diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index daec1666314a7..2365098deb9a4 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -5,7 +5,7 @@ Here's a checklist you might find useful. * [ ] There is an associated issue that is labeled 'Bug' or 'help wanted' or is in the Community milestone * [ ] Code is up-to-date with the `master` branch -* [ ] You've successfully run `jake runtests` locally +* [ ] You've successfully run `gulp runtests` locally * [ ] You've signed the CLA * [ ] There are new or updated unit tests validating the change diff --git a/.npmignore b/.npmignore index 6054bfbdb3705..482633f48fc40 100644 --- a/.npmignore +++ b/.npmignore @@ -12,7 +12,11 @@ tests tslint.json Jakefile.js .editorconfig +.failed-tests +.git +.git/ .gitattributes +.github/ .gitmodules .settings/ .travis.yml @@ -23,6 +27,5 @@ Jakefile.js test.config package-lock.json yarn.lock -.github/ CONTRIBUTING.md TEST-results.xml diff --git a/.travis.yml b/.travis.yml index 0f720b7375e62..b35dabcbb5f74 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: node_js node_js: - 'node' - '10' - - '6' + - '8' sudo: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 980f84a380088..4b58cc2875a78 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,7 +55,7 @@ The TypeScript repository is relatively large. To save some time, you might want ### Using local builds -Run `gulp build` to build a version of the compiler/language service that reflects changes you've made. You can then run `node /built/local/tsc.js` in place of `tsc` in your project. For example, to run `tsc --watch` from within the root of the repository on a file called `test.ts`, you can run `node ./built/local/tsc.js --watch test.ts`. +Run `gulp` to build a version of the compiler/language service that reflects changes you've made. You can then run `node /built/local/tsc.js` in place of `tsc` in your project. For example, to run `tsc --watch` from within the root of the repository on a file called `test.ts`, you can run `node ./built/local/tsc.js --watch test.ts`. ## Contributing bug fixes @@ -104,7 +104,7 @@ Any changes should be made to [src/lib](https://github.com/Microsoft/TypeScript/ Library files in `built/local/` are updated automatically by running the standard build task: ```sh -jake +gulp ``` The files in `lib/` are used to bootstrap compilation and usually **should not** be updated unless publishing a new version or updating the LKG. @@ -115,49 +115,49 @@ The files `src/lib/dom.generated.d.ts` and `src/lib/webworker.generated.d.ts` bo ## Running the Tests -To run all tests, invoke the `runtests-parallel` target using jake: +To run all tests, invoke the `runtests-parallel` target using gulp: ```Shell -jake runtests-parallel +gulp runtests-parallel ``` This will run all tests; to run only a specific subset of tests, use: ```Shell -jake runtests tests= +gulp runtests --tests= ``` e.g. to run all compiler baseline tests: ```Shell -jake runtests tests=compiler +gulp runtests --tests=compiler ``` or to run a specific test: `tests\cases\compiler\2dArrays.ts` ```Shell -jake runtests tests=2dArrays +gulp runtests --tests=2dArrays ``` ## Debugging the tests -To debug the tests, invoke the `runtests-browser` task from jake. +To debug the tests, invoke the `runtests-browser` task from gulp. You will probably only want to debug one test at a time: ```Shell -jake runtests-browser tests=2dArrays +gulp runtests-browser --tests=2dArrays ``` You can specify which browser to use for debugging. Currently Chrome and IE are supported: ```Shell -jake runtests-browser tests=2dArrays browser=chrome +gulp runtests-browser --tests=2dArrays --browser=chrome ``` -You can debug with VS Code or Node instead with `jake runtests inspect=true`: +You can debug with VS Code or Node instead with `gulp runtests --inspect=true`: ```Shell -jake runtests tests=2dArrays inspect=true +gulp runtests --tests=2dArrays --inspect=true ``` ## Adding a Test @@ -197,13 +197,13 @@ Compiler testcases generate baselines that track the emitted `.js`, the errors p When a change in the baselines is detected, the test will fail. To inspect changes vs the expected baselines, use ```Shell -jake diff +gulp diff ``` After verifying that the changes in the baselines are correct, run ```Shell -jake baseline-accept +gulp baseline-accept ``` to establish the new baselines as the desired behavior. This will change the files in `tests\baselines\reference`, which should be included as part of your commit. It's important to carefully validate changes in the baselines. @@ -211,6 +211,6 @@ to establish the new baselines as the desired behavior. This will change the fil ## Localization All strings the user may see are stored in [`diagnosticMessages.json`](./src/compiler/diagnosticMessages.json). -If you make changes to it, run `jake generate-diagnostics` to push them to the `Diagnostic` interface in `diagnosticInformationMap.generated.ts`. +If you make changes to it, run `gulp generate-diagnostics` to push them to the `Diagnostic` interface in `diagnosticInformationMap.generated.ts`. See [coding guidelines on diagnostic messages](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines#diagnostic-messages). diff --git a/Gulpfile.js b/Gulpfile.js index 68a2b79f222e9..3ce488caeddf2 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -232,7 +232,7 @@ task("watch-tsserver").flags = { " --built": "Compile using the built version of the compiler." } -task("min", series(lkgPreBuild, parallel(buildTsc, buildServer))); +task("min", series(preBuild, parallel(buildTsc, buildServer))); task("min").description = "Builds only tsc and tsserver"; task("min").flags = { " --built": "Compile using the built version of the compiler." @@ -373,9 +373,34 @@ task("lint").flags = { " --f[iles]=": "pattern to match files to lint", }; +const buildCancellationToken = () => buildProject("src/cancellationToken"); +const cleanCancellationToken = () => cleanProject("src/cancellationToken"); +cleanTasks.push(cleanCancellationToken); + +const buildTypingsInstaller = () => buildProject("src/typingsInstaller"); +const cleanTypingsInstaller = () => cleanProject("src/typingsInstaller"); +cleanTasks.push(cleanTypingsInstaller); + +const buildWatchGuard = () => buildProject("src/watchGuard"); +const cleanWatchGuard = () => cleanProject("src/watchGuard"); +cleanTasks.push(cleanWatchGuard); + +const generateTypesMap = () => src("src/server/typesMap.json") + .pipe(newer("built/local/typesMap.json")) + .pipe(transform(contents => (JSON.parse(contents), contents))) // validates typesMap.json is valid JSON + .pipe(dest("built/local")); +task("generate-types-map", generateTypesMap); + +const cleanTypesMap = () => del("built/local/typesMap.json"); +cleanTasks.push(cleanTypesMap); + +const buildOtherOutputs = parallel(buildCancellationToken, buildTypingsInstaller, buildWatchGuard, generateTypesMap); +task("other-outputs", series(preBuild, buildOtherOutputs)); +task("other-outputs").description = "Builds miscelaneous scripts and documents distributed with the LKG"; + const buildFoldStart = async () => { if (fold.isTravis()) console.log(fold.start("build")); }; const buildFoldEnd = async () => { if (fold.isTravis()) console.log(fold.end("build")); }; -task("local", series(buildFoldStart, lkgPreBuild, parallel(localize, buildTsc, buildServer, buildServices, buildLssl), buildFoldEnd)); +task("local", series(buildFoldStart, preBuild, parallel(localize, buildTsc, buildServer, buildServices, buildLssl, buildOtherOutputs), buildFoldEnd)); task("local").description = "Builds the full compiler and services"; task("local").flags = { " --built": "Compile using the built version of the compiler." @@ -473,22 +498,23 @@ task("diff").description = "Diffs the compiler baselines using the diff tool spe task("diff-rwc", () => exec(getDiffTool(), [refRwcBaseline, localRwcBaseline], { ignoreExitCode: true })); task("diff-rwc").description = "Diffs the RWC baselines using the diff tool specified by the 'DIFF' environment variable"; -const baselineAccept = subfolder => merge2( - src([`${localBaseline}${subfolder ? `${subfolder}/` : ``}**`, `!${localBaseline}${subfolder}/**/*.delete`], { base: localBaseline }) +/** + * @param {string} localBaseline Path to the local copy of the baselines + * @param {string} refBaseline Path to the reference copy of the baselines + */ +const baselineAccept = (localBaseline, refBaseline) => merge2( + src([`${localBaseline}/**`, `!${localBaseline}/**/*.delete`], { base: localBaseline }) .pipe(dest(refBaseline)), - src([`${localBaseline}${subfolder ? `${subfolder}/` : ``}**/*.delete`], { base: localBaseline, read: false }) + src([`${localBaseline}/**/*.delete`], { base: localBaseline, read: false }) .pipe(rm()) .pipe(rename({ extname: "" })) .pipe(rm(refBaseline))); -task("baseline-accept", () => baselineAccept("")); +task("baseline-accept", () => baselineAccept(localBaseline, refBaseline)); task("baseline-accept").description = "Makes the most recent test results the new baseline, overwriting the old baseline"; -task("baseline-accept-rwc", () => baselineAccept("rwc")); +task("baseline-accept-rwc", () => baselineAccept(localRwcBaseline, refRwcBaseline)); task("baseline-accept-rwc").description = "Makes the most recent rwc test results the new baseline, overwriting the old baseline"; -task("baseline-accept-test262", () => baselineAccept("test262")); -task("baseline-accept-test262").description = "Makes the most recent test262 test results the new baseline, overwriting the old baseline"; - // TODO(rbuckton): Determine if 'webhost' is still in use. const buildWebHost = () => buildProject("tests/webhost/webtsc.tsconfig.json"); task("webhost", series(lkgPreBuild, buildWebHost)); @@ -550,28 +576,6 @@ const buildReleaseTsc = () => buildProject("src/tsc/tsconfig.release.json"); const cleanReleaseTsc = () => cleanProject("src/tsc/tsconfig.release.json"); cleanTasks.push(cleanReleaseTsc); -const buildCancellationToken = () => buildProject("src/cancellationToken"); -const cleanCancellationToken = () => cleanProject("src/cancellationToken"); -cleanTasks.push(cleanCancellationToken); - -const buildTypingsInstaller = () => buildProject("src/typingsInstaller"); -const cleanTypingsInstaller = () => cleanProject("src/typingsInstaller"); -cleanTasks.push(cleanTypingsInstaller); - -const buildWatchGuard = () => buildProject("src/watchGuard"); -const cleanWatchGuard = () => cleanProject("src/watchGuard"); -cleanTasks.push(cleanWatchGuard); - -// TODO(rbuckton): This task isn't triggered by any other task. Is it still needed? -const generateTypesMap = () => src("src/server/typesMap.json") - .pipe(newer("built/local/typesMap.json")) - .pipe(transform(contents => (JSON.parse(contents), contents))) // validates typesMap.json is valid JSON - .pipe(dest("built/local")); -task("generate-types-map", generateTypesMap); - -const cleanTypesMap = () => del("built/local/typesMap.json"); -cleanTasks.push(cleanTypesMap); - const cleanBuilt = () => del("built"); const produceLKG = async () => { @@ -601,7 +605,7 @@ const produceLKG = async () => { } }; -task("LKG", series(lkgPreBuild, parallel(localize, buildTsc, buildServer, buildServices, buildLssl, buildCancellationToken, buildTypingsInstaller, buildWatchGuard, buildReleaseTsc), produceLKG)); +task("LKG", series(lkgPreBuild, parallel(localize, buildTsc, buildServer, buildServices, buildLssl, buildOtherOutputs, buildReleaseTsc), produceLKG)); task("LKG").description = "Makes a new LKG out of the built js files"; task("LKG").flags = { " --built": "Compile using the built version of the compiler.", @@ -618,6 +622,10 @@ const configureNightly = () => exec(process.execPath, ["scripts/configurePrerele task("configure-nightly", series(buildScripts, configureNightly)); task("configure-nightly").description = "Runs scripts/configurePrerelease.ts to prepare a build for nightly publishing"; +const configureInsiders = () => exec(process.execPath, ["scripts/configurePrerelease.js", "insiders", "package.json", "src/compiler/core.ts"]) +task("configure-insiders", series(buildScripts, configureInsiders)); +task("configure-insiders").description = "Runs scripts/configurePrerelease.ts to prepare a build for insiders publishing"; + const publishNightly = () => exec("npm", ["publish", "--tag", "next"]); task("publish-nightly", series(task("clean"), task("LKG"), task("clean"), task("runtests-parallel"), publishNightly)); task("publish-nightly").description = "Runs `npm publish --tag next` to create a new nightly build on npm"; diff --git a/Jakefile.js b/Jakefile.js deleted file mode 100644 index c6b1cde9d4e2b..0000000000000 --- a/Jakefile.js +++ /dev/null @@ -1,860 +0,0 @@ -// This file contains the build logic for the public repo -// @ts-check -/// - -const fs = require("fs"); -const os = require("os"); -const path = require("path"); -const fold = require("travis-fold"); -const ts = require("./lib/typescript"); -const del = require("del"); -const { getDirSize, needsUpdate, flatten } = require("./scripts/build/utils"); -const { base64VLQFormatEncode } = require("./scripts/build/sourcemaps"); - -// add node_modules to path so we don't need global modules, prefer the modules by adding them first -var nodeModulesPathPrefix = path.resolve("./node_modules/.bin/") + path.delimiter; -if (process.env.path !== undefined) { - process.env.path = nodeModulesPathPrefix + process.env.path; -} -else if (process.env.PATH !== undefined) { - process.env.PATH = nodeModulesPathPrefix + process.env.PATH; -} - -const host = process.env.TYPESCRIPT_HOST || process.env.host || "node"; - -const defaultTestTimeout = 40000; -const useBuilt = - process.env.USE_BUILT === "true" ? true : - process.env.LKG === "true" ? false : - false; - -let useDebugMode = true; - -const TaskNames = { - local: "local", - runtests: "runtests", - runtestsParallel: "runtests-parallel", - buildRules: "build-rules", - clean: "clean", - lib: "lib", - buildFoldStart: "build-fold-start", - buildFoldEnd: "build-fold-end", - generateDiagnostics: "generate-diagnostics", - coreBuild: "core-build", - tsc: "tsc", - lkg: "LKG", - release: "release", - lssl: "lssl", - lint: "lint", - scripts: "scripts", - localize: "localize", - configureInsiders: "configure-insiders", - publishInsiders: "publish-insiders", - configureNightly: "configure-nightly", - publishNightly: "publish-nightly", - help: "help" -}; - -const Paths = {}; -Paths.lkg = "lib"; -Paths.lkgCompiler = "lib/tsc.js"; -Paths.built = "built"; -Paths.builtLocal = "built/local"; -Paths.builtLocalCompiler = "built/local/tsc.js"; -Paths.builtLocalTSServer = "built/local/tsserver.js"; -Paths.builtLocalRun = "built/local/run.js"; -Paths.releaseCompiler = "built/local/tsc.release.js"; -Paths.typesMapOutput = "built/local/typesMap.json"; -Paths.typescriptFile = "built/local/typescript.js"; -Paths.servicesFile = "built/local/typescriptServices.js"; -Paths.servicesDefinitionFile = "built/local/typescriptServices.d.ts"; -Paths.servicesOutFile = "built/local/typescriptServices.out.js"; -Paths.servicesDefinitionOutFile = "built/local/typescriptServices.out.d.ts"; -Paths.typescriptDefinitionFile = "built/local/typescript.d.ts"; -Paths.typescriptStandaloneDefinitionFile = "built/local/typescript_standalone.d.ts"; -Paths.tsserverLibraryFile = "built/local/tsserverlibrary.js"; -Paths.tsserverLibraryDefinitionFile = "built/local/tsserverlibrary.d.ts"; -Paths.tsserverLibraryOutFile = "built/local/tsserverlibrary.out.js"; -Paths.tsserverLibraryDefinitionOutFile = "built/local/tsserverlibrary.out.d.ts"; -Paths.baselines = {}; -Paths.baselines.local = "tests/baselines/local"; -Paths.baselines.localTest262 = "tests/baselines/test262/local"; -Paths.baselines.localRwc = "internal/baselines/rwc/local"; -Paths.baselines.reference = "tests/baselines/reference"; -Paths.baselines.referenceTest262 = "tests/baselines/test262/reference"; -Paths.baselines.referenceRwc = "internal/baselines/rwc/reference"; -Paths.copyright = "CopyrightNotice.txt"; -Paths.thirdParty = "ThirdPartyNoticeText.txt"; -Paths.processDiagnosticMessagesJs = "scripts/processDiagnosticMessages.js"; -Paths.diagnosticInformationMap = "src/compiler/diagnosticInformationMap.generated.ts"; -Paths.diagnosticMessagesJson = "src/compiler/diagnosticMessages.json"; -Paths.diagnosticGeneratedJson = "src/compiler/diagnosticMessages.generated.json"; -Paths.builtDiagnosticGeneratedJson = "built/local/diagnosticMessages.generated.json"; -Paths.lcl = "src/loc/lcl" -Paths.locLcg = "built/local/enu/diagnosticMessages.generated.json.lcg"; -Paths.generatedLCGFile = path.join(Paths.builtLocal, "enu", "diagnosticMessages.generated.json.lcg"); -Paths.library = "src/lib"; -Paths.srcServer = "src/server"; -Paths.scripts = {}; -Paths.scripts.generateLocalizedDiagnosticMessages = "scripts/generateLocalizedDiagnosticMessages.js"; -Paths.scripts.processDiagnosticMessages = "scripts/processDiagnosticMessages.js"; -Paths.scripts.produceLKG = "scripts/produceLKG.js"; -Paths.scripts.configurePrerelease = "scripts/configurePrerelease.js"; -Paths.packageJson = "package.json"; -Paths.versionFile = "src/compiler/core.ts"; - -const ConfigFileFor = { - tsc: "src/tsc", - tscRelease: "src/tsc/tsconfig.release.json", - tsserver: "src/tsserver", - runjs: "src/testRunner", - lint: "scripts/tslint", - scripts: "scripts", - all: "src", - typescriptServices: "built/local/typescriptServices.tsconfig.json", - tsserverLibrary: "built/local/tsserverlibrary.tsconfig.json", -}; - -const ExpectedLKGFiles = [ - "tsc.js", - "tsserver.js", - "typescriptServices.js", - "typescriptServices.d.ts", - "typescript.js", - "typescript.d.ts", - "cancellationToken.js", - "typingsInstaller.js", - "protocol.d.ts", - "watchGuard.js" -]; - -directory(Paths.builtLocal); - -// Local target to build the compiler and services -desc("Builds the full compiler and services"); -task(TaskNames.local, [ - TaskNames.buildFoldStart, - TaskNames.coreBuild, - Paths.servicesDefinitionFile, - Paths.typescriptFile, - Paths.typescriptDefinitionFile, - Paths.typescriptStandaloneDefinitionFile, - Paths.tsserverLibraryDefinitionFile, - TaskNames.localize, - TaskNames.buildFoldEnd -]); - -task("default", [TaskNames.local]); - -const RunTestsPrereqs = [TaskNames.lib, Paths.servicesDefinitionFile, Paths.typescriptDefinitionFile, Paths.tsserverLibraryDefinitionFile]; -desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... i[nspect]=true."); -task(TaskNames.runtestsParallel, RunTestsPrereqs, function () { - tsbuild([ConfigFileFor.runjs], true, () => { - runConsoleTests("min", /*parallel*/ true); - }); -}, { async: true }); - -desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... i[nspect]=true."); -task(TaskNames.runtests, RunTestsPrereqs, function () { - tsbuild([ConfigFileFor.runjs], true, () => { - runConsoleTests('mocha-fivemat-progress-reporter', /*runInParallel*/ false); - }); -}, { async: true }); - -desc("Generates a diagnostic file in TypeScript based on an input JSON file"); -task(TaskNames.generateDiagnostics, [Paths.diagnosticInformationMap]); - -const libraryTargets = getLibraryTargets(); -desc("Builds the library targets"); -task(TaskNames.lib, libraryTargets); - -desc("Builds internal scripts"); -task(TaskNames.scripts, [TaskNames.coreBuild], function() { - tsbuild([ConfigFileFor.scripts], true, () => { - complete(); - }); -}, { async: true }); - -task(Paths.releaseCompiler, function () { - tsbuild([ConfigFileFor.tscRelease], true, () => { - complete(); - }); -}, { async: true }); - -// 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(TaskNames.lkg, [ - TaskNames.scripts, - TaskNames.release, - TaskNames.local, - Paths.servicesDefinitionFile, - Paths.typescriptFile, - Paths.typescriptDefinitionFile, - Paths.typescriptStandaloneDefinitionFile, - Paths.tsserverLibraryDefinitionFile, - Paths.releaseCompiler, - ...libraryTargets -], () => { - const sizeBefore = getDirSize(Paths.lkg); - - exec(`${host} ${Paths.scripts.produceLKG}`, () => { - const sizeAfter = getDirSize(Paths.lkg); - if (sizeAfter > (sizeBefore * 1.10)) { - throw new Error("The lib folder increased by 10% or more. This likely indicates a bug."); - } - - complete(); - }); -}, { async: true }); - -desc("Makes the most recent test results the new baseline, overwriting the old baseline"); -task("baseline-accept", function () { - acceptBaseline(Paths.baselines.local, Paths.baselines.reference); -}); - -desc("Makes the most recent rwc test results the new baseline, overwriting the old baseline"); -task("baseline-accept-rwc", function () { - acceptBaseline(Paths.baselines.localRwc, Paths.baselines.referenceRwc); -}); - -desc("Makes the most recent test262 test results the new baseline, overwriting the old baseline"); -task("baseline-accept-test262", function () { - acceptBaseline(Paths.baselines.localTest262, Paths.baselines.referenceTest262); -}); - -desc("Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex"); -task(TaskNames.lint, [TaskNames.buildRules], () => { - if (fold.isTravis()) console.log(fold.start("lint")); - function lint(project, cb) { - const fix = process.env.fix || process.env.f; - const cmd = `node node_modules/tslint/bin/tslint --project ${project} --formatters-dir ./built/local/tslint/formatters --format autolinkableStylish${fix ? " --fix" : ""}`; - exec(cmd, cb); - } - lint("scripts/tslint/tsconfig.json", () => lint("src/tsconfig-base.json", () => { - if (fold.isTravis()) console.log(fold.end("lint")); - complete(); - })); -}, { async: true }); - -desc("Diffs the compiler baselines using the diff tool specified by the 'DIFF' environment variable"); -task('diff', function () { - var cmd = `"${getDiffTool()}" ${Paths.baselines.reference} ${Paths.baselines.local}`; - exec(cmd); -}, { async: true }); - -desc("Diffs the RWC baselines using the diff tool specified by the 'DIFF' environment variable"); -task('diff-rwc', function () { - var cmd = `"${getDiffTool()}" ${Paths.baselines.referenceRwc} ${Paths.baselines.localRwc}`; - exec(cmd); -}, { async: true }); - -task(TaskNames.configureNightly, [TaskNames.scripts], function () { - const cmd = `${host} ${Paths.scripts.configurePrerelease} dev ${Paths.packageJson} ${Paths.versionFile}`; - exec(cmd, () => complete()); -}, { async: true }); - -desc("Configure, build, test, and publish the nightly release."); -task(TaskNames.publishNightly, [TaskNames.coreBuild, TaskNames.configureNightly, TaskNames.lkg, "setDebugMode", "runtests-parallel"], function () { - var cmd = "npm publish --tag next"; - exec(cmd, () => complete()); -}, { async: true }); - -task(TaskNames.help, function() { - var cmd = "jake --tasks"; - exec(cmd, () => complete()); -}) - -task(TaskNames.configureInsiders, [TaskNames.scripts], function () { - const cmd = `${host} ${Paths.scripts.configurePrerelease} insiders ${Paths.packageJson} ${Paths.versionFile}`; - exec(cmd, () => complete()); -}, { async: true }); - -desc("Configure, build, test, and publish the insiders release."); -task(TaskNames.publishInsiders, [TaskNames.coreBuild, TaskNames.configureInsiders, TaskNames.lkg, "setDebugMode", "runtests-parallel"], function () { - var cmd = "npm publish --tag insiders"; - exec(cmd, () => complete()); -}, { async: true }); - -desc("Sets the release mode flag"); -task("release", function () { - useDebugMode = false; -}); - -desc("Clears the release mode flag"); -task("setDebugMode", function () { - useDebugMode = true; -}); - -desc("Generates localized diagnostic messages"); -task(TaskNames.localize, [Paths.generatedLCGFile]); - -desc("Emit the start of the build fold"); -task(TaskNames.buildFoldStart, [], function () { - if (fold.isTravis()) console.log(fold.start("build")); -}); - -desc("Emit the end of the build fold"); -task(TaskNames.buildFoldEnd, [], function () { - if (fold.isTravis()) console.log(fold.end("build")); -}); - -desc("Compiles tslint rules to js"); -task(TaskNames.buildRules, [], function () { - tsbuild(ConfigFileFor.lint, !useBuilt, () => complete()); -}, { async: true }); - -desc("Cleans the compiler output, declare files, and tests"); -task(TaskNames.clean, function () { - jake.rmRf(Paths.built); -}); - -desc("Generates the LCG file for localization"); -task("localize", [Paths.generatedLCGFile]); - -task(TaskNames.tsc, [Paths.diagnosticInformationMap, TaskNames.lib], function () { - tsbuild(ConfigFileFor.tsc, true, () => { - complete(); - }); -}, { async: true }); - -task(TaskNames.coreBuild, [Paths.diagnosticInformationMap, TaskNames.lib], function () { - tsbuild(ConfigFileFor.all, true, () => { - complete(); - }); -}, { async: true }); - -file(Paths.diagnosticMessagesJson); - -file(Paths.typesMapOutput, /** @type {*} */(function () { - var content = readFileSync(path.join(Paths.srcServer, 'typesMap.json')); - // Validate that it's valid JSON - try { - JSON.parse(content); - } catch (e) { - console.log("Parse error in typesMap.json: " + e); - } - fs.writeFileSync(Paths.typesMapOutput, content); -})); - -file(Paths.builtDiagnosticGeneratedJson, [Paths.diagnosticGeneratedJson], function () { - if (fs.existsSync(Paths.builtLocal)) { - jake.cpR(Paths.diagnosticGeneratedJson, Paths.builtDiagnosticGeneratedJson); - } -}); - -// Localized diagnostics -file(Paths.generatedLCGFile, [TaskNames.scripts, Paths.diagnosticInformationMap, Paths.diagnosticGeneratedJson], function () { - const cmd = `${host} ${Paths.scripts.generateLocalizedDiagnosticMessages} ${Paths.lcl} ${Paths.builtLocal} ${Paths.diagnosticGeneratedJson}` - exec(cmd, complete); -}, { async: true }); - - -// The generated diagnostics map; built for the compiler and for the 'generate-diagnostics' task -file(Paths.diagnosticInformationMap, [Paths.diagnosticMessagesJson], function () { - tsbuild(ConfigFileFor.scripts, true, () => { - const cmd = `${host} ${Paths.scripts.processDiagnosticMessages} ${Paths.diagnosticMessagesJson}`; - exec(cmd, complete); - }); -}, { async: true }); - -file(ConfigFileFor.tsserverLibrary, [], function () { - flatten("src/tsserver/tsconfig.json", ConfigFileFor.tsserverLibrary, { - exclude: ["src/tsserver/server.ts"], - compilerOptions: { - "removeComments": false, - "stripInternal": true, - "declaration": true, - "outFile": "tsserverlibrary.out.js" - } - }) -}); - -// tsserverlibrary.js -// tsserverlibrary.d.ts -file(Paths.tsserverLibraryFile, [TaskNames.coreBuild, ConfigFileFor.tsserverLibrary], function() { - tsbuild(ConfigFileFor.tsserverLibrary, !useBuilt, () => { - if (needsUpdate([Paths.tsserverLibraryOutFile, Paths.tsserverLibraryDefinitionOutFile], [Paths.tsserverLibraryFile, Paths.tsserverLibraryDefinitionFile])) { - const copyright = readFileSync(Paths.copyright); - - let libraryDefinitionContent = readFileSync(Paths.tsserverLibraryDefinitionOutFile); - libraryDefinitionContent = copyright + removeConstModifierFromEnumDeclarations(libraryDefinitionContent); - libraryDefinitionContent += "\nexport = ts;\nexport as namespace ts;"; - fs.writeFileSync(Paths.tsserverLibraryDefinitionFile, libraryDefinitionContent, "utf8"); - - let libraryContent = readFileSync(Paths.tsserverLibraryOutFile); - libraryContent = copyright + libraryContent; - fs.writeFileSync(Paths.tsserverLibraryFile, libraryContent, "utf8"); - - // adjust source map for tsserverlibrary.js - let libraryMapContent = readFileSync(Paths.tsserverLibraryOutFile + ".map"); - const map = JSON.parse(libraryMapContent); - const lineStarts = /**@type {*}*/(ts).computeLineStarts(copyright); - let prependMappings = ""; - for (let i = 1; i < lineStarts.length; i++) { - prependMappings += ";"; - } - - const offset = copyright.length - lineStarts[lineStarts.length - 1]; - if (offset > 0) { - prependMappings += base64VLQFormatEncode(offset) + ","; - } - - const outputMap = { - version: map.version, - file: map.file, - sources: map.sources, - sourceRoot: map.sourceRoot, - mappings: prependMappings + map.mappings, - names: map.names, - sourcesContent: map.sourcesContent - }; - - libraryMapContent = JSON.stringify(outputMap); - fs.writeFileSync(Paths.tsserverLibraryFile + ".map", libraryMapContent); - } - complete(); - }); -}, { async: true }); -task(Paths.tsserverLibraryDefinitionFile, [Paths.tsserverLibraryFile]); - -file(ConfigFileFor.typescriptServices, [], function () { - flatten("src/services/tsconfig.json", ConfigFileFor.typescriptServices, { - compilerOptions: { - "removeComments": false, - "stripInternal": true, - "declarationMap": false, - "outFile": "typescriptServices.out.js" - } - }); -}); - -// typescriptServices.js -// typescriptServices.d.ts -file(Paths.servicesFile, [TaskNames.coreBuild, ConfigFileFor.typescriptServices], function() { - tsbuild(ConfigFileFor.typescriptServices, !useBuilt, () => { - if (needsUpdate([Paths.servicesOutFile, Paths.servicesDefinitionOutFile], [Paths.servicesFile, Paths.servicesDefinitionFile])) { - const copyright = readFileSync(Paths.copyright); - - let servicesDefinitionContent = readFileSync(Paths.servicesDefinitionOutFile); - servicesDefinitionContent = copyright + removeConstModifierFromEnumDeclarations(servicesDefinitionContent); - fs.writeFileSync(Paths.servicesDefinitionFile, servicesDefinitionContent, "utf8"); - - let servicesContent = readFileSync(Paths.servicesOutFile); - servicesContent = copyright + servicesContent; - fs.writeFileSync(Paths.servicesFile, servicesContent, "utf8"); - - // adjust source map for typescriptServices.js - let servicesMapContent = readFileSync(Paths.servicesOutFile + ".map"); - const map = JSON.parse(servicesMapContent); - const lineStarts = /**@type {*}*/(ts).computeLineStarts(copyright); - let prependMappings = ""; - for (let i = 1; i < lineStarts.length; i++) { - prependMappings += ";"; - } - - const offset = copyright.length - lineStarts[lineStarts.length - 1]; - if (offset > 0) { - prependMappings += base64VLQFormatEncode(offset) + ","; - } - - const outputMap = { - version: map.version, - file: map.file, - sources: map.sources, - sourceRoot: map.sourceRoot, - mappings: prependMappings + map.mappings, - names: map.names, - sourcesContent: map.sourcesContent - }; - - servicesMapContent = JSON.stringify(outputMap); - fs.writeFileSync(Paths.servicesFile + ".map", servicesMapContent); - } - - complete(); - }); -}, { async: true }); -task(Paths.servicesDefinitionFile, [Paths.servicesFile]); - -// typescript.js -// typescript.d.ts -file(Paths.typescriptFile, [Paths.servicesFile], function() { - if (needsUpdate([Paths.servicesFile, Paths.servicesDefinitionFile], [Paths.typescriptFile, Paths.typescriptDefinitionFile])) { - jake.cpR(Paths.servicesFile, Paths.typescriptFile); - if (fs.existsSync(Paths.servicesFile + ".map")) { - jake.cpR(Paths.servicesFile + ".map", Paths.typescriptFile + ".map"); - } - const content = readFileSync(Paths.servicesDefinitionFile); - fs.writeFileSync(Paths.typescriptDefinitionFile, content + "\r\nexport = ts;", { encoding: "utf-8" }); - } -}); -task(Paths.typescriptDefinitionFile, [Paths.typescriptFile]); - -// typescript_standalone.d.ts -file(Paths.typescriptStandaloneDefinitionFile, [Paths.servicesDefinitionFile], function() { - if (needsUpdate(Paths.servicesDefinitionFile, Paths.typescriptStandaloneDefinitionFile)) { - const content = readFileSync(Paths.servicesDefinitionFile); - fs.writeFileSync(Paths.typescriptStandaloneDefinitionFile, content.replace(/declare (namespace|module) ts(\..+)? \{/g, 'declare module "typescript" {'), { encoding: "utf-8"}); - } -}); - -function getLibraryTargets() { - /** @type {{ libs: string[], paths?: Record, sources?: Record }} */ - const libraries = readJson("./src/lib/libs.json"); - return libraries.libs.map(function (lib) { - const relativeSources = ["header.d.ts"].concat(libraries.sources && libraries.sources[lib] || [lib + ".d.ts"]); - const relativeTarget = libraries.paths && libraries.paths[lib] || ("lib." + lib + ".d.ts"); - const sources = [Paths.copyright].concat(relativeSources.map(s => path.join(Paths.library, s))); - const target = path.join(Paths.builtLocal, relativeTarget); - file(target, [Paths.builtLocal].concat(sources), function () { - concatenateFiles(target, sources); - }); - return target; - }); -} - -function runConsoleTests(defaultReporter, runInParallel) { - var dirty = process.env.dirty; - if (!dirty) { - cleanTestDirs(); - } - - let testTimeout = process.env.timeout || defaultTestTimeout; - const inspect = process.env.inspect || process.env["inspect-brk"] || process.env.i; - const runners = process.env.runners || process.env.runner || process.env.ru; - const tests = process.env.test || process.env.tests || process.env.t; - const light = process.env.light === undefined || process.env.light !== "false"; - const failed = process.env.failed; - const keepFailed = process.env.keepFailed || failed; - const stackTraceLimit = process.env.stackTraceLimit; - const colorsFlag = process.env.color || process.env.colors; - const colors = colorsFlag !== "false" && colorsFlag !== "0"; - const reporter = process.env.reporter || process.env.r || defaultReporter; - const bail = process.env.bail || process.env.b; - const lintFlag = process.env.lint !== 'false'; - const testConfigFile = 'test.config'; - - if (fs.existsSync(testConfigFile)) { - fs.unlinkSync(testConfigFile); - } - - let workerCount, taskConfigsFolder; - if (runInParallel) { - // generate name to store task configuration files - const prefix = os.tmpdir() + "/ts-tests"; - let i = 1; - do { - taskConfigsFolder = prefix + i; - i++; - } while (fs.existsSync(taskConfigsFolder)); - fs.mkdirSync(taskConfigsFolder); - - workerCount = process.env.workerCount || process.env.p || os.cpus().length; - } - - if (tests && tests.toLocaleLowerCase() === "rwc") { - testTimeout = 800000; - } - - if (tests || runners || light || testTimeout || taskConfigsFolder || keepFailed) { - writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, colors, testTimeout, keepFailed); - } - - // timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally - // default timeout is 2sec which really should be enough, but maybe we just need a small amount longer - if (!runInParallel) { - var startTime = Travis.mark(); - var args = []; - args.push("-R", "scripts/failed-tests"); - args.push("-O", '"reporter=' + reporter + (keepFailed ? ",keepFailed=true" : "") + '"'); - if (tests) args.push("-g", `"${tests}"`); - args.push(colors ? "--colors" : "--no-colors"); - if (bail) args.push("--bail"); - if (inspect) { - args.unshift("--inspect-brk"); - } else { - args.push("-t", testTimeout); - } - args.push(Paths.builtLocalRun); - - var cmd; - if (failed) { - args.unshift("scripts/run-failed-tests.js"); - cmd = host + " " + args.join(" "); - } - else { - cmd = "mocha " + args.join(" "); - } - var savedNodeEnv = process.env.NODE_ENV; - process.env.NODE_ENV = "development"; - exec(cmd, function () { - process.env.NODE_ENV = savedNodeEnv; - Travis.measure(startTime); - runLinterAndComplete(); - }, function (e, status) { - process.env.NODE_ENV = savedNodeEnv; - Travis.measure(startTime); - finish(status); - }); - } - else { - var savedNodeEnv = process.env.NODE_ENV; - process.env.NODE_ENV = "development"; - var startTime = Travis.mark(); - const cmd = `${host} ${Paths.builtLocalRun}`; - exec(cmd, function () { - // Tests succeeded; run 'lint' task - process.env.NODE_ENV = savedNodeEnv; - Travis.measure(startTime); - runLinterAndComplete(); - }, function (e, status) { - // Tests failed - process.env.NODE_ENV = savedNodeEnv; - Travis.measure(startTime); - finish(status); - }); - } - - function finish(errorStatus) { - deleteTemporaryProjectOutput(); - if (errorStatus !== undefined) { - fail("Process exited with code " + errorStatus); - } - else { - complete(); - } - } - - function runLinterAndComplete() { - if (!lintFlag || dirty) { - return finish(); - } - var lint = jake.Task['lint']; - lint.once('complete', function () { - finish(); - }); - lint.invoke(); - } - - function deleteTemporaryProjectOutput() { - if (fs.existsSync(path.join(Paths.baselines.local, "projectOutput/"))) { - jake.rmRf(path.join(Paths.baselines.local, "projectOutput/")); - } - } -} - -// used to pass data from jake command line directly to run.js -function writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, colors, testTimeout, keepFailed) { - var testConfigContents = JSON.stringify({ - runners: runners ? runners.split(",") : undefined, - test: tests ? [tests] : undefined, - light: light, - workerCount: workerCount, - taskConfigsFolder: taskConfigsFolder, - stackTraceLimit: stackTraceLimit, - noColor: !colors, - timeout: testTimeout, - keepFailed: keepFailed - }); - fs.writeFileSync('test.config', testConfigContents, { encoding: "utf-8" }); -} - -function cleanTestDirs() { - // Clean the local baselines directory - if (fs.existsSync(Paths.baselines.local)) { - del.sync(Paths.baselines.local); - } - - // Clean the local Rwc baselines directory - if (fs.existsSync(Paths.baselines.localRwc)) { - del.sync(Paths.baselines.localRwc); - } - - jake.mkdirP(Paths.baselines.local); - jake.mkdirP(Paths.baselines.localTest262); -} - -function tsbuild(tsconfigPath, useLkg = true, done = undefined) { - const startCompileTime = Travis.mark(); - const compilerPath = useLkg ? Paths.lkgCompiler : Paths.builtLocalCompiler; - const cmd = `${host} ${compilerPath} -b ${Array.isArray(tsconfigPath) ? tsconfigPath.join(" ") : tsconfigPath}`; - - exec(cmd, () => { - // Success - Travis.measure(startCompileTime); - done ? done() : complete(); - }, () => { - // Fail - Travis.measure(startCompileTime); - fail(`Compilation of ${tsconfigPath} unsuccessful`); - }); -} - -const Travis = { - mark() { - if (!fold.isTravis()) return; - var stamp = process.hrtime(); - var id = Math.floor(Math.random() * 0xFFFFFFFF).toString(16); - console.log("travis_time:start:" + id + "\r"); - return { - stamp: stamp, - id: id - }; - }, - measure(marker) { - if (!fold.isTravis()) return; - var diff = process.hrtime(marker.stamp); - var total = [marker.stamp[0] + diff[0], marker.stamp[1] + diff[1]]; - console.log("travis_time:end:" + marker.id + ":start=" + toNs(marker.stamp) + ",finish=" + toNs(total) + ",duration=" + toNs(diff) + "\r"); - } -}; - -function toNs(diff) { - return diff[0] * 1e9 + diff[1]; -} - -function exec(cmd, successHandler, errorHandler) { - var ex = jake.createExec([cmd], /** @type {jake.ExecOptions} */({ windowsVerbatimArguments: true, interactive: true })); - // Add listeners for output and error - ex.addListener("stdout", function (output) { - process.stdout.write(output); - }); - ex.addListener("stderr", function (error) { - process.stderr.write(error); - }); - ex.addListener("cmdEnd", function () { - if (successHandler) { - successHandler(); - } - }); - ex.addListener("error", function (e, status) { - if (errorHandler) { - errorHandler(e, status); - } - else { - fail("Process exited with code " + status); - } - }); - - console.log(cmd); - ex.run(); -} - -function acceptBaseline(sourceFolder, targetFolder) { - console.log('Accept baselines from ' + sourceFolder + ' to ' + targetFolder); - var deleteEnding = '.delete'; - - jake.mkdirP(targetFolder); - acceptBaselineFolder(sourceFolder, targetFolder); - - function acceptBaselineFolder(sourceFolder, targetFolder) { - var files = fs.readdirSync(sourceFolder); - - for (var i in files) { - var filename = files[i]; - var fullLocalPath = path.join(sourceFolder, filename); - var stat = fs.statSync(fullLocalPath); - if (stat.isFile()) { - if (filename.substr(filename.length - deleteEnding.length) === deleteEnding) { - filename = filename.substr(0, filename.length - deleteEnding.length); - fs.unlinkSync(path.join(targetFolder, filename)); - } - else { - var target = path.join(targetFolder, filename); - if (fs.existsSync(target)) { - fs.unlinkSync(target); - } - jake.mkdirP(path.dirname(target)); - fs.renameSync(path.join(sourceFolder, filename), target); - } - } - else if (stat.isDirectory()) { - acceptBaselineFolder(fullLocalPath, path.join(targetFolder, filename)); - } - } - } -} - -/** @param jsonPath {string} */ -function readJson(jsonPath) { - const jsonText = readFileSync(jsonPath); - const result = ts.parseConfigFileTextToJson(jsonPath, jsonText); - if (result.error) { - reportDiagnostics([result.error]); - throw new Error("An error occurred during parse."); - } - return result.config; -} - -/** @param diagnostics {ts.Diagnostic[]} */ -function reportDiagnostics(diagnostics) { - console.log(diagnosticsToString(diagnostics, process.stdout.isTTY)); -} - -/** - * @param diagnostics {ts.Diagnostic[]} - * @param [pretty] {boolean} - */ -function diagnosticsToString(diagnostics, pretty) { - const host = { - getCurrentDirectory() { return process.cwd(); }, - getCanonicalFileName(fileName) { return fileName; }, - getNewLine() { return os.EOL; } - }; - return pretty ? ts.formatDiagnosticsWithColorAndContext(diagnostics, host) : - ts.formatDiagnostics(diagnostics, host); -} - -/** - * Concatenate a list of sourceFiles to a destinationFile - * @param {string} destinationFile - * @param {string[]} sourceFiles - * @param {string=} extraContent - */ -function concatenateFiles(destinationFile, sourceFiles, extraContent) { - var temp = "temptemp"; - // append all files in sequence - var text = ""; - for (var i = 0; i < sourceFiles.length; i++) { - if (!fs.existsSync(sourceFiles[i])) { - fail(sourceFiles[i] + " does not exist!"); - } - if (i > 0) { text += "\n\n"; } - text += readFileSync(sourceFiles[i]).replace(/\r?\n/g, "\n"); - } - if (extraContent) { - text += extraContent; - } - fs.writeFileSync(temp, text); - // Move the file to the final destination - fs.renameSync(temp, destinationFile); -} - -function appendToFile(path, content) { - fs.writeFileSync(path, readFileSync(path) + "\r\n" + content); -} - -/** - * - * @param {string} path - * @returns string - */ -function readFileSync(path) { - return fs.readFileSync(path, { encoding: "utf-8" }); -} - -function getDiffTool() { - var program = process.env['DIFF']; - if (!program) { - fail("Add the 'DIFF' environment variable to the path of the program you want to use."); - } - return program; -} - -/** - * Replaces const enum declarations with non-const enums - * @param {string} text - */ -function removeConstModifierFromEnumDeclarations(text) { - return text.replace(/^(\s*)(export )?const enum (\S+) {(\s*)$/gm, '$1$2enum $3 {$4'); -} \ No newline at end of file diff --git a/README.md b/README.md index 2826db8aec664..3b20af2d39848 100644 --- a/README.md +++ b/README.md @@ -61,29 +61,29 @@ Change to the TypeScript directory: cd TypeScript ``` -Install [Jake](http://jakejs.com/) tools and dev dependencies: +Install [Gulp](https://gulpjs.com/) tools and dev dependencies: ```bash -npm install -g jake +npm install -g gulp npm install ``` Use one of the following to build and test: ``` -jake local # Build the compiler into built/local -jake clean # Delete the built compiler -jake LKG # Replace the last known good with the built one. +gulp local # Build the compiler into built/local +gulp clean # Delete the built compiler +gulp LKG # Replace the last known good with the built one. # Bootstrapping step to be executed when the built compiler reaches a stable state. -jake tests # Build the test infrastructure using the built compiler. -jake runtests # Run tests using the built compiler and test infrastructure. +gulp tests # Build the test infrastructure using the built compiler. +gulp runtests # Run tests using the built compiler and test infrastructure. # You can override the host or specify a test for this command. - # Use host= or tests=. -jake runtests-browser # Runs the tests using the built run.js file. Syntax is jake runtests. Optional - parameters 'host=', 'tests=[regex], reporter=[list|spec|json|]'. -jake baseline-accept # This replaces the baseline test results with the results obtained from jake runtests. -jake lint # Runs tslint on the TypeScript source. -jake help # List the above commands. + # Use --host= or --tests=. +gulp runtests-browser # Runs the tests using the built run.js file. Syntax is gulp runtests. Optional + parameters '--host=', '--tests=[regex], --reporter=[list|spec|json|]'. +gulp baseline-accept # This replaces the baseline test results with the results obtained from gulp runtests. +gulp lint # Runs tslint on the TypeScript source. +gulp help # List the above commands. ``` diff --git a/lib/README.md b/lib/README.md index 0a85a9e7b5c80..ce0455fa40d3c 100644 --- a/lib/README.md +++ b/lib/README.md @@ -2,4 +2,4 @@ **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. +Running `gulp LKG` will then appropriately update the files in this directory. diff --git a/package.json b/package.json index 4f4f7db571da7..275411c477f13 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "@types/minimist": "latest", "@types/mkdirp": "latest", "@types/mocha": "latest", + "@types/ms": "latest", "@types/node": "8.5.5", "@types/q": "latest", "@types/source-map-support": "latest", @@ -67,13 +68,13 @@ "gulp-rename": "latest", "gulp-sourcemaps": "latest", "istanbul": "latest", - "jake": "latest", - "lodash": "4.17.10", + "lodash": "^4.17.11", "merge2": "latest", "minimist": "latest", "mkdirp": "latest", "mocha": "latest", "mocha-fivemat-progress-reporter": "latest", + "ms": "latest", "plugin-error": "latest", "pretty-hrtime": "^1.0.3", "prex": "^0.4.3", @@ -89,16 +90,16 @@ "xml2js": "^0.4.19" }, "scripts": { - "pretest": "jake tests", - "test": "jake runtests-parallel light=false", + "pretest": "gulp tests", + "test": "gulp runtests-parallel --light=false", "build": "npm run build:compiler && npm run build:tests", - "build:compiler": "jake local", - "build:tests": "jake tests", + "build:compiler": "gulp local", + "build:tests": "gulp tests", "start": "node lib/tsc", - "clean": "jake clean", + "clean": "gulp clean", "gulp": "gulp", - "jake": "jake", - "lint": "jake lint", + "jake": "gulp", + "lint": "gulp lint", "setup-hooks": "node scripts/link-hooks.js" }, "browser": { diff --git a/scripts/bisect-test.ts b/scripts/bisect-test.ts index cc0248f6d64f3..d66e0b7106132 100644 --- a/scripts/bisect-test.ts +++ b/scripts/bisect-test.ts @@ -15,6 +15,7 @@ function tsc(tscArgs: string, onExit: (exitCode: number) => void) { }); } +// TODO: Rewrite bisect script to handle the post-jake/gulp swap period var jake = cp.exec('jake clean local', () => void 0); jake.on('close', jakeExitCode => { if (jakeExitCode === 0) { diff --git a/scripts/build/tests.js b/scripts/build/tests.js index 36a9ea54cb9b5..0ac65002ab86a 100644 --- a/scripts/build/tests.js +++ b/scripts/build/tests.js @@ -116,6 +116,17 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode, errorStatus = exitCode; error = new Error(`Process exited with status code ${errorStatus}.`); } + else if (process.env.CI === "true") { + // finally, do a sanity check and build the compiler with the built version of itself + log.info("Starting sanity check build..."); + // Cleanup everything except lint rules (we'll need those later and would rather not waste time rebuilding them) + await exec("gulp", ["clean-tsc", "clean-services", "clean-tsserver", "clean-lssl", "clean-tests"], { cancelToken }); + const { exitCode } = await exec("gulp", ["local", "--lkg=false"], { cancelToken }); + if (exitCode !== 0) { + errorStatus = exitCode; + error = new Error(`Sanity check build process exited with status code ${errorStatus}.`); + } + } } catch (e) { errorStatus = undefined; @@ -129,13 +140,8 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode, await deleteTemporaryProjectOutput(); if (error !== undefined) { - if (watchMode) { - throw error; - } - else { - log.error(error); - process.exit(typeof errorStatus === "number" ? errorStatus : 2); - } + process.exitCode = typeof errorStatus === "number" ? errorStatus : 2; + throw error; } } exports.runConsoleTests = runConsoleTests; @@ -148,7 +154,7 @@ async function cleanTestDirs() { exports.cleanTestDirs = cleanTestDirs; /** - * used to pass data from jake command line directly to run.js + * used to pass data from gulp command line directly to run.js * @param {string} tests * @param {string} runners * @param {boolean} light diff --git a/scripts/build/utils.js b/scripts/build/utils.js index 170c36adef6b4..b070bd133a94c 100644 --- a/scripts/build/utils.js +++ b/scripts/build/utils.js @@ -373,15 +373,16 @@ function rm(dest, opts) { pending.push(entry); }, final(cb) { + const endThenCb = () => (duplex.push(null), cb()); // signal end of read queue processDeleted(); if (pending.length) { Promise .all(pending.map(entry => entry.promise)) .then(() => processDeleted()) - .then(() => cb(), cb); + .then(() => endThenCb(), endThenCb); return; } - cb(); + endThenCb(); }, read() { } diff --git a/scripts/hooks/post-checkout b/scripts/hooks/post-checkout index fb41e4e8652cd..28a583794d929 100644 --- a/scripts/hooks/post-checkout +++ b/scripts/hooks/post-checkout @@ -1,2 +1,2 @@ #!/bin/sh -npm run jake -- generate-diagnostics \ No newline at end of file +npm run gulp -- generate-diagnostics \ No newline at end of file diff --git a/scripts/open-user-pr.ts b/scripts/open-user-pr.ts index f510c63d4e308..aedfcc4254791 100644 --- a/scripts/open-user-pr.ts +++ b/scripts/open-user-pr.ts @@ -24,7 +24,7 @@ const branchName = `user-update-${now.getFullYear()}${padNum(now.getMonth())}${p const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`; runSequence([ ["git", ["checkout", "."]], // reset any changes - ["node", ["./node_modules/jake/bin/cli.js", "baseline-accept"]], // accept baselines + ["node", ["./node_modules/gulp/bin/gulp.js", "baseline-accept"]], // accept baselines ["git", ["checkout", "-b", branchName]], // create a branch ["git", ["add", "."]], // Add all changes ["git", ["commit", "-m", `"Update user baselines"`]], // Commit all changes diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 11e0a8d769052..d7b5d3f42a8a2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -390,10 +390,10 @@ namespace ts { const wildcardType = createIntrinsicType(TypeFlags.Any, "any"); const errorType = createIntrinsicType(TypeFlags.Any, "error"); const unknownType = createIntrinsicType(TypeFlags.Unknown, "unknown"); - const undefinedType = createIntrinsicType(TypeFlags.Undefined, "undefined"); - const undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsWideningType, "undefined"); - const nullType = createIntrinsicType(TypeFlags.Null, "null"); - const nullWideningType = strictNullChecks ? nullType : createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsWideningType, "null"); + const undefinedType = createNullableType(TypeFlags.Undefined, "undefined", 0); + const undefinedWideningType = strictNullChecks ? undefinedType : createNullableType(TypeFlags.Undefined, "undefined", ObjectFlags.ContainsWideningType); + const nullType = createNullableType(TypeFlags.Null, "null", 0); + const nullWideningType = strictNullChecks ? nullType : createNullableType(TypeFlags.Null, "null", ObjectFlags.ContainsWideningType); const stringType = createIntrinsicType(TypeFlags.String, "string"); const numberType = createIntrinsicType(TypeFlags.Number, "number"); const bigintType = createIntrinsicType(TypeFlags.BigInt, "bigint"); @@ -439,7 +439,7 @@ namespace ts { const anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); // The anyFunctionType contains the anyFunctionType by definition. The flag is further propagated // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. - anyFunctionType.flags |= TypeFlags.ContainsAnyFunctionType; + anyFunctionType.objectFlags |= ObjectFlags.ContainsAnyFunctionType; const noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); const circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -1526,7 +1526,8 @@ namespace ts { !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && - !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning)) { + !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) && + !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) { let suggestion: Symbol | undefined; if (suggestedNameNotFoundMessage && suggestionCount < maximumSuggestionCount) { suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning); @@ -1716,6 +1717,17 @@ namespace ts { return false; } + function checkAndReportErrorForUsingValueAsType(errorLocation: Node, name: __String, meaning: SymbolFlags): boolean { + if (meaning & (SymbolFlags.Type & ~SymbolFlags.Namespace)) { + const symbol = resolveSymbol(resolveName(errorLocation, name, ~SymbolFlags.Type & SymbolFlags.Value, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined, /*isUse*/ false)); + if (symbol && !(symbol.flags & SymbolFlags.Namespace)) { + error(errorLocation, Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here, unescapeLeadingUnderscores(name)); + return true; + } + } + return false; + } + function checkAndReportErrorForUsingTypeAsValue(errorLocation: Node, name: __String, meaning: SymbolFlags): boolean { if (meaning & (SymbolFlags.Value & ~SymbolFlags.NamespaceModule)) { if (name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never") { @@ -2749,6 +2761,12 @@ namespace ts { return type; } + function createNullableType(kind: TypeFlags, intrinsicName: string, objectFlags: ObjectFlags): NullableType { + const type = createIntrinsicType(kind, intrinsicName); + type.objectFlags = objectFlags; + return type; + } + function createBooleanType(trueFalseTypes: ReadonlyArray): IntrinsicType & UnionType { const type = getUnionType(trueFalseTypes); type.flags |= TypeFlags.Boolean; @@ -5136,7 +5154,7 @@ namespace ts { definedInConstructor = true; } } - const sourceTypes = some(constructorTypes, t => !!(t.flags & ~(TypeFlags.Nullable | TypeFlags.ContainsWideningType))) ? constructorTypes : types; // TODO: GH#18217 + const sourceTypes = some(constructorTypes, t => !!(t.flags & ~TypeFlags.Nullable)) ? constructorTypes : types; // TODO: GH#18217 type = getUnionType(sourceTypes!, UnionReduction.Subtype); } const widened = getWidenedType(addOptionality(type, definedInMethod && !definedInConstructor)); @@ -5301,7 +5319,7 @@ namespace ts { function getTypeFromObjectBindingPattern(pattern: ObjectBindingPattern, includePatternInType: boolean, reportErrors: boolean): Type { const members = createSymbolTable(); let stringIndexInfo: IndexInfo | undefined; - let objectFlags = ObjectFlags.ObjectLiteral; + let objectFlags = ObjectFlags.ObjectLiteral | ObjectFlags.ContainsObjectLiteral; forEach(pattern.elements, e => { const name = e.propertyName || e.name; if (e.dotDotDotToken) { @@ -5323,7 +5341,6 @@ namespace ts { members.set(symbol.escapedName, symbol); }); const result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); - result.flags |= TypeFlags.ContainsObjectLiteral; result.objectFlags |= objectFlags; if (includePatternInType) { result.pattern = pattern; @@ -5416,7 +5433,16 @@ namespace ts { function getTypeOfVariableOrParameterOrProperty(symbol: Symbol): Type { const links = getSymbolLinks(symbol); - return links.type || (links.type = getTypeOfVariableOrParameterOrPropertyWorker(symbol)); + if (!links.type) { + const type = getTypeOfVariableOrParameterOrPropertyWorker(symbol); + // For a contextually typed parameter it is possible that a type has already + // been assigned (in assignTypeToParameterAndFixTypeParameters), and we want + // to preserve this type. + if (!links.type) { + links.type = type; + } + } + return links.type; } function getTypeOfVariableOrParameterOrPropertyWorker(symbol: Symbol) { @@ -5460,7 +5486,7 @@ namespace ts { if (symbol.flags & SymbolFlags.ValueModule) { return getTypeOfFuncClassEnumModule(symbol); } - return errorType; + return reportCircularityError(symbol); } let type: Type | undefined; if (isInJSFile(declaration) && @@ -5519,7 +5545,7 @@ namespace ts { if (symbol.flags & SymbolFlags.ValueModule) { return getTypeOfFuncClassEnumModule(symbol); } - type = reportCircularityError(symbol); + return reportCircularityError(symbol); } return type; } @@ -7388,7 +7414,7 @@ namespace ts { const nameType = property.name && getLiteralTypeFromPropertyName(property.name); const name = nameType && isTypeUsableAsPropertyName(nameType) ? getPropertyNameFromType(nameType) : undefined; const expected = name === undefined ? undefined : getTypeOfPropertyOfType(contextualType, name); - return !!expected && isLiteralType(expected) && !isTypeIdenticalTo(getTypeOfNode(property), expected); + return !!expected && isLiteralType(expected) && !isTypeAssignableTo(getTypeOfNode(property), expected); }); } @@ -8548,14 +8574,14 @@ 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: ReadonlyArray, excludeKinds: TypeFlags): TypeFlags { - let result: TypeFlags = 0; + function getPropagatingFlagsOfTypes(types: ReadonlyArray, excludeKinds: TypeFlags): ObjectFlags { + let result: ObjectFlags = 0; for (const type of types) { if (!(type.flags & excludeKinds)) { - result |= type.flags; + result |= getObjectFlags(type); } } - return result & TypeFlags.PropagatingFlags; + return result & ObjectFlags.PropagatingFlags; } function createTypeReference(target: GenericType, typeArguments: ReadonlyArray | undefined): TypeReference { @@ -8564,7 +8590,7 @@ namespace ts { if (!type) { type = createObjectType(ObjectFlags.Reference, target.symbol); target.instantiations.set(id, type); - type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0; + type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0; type.target = target; type.typeArguments = typeArguments; } @@ -9243,10 +9269,11 @@ namespace ts { // intersections of unit types into 'never' upon construction, but deferring the reduction makes it // easier to reason about their origin. if (!(flags & TypeFlags.Never || flags & TypeFlags.Intersection && isEmptyIntersectionType(type))) { - includes |= flags & ~TypeFlags.ConstructionFlags; - if (type === wildcardType) includes |= TypeFlags.Wildcard; + includes |= flags & TypeFlags.IncludesMask; + if (flags & TypeFlags.StructuredOrInstantiable) includes |= TypeFlags.IncludesStructuredOrInstantiable; + if (type === wildcardType) includes |= TypeFlags.IncludesWildcard; if (!strictNullChecks && flags & TypeFlags.Nullable) { - if (!(flags & TypeFlags.ContainsWideningType)) includes |= TypeFlags.NonWideningType; + if (!(getObjectFlags(type) & ObjectFlags.ContainsWideningType)) includes |= TypeFlags.IncludesNonWideningType; } else { const len = typeSet.length; @@ -9357,27 +9384,27 @@ namespace ts { const includes = addTypesToUnion(typeSet, 0, types); if (unionReduction !== UnionReduction.None) { if (includes & TypeFlags.AnyOrUnknown) { - return includes & TypeFlags.Any ? includes & TypeFlags.Wildcard ? wildcardType : anyType : unknownType; + return includes & TypeFlags.Any ? includes & TypeFlags.IncludesWildcard ? wildcardType : anyType : unknownType; } switch (unionReduction) { case UnionReduction.Literal: - if (includes & TypeFlags.StringOrNumberLiteralOrUnique | TypeFlags.BooleanLiteral) { + if (includes & (TypeFlags.Literal | TypeFlags.UniqueESSymbol)) { removeRedundantLiteralTypes(typeSet, includes); } break; case UnionReduction.Subtype: - if (!removeSubtypes(typeSet, !(includes & TypeFlags.StructuredOrInstantiable))) { + if (!removeSubtypes(typeSet, !(includes & TypeFlags.IncludesStructuredOrInstantiable))) { return errorType; } break; } if (typeSet.length === 0) { - return includes & TypeFlags.Null ? includes & TypeFlags.NonWideningType ? nullType : nullWideningType : - includes & TypeFlags.Undefined ? includes & TypeFlags.NonWideningType ? undefinedType : undefinedWideningType : + return includes & TypeFlags.Null ? includes & TypeFlags.IncludesNonWideningType ? nullType : nullWideningType : + includes & TypeFlags.Undefined ? includes & TypeFlags.IncludesNonWideningType ? undefinedType : undefinedWideningType : neverType; } } - return getUnionTypeFromSortedList(typeSet, !(includes & TypeFlags.NotPrimitiveUnion), aliasSymbol, aliasTypeArguments); + return getUnionTypeFromSortedList(typeSet, includes & TypeFlags.NotPrimitiveUnion ? 0 : ObjectFlags.PrimitiveUnion, aliasSymbol, aliasTypeArguments); } function getUnionTypePredicate(signatures: ReadonlyArray): TypePredicate | undefined { @@ -9417,7 +9444,7 @@ namespace ts { } // This function assumes the constituent type list is sorted and deduplicated. - function getUnionTypeFromSortedList(types: Type[], primitiveTypesOnly: boolean, aliasSymbol?: Symbol, aliasTypeArguments?: ReadonlyArray): Type { + function getUnionTypeFromSortedList(types: Type[], objectFlags: ObjectFlags, aliasSymbol?: Symbol, aliasTypeArguments?: ReadonlyArray): Type { if (types.length === 0) { return neverType; } @@ -9427,11 +9454,10 @@ namespace ts { const id = getTypeListId(types); let type = unionTypes.get(id); if (!type) { - const propagatedFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ TypeFlags.Nullable); - type = createType(TypeFlags.Union | propagatedFlags); + type = createType(TypeFlags.Union); unionTypes.set(id, type); + type.objectFlags = objectFlags | getPropagatingFlagsOfTypes(types, /*excludeKinds*/ TypeFlags.Nullable); type.types = types; - type.primitiveTypesOnly = primitiveTypesOnly; /* Note: This is the alias symbol (or lack thereof) that we see when we first encounter this union type. For aliases of identical unions, eg `type T = A | B; type U = A | B`, the symbol of the first alias encountered is the aliasSymbol. @@ -9460,15 +9486,15 @@ namespace ts { return addTypesToIntersection(typeSet, includes, (type).types); } if (isEmptyAnonymousObjectType(type)) { - if (!(includes & TypeFlags.EmptyObject)) { - includes |= TypeFlags.EmptyObject; + if (!(includes & TypeFlags.IncludesEmptyObject)) { + includes |= TypeFlags.IncludesEmptyObject; typeSet.push(type); } } else { - includes |= flags & ~TypeFlags.ConstructionFlags; + includes |= flags & TypeFlags.IncludesMask; if (flags & TypeFlags.AnyOrUnknown) { - if (type === wildcardType) includes |= TypeFlags.Wildcard; + if (type === wildcardType) includes |= TypeFlags.IncludesWildcard; } else if ((strictNullChecks || !(flags & TypeFlags.Nullable)) && !contains(typeSet, type)) { typeSet.push(type); @@ -9526,7 +9552,7 @@ namespace ts { // other unions and return true. Otherwise, do nothing and return false. function intersectUnionsOfPrimitiveTypes(types: Type[]) { let unionTypes: UnionType[] | undefined; - const index = findIndex(types, t => !!(t.flags & TypeFlags.Union) && (t).primitiveTypesOnly); + const index = findIndex(types, t => !!(getObjectFlags(t) & ObjectFlags.PrimitiveUnion)); if (index < 0) { return false; } @@ -9535,7 +9561,7 @@ namespace ts { // the unionTypes array. while (i < types.length) { const t = types[i]; - if (t.flags & TypeFlags.Union && (t).primitiveTypesOnly) { + if (getObjectFlags(t) & ObjectFlags.PrimitiveUnion) { (unionTypes || (unionTypes = [types[index]])).push(t); orderedRemoveItemAt(types, i); } @@ -9562,7 +9588,7 @@ namespace ts { } } // Finally replace the first union with the result - types[index] = getUnionTypeFromSortedList(result, /*primitiveTypesOnly*/ true); + types[index] = getUnionTypeFromSortedList(result, ObjectFlags.PrimitiveUnion); return true; } @@ -9583,7 +9609,7 @@ namespace ts { return neverType; } if (includes & TypeFlags.Any) { - return includes & TypeFlags.Wildcard ? wildcardType : anyType; + return includes & TypeFlags.IncludesWildcard ? wildcardType : anyType; } if (!strictNullChecks && includes & TypeFlags.Nullable) { return includes & TypeFlags.Undefined ? undefinedType : nullType; @@ -9594,7 +9620,7 @@ namespace ts { includes & TypeFlags.ESSymbol && includes & TypeFlags.UniqueESSymbol) { removeRedundantPrimitiveTypes(typeSet, includes); } - if (includes & TypeFlags.EmptyObject && includes & TypeFlags.Object) { + if (includes & TypeFlags.IncludesEmptyObject && includes & TypeFlags.Object) { orderedRemoveItemAt(typeSet, findIndex(typeSet, isEmptyAnonymousObjectType)); } if (typeSet.length === 0) { @@ -9620,9 +9646,9 @@ namespace ts { const id = getTypeListId(typeSet); let type = intersectionTypes.get(id); if (!type) { - const propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ TypeFlags.Nullable); - type = createType(TypeFlags.Intersection | propagatedFlags); + type = createType(TypeFlags.Intersection); intersectionTypes.set(id, type); + type.objectFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ TypeFlags.Nullable); type.types = typeSet; type.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`. type.aliasTypeArguments = aliasTypeArguments; @@ -10281,7 +10307,7 @@ namespace ts { * this function should be called in a left folding style, with left = previous result of getSpreadType * and right = the new element to be spread. */ - function getSpreadType(left: Type, right: Type, symbol: Symbol | undefined, typeFlags: TypeFlags, objectFlags: ObjectFlags, readonly: boolean): Type { + function getSpreadType(left: Type, right: Type, symbol: Symbol | undefined, objectFlags: ObjectFlags, readonly: boolean): Type { if (left.flags & TypeFlags.Any || right.flags & TypeFlags.Any) { return anyType; } @@ -10295,10 +10321,10 @@ namespace ts { return left; } if (left.flags & TypeFlags.Union) { - return mapType(left, t => getSpreadType(t, right, symbol, typeFlags, objectFlags, readonly)); + return mapType(left, t => getSpreadType(t, right, symbol, objectFlags, readonly)); } if (right.flags & TypeFlags.Union) { - return mapType(right, t => getSpreadType(left, t, symbol, typeFlags, objectFlags, readonly)); + return mapType(right, t => getSpreadType(left, t, symbol, objectFlags, readonly)); } if (right.flags & (TypeFlags.BooleanLike | TypeFlags.NumberLike | TypeFlags.BigIntLike | TypeFlags.StringLike | TypeFlags.EnumLike | TypeFlags.NonPrimitive | TypeFlags.Index)) { return left; @@ -10315,7 +10341,7 @@ namespace ts { const types = (left).types; const lastLeft = types[types.length - 1]; if (isNonGenericObjectType(lastLeft) && isNonGenericObjectType(right)) { - return getIntersectionType(concatenate(types.slice(0, types.length - 1), [getSpreadType(lastLeft, right, symbol, typeFlags, objectFlags, readonly)])); + return getIntersectionType(concatenate(types.slice(0, types.length - 1), [getSpreadType(lastLeft, right, symbol, objectFlags, readonly)])); } } return getIntersectionType([left, right]); @@ -10375,8 +10401,7 @@ namespace ts { emptyArray, getIndexInfoWithReadonly(stringIndexInfo, readonly), getIndexInfoWithReadonly(numberIndexInfo, readonly)); - spread.flags |= TypeFlags.ContainsObjectLiteral | typeFlags; - spread.objectFlags |= ObjectFlags.ObjectLiteral | ObjectFlags.ContainsSpread | objectFlags; + spread.objectFlags |= ObjectFlags.ObjectLiteral | ObjectFlags.ContainsObjectLiteral | ObjectFlags.ContainsSpread | objectFlags; return spread; } @@ -11045,7 +11070,13 @@ namespace ts { return getConditionalTypeInstantiation(type, combineTypeMappers((type).mapper, mapper)); } if (flags & TypeFlags.Substitution) { - return instantiateType((type).typeVariable, mapper); + const maybeVariable = instantiateType((type).typeVariable, mapper); + if (maybeVariable.flags & TypeFlags.TypeVariable) { + return getSubstitutionType(maybeVariable as TypeVariable, instantiateType((type).substitute, mapper)); + } + else { + return maybeVariable; + } } return type; } @@ -12578,6 +12609,7 @@ namespace ts { let result: Ternary; let originalErrorInfo: DiagnosticMessageChain | undefined; + let varianceCheckFailed = false; const saveErrorInfo = errorInfo; // We limit alias variance probing to only object and conditional types since their alias behavior @@ -12587,11 +12619,10 @@ namespace ts { source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol && !(source.aliasTypeArgumentsContainsMarker || target.aliasTypeArgumentsContainsMarker)) { const variances = getAliasVariances(source.aliasSymbol); - if (result = typeArgumentsRelatedTo(source.aliasTypeArguments, target.aliasTypeArguments, variances, reportErrors)) { - return result; + const varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances); + if (varianceResult !== undefined) { + return varianceResult; } - originalErrorInfo = errorInfo; - errorInfo = saveErrorInfo; } if (target.flags & TypeFlags.TypeParameter) { @@ -12755,36 +12786,19 @@ namespace ts { // type references (which are intended by be compared structurally). Obtain the variance // information for the type parameters and relate the type arguments accordingly. const variances = getVariances((source).target); - if (result = typeArgumentsRelatedTo((source).typeArguments, (target).typeArguments, variances, reportErrors)) { - return result; - } - // The type arguments did not relate appropriately, but it may be because we have no variance - // information (in which case typeArgumentsRelatedTo defaulted to covariance for all type - // arguments). It might also be the case that the target type has a 'void' type argument for - // a covariant type parameter that is only used in return positions within the generic type - // (in which case any type argument is permitted on the source side). In those cases we proceed - // with a structural comparison. Otherwise, we know for certain the instantiations aren't - // related and we can return here. - if (variances !== emptyArray && !hasCovariantVoidArgument(target, variances)) { - // In some cases generic types that are covariant in regular type checking mode become - // invariant in --strictFunctionTypes mode because one or more type parameters are used in - // both co- and contravariant positions. In order to make it easier to diagnose *why* such - // types are invariant, if any of the type parameters are invariant we reset the reported - // errors and instead force a structural comparison (which will include elaborations that - // reveal the reason). - if (!(reportErrors && some(variances, v => v === Variance.Invariant))) { - return Ternary.False; - } - // We remember the original error information so we can restore it in case the structural - // comparison unexpectedly succeeds. This can happen when the structural comparison result - // is a Ternary.Maybe for example caused by the recursion depth limiter. - originalErrorInfo = errorInfo; - errorInfo = saveErrorInfo; + const varianceResult = relateVariances((source).typeArguments, (target).typeArguments, variances); + if (varianceResult !== undefined) { + return varianceResult; } } else if (isReadonlyArrayType(target) ? isArrayType(source) || isTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) { return isRelatedTo(getIndexTypeOfType(source, IndexKind.Number) || anyType, getIndexTypeOfType(target, IndexKind.Number) || anyType, reportErrors); } + // Consider a fresh empty object literal type "closed" under the subtype relationship - this way `{} <- {[idx: string]: any} <- fresh({})` + // and not `{} <- fresh({}) <- {[idx: string]: any}` + else if (relation === subtypeRelation && isEmptyObjectType(target) && getObjectFlags(target) & ObjectFlags.FreshLiteral && !isEmptyObjectType(source)) { + return Ternary.False; + } // Even if relationship doesn't hold for unions, intersections, or generic type references, // it may hold in a structural comparison. // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates @@ -12806,16 +12820,48 @@ namespace ts { } } } - if (result) { - if (!originalErrorInfo) { - errorInfo = saveErrorInfo; - return result; - } - errorInfo = originalErrorInfo; + if (varianceCheckFailed && result) { + errorInfo = originalErrorInfo || errorInfo || saveErrorInfo; // Use variance error (there is no structural one) and return false + } + else if (result) { + return result; } } } return Ternary.False; + + function relateVariances(sourceTypeArguments: ReadonlyArray | undefined, targetTypeArguments: ReadonlyArray | undefined, variances: Variance[]) { + if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors)) { + return result; + } + const isCovariantVoid = targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances); + varianceCheckFailed = !isCovariantVoid; + // The type arguments did not relate appropriately, but it may be because we have no variance + // information (in which case typeArgumentsRelatedTo defaulted to covariance for all type + // arguments). It might also be the case that the target type has a 'void' type argument for + // a covariant type parameter that is only used in return positions within the generic type + // (in which case any type argument is permitted on the source side). In those cases we proceed + // with a structural comparison. Otherwise, we know for certain the instantiations aren't + // related and we can return here. + if (variances !== emptyArray && !isCovariantVoid) { + // In some cases generic types that are covariant in regular type checking mode become + // invariant in --strictFunctionTypes mode because one or more type parameters are used in + // both co- and contravariant positions. In order to make it easier to diagnose *why* such + // types are invariant, if any of the type parameters are invariant we reset the reported + // errors and instead force a structural comparison (which will include elaborations that + // reveal the reason). + // We can switch on `reportErrors` here, since varianceCheckFailed guarantees we return `False`, + // we can return `False` early here to skip calculating the structural error message we don't need. + if (varianceCheckFailed && !(reportErrors && some(variances, v => v === Variance.Invariant))) { + return Ternary.False; + } + // We remember the original error information so we can restore it in case the structural + // comparison unexpectedly succeeds. This can happen when the structural comparison result + // is a Ternary.Maybe for example caused by the recursion depth limiter. + originalErrorInfo = errorInfo; + errorInfo = saveErrorInfo; + } + } } // A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is @@ -13324,7 +13370,7 @@ namespace ts { function getVariances(type: GenericType): Variance[] { // Arrays and tuples are known to be covariant, no need to spend time computing this (emptyArray implies covariance for all parameters) - if (!strictFunctionTypes || type === globalArrayType || type === globalReadonlyArrayType || type.objectFlags & ObjectFlags.Tuple) { + if (type === globalArrayType || type === globalReadonlyArrayType || type.objectFlags & ObjectFlags.Tuple) { return emptyArray; } return getVariancesWorker(type.typeParameters, type, getMarkerTypeReference); @@ -13332,9 +13378,9 @@ namespace ts { // Return true if the given type reference has a 'void' type argument for a covariant type parameter. // See comment at call in recursiveTypeRelatedTo for when this case matters. - function hasCovariantVoidArgument(type: TypeReference, variances: Variance[]): boolean { + function hasCovariantVoidArgument(typeArguments: ReadonlyArray, variances: Variance[]): boolean { for (let i = 0; i < variances.length; i++) { - if (variances[i] === Variance.Covariant && type.typeArguments![i].flags & TypeFlags.Void) { + if (variances[i] === Variance.Covariant && typeArguments[i].flags & TypeFlags.Void) { return true; } } @@ -13860,7 +13906,7 @@ namespace ts { resolved.stringIndexInfo, resolved.numberIndexInfo); regularNew.flags = resolved.flags; - regularNew.objectFlags |= ObjectFlags.ObjectLiteral | (getObjectFlags(resolved) & ObjectFlags.JSLiteral); + regularNew.objectFlags |= resolved.objectFlags & ~ObjectFlags.FreshLiteral; (type).regularType = regularNew; return regularNew; } @@ -13951,7 +13997,7 @@ namespace ts { } function getWidenedTypeWithContext(type: Type, context: WideningContext | undefined): Type { - if (type.flags & TypeFlags.RequiresWidening) { + if (getObjectFlags(type) & ObjectFlags.RequiresWidening) { if (type.flags & TypeFlags.Nullable) { return anyType; } @@ -13989,7 +14035,7 @@ namespace ts { */ function reportWideningErrorsInType(type: Type): boolean { let errorReported = false; - if (type.flags & TypeFlags.ContainsWideningType) { + if (getObjectFlags(type) & ObjectFlags.ContainsWideningType) { if (type.flags & TypeFlags.Union) { if (some((type).types, isEmptyObjectType)) { errorReported = true; @@ -14012,7 +14058,7 @@ namespace ts { if (isObjectLiteralType(type)) { for (const p of getPropertiesOfObjectType(type)) { const t = getTypeOfSymbol(p); - if (t.flags & TypeFlags.ContainsWideningType) { + if (getObjectFlags(t) & ObjectFlags.ContainsWideningType) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t))); } @@ -14087,7 +14133,7 @@ namespace ts { } function reportErrorsFromWidening(declaration: Declaration, type: Type) { - if (produceDiagnostics && noImplicitAny && type.flags & TypeFlags.ContainsWideningType) { + if (produceDiagnostics && noImplicitAny && getObjectFlags(type) & ObjectFlags.ContainsWideningType) { // Report implicit any error within type if possible, otherwise report error on declaration if (!reportWideningErrorsInType(type)) { reportImplicitAny(declaration, type); @@ -14232,7 +14278,7 @@ namespace ts { // If any property contains context sensitive functions that have been skipped, the source type // is incomplete and we can't infer a meaningful input type. for (const prop of properties) { - if (getTypeOfSymbol(prop).flags & TypeFlags.ContainsAnyFunctionType) { + if (getObjectFlags(getTypeOfSymbol(prop)) & ObjectFlags.ContainsAnyFunctionType) { return undefined; } } @@ -14390,7 +14436,7 @@ namespace ts { // not contain anyFunctionType when we come back to this argument for its second round // of inference. Also, we exclude inferences for silentNeverType (which is used as a wildcard // when constructing types from type parameters that had no inference candidates). - if (source.flags & TypeFlags.ContainsAnyFunctionType || source === silentNeverType || (priority & InferencePriority.ReturnType && (source === autoType || source === autoArrayType))) { + if (getObjectFlags(source) & ObjectFlags.ContainsAnyFunctionType || source === silentNeverType || (priority & InferencePriority.ReturnType && (source === autoType || source === autoArrayType))) { return; } const inference = getInferenceInfoForType(target); @@ -14437,6 +14483,9 @@ namespace ts { } } } + else if (target.flags & TypeFlags.Substitution) { + inferFromTypes(source, (target as SubstitutionType).typeVariable); + } if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (source).target === (target).target) { // If source and target are references to the same generic type, infer from type arguments const sourceTypes = (source).typeArguments || emptyArray; @@ -14477,29 +14526,19 @@ namespace ts { inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target)); } else if (target.flags & TypeFlags.Conditional) { - inferFromTypes(source, getUnionType([getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)])); + inferFromTypes(source, getTrueTypeFromConditionalType(target)); + inferFromTypes(source, getFalseTypeFromConditionalType(target)); } else if (target.flags & TypeFlags.UnionOrIntersection) { - const targetTypes = (target).types; - let typeVariableCount = 0; - let typeVariable: TypeParameter | IndexedAccessType | undefined; - // First infer to each type in union or intersection that isn't a type variable - for (const t of targetTypes) { + for (const t of (target).types) { + const savePriority = priority; + // Inferences directly to naked type variables are given lower priority as they are + // less specific. For example, when inferring from Promise to T | Promise, + // we want to infer string for T, not Promise | string. if (getInferenceInfoForType(t)) { - typeVariable = t; - typeVariableCount++; - } - else { - inferFromTypes(source, t); + priority |= InferencePriority.NakedTypeVariable; } - } - // Next, if target containings a single naked type variable, make a secondary inference to that type - // variable. This gives meaningful results for union types in co-variant positions and intersection - // types in contra-variant positions (such as callback parameters). - if (typeVariableCount === 1) { - const savePriority = priority; - priority |= InferencePriority.NakedTypeVariable; - inferFromTypes(source, typeVariable!); + inferFromTypes(source, t); priority = savePriority; } } @@ -14587,11 +14626,11 @@ namespace ts { return undefined; } - function inferFromMappedTypeConstraint(source: Type, target: Type, constraintType: Type): boolean { + function inferToMappedType(source: Type, target: MappedType, constraintType: Type): boolean { if (constraintType.flags & TypeFlags.Union) { let result = false; for (const type of (constraintType as UnionType).types) { - result = inferFromMappedTypeConstraint(source, target, type) || result; + result = inferToMappedType(source, target, type) || result; } return result; } @@ -14602,7 +14641,7 @@ namespace ts { // such that direct inferences to T get priority over inferences to Partial, for example. const inference = getInferenceInfoForType((constraintType).type); if (inference && !inference.isFixed) { - const inferredType = inferTypeForHomomorphicMappedType(source, target, constraintType as IndexType); + const inferredType = inferTypeForHomomorphicMappedType(source, target, constraintType); if (inferredType) { const savePriority = priority; priority |= InferencePriority.HomomorphicMappedType; @@ -14613,18 +14652,28 @@ namespace ts { return true; } if (constraintType.flags & TypeFlags.TypeParameter) { - // We're inferring from some source type S to a mapped type { [P in T]: X }, where T is a type - // parameter. Infer from 'keyof S' to T and infer from a union of each property type in S to X. + // We're inferring from some source type S to a mapped type { [P in K]: X }, where K is a type + // parameter. First infer from 'keyof S' to K. const savePriority = priority; priority |= InferencePriority.MappedTypeConstraint; inferFromTypes(getIndexType(source), constraintType); priority = savePriority; + // If K is constrained to a type C, also infer to C. Thus, for a mapped type { [P in K]: X }, + // where K extends keyof T, we make the same inferences as for a homomorphic mapped type + // { [P in keyof T]: X }. This enables us to make meaningful inferences when the target is a + // Pick. + const extendedConstraint = getConstraintOfType(constraintType); + if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) { + return true; + } + // If no inferences can be made to K's constraint, infer from a union of the property types + // in the source to the template type X. const valueTypes = compact([ getIndexTypeOfType(source, IndexKind.String), getIndexTypeOfType(source, IndexKind.Number), ...map(getPropertiesOfType(source), getTypeOfSymbol) ]); - inferFromTypes(getUnionType(valueTypes), getTemplateTypeFromMappedType(target)); + inferFromTypes(getUnionType(valueTypes), getTemplateTypeFromMappedType(target)); return true; } return false; @@ -14639,7 +14688,7 @@ namespace ts { } if (getObjectFlags(target) & ObjectFlags.Mapped) { const constraintType = getConstraintTypeFromMappedType(target); - if (inferFromMappedTypeConstraint(source, target, constraintType)) { + if (inferToMappedType(source, target, constraintType)) { return; } } @@ -14694,7 +14743,7 @@ namespace ts { const sourceLen = sourceSignatures.length; const targetLen = targetSignatures.length; const len = sourceLen < targetLen ? sourceLen : targetLen; - const skipParameters = !!(source.flags & TypeFlags.ContainsAnyFunctionType); + const skipParameters = !!(getObjectFlags(source) & ObjectFlags.ContainsAnyFunctionType); for (let i = 0; i < len; i++) { inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getBaseSignature(targetSignatures[targetLen - len + i]), skipParameters); } @@ -15452,7 +15501,7 @@ namespace ts { if (type.flags & TypeFlags.Union) { const types = (type).types; const filtered = filter(types, f); - return filtered === types ? type : getUnionTypeFromSortedList(filtered, (type).primitiveTypesOnly); + return filtered === types ? type : getUnionTypeFromSortedList(filtered, (type).objectFlags); } return f(type) ? type : neverType; } @@ -18358,7 +18407,6 @@ namespace ts { let propertiesTable: SymbolTable; let propertiesArray: Symbol[] = []; let spread: Type = emptyObjectType; - let propagatedFlags: TypeFlags = 0; const contextualType = getApparentTypeOfContextualType(node); const contextualTypeHasPattern = contextualType && contextualType.pattern && @@ -18368,7 +18416,7 @@ namespace ts { const isInJavascript = isInJSFile(node) && !isInJsonFile(node); const enumTag = getJSDocEnumTag(node); const isJSObjectLiteral = !contextualType && isInJavascript && !enumTag; - let typeFlags: TypeFlags = 0; + let objectFlags: ObjectFlags = freshObjectLiteralFlag; let patternWithComputedProperties = false; let hasComputedStringProperty = false; let hasComputedNumberProperty = false; @@ -18396,7 +18444,7 @@ namespace ts { checkTypeAssignableTo(type, getTypeFromTypeNode(enumTag.typeExpression), memberDecl); } } - typeFlags |= type.flags; + objectFlags |= getObjectFlags(type) & ObjectFlags.PropagatingFlags; const nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : undefined; const prop = nameType ? createSymbol(SymbolFlags.Property | member.flags, getPropertyNameFromType(nameType), checkFlags | CheckFlags.Late) : @@ -18444,19 +18492,18 @@ namespace ts { checkExternalEmitHelpers(memberDecl, ExternalEmitHelpers.Assign); } if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), node.symbol, propagatedFlags, ObjectFlags.FreshLiteral, inConstContext); + spread = getSpreadType(spread, createObjectLiteralType(), node.symbol, objectFlags, inConstContext); propertiesArray = []; propertiesTable = createSymbolTable(); hasComputedStringProperty = false; hasComputedNumberProperty = false; - typeFlags = 0; } const type = checkExpression(memberDecl.expression); if (!isValidSpreadType(type)) { error(memberDecl, Diagnostics.Spread_types_may_only_be_created_from_object_types); return errorType; } - spread = getSpreadType(spread, type, node.symbol, propagatedFlags, ObjectFlags.FreshLiteral, inConstContext); + spread = getSpreadType(spread, type, node.symbol, objectFlags, inConstContext); offset = i + 1; continue; } @@ -18506,7 +18553,7 @@ namespace ts { if (spread !== emptyObjectType) { if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), node.symbol, propagatedFlags, ObjectFlags.FreshLiteral, inConstContext); + spread = getSpreadType(spread, createObjectLiteralType(), node.symbol, objectFlags, inConstContext); } return spread; } @@ -18517,8 +18564,7 @@ namespace ts { const stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, offset, propertiesArray, IndexKind.String) : undefined; const numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, offset, propertiesArray, IndexKind.Number) : undefined; const result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); - result.flags |= TypeFlags.ContainsObjectLiteral | typeFlags & TypeFlags.PropagatingFlags; - result.objectFlags |= ObjectFlags.ObjectLiteral | freshObjectLiteralFlag; + result.objectFlags |= objectFlags | ObjectFlags.ObjectLiteral | ObjectFlags.ContainsObjectLiteral; if (isJSObjectLiteral) { result.objectFlags |= ObjectFlags.JSLiteral; } @@ -18528,7 +18574,6 @@ namespace ts { if (inDestructuringPattern) { result.pattern = node; } - propagatedFlags |= result.flags & TypeFlags.PropagatingFlags; return result; } } @@ -18619,7 +18664,6 @@ namespace ts { let hasSpreadAnyType = false; let typeToIntersect: Type | undefined; let explicitlySpecifyChildrenAttribute = false; - let typeFlags: TypeFlags = 0; let objectFlags: ObjectFlags = ObjectFlags.JsxAttributes; const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(openingLikeElement)); @@ -18627,7 +18671,7 @@ namespace ts { const member = attributeDecl.symbol; if (isJsxAttribute(attributeDecl)) { const exprType = checkJsxAttribute(attributeDecl, checkMode); - typeFlags |= exprType.flags & TypeFlags.PropagatingFlags; + objectFlags |= getObjectFlags(exprType) & ObjectFlags.PropagatingFlags; const attributeSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.escapedName); attributeSymbol.declarations = member.declarations; @@ -18645,7 +18689,7 @@ namespace ts { else { Debug.assert(attributeDecl.kind === SyntaxKind.JsxSpreadAttribute); if (attributesTable.size > 0) { - spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, typeFlags, objectFlags, /*readonly*/ false); + spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false); attributesTable = createSymbolTable(); } const exprType = checkExpressionCached(attributeDecl.expression, checkMode); @@ -18653,7 +18697,7 @@ namespace ts { hasSpreadAnyType = true; } if (isValidSpreadType(exprType)) { - spread = getSpreadType(spread, exprType, attributes.symbol, typeFlags, objectFlags, /*readonly*/ false); + spread = getSpreadType(spread, exprType, attributes.symbol, objectFlags, /*readonly*/ false); } else { typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType; @@ -18663,7 +18707,7 @@ namespace ts { if (!hasSpreadAnyType) { if (attributesTable.size > 0) { - spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, typeFlags, objectFlags, /*readonly*/ false); + spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false); } } @@ -18695,7 +18739,7 @@ namespace ts { const childPropMap = createSymbolTable(); childPropMap.set(jsxChildrenPropertyName, childrenPropSymbol); spread = getSpreadType(spread, createAnonymousType(attributes.symbol, childPropMap, emptyArray, emptyArray, /*stringIndexInfo*/ undefined, /*numberIndexInfo*/ undefined), - attributes.symbol, typeFlags, objectFlags, /*readonly*/ false); + attributes.symbol, objectFlags, /*readonly*/ false); } } @@ -18716,8 +18760,7 @@ namespace ts { function createJsxAttributesType() { objectFlags |= freshObjectLiteralFlag; const result = createAnonymousType(attributes.symbol, attributesTable, emptyArray, emptyArray, /*stringIndexInfo*/ undefined, /*numberIndexInfo*/ undefined); - result.flags |= TypeFlags.ContainsObjectLiteral | typeFlags; - result.objectFlags |= ObjectFlags.ObjectLiteral | objectFlags; + result.objectFlags |= objectFlags | ObjectFlags.ObjectLiteral | ObjectFlags.ContainsObjectLiteral; return result; } } @@ -21425,7 +21468,7 @@ namespace ts { const anonymousSymbol = createSymbol(SymbolFlags.TypeLiteral, InternalSymbolName.Type); const defaultContainingObject = createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, /*stringIndexInfo*/ undefined, /*numberIndexInfo*/ undefined); anonymousSymbol.type = defaultContainingObject; - synthType.syntheticType = isValidSpreadType(type) ? getSpreadType(type, defaultContainingObject, anonymousSymbol, /*typeFLags*/ 0, /*objectFlags*/ 0, /*readonly*/ false) : defaultContainingObject; + synthType.syntheticType = isValidSpreadType(type) ? getSpreadType(type, defaultContainingObject, anonymousSymbol, /*objectFlags*/ 0, /*readonly*/ false) : defaultContainingObject; } else { synthType.syntheticType = type; @@ -21601,13 +21644,8 @@ namespace ts { } if (signature.hasRestParameter) { const restType = getTypeOfSymbol(signature.parameters[paramCount]); - if (isTupleType(restType)) { - if (pos - paramCount < getLengthOfTupleType(restType)) { - return restType.typeArguments![pos - paramCount]; - } - return getRestTypeOfTupleType(restType); - } - return getIndexTypeOfType(restType, IndexKind.Number); + const indexType = getLiteralType(pos - paramCount); + return getIndexedAccessType(restType, indexType); } return undefined; } @@ -21615,18 +21653,22 @@ namespace ts { function getRestTypeAtPosition(source: Signature, pos: number): Type { const paramCount = getParameterCount(source); const restType = getEffectiveRestType(source); - if (restType && pos === paramCount - 1) { + const nonRestCount = paramCount - (restType ? 1 : 0); + if (restType && pos === nonRestCount) { return restType; } - const start = restType ? Math.min(pos, paramCount - 1) : pos; const types = []; const names = []; - for (let i = start; i < paramCount; i++) { + for (let i = pos; i < nonRestCount; i++) { types.push(getTypeAtPosition(source, i)); names.push(getParameterNameAtPosition(source, i)); } + if (restType) { + types.push(getIndexedAccessType(restType, numberType)); + names.push(getParameterNameAtPosition(source, nonRestCount)); + } const minArgumentCount = getMinArgumentCount(source); - const minLength = minArgumentCount < start ? 0 : minArgumentCount - start; + const minLength = minArgumentCount < pos ? 0 : minArgumentCount - pos; return createTupleType(types, minLength, !!restType, /*readonly*/ false, names); } @@ -22104,7 +22146,7 @@ namespace ts { const returnType = getReturnTypeFromBody(node, checkMode); const returnOnlySignature = createSignature(undefined, undefined, undefined, emptyArray, returnType, /*resolvedTypePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); const returnOnlyType = createAnonymousType(node.symbol, emptySymbols, [returnOnlySignature], emptyArray, undefined, undefined); - returnOnlyType.flags |= TypeFlags.ContainsAnyFunctionType; + returnOnlyType.objectFlags |= ObjectFlags.ContainsAnyFunctionType; return links.contextFreeType = returnOnlyType; } return anyFunctionType; @@ -24472,7 +24514,10 @@ namespace ts { const bodySignature = getSignatureFromDeclaration(bodyDeclaration); for (const signature of signatures) { if (!isImplementationCompatibleWithOverload(bodySignature, signature)) { - error(signature.declaration, Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + addRelatedInfo( + error(signature.declaration, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), + createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here) + ); break; } } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index c5505ec373669..4bd4801ce8f64 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1396,9 +1396,10 @@ namespace ts { export function assign(t: T, ...args: (T | undefined)[]) { for (const arg of args) { - for (const p in arg!) { - if (hasProperty(arg!, p)) { - t![p] = arg![p]; // TODO: GH#23368 + if (arg === undefined) continue; + for (const p in arg) { + if (hasProperty(arg, p)) { + t[p] = arg[p]; } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index e40fccd8bf2f0..09b0f72129255 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1404,7 +1404,7 @@ "category": "Error", "code": 2393 }, - "Overload signature is not compatible with function implementation.": { + "This overload signature is not compatible with its implementation signature.": { "category": "Error", "code": 2394 }, @@ -2581,6 +2581,14 @@ "category": "Error", "code": 2748 }, + "'{0}' refers to a value, but is being used as a type here.": { + "category": "Error", + "code": 2749 + }, + "The implementation signature is declared here.": { + "category": "Error", + "code": 2750 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 00d8419205579..f303dcb47a637 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -89,10 +89,10 @@ namespace ts { return createLiteralFromNode(value); } - export function createNumericLiteral(value: string): NumericLiteral { + export function createNumericLiteral(value: string, numericLiteralFlags: TokenFlags = TokenFlags.None): NumericLiteral { const node = createSynthesizedNode(SyntaxKind.NumericLiteral); node.text = value; - node.numericLiteralFlags = 0; + node.numericLiteralFlags = numericLiteralFlags; return node; } diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 35e9a9ec35fd0..33283c9380352 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -632,7 +632,7 @@ namespace ts { getModifiedTime, setModifiedTime, deleteFile, - createHash: _crypto ? createMD5HashUsingNativeCrypto : generateDjb2Hash, + createHash: _crypto ? createSHA256Hash : generateDjb2Hash, createSHA256Hash: _crypto ? createSHA256Hash : undefined, getMemoryUsage() { if (global.gc) { @@ -1125,12 +1125,6 @@ namespace ts { } } - function createMD5HashUsingNativeCrypto(data: string): string { - const hash = _crypto!.createHash("md5"); - hash.update(data); - return hash.digest("hex"); - } - function createSHA256Hash(data: string): string { const hash = _crypto!.createHash("sha256"); hash.update(data); diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 42bb5d7793131..63c340d81dc8a 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -1006,7 +1006,9 @@ namespace ts { if (!isPropertyAccessExpression(p.valueDeclaration)) { return undefined; } + getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration); const type = resolver.createTypeOfDeclaration(p.valueDeclaration, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker); + getSymbolAccessibilityDiagnostic = oldDiag; const varDecl = createVariableDeclaration(unescapeLeadingUnderscores(p.escapedName), type, /*initializer*/ undefined); return createVariableStatement(/*modifiers*/ undefined, createVariableDeclarationList([varDecl])); }); diff --git a/src/compiler/transformers/declarations/diagnostics.ts b/src/compiler/transformers/declarations/diagnostics.ts index b4c72c7901214..9a9aed99e4791 100644 --- a/src/compiler/transformers/declarations/diagnostics.ts +++ b/src/compiler/transformers/declarations/diagnostics.ts @@ -26,7 +26,8 @@ namespace ts { | ImportEqualsDeclaration | TypeAliasDeclaration | ConstructorDeclaration - | IndexSignatureDeclaration; + | IndexSignatureDeclaration + | PropertyAccessExpression; export function canProduceDiagnostics(node: Node): node is DeclarationDiagnosticProducing { return isVariableDeclaration(node) || @@ -46,7 +47,8 @@ namespace ts { isImportEqualsDeclaration(node) || isTypeAliasDeclaration(node) || isConstructorDeclaration(node) || - isIndexSignatureDeclaration(node); + isIndexSignatureDeclaration(node) || + isPropertyAccessExpression(node); } export function createGetSymbolAccessibilityDiagnosticForNodeName(node: DeclarationDiagnosticProducing) { @@ -123,7 +125,7 @@ namespace ts { } export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationDiagnosticProducing): (symbolAccessibilityResult: SymbolAccessibilityResult) => SymbolAccessibilityDiagnostic | undefined { - if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isBindingElement(node) || isConstructorDeclaration(node)) { + if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) { return getVariableDeclarationTypeVisibilityError; } else if (isSetAccessor(node) || isGetAccessor(node)) { @@ -164,7 +166,7 @@ namespace ts { } // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. - else if (node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature || + else if (node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertyAccessExpression || node.kind === SyntaxKind.PropertySignature || (node.kind === SyntaxKind.Parameter && hasModifier(node.parent, ModifierFlags.Private))) { // TODO(jfreeman): Deal with computed properties in error reporting. if (hasModifier(node, ModifierFlags.Static)) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f43b67b337258..3992f145f20d1 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1648,20 +1648,26 @@ namespace ts { kind: SyntaxKind.NoSubstitutionTemplateLiteral; } - /* @internal */ export const enum TokenFlags { None = 0, + /* @internal */ PrecedingLineBreak = 1 << 0, + /* @internal */ PrecedingJSDocComment = 1 << 1, + /* @internal */ Unterminated = 1 << 2, + /* @internal */ ExtendedUnicodeEscape = 1 << 3, Scientific = 1 << 4, // e.g. `10e2` Octal = 1 << 5, // e.g. `0777` HexSpecifier = 1 << 6, // e.g. `0x00000000` BinarySpecifier = 1 << 7, // e.g. `0b0110010000000000` OctalSpecifier = 1 << 8, // e.g. `0o777` + /* @internal */ ContainsSeparator = 1 << 9, // e.g. `0b1100_0101` + /* @internal */ BinaryOrOctalSpecifier = BinarySpecifier | OctalSpecifier, + /* @internal */ NumericLiteralFlags = Scientific | Octal | HexSpecifier | BinaryOrOctalSpecifier | ContainsSeparator } @@ -3818,39 +3824,33 @@ namespace ts { } export const enum TypeFlags { - Any = 1 << 0, - Unknown = 1 << 1, - String = 1 << 2, - Number = 1 << 3, - Boolean = 1 << 4, - Enum = 1 << 5, - BigInt = 1 << 6, - StringLiteral = 1 << 7, - NumberLiteral = 1 << 8, - BooleanLiteral = 1 << 9, - EnumLiteral = 1 << 10, // Always combined with StringLiteral, NumberLiteral, or Union - BigIntLiteral = 1 << 11, - ESSymbol = 1 << 12, // Type of symbol primitive introduced in ES6 - UniqueESSymbol = 1 << 13, // unique symbol - Void = 1 << 14, - Undefined = 1 << 15, - Null = 1 << 16, - Never = 1 << 17, // Never type - TypeParameter = 1 << 18, // Type parameter - Object = 1 << 19, // Object type - Union = 1 << 20, // Union (T | U) - Intersection = 1 << 21, // Intersection (T & U) - Index = 1 << 22, // keyof T - IndexedAccess = 1 << 23, // T[K] - Conditional = 1 << 24, // T extends U ? X : Y - Substitution = 1 << 25, // Type parameter substitution - NonPrimitive = 1 << 26, // intrinsic object type - /* @internal */ - ContainsWideningType = 1 << 27, // Type is or contains undefined or null widening type - /* @internal */ - ContainsObjectLiteral = 1 << 28, // Type is or contains object literal type - /* @internal */ - ContainsAnyFunctionType = 1 << 29, // Type is or contains the anyFunctionType + Any = 1 << 0, + Unknown = 1 << 1, + String = 1 << 2, + Number = 1 << 3, + Boolean = 1 << 4, + Enum = 1 << 5, + BigInt = 1 << 6, + StringLiteral = 1 << 7, + NumberLiteral = 1 << 8, + BooleanLiteral = 1 << 9, + EnumLiteral = 1 << 10, // Always combined with StringLiteral, NumberLiteral, or Union + BigIntLiteral = 1 << 11, + ESSymbol = 1 << 12, // Type of symbol primitive introduced in ES6 + UniqueESSymbol = 1 << 13, // unique symbol + Void = 1 << 14, + Undefined = 1 << 15, + Null = 1 << 16, + Never = 1 << 17, // Never type + TypeParameter = 1 << 18, // Type parameter + Object = 1 << 19, // Object type + Union = 1 << 20, // Union (T | U) + Intersection = 1 << 21, // Intersection (T & U) + Index = 1 << 22, // keyof T + IndexedAccess = 1 << 23, // T[K] + Conditional = 1 << 24, // T extends U ? X : Y + Substitution = 1 << 25, // Type parameter substitution + NonPrimitive = 1 << 26, // intrinsic object type /* @internal */ AnyOrUnknown = Any | Unknown, @@ -3884,29 +3884,29 @@ namespace ts { InstantiablePrimitive = Index, Instantiable = InstantiableNonPrimitive | InstantiablePrimitive, StructuredOrInstantiable = StructuredType | Instantiable, - + /* @internal */ + ObjectFlagsType = Nullable | Object | Union | Intersection, // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never Narrowable = Any | Unknown | StructuredOrInstantiable | StringLike | NumberLike | BigIntLike | BooleanLike | ESSymbol | UniqueESSymbol | NonPrimitive, NotUnionOrUnit = Any | Unknown | ESSymbol | Object | NonPrimitive, /* @internal */ NotPrimitiveUnion = Any | Unknown | Enum | Void | Never | StructuredOrInstantiable, + // The following flags are aggregated during union and intersection type construction /* @internal */ - RequiresWidening = ContainsWideningType | ContainsObjectLiteral, - /* @internal */ - PropagatingFlags = ContainsWideningType | ContainsObjectLiteral | ContainsAnyFunctionType, + IncludesMask = Any | Unknown | Primitive | Never | Object | Union, // The following flags are used for different purposes during union and intersection type construction /* @internal */ - NonWideningType = ContainsWideningType, + IncludesStructuredOrInstantiable = TypeParameter, /* @internal */ - Wildcard = ContainsObjectLiteral, + IncludesNonWideningType = Intersection, /* @internal */ - EmptyObject = ContainsAnyFunctionType, + IncludesWildcard = Index, /* @internal */ - ConstructionFlags = NonWideningType | Wildcard | EmptyObject, + IncludesEmptyObject = IndexedAccess, // The following flag is used for different purposes by maybeTypeOfKind /* @internal */ - GenericMappedType = ContainsWideningType + GenericMappedType = Never, } export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; @@ -3933,6 +3933,12 @@ namespace ts { // Intrinsic types (TypeFlags.Intrinsic) export interface IntrinsicType extends Type { intrinsicName: string; // Name of intrinsic type + objectFlags: ObjectFlags; + } + + /* @internal */ + export interface NullableType extends IntrinsicType { + objectFlags: ObjectFlags; } /* @internal */ @@ -3992,9 +3998,24 @@ namespace ts { MarkerType = 1 << 13, // Marker type used for variance probing JSLiteral = 1 << 14, // Object type declared in JS - disables errors on read/write of nonexisting members FreshLiteral = 1 << 15, // Fresh object literal - ClassOrInterface = Class | Interface + /* @internal */ + PrimitiveUnion = 1 << 16, // Union of only primitive types + /* @internal */ + ContainsWideningType = 1 << 17, // Type is or contains undefined or null widening type + /* @internal */ + ContainsObjectLiteral = 1 << 18, // Type is or contains object literal type + /* @internal */ + ContainsAnyFunctionType = 1 << 19, // Type is or contains the anyFunctionType + ClassOrInterface = Class | Interface, + /* @internal */ + RequiresWidening = ContainsWideningType | ContainsObjectLiteral, + /* @internal */ + PropagatingFlags = ContainsWideningType | ContainsObjectLiteral | ContainsAnyFunctionType } + /* @internal */ + export type ObjectFlagsType = NullableType | ObjectType | UnionType | IntersectionType; + // Object types (TypeFlags.ObjectType) export interface ObjectType extends Type { objectFlags: ObjectFlags; @@ -4075,6 +4096,8 @@ namespace ts { export interface UnionOrIntersectionType extends Type { types: Type[]; // Constituent types /* @internal */ + objectFlags: ObjectFlags; + /* @internal */ propertyCache: SymbolTable; // Cache of resolved properties /* @internal */ resolvedProperties: Symbol[]; @@ -4089,8 +4112,6 @@ namespace ts { } export interface UnionType extends UnionOrIntersectionType { - /* @internal */ - primitiveTypesOnly: boolean; } export interface IntersectionType extends UnionOrIntersectionType { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 29d2ebfa59e3f..aa2ebe3d60c07 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4515,7 +4515,7 @@ namespace ts { } export function getObjectFlags(type: Type): ObjectFlags { - return type.flags & TypeFlags.Object ? (type).objectFlags : 0; + return type.flags & TypeFlags.ObjectFlagsType ? (type).objectFlags : 0; } export function typeHasCallOrConstructSignatures(type: Type, checker: TypeChecker) { diff --git a/src/compiler/watchUtilities.ts b/src/compiler/watchUtilities.ts index 9bf242e07e82c..565af054b8feb 100644 --- a/src/compiler/watchUtilities.ts +++ b/src/compiler/watchUtilities.ts @@ -361,9 +361,9 @@ namespace ts { function getWatchFactoryWith(watchLogLevel: WatchLogLevel, log: (s: string) => void, getDetailWatchInfo: GetDetailWatchInfo | undefined, watchFile: (host: WatchFileHost, file: string, callback: FileWatcherCallback, watchPriority: PollingInterval) => FileWatcher, watchDirectory: (host: WatchDirectoryHost, directory: string, callback: DirectoryWatcherCallback, flags: WatchDirectoryFlags) => FileWatcher): WatchFactory { - const createFileWatcher: CreateFileWatcher = getCreateFileWatcher(watchLogLevel, watchFile); + const createFileWatcher: CreateFileWatcher = getCreateFileWatcher(watchLogLevel, watchFile); const createFilePathWatcher: CreateFileWatcher = watchLogLevel === WatchLogLevel.None ? watchFilePath : createFileWatcher; - const createDirectoryWatcher: CreateFileWatcher = getCreateFileWatcher(watchLogLevel, watchDirectory); + const createDirectoryWatcher: CreateFileWatcher = getCreateFileWatcher(watchLogLevel, watchDirectory); return { watchFile: (host, file, callback, pollingInterval, detailInfo1, detailInfo2) => createFileWatcher(host, file, callback, pollingInterval, /*passThrough*/ undefined, detailInfo1, detailInfo2, watchFile, log, "FileWatcher", getDetailWatchInfo), @@ -402,7 +402,7 @@ namespace ts { } } - function createFileWatcherWithLogging(host: H, file: string, cb: WatchCallback, flags: T, passThrough: V | undefined, detailInfo1: X | undefined, detailInfo2: Y | undefined, addWatch: AddWatch, log: (s: string) => void, watchCaption: string, getDetailWatchInfo: GetDetailWatchInfo | undefined): FileWatcher { + function createFileWatcherWithLogging(host: H, file: string, cb: WatchCallback, flags: T, passThrough: V | undefined, detailInfo1: X | undefined, detailInfo2: Y | undefined, addWatch: AddWatch, log: (s: string) => void, watchCaption: string, getDetailWatchInfo: GetDetailWatchInfo | undefined): FileWatcher { log(`${watchCaption}:: Added:: ${getWatchInfo(file, flags, detailInfo1, detailInfo2, getDetailWatchInfo)}`); const watcher = createFileWatcherWithTriggerLogging(host, file, cb, flags, passThrough, detailInfo1, detailInfo2, addWatch, log, watchCaption, getDetailWatchInfo); return { @@ -413,7 +413,7 @@ namespace ts { }; } - function createDirectoryWatcherWithLogging(host: H, file: string, cb: WatchCallback, flags: T, passThrough: V | undefined, detailInfo1: X | undefined, detailInfo2: Y | undefined, addWatch: AddWatch, log: (s: string) => void, watchCaption: string, getDetailWatchInfo: GetDetailWatchInfo | undefined): FileWatcher { + function createDirectoryWatcherWithLogging(host: H, file: string, cb: WatchCallback, flags: T, passThrough: V | undefined, detailInfo1: X | undefined, detailInfo2: Y | undefined, addWatch: AddWatch, log: (s: string) => void, watchCaption: string, getDetailWatchInfo: GetDetailWatchInfo | undefined): FileWatcher { const watchInfo = `${watchCaption}:: Added:: ${getWatchInfo(file, flags, detailInfo1, detailInfo2, getDetailWatchInfo)}`; log(watchInfo); const start = timestamp(); @@ -432,7 +432,7 @@ namespace ts { }; } - function createFileWatcherWithTriggerLogging(host: H, file: string, cb: WatchCallback, flags: T, passThrough: V | undefined, detailInfo1: X | undefined, detailInfo2: Y | undefined, addWatch: AddWatch, log: (s: string) => void, watchCaption: string, getDetailWatchInfo: GetDetailWatchInfo | undefined): FileWatcher { + function createFileWatcherWithTriggerLogging(host: H, file: string, cb: WatchCallback, flags: T, passThrough: V | undefined, detailInfo1: X | undefined, detailInfo2: Y | undefined, addWatch: AddWatch, log: (s: string) => void, watchCaption: string, getDetailWatchInfo: GetDetailWatchInfo | undefined): FileWatcher { return addWatch(host, file, (fileName, cbOptional) => { const triggerredInfo = `${watchCaption}:: Triggered with ${fileName} ${cbOptional !== undefined ? cbOptional : ""}:: ${getWatchInfo(file, flags, detailInfo1, detailInfo2, getDetailWatchInfo)}`; log(triggerredInfo); diff --git a/src/harness/evaluator.ts b/src/harness/evaluator.ts index 168fda1d7670e..a22bdb958bc5f 100644 --- a/src/harness/evaluator.ts +++ b/src/harness/evaluator.ts @@ -56,6 +56,7 @@ namespace evaluator { } const evaluateText = `(function (module, exports, require, __dirname, __filename, ${globalNames.join(", ")}) { ${output.text} })`; + // tslint:disable-next-line:no-eval const evaluateThunk = eval(evaluateText) as (module: any, exports: any, require: (id: string) => any, dirname: string, filename: string, ...globalArgs: any[]) => void; const module: { exports: any; } = { exports: {} }; evaluateThunk.call(globals, module, module.exports, noRequire, vpath.dirname(output.file), output.file, FakeSymbol, ...globalArgs); diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index b0bb35d5db3bc..f3a7197e7772c 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -3159,6 +3159,7 @@ ${code} const debug = new FourSlashInterface.Debug(state); const format = new FourSlashInterface.Format(state); const cancellation = new FourSlashInterface.Cancellation(state); + // tslint:disable-next-line:no-eval const f = eval(wrappedCode); f(test, goTo, plugins, verify, edit, debug, format, cancellation, FourSlashInterface.Classification, FourSlashInterface.Completion, verifyOperationIsCancelled); } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 13ef2adbf90be..a78a04c3ecbe3 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -77,6 +77,7 @@ namespace Utils { const environment = getExecutionEnvironment(); switch (environment) { case ExecutionEnvironment.Browser: + // tslint:disable-next-line:no-eval eval(fileContents); break; case ExecutionEnvironment.Node: diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index a78ef88e5b74b..b70afecb7916d 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -766,6 +766,7 @@ namespace Harness.LanguageService { } setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any { + // tslint:disable-next-line:ban return setTimeout(callback, ms, args); } diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 6dccc08c4b5cd..e9d97f6e03c02 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -7,7 +7,6 @@ namespace ts.server { export const ProjectsUpdatedInBackgroundEvent = "projectsUpdatedInBackground"; export const ProjectLoadingStartEvent = "projectLoadingStart"; export const ProjectLoadingFinishEvent = "projectLoadingFinish"; - export const SurveyReady = "surveyReady"; export const LargeFileReferencedEvent = "largeFileReferenced"; export const ConfigFileDiagEvent = "configFileDiag"; export const ProjectLanguageServiceStateEvent = "projectLanguageServiceState"; @@ -30,11 +29,6 @@ namespace ts.server { data: { project: Project; }; } - export interface SurveyReady { - eventName: typeof SurveyReady; - data: { surveyId: string; }; - } - export interface LargeFileReferencedEvent { eventName: typeof LargeFileReferencedEvent; data: { file: string; fileSize: number; maxFileSize: number; }; @@ -146,7 +140,6 @@ namespace ts.server { } export type ProjectServiceEvent = LargeFileReferencedEvent | - SurveyReady | ProjectsUpdatedInBackgroundEvent | ProjectLoadingStartEvent | ProjectLoadingFinishEvent | @@ -518,9 +511,6 @@ namespace ts.server { /** Tracks projects that we have already sent telemetry for. */ private readonly seenProjects = createMap(); - /** Tracks projects that we have already sent survey events for. */ - private readonly seenSurveyProjects = createMap(); - /*@internal*/ readonly watchFactory: WatchFactory; @@ -722,14 +712,6 @@ namespace ts.server { this.eventHandler(event); } - /* @internal */ - sendSurveyReadyEvent(surveyId: string) { - if (!this.eventHandler) { - return; - } - this.eventHandler({ eventName: SurveyReady, data: { surveyId } }); - } - /* @internal */ sendLargeFileReferencedEvent(file: string, fileSize: number) { if (!this.eventHandler) { @@ -1611,20 +1593,6 @@ namespace ts.server { return project; } - /*@internal*/ - sendSurveyReady(project: ExternalProject | ConfiguredProject): void { - if (this.seenSurveyProjects.has(project.projectName)) { - return; - } - - if (project.getCompilerOptions().checkJs !== undefined) { - const name = "checkJs"; - this.logger.info(`Survey ${name} is ready`); - this.sendSurveyReadyEvent(name); - this.seenSurveyProjects.set(project.projectName, true); - } - } - /*@internal*/ sendProjectTelemetry(project: ExternalProject | ConfiguredProject): void { if (this.seenProjects.has(project.projectName)) { diff --git a/src/server/project.ts b/src/server/project.ts index b296668e6ae4c..280cedb424d6b 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1431,7 +1431,6 @@ namespace ts.server { } this.projectService.sendProjectLoadingFinishEvent(this); this.projectService.sendProjectTelemetry(this); - this.projectService.sendSurveyReady(this); return result; } @@ -1627,7 +1626,6 @@ namespace ts.server { updateGraph() { const result = super.updateGraph(); this.projectService.sendProjectTelemetry(this); - this.projectService.sendSurveyReady(this); return result; } diff --git a/src/server/session.ts b/src/server/session.ts index e5b128c984e82..b47dfe6b716e7 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -610,10 +610,6 @@ namespace ts.server { diagnostics: bakedDiags }, ConfigFileDiagEvent); break; - case SurveyReady: - const { surveyId } = event.data; - this.event({ surveyId }, SurveyReady); - break; case ProjectLanguageServiceStateEvent: { const eventName: protocol.ProjectLanguageServiceStateEventName = ProjectLanguageServiceStateEvent; this.event({ diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index ec86415b9fae9..45a79613db5fd 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -156,7 +156,7 @@ namespace ts.codefix { isIdentifier(arg) ? arg.text : isPropertyAccessExpression(arg) ? arg.name.text : undefined); const contextualType = checker.getContextualType(call); - const returnType = inJs ? undefined : contextualType && checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker) || createKeywordTypeNode(SyntaxKind.AnyKeyword); + const returnType = (inJs || !contextualType) ? undefined : checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker); return createMethod( /*decorators*/ undefined, /*modifiers*/ makeStatic ? [createToken(SyntaxKind.StaticKeyword)] : undefined, diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index b2dac950323cd..8d710f87a4ea2 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -442,7 +442,7 @@ namespace ts.formatting { case SyntaxKind.ForInStatement: // "in" keyword in [P in keyof T]: T[P] case SyntaxKind.TypeParameter: - return context.currentTokenSpan.kind === SyntaxKind.InKeyword || context.nextTokenSpan.kind === SyntaxKind.InKeyword; + return context.currentTokenSpan.kind === SyntaxKind.InKeyword || context.nextTokenSpan.kind === SyntaxKind.InKeyword || context.currentTokenSpan.kind === SyntaxKind.EqualsToken || context.nextTokenSpan.kind === SyntaxKind.EqualsToken; // Technically, "of" is not a binary operator, but format it the same way as "in" case SyntaxKind.ForOfStatement: return context.currentTokenSpan.kind === SyntaxKind.OfKeyword || context.nextTokenSpan.kind === SyntaxKind.OfKeyword; diff --git a/src/testRunner/parallel/host.ts b/src/testRunner/parallel/host.ts index 376896a469777..597013ed0d985 100644 --- a/src/testRunner/parallel/host.ts +++ b/src/testRunner/parallel/host.ts @@ -7,7 +7,7 @@ namespace Harness.Parallel.Host { const Base = Mocha.reporters.Base; const color = Base.color; const cursor = Base.cursor; - const ms = require("mocha/lib/ms") as typeof import("mocha/lib/ms"); + const ms = require("ms") as typeof import("ms"); const readline = require("readline") as typeof import("readline"); const os = require("os") as typeof import("os"); const tty = require("tty") as typeof import("tty"); @@ -302,6 +302,7 @@ namespace Harness.Parallel.Host { worker.timer = undefined; } else { + // tslint:disable-next-line:ban worker.timer = setTimeout(killChild, data.payload.duration, data.payload); } break; @@ -529,6 +530,8 @@ namespace Harness.Parallel.Host { const replayRunner = new Mocha.Runner(new Mocha.Suite(""), /*delay*/ false); replayRunner.started = true; + const createStatsCollector = require("mocha/lib/stats-collector"); + createStatsCollector(replayRunner); // manually init stats collector like mocha.run would const consoleReporter = new Base(replayRunner); patchStats(consoleReporter.stats); @@ -623,6 +626,7 @@ namespace Harness.Parallel.Host { shimNoopTestInterface(global); } + // tslint:disable-next-line:ban setTimeout(() => startDelayed(perfData, totalCost), 0); // Do real startup on next tick, so all unit tests have been collected } } diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index 7e75c0105a2d3..137e4d8af58b7 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -109,7 +109,6 @@ "unittests/tsserver/events/projectLanguageServiceState.ts", "unittests/tsserver/events/projectLoading.ts", "unittests/tsserver/events/projectUpdatedInBackground.ts", - "unittests/tsserver/events/surveyReady.ts", "unittests/tsserver/externalProjects.ts", "unittests/tsserver/forceConsistentCasingInFileNames.ts", "unittests/tsserver/formatSettings.ts", diff --git a/src/testRunner/unittests/tsserver/events/surveyReady.ts b/src/testRunner/unittests/tsserver/events/surveyReady.ts deleted file mode 100644 index b04746800d0cd..0000000000000 --- a/src/testRunner/unittests/tsserver/events/surveyReady.ts +++ /dev/null @@ -1,111 +0,0 @@ -namespace ts.projectSystem { - describe("unittests:: tsserver:: events:: SurveyReady", () => { - function createSessionWithEventHandler(host: TestServerHost) { - const { session, events: surveyEvents } = createSessionWithEventTracking(host, server.SurveyReady); - - return { session, verifySurveyReadyEvent }; - - function verifySurveyReadyEvent(numberOfEvents: number) { - assert.equal(surveyEvents.length, numberOfEvents); - const expectedEvents = numberOfEvents === 0 ? [] : [{ - eventName: server.SurveyReady, - data: { surveyId: "checkJs" } - }]; - assert.deepEqual(surveyEvents, expectedEvents); - } - } - - it("doesn't log an event when checkJs isn't set", () => { - const projectRoot = "/user/username/projects/project"; - const file: File = { - path: `${projectRoot}/src/file.ts`, - content: "export var y = 10;" - }; - const tsconfig: File = { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ compilerOptions: {} }), - }; - const host = createServerHost([file, tsconfig]); - const { session, verifySurveyReadyEvent } = createSessionWithEventHandler(host); - const service = session.getProjectService(); - openFilesForSession([file], session); - checkNumberOfProjects(service, { configuredProjects: 1 }); - const project = service.configuredProjects.get(tsconfig.path)!; - checkProjectActualFiles(project, [file.path, tsconfig.path]); - - verifySurveyReadyEvent(0); - }); - - it("logs an event when checkJs is set", () => { - const projectRoot = "/user/username/projects/project"; - const file: File = { - path: `${projectRoot}/src/file.ts`, - content: "export var y = 10;" - }; - const tsconfig: File = { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { checkJs: true } }), - }; - const host = createServerHost([file, tsconfig]); - const { session, verifySurveyReadyEvent } = createSessionWithEventHandler(host); - openFilesForSession([file], session); - - verifySurveyReadyEvent(1); - }); - - it("logs an event when checkJs is set, only the first time", () => { - const projectRoot = "/user/username/projects/project"; - const file: File = { - path: `${projectRoot}/src/file.ts`, - content: "export var y = 10;" - }; - const rando: File = { - path: `/rando/calrissian.ts`, - content: "export function f() { }" - }; - const tsconfig: File = { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { checkJs: true } }), - }; - const host = createServerHost([file, tsconfig]); - const { session, verifySurveyReadyEvent } = createSessionWithEventHandler(host); - openFilesForSession([file], session); - - verifySurveyReadyEvent(1); - - closeFilesForSession([file], session); - openFilesForSession([rando], session); - openFilesForSession([file], session); - - verifySurveyReadyEvent(1); - }); - - it("logs an event when checkJs is set after closing and reopening", () => { - const projectRoot = "/user/username/projects/project"; - const file: File = { - path: `${projectRoot}/src/file.ts`, - content: "export var y = 10;" - }; - const rando: File = { - path: `/rando/calrissian.ts`, - content: "export function f() { }" - }; - const tsconfig: File = { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({}), - }; - const host = createServerHost([file, tsconfig]); - const { session, verifySurveyReadyEvent } = createSessionWithEventHandler(host); - openFilesForSession([file], session); - - verifySurveyReadyEvent(0); - - closeFilesForSession([file], session); - openFilesForSession([rando], session); - host.writeFile(tsconfig.path, JSON.stringify({ compilerOptions: { checkJs: true } })); - openFilesForSession([file], session); - - verifySurveyReadyEvent(1); - }); - }); -} diff --git a/src/tsserver/server.ts b/src/tsserver/server.ts index 21146958748a8..0dc57ca520ad5 100644 --- a/src/tsserver/server.ts +++ b/src/tsserver/server.ts @@ -705,6 +705,7 @@ namespace ts.server { // stat due to inconsistencies of fs.watch // and efficiency of stat on modern filesystems function startWatchTimer() { + // tslint:disable-next-line:ban setInterval(() => { let count = 0; let nextToCheck = nextFileToCheck; diff --git a/tests/baselines/reference/allowImportClausesToMergeWithTypes.errors.txt b/tests/baselines/reference/allowImportClausesToMergeWithTypes.errors.txt index 684921ae12633..8c4f995531047 100644 --- a/tests/baselines/reference/allowImportClausesToMergeWithTypes.errors.txt +++ b/tests/baselines/reference/allowImportClausesToMergeWithTypes.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/index.ts(4,1): error TS2693: 'zzz' only refers to a type, but is being used as a value here. -tests/cases/compiler/index.ts(9,10): error TS2304: Cannot find name 'originalZZZ'. +tests/cases/compiler/index.ts(9,10): error TS2749: 'originalZZZ' refers to a value, but is being used as a type here. ==== tests/cases/compiler/b.ts (0 errors) ==== @@ -31,4 +31,4 @@ tests/cases/compiler/index.ts(9,10): error TS2304: Cannot find name 'originalZZZ const y: originalZZZ = x; ~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'originalZZZ'. \ No newline at end of file +!!! error TS2749: 'originalZZZ' refers to a value, but is being used as a type here. \ No newline at end of file diff --git a/tests/baselines/reference/anyIdenticalToItself.errors.txt b/tests/baselines/reference/anyIdenticalToItself.errors.txt index bcd3b52daef1d..3eff1c4b87a03 100644 --- a/tests/baselines/reference/anyIdenticalToItself.errors.txt +++ b/tests/baselines/reference/anyIdenticalToItself.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/anyIdenticalToItself.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/anyIdenticalToItself.ts(1,10): error TS2394: This overload signature is not compatible with its implementation signature. tests/cases/compiler/anyIdenticalToItself.ts(6,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/anyIdenticalToItself.ts(10,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -6,7 +6,8 @@ tests/cases/compiler/anyIdenticalToItself.ts(10,9): error TS1056: Accessors are ==== tests/cases/compiler/anyIdenticalToItself.ts (3 errors) ==== function foo(x: any); ~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/anyIdenticalToItself.ts:3:10: The implementation signature is declared here. function foo(x: any); function foo(x: any, y: number) { } diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index e7d9b2e9258ce..dc63ff419252b 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -997,6 +997,14 @@ declare namespace ts { interface NoSubstitutionTemplateLiteral extends LiteralExpression { kind: SyntaxKind.NoSubstitutionTemplateLiteral; } + enum TokenFlags { + None = 0, + Scientific = 16, + Octal = 32, + HexSpecifier = 64, + BinarySpecifier = 128, + OctalSpecifier = 256 + } interface NumericLiteral extends LiteralExpression { kind: SyntaxKind.NumericLiteral; } @@ -3670,7 +3678,7 @@ declare namespace ts { function createLiteral(value: number | PseudoBigInt): NumericLiteral; function createLiteral(value: boolean): BooleanLiteral; function createLiteral(value: string | number | PseudoBigInt | boolean): PrimaryExpression; - function createNumericLiteral(value: string): NumericLiteral; + function createNumericLiteral(value: string, numericLiteralFlags?: TokenFlags): NumericLiteral; function createBigIntLiteral(value: string): BigIntLiteral; function createStringLiteral(text: string): StringLiteral; function createRegularExpressionLiteral(text: string): RegularExpressionLiteral; @@ -8357,7 +8365,6 @@ declare namespace ts.server { const ProjectsUpdatedInBackgroundEvent = "projectsUpdatedInBackground"; const ProjectLoadingStartEvent = "projectLoadingStart"; const ProjectLoadingFinishEvent = "projectLoadingFinish"; - const SurveyReady = "surveyReady"; const LargeFileReferencedEvent = "largeFileReferenced"; const ConfigFileDiagEvent = "configFileDiag"; const ProjectLanguageServiceStateEvent = "projectLanguageServiceState"; @@ -8382,12 +8389,6 @@ declare namespace ts.server { project: Project; }; } - interface SurveyReady { - eventName: typeof SurveyReady; - data: { - surveyId: string; - }; - } interface LargeFileReferencedEvent { eventName: typeof LargeFileReferencedEvent; data: { @@ -8472,7 +8473,7 @@ declare namespace ts.server { interface OpenFileInfo { readonly checkJs: boolean; } - type ProjectServiceEvent = LargeFileReferencedEvent | SurveyReady | ProjectsUpdatedInBackgroundEvent | ProjectLoadingStartEvent | ProjectLoadingFinishEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent | ProjectInfoTelemetryEvent | OpenFileInfoTelemetryEvent; + type ProjectServiceEvent = LargeFileReferencedEvent | ProjectsUpdatedInBackgroundEvent | ProjectLoadingStartEvent | ProjectLoadingFinishEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent | ProjectInfoTelemetryEvent | OpenFileInfoTelemetryEvent; type ProjectServiceEventHandler = (event: ProjectServiceEvent) => void; interface SafeList { [name: string]: { @@ -8589,8 +8590,6 @@ declare namespace ts.server { readonly syntaxOnly?: boolean; /** Tracks projects that we have already sent telemetry for. */ private readonly seenProjects; - /** Tracks projects that we have already sent survey events for. */ - private readonly seenSurveyProjects; constructor(opts: ProjectServiceOptions); toPath(fileName: string): Path; private loadTypesMap; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index b12d9b1ab6f0e..5c7d36c9c995d 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -997,6 +997,14 @@ declare namespace ts { interface NoSubstitutionTemplateLiteral extends LiteralExpression { kind: SyntaxKind.NoSubstitutionTemplateLiteral; } + enum TokenFlags { + None = 0, + Scientific = 16, + Octal = 32, + HexSpecifier = 64, + BinarySpecifier = 128, + OctalSpecifier = 256 + } interface NumericLiteral extends LiteralExpression { kind: SyntaxKind.NumericLiteral; } @@ -3670,7 +3678,7 @@ declare namespace ts { function createLiteral(value: number | PseudoBigInt): NumericLiteral; function createLiteral(value: boolean): BooleanLiteral; function createLiteral(value: string | number | PseudoBigInt | boolean): PrimaryExpression; - function createNumericLiteral(value: string): NumericLiteral; + function createNumericLiteral(value: string, numericLiteralFlags?: TokenFlags): NumericLiteral; function createBigIntLiteral(value: string): BigIntLiteral; function createStringLiteral(text: string): StringLiteral; function createRegularExpressionLiteral(text: string): RegularExpressionLiteral; diff --git a/tests/baselines/reference/callOverloads3.errors.txt b/tests/baselines/reference/callOverloads3.errors.txt index 9b14a6791a3a4..7a38d132cbbb1 100644 --- a/tests/baselines/reference/callOverloads3.errors.txt +++ b/tests/baselines/reference/callOverloads3.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/callOverloads3.ts(1,10): error TS2300: Duplicate identifier 'Foo'. -tests/cases/compiler/callOverloads3.ts(1,16): error TS2304: Cannot find name 'Foo'. +tests/cases/compiler/callOverloads3.ts(1,16): error TS2749: 'Foo' refers to a value, but is being used as a type here. tests/cases/compiler/callOverloads3.ts(2,10): error TS2300: Duplicate identifier 'Foo'. tests/cases/compiler/callOverloads3.ts(2,10): error TS2391: Function implementation is missing or not immediately following the declaration. -tests/cases/compiler/callOverloads3.ts(2,24): error TS2304: Cannot find name 'Foo'. +tests/cases/compiler/callOverloads3.ts(2,24): error TS2749: 'Foo' refers to a value, but is being used as a type here. tests/cases/compiler/callOverloads3.ts(3,7): error TS2300: Duplicate identifier 'Foo'. tests/cases/compiler/callOverloads3.ts(11,10): error TS2350: Only a void function can be called with the 'new' keyword. @@ -12,14 +12,14 @@ tests/cases/compiler/callOverloads3.ts(11,10): error TS2350: Only a void functio ~~~ !!! error TS2300: Duplicate identifier 'Foo'. ~~~ -!!! error TS2304: Cannot find name 'Foo'. +!!! error TS2749: 'Foo' refers to a value, but is being used as a type here. function Foo(s:string):Foo; // error ~~~ !!! error TS2300: Duplicate identifier 'Foo'. ~~~ !!! error TS2391: Function implementation is missing or not immediately following the declaration. ~~~ -!!! error TS2304: Cannot find name 'Foo'. +!!! error TS2749: 'Foo' refers to a value, but is being used as a type here. class Foo { // error ~~~ !!! error TS2300: Duplicate identifier 'Foo'. diff --git a/tests/baselines/reference/callOverloads4.errors.txt b/tests/baselines/reference/callOverloads4.errors.txt index 04ac340c990f0..dcecd65666e18 100644 --- a/tests/baselines/reference/callOverloads4.errors.txt +++ b/tests/baselines/reference/callOverloads4.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/callOverloads4.ts(1,10): error TS2300: Duplicate identifier 'Foo'. -tests/cases/compiler/callOverloads4.ts(1,16): error TS2304: Cannot find name 'Foo'. +tests/cases/compiler/callOverloads4.ts(1,16): error TS2749: 'Foo' refers to a value, but is being used as a type here. tests/cases/compiler/callOverloads4.ts(2,10): error TS2300: Duplicate identifier 'Foo'. tests/cases/compiler/callOverloads4.ts(2,10): error TS2391: Function implementation is missing or not immediately following the declaration. -tests/cases/compiler/callOverloads4.ts(2,24): error TS2304: Cannot find name 'Foo'. +tests/cases/compiler/callOverloads4.ts(2,24): error TS2749: 'Foo' refers to a value, but is being used as a type here. tests/cases/compiler/callOverloads4.ts(3,7): error TS2300: Duplicate identifier 'Foo'. tests/cases/compiler/callOverloads4.ts(11,10): error TS2350: Only a void function can be called with the 'new' keyword. @@ -12,14 +12,14 @@ tests/cases/compiler/callOverloads4.ts(11,10): error TS2350: Only a void functio ~~~ !!! error TS2300: Duplicate identifier 'Foo'. ~~~ -!!! error TS2304: Cannot find name 'Foo'. +!!! error TS2749: 'Foo' refers to a value, but is being used as a type here. function Foo(s:string):Foo; // error ~~~ !!! error TS2300: Duplicate identifier 'Foo'. ~~~ !!! error TS2391: Function implementation is missing or not immediately following the declaration. ~~~ -!!! error TS2304: Cannot find name 'Foo'. +!!! error TS2749: 'Foo' refers to a value, but is being used as a type here. class Foo { // error ~~~ !!! error TS2300: Duplicate identifier 'Foo'. diff --git a/tests/baselines/reference/callOverloads5.errors.txt b/tests/baselines/reference/callOverloads5.errors.txt index e521a9a9076ae..e9ebdc8a52443 100644 --- a/tests/baselines/reference/callOverloads5.errors.txt +++ b/tests/baselines/reference/callOverloads5.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/callOverloads5.ts(1,10): error TS2300: Duplicate identifier 'Foo'. -tests/cases/compiler/callOverloads5.ts(1,16): error TS2304: Cannot find name 'Foo'. +tests/cases/compiler/callOverloads5.ts(1,16): error TS2749: 'Foo' refers to a value, but is being used as a type here. tests/cases/compiler/callOverloads5.ts(2,10): error TS2300: Duplicate identifier 'Foo'. tests/cases/compiler/callOverloads5.ts(2,10): error TS2391: Function implementation is missing or not immediately following the declaration. -tests/cases/compiler/callOverloads5.ts(2,24): error TS2304: Cannot find name 'Foo'. +tests/cases/compiler/callOverloads5.ts(2,24): error TS2749: 'Foo' refers to a value, but is being used as a type here. tests/cases/compiler/callOverloads5.ts(3,7): error TS2300: Duplicate identifier 'Foo'. tests/cases/compiler/callOverloads5.ts(13,10): error TS2350: Only a void function can be called with the 'new' keyword. @@ -12,14 +12,14 @@ tests/cases/compiler/callOverloads5.ts(13,10): error TS2350: Only a void functio ~~~ !!! error TS2300: Duplicate identifier 'Foo'. ~~~ -!!! error TS2304: Cannot find name 'Foo'. +!!! error TS2749: 'Foo' refers to a value, but is being used as a type here. function Foo(s:string):Foo; // error ~~~ !!! error TS2300: Duplicate identifier 'Foo'. ~~~ !!! error TS2391: Function implementation is missing or not immediately following the declaration. ~~~ -!!! error TS2304: Cannot find name 'Foo'. +!!! error TS2749: 'Foo' refers to a value, but is being used as a type here. class Foo { // error ~~~ !!! error TS2300: Duplicate identifier 'Foo'. diff --git a/tests/baselines/reference/checkInfiniteExpansionTermination.errors.txt b/tests/baselines/reference/checkInfiniteExpansionTermination.errors.txt new file mode 100644 index 0000000000000..014087ff6275e --- /dev/null +++ b/tests/baselines/reference/checkInfiniteExpansionTermination.errors.txt @@ -0,0 +1,32 @@ +tests/cases/compiler/checkInfiniteExpansionTermination.ts(16,1): error TS2322: Type 'ISubject' is not assignable to type 'IObservable'. + Types of property 'n' are incompatible. + Type 'IObservable' is not assignable to type 'IObservable'. + Type 'Bar[]' is not assignable to type 'Foo[]'. + Property 'x' is missing in type 'Bar' but required in type 'Foo'. + + +==== tests/cases/compiler/checkInfiniteExpansionTermination.ts (1 errors) ==== + // Regression test for #1002 + // Before fix this code would cause infinite loop + + interface IObservable { + n: IObservable; // Needed, must be T[] + } + + // Needed + interface ISubject extends IObservable { } + + interface Foo { x } + interface Bar { y } + + var values: IObservable; + var values2: ISubject; + values = values2; + ~~~~~~ +!!! error TS2322: Type 'ISubject' is not assignable to type 'IObservable'. +!!! error TS2322: Types of property 'n' are incompatible. +!!! error TS2322: Type 'IObservable' is not assignable to type 'IObservable'. +!!! error TS2322: Type 'Bar[]' is not assignable to type 'Foo[]'. +!!! error TS2322: Property 'x' is missing in type 'Bar' but required in type 'Foo'. +!!! related TS2728 tests/cases/compiler/checkInfiniteExpansionTermination.ts:11:17: 'x' is declared here. + \ No newline at end of file diff --git a/tests/baselines/reference/complexRecursiveCollections.types b/tests/baselines/reference/complexRecursiveCollections.types index a9fc13e7d1dc1..feaff62048628 100644 --- a/tests/baselines/reference/complexRecursiveCollections.types +++ b/tests/baselines/reference/complexRecursiveCollections.types @@ -1137,7 +1137,7 @@ declare module Immutable { >Seq : typeof Seq function isSeq(maybeSeq: any): maybeSeq is Seq.Indexed | Seq.Keyed; ->isSeq : (maybeSeq: any) => maybeSeq is Keyed | Indexed +>isSeq : (maybeSeq: any) => maybeSeq is Indexed | Keyed >maybeSeq : any >Seq : any >Seq : any diff --git a/tests/baselines/reference/conditionalTypeDoesntSpinForever.types b/tests/baselines/reference/conditionalTypeDoesntSpinForever.types index d4fe4bf48261b..1f4b4a62cd293 100644 --- a/tests/baselines/reference/conditionalTypeDoesntSpinForever.types +++ b/tests/baselines/reference/conditionalTypeDoesntSpinForever.types @@ -120,9 +120,9 @@ export enum PubSubRecordIsStoredInRedisAsA { buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString})) as >buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString})) as BuildPubSubRecordType : BuildPubSubRecordType ->buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString})) : BuildPubSubRecordType +>buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString})) : BuildPubSubRecordType >buildPubSubRecordType : (soFar: SO_FAR) => BuildPubSubRecordType ->Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString}) : SO_FAR & { storedAs: PubSubRecordIsStoredInRedisAsA; } +>Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString}) : SO_FAR & { storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString; } >Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } >Object : ObjectConstructor >assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } @@ -144,9 +144,9 @@ export enum PubSubRecordIsStoredInRedisAsA { buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash})) as >buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash})) as BuildPubSubRecordType : BuildPubSubRecordType ->buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash})) : BuildPubSubRecordType +>buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash})) : BuildPubSubRecordType >buildPubSubRecordType : (soFar: SO_FAR) => BuildPubSubRecordType ->Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash}) : SO_FAR & { storedAs: PubSubRecordIsStoredInRedisAsA; } +>Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash}) : SO_FAR & { storedAs: PubSubRecordIsStoredInRedisAsA.redisHash; } >Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } >Object : ObjectConstructor >assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } @@ -337,16 +337,16 @@ export enum PubSubRecordIsStoredInRedisAsA { buildPubSubRecordType(Object.assign({}, soFar, {maxMsToWaitBeforePublishing: 0})) as BuildPubSubRecordType, >buildPubSubRecordType(Object.assign({}, soFar, {maxMsToWaitBeforePublishing: 0})) as BuildPubSubRecordType : BuildPubSubRecordType ->buildPubSubRecordType(Object.assign({}, soFar, {maxMsToWaitBeforePublishing: 0})) : BuildPubSubRecordType +>buildPubSubRecordType(Object.assign({}, soFar, {maxMsToWaitBeforePublishing: 0})) : BuildPubSubRecordType >buildPubSubRecordType : (soFar: SO_FAR) => BuildPubSubRecordType ->Object.assign({}, soFar, {maxMsToWaitBeforePublishing: 0}) : SO_FAR & { maxMsToWaitBeforePublishing: number; } +>Object.assign({}, soFar, {maxMsToWaitBeforePublishing: 0}) : SO_FAR & { maxMsToWaitBeforePublishing: 0; } >Object.assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } >Object : ObjectConstructor >assign : { (target: T, source: U): T & U; (target: T, source1: U, source2: V): T & U & V; (target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; } >{} : {} >soFar : SO_FAR ->{maxMsToWaitBeforePublishing: 0} : { maxMsToWaitBeforePublishing: number; } ->maxMsToWaitBeforePublishing : number +>{maxMsToWaitBeforePublishing: 0} : { maxMsToWaitBeforePublishing: 0; } +>maxMsToWaitBeforePublishing : 0 >0 : 0 >maxMsToWaitBeforePublishing : 0 } diff --git a/tests/baselines/reference/conditionalTypeRelaxingConstraintAssignability.js b/tests/baselines/reference/conditionalTypeRelaxingConstraintAssignability.js new file mode 100644 index 0000000000000..f066b18d5c64f --- /dev/null +++ b/tests/baselines/reference/conditionalTypeRelaxingConstraintAssignability.js @@ -0,0 +1,39 @@ +//// [conditionalTypeRelaxingConstraintAssignability.ts] +export type ElChildren = + | ElChildren.Void + | ElChildren.Text; +export namespace ElChildren { + export type Void = undefined; + export type Text = string; +} + +type Relax = C extends ElChildren.Text ? ElChildren.Text : C; + +export class Elem< + C extends ElChildren, + > { + constructor( + private children_: Relax, + ) { + } +} + +new Elem(undefined as ElChildren.Void); +new Elem('' as ElChildren.Text); +new Elem('' as ElChildren.Void | ElChildren.Text); // error +new Elem('' as ElChildren); // error + +//// [conditionalTypeRelaxingConstraintAssignability.js] +"use strict"; +exports.__esModule = true; +var Elem = /** @class */ (function () { + function Elem(children_) { + this.children_ = children_; + } + return Elem; +}()); +exports.Elem = Elem; +new Elem(undefined); +new Elem(''); +new Elem(''); // error +new Elem(''); // error diff --git a/tests/baselines/reference/conditionalTypeRelaxingConstraintAssignability.symbols b/tests/baselines/reference/conditionalTypeRelaxingConstraintAssignability.symbols new file mode 100644 index 0000000000000..7ce85b0fbfaf8 --- /dev/null +++ b/tests/baselines/reference/conditionalTypeRelaxingConstraintAssignability.symbols @@ -0,0 +1,73 @@ +=== tests/cases/compiler/conditionalTypeRelaxingConstraintAssignability.ts === +export type ElChildren = +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) + + | ElChildren.Void +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) +>Void : Symbol(ElChildren.Void, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 3, 29)) + + | ElChildren.Text; +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) +>Text : Symbol(ElChildren.Text, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 4, 31)) + +export namespace ElChildren { +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) + + export type Void = undefined; +>Void : Symbol(Void, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 3, 29)) + + export type Text = string; +>Text : Symbol(Text, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 4, 31)) +} + +type Relax = C extends ElChildren.Text ? ElChildren.Text : C; +>Relax : Symbol(Relax, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 6, 1)) +>C : Symbol(C, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 11)) +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) +>C : Symbol(C, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 11)) +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) +>Text : Symbol(ElChildren.Text, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 4, 31)) +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) +>Text : Symbol(ElChildren.Text, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 4, 31)) +>C : Symbol(C, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 11)) + +export class Elem< +>Elem : Symbol(Elem, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 83)) + + C extends ElChildren, +>C : Symbol(C, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 10, 18)) +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) + + > { + constructor( + private children_: Relax, +>children_ : Symbol(Elem.children_, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 13, 14)) +>Relax : Symbol(Relax, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 6, 1)) +>C : Symbol(C, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 10, 18)) + + ) { + } +} + +new Elem(undefined as ElChildren.Void); +>Elem : Symbol(Elem, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 83)) +>undefined : Symbol(undefined) +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) +>Void : Symbol(ElChildren.Void, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 3, 29)) + +new Elem('' as ElChildren.Text); +>Elem : Symbol(Elem, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 83)) +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) +>Text : Symbol(ElChildren.Text, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 4, 31)) + +new Elem('' as ElChildren.Void | ElChildren.Text); // error +>Elem : Symbol(Elem, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 83)) +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) +>Void : Symbol(ElChildren.Void, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 3, 29)) +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) +>Text : Symbol(ElChildren.Text, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 4, 31)) + +new Elem('' as ElChildren); // error +>Elem : Symbol(Elem, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 83)) +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) + diff --git a/tests/baselines/reference/conditionalTypeRelaxingConstraintAssignability.types b/tests/baselines/reference/conditionalTypeRelaxingConstraintAssignability.types new file mode 100644 index 0000000000000..c827e26bddb99 --- /dev/null +++ b/tests/baselines/reference/conditionalTypeRelaxingConstraintAssignability.types @@ -0,0 +1,64 @@ +=== tests/cases/compiler/conditionalTypeRelaxingConstraintAssignability.ts === +export type ElChildren = +>ElChildren : ElChildren + + | ElChildren.Void +>ElChildren : any + + | ElChildren.Text; +>ElChildren : any + +export namespace ElChildren { + export type Void = undefined; +>Void : undefined + + export type Text = string; +>Text : string +} + +type Relax = C extends ElChildren.Text ? ElChildren.Text : C; +>Relax : Relax +>ElChildren : any +>ElChildren : any + +export class Elem< +>Elem : Elem + + C extends ElChildren, + > { + constructor( + private children_: Relax, +>children_ : Relax + + ) { + } +} + +new Elem(undefined as ElChildren.Void); +>new Elem(undefined as ElChildren.Void) : Elem +>Elem : typeof Elem +>undefined as ElChildren.Void : undefined +>undefined : undefined +>ElChildren : any + +new Elem('' as ElChildren.Text); +>new Elem('' as ElChildren.Text) : Elem +>Elem : typeof Elem +>'' as ElChildren.Text : string +>'' : "" +>ElChildren : any + +new Elem('' as ElChildren.Void | ElChildren.Text); // error +>new Elem('' as ElChildren.Void | ElChildren.Text) : Elem +>Elem : typeof Elem +>'' as ElChildren.Void | ElChildren.Text : ElChildren +>'' : "" +>ElChildren : any +>ElChildren : any + +new Elem('' as ElChildren); // error +>new Elem('' as ElChildren) : Elem +>Elem : typeof Elem +>'' as ElChildren : ElChildren +>'' : "" + diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index 62239eca7b821..ec35f89161589 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -17,8 +17,12 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(103,5): error TS2 tests/cases/conformance/types/conditional/conditionalTypes1.ts(104,5): error TS2322: Type 'Pick' is not assignable to type 'T'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(106,5): error TS2322: Type 'Pick' is not assignable to type 'Pick'. Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. + Type 'keyof T' is not assignable to type 'never'. + Type 'string | number | symbol' is not assignable to type 'never'. + Type 'string' is not assignable to type 'never'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(108,5): error TS2322: Type 'Pick' is not assignable to type 'Pick'. Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. + Type 'keyof T' is not assignable to type 'never'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(114,5): error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. @@ -183,11 +187,15 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS ~ !!! error TS2322: Type 'Pick' is not assignable to type 'Pick'. !!! error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. +!!! error TS2322: Type 'keyof T' is not assignable to type 'never'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'never'. +!!! error TS2322: Type 'string' is not assignable to type 'never'. z = x; z = y; // Error ~ !!! error TS2322: Type 'Pick' is not assignable to type 'Pick'. !!! error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. +!!! error TS2322: Type 'keyof T' is not assignable to type 'never'. } function f8(x: keyof T, y: FunctionPropertyNames, z: NonFunctionPropertyNames) { diff --git a/tests/baselines/reference/conditionalTypes2.errors.txt b/tests/baselines/reference/conditionalTypes2.errors.txt index a1a23b6da1870..6cf81cf573039 100644 --- a/tests/baselines/reference/conditionalTypes2.errors.txt +++ b/tests/baselines/reference/conditionalTypes2.errors.txt @@ -8,6 +8,13 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(24,5): error TS23 Type 'keyof B' is not assignable to type 'keyof A'. Type 'string | number | symbol' is not assignable to type 'keyof A'. Type 'string' is not assignable to type 'keyof A'. + Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. + Type 'keyof B' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. + Type 'string | number | symbol' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. + Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. + Type 'keyof B' is not assignable to type '"valueOf"'. + Type 'string | number | symbol' is not assignable to type '"valueOf"'. + Type 'string' is not assignable to type '"valueOf"'. tests/cases/conformance/types/conditional/conditionalTypes2.ts(25,5): error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. Types of property 'foo' are incompatible. Type 'A extends string ? keyof A : A' is not assignable to type 'B extends string ? keyof B : B'. @@ -61,6 +68,13 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(75,12): error TS2 !!! error TS2322: Type 'keyof B' is not assignable to type 'keyof A'. !!! error TS2322: Type 'string | number | symbol' is not assignable to type 'keyof A'. !!! error TS2322: Type 'string' is not assignable to type 'keyof A'. +!!! error TS2322: Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. +!!! error TS2322: Type 'keyof B' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. +!!! error TS2322: Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. +!!! error TS2322: Type 'keyof B' is not assignable to type '"valueOf"'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type '"valueOf"'. +!!! error TS2322: Type 'string' is not assignable to type '"valueOf"'. b = a; // Error ~ !!! error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. diff --git a/tests/baselines/reference/constructorOverloads7.errors.txt b/tests/baselines/reference/constructorOverloads7.errors.txt index c915b8f97543d..81aeaaf24ff1e 100644 --- a/tests/baselines/reference/constructorOverloads7.errors.txt +++ b/tests/baselines/reference/constructorOverloads7.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/constructorOverloads7.ts(1,15): error TS2300: Duplicate identifier 'Point'. -tests/cases/compiler/constructorOverloads7.ts(7,35): error TS2304: Cannot find name 'Point'. -tests/cases/compiler/constructorOverloads7.ts(8,14): error TS2304: Cannot find name 'Point'. +tests/cases/compiler/constructorOverloads7.ts(7,35): error TS2749: 'Point' refers to a value, but is being used as a type here. +tests/cases/compiler/constructorOverloads7.ts(8,14): error TS2749: 'Point' refers to a value, but is being used as a type here. tests/cases/compiler/constructorOverloads7.ts(15,10): error TS2300: Duplicate identifier 'Point'. tests/cases/compiler/constructorOverloads7.ts(22,18): error TS2384: Overload signatures must all be ambient or non-ambient. @@ -16,10 +16,10 @@ tests/cases/compiler/constructorOverloads7.ts(22,18): error TS2384: Overload sig add(dx: number, dy: number): Point; ~~~~~ -!!! error TS2304: Cannot find name 'Point'. +!!! error TS2749: 'Point' refers to a value, but is being used as a type here. origin: Point; ~~~~~ -!!! error TS2304: Cannot find name 'Point'. +!!! error TS2749: 'Point' refers to a value, but is being used as a type here. } diff --git a/tests/baselines/reference/constructorsWithSpecializedSignatures.errors.txt b/tests/baselines/reference/constructorsWithSpecializedSignatures.errors.txt index 4f869fd63a06f..682959074e800 100644 --- a/tests/baselines/reference/constructorsWithSpecializedSignatures.errors.txt +++ b/tests/baselines/reference/constructorsWithSpecializedSignatures.errors.txt @@ -1,5 +1,5 @@ -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(18,5): error TS2394: This overload signature is not compatible with its implementation signature. +tests/cases/compiler/constructorsWithSpecializedSignatures.ts(26,5): error TS2394: This overload signature is not compatible with its implementation signature. ==== tests/cases/compiler/constructorsWithSpecializedSignatures.ts (2 errors) ==== @@ -22,7 +22,8 @@ tests/cases/compiler/constructorsWithSpecializedSignatures.ts(26,5): error TS239 constructor(x: "hi"); constructor(x: "foo"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/constructorsWithSpecializedSignatures.ts:20:5: The implementation signature is declared here. constructor(x: number); constructor(x: "hi") { } } @@ -32,7 +33,8 @@ tests/cases/compiler/constructorsWithSpecializedSignatures.ts(26,5): error TS239 constructor(x: "hi"); constructor(x: "foo"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/constructorsWithSpecializedSignatures.ts:28:5: The implementation signature is declared here. constructor(x: string); constructor(x: "hi") { } // error } diff --git a/tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.errors.txt b/tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.errors.txt new file mode 100644 index 0000000000000..343a3a5351a8f --- /dev/null +++ b/tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.errors.txt @@ -0,0 +1,14 @@ +tests/cases/compiler/b.ts(4,1): error TS4032: Property 'val' of exported interface has or is using name 'I' from private module '"tests/cases/compiler/a"'. + + +==== tests/cases/compiler/a.ts (0 errors) ==== + interface I {} + export function f(): I { return null as I; } +==== tests/cases/compiler/b.ts (1 errors) ==== + import {f} from "./a"; + + export function q() {} + q.val = f(); + ~~~~~ +!!! error TS4032: Property 'val' of exported interface has or is using name 'I' from private module '"tests/cases/compiler/a"'. + \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.js b/tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.js new file mode 100644 index 0000000000000..a40fb25276005 --- /dev/null +++ b/tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.js @@ -0,0 +1,31 @@ +//// [tests/cases/compiler/declarationEmitExpandoPropertyPrivateName.ts] //// + +//// [a.ts] +interface I {} +export function f(): I { return null as I; } +//// [b.ts] +import {f} from "./a"; + +export function q() {} +q.val = f(); + + +//// [a.js] +"use strict"; +exports.__esModule = true; +function f() { return null; } +exports.f = f; +//// [b.js] +"use strict"; +exports.__esModule = true; +var a_1 = require("./a"); +function q() { } +exports.q = q; +q.val = a_1.f(); + + +//// [a.d.ts] +interface I { +} +export declare function f(): I; +export {}; diff --git a/tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.symbols b/tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.symbols new file mode 100644 index 0000000000000..841620f036182 --- /dev/null +++ b/tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.symbols @@ -0,0 +1,22 @@ +=== tests/cases/compiler/a.ts === +interface I {} +>I : Symbol(I, Decl(a.ts, 0, 0)) + +export function f(): I { return null as I; } +>f : Symbol(f, Decl(a.ts, 0, 14)) +>I : Symbol(I, Decl(a.ts, 0, 0)) +>I : Symbol(I, Decl(a.ts, 0, 0)) + +=== tests/cases/compiler/b.ts === +import {f} from "./a"; +>f : Symbol(f, Decl(b.ts, 0, 8)) + +export function q() {} +>q : Symbol(q, Decl(b.ts, 0, 22), Decl(b.ts, 2, 22)) + +q.val = f(); +>q.val : Symbol(q.val, Decl(b.ts, 2, 22)) +>q : Symbol(q, Decl(b.ts, 0, 22), Decl(b.ts, 2, 22)) +>val : Symbol(q.val, Decl(b.ts, 2, 22)) +>f : Symbol(f, Decl(b.ts, 0, 8)) + diff --git a/tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.types b/tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.types new file mode 100644 index 0000000000000..7418b4140297b --- /dev/null +++ b/tests/baselines/reference/declarationEmitExpandoPropertyPrivateName.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/a.ts === +interface I {} +export function f(): I { return null as I; } +>f : () => I +>null as I : I +>null : null + +=== tests/cases/compiler/b.ts === +import {f} from "./a"; +>f : () => I + +export function q() {} +>q : typeof q + +q.val = f(); +>q.val = f() : I +>q.val : I +>q : typeof q +>val : I +>f() : I +>f : () => I + diff --git a/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.errors.txt b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.errors.txt new file mode 100644 index 0000000000000..56135cf8b0d14 --- /dev/null +++ b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.errors.txt @@ -0,0 +1,53 @@ +tests/cases/compiler/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts(41,3): error TS2322: Type 'Dictionary' is not assignable to type 'Record'. + Index signatures are incompatible. + Type 'string' is not assignable to type 'Bar'. + + +==== tests/cases/compiler/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts (1 errors) ==== + // This should behave the same as emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts + // Begin types from Lodash. + interface Dictionary { + [index: string]: T; + } + + interface NumericDictionary { + [index: number]: T; + } + + type ObjectIterator = ( + value: TObject[keyof TObject], + key: string, + collection: TObject + ) => TResult; + + type DictionaryIterator = ObjectIterator, TResult>; + + // In lodash.d.ts this function has many overloads, but this seems to be the problematic one. + function mapValues( + obj: Dictionary | NumericDictionary | null | undefined, + callback: DictionaryIterator + ): Dictionary { + return null as any; + } + // End types from Lodash. + + interface Foo { + foo: string; + } + + interface Bar { + bar: string; + } + + export function fooToBar( + foos: Record + ): Record { + const result = foos == null ? {} : mapValues(foos, f => f.foo); + // This line _should_ fail, because `result` is not the right type. + return result; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Dictionary' is not assignable to type 'Record'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'Bar'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.js b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.js new file mode 100644 index 0000000000000..38418b365a2b0 --- /dev/null +++ b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.js @@ -0,0 +1,58 @@ +//// [emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts] +// This should behave the same as emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts +// Begin types from Lodash. +interface Dictionary { + [index: string]: T; +} + +interface NumericDictionary { + [index: number]: T; +} + +type ObjectIterator = ( + value: TObject[keyof TObject], + key: string, + collection: TObject +) => TResult; + +type DictionaryIterator = ObjectIterator, TResult>; + +// In lodash.d.ts this function has many overloads, but this seems to be the problematic one. +function mapValues( + obj: Dictionary | NumericDictionary | null | undefined, + callback: DictionaryIterator +): Dictionary { + return null as any; +} +// End types from Lodash. + +interface Foo { + foo: string; +} + +interface Bar { + bar: string; +} + +export function fooToBar( + foos: Record +): Record { + const result = foos == null ? {} : mapValues(foos, f => f.foo); + // This line _should_ fail, because `result` is not the right type. + return result; +} + + +//// [emptyObjectNotSubtypeOfIndexSignatureContainingObject1.js] +"use strict"; +exports.__esModule = true; +// In lodash.d.ts this function has many overloads, but this seems to be the problematic one. +function mapValues(obj, callback) { + return null; +} +function fooToBar(foos) { + var result = foos == null ? {} : mapValues(foos, function (f) { return f.foo; }); + // This line _should_ fail, because `result` is not the right type. + return result; +} +exports.fooToBar = fooToBar; diff --git a/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.symbols b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.symbols new file mode 100644 index 0000000000000..2d808fb513832 --- /dev/null +++ b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.symbols @@ -0,0 +1,118 @@ +=== tests/cases/compiler/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts === +// This should behave the same as emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts +// Begin types from Lodash. +interface Dictionary { +>Dictionary : Symbol(Dictionary, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 0, 0)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 2, 21)) + + [index: string]: T; +>index : Symbol(index, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 3, 3)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 2, 21)) +} + +interface NumericDictionary { +>NumericDictionary : Symbol(NumericDictionary, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 4, 1)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 6, 28)) + + [index: number]: T; +>index : Symbol(index, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 7, 3)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 6, 28)) +} + +type ObjectIterator = ( +>ObjectIterator : Symbol(ObjectIterator, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 8, 1)) +>TObject : Symbol(TObject, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 10, 20)) +>TResult : Symbol(TResult, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 10, 28)) + + value: TObject[keyof TObject], +>value : Symbol(value, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 10, 41)) +>TObject : Symbol(TObject, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 10, 20)) +>TObject : Symbol(TObject, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 10, 20)) + + key: string, +>key : Symbol(key, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 11, 32)) + + collection: TObject +>collection : Symbol(collection, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 12, 14)) +>TObject : Symbol(TObject, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 10, 20)) + +) => TResult; +>TResult : Symbol(TResult, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 10, 28)) + +type DictionaryIterator = ObjectIterator, TResult>; +>DictionaryIterator : Symbol(DictionaryIterator, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 14, 13)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 16, 24)) +>TResult : Symbol(TResult, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 16, 26)) +>ObjectIterator : Symbol(ObjectIterator, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 8, 1)) +>Dictionary : Symbol(Dictionary, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 0, 0)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 16, 24)) +>TResult : Symbol(TResult, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 16, 26)) + +// In lodash.d.ts this function has many overloads, but this seems to be the problematic one. +function mapValues( +>mapValues : Symbol(mapValues, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 16, 77)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 19, 19)) +>TResult : Symbol(TResult, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 19, 21)) + + obj: Dictionary | NumericDictionary | null | undefined, +>obj : Symbol(obj, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 19, 31)) +>Dictionary : Symbol(Dictionary, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 0, 0)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 19, 19)) +>NumericDictionary : Symbol(NumericDictionary, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 4, 1)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 19, 19)) + + callback: DictionaryIterator +>callback : Symbol(callback, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 20, 63)) +>DictionaryIterator : Symbol(DictionaryIterator, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 14, 13)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 19, 19)) +>TResult : Symbol(TResult, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 19, 21)) + +): Dictionary { +>Dictionary : Symbol(Dictionary, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 0, 0)) +>TResult : Symbol(TResult, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 19, 21)) + + return null as any; +} +// End types from Lodash. + +interface Foo { +>Foo : Symbol(Foo, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 24, 1)) + + foo: string; +>foo : Symbol(Foo.foo, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 27, 15)) +} + +interface Bar { +>Bar : Symbol(Bar, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 29, 1)) + + bar: string; +>bar : Symbol(Bar.bar, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 31, 15)) +} + +export function fooToBar( +>fooToBar : Symbol(fooToBar, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 33, 1)) + + foos: Record +>foos : Symbol(foos, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 35, 25)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) +>Foo : Symbol(Foo, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 24, 1)) + +): Record { +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) +>Bar : Symbol(Bar, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 29, 1)) + + const result = foos == null ? {} : mapValues(foos, f => f.foo); +>result : Symbol(result, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 38, 7)) +>foos : Symbol(foos, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 35, 25)) +>mapValues : Symbol(mapValues, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 16, 77)) +>foos : Symbol(foos, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 35, 25)) +>f : Symbol(f, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 38, 52)) +>f.foo : Symbol(Foo.foo, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 27, 15)) +>f : Symbol(f, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 38, 52)) +>foo : Symbol(Foo.foo, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 27, 15)) + + // This line _should_ fail, because `result` is not the right type. + return result; +>result : Symbol(result, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts, 38, 7)) +} + diff --git a/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.types b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.types new file mode 100644 index 0000000000000..6426ab89c8ad9 --- /dev/null +++ b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.types @@ -0,0 +1,88 @@ +=== tests/cases/compiler/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts === +// This should behave the same as emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts +// Begin types from Lodash. +interface Dictionary { + [index: string]: T; +>index : string +} + +interface NumericDictionary { + [index: number]: T; +>index : number +} + +type ObjectIterator = ( +>ObjectIterator : ObjectIterator + + value: TObject[keyof TObject], +>value : TObject[keyof TObject] + + key: string, +>key : string + + collection: TObject +>collection : TObject + +) => TResult; + +type DictionaryIterator = ObjectIterator, TResult>; +>DictionaryIterator : ObjectIterator, TResult> + +// In lodash.d.ts this function has many overloads, but this seems to be the problematic one. +function mapValues( +>mapValues : (obj: Dictionary | NumericDictionary, callback: ObjectIterator, TResult>) => Dictionary + + obj: Dictionary | NumericDictionary | null | undefined, +>obj : Dictionary | NumericDictionary +>null : null + + callback: DictionaryIterator +>callback : ObjectIterator, TResult> + +): Dictionary { + return null as any; +>null as any : any +>null : null +} +// End types from Lodash. + +interface Foo { + foo: string; +>foo : string +} + +interface Bar { + bar: string; +>bar : string +} + +export function fooToBar( +>fooToBar : (foos: Record) => Record + + foos: Record +>foos : Record + +): Record { +>null : null + + const result = foos == null ? {} : mapValues(foos, f => f.foo); +>result : Dictionary +>foos == null ? {} : mapValues(foos, f => f.foo) : Dictionary +>foos == null : boolean +>foos : Record +>null : null +>{} : {} +>mapValues(foos, f => f.foo) : Dictionary +>mapValues : (obj: Dictionary | NumericDictionary, callback: ObjectIterator, TResult>) => Dictionary +>foos : Record +>f => f.foo : (f: Foo) => string +>f : Foo +>f.foo : string +>f : Foo +>foo : string + + // This line _should_ fail, because `result` is not the right type. + return result; +>result : Dictionary +} + diff --git a/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.errors.txt b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.errors.txt new file mode 100644 index 0000000000000..58de463148308 --- /dev/null +++ b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.errors.txt @@ -0,0 +1,54 @@ +tests/cases/compiler/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts(42,3): error TS2322: Type 'Dictionary' is not assignable to type 'Record'. + Index signatures are incompatible. + Type 'string' is not assignable to type 'Bar'. + + +==== tests/cases/compiler/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts (1 errors) ==== + // This should behave the same as emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts + // Begin types from Lodash. + interface Dictionary { + [index: string]: T; + } + + interface NumericDictionary { + [index: number]: T; + } + + type ObjectIterator = ( + value: TObject[keyof TObject], + key: string, + collection: TObject + ) => TResult; + + type DictionaryIterator = ObjectIterator, TResult>; + + // In lodash.d.ts this function has many overloads, but this seems to be the problematic one. + function mapValues( + obj: Dictionary | NumericDictionary | null | undefined, + callback: DictionaryIterator + ): Dictionary { + return null as any; + } + // End types from Lodash. + + interface Foo { + foo: string; + } + + interface Bar { + bar: string; + } + + export function fooToBar( + foos: Record + ): Record { + const wat = mapValues(foos, f => f.foo); + const result = foos == null ? {} : mapValues(foos, f => f.foo); + // This line _should_ fail, because `result` is not the right type. + return result; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type 'Dictionary' is not assignable to type 'Record'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'Bar'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.js b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.js new file mode 100644 index 0000000000000..b2193cc31010c --- /dev/null +++ b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.js @@ -0,0 +1,60 @@ +//// [emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts] +// This should behave the same as emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts +// Begin types from Lodash. +interface Dictionary { + [index: string]: T; +} + +interface NumericDictionary { + [index: number]: T; +} + +type ObjectIterator = ( + value: TObject[keyof TObject], + key: string, + collection: TObject +) => TResult; + +type DictionaryIterator = ObjectIterator, TResult>; + +// In lodash.d.ts this function has many overloads, but this seems to be the problematic one. +function mapValues( + obj: Dictionary | NumericDictionary | null | undefined, + callback: DictionaryIterator +): Dictionary { + return null as any; +} +// End types from Lodash. + +interface Foo { + foo: string; +} + +interface Bar { + bar: string; +} + +export function fooToBar( + foos: Record +): Record { + const wat = mapValues(foos, f => f.foo); + const result = foos == null ? {} : mapValues(foos, f => f.foo); + // This line _should_ fail, because `result` is not the right type. + return result; +} + + +//// [emptyObjectNotSubtypeOfIndexSignatureContainingObject2.js] +"use strict"; +exports.__esModule = true; +// In lodash.d.ts this function has many overloads, but this seems to be the problematic one. +function mapValues(obj, callback) { + return null; +} +function fooToBar(foos) { + var wat = mapValues(foos, function (f) { return f.foo; }); + var result = foos == null ? {} : mapValues(foos, function (f) { return f.foo; }); + // This line _should_ fail, because `result` is not the right type. + return result; +} +exports.fooToBar = fooToBar; diff --git a/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.symbols b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.symbols new file mode 100644 index 0000000000000..8ce432231e1dd --- /dev/null +++ b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.symbols @@ -0,0 +1,127 @@ +=== tests/cases/compiler/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts === +// This should behave the same as emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts +// Begin types from Lodash. +interface Dictionary { +>Dictionary : Symbol(Dictionary, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 0, 0)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 2, 21)) + + [index: string]: T; +>index : Symbol(index, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 3, 3)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 2, 21)) +} + +interface NumericDictionary { +>NumericDictionary : Symbol(NumericDictionary, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 4, 1)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 6, 28)) + + [index: number]: T; +>index : Symbol(index, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 7, 3)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 6, 28)) +} + +type ObjectIterator = ( +>ObjectIterator : Symbol(ObjectIterator, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 8, 1)) +>TObject : Symbol(TObject, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 10, 20)) +>TResult : Symbol(TResult, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 10, 28)) + + value: TObject[keyof TObject], +>value : Symbol(value, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 10, 41)) +>TObject : Symbol(TObject, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 10, 20)) +>TObject : Symbol(TObject, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 10, 20)) + + key: string, +>key : Symbol(key, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 11, 32)) + + collection: TObject +>collection : Symbol(collection, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 12, 14)) +>TObject : Symbol(TObject, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 10, 20)) + +) => TResult; +>TResult : Symbol(TResult, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 10, 28)) + +type DictionaryIterator = ObjectIterator, TResult>; +>DictionaryIterator : Symbol(DictionaryIterator, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 14, 13)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 16, 24)) +>TResult : Symbol(TResult, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 16, 26)) +>ObjectIterator : Symbol(ObjectIterator, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 8, 1)) +>Dictionary : Symbol(Dictionary, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 0, 0)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 16, 24)) +>TResult : Symbol(TResult, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 16, 26)) + +// In lodash.d.ts this function has many overloads, but this seems to be the problematic one. +function mapValues( +>mapValues : Symbol(mapValues, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 16, 77)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 19, 19)) +>TResult : Symbol(TResult, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 19, 21)) + + obj: Dictionary | NumericDictionary | null | undefined, +>obj : Symbol(obj, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 19, 31)) +>Dictionary : Symbol(Dictionary, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 0, 0)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 19, 19)) +>NumericDictionary : Symbol(NumericDictionary, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 4, 1)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 19, 19)) + + callback: DictionaryIterator +>callback : Symbol(callback, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 20, 63)) +>DictionaryIterator : Symbol(DictionaryIterator, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 14, 13)) +>T : Symbol(T, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 19, 19)) +>TResult : Symbol(TResult, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 19, 21)) + +): Dictionary { +>Dictionary : Symbol(Dictionary, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 0, 0)) +>TResult : Symbol(TResult, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 19, 21)) + + return null as any; +} +// End types from Lodash. + +interface Foo { +>Foo : Symbol(Foo, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 24, 1)) + + foo: string; +>foo : Symbol(Foo.foo, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 27, 15)) +} + +interface Bar { +>Bar : Symbol(Bar, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 29, 1)) + + bar: string; +>bar : Symbol(Bar.bar, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 31, 15)) +} + +export function fooToBar( +>fooToBar : Symbol(fooToBar, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 33, 1)) + + foos: Record +>foos : Symbol(foos, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 35, 25)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) +>Foo : Symbol(Foo, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 24, 1)) + +): Record { +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) +>Bar : Symbol(Bar, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 29, 1)) + + const wat = mapValues(foos, f => f.foo); +>wat : Symbol(wat, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 38, 7)) +>mapValues : Symbol(mapValues, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 16, 77)) +>foos : Symbol(foos, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 35, 25)) +>f : Symbol(f, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 38, 29)) +>f.foo : Symbol(Foo.foo, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 27, 15)) +>f : Symbol(f, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 38, 29)) +>foo : Symbol(Foo.foo, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 27, 15)) + + const result = foos == null ? {} : mapValues(foos, f => f.foo); +>result : Symbol(result, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 39, 7)) +>foos : Symbol(foos, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 35, 25)) +>mapValues : Symbol(mapValues, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 16, 77)) +>foos : Symbol(foos, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 35, 25)) +>f : Symbol(f, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 39, 52)) +>f.foo : Symbol(Foo.foo, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 27, 15)) +>f : Symbol(f, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 39, 52)) +>foo : Symbol(Foo.foo, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 27, 15)) + + // This line _should_ fail, because `result` is not the right type. + return result; +>result : Symbol(result, Decl(emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts, 39, 7)) +} + diff --git a/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.types b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.types new file mode 100644 index 0000000000000..fd536cbd8498c --- /dev/null +++ b/tests/baselines/reference/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.types @@ -0,0 +1,99 @@ +=== tests/cases/compiler/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts === +// This should behave the same as emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts +// Begin types from Lodash. +interface Dictionary { + [index: string]: T; +>index : string +} + +interface NumericDictionary { + [index: number]: T; +>index : number +} + +type ObjectIterator = ( +>ObjectIterator : ObjectIterator + + value: TObject[keyof TObject], +>value : TObject[keyof TObject] + + key: string, +>key : string + + collection: TObject +>collection : TObject + +) => TResult; + +type DictionaryIterator = ObjectIterator, TResult>; +>DictionaryIterator : ObjectIterator, TResult> + +// In lodash.d.ts this function has many overloads, but this seems to be the problematic one. +function mapValues( +>mapValues : (obj: Dictionary | NumericDictionary, callback: ObjectIterator, TResult>) => Dictionary + + obj: Dictionary | NumericDictionary | null | undefined, +>obj : Dictionary | NumericDictionary +>null : null + + callback: DictionaryIterator +>callback : ObjectIterator, TResult> + +): Dictionary { + return null as any; +>null as any : any +>null : null +} +// End types from Lodash. + +interface Foo { + foo: string; +>foo : string +} + +interface Bar { + bar: string; +>bar : string +} + +export function fooToBar( +>fooToBar : (foos: Record) => Record + + foos: Record +>foos : Record + +): Record { +>null : null + + const wat = mapValues(foos, f => f.foo); +>wat : Dictionary +>mapValues(foos, f => f.foo) : Dictionary +>mapValues : (obj: Dictionary | NumericDictionary, callback: ObjectIterator, TResult>) => Dictionary +>foos : Record +>f => f.foo : (f: Foo) => string +>f : Foo +>f.foo : string +>f : Foo +>foo : string + + const result = foos == null ? {} : mapValues(foos, f => f.foo); +>result : Dictionary +>foos == null ? {} : mapValues(foos, f => f.foo) : Dictionary +>foos == null : boolean +>foos : Record +>null : null +>{} : {} +>mapValues(foos, f => f.foo) : Dictionary +>mapValues : (obj: Dictionary | NumericDictionary, callback: ObjectIterator, TResult>) => Dictionary +>foos : Record +>f => f.foo : (f: Foo) => string +>f : Foo +>f.foo : string +>f : Foo +>foo : string + + // This line _should_ fail, because `result` is not the right type. + return result; +>result : Dictionary +} + diff --git a/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt b/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt index a87dc989178c5..a22bdef219965 100644 --- a/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt +++ b/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt @@ -1,11 +1,12 @@ -tests/cases/compiler/functionAndInterfaceWithSeparateErrors.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionAndInterfaceWithSeparateErrors.ts(1,10): error TS2394: This overload signature is not compatible with its implementation signature. tests/cases/compiler/functionAndInterfaceWithSeparateErrors.ts(6,5): error TS2411: Property 'prop' of type 'number' is not assignable to string index type 'string'. ==== tests/cases/compiler/functionAndInterfaceWithSeparateErrors.ts (2 errors) ==== function Foo(s: string); ~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/functionAndInterfaceWithSeparateErrors.ts:2:10: The implementation signature is declared here. function Foo(n: number) { } interface Foo { diff --git a/tests/baselines/reference/functionOverloadCompatibilityWithVoid01.errors.txt b/tests/baselines/reference/functionOverloadCompatibilityWithVoid01.errors.txt index 56951e380e452..5e81224b5eb69 100644 --- a/tests/baselines/reference/functionOverloadCompatibilityWithVoid01.errors.txt +++ b/tests/baselines/reference/functionOverloadCompatibilityWithVoid01.errors.txt @@ -1,10 +1,11 @@ -tests/cases/conformance/functions/functionOverloadCompatibilityWithVoid01.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/functions/functionOverloadCompatibilityWithVoid01.ts(1,10): error TS2394: This overload signature is not compatible with its implementation signature. ==== tests/cases/conformance/functions/functionOverloadCompatibilityWithVoid01.ts (1 errors) ==== function f(x: string): number; ~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/conformance/functions/functionOverloadCompatibilityWithVoid01.ts:2:10: The implementation signature is declared here. function f(x: string): void { return; } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloadErrors.errors.txt b/tests/baselines/reference/functionOverloadErrors.errors.txt index ddcaf4786021c..66f0751fb4291 100644 --- a/tests/baselines/reference/functionOverloadErrors.errors.txt +++ b/tests/baselines/reference/functionOverloadErrors.errors.txt @@ -5,9 +5,9 @@ tests/cases/conformance/functions/functionOverloadErrors.ts(75,21): error TS2383 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. -tests/cases/conformance/functions/functionOverloadErrors.ts(99,10): error TS2394: Overload signature is not compatible with function implementation. -tests/cases/conformance/functions/functionOverloadErrors.ts(103,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/functions/functionOverloadErrors.ts(94,10): error TS2394: This overload signature is not compatible with its implementation signature. +tests/cases/conformance/functions/functionOverloadErrors.ts(99,10): error TS2394: This overload signature is not compatible with its implementation signature. +tests/cases/conformance/functions/functionOverloadErrors.ts(103,10): error TS2394: This overload signature is not compatible with its implementation signature. tests/cases/conformance/functions/functionOverloadErrors.ts(116,19): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. @@ -121,20 +121,23 @@ tests/cases/conformance/functions/functionOverloadErrors.ts(116,19): error TS237 //Function overloads with fewer params than implementation signature function fewerParams(); ~~~~~~~~~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/conformance/functions/functionOverloadErrors.ts:95:10: The implementation signature is declared here. function fewerParams(n: string) { } //Function implementation whose parameter types are not assignable to all corresponding overload signature parameters function fn13(n: string); ~~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/conformance/functions/functionOverloadErrors.ts:100:10: The implementation signature is declared here. function fn13(n: number) { } //Function overloads where return types are not all subtype of implementation return type function fn14(n: string): string; ~~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/conformance/functions/functionOverloadErrors.ts:104:10: The implementation signature is declared here. function fn14() { return 3; } diff --git a/tests/baselines/reference/functionOverloads11.errors.txt b/tests/baselines/reference/functionOverloads11.errors.txt index 005ee9bb1438a..a2e37789b60b3 100644 --- a/tests/baselines/reference/functionOverloads11.errors.txt +++ b/tests/baselines/reference/functionOverloads11.errors.txt @@ -1,9 +1,10 @@ -tests/cases/compiler/functionOverloads11.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionOverloads11.ts(1,10): error TS2394: This overload signature is not compatible with its implementation signature. ==== tests/cases/compiler/functionOverloads11.ts (1 errors) ==== function foo():number; ~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/functionOverloads11.ts:2:10: The implementation signature is declared here. function foo():string { return "" } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads17.errors.txt b/tests/baselines/reference/functionOverloads17.errors.txt index febd2c03ac8d0..1945e3fc17a18 100644 --- a/tests/baselines/reference/functionOverloads17.errors.txt +++ b/tests/baselines/reference/functionOverloads17.errors.txt @@ -1,9 +1,10 @@ -tests/cases/compiler/functionOverloads17.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionOverloads17.ts(1,10): error TS2394: This overload signature is not compatible with its implementation signature. ==== tests/cases/compiler/functionOverloads17.ts (1 errors) ==== function foo():{a:number;} ~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/functionOverloads17.ts:2:10: The implementation signature is declared here. function foo():{a:string;} { return {a:""} } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads18.errors.txt b/tests/baselines/reference/functionOverloads18.errors.txt index bec6a45ed8918..6010c633abf0f 100644 --- a/tests/baselines/reference/functionOverloads18.errors.txt +++ b/tests/baselines/reference/functionOverloads18.errors.txt @@ -1,9 +1,10 @@ -tests/cases/compiler/functionOverloads18.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionOverloads18.ts(1,10): error TS2394: This overload signature is not compatible with its implementation signature. ==== tests/cases/compiler/functionOverloads18.ts (1 errors) ==== function foo(bar:{a:number;}); ~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/functionOverloads18.ts:2:10: The implementation signature is declared here. function foo(bar:{a:string;}) { return {a:""} } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads19.errors.txt b/tests/baselines/reference/functionOverloads19.errors.txt index d87ba17562ae6..bd2ce38ec1652 100644 --- a/tests/baselines/reference/functionOverloads19.errors.txt +++ b/tests/baselines/reference/functionOverloads19.errors.txt @@ -1,10 +1,11 @@ -tests/cases/compiler/functionOverloads19.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionOverloads19.ts(1,10): error TS2394: This overload signature is not compatible with its implementation signature. ==== tests/cases/compiler/functionOverloads19.ts (1 errors) ==== function foo(bar:{b:string;}); ~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/functionOverloads19.ts:3:10: The implementation signature is declared here. function foo(bar:{a:string;}); function foo(bar:{a:any;}) { return {a:""} } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads20.errors.txt b/tests/baselines/reference/functionOverloads20.errors.txt index 6b33795bc3eca..b4e4f969dfb35 100644 --- a/tests/baselines/reference/functionOverloads20.errors.txt +++ b/tests/baselines/reference/functionOverloads20.errors.txt @@ -1,10 +1,11 @@ -tests/cases/compiler/functionOverloads20.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionOverloads20.ts(1,10): error TS2394: This overload signature is not compatible with its implementation signature. ==== tests/cases/compiler/functionOverloads20.ts (1 errors) ==== function foo(bar:{a:number;}): number; ~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/functionOverloads20.ts:3:10: The implementation signature is declared here. function foo(bar:{a:string;}): string; function foo(bar:{a:any;}): string {return ""} \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads4.errors.txt b/tests/baselines/reference/functionOverloads4.errors.txt index 78d772a0f6f5c..d9ce3a7d1893e 100644 --- a/tests/baselines/reference/functionOverloads4.errors.txt +++ b/tests/baselines/reference/functionOverloads4.errors.txt @@ -1,8 +1,9 @@ -tests/cases/compiler/functionOverloads4.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionOverloads4.ts(1,10): error TS2394: This overload signature is not compatible with its implementation signature. ==== tests/cases/compiler/functionOverloads4.ts (1 errors) ==== function foo():number; ~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/functionOverloads4.ts:2:10: The implementation signature is declared here. function foo():string { return "a" } \ No newline at end of file diff --git a/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.js b/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.js new file mode 100644 index 0000000000000..2d82034c6f7c9 --- /dev/null +++ b/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.js @@ -0,0 +1,36 @@ +//// [inlinedAliasAssignableToConstraintSameAsAlias.ts] +interface RelationFields { + x: A; + y: A[]; + z: A[]; +} +type Name = keyof RelationFields; +type ShouldA = RF[N] extends A[] + ? RF[N][0] + : never; + +class A { + x: A; + y: A[]; + z: A[]; + + whereRelated< // Works // Type is same as A1, but is not assignable to type A + RF extends RelationFields = RelationFields, + N extends Name = Name, + A1 extends A = RF[N] extends A[] ? RF[N][0] : never, + A2 extends A = ShouldA + >(): number { + return 1; + } +} + + +//// [inlinedAliasAssignableToConstraintSameAsAlias.js] +var A = /** @class */ (function () { + function A() { + } + A.prototype.whereRelated = function () { + return 1; + }; + return A; +}()); diff --git a/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.symbols b/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.symbols new file mode 100644 index 0000000000000..86e55f14ee924 --- /dev/null +++ b/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.symbols @@ -0,0 +1,85 @@ +=== tests/cases/compiler/inlinedAliasAssignableToConstraintSameAsAlias.ts === +interface RelationFields { +>RelationFields : Symbol(RelationFields, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 0, 0)) + + x: A; +>x : Symbol(RelationFields.x, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 0, 26)) +>A : Symbol(A, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 8, 10)) + + y: A[]; +>y : Symbol(RelationFields.y, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 1, 7)) +>A : Symbol(A, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 8, 10)) + + z: A[]; +>z : Symbol(RelationFields.z, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 2, 9)) +>A : Symbol(A, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 8, 10)) +} +type Name = keyof RelationFields; +>Name : Symbol(Name, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 4, 1)) +>RelationFields : Symbol(RelationFields, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 0, 0)) + +type ShouldA = RF[N] extends A[] +>ShouldA : Symbol(ShouldA, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 5, 33)) +>RF : Symbol(RF, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 6, 13)) +>RelationFields : Symbol(RelationFields, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 0, 0)) +>N : Symbol(N, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 6, 39)) +>Name : Symbol(Name, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 4, 1)) +>RF : Symbol(RF, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 6, 13)) +>N : Symbol(N, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 6, 39)) +>A : Symbol(A, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 8, 10)) + + ? RF[N][0] +>RF : Symbol(RF, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 6, 13)) +>N : Symbol(N, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 6, 39)) + + : never; + +class A { +>A : Symbol(A, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 8, 10)) + + x: A; +>x : Symbol(A.x, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 10, 9)) +>A : Symbol(A, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 8, 10)) + + y: A[]; +>y : Symbol(A.y, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 11, 7)) +>A : Symbol(A, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 8, 10)) + + z: A[]; +>z : Symbol(A.z, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 12, 9)) +>A : Symbol(A, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 8, 10)) + + whereRelated< // Works // Type is same as A1, but is not assignable to type A +>whereRelated : Symbol(A.whereRelated, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 13, 9)) + + RF extends RelationFields = RelationFields, +>RF : Symbol(RF, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 15, 15)) +>RelationFields : Symbol(RelationFields, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 0, 0)) +>RelationFields : Symbol(RelationFields, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 0, 0)) + + N extends Name = Name, +>N : Symbol(N, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 16, 47)) +>Name : Symbol(Name, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 4, 1)) +>Name : Symbol(Name, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 4, 1)) + + A1 extends A = RF[N] extends A[] ? RF[N][0] : never, +>A1 : Symbol(A1, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 17, 26)) +>A : Symbol(A, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 8, 10)) +>RF : Symbol(RF, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 15, 15)) +>N : Symbol(N, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 16, 47)) +>A : Symbol(A, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 8, 10)) +>RF : Symbol(RF, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 15, 15)) +>N : Symbol(N, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 16, 47)) + + A2 extends A = ShouldA +>A2 : Symbol(A2, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 18, 56)) +>A : Symbol(A, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 8, 10)) +>ShouldA : Symbol(ShouldA, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 5, 33)) +>RF : Symbol(RF, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 15, 15)) +>N : Symbol(N, Decl(inlinedAliasAssignableToConstraintSameAsAlias.ts, 16, 47)) + + >(): number { + return 1; + } +} + diff --git a/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.types b/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.types new file mode 100644 index 0000000000000..d337fbc718abb --- /dev/null +++ b/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/inlinedAliasAssignableToConstraintSameAsAlias.ts === +interface RelationFields { + x: A; +>x : A + + y: A[]; +>y : A[] + + z: A[]; +>z : A[] +} +type Name = keyof RelationFields; +>Name : "x" | "y" | "z" + +type ShouldA = RF[N] extends A[] +>ShouldA : ShouldA + + ? RF[N][0] + : never; + +class A { +>A : A + + x: A; +>x : A + + y: A[]; +>y : A[] + + z: A[]; +>z : A[] + + whereRelated< // Works // Type is same as A1, but is not assignable to type A +>whereRelated : >() => number + + RF extends RelationFields = RelationFields, + N extends Name = Name, + A1 extends A = RF[N] extends A[] ? RF[N][0] : never, + A2 extends A = ShouldA + >(): number { + return 1; +>1 : 1 + } +} + diff --git a/tests/baselines/reference/intrinsics.errors.txt b/tests/baselines/reference/intrinsics.errors.txt index 5692f057903e5..13d61dacbcf97 100644 --- a/tests/baselines/reference/intrinsics.errors.txt +++ b/tests/baselines/reference/intrinsics.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/intrinsics.ts(1,21): error TS2304: Cannot find name 'hasOwnProperty'. +tests/cases/compiler/intrinsics.ts(1,21): error TS2749: 'hasOwnProperty' refers to a value, but is being used as a type here. tests/cases/compiler/intrinsics.ts(1,21): error TS4025: Exported variable 'hasOwnProperty' has or is using private name 'hasOwnProperty'. tests/cases/compiler/intrinsics.ts(10,1): error TS2304: Cannot find name '__proto__'. @@ -6,7 +6,7 @@ tests/cases/compiler/intrinsics.ts(10,1): error TS2304: Cannot find name '__prot ==== tests/cases/compiler/intrinsics.ts (3 errors) ==== var hasOwnProperty: hasOwnProperty; // Error ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'hasOwnProperty'. +!!! error TS2749: 'hasOwnProperty' refers to a value, but is being used as a type here. ~~~~~~~~~~~~~~ !!! error TS4025: Exported variable 'hasOwnProperty' has or is using private name 'hasOwnProperty'. diff --git a/tests/baselines/reference/isomorphicMappedTypeInference.js b/tests/baselines/reference/isomorphicMappedTypeInference.js index 589122444323a..aa904e9afa173 100644 --- a/tests/baselines/reference/isomorphicMappedTypeInference.js +++ b/tests/baselines/reference/isomorphicMappedTypeInference.js @@ -149,7 +149,35 @@ var g2 = applySpec({ foo: { bar: { baz: (x: any) => true } } }); const foo = (object: T, partial: Partial) => object; let o = {a: 5, b: 7}; foo(o, {b: 9}); -o = foo(o, {b: 9}); +o = foo(o, {b: 9}); + +// Inferring to { [P in K]: X }, where K extends keyof T, produces same inferences as +// inferring to { [P in keyof T]: X }. + +declare function f20(obj: Pick): T; +declare function f21(obj: Pick): K; +declare function f22(obj: Boxified>): T; +declare function f23(obj: Pick): T; +declare function f24(obj: Pick): T & U; + +let x0 = f20({ foo: 42, bar: "hello" }); +let x1 = f21({ foo: 42, bar: "hello" }); +let x2 = f22({ foo: { value: 42} , bar: { value: "hello" } }); +let x3 = f23({ foo: 42, bar: "hello" }); +let x4 = f24({ foo: 42, bar: "hello" }); + +// Repro from #29765 + +function getProps(obj: T, list: K[]): Pick { + return {} as any; +} + +const myAny: any = {}; + +const o1 = getProps(myAny, ['foo', 'bar']); + +const o2: { foo: any; bar: any } = getProps(myAny, ['foo', 'bar']); + //// [isomorphicMappedTypeInference.js] function box(x) { @@ -255,6 +283,18 @@ var foo = function (object, partial) { return object; }; var o = { a: 5, b: 7 }; foo(o, { b: 9 }); o = foo(o, { b: 9 }); +var x0 = f20({ foo: 42, bar: "hello" }); +var x1 = f21({ foo: 42, bar: "hello" }); +var x2 = f22({ foo: { value: 42 }, bar: { value: "hello" } }); +var x3 = f23({ foo: 42, bar: "hello" }); +var x4 = f24({ foo: 42, bar: "hello" }); +// Repro from #29765 +function getProps(obj, list) { + return {}; +} +var myAny = {}; +var o1 = getProps(myAny, ['foo', 'bar']); +var o2 = getProps(myAny, ['foo', 'bar']); //// [isomorphicMappedTypeInference.d.ts] @@ -323,3 +363,35 @@ declare let o: { a: number; b: number; }; +declare function f20(obj: Pick): T; +declare function f21(obj: Pick): K; +declare function f22(obj: Boxified>): T; +declare function f23(obj: Pick): T; +declare function f24(obj: Pick): T & U; +declare let x0: { + foo: number; + bar: string; +}; +declare let x1: "foo" | "bar"; +declare let x2: { + foo: number; + bar: string; +}; +declare let x3: { + foo: number; + bar: string; +}; +declare let x4: { + foo: number; + bar: string; +} & { + foo: number; + bar: string; +}; +declare function getProps(obj: T, list: K[]): Pick; +declare const myAny: any; +declare const o1: Pick; +declare const o2: { + foo: any; + bar: any; +}; diff --git a/tests/baselines/reference/isomorphicMappedTypeInference.symbols b/tests/baselines/reference/isomorphicMappedTypeInference.symbols index d36ebc7a4a517..3192be13ff634 100644 --- a/tests/baselines/reference/isomorphicMappedTypeInference.symbols +++ b/tests/baselines/reference/isomorphicMappedTypeInference.symbols @@ -486,3 +486,133 @@ o = foo(o, {b: 9}); >o : Symbol(o, Decl(isomorphicMappedTypeInference.ts, 148, 3)) >b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 150, 12)) +// Inferring to { [P in K]: X }, where K extends keyof T, produces same inferences as +// inferring to { [P in keyof T]: X }. + +declare function f20(obj: Pick): T; +>f20 : Symbol(f20, Decl(isomorphicMappedTypeInference.ts, 150, 19)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 155, 21)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 155, 23)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 155, 21)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 155, 43)) +>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 155, 21)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 155, 23)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 155, 21)) + +declare function f21(obj: Pick): K; +>f21 : Symbol(f21, Decl(isomorphicMappedTypeInference.ts, 155, 63)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 156, 21)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 156, 23)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 156, 21)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 156, 43)) +>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 156, 21)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 156, 23)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 156, 23)) + +declare function f22(obj: Boxified>): T; +>f22 : Symbol(f22, Decl(isomorphicMappedTypeInference.ts, 156, 63)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 157, 21)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 157, 23)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 157, 21)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 157, 43)) +>Boxified : Symbol(Boxified, Decl(isomorphicMappedTypeInference.ts, 2, 1)) +>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 157, 21)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 157, 23)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 157, 21)) + +declare function f23(obj: Pick): T; +>f23 : Symbol(f23, Decl(isomorphicMappedTypeInference.ts, 157, 73)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 158, 21)) +>U : Symbol(U, Decl(isomorphicMappedTypeInference.ts, 158, 23)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 158, 21)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 158, 42)) +>U : Symbol(U, Decl(isomorphicMappedTypeInference.ts, 158, 23)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 158, 56)) +>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 158, 21)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 158, 42)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 158, 21)) + +declare function f24(obj: Pick): T & U; +>f24 : Symbol(f24, Decl(isomorphicMappedTypeInference.ts, 158, 76)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 159, 21)) +>U : Symbol(U, Decl(isomorphicMappedTypeInference.ts, 159, 23)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 159, 26)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 159, 21)) +>U : Symbol(U, Decl(isomorphicMappedTypeInference.ts, 159, 23)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 159, 56)) +>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 159, 21)) +>U : Symbol(U, Decl(isomorphicMappedTypeInference.ts, 159, 23)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 159, 26)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 159, 21)) +>U : Symbol(U, Decl(isomorphicMappedTypeInference.ts, 159, 23)) + +let x0 = f20({ foo: 42, bar: "hello" }); +>x0 : Symbol(x0, Decl(isomorphicMappedTypeInference.ts, 161, 3)) +>f20 : Symbol(f20, Decl(isomorphicMappedTypeInference.ts, 150, 19)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 161, 14)) +>bar : Symbol(bar, Decl(isomorphicMappedTypeInference.ts, 161, 23)) + +let x1 = f21({ foo: 42, bar: "hello" }); +>x1 : Symbol(x1, Decl(isomorphicMappedTypeInference.ts, 162, 3)) +>f21 : Symbol(f21, Decl(isomorphicMappedTypeInference.ts, 155, 63)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 162, 14)) +>bar : Symbol(bar, Decl(isomorphicMappedTypeInference.ts, 162, 23)) + +let x2 = f22({ foo: { value: 42} , bar: { value: "hello" } }); +>x2 : Symbol(x2, Decl(isomorphicMappedTypeInference.ts, 163, 3)) +>f22 : Symbol(f22, Decl(isomorphicMappedTypeInference.ts, 156, 63)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 163, 14)) +>value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 163, 21)) +>bar : Symbol(bar, Decl(isomorphicMappedTypeInference.ts, 163, 34)) +>value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 163, 41)) + +let x3 = f23({ foo: 42, bar: "hello" }); +>x3 : Symbol(x3, Decl(isomorphicMappedTypeInference.ts, 164, 3)) +>f23 : Symbol(f23, Decl(isomorphicMappedTypeInference.ts, 157, 73)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 164, 14)) +>bar : Symbol(bar, Decl(isomorphicMappedTypeInference.ts, 164, 23)) + +let x4 = f24({ foo: 42, bar: "hello" }); +>x4 : Symbol(x4, Decl(isomorphicMappedTypeInference.ts, 165, 3)) +>f24 : Symbol(f24, Decl(isomorphicMappedTypeInference.ts, 158, 76)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 165, 14)) +>bar : Symbol(bar, Decl(isomorphicMappedTypeInference.ts, 165, 23)) + +// Repro from #29765 + +function getProps(obj: T, list: K[]): Pick { +>getProps : Symbol(getProps, Decl(isomorphicMappedTypeInference.ts, 165, 40)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 169, 18)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 169, 20)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 169, 18)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 169, 40)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 169, 18)) +>list : Symbol(list, Decl(isomorphicMappedTypeInference.ts, 169, 47)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 169, 20)) +>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 169, 18)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 169, 20)) + + return {} as any; +} + +const myAny: any = {}; +>myAny : Symbol(myAny, Decl(isomorphicMappedTypeInference.ts, 173, 5)) + +const o1 = getProps(myAny, ['foo', 'bar']); +>o1 : Symbol(o1, Decl(isomorphicMappedTypeInference.ts, 175, 5)) +>getProps : Symbol(getProps, Decl(isomorphicMappedTypeInference.ts, 165, 40)) +>myAny : Symbol(myAny, Decl(isomorphicMappedTypeInference.ts, 173, 5)) + +const o2: { foo: any; bar: any } = getProps(myAny, ['foo', 'bar']); +>o2 : Symbol(o2, Decl(isomorphicMappedTypeInference.ts, 177, 5)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 177, 11)) +>bar : Symbol(bar, Decl(isomorphicMappedTypeInference.ts, 177, 21)) +>getProps : Symbol(getProps, Decl(isomorphicMappedTypeInference.ts, 165, 40)) +>myAny : Symbol(myAny, Decl(isomorphicMappedTypeInference.ts, 173, 5)) + diff --git a/tests/baselines/reference/isomorphicMappedTypeInference.types b/tests/baselines/reference/isomorphicMappedTypeInference.types index 4488fa27daf6c..1f1fa0d200a0c 100644 --- a/tests/baselines/reference/isomorphicMappedTypeInference.types +++ b/tests/baselines/reference/isomorphicMappedTypeInference.types @@ -507,3 +507,116 @@ o = foo(o, {b: 9}); >b : number >9 : 9 +// Inferring to { [P in K]: X }, where K extends keyof T, produces same inferences as +// inferring to { [P in keyof T]: X }. + +declare function f20(obj: Pick): T; +>f20 : (obj: Pick) => T +>obj : Pick + +declare function f21(obj: Pick): K; +>f21 : (obj: Pick) => K +>obj : Pick + +declare function f22(obj: Boxified>): T; +>f22 : (obj: Boxified>) => T +>obj : Boxified> + +declare function f23(obj: Pick): T; +>f23 : (obj: Pick) => T +>obj : Pick + +declare function f24(obj: Pick): T & U; +>f24 : (obj: Pick) => T & U +>obj : Pick + +let x0 = f20({ foo: 42, bar: "hello" }); +>x0 : { foo: number; bar: string; } +>f20({ foo: 42, bar: "hello" }) : { foo: number; bar: string; } +>f20 : (obj: Pick) => T +>{ foo: 42, bar: "hello" } : { foo: number; bar: string; } +>foo : number +>42 : 42 +>bar : string +>"hello" : "hello" + +let x1 = f21({ foo: 42, bar: "hello" }); +>x1 : "foo" | "bar" +>f21({ foo: 42, bar: "hello" }) : "foo" | "bar" +>f21 : (obj: Pick) => K +>{ foo: 42, bar: "hello" } : { foo: number; bar: string; } +>foo : number +>42 : 42 +>bar : string +>"hello" : "hello" + +let x2 = f22({ foo: { value: 42} , bar: { value: "hello" } }); +>x2 : { foo: number; bar: string; } +>f22({ foo: { value: 42} , bar: { value: "hello" } }) : { foo: number; bar: string; } +>f22 : (obj: Boxified>) => T +>{ foo: { value: 42} , bar: { value: "hello" } } : { foo: { value: number; }; bar: { value: string; }; } +>foo : { value: number; } +>{ value: 42} : { value: number; } +>value : number +>42 : 42 +>bar : { value: string; } +>{ value: "hello" } : { value: string; } +>value : string +>"hello" : "hello" + +let x3 = f23({ foo: 42, bar: "hello" }); +>x3 : { foo: number; bar: string; } +>f23({ foo: 42, bar: "hello" }) : { foo: number; bar: string; } +>f23 : (obj: Pick) => T +>{ foo: 42, bar: "hello" } : { foo: number; bar: string; } +>foo : number +>42 : 42 +>bar : string +>"hello" : "hello" + +let x4 = f24({ foo: 42, bar: "hello" }); +>x4 : { foo: number; bar: string; } & { foo: number; bar: string; } +>f24({ foo: 42, bar: "hello" }) : { foo: number; bar: string; } & { foo: number; bar: string; } +>f24 : (obj: Pick) => T & U +>{ foo: 42, bar: "hello" } : { foo: number; bar: string; } +>foo : number +>42 : 42 +>bar : string +>"hello" : "hello" + +// Repro from #29765 + +function getProps(obj: T, list: K[]): Pick { +>getProps : (obj: T, list: K[]) => Pick +>obj : T +>list : K[] + + return {} as any; +>{} as any : any +>{} : {} +} + +const myAny: any = {}; +>myAny : any +>{} : {} + +const o1 = getProps(myAny, ['foo', 'bar']); +>o1 : Pick +>getProps(myAny, ['foo', 'bar']) : Pick +>getProps : (obj: T, list: K[]) => Pick +>myAny : any +>['foo', 'bar'] : ("foo" | "bar")[] +>'foo' : "foo" +>'bar' : "bar" + +const o2: { foo: any; bar: any } = getProps(myAny, ['foo', 'bar']); +>o2 : { foo: any; bar: any; } +>foo : any +>bar : any +>getProps(myAny, ['foo', 'bar']) : Pick +>getProps : (obj: T, list: K[]) => Pick +>myAny : any +>['foo', 'bar'] : ("foo" | "bar")[] +>'foo' : "foo" +>'bar' : "bar" + diff --git a/tests/baselines/reference/jqueryInference.js b/tests/baselines/reference/jqueryInference.js index 05664a889deae..cea70bc4391dd 100644 --- a/tests/baselines/reference/jqueryInference.js +++ b/tests/baselines/reference/jqueryInference.js @@ -11,7 +11,7 @@ declare function shouldBeIdentity(p: DoNothingAlias): MyPromise; var p2 = shouldBeIdentity(p1); -var p2: MyPromise; +var p2: MyPromise; //// [jqueryInference.js] diff --git a/tests/baselines/reference/jqueryInference.symbols b/tests/baselines/reference/jqueryInference.symbols index ce3836aacd478..3d6c4f2f9609f 100644 --- a/tests/baselines/reference/jqueryInference.symbols +++ b/tests/baselines/reference/jqueryInference.symbols @@ -48,7 +48,7 @@ var p2 = shouldBeIdentity(p1); >shouldBeIdentity : Symbol(shouldBeIdentity, Decl(jqueryInference.ts, 6, 58)) >p1 : Symbol(p1, Decl(jqueryInference.ts, 10, 13)) -var p2: MyPromise; +var p2: MyPromise; >p2 : Symbol(p2, Decl(jqueryInference.ts, 11, 3), Decl(jqueryInference.ts, 12, 3)) >MyPromise : Symbol(MyPromise, Decl(jqueryInference.ts, 0, 0)) diff --git a/tests/baselines/reference/jqueryInference.types b/tests/baselines/reference/jqueryInference.types index 5f055fe16b248..558b0f53df36c 100644 --- a/tests/baselines/reference/jqueryInference.types +++ b/tests/baselines/reference/jqueryInference.types @@ -22,11 +22,11 @@ declare const p1: MyPromise; >p1 : MyPromise var p2 = shouldBeIdentity(p1); ->p2 : MyPromise ->shouldBeIdentity(p1) : MyPromise +>p2 : MyPromise +>shouldBeIdentity(p1) : MyPromise >shouldBeIdentity : (p: DoNothingAlias) => MyPromise >p1 : MyPromise -var p2: MyPromise; ->p2 : MyPromise +var p2: MyPromise; +>p2 : MyPromise diff --git a/tests/baselines/reference/jsFileClassSelfReferencedProperty.types b/tests/baselines/reference/jsFileClassSelfReferencedProperty.types index d5c2fe39c9fce..204eee67c9707 100644 --- a/tests/baselines/reference/jsFileClassSelfReferencedProperty.types +++ b/tests/baselines/reference/jsFileClassSelfReferencedProperty.types @@ -4,11 +4,11 @@ export class StackOverflowTest { constructor () { this.testStackOverflow = this.testStackOverflow.bind(this) ->this.testStackOverflow = this.testStackOverflow.bind(this) : error +>this.testStackOverflow = this.testStackOverflow.bind(this) : any >this.testStackOverflow : any >this : this >testStackOverflow : any ->this.testStackOverflow.bind(this) : error +>this.testStackOverflow.bind(this) : any >this.testStackOverflow.bind : any >this.testStackOverflow : any >this : this diff --git a/tests/baselines/reference/jsdocTypeNongenericInstantiationAttempt.errors.txt b/tests/baselines/reference/jsdocTypeNongenericInstantiationAttempt.errors.txt index 941e4386f9927..b3298f137f14f 100644 --- a/tests/baselines/reference/jsdocTypeNongenericInstantiationAttempt.errors.txt +++ b/tests/baselines/reference/jsdocTypeNongenericInstantiationAttempt.errors.txt @@ -5,7 +5,7 @@ tests/cases/compiler/index4.js(2,19): error TS2315: Type 'Function' is not gener tests/cases/compiler/index5.js(2,19): error TS2315: Type 'String' is not generic. tests/cases/compiler/index6.js(2,19): error TS2315: Type 'Number' is not generic. tests/cases/compiler/index7.js(2,19): error TS2315: Type 'Object' is not generic. -tests/cases/compiler/index8.js(4,12): error TS2304: Cannot find name 'fn'. +tests/cases/compiler/index8.js(4,12): error TS2749: 'fn' refers to a value, but is being used as a type here. tests/cases/compiler/index8.js(4,15): error TS2304: Cannot find name 'T'. @@ -90,7 +90,7 @@ tests/cases/compiler/index8.js(4,15): error TS2304: Cannot find name 'T'. /** * @param {fn} somebody ~~ -!!! error TS2304: Cannot find name 'fn'. +!!! error TS2749: 'fn' refers to a value, but is being used as a type here. ~ !!! error TS2304: Cannot find name 'T'. */ diff --git a/tests/baselines/reference/mappedTypeRelationships.errors.txt b/tests/baselines/reference/mappedTypeRelationships.errors.txt index 60a06e000c255..3d63765407972 100644 --- a/tests/baselines/reference/mappedTypeRelationships.errors.txt +++ b/tests/baselines/reference/mappedTypeRelationships.errors.txt @@ -34,7 +34,9 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(66,5): error TS2 tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(66,5): error TS2542: Index signature in type 'Readonly' only permits reading. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(72,5): error TS2322: Type 'Partial' is not assignable to type 'T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(78,5): error TS2322: Type 'Partial' is not assignable to type 'Partial'. + Type 'Thing' is not assignable to type 'T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(88,5): error TS2322: Type 'Readonly' is not assignable to type 'Readonly'. + Type 'Thing' is not assignable to type 'T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(127,5): error TS2322: Type 'Partial' is not assignable to type 'Identity'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(143,5): error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'. Type 'T[P]' is not assignable to type 'U[P]'. @@ -197,6 +199,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS y = x; // Error ~ !!! error TS2322: Type 'Partial' is not assignable to type 'Partial'. +!!! error TS2322: Type 'Thing' is not assignable to type 'T'. } function f40(x: T, y: Readonly) { @@ -209,6 +212,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS y = x; // Error ~ !!! error TS2322: Type 'Readonly' is not assignable to type 'Readonly'. +!!! error TS2322: Type 'Thing' is not assignable to type 'T'. } type Item = { diff --git a/tests/baselines/reference/mappedTypes5.errors.txt b/tests/baselines/reference/mappedTypes5.errors.txt index d0c32cd1dd956..21d6f98964ae5 100644 --- a/tests/baselines/reference/mappedTypes5.errors.txt +++ b/tests/baselines/reference/mappedTypes5.errors.txt @@ -1,6 +1,7 @@ tests/cases/conformance/types/mapped/mappedTypes5.ts(6,9): error TS2322: Type 'Partial' is not assignable to type 'Readonly'. tests/cases/conformance/types/mapped/mappedTypes5.ts(8,9): error TS2322: Type 'Partial>' is not assignable to type 'Readonly'. tests/cases/conformance/types/mapped/mappedTypes5.ts(9,9): error TS2322: Type 'Readonly>' is not assignable to type 'Readonly'. + Type 'Partial' is not assignable to type 'T'. ==== tests/cases/conformance/types/mapped/mappedTypes5.ts (3 errors) ==== @@ -19,6 +20,7 @@ tests/cases/conformance/types/mapped/mappedTypes5.ts(9,9): error TS2322: Type 'R let b4: Readonly = rp; // Error ~~ !!! error TS2322: Type 'Readonly>' is not assignable to type 'Readonly'. +!!! error TS2322: Type 'Partial' is not assignable to type 'T'. let c1: Partial> = p; let c2: Partial> = r; let c3: Partial> = pr; diff --git a/tests/baselines/reference/objectSpread.types b/tests/baselines/reference/objectSpread.types index 0ffd5dd20b718..e095a4e03bb1c 100644 --- a/tests/baselines/reference/objectSpread.types +++ b/tests/baselines/reference/objectSpread.types @@ -602,7 +602,7 @@ let exclusive: { id: string, a: number, b: string, c: string, d: boolean } = >d : boolean f({ a: 1, b: 'yes' }, { c: 'no', d: false }) ->f({ a: 1, b: 'yes' }, { c: 'no', d: false }) : { a: number; b: string; } & { c: string; d: boolean; } & { id: string; } +>f({ a: 1, b: 'yes' }, { c: 'no', d: false }) : { a: number; b: string; } & { c: string; d: false; } & { id: string; } >f : (t: T, u: U) => T & U & { id: string; } >{ a: 1, b: 'yes' } : { a: number; b: string; } >a : number diff --git a/tests/baselines/reference/overloadAssignmentCompat.errors.txt b/tests/baselines/reference/overloadAssignmentCompat.errors.txt index 35906ee92c9aa..a0609b70e713a 100644 --- a/tests/baselines/reference/overloadAssignmentCompat.errors.txt +++ b/tests/baselines/reference/overloadAssignmentCompat.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/overloadAssignmentCompat.ts(34,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/overloadAssignmentCompat.ts(34,10): error TS2394: This overload signature is not compatible with its implementation signature. ==== tests/cases/compiler/overloadAssignmentCompat.ts (1 errors) ==== @@ -37,7 +37,8 @@ tests/cases/compiler/overloadAssignmentCompat.ts(34,10): error TS2394: Overload // error - signatures are not assignment compatible function foo():number; ~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/overloadAssignmentCompat.ts:35:10: The implementation signature is declared here. function foo():string { return "a" }; \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt b/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt index aa7bbf7723968..457f7f5b3888f 100644 --- a/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt +++ b/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt @@ -1,11 +1,12 @@ -tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(1,10): error TS2394: This overload signature is not compatible with its implementation signature. tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(9,8): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/overloadOnConstNoAnyImplementation.ts (2 errors) ==== function x1(a: number, cb: (x: 'hi') => number); ~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/overloadOnConstNoAnyImplementation.ts:3:10: The implementation signature is declared here. function x1(a: number, cb: (x: 'bye') => number); function x1(a: number, cb: (x: string) => number) { cb('hi'); diff --git a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt index a090f370863f5..f6792949e596e 100644 --- a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt +++ b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(6,5): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(6,5): error TS2394: This overload signature is not compatible with its implementation signature. tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(12,18): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. 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. @@ -16,7 +16,8 @@ tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(21,9): error TS2345: class C { x1(a: number, callback: (x: 'hi') => number); ~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts:7:5: The implementation signature is declared here. x1(a: number, callback: (x: string) => number) { callback('hi'); callback('bye'); diff --git a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt index 3fe0a43d855c8..9fc6c97f6b77d 100644 --- a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt +++ b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(6,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(6,10): error TS2394: This overload signature is not compatible with its implementation signature. tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(11,5): error TS2345: Argument of type '"HI"' is not assignable to parameter of type '"SPAN"'. @@ -10,7 +10,8 @@ tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(11,5): error TS2345: function foo(name: "SPAN"): Derived1; ~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts:7:10: The implementation signature is declared here. function foo(name: "DIV"): Derived2 { return null; } diff --git a/tests/baselines/reference/overloadingOnConstants2.errors.txt b/tests/baselines/reference/overloadingOnConstants2.errors.txt index f50a6bbd8c3a0..c12d77714a31e 100644 --- a/tests/baselines/reference/overloadingOnConstants2.errors.txt +++ b/tests/baselines/reference/overloadingOnConstants2.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/overloadingOnConstants2.ts(9,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/overloadingOnConstants2.ts(9,10): error TS2394: This overload signature is not compatible with its implementation signature. 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 TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2394: This overload signature is not compatible with its implementation signature. ==== tests/cases/compiler/overloadingOnConstants2.ts (3 errors) ==== @@ -14,7 +14,8 @@ tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2394: Overload s function foo(x: "hi", items: string[]): D; function foo(x: "bye", items: string[]): E; ~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/overloadingOnConstants2.ts:10:10: The implementation signature is declared here. function foo(x: string, items: string[]): C { return null; } @@ -28,7 +29,8 @@ tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2394: Overload s //function bar(x: "hi", items: string[]): D; function bar(x: "bye", items: string[]): E; ~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/overloadingOnConstants2.ts:21:10: The implementation signature is declared here. function bar(x: string, items: string[]): C; function bar(x: string, items: string[]): C { return null; diff --git a/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt b/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt index d1a0513c1f68d..6f64fdc86697f 100644 --- a/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt +++ b/tests/baselines/reference/parameterPropertyInConstructor2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/parameterPropertyInConstructor2.ts(3,5): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/parameterPropertyInConstructor2.ts(3,5): error TS2394: This overload signature is not compatible with its implementation signature. tests/cases/compiler/parameterPropertyInConstructor2.ts(3,17): error TS2369: A parameter property is only allowed in a constructor implementation. tests/cases/compiler/parameterPropertyInConstructor2.ts(4,24): error TS2300: Duplicate identifier 'names'. @@ -8,7 +8,8 @@ tests/cases/compiler/parameterPropertyInConstructor2.ts(4,24): error TS2300: Dup class Customers { constructor(public names: string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/parameterPropertyInConstructor2.ts:4:5: The implementation signature is declared here. ~~~~~~~~~~~~~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. constructor(public names: string, public ages: number) { diff --git a/tests/baselines/reference/parserAmbiguityWithBinaryOperator4.errors.txt b/tests/baselines/reference/parserAmbiguityWithBinaryOperator4.errors.txt index 41147305ce059..a94b60e5f996d 100644 --- a/tests/baselines/reference/parserAmbiguityWithBinaryOperator4.errors.txt +++ b/tests/baselines/reference/parserAmbiguityWithBinaryOperator4.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserAmbiguityWithBinaryOperator4.ts(3,9): error TS2347: Untyped function calls may not accept type arguments. -tests/cases/conformance/parser/ecmascript5/Generics/parserAmbiguityWithBinaryOperator4.ts(3,11): error TS2304: Cannot find name 'b'. -tests/cases/conformance/parser/ecmascript5/Generics/parserAmbiguityWithBinaryOperator4.ts(3,14): error TS2304: Cannot find name 'b'. +tests/cases/conformance/parser/ecmascript5/Generics/parserAmbiguityWithBinaryOperator4.ts(3,11): error TS2749: 'b' refers to a value, but is being used as a type here. +tests/cases/conformance/parser/ecmascript5/Generics/parserAmbiguityWithBinaryOperator4.ts(3,14): error TS2749: 'b' refers to a value, but is being used as a type here. ==== tests/cases/conformance/parser/ecmascript5/Generics/parserAmbiguityWithBinaryOperator4.ts (3 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserAmbiguityWithBinaryOpe ~~~~~~~~~~~~~~ !!! error TS2347: Untyped function calls may not accept type arguments. ~ -!!! error TS2304: Cannot find name 'b'. +!!! error TS2749: 'b' refers to a value, but is being used as a type here. ~ -!!! error TS2304: Cannot find name 'b'. +!!! error TS2749: 'b' refers to a value, but is being used as a type here. } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration12.errors.txt b/tests/baselines/reference/parserClassDeclaration12.errors.txt index 130eaa3defd2e..453c4f13eba93 100644 --- a/tests/baselines/reference/parserClassDeclaration12.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration12.errors.txt @@ -1,10 +1,11 @@ -tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration12.ts(2,4): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration12.ts(2,4): error TS2394: This overload signature is not compatible with its implementation signature. ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration12.ts (1 errors) ==== class C { constructor(); ~~~~~~~~~~~~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration12.ts:3:4: The implementation signature is declared here. constructor(a) { } } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement18.types b/tests/baselines/reference/parserES5ForOfStatement18.types index 156ed2c68f306..f9544e39a31d1 100644 --- a/tests/baselines/reference/parserES5ForOfStatement18.types +++ b/tests/baselines/reference/parserES5ForOfStatement18.types @@ -1,5 +1,5 @@ === tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts === for (var of of of) { } >of : any ->of : error +>of : any diff --git a/tests/baselines/reference/parserES5ForOfStatement19.types b/tests/baselines/reference/parserES5ForOfStatement19.types index cc3a1ed01b195..13abc7ae757b4 100644 --- a/tests/baselines/reference/parserES5ForOfStatement19.types +++ b/tests/baselines/reference/parserES5ForOfStatement19.types @@ -1,5 +1,5 @@ === tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts === for (var of in of) { } >of : any ->of : error +>of : any diff --git a/tests/baselines/reference/parserForOfStatement18.types b/tests/baselines/reference/parserForOfStatement18.types index 3fe8de5b6c10e..8e3b52ac87743 100644 --- a/tests/baselines/reference/parserForOfStatement18.types +++ b/tests/baselines/reference/parserForOfStatement18.types @@ -1,5 +1,5 @@ === tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts === for (var of of of) { } >of : any ->of : error +>of : any diff --git a/tests/baselines/reference/parserForOfStatement19.types b/tests/baselines/reference/parserForOfStatement19.types index 04104a9667c0e..6fcc5e8f79216 100644 --- a/tests/baselines/reference/parserForOfStatement19.types +++ b/tests/baselines/reference/parserForOfStatement19.types @@ -1,5 +1,5 @@ === tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts === for (var of in of) { } >of : any ->of : error +>of : any diff --git a/tests/baselines/reference/parserParameterList15.errors.txt b/tests/baselines/reference/parserParameterList15.errors.txt index 7a1a8af90937b..cca41d949879c 100644 --- a/tests/baselines/reference/parserParameterList15.errors.txt +++ b/tests/baselines/reference/parserParameterList15.errors.txt @@ -1,11 +1,12 @@ -tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList15.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList15.ts(1,10): error TS2394: This overload signature is not compatible with its implementation signature. tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList15.ts(1,14): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. ==== tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList15.ts (2 errors) ==== function foo(a = 4); ~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList15.ts:2:10: The implementation signature is declared here. ~~~~~ !!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. function foo(a, b) {} \ No newline at end of file diff --git a/tests/baselines/reference/parserParameterList16.errors.txt b/tests/baselines/reference/parserParameterList16.errors.txt index 4b30b386e6f91..7d496cc03ea42 100644 --- a/tests/baselines/reference/parserParameterList16.errors.txt +++ b/tests/baselines/reference/parserParameterList16.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList16.ts(2,4): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList16.ts(2,4): error TS2394: This overload signature is not compatible with its implementation signature. tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList16.ts(2,8): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. @@ -6,7 +6,8 @@ tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList16. class C { foo(a = 4); ~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList16.ts:3:4: The implementation signature is declared here. ~~~~~ !!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. foo(a, b) { } diff --git a/tests/baselines/reference/parserParameterList17.errors.txt b/tests/baselines/reference/parserParameterList17.errors.txt index a75e3c3b71299..025c2eabbba86 100644 --- a/tests/baselines/reference/parserParameterList17.errors.txt +++ b/tests/baselines/reference/parserParameterList17.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList17.ts(2,4): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList17.ts(2,4): error TS2394: This overload signature is not compatible with its implementation signature. tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList17.ts(2,16): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. @@ -6,7 +6,8 @@ tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList17. class C { constructor(a = 4); ~~~~~~~~~~~~~~~~~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList17.ts:3:4: The implementation signature is declared here. ~~~~~ !!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. constructor(a, b) { } diff --git a/tests/baselines/reference/recur1.types b/tests/baselines/reference/recur1.types index d4893d27b8687..83b4dbd598b82 100644 --- a/tests/baselines/reference/recur1.types +++ b/tests/baselines/reference/recur1.types @@ -15,7 +15,7 @@ salt.pepper = function() {} var cobalt = new cobalt.pitch(); >cobalt : any ->new cobalt.pitch() : error +>new cobalt.pitch() : any >cobalt.pitch : any >cobalt : any >pitch : any diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.types b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.types index 939e7beb79b25..a5675737c214c 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.types +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.types @@ -14,7 +14,7 @@ import self = require("recursiveExportAssignmentAndFindAliasedType7_moduleD"); var selfVar = self; >selfVar : any ->self : error +>self : any export = selfVar; >selfVar : any diff --git a/tests/baselines/reference/recursiveFunctionTypes.errors.txt b/tests/baselines/reference/recursiveFunctionTypes.errors.txt index 77010d7efa198..cf30a4ff273f4 100644 --- a/tests/baselines/reference/recursiveFunctionTypes.errors.txt +++ b/tests/baselines/reference/recursiveFunctionTypes.errors.txt @@ -7,7 +7,7 @@ tests/cases/compiler/recursiveFunctionTypes.ts(12,16): error TS2355: A function tests/cases/compiler/recursiveFunctionTypes.ts(17,5): error TS2322: Type '() => I' is not assignable to type 'number'. tests/cases/compiler/recursiveFunctionTypes.ts(22,5): error TS2345: Argument of type '3' is not assignable to parameter of type '(t: typeof g) => void'. tests/cases/compiler/recursiveFunctionTypes.ts(25,1): error TS2322: Type '3' is not assignable to type '() => any'. -tests/cases/compiler/recursiveFunctionTypes.ts(30,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/recursiveFunctionTypes.ts(30,10): error TS2394: This overload signature is not compatible with its implementation signature. tests/cases/compiler/recursiveFunctionTypes.ts(33,1): error TS2554: Expected 0-1 arguments, but got 2. tests/cases/compiler/recursiveFunctionTypes.ts(34,4): error TS2345: Argument of type '""' is not assignable to parameter of type '{ (): typeof f6; (a: typeof f6): () => number; }'. tests/cases/compiler/recursiveFunctionTypes.ts(42,1): error TS2554: Expected 0-1 arguments, but got 2. @@ -63,7 +63,8 @@ tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2345: Argument of function f6(): typeof f6; function f6(a: typeof f6): () => number; ~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/recursiveFunctionTypes.ts:31:10: The implementation signature is declared here. function f6(a?: any) { return f6; } f6("", 3); // error (arity mismatch) diff --git a/tests/baselines/reference/recursiveTypeComparison.errors.txt b/tests/baselines/reference/recursiveTypeComparison.errors.txt new file mode 100644 index 0000000000000..f647763b2e275 --- /dev/null +++ b/tests/baselines/reference/recursiveTypeComparison.errors.txt @@ -0,0 +1,27 @@ +tests/cases/compiler/recursiveTypeComparison.ts(14,5): error TS2322: Type 'Observable<{}>' is not assignable to type 'Property'. + Types of property 'needThisOne' are incompatible. + Type 'Observable<{}>' is not assignable to type 'Observable'. + Type '{}' is not assignable to type 'number'. + + +==== tests/cases/compiler/recursiveTypeComparison.ts (1 errors) ==== + // Before fix this would take an exceeding long time to complete (#1170) + + interface Observable { + // This member can't be of type T, Property, or Observable + needThisOne: Observable; + // Add more to make it slower + expo1: Property; // 0.31 seconds in check + expo2: Property; // 3.11 seconds + expo3: Property; // 82.28 seconds + } + interface Property extends Observable { } + + var p: Observable<{}>; + var stuck: Property = p; + ~~~~~ +!!! error TS2322: Type 'Observable<{}>' is not assignable to type 'Property'. +!!! error TS2322: Types of property 'needThisOne' are incompatible. +!!! error TS2322: Type 'Observable<{}>' is not assignable to type 'Observable'. +!!! error TS2322: Type '{}' is not assignable to type 'number'. + \ No newline at end of file diff --git a/tests/baselines/reference/restTupleElements1.types b/tests/baselines/reference/restTupleElements1.types index 9a8b3aaeb7ef1..ffa20bf503ede 100644 --- a/tests/baselines/reference/restTupleElements1.types +++ b/tests/baselines/reference/restTupleElements1.types @@ -173,7 +173,7 @@ f0([]); // Error >[] : never[] f0([1]); ->f0([1]) : [number, {}] +>f0([1]) : [number, number] >f0 : (x: [T, ...U[]]) => [T, U] >[1] : [number] >1 : 1 diff --git a/tests/baselines/reference/restTuplesFromContextualTypes.errors.txt b/tests/baselines/reference/restTuplesFromContextualTypes.errors.txt index d2246fbfd8409..2b94b57f462b6 100644 --- a/tests/baselines/reference/restTuplesFromContextualTypes.errors.txt +++ b/tests/baselines/reference/restTuplesFromContextualTypes.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts(56,7): error TS2345: Argument of type '(a: number, b: any, ...x: any[]) => void' is not assignable to parameter of type '(x: number, ...args: T) => void'. +tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts(56,7): error TS2345: Argument of type '(a: number, b: T[0], ...x: T[number][]) => void' is not assignable to parameter of type '(x: number, ...args: T) => void'. Types of parameters 'b' and 'args' are incompatible. - Type 'T' is not assignable to type '[any, ...any[]]'. - Property '0' is missing in type 'any[]' but required in type '[any, ...any[]]'. + Type 'T' is not assignable to type '[T[0], ...T[number][]]'. + Property '0' is missing in type 'any[]' but required in type '[T[0], ...T[number][]]'. ==== tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts (1 errors) ==== @@ -62,10 +62,10 @@ tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts(56,7): error f((a, ...x) => {}); f((a, b, ...x) => {}); ~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(a: number, b: any, ...x: any[]) => void' is not assignable to parameter of type '(x: number, ...args: T) => void'. +!!! error TS2345: Argument of type '(a: number, b: T[0], ...x: T[number][]) => void' is not assignable to parameter of type '(x: number, ...args: T) => void'. !!! error TS2345: Types of parameters 'b' and 'args' are incompatible. -!!! error TS2345: Type 'T' is not assignable to type '[any, ...any[]]'. -!!! error TS2345: Property '0' is missing in type 'any[]' but required in type '[any, ...any[]]'. +!!! error TS2345: Type 'T' is not assignable to type '[T[0], ...T[number][]]'. +!!! error TS2345: Property '0' is missing in type 'any[]' but required in type '[T[0], ...T[number][]]'. } // Repro from #25288 @@ -79,4 +79,18 @@ tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts(56,7): error (function foo(...rest){}(1, '')); take(function(...rest){}); + + // Repro from #29833 + + type ArgsUnion = [number, string] | [number, Error]; + type TupleUnionFunc = (...params: ArgsUnion) => number; + + const funcUnionTupleNoRest: TupleUnionFunc = (num, strOrErr) => { + return num; + }; + + const funcUnionTupleRest: TupleUnionFunc = (...params) => { + const [num, strOrErr] = params; + return num; + }; \ No newline at end of file diff --git a/tests/baselines/reference/restTuplesFromContextualTypes.js b/tests/baselines/reference/restTuplesFromContextualTypes.js index 3db6c53f384fd..34e75fcea6e30 100644 --- a/tests/baselines/reference/restTuplesFromContextualTypes.js +++ b/tests/baselines/reference/restTuplesFromContextualTypes.js @@ -68,6 +68,20 @@ declare function take(cb: (a: number, b: string) => void): void; (function foo(...rest){}(1, '')); take(function(...rest){}); + +// Repro from #29833 + +type ArgsUnion = [number, string] | [number, Error]; +type TupleUnionFunc = (...params: ArgsUnion) => number; + +const funcUnionTupleNoRest: TupleUnionFunc = (num, strOrErr) => { + return num; +}; + +const funcUnionTupleRest: TupleUnionFunc = (...params) => { + const [num, strOrErr] = params; + return num; +}; //// [restTuplesFromContextualTypes.js] @@ -274,6 +288,17 @@ take(function () { rest[_i] = arguments[_i]; } }); +var funcUnionTupleNoRest = function (num, strOrErr) { + return num; +}; +var funcUnionTupleRest = function () { + var params = []; + for (var _i = 0; _i < arguments.length; _i++) { + params[_i] = arguments[_i]; + } + var num = params[0], strOrErr = params[1]; + return num; +}; //// [restTuplesFromContextualTypes.d.ts] @@ -286,3 +311,7 @@ declare function f3(cb: (x: number, ...args: typeof t3) => void): void; declare function f4(t: T): void; declare var tuple: [number, string]; declare function take(cb: (a: number, b: string) => void): void; +declare type ArgsUnion = [number, string] | [number, Error]; +declare type TupleUnionFunc = (...params: ArgsUnion) => number; +declare const funcUnionTupleNoRest: TupleUnionFunc; +declare const funcUnionTupleRest: TupleUnionFunc; diff --git a/tests/baselines/reference/restTuplesFromContextualTypes.symbols b/tests/baselines/reference/restTuplesFromContextualTypes.symbols index d9b2310b5e27c..c58e8cabcae7d 100644 --- a/tests/baselines/reference/restTuplesFromContextualTypes.symbols +++ b/tests/baselines/reference/restTuplesFromContextualTypes.symbols @@ -265,3 +265,40 @@ take(function(...rest){}); >take : Symbol(take, Decl(restTuplesFromContextualTypes.ts, 61, 33)) >rest : Symbol(rest, Decl(restTuplesFromContextualTypes.ts, 68, 14)) +// Repro from #29833 + +type ArgsUnion = [number, string] | [number, Error]; +>ArgsUnion : Symbol(ArgsUnion, Decl(restTuplesFromContextualTypes.ts, 68, 26)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +type TupleUnionFunc = (...params: ArgsUnion) => number; +>TupleUnionFunc : Symbol(TupleUnionFunc, Decl(restTuplesFromContextualTypes.ts, 72, 52)) +>params : Symbol(params, Decl(restTuplesFromContextualTypes.ts, 73, 23)) +>ArgsUnion : Symbol(ArgsUnion, Decl(restTuplesFromContextualTypes.ts, 68, 26)) + +const funcUnionTupleNoRest: TupleUnionFunc = (num, strOrErr) => { +>funcUnionTupleNoRest : Symbol(funcUnionTupleNoRest, Decl(restTuplesFromContextualTypes.ts, 75, 5)) +>TupleUnionFunc : Symbol(TupleUnionFunc, Decl(restTuplesFromContextualTypes.ts, 72, 52)) +>num : Symbol(num, Decl(restTuplesFromContextualTypes.ts, 75, 46)) +>strOrErr : Symbol(strOrErr, Decl(restTuplesFromContextualTypes.ts, 75, 50)) + + return num; +>num : Symbol(num, Decl(restTuplesFromContextualTypes.ts, 75, 46)) + +}; + +const funcUnionTupleRest: TupleUnionFunc = (...params) => { +>funcUnionTupleRest : Symbol(funcUnionTupleRest, Decl(restTuplesFromContextualTypes.ts, 79, 5)) +>TupleUnionFunc : Symbol(TupleUnionFunc, Decl(restTuplesFromContextualTypes.ts, 72, 52)) +>params : Symbol(params, Decl(restTuplesFromContextualTypes.ts, 79, 44)) + + const [num, strOrErr] = params; +>num : Symbol(num, Decl(restTuplesFromContextualTypes.ts, 80, 9)) +>strOrErr : Symbol(strOrErr, Decl(restTuplesFromContextualTypes.ts, 80, 13)) +>params : Symbol(params, Decl(restTuplesFromContextualTypes.ts, 79, 44)) + + return num; +>num : Symbol(num, Decl(restTuplesFromContextualTypes.ts, 80, 9)) + +}; + diff --git a/tests/baselines/reference/restTuplesFromContextualTypes.types b/tests/baselines/reference/restTuplesFromContextualTypes.types index ee63057b9ebb2..c282dbbae311e 100644 --- a/tests/baselines/reference/restTuplesFromContextualTypes.types +++ b/tests/baselines/reference/restTuplesFromContextualTypes.types @@ -332,8 +332,8 @@ function f4(t: T) { f((...x) => {}); >f((...x) => {}) : void >f : (cb: (x: number, ...args: T) => void) => void ->(...x) => {} : (x: number, ...args: any[]) => void ->x : [number, ...any[]] +>(...x) => {} : (x: number, ...args: T[number][]) => void +>x : [number, ...T[number][]] f((a, ...x) => {}); >f((a, ...x) => {}) : void @@ -345,10 +345,10 @@ function f4(t: T) { f((a, b, ...x) => {}); >f((a, b, ...x) => {}) : void >f : (cb: (x: number, ...args: T) => void) => void ->(a, b, ...x) => {} : (a: number, b: any, ...x: any[]) => void +>(a, b, ...x) => {} : (a: number, b: T[0], ...x: T[number][]) => void >a : number ->b : any ->x : any[] +>b : T[0] +>x : T[number][] } // Repro from #25288 @@ -389,3 +389,38 @@ take(function(...rest){}); >function(...rest){} : (a: number, b: string) => void >rest : [number, string] +// Repro from #29833 + +type ArgsUnion = [number, string] | [number, Error]; +>ArgsUnion : ArgsUnion + +type TupleUnionFunc = (...params: ArgsUnion) => number; +>TupleUnionFunc : TupleUnionFunc +>params : ArgsUnion + +const funcUnionTupleNoRest: TupleUnionFunc = (num, strOrErr) => { +>funcUnionTupleNoRest : TupleUnionFunc +>(num, strOrErr) => { return num;} : (num: number, strOrErr: string | Error) => number +>num : number +>strOrErr : string | Error + + return num; +>num : number + +}; + +const funcUnionTupleRest: TupleUnionFunc = (...params) => { +>funcUnionTupleRest : TupleUnionFunc +>(...params) => { const [num, strOrErr] = params; return num;} : (...params: ArgsUnion) => number +>params : ArgsUnion + + const [num, strOrErr] = params; +>num : number +>strOrErr : string | Error +>params : ArgsUnion + + return num; +>num : number + +}; + diff --git a/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt b/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt index 0e9454b9018d1..e6dd1aa26ee04 100644 --- a/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt +++ b/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt @@ -1,10 +1,11 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(1,10): error TS2394: This overload signature is not compatible with its implementation signature. ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts (1 errors) ==== function foo(x: 'a'); ~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts:2:10: The implementation signature is declared here. function foo(x: number) { } class C { diff --git a/tests/baselines/reference/strictFunctionTypesErrors.errors.txt b/tests/baselines/reference/strictFunctionTypesErrors.errors.txt index 369919850f085..3ff04c44fb75b 100644 --- a/tests/baselines/reference/strictFunctionTypesErrors.errors.txt +++ b/tests/baselines/reference/strictFunctionTypesErrors.errors.txt @@ -17,19 +17,15 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(21,1): error TS2322: Type '(x: tests/cases/compiler/strictFunctionTypesErrors.ts(23,1): error TS2322: Type '(x: string) => Object' is not assignable to type '(x: string) => string'. Type 'Object' is not assignable to type 'string'. tests/cases/compiler/strictFunctionTypesErrors.ts(33,1): error TS2322: Type 'Func' is not assignable to type 'Func'. - Types of parameters 'x' and 'x' are incompatible. - Type 'Object' is not assignable to type 'string'. + Type 'Object' is not assignable to type 'string'. tests/cases/compiler/strictFunctionTypesErrors.ts(34,1): error TS2322: Type 'Func' is not assignable to type 'Func'. - Types of parameters 'x' and 'x' are incompatible. - Type 'Object' is not assignable to type 'string'. + Type 'Object' is not assignable to type 'string'. tests/cases/compiler/strictFunctionTypesErrors.ts(36,1): error TS2322: Type 'Func' is not assignable to type 'Func'. Type 'Object' is not assignable to type 'string'. tests/cases/compiler/strictFunctionTypesErrors.ts(37,1): error TS2322: Type 'Func' is not assignable to type 'Func'. - Types of parameters 'x' and 'x' are incompatible. - Type 'Object' is not assignable to type 'string'. + Type 'Object' is not assignable to type 'string'. tests/cases/compiler/strictFunctionTypesErrors.ts(38,1): error TS2322: Type 'Func' is not assignable to type 'Func'. - Types of parameters 'x' and 'x' are incompatible. - Type 'Object' is not assignable to type 'string'. + Type 'Object' is not assignable to type 'string'. tests/cases/compiler/strictFunctionTypesErrors.ts(44,1): error TS2322: Type 'Func' is not assignable to type 'Func'. Type 'Object' is not assignable to type 'string'. tests/cases/compiler/strictFunctionTypesErrors.ts(46,1): error TS2322: Type 'Func' is not assignable to type 'Func'. @@ -39,37 +35,26 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(57,1): error TS2322: Type 'Fun tests/cases/compiler/strictFunctionTypesErrors.ts(58,1): error TS2322: Type 'Func, Object>' is not assignable to type 'Func, string>'. Type 'Object' is not assignable to type 'string'. tests/cases/compiler/strictFunctionTypesErrors.ts(61,1): error TS2322: Type 'Func, Object>' is not assignable to type 'Func, Object>'. - Types of parameters 'x' and 'x' are incompatible. - Types of parameters 'x' and 'x' are incompatible. - Type 'Object' is not assignable to type 'string'. + Type 'Func' is not assignable to type 'Func'. + Type 'Object' is not assignable to type 'string'. tests/cases/compiler/strictFunctionTypesErrors.ts(62,1): error TS2322: Type 'Func, string>' is not assignable to type 'Func, Object>'. - Types of parameters 'x' and 'x' are incompatible. - Types of parameters 'x' and 'x' are incompatible. - Type 'Object' is not assignable to type 'string'. + Type 'Func' is not assignable to type 'Func'. tests/cases/compiler/strictFunctionTypesErrors.ts(65,1): error TS2322: Type 'Func, Object>' is not assignable to type 'Func, string>'. - Types of parameters 'x' and 'x' are incompatible. - Types of parameters 'x' and 'x' are incompatible. - Type 'Object' is not assignable to type 'string'. + Type 'Func' is not assignable to type 'Func'. tests/cases/compiler/strictFunctionTypesErrors.ts(66,1): error TS2322: Type 'Func, string>' is not assignable to type 'Func, string>'. - Types of parameters 'x' and 'x' are incompatible. - Types of parameters 'x' and 'x' are incompatible. - Type 'Object' is not assignable to type 'string'. + Type 'Func' is not assignable to type 'Func'. tests/cases/compiler/strictFunctionTypesErrors.ts(67,1): error TS2322: Type 'Func, Object>' is not assignable to type 'Func, string>'. Type 'Object' is not assignable to type 'string'. tests/cases/compiler/strictFunctionTypesErrors.ts(74,1): error TS2322: Type 'Func>' is not assignable to type 'Func>'. Type 'Func' is not assignable to type 'Func'. tests/cases/compiler/strictFunctionTypesErrors.ts(75,1): error TS2322: Type 'Func>' is not assignable to type 'Func>'. - Types of parameters 'x' and 'x' are incompatible. - Type 'Object' is not assignable to type 'string'. + Type 'Object' is not assignable to type 'string'. tests/cases/compiler/strictFunctionTypesErrors.ts(76,1): error TS2322: Type 'Func>' is not assignable to type 'Func>'. - Types of parameters 'x' and 'x' are incompatible. - Type 'Object' is not assignable to type 'string'. + Type 'Object' is not assignable to type 'string'. tests/cases/compiler/strictFunctionTypesErrors.ts(79,1): error TS2322: Type 'Func>' is not assignable to type 'Func>'. - Types of parameters 'x' and 'x' are incompatible. - Type 'Object' is not assignable to type 'string'. + Type 'Object' is not assignable to type 'string'. tests/cases/compiler/strictFunctionTypesErrors.ts(80,1): error TS2322: Type 'Func>' is not assignable to type 'Func>'. - Types of parameters 'x' and 'x' are incompatible. - Type 'Object' is not assignable to type 'string'. + Type 'Object' is not assignable to type 'string'. tests/cases/compiler/strictFunctionTypesErrors.ts(83,1): error TS2322: Type 'Func>' is not assignable to type 'Func>'. Type 'Func' is not assignable to type 'Func'. tests/cases/compiler/strictFunctionTypesErrors.ts(84,1): error TS2322: Type 'Func>' is not assignable to type 'Func>'. @@ -162,13 +147,11 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(155,5): error TS2322: Type '(c g1 = g3; // Error ~~ !!! error TS2322: Type 'Func' is not assignable to type 'Func'. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'Object' is not assignable to type 'string'. +!!! error TS2322: Type 'Object' is not assignable to type 'string'. g1 = g4; // Error ~~ !!! error TS2322: Type 'Func' is not assignable to type 'Func'. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'Object' is not assignable to type 'string'. +!!! error TS2322: Type 'Object' is not assignable to type 'string'. g2 = g1; // Error ~~ @@ -177,13 +160,11 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(155,5): error TS2322: Type '(c g2 = g3; // Error ~~ !!! error TS2322: Type 'Func' is not assignable to type 'Func'. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'Object' is not assignable to type 'string'. +!!! error TS2322: Type 'Object' is not assignable to type 'string'. g2 = g4; // Error ~~ !!! error TS2322: Type 'Func' is not assignable to type 'Func'. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'Object' is not assignable to type 'string'. +!!! error TS2322: Type 'Object' is not assignable to type 'string'. g3 = g1; // Ok g3 = g2; // Ok @@ -221,29 +202,22 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(155,5): error TS2322: Type '(c h3 = h1; // Error ~~ !!! error TS2322: Type 'Func, Object>' is not assignable to type 'Func, Object>'. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'Object' is not assignable to type 'string'. +!!! error TS2322: Type 'Func' is not assignable to type 'Func'. +!!! error TS2322: Type 'Object' is not assignable to type 'string'. h3 = h2; // Error ~~ !!! error TS2322: Type 'Func, string>' is not assignable to type 'Func, Object>'. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'Object' is not assignable to type 'string'. +!!! error TS2322: Type 'Func' is not assignable to type 'Func'. h3 = h4; // Ok h4 = h1; // Error ~~ !!! error TS2322: Type 'Func, Object>' is not assignable to type 'Func, string>'. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'Object' is not assignable to type 'string'. +!!! error TS2322: Type 'Func' is not assignable to type 'Func'. h4 = h2; // Error ~~ !!! error TS2322: Type 'Func, string>' is not assignable to type 'Func, string>'. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'Object' is not assignable to type 'string'. +!!! error TS2322: Type 'Func' is not assignable to type 'Func'. h4 = h3; // Error ~~ !!! error TS2322: Type 'Func, Object>' is not assignable to type 'Func, string>'. @@ -261,25 +235,21 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(155,5): error TS2322: Type '(c i1 = i3; // Error ~~ !!! error TS2322: Type 'Func>' is not assignable to type 'Func>'. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'Object' is not assignable to type 'string'. +!!! error TS2322: Type 'Object' is not assignable to type 'string'. i1 = i4; // Error ~~ !!! error TS2322: Type 'Func>' is not assignable to type 'Func>'. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'Object' is not assignable to type 'string'. +!!! error TS2322: Type 'Object' is not assignable to type 'string'. i2 = i1; // Ok i2 = i3; // Error ~~ !!! error TS2322: Type 'Func>' is not assignable to type 'Func>'. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'Object' is not assignable to type 'string'. +!!! error TS2322: Type 'Object' is not assignable to type 'string'. i2 = i4; // Error ~~ !!! error TS2322: Type 'Func>' is not assignable to type 'Func>'. -!!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'Object' is not assignable to type 'string'. +!!! error TS2322: Type 'Object' is not assignable to type 'string'. i3 = i1; // Ok i3 = i2; // Error diff --git a/tests/baselines/reference/stringLiteralTypesOverloads05.errors.txt b/tests/baselines/reference/stringLiteralTypesOverloads05.errors.txt index 027feb7cc31a6..4353264b64983 100644 --- a/tests/baselines/reference/stringLiteralTypesOverloads05.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesOverloads05.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads05.ts(6,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads05.ts(6,10): error TS2394: This overload signature is not compatible with its implementation signature. ==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads05.ts (1 errors) ==== @@ -9,7 +9,8 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads05.ts(6,1 function doThing(x: "dog"): Dog; ~~~~~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads05.ts:9:10: The implementation signature is declared here. function doThing(x: "cat"): Cat; function doThing(x: string): Animal; function doThing(x: string, y?: string): Moose { diff --git a/tests/baselines/reference/templateStringInFunctionParameterType.errors.txt b/tests/baselines/reference/templateStringInFunctionParameterType.errors.txt index e523b4c2dcb9d..256d9dc1e9105 100644 --- a/tests/baselines/reference/templateStringInFunctionParameterType.errors.txt +++ b/tests/baselines/reference/templateStringInFunctionParameterType.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration. -tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts(1,10): error TS2394: This overload signature is not compatible with its implementation signature. tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts(1,12): error TS1138: Parameter declaration expected. tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts(1,19): error TS1005: ';' expected. @@ -9,7 +9,8 @@ tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts(1 ~ !!! error TS2391: Function implementation is missing or not immediately following the declaration. ~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts:3:10: The implementation signature is declared here. ~~~~~~~ !!! error TS1138: Parameter declaration expected. ~ diff --git a/tests/baselines/reference/templateStringInFunctionParameterTypeES6.errors.txt b/tests/baselines/reference/templateStringInFunctionParameterTypeES6.errors.txt index be9c3556caf1c..feb068d49578a 100644 --- a/tests/baselines/reference/templateStringInFunctionParameterTypeES6.errors.txt +++ b/tests/baselines/reference/templateStringInFunctionParameterTypeES6.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration. -tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts(1,10): error TS2394: This overload signature is not compatible with its implementation signature. tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts(1,12): error TS1138: Parameter declaration expected. tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts(1,19): error TS1005: ';' expected. @@ -9,7 +9,8 @@ tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.t ~ !!! error TS2391: Function implementation is missing or not immediately following the declaration. ~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts:3:10: The implementation signature is declared here. ~~~~~~~ !!! error TS1138: Parameter declaration expected. ~ diff --git a/tests/baselines/reference/typeAssertions.errors.txt b/tests/baselines/reference/typeAssertions.errors.txt index 27de59a76453f..ef9a23b8d8ae4 100644 --- a/tests/baselines/reference/typeAssertions.errors.txt +++ b/tests/baselines/reference/typeAssertions.errors.txt @@ -7,7 +7,7 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(37,13): err Property 'q' is missing in type 'SomeDerived' but required in type 'SomeOther'. tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(38,13): error TS2352: Conversion of type 'SomeBase' to type 'SomeOther' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. Property 'q' is missing in type 'SomeBase' but required in type 'SomeOther'. -tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,5): error TS2304: Cannot find name 'numOrStr'. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,5): error TS2749: 'numOrStr' refers to a value, but is being used as a type here. 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. @@ -15,7 +15,7 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,17): err tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,48): error TS1005: ';' expected. tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(45,2): error TS2322: Type 'string | number' 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,32): error TS2749: 'numOrStr' refers to a value, but is being used as a type here. 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. @@ -86,7 +86,7 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,50): err var str: string; if((numOrStr === undefined)) { // Error ~~~~~~~~ -!!! error TS2304: Cannot find name 'numOrStr'. +!!! error TS2749: 'numOrStr' refers to a value, but is being used as a type here. ~~ !!! error TS1005: '>' expected. ~~ @@ -105,7 +105,7 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,50): err if((numOrStr === undefined) as numOrStr is string) { // Error ~~~~~~~~ -!!! error TS2304: Cannot find name 'numOrStr'. +!!! error TS2749: 'numOrStr' refers to a value, but is being used as a type here. ~~ !!! error TS1005: ')' expected. ~~ diff --git a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt index a6ea9961c54f5..6f24585a85f2b 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt +++ b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt @@ -1,10 +1,10 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(1,7): error TS2300: Duplicate identifier 'A'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(14,5): error TS2322: Type '""' is not assignable to type 'boolean'. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(17,55): error TS2304: Cannot find name 'x'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(17,55): error TS2749: 'x' refers to a value, but is being used as a type here. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(17,57): error TS1144: '{' or ';' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(17,60): error TS1005: ';' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(17,62): error TS1005: ';' expected. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(21,33): error TS2304: Cannot find name 'x'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(21,33): error TS2749: 'x' refers to a value, but is being used as a type here. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(25,33): error TS1225: Cannot find parameter 'x'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(29,10): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(30,5): error TS1131: Property or signature expected. @@ -28,14 +28,14 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(84,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(90,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(95,9): error TS2304: Cannot find name 'b'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(95,9): error TS2749: 'b' refers to a value, but is being used as a type here. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(95,11): error TS1005: ',' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(95,14): error TS1005: ',' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(95,14): error TS2300: Duplicate identifier 'A'. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(96,16): error TS2304: Cannot find name 'b'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(96,16): error TS2749: 'b' refers to a value, but is being used as a type here. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(96,18): error TS1005: ',' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(96,21): error TS1005: ',' expected. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,20): error TS2304: Cannot find name 'b'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,20): error TS2749: 'b' refers to a value, but is being used as a type here. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,22): error TS1144: '{' or ';' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,25): error TS1005: ';' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,27): error TS1005: ';' expected. @@ -91,7 +91,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(166,54 function hasTypeGuardTypeInsideTypeGuardType(x): x is x is A { ~ -!!! error TS2304: Cannot find name 'x'. +!!! error TS2749: 'x' refers to a value, but is being used as a type here. ~~ !!! error TS1144: '{' or ';' expected. ~ @@ -103,7 +103,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(166,54 function hasMissingIsKeyword(): x { ~ -!!! error TS2304: Cannot find name 'x'. +!!! error TS2749: 'x' refers to a value, but is being used as a type here. return true; } @@ -222,7 +222,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(166,54 // Type predicates in non-return type positions var b1: b is A; ~ -!!! error TS2304: Cannot find name 'b'. +!!! error TS2749: 'b' refers to a value, but is being used as a type here. ~~ !!! error TS1005: ',' expected. ~ @@ -231,14 +231,14 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(166,54 !!! error TS2300: Duplicate identifier 'A'. function b2(a: b is A) {}; ~ -!!! error TS2304: Cannot find name 'b'. +!!! error TS2749: 'b' refers to a value, but is being used as a type here. ~~ !!! error TS1005: ',' expected. ~ !!! error TS1005: ',' expected. function b3(): A | b is A { ~ -!!! error TS2304: Cannot find name 'b'. +!!! error TS2749: 'b' refers to a value, but is being used as a type here. ~~ !!! error TS1144: '{' or ';' expected. ~ diff --git a/tests/baselines/reference/unionAndIntersectionInference1.js b/tests/baselines/reference/unionAndIntersectionInference1.js index 235eb23ebf847..ca9e527d99ed2 100644 --- a/tests/baselines/reference/unionAndIntersectionInference1.js +++ b/tests/baselines/reference/unionAndIntersectionInference1.js @@ -71,6 +71,24 @@ declare var mbp: Man & Bear; pigify(mbp).oinks; // OK, mbp is treated as Pig pigify(mbp).walks; // Ok, mbp is treated as Man + +// Repros from #29815 + +interface ITest { + name: 'test' +} + +const createTestAsync = (): Promise => Promise.resolve().then(() => ({ name: 'test' })) + +const createTest = (): ITest => { + return { name: 'test' } +} + +declare function f1(x: T | U): T | U; +declare function f2(x: T & U): T & U; + +let x1: string = f1('a'); +let x2: string = f2('a'); //// [unionAndIntersectionInference1.js] @@ -80,7 +98,7 @@ function destructure(something, haveValue, haveY) { return something === y ? haveY(y) : haveValue(something); } var value = Math.random() > 0.5 ? 'hey!' : undefined; -var result = destructure(value, function (text) { return 'string'; }, function (y) { return 'other one'; }); // text: string, y: Y +var result = destructure(value, text => 'string', y => 'other one'); // text: string, y: Y // Repro from #4212 function isVoid(value) { return undefined; @@ -107,7 +125,13 @@ function baz1(value) { function get(x) { return null; // just an example } -var foo; +let foo; get(foo).toUpperCase(); // Ok pigify(mbp).oinks; // OK, mbp is treated as Pig pigify(mbp).walks; // Ok, mbp is treated as Man +const createTestAsync = () => Promise.resolve().then(() => ({ name: 'test' })); +const createTest = () => { + return { name: 'test' }; +}; +let x1 = f1('a'); +let x2 = f2('a'); diff --git a/tests/baselines/reference/unionAndIntersectionInference1.symbols b/tests/baselines/reference/unionAndIntersectionInference1.symbols index 38bcd416dff8f..e866f19daa423 100644 --- a/tests/baselines/reference/unionAndIntersectionInference1.symbols +++ b/tests/baselines/reference/unionAndIntersectionInference1.symbols @@ -50,7 +50,7 @@ function destructure( var value = Math.random() > 0.5 ? 'hey!' : undefined; >value : Symbol(value, Decl(unionAndIntersectionInference1.ts, 12, 3)) >Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) ->Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) >Y : Symbol(Y, Decl(unionAndIntersectionInference1.ts, 0, 0)) >undefined : Symbol(undefined) @@ -201,3 +201,59 @@ pigify(mbp).walks; // Ok, mbp is treated as Man >mbp : Symbol(mbp, Decl(unionAndIntersectionInference1.ts, 68, 11)) >walks : Symbol(Man.walks, Decl(unionAndIntersectionInference1.ts, 55, 15)) +// Repros from #29815 + +interface ITest { +>ITest : Symbol(ITest, Decl(unionAndIntersectionInference1.ts, 71, 18)) + + name: 'test' +>name : Symbol(ITest.name, Decl(unionAndIntersectionInference1.ts, 75, 17)) +} + +const createTestAsync = (): Promise => Promise.resolve().then(() => ({ name: 'test' })) +>createTestAsync : Symbol(createTestAsync, Decl(unionAndIntersectionInference1.ts, 79, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>ITest : Symbol(ITest, Decl(unionAndIntersectionInference1.ts, 71, 18)) +>Promise.resolve().then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>name : Symbol(name, Decl(unionAndIntersectionInference1.ts, 79, 77)) + +const createTest = (): ITest => { +>createTest : Symbol(createTest, Decl(unionAndIntersectionInference1.ts, 81, 5)) +>ITest : Symbol(ITest, Decl(unionAndIntersectionInference1.ts, 71, 18)) + + return { name: 'test' } +>name : Symbol(name, Decl(unionAndIntersectionInference1.ts, 82, 10)) +} + +declare function f1(x: T | U): T | U; +>f1 : Symbol(f1, Decl(unionAndIntersectionInference1.ts, 83, 1)) +>T : Symbol(T, Decl(unionAndIntersectionInference1.ts, 85, 20)) +>U : Symbol(U, Decl(unionAndIntersectionInference1.ts, 85, 22)) +>x : Symbol(x, Decl(unionAndIntersectionInference1.ts, 85, 26)) +>T : Symbol(T, Decl(unionAndIntersectionInference1.ts, 85, 20)) +>U : Symbol(U, Decl(unionAndIntersectionInference1.ts, 85, 22)) +>T : Symbol(T, Decl(unionAndIntersectionInference1.ts, 85, 20)) +>U : Symbol(U, Decl(unionAndIntersectionInference1.ts, 85, 22)) + +declare function f2(x: T & U): T & U; +>f2 : Symbol(f2, Decl(unionAndIntersectionInference1.ts, 85, 43)) +>T : Symbol(T, Decl(unionAndIntersectionInference1.ts, 86, 20)) +>U : Symbol(U, Decl(unionAndIntersectionInference1.ts, 86, 22)) +>x : Symbol(x, Decl(unionAndIntersectionInference1.ts, 86, 26)) +>T : Symbol(T, Decl(unionAndIntersectionInference1.ts, 86, 20)) +>U : Symbol(U, Decl(unionAndIntersectionInference1.ts, 86, 22)) +>T : Symbol(T, Decl(unionAndIntersectionInference1.ts, 86, 20)) +>U : Symbol(U, Decl(unionAndIntersectionInference1.ts, 86, 22)) + +let x1: string = f1('a'); +>x1 : Symbol(x1, Decl(unionAndIntersectionInference1.ts, 88, 3)) +>f1 : Symbol(f1, Decl(unionAndIntersectionInference1.ts, 83, 1)) + +let x2: string = f2('a'); +>x2 : Symbol(x2, Decl(unionAndIntersectionInference1.ts, 89, 3)) +>f2 : Symbol(f2, Decl(unionAndIntersectionInference1.ts, 85, 43)) + diff --git a/tests/baselines/reference/unionAndIntersectionInference1.types b/tests/baselines/reference/unionAndIntersectionInference1.types index 7b2515c6b581f..4dddcb8bd0f32 100644 --- a/tests/baselines/reference/unionAndIntersectionInference1.types +++ b/tests/baselines/reference/unionAndIntersectionInference1.types @@ -179,3 +179,56 @@ pigify(mbp).walks; // Ok, mbp is treated as Man >mbp : Man & Bear >walks : boolean +// Repros from #29815 + +interface ITest { + name: 'test' +>name : "test" +} + +const createTestAsync = (): Promise => Promise.resolve().then(() => ({ name: 'test' })) +>createTestAsync : () => Promise +>(): Promise => Promise.resolve().then(() => ({ name: 'test' })) : () => Promise +>Promise.resolve().then(() => ({ name: 'test' })) : Promise +>Promise.resolve().then : (onfulfilled?: (value: void) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>Promise.resolve() : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>then : (onfulfilled?: (value: void) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => ({ name: 'test' }) : () => { name: "test"; } +>({ name: 'test' }) : { name: "test"; } +>{ name: 'test' } : { name: "test"; } +>name : "test" +>'test' : "test" + +const createTest = (): ITest => { +>createTest : () => ITest +>(): ITest => { return { name: 'test' }} : () => ITest + + return { name: 'test' } +>{ name: 'test' } : { name: "test"; } +>name : "test" +>'test' : "test" +} + +declare function f1(x: T | U): T | U; +>f1 : (x: T | U) => T | U +>x : T | U + +declare function f2(x: T & U): T & U; +>f2 : (x: T & U) => T & U +>x : T & U + +let x1: string = f1('a'); +>x1 : string +>f1('a') : "a" +>f1 : (x: T | U) => T | U +>'a' : "a" + +let x2: string = f2('a'); +>x2 : string +>f2('a') : "a" +>f2 : (x: T & U) => T & U +>'a' : "a" + diff --git a/tests/baselines/reference/unionTypeErrorMessageTypeRefs01.errors.txt b/tests/baselines/reference/unionTypeErrorMessageTypeRefs01.errors.txt index 5fdeab58610af..ab661b6fee7c8 100644 --- a/tests/baselines/reference/unionTypeErrorMessageTypeRefs01.errors.txt +++ b/tests/baselines/reference/unionTypeErrorMessageTypeRefs01.errors.txt @@ -9,16 +9,13 @@ tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts(27,1): error TS2322: Typ Property 'kwah' is missing in type 'Foo' but required in type 'Kwah'. tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts(48,1): error TS2322: Type 'X' is not assignable to type 'X | Y | Z'. Type 'X' is not assignable to type 'X'. - Types of property 'xProp' are incompatible. - Type 'Foo' is not assignable to type 'Bar'. + Type 'Foo' is not assignable to type 'Bar'. tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts(49,1): error TS2322: Type 'Y' is not assignable to type 'X | Y | Z'. Type 'Y' is not assignable to type 'Y'. - Types of property 'yProp' are incompatible. - Type 'Foo' is not assignable to type 'Baz'. + Type 'Foo' is not assignable to type 'Baz'. tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts(50,1): error TS2322: Type 'Z' is not assignable to type 'X | Y | Z'. Type 'Z' is not assignable to type 'Z'. - Types of property 'zProp' are incompatible. - Type 'Foo' is not assignable to type 'Kwah'. + Type 'Foo' is not assignable to type 'Kwah'. ==== tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts (6 errors) ==== @@ -88,17 +85,14 @@ tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts(50,1): error TS2322: Typ ~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'X' is not assignable to type 'X | Y | Z'. !!! error TS2322: Type 'X' is not assignable to type 'X'. -!!! error TS2322: Types of property 'xProp' are incompatible. -!!! error TS2322: Type 'Foo' is not assignable to type 'Bar'. +!!! error TS2322: Type 'Foo' is not assignable to type 'Bar'. thingOfTypeAliases = y; ~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'Y' is not assignable to type 'X | Y | Z'. !!! error TS2322: Type 'Y' is not assignable to type 'Y'. -!!! error TS2322: Types of property 'yProp' are incompatible. -!!! error TS2322: Type 'Foo' is not assignable to type 'Baz'. +!!! error TS2322: Type 'Foo' is not assignable to type 'Baz'. thingOfTypeAliases = z; ~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'Z' is not assignable to type 'X | Y | Z'. !!! error TS2322: Type 'Z' is not assignable to type 'Z'. -!!! error TS2322: Types of property 'zProp' are incompatible. -!!! error TS2322: Type 'Foo' is not assignable to type 'Kwah'. \ No newline at end of file +!!! error TS2322: Type 'Foo' is not assignable to type 'Kwah'. \ No newline at end of file diff --git a/tests/baselines/reference/user/async.log b/tests/baselines/reference/user/async.log index 1477ce5faa65e..10f2d38ca6c93 100644 --- a/tests/baselines/reference/user/async.log +++ b/tests/baselines/reference/user/async.log @@ -51,7 +51,7 @@ node_modules/async/autoInject.js(160,28): error TS2695: Left side of comma opera node_modules/async/autoInject.js(164,14): error TS2695: Left side of comma operator is unused and has no side effects. node_modules/async/autoInject.js(168,6): error TS2695: Left side of comma operator is unused and has no side effects. node_modules/async/cargo.js(62,12): error TS2304: Cannot find name 'AsyncFunction'. -node_modules/async/cargo.js(67,14): error TS2591: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig. +node_modules/async/cargo.js(67,14): error TS2749: 'module' refers to a value, but is being used as a type here. node_modules/async/cargo.js(67,20): error TS1005: '}' expected. node_modules/async/cargo.js(92,11): error TS2695: Left side of comma operator is unused and has no side effects. node_modules/async/compose.js(8,37): error TS2695: Left side of comma operator is unused and has no side effects. diff --git a/tests/baselines/reference/user/chrome-devtools-frontend.log b/tests/baselines/reference/user/chrome-devtools-frontend.log index 7ae2531d38396..5d98e163938c3 100644 --- a/tests/baselines/reference/user/chrome-devtools-frontend.log +++ b/tests/baselines/reference/user/chrome-devtools-frontend.log @@ -1,16 +1,16 @@ Exit Code: 1 Standard output: -../../../../built/local/lib.dom.d.ts(2388,11): error TS2300: Duplicate identifier 'CSSRule'. -../../../../built/local/lib.dom.d.ts(2407,13): error TS2300: Duplicate identifier 'CSSRule'. -../../../../built/local/lib.dom.d.ts(3267,11): error TS2300: Duplicate identifier 'Comment'. -../../../../built/local/lib.dom.d.ts(3270,13): error TS2300: Duplicate identifier 'Comment'. -../../../../built/local/lib.dom.d.ts(4963,11): error TS2300: Duplicate identifier 'Event'. -../../../../built/local/lib.dom.d.ts(5023,13): error TS2300: Duplicate identifier 'Event'. -../../../../built/local/lib.dom.d.ts(11214,11): error TS2300: Duplicate identifier 'Position'. -../../../../built/local/lib.dom.d.ts(11959,11): error TS2300: Duplicate identifier 'Request'. -../../../../built/local/lib.dom.d.ts(12039,13): error TS2300: Duplicate identifier 'Request'. -../../../../built/local/lib.dom.d.ts(16513,11): error TS2300: Duplicate identifier 'Window'. -../../../../built/local/lib.dom.d.ts(16644,13): error TS2300: Duplicate identifier 'Window'. +../../../../built/local/lib.dom.d.ts(2439,11): error TS2300: Duplicate identifier 'CSSRule'. +../../../../built/local/lib.dom.d.ts(2458,13): error TS2300: Duplicate identifier 'CSSRule'. +../../../../built/local/lib.dom.d.ts(3339,11): error TS2300: Duplicate identifier 'Comment'. +../../../../built/local/lib.dom.d.ts(3342,13): error TS2300: Duplicate identifier 'Comment'. +../../../../built/local/lib.dom.d.ts(5032,11): error TS2300: Duplicate identifier 'Event'. +../../../../built/local/lib.dom.d.ts(5092,13): error TS2300: Duplicate identifier 'Event'. +../../../../built/local/lib.dom.d.ts(11453,11): error TS2300: Duplicate identifier 'Position'. +../../../../built/local/lib.dom.d.ts(12214,11): error TS2300: Duplicate identifier 'Request'. +../../../../built/local/lib.dom.d.ts(12294,13): error TS2300: Duplicate identifier 'Request'. +../../../../built/local/lib.dom.d.ts(16941,11): error TS2300: Duplicate identifier 'Window'. +../../../../built/local/lib.dom.d.ts(17073,13): error TS2300: Duplicate identifier 'Window'. ../../../../built/local/lib.es5.d.ts(1416,11): error TS2300: Duplicate identifier 'ArrayLike'. ../../../../built/local/lib.es5.d.ts(1452,6): error TS2300: Duplicate identifier 'Record'. ../../../../node_modules/@types/node/index.d.ts(150,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'module' must be of type '{}', but here has type 'NodeModule'. @@ -19,12 +19,7 @@ node_modules/chrome-devtools-frontend/front_end/Runtime.js(77,16): error TS7014: node_modules/chrome-devtools-frontend/front_end/Runtime.js(78,16): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. node_modules/chrome-devtools-frontend/front_end/Runtime.js(95,28): error TS2339: Property 'response' does not exist on type 'EventTarget'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(147,37): error TS2339: Property '_importScriptPathPrefix' does not exist on type 'Window'. -node_modules/chrome-devtools-frontend/front_end/Runtime.js(158,21): error TS2345: Argument of type 'Promise' is not assignable to parameter of type 'Promise'. - Type 'string' is not assignable to type 'undefined'. -node_modules/chrome-devtools-frontend/front_end/Runtime.js(161,5): error TS2322: Type 'Promise' is not assignable to type 'Promise'. - Type 'undefined[]' is not assignable to type 'undefined'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(187,12): error TS2339: Property 'eval' does not exist on type 'Window'. -node_modules/chrome-devtools-frontend/front_end/Runtime.js(197,5): error TS2322: Type 'Promise' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(267,14): error TS2339: Property 'runtime' does not exist on type 'Window'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(269,59): error TS2339: Property 'runtime' does not exist on type 'Window'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(270,9): error TS2322: Type 'Promise' is not assignable to type 'Promise'. @@ -38,7 +33,6 @@ node_modules/chrome-devtools-frontend/front_end/Runtime.js(693,7): error TS2322: Type 'boolean' is not assignable to type 'undefined'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(705,5): error TS2322: Type 'Promise' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(715,7): error TS2322: Type 'Promise' is not assignable to type 'Promise'. -node_modules/chrome-devtools-frontend/front_end/Runtime.js(721,5): error TS2322: Type 'Promise' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(729,7): error TS2322: Type 'Promise' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(854,36): error TS2339: Property 'eval' does not exist on type 'Window'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(1083,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. @@ -158,7 +152,7 @@ node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane. node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.js(391,50): error TS2345: Argument of type '0' is not assignable to parameter of type 'string'. node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.js(393,50): error TS2345: Argument of type '-1' is not assignable to parameter of type 'string'. node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.js(396,27): error TS2339: Property 'focus' does not exist on type 'Element'. -node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.js(447,26): error TS2339: Property 'breadcrumb' does not exist on type 'Node'. +node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.js(447,26): error TS2339: Property 'breadcrumb' does not exist on type 'ChildNode'. node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.js(457,30): error TS2339: Property 'breadcrumb' does not exist on type 'Node'. node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.js(473,24): error TS2694: Namespace 'Protocol' has no exported member 'Accessibility'. node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.js(481,17): error TS2339: Property 'setTextContentTruncatedIfNeeded' does not exist on type 'Element'. @@ -282,7 +276,7 @@ node_modules/chrome-devtools-frontend/front_end/animation/AnimationModel.js(514, node_modules/chrome-devtools-frontend/front_end/animation/AnimationModel.js(553,11): error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'. node_modules/chrome-devtools-frontend/front_end/animation/AnimationModel.js(583,43): error TS2339: Property 'remove' does not exist on type 'Map'. node_modules/chrome-devtools-frontend/front_end/animation/AnimationModel.js(665,37): error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'. -node_modules/chrome-devtools-frontend/front_end/animation/AnimationModel.js(691,24): error TS2304: Cannot find name 'Image'. +node_modules/chrome-devtools-frontend/front_end/animation/AnimationModel.js(691,24): error TS2749: 'Image' refers to a value, but is being used as a type here. node_modules/chrome-devtools-frontend/front_end/animation/AnimationModel.js(708,11): error TS2339: Property 'AnimationDispatcher' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'. node_modules/chrome-devtools-frontend/front_end/animation/AnimationModel.js(731,24): error TS2694: Namespace 'Protocol' has no exported member 'Animation'. node_modules/chrome-devtools-frontend/front_end/animation/AnimationModel.js(741,11): error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'. @@ -293,7 +287,7 @@ node_modules/chrome-devtools-frontend/front_end/animation/AnimationModel.js(782, node_modules/chrome-devtools-frontend/front_end/animation/AnimationModel.js(811,11): error TS2339: Property 'AnimationModel' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'. node_modules/chrome-devtools-frontend/front_end/animation/AnimationModel.js(811,44): error TS2300: Duplicate identifier 'Request'. node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(7,11): error TS2339: Property 'AnimationScreenshotPopover' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'. -node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(9,23): error TS2304: Cannot find name 'Image'. +node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(9,23): error TS2749: 'Image' refers to a value, but is being used as a type here. node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(18,39): error TS2345: Argument of type 'new (width?: number, height?: number) => HTMLImageElement' is not assignable to parameter of type 'Node'. Type 'new (width?: number, height?: number) => HTMLImageElement' is missing the following properties from type 'Node': baseURI, childNodes, firstChild, isConnected, and 47 more. node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(19,13): error TS2339: Property 'style' does not exist on type 'new (width?: number, height?: number) => HTMLImageElement'. @@ -345,7 +339,7 @@ node_modules/chrome-devtools-frontend/front_end/animation/AnimationTimeline.js(1 node_modules/chrome-devtools-frontend/front_end/animation/AnimationTimeline.js(173,25): error TS2339: Property 'boxInWindow' does not exist on type 'EventTarget'. node_modules/chrome-devtools-frontend/front_end/animation/AnimationTimeline.js(176,44): error TS2339: Property 'keysArray' does not exist on type 'Map'. node_modules/chrome-devtools-frontend/front_end/animation/AnimationTimeline.js(177,63): error TS2339: Property 'parentElement' does not exist on type 'EventTarget'. -node_modules/chrome-devtools-frontend/front_end/animation/AnimationTimeline.js(194,30): error TS2304: Cannot find name 'Image'. +node_modules/chrome-devtools-frontend/front_end/animation/AnimationTimeline.js(194,30): error TS2749: 'Image' refers to a value, but is being used as a type here. node_modules/chrome-devtools-frontend/front_end/animation/AnimationTimeline.js(197,25): error TS2339: Property 'AnimationScreenshotPopover' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'. node_modules/chrome-devtools-frontend/front_end/animation/AnimationTimeline.js(208,50): error TS2554: Expected 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/animation/AnimationTimeline.js(208,67): error TS2554: Expected 2 arguments, but got 1. @@ -451,7 +445,7 @@ node_modules/chrome-devtools-frontend/front_end/application_test_runner/CacheSto node_modules/chrome-devtools-frontend/front_end/application_test_runner/CacheStorageTestRunner.js(19,13): error TS2339: Property 'resources' does not exist on type 'any[]'. node_modules/chrome-devtools-frontend/front_end/application_test_runner/CacheStorageTestRunner.js(21,37): error TS2339: Property 'resources' does not exist on type 'any[]'. node_modules/chrome-devtools-frontend/front_end/application_test_runner/CacheStorageTestRunner.js(32,5): error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? -node_modules/chrome-devtools-frontend/front_end/application_test_runner/CacheStorageTestRunner.js(40,11): error TS2304: Cannot find name 'promise'. +node_modules/chrome-devtools-frontend/front_end/application_test_runner/CacheStorageTestRunner.js(40,11): error TS2552: Cannot find name 'promise'. Did you mean 'Promise'? node_modules/chrome-devtools-frontend/front_end/application_test_runner/CacheStorageTestRunner.js(61,13): error TS2339: Property 'resources' does not exist on type 'any[]'. node_modules/chrome-devtools-frontend/front_end/application_test_runner/CacheStorageTestRunner.js(68,37): error TS2339: Property 'resources' does not exist on type 'any[]'. node_modules/chrome-devtools-frontend/front_end/application_test_runner/CacheStorageTestRunner.js(70,13): error TS2339: Property 'resources' does not exist on type 'any[]'. @@ -699,10 +693,6 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(9093,1): error TS2554: Expected 0-2 arguments, but got 3. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(9117,1): error TS2554: Expected 0-2 arguments, but got 3. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(9467,15): error TS2339: Property 'axe' does not exist on type 'Window'. -node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(9708,34): error TS2345: Argument of type 'any[][]' is not assignable to parameter of type 'readonly [any, any][]'. - Type 'any[]' is missing the following properties from type '[any, any]': 0, 1 -node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(9948,10): error TS2693: 'ShadowRoot' only refers to a type, but is being used as a value here. -node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(9969,4): error TS2693: 'ShadowRoot' only refers to a type, but is being used as a value here. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(10092,16): error TS2304: Cannot find name 'd41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(10513,19): error TS2488: Type 'NodeListOf' must have a '[Symbol.iterator]()' method that returns an iterator. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(10811,19): error TS2304: Cannot find name 'getElementsInDocument'. @@ -723,10 +713,11 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(15630,28): error TS2304: Cannot find name 'fs'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(15636,30): error TS2304: Cannot find name 'fs'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(15645,18): error TS2304: Cannot find name 'fs'. -node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(15684,1): error TS2322: Type 'Promise' is not assignable to type 'Promise'. - Type 'void' is not assignable to type 'any[]'. +node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(15684,1): error TS2322: Type 'Promise' is not assignable to type 'Promise'. + Type 'void | any[]' is not assignable to type 'any[]'. + Type 'void' is not assignable to type 'any[]'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(15687,1): error TS2304: Cannot find name 'fs'. -node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(15694,1): error TS2322: Type 'Promise' is not assignable to type 'Promise'. +node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(15694,1): error TS2322: Type 'Promise' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(15695,1): error TS2304: Cannot find name 'fs'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(15695,78): error TS2345: Argument of type '0' is not assignable to parameter of type '(string | number)[]'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(15791,19): error TS2304: Cannot find name 'fs'. @@ -748,15 +739,17 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(17501,1): error TS2322: Type 'any[]' is not assignable to type 'string'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(18010,1): error TS2554: Expected 0 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(19499,6): error TS2339: Property 'Util' does not exist on type 'Window'. -node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(19585,1): error TS2322: Type 'Promise<{ artifacts: any; auditResults: any[]; }>' is not assignable to type 'Promise'. - Type '{ artifacts: any; auditResults: any[]; }' is not assignable to type 'void'. +node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(19585,1): error TS2322: Type 'Promise' is not assignable to type 'Promise'. + Type 'void | { artifacts: any; auditResults: any[]; }' is not assignable to type 'void'. + Type '{ artifacts: any; auditResults: any[]; }' is not assignable to type 'void'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(19591,15): error TS2339: Property 'artifacts' does not exist on type 'void'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(19592,42): error TS2339: Property 'artifacts' does not exist on type 'void'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(19597,31): error TS2339: Property 'auditResults' does not exist on type 'void'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(19605,22): error TS2339: Property 'artifacts' does not exist on type 'void'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(19612,22): error TS2339: Property 'artifacts' does not exist on type 'void'. -node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(19683,1): error TS2322: Type 'Promise' is not assignable to type 'Promise'. - Type 'number' is not assignable to type 'void'. +node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(19683,1): error TS2322: Type 'Promise' is not assignable to type 'Promise'. + Type 'number | void' is not assignable to type 'void'. + Type 'number' is not assignable to type 'void'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(19744,7): error TS2339: Property 'expected' does not exist on type 'Error'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20005,8): error TS2339: Property 'runLighthouseForConnection' does not exist on type 'Window'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20035,8): error TS2339: Property 'runLighthouseInWorker' does not exist on type 'Window'. @@ -3098,8 +3091,6 @@ node_modules/chrome-devtools-frontend/front_end/bindings/BlackboxManager.js(341, node_modules/chrome-devtools-frontend/front_end/bindings/BlackboxManager.js(351,31): error TS2694: Namespace 'Protocol' has no exported member 'Debugger'. node_modules/chrome-devtools-frontend/front_end/bindings/BlackboxManager.js(362,31): error TS2694: Namespace 'Protocol' has no exported member 'Debugger'. node_modules/chrome-devtools-frontend/front_end/bindings/BlackboxManager.js(375,9): error TS2322: Type 'Promise' is not assignable to type 'Promise'. -node_modules/chrome-devtools-frontend/front_end/bindings/BlackboxManager.js(378,9): error TS2322: Type 'Promise' is not assignable to type 'Promise'. -node_modules/chrome-devtools-frontend/front_end/bindings/BlackboxManager.js(381,5): error TS2322: Type 'Promise' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/bindings/BreakpointManager.js(60,52): error TS2345: Argument of type 'this' is not assignable to parameter of type '{ modelAdded(model: T): void; modelRemoved(model: T): void; }'. Type 'BreakpointManager' is not assignable to type '{ modelAdded(model: T): void; modelRemoved(model: T): void; }'. Types of property 'modelAdded' are incompatible. @@ -3755,6 +3746,7 @@ node_modules/chrome-devtools-frontend/front_end/common/ParsedURL.js(152,25): err node_modules/chrome-devtools-frontend/front_end/common/ParsedURL.js(161,25): error TS2339: Property 'asParsedURL' does not exist on type 'string'. node_modules/chrome-devtools-frontend/front_end/common/ParsedURL.js(211,34): error TS2339: Property 'asParsedURL' does not exist on type 'string'. node_modules/chrome-devtools-frontend/front_end/common/ParsedURL.js(215,29): error TS2339: Property 'asParsedURL' does not exist on type 'string'. +node_modules/chrome-devtools-frontend/front_end/common/ParsedURL.js(318,32): error TS2554: Expected 0 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/common/ParsedURL.js(375,18): error TS2339: Property 'asParsedURL' does not exist on type 'String'. node_modules/chrome-devtools-frontend/front_end/common/SegmentedRange.js(48,37): error TS2339: Property 'lowerBound' does not exist on type 'Segment[]'. node_modules/chrome-devtools-frontend/front_end/common/Settings.js(49,10): error TS2339: Property 'runtime' does not exist on type 'Window'. @@ -3906,6 +3898,7 @@ node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.j node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.js(192,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.js(200,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.js(255,28): error TS2339: Property 'createChild' does not exist on type 'DocumentFragment'. +node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.js(256,27): error TS2554: Expected 0 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.js(257,31): error TS2339: Property 'createChild' does not exist on type 'DocumentFragment'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.js(264,13): error TS2339: Property 'style' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.js(279,14): error TS2555: Expected at least 2 arguments, but got 1. @@ -3981,7 +3974,7 @@ node_modules/chrome-devtools-frontend/front_end/console/ConsoleSidebar.js(107,9) node_modules/chrome-devtools-frontend/front_end/console/ConsoleSidebar.js(111,9): error TS2339: Property 'ConsoleSidebar' does not exist on type '{ new (): Console; prototype: Console; }'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleSidebar.js(119,47): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleSidebar.js(122,25): error TS2345: Argument of type 'Element' is not assignable to parameter of type 'Icon'. - Type 'Element' is missing the following properties from type 'Icon': createdCallback, _descriptor, _spriteSheet, _iconType, and 116 more. + Type 'Element' is missing the following properties from type 'Icon': createdCallback, _descriptor, _spriteSheet, _iconType, and 117 more. node_modules/chrome-devtools-frontend/front_end/console/ConsoleSidebar.js(133,9): error TS2339: Property 'ConsoleSidebar' does not exist on type '{ new (): Console; prototype: Console; }'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleSidebar.js(147,27): error TS2322: Type 'Element' is not assignable to type 'Icon'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleSidebar.js(177,60): error TS2555: Expected at least 2 arguments, but got 1. @@ -4184,6 +4177,7 @@ node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(70 node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(733,19): error TS2339: Property 'removeChildren' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(735,35): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(736,31): error TS2555: Expected at least 2 arguments, but got 1. +node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(750,27): error TS2554: Expected 0 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(803,34): error TS2339: Property 'style' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(804,31): error TS2339: Property 'style' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(806,43): error TS2339: Property 'style' does not exist on type 'Element'. @@ -4521,6 +4515,7 @@ node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(98,48): er node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(109,26): error TS2352: Conversion of type 'DataGridNode' to type 'NODE_TYPE' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(121,17): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(123,17): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. +node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(134,29): error TS2554: Expected 0 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(135,15): error TS2339: Property 'title' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(139,15): error TS2339: Property 'title' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(159,33): error TS2694: Namespace 'DataGrid.DataGrid' has no exported member 'ColumnDescriptor'. @@ -5065,8 +5060,6 @@ node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(25 node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(253,61): error TS2339: Property 'host' does not exist on type 'Node'. node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(254,17): error TS2339: Property 'host' does not exist on type 'Node'. node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(261,16): error TS2339: Property 'getComponentSelection' does not exist on type 'Node'. -node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(265,28): error TS2693: 'ShadowRoot' only refers to a type, but is being used as a value here. -node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(265,48): error TS2339: Property 'getSelection' does not exist on type 'Node & ParentNode'. node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(265,70): error TS2339: Property 'window' does not exist on type 'Node'. node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(271,16): error TS2339: Property 'hasSelection' does not exist on type 'Node'. node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(273,23): error TS2339: Property 'querySelectorAll' does not exist on type 'Node'. @@ -5149,7 +5142,7 @@ node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(74 node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(745,48): error TS2339: Property 'pageX' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(745,60): error TS2339: Property 'pageY' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(753,20): error TS2339: Property 'deepElementFromPoint' does not exist on type 'Document'. -node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(761,5): error TS2740: Type 'ShadowRoot' is missing the following properties from type 'Document': URL, alinkColor, all, anchors, and 169 more. +node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(761,5): error TS2740: Type 'ShadowRoot' is missing the following properties from type 'Document': URL, alinkColor, all, anchors, and 174 more. node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(766,28): error TS2339: Property 'deepElementFromPoint' does not exist on type 'DocumentFragment'. node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(766,70): error TS2339: Property 'deepElementFromPoint' does not exist on type 'Document'. node_modules/chrome-devtools-frontend/front_end/dom_extension/DOMExtension.js(771,20): error TS2339: Property 'deepActiveElement' does not exist on type 'Document'. @@ -5367,7 +5360,7 @@ node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js( node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(575,10): error TS2339: Property 'style' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(576,10): error TS2339: Property 'style' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(580,10): error TS2339: Property 'scrollIntoViewIfNeeded' does not exist on type 'Element'. -node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(592,20): error TS2339: Property 'classList' does not exist on type 'Node'. +node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(592,20): error TS2339: Property 'classList' does not exist on type 'ChildNode'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(600,41): error TS2339: Property 'isAncestor' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(632,27): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(655,26): error TS2339: Property 'getComponentSelection' does not exist on type 'Element'. @@ -5377,7 +5370,6 @@ node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js( node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(738,14): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(739,14): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(762,13): error TS2339: Property 'style' does not exist on type 'ChildNode'. -node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(763,7): error TS2739: Type 'Node' is missing the following properties from type 'ChildNode': after, before, remove, replaceWith node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(767,32): error TS2339: Property 'style' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(772,10): error TS2339: Property 'runtime' does not exist on type 'Window'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(796,24): error TS2339: Property 'setMultilineEditing' does not exist on type 'TreeOutline'. @@ -5385,7 +5377,6 @@ node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js( node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(803,60): error TS2339: Property 'visibleWidth' does not exist on type 'TreeOutline'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(828,34): error TS2339: Property 'style' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(832,15): error TS2339: Property 'style' does not exist on type 'ChildNode'. -node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(833,9): error TS2322: Type 'Node' is not assignable to type 'ChildNode'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(837,26): error TS2339: Property 'setMultilineEditing' does not exist on type 'TreeOutline'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(851,18): error TS2339: Property 'altKey' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElement.js(851,35): error TS2339: Property 'shiftKey' does not exist on type 'Event'. @@ -5466,7 +5457,7 @@ node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeOutline.js( node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeOutline.js(755,33): error TS2339: Property 'enclosingNodeOrSelfWithClass' does not exist on type 'EventTarget'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeOutline.js(758,36): error TS2339: Property 'enclosingNodeOrSelfWithClass' does not exist on type 'EventTarget'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeOutline.js(813,22): error TS2339: Property 'index' does not exist on type 'DOMNode'. -node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeOutline.js(920,9): error TS2740: Type 'Node & ParentNode' is missing the following properties from type 'Element': assignedSlot, attributes, classList, className, and 63 more. +node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeOutline.js(920,9): error TS2740: Type 'Node & ParentNode' is missing the following properties from type 'Element': assignedSlot, attributes, classList, className, and 64 more. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeOutline.js(930,13): error TS2339: Property 'type' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeOutline.js(1010,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeOutline.js(1025,22): error TS2694: Namespace 'Common' has no exported member 'Event'. @@ -5658,14 +5649,13 @@ node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(10 node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1040,69): error TS2339: Property 'selectorText' does not exist on type 'CSSRule'. node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1055,24): error TS2339: Property '_section' does not exist on type 'ChildNode'. node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1056,29): error TS2339: Property '_section' does not exist on type 'ChildNode'. -node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1057,7): error TS2322: Type 'Node' is not assignable to type 'ChildNode'. node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1073,24): error TS2339: Property '_section' does not exist on type 'ChildNode'. node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1074,29): error TS2339: Property '_section' does not exist on type 'ChildNode'. -node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1075,7): error TS2322: Type 'Node' is not assignable to type 'ChildNode'. -node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1087,7): error TS2740: Type 'Node' is missing the following properties from type 'Element': assignedSlot, attributes, classList, className, and 71 more. +node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1075,7): error TS2739: Type 'Node' is missing the following properties from type 'ChildNode': after, before, remove, replaceWith +node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1087,7): error TS2740: Type 'ChildNode' is missing the following properties from type 'Element': assignedSlot, attributes, classList, className, and 68 more. node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1088,38): error TS2339: Property '_section' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1090,36): error TS2339: Property '_section' does not exist on type 'Element'. -node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1099,7): error TS2322: Type 'Node' is not assignable to type 'Element'. +node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1099,7): error TS2740: Type 'Node' is missing the following properties from type 'Element': assignedSlot, attributes, classList, className, and 72 more. node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1100,38): error TS2339: Property '_section' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1102,36): error TS2339: Property '_section' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(1106,22): error TS2694: Namespace 'Common' has no exported member 'Event'. @@ -5796,7 +5786,6 @@ node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(28 node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(2906,7): error TS2322: Type 'Promise' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(2910,7): error TS2322: Type 'Promise' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(2918,7): error TS2322: Type 'Promise' is not assignable to type 'Promise'. -node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(2956,5): error TS2322: Type 'Promise' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(2978,35): error TS2300: Duplicate identifier 'Context'. node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(2978,35): error TS2339: Property 'Context' does not exist on type 'typeof StylePropertyTreeElement'. node_modules/chrome-devtools-frontend/front_end/elements/StylesSidebarPane.js(3021,19): error TS2339: Property 'key' does not exist on type 'Event'. @@ -6143,7 +6132,6 @@ node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionServer.js(13 node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionServer.js(161,5): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionServer.js(219,43): error TS2694: Namespace 'Protocol' has no exported member 'Network'. node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionServer.js(244,54): error TS2339: Property 'traverseNextNode' does not exist on type 'HTMLElement'. -node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionServer.js(245,27): error TS2693: 'ShadowRoot' only refers to a type, but is being used as a value here. node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionServer.js(463,53): error TS2345: Argument of type '{ url: string; type: string; }' is not assignable to parameter of type '{ contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise; requestContent(): Promise; searchInContent(query: string, caseSensitive: boolean, isRegex: boolean): Promise<...>; }'. Type '{ url: string; type: string; }' is missing the following properties from type '{ contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise; requestContent(): Promise; searchInContent(query: string, caseSensitive: boolean, isRegex: boolean): Promise<...>; }': contentURL, contentType, contentEncoded, requestContent, searchInContent node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionServer.js(471,22): error TS2339: Property 'valuesArray' does not exist on type 'Map; requestContent(): Promise; searchInContent(query: string, caseSensitive: boolean, isRegex: boolean): Promise<...>; }>'. @@ -6923,11 +6911,10 @@ node_modules/chrome-devtools-frontend/front_end/layer_viewer/Layers3DView.js(794 node_modules/chrome-devtools-frontend/front_end/layer_viewer/Layers3DView.js(795,22): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/layer_viewer/Layers3DView.js(796,22): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/layer_viewer/Layers3DView.js(841,14): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -node_modules/chrome-devtools-frontend/front_end/layer_viewer/Layers3DView.js(852,15): error TS2304: Cannot find name 'Image'. +node_modules/chrome-devtools-frontend/front_end/layer_viewer/Layers3DView.js(852,15): error TS2749: 'Image' refers to a value, but is being used as a type here. node_modules/chrome-devtools-frontend/front_end/layer_viewer/Layers3DView.js(858,13): error TS2339: Property 'image' does not exist on type 'WebGLTexture'. node_modules/chrome-devtools-frontend/front_end/layer_viewer/Layers3DView.js(861,81): error TS2339: Property 'image' does not exist on type 'WebGLTexture'. node_modules/chrome-devtools-frontend/front_end/layer_viewer/Layers3DView.js(928,26): error TS2694: Namespace 'SDK' has no exported member 'SnapshotWithRect'. -node_modules/chrome-devtools-frontend/front_end/layer_viewer/Layers3DView.js(932,39): error TS2345: Argument of type 'any[][]' is not assignable to parameter of type 'readonly [any, any][]'. node_modules/chrome-devtools-frontend/front_end/layer_viewer/Layers3DView.js(1080,24): error TS2694: Namespace 'Protocol' has no exported member 'DOM'. node_modules/chrome-devtools-frontend/front_end/layer_viewer/Layers3DView.js(1098,15): error TS2304: Cannot find name 'CSSMatrix'. node_modules/chrome-devtools-frontend/front_end/layer_viewer/Layers3DView.js(1143,19): error TS2694: Namespace 'SDK' has no exported member 'SnapshotWithRect'. @@ -7762,6 +7749,7 @@ node_modules/chrome-devtools-frontend/front_end/object_ui/JavaScriptAutocomplete node_modules/chrome-devtools-frontend/front_end/object_ui/JavaScriptAutocomplete.js(471,33): error TS2339: Property 'CompletionGroup' does not exist on type 'typeof JavaScriptAutocomplete'. node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPopoverHelper.js(82,35): error TS2694: Namespace 'SDK.DebuggerModel' has no exported member 'FunctionDetails'. node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPopoverHelper.js(91,29): error TS2339: Property 'createChild' does not exist on type 'Element'. +node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPopoverHelper.js(108,23): error TS2554: Expected 0 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPopoverHelper.js(114,48): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPopoverHelper.js(129,7): error TS2722: Cannot invoke an object which is possibly 'undefined'. node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPopoverHelper.js(145,50): error TS2339: Property 'createChild' does not exist on type 'Element'. @@ -7774,6 +7762,7 @@ node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSectio node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSection.js(181,18): error TS2339: Property 'title' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSection.js(207,22): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSection.js(209,22): error TS2339: Property 'createTextChild' does not exist on type 'Element'. +node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSection.js(209,38): error TS2554: Expected 0 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSection.js(211,22): error TS2339: Property 'createTextChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSection.js(263,20): error TS2339: Property 'title' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSection.js(268,22): error TS2339: Property 'setTextContentTruncatedIfNeeded' does not exist on type 'Element'. @@ -7941,7 +7930,6 @@ node_modules/chrome-devtools-frontend/front_end/perf_ui/FilmStripView.js(254,19) node_modules/chrome-devtools-frontend/front_end/perf_ui/FilmStripView.js(256,35): error TS2339: Property 'metaKey' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/perf_ui/FilmStripView.js(263,35): error TS2339: Property 'metaKey' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/perf_ui/FilmStripView.js(306,51): error TS2339: Property 'millisToString' does not exist on type 'NumberConstructor'. -node_modules/chrome-devtools-frontend/front_end/perf_ui/FilmStripView.js(307,5): error TS2322: Type 'Promise' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(307,36): error TS2339: Property 'offsetX' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(308,36): error TS2339: Property 'offsetY' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(313,45): error TS2339: Property 'offsetX' does not exist on type 'Event'. @@ -8059,8 +8047,8 @@ node_modules/chrome-devtools-frontend/front_end/perf_ui/TimelineGrid.js(189,25): node_modules/chrome-devtools-frontend/front_end/perf_ui/TimelineGrid.js(196,23): error TS2339: Property '_labelElement' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/perf_ui/TimelineGrid.js(199,15): error TS2339: Property 'style' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/perf_ui/TimelineGrid.js(200,23): error TS2339: Property 'style' does not exist on type 'Element'. -node_modules/chrome-devtools-frontend/front_end/perf_ui/TimelineGrid.js(210,7): error TS2322: Type 'Node' is not assignable to type 'Element'. -node_modules/chrome-devtools-frontend/front_end/perf_ui/TimelineGrid.js(215,7): error TS2322: Type 'Node' is not assignable to type 'Element'. +node_modules/chrome-devtools-frontend/front_end/perf_ui/TimelineGrid.js(210,7): error TS2322: Type 'ChildNode' is not assignable to type 'Element'. +node_modules/chrome-devtools-frontend/front_end/perf_ui/TimelineGrid.js(215,7): error TS2322: Type 'ChildNode' is not assignable to type 'Element'. node_modules/chrome-devtools-frontend/front_end/perf_ui/TimelineGrid.js(267,21): error TS2339: Property 'DividersData' does not exist on type 'typeof TimelineGrid'. node_modules/chrome-devtools-frontend/front_end/perf_ui/TimelineGrid.js(277,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. node_modules/chrome-devtools-frontend/front_end/perf_ui/TimelineGrid.js(284,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. @@ -8253,6 +8241,7 @@ node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(125,15): e node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(125,39): error TS2339: Property 'regexSpecialCharacters' does not exist on type 'StringConstructor'. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(132,8): error TS2339: Property 'filterRegex' does not exist on type 'StringConstructor'. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(133,27): error TS2339: Property 'regexSpecialCharacters' does not exist on type 'StringConstructor'. +node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(198,1): error TS2322: Type '(maxLength: number) => string' is not assignable to type '() => string'. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(250,8): error TS2339: Property 'hashCode' does not exist on type 'StringConstructor'. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(275,8): error TS2339: Property 'isDigitAt' does not exist on type 'StringConstructor'. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(320,8): error TS2339: Property 'naturalOrderComparator' does not exist on type 'StringConstructor'. @@ -8343,7 +8332,212 @@ node_modules/chrome-devtools-frontend/front_end/product_registry/ProductRegistry node_modules/chrome-devtools-frontend/front_end/product_registry/ProductRegistry.js(34,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. node_modules/chrome-devtools-frontend/front_end/product_registry/ProductRegistry.js(55,41): error TS2694: Namespace 'ProductRegistry.Registry' has no exported member 'ProductEntry'. node_modules/chrome-devtools-frontend/front_end/product_registry/ProductRegistry.js(72,26): error TS2339: Property 'ProductEntry' does not exist on type 'typeof Registry'. -node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(1488,1): error TS2590: Expression produces a union type that is too complex to represent. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(1559,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(1563,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(1604,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(1605,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(1606,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(1865,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2136,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2136,64): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2136,86): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2208,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2269,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2270,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2322,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2323,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2503,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2856,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2857,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2858,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2859,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2860,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2861,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2862,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2863,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2864,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(2865,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3126,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3572,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3573,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3574,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3575,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3576,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3747,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3748,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3770,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3771,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3772,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3773,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3774,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3775,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3776,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3780,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3819,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3826,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3873,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3874,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3957,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(3958,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4068,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4069,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4138,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4139,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4203,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4230,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4260,104): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4264,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4265,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4266,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4312,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4480,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4832,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4833,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4834,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(4835,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5127,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5137,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5159,70): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5175,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5186,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5202,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5249,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5522,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5523,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5524,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5525,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5539,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5565,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5612,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5613,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5614,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5615,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5616,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5617,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5618,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5619,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5684,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5789,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5820,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5852,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5858,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5859,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5860,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5970,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5971,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(5972,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6145,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6151,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6152,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6153,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6154,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6180,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6181,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6182,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6183,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6184,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6185,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6186,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6187,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6193,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6194,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6195,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6196,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6197,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6198,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6199,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6217,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6218,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6225,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6227,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6228,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6229,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6230,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6231,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6232,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6233,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6243,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6270,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6272,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6276,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6294,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6296,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6297,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6298,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6299,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6300,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6303,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6305,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6323,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6324,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6325,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6326,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6327,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6333,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6334,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6335,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6336,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6337,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6338,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6339,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6340,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6341,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6342,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6343,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6344,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6345,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6346,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6347,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6348,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6349,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6350,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6351,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6360,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6361,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6362,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6363,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6364,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6365,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6369,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6382,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6388,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6389,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6404,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6405,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6406,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6425,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6441,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6442,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6445,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6481,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6521,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6560,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6573,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6574,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6575,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6576,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6577,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6578,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6579,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6580,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6581,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6582,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6583,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6615,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6620,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6629,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6637,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6661,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6668,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6675,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6689,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6690,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6699,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6726,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6735,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6737,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6738,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. +node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryData.js(6741,42): error TS2741: Property 'type' is missing in type '{ "product": number; }' but required in type '{ product: number; type: number; }'. node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryImpl.js(27,41): error TS2694: Namespace 'ProductRegistry.Registry' has no exported member 'ProductEntry'. node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryImpl.js(103,67): error TS2694: Namespace 'ProductRegistry.Registry' has no exported member 'ProductEntry'. node_modules/chrome-devtools-frontend/front_end/profiler/BottomUpProfileDataGrid.js(83,15): error TS2339: Property '_remainingNodeInfos' does not exist on type 'ProfileDataGridNode'. @@ -8772,8 +8966,6 @@ node_modules/chrome-devtools-frontend/front_end/profiler/ProfileView.js(57,23): node_modules/chrome-devtools-frontend/front_end/profiler/ProfileView.js(78,46): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/ProfileView.js(79,46): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/ProfileView.js(80,45): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/profiler/ProfileView.js(84,17): error TS2345: Argument of type '(string | Element)[][]' is not assignable to parameter of type 'readonly [any, any][]'. - Type '(string | Element)[]' is missing the following properties from type '[any, any]': 0, 1 node_modules/chrome-devtools-frontend/front_end/profiler/ProfileView.js(136,59): error TS2339: Property 'profile' does not exist on type 'ProfileView'. node_modules/chrome-devtools-frontend/front_end/profiler/ProfileView.js(136,78): error TS2339: Property 'adjustedTotal' does not exist on type 'ProfileView'. node_modules/chrome-devtools-frontend/front_end/profiler/ProfileView.js(147,59): error TS2339: Property 'profile' does not exist on type 'ProfileView'. @@ -10070,8 +10262,6 @@ node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1179,3): err Types of parameters 'functionDeclaration' and 'functionDeclaration' are incompatible. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1234,21): error TS2694: Namespace 'SDK' has no exported member 'CallFunctionResult'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1265,21): error TS2694: Namespace 'SDK' has no exported member 'CallFunctionResult'. -node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1325,5): error TS2322: Type 'Promise<{ properties: RemoteObjectProperty[]; internalProperties: RemoteObjectProperty[]; }>' is not assignable to type 'Promise'. - Type '{ properties: RemoteObjectProperty[]; internalProperties: RemoteObjectProperty[]; }' is missing the following properties from type 'RemoteObject': customPreview, objectId, type, subtype, and 20 more. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1345,43): error TS2694: Namespace 'SDK.DebuggerModel' has no exported member 'FunctionDetails'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1352,45): error TS2694: Namespace 'SDK.DebuggerModel' has no exported member 'FunctionDetails'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1363,35): error TS2694: Namespace 'SDK.DebuggerModel' has no exported member 'FunctionDetails'. @@ -10730,7 +10920,6 @@ node_modules/chrome-devtools-frontend/front_end/source_frame/XMLView.js(54,59): node_modules/chrome-devtools-frontend/front_end/source_frame/XMLView.js(73,28): error TS2339: Property 'setSearchRegex' does not exist on type 'TreeElement'. node_modules/chrome-devtools-frontend/front_end/source_frame/XMLView.js(80,23): error TS2339: Property 'setSearchRegex' does not exist on type 'TreeElement'. node_modules/chrome-devtools-frontend/front_end/source_frame/XMLView.js(223,35): error TS2339: Property 'childElementCount' does not exist on type 'Node'. -node_modules/chrome-devtools-frontend/front_end/source_frame/XMLView.js(242,7): error TS2322: Type 'Node' is not assignable to type 'ChildNode'. node_modules/chrome-devtools-frontend/front_end/source_frame/XMLView.js(290,24): error TS2339: Property 'tagName' does not exist on type 'Node'. node_modules/chrome-devtools-frontend/front_end/source_frame/XMLView.js(296,31): error TS2339: Property 'attributes' does not exist on type 'Node'. node_modules/chrome-devtools-frontend/front_end/source_frame/XMLView.js(305,20): error TS2339: Property 'childElementCount' does not exist on type 'Node'. @@ -10860,9 +11049,7 @@ node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSid node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(80,71): error TS2339: Property 'uiLocation' does not exist on type 'V'. node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(81,60): error TS2339: Property 'breakpoint' does not exist on type 'V'. node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(82,62): error TS2339: Property 'breakpoint' does not exist on type 'V'. -node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(87,7): error TS2322: Type 'Node' is not assignable to type 'ChildNode'. -node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(92,7): error TS2322: Type 'Node' is not assignable to type 'ChildNode'. -node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(119,5): error TS2322: Type 'Promise' is not assignable to type 'Promise'. +node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(131,38): error TS2554: Expected 0 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(141,29): error TS2339: Property 'enclosingNodeOrSelfWithClass' does not exist on type 'EventTarget'. node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(156,33): error TS2339: Property 'checkboxElement' does not exist on type 'EventTarget'. node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(159,11): error TS2339: Property 'consume' does not exist on type 'Event'. @@ -11061,9 +11248,6 @@ node_modules/chrome-devtools-frontend/front_end/sources/SnippetsPlugin.js(41,73) node_modules/chrome-devtools-frontend/front_end/sources/SourceFormatter.js(48,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/sources/SourceFormatter.js(55,32): error TS2339: Property 'remove' does not exist on type 'Map; formatData: SourceFormatData; }>'. node_modules/chrome-devtools-frontend/front_end/sources/SourceFormatter.js(67,32): error TS2339: Property 'remove' does not exist on type 'Map; formatData: SourceFormatData; }>'. -node_modules/chrome-devtools-frontend/front_end/sources/SourceMapNamesResolver.js(55,5): error TS2322: Type 'Promise<{ name: string; offset: number; }[]>' is not assignable to type 'Promise'. - Type '{ name: string; offset: number; }[]' is not assignable to type 'Identifier[]'. - Type '{ name: string; offset: number; }' is missing the following properties from type 'Identifier': lineNumber, columnNumber node_modules/chrome-devtools-frontend/front_end/sources/SourceMapNamesResolver.js(304,37): error TS2339: Property 'inverse' does not exist on type 'Map'. node_modules/chrome-devtools-frontend/front_end/sources/SourceMapNamesResolver.js(322,32): error TS2694: Namespace 'SDK.RuntimeModel' has no exported member 'EvaluationResult'. node_modules/chrome-devtools-frontend/front_end/sources/SourceMapNamesResolver.js(361,25): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. @@ -11345,8 +11529,6 @@ node_modules/chrome-devtools-frontend/front_end/sources_test_runner/SourcesTestR node_modules/chrome-devtools-frontend/front_end/sources_test_runner/SourcesTestRunner.js(129,11): error TS2339: Property 'pushAll' does not exist on type 'any[]'. node_modules/chrome-devtools-frontend/front_end/terminal/TerminalWidget.js(29,54): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/terminal/TerminalWidget.js(30,65): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/terminal/TerminalWidget.js(139,9): error TS2322: Type 'Node' is not assignable to type 'ChildNode'. -node_modules/chrome-devtools-frontend/front_end/terminal/TerminalWidget.js(146,7): error TS2322: Type 'Node' is not assignable to type 'ChildNode'. node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/addons/fit/fit.js(19,34): error TS2307: Cannot find module '../../xterm'. node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/addons/fit/fit.js(20,21): error TS2304: Cannot find name 'define'. node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/addons/fit/fit.js(24,5): error TS2304: Cannot find name 'define'. @@ -11500,7 +11682,6 @@ node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(683,28 node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(717,24): error TS2694: Namespace 'TestRunner' has no exported member 'CustomFormatters'. node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(748,24): error TS2694: Namespace 'TestRunner' has no exported member 'CustomFormatters'. node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(777,22): error TS2339: Property 'attributes' does not exist on type 'Node'. -node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(783,46): error TS2322: Type 'Node' is not assignable to type 'ChildNode'. node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(785,14): error TS2339: Property 'shadowRoot' does not exist on type 'Node'. node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(786,39): error TS2339: Property 'shadowRoot' does not exist on type 'Node'. node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(805,12): error TS2339: Property 'shadowRoot' does not exist on type 'Node'. @@ -11741,8 +11922,9 @@ node_modules/chrome-devtools-frontend/front_end/timeline/TimelineEventOverview.j node_modules/chrome-devtools-frontend/front_end/timeline/TimelineEventOverview.js(204,36): error TS2339: Property '_overviewIndex' does not exist on type 'TimelineCategory'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineEventOverview.js(246,68): error TS2339: Property 'peekLast' does not exist on type 'any[]'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineEventOverview.js(248,81): error TS2339: Property '_overviewIndex' does not exist on type 'TimelineCategory'. -node_modules/chrome-devtools-frontend/front_end/timeline/TimelineEventOverview.js(384,7): error TS2322: Type 'Promise HTMLImageElement>' is not assignable to type 'Promise'. - Type 'new (width?: number, height?: number) => HTMLImageElement' is missing the following properties from type 'HTMLImageElement': align, alt, border, complete, and 259 more. +node_modules/chrome-devtools-frontend/front_end/timeline/TimelineEventOverview.js(384,7): error TS2322: Type 'Promise HTMLImageElement)>' is not assignable to type 'Promise'. + Type 'HTMLImageElement | (new (width?: number, height?: number) => HTMLImageElement)' is not assignable to type 'HTMLImageElement'. + Type 'new (width?: number, height?: number) => HTMLImageElement' is missing the following properties from type 'HTMLImageElement': align, alt, border, complete, and 261 more. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineEventOverview.js(457,17): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineEventOverview.js(483,24): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineEventOverview.js(524,28): error TS2339: Property 'peekLast' does not exist on type 'TimelineFrame[]'. @@ -11757,7 +11939,7 @@ node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataP node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(111,16): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(140,27): error TS2339: Property '_blackboxRoot' does not exist on type 'string | Event | TimelineFrame | Frame'. Property '_blackboxRoot' does not exist on type 'string'. -node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(171,49): error TS2304: Cannot find name 'Image'. +node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(171,49): error TS2749: 'Image' refers to a value, but is being used as a type here. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(203,24): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(222,11): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(225,11): error TS2555: Expected at least 2 arguments, but got 1. @@ -12252,7 +12434,7 @@ node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1652 node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1657,64): error TS2345: Argument of type 'new (width?: number, height?: number) => HTMLImageElement' is not assignable to parameter of type 'Node'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1664,11): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1665,67): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1675,5): error TS2740: Type 'DocumentFragment' is missing the following properties from type 'Element': assignedSlot, attributes, classList, className, and 63 more. +node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1675,5): error TS2740: Type 'DocumentFragment' is missing the following properties from type 'Element': assignedSlot, attributes, classList, className, and 64 more. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1684,30): error TS2339: Property 'millisToString' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1685,16): error TS2339: Property 'millisToString' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1687,13): error TS2339: Property 'createTextChild' does not exist on type 'Element'. @@ -13027,7 +13209,7 @@ node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(592,35): error node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(601,32): error TS2339: Property 'isAncestor' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(610,54): error TS2339: Property 'isAncestor' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(622,35): error TS2339: Property 'getComponentSelection' does not exist on type 'Element'. -node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(627,7): error TS2740: Type 'ChildNode' is missing the following properties from type 'Element': assignedSlot, attributes, classList, className, and 67 more. +node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(627,7): error TS2322: Type 'ChildNode' is not assignable to type 'Element'. node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(43,50): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(48,45): error TS2339: Property 'createChild' does not exist on type 'DocumentFragment'. node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(75,24): error TS2694: Namespace 'Common' has no exported member 'Event'. @@ -13213,6 +13395,7 @@ node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1561,11): error TS node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1562,17): error TS2339: Property 'value' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1570,25): error TS2339: Property 'value' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1574,11): error TS2339: Property 'value' does not exist on type 'Element'. +node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1633,64): error TS2554: Expected 0 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1646,40): error TS2339: Property '_textWidthCache' does not exist on type '(context: CanvasRenderingContext2D, text: string) => number'. node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1649,25): error TS2339: Property '_textWidthCache' does not exist on type '(context: CanvasRenderingContext2D, text: string) => number'. node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1715,20): error TS2339: Property 'type' does not exist on type 'Element'. @@ -13224,10 +13407,10 @@ node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1910,22): error TS node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1911,22): error TS2339: Property 'constrain' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1912,22): error TS2339: Property 'constrain' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1913,22): error TS2339: Property 'constrain' does not exist on type 'NumberConstructor'. -node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1938,23): error TS2304: Cannot find name 'Image'. +node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1938,23): error TS2749: 'Image' refers to a value, but is being used as a type here. node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1943,50): error TS2345: Argument of type 'HTMLImageElement' is not assignable to parameter of type '(new (width?: number, height?: number) => HTMLImageElement) | PromiseLike HTMLImageElement>'. Property 'then' is missing in type 'HTMLImageElement' but required in type 'PromiseLike HTMLImageElement>'. -node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1951,23): error TS2304: Cannot find name 'Image'. +node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1951,23): error TS2749: 'Image' refers to a value, but is being used as a type here. node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1961,12): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1966,23): error TS2339: Property 'type' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1967,23): error TS2339: Property 'style' does not exist on type 'Element'. diff --git a/tests/baselines/reference/user/debug.log b/tests/baselines/reference/user/debug.log index 78c472d877fa8..4879bb3f8b305 100644 --- a/tests/baselines/reference/user/debug.log +++ b/tests/baselines/reference/user/debug.log @@ -53,21 +53,21 @@ node_modules/debug/src/browser.js(45,138): error TS2551: Property 'WebkitAppeara node_modules/debug/src/browser.js(46,70): error TS2339: Property 'firebug' does not exist on type 'Console'. node_modules/debug/src/browser.js(100,148): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any?, ...any[]]'. node_modules/debug/src/browser.js(152,13): error TS2304: Cannot find name 'LocalStorage'. -node_modules/debug/src/common.js(51,24): error TS2339: Property 'colors' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: any; ... 4 more ...; selectColor: (namespace: string) => string | number; }'. -node_modules/debug/src/common.js(51,60): error TS2339: Property 'colors' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: any; ... 4 more ...; selectColor: (namespace: string) => string | number; }'. +node_modules/debug/src/common.js(51,24): error TS2339: Property 'colors' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: { (value: number, options?: { ...; } | undefined): string; (value: string): number; }; ... 4 more ...; selectColor: (namespace...'. +node_modules/debug/src/common.js(51,60): error TS2339: Property 'colors' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: { (value: number, options?: { ...; } | undefined): string; (value: string): number; }; ... 4 more ...; selectColor: (namespace...'. node_modules/debug/src/common.js(80,12): error TS2339: Property 'diff' does not exist on type '{ (...args: any[]): void; namespace: string; enabled: boolean; useColors: any; color: string | number; destroy: () => boolean; extend: (namespace: any, delimiter: any) => Function; }'. node_modules/debug/src/common.js(81,12): error TS2339: Property 'prev' does not exist on type '{ (...args: any[]): void; namespace: string; enabled: boolean; useColors: any; color: string | number; destroy: () => boolean; extend: (namespace: any, delimiter: any) => Function; }'. node_modules/debug/src/common.js(82,12): error TS2339: Property 'curr' does not exist on type '{ (...args: any[]): void; namespace: string; enabled: boolean; useColors: any; color: string | number; destroy: () => boolean; extend: (namespace: any, delimiter: any) => Function; }'. -node_modules/debug/src/common.js(113,19): error TS2551: Property 'formatArgs' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: any; ... 4 more ...; selectColor: (namespace: string) => string | number; }'. Did you mean 'formatters'? +node_modules/debug/src/common.js(113,19): error TS2551: Property 'formatArgs' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: { (value: number, options?: { ...; } | undefined): string; (value: string): number; }; ... 4 more ...; selectColor: (namespace...'. Did you mean 'formatters'? node_modules/debug/src/common.js(114,24): error TS2339: Property 'log' does not exist on type '{ (...args: any[]): void; namespace: string; enabled: boolean; useColors: any; color: string | number; destroy: () => boolean; extend: (namespace: any, delimiter: any) => Function; }'. -node_modules/debug/src/common.js(114,43): error TS2339: Property 'log' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: any; ... 4 more ...; selectColor: (namespace: string) => string | number; }'. -node_modules/debug/src/common.js(120,35): error TS2339: Property 'useColors' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: any; ... 4 more ...; selectColor: (namespace: string) => string | number; }'. -node_modules/debug/src/common.js(127,28): error TS2339: Property 'init' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: any; ... 4 more ...; selectColor: (namespace: string) => string | number; }'. -node_modules/debug/src/common.js(128,19): error TS2339: Property 'init' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: any; ... 4 more ...; selectColor: (namespace: string) => string | number; }'. -node_modules/debug/src/common.js(159,17): error TS2339: Property 'save' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: any; ... 4 more ...; selectColor: (namespace: string) => string | number; }'. +node_modules/debug/src/common.js(114,43): error TS2339: Property 'log' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: { (value: number, options?: { ...; } | undefined): string; (value: string): number; }; ... 4 more ...; selectColor: (namespace...'. +node_modules/debug/src/common.js(120,35): error TS2339: Property 'useColors' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: { (value: number, options?: { ...; } | undefined): string; (value: string): number; }; ... 4 more ...; selectColor: (namespace...'. +node_modules/debug/src/common.js(127,28): error TS2339: Property 'init' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: { (value: number, options?: { ...; } | undefined): string; (value: string): number; }; ... 4 more ...; selectColor: (namespace...'. +node_modules/debug/src/common.js(128,19): error TS2339: Property 'init' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: { (value: number, options?: { ...; } | undefined): string; (value: string): number; }; ... 4 more ...; selectColor: (namespace...'. +node_modules/debug/src/common.js(159,17): error TS2339: Property 'save' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: { (value: number, options?: { ...; } | undefined): string; (value: string): number; }; ... 4 more ...; selectColor: (namespace...'. node_modules/debug/src/common.js(230,13): error TS2304: Cannot find name 'Mixed'. node_modules/debug/src/common.js(231,14): error TS2304: Cannot find name 'Mixed'. -node_modules/debug/src/common.js(244,34): error TS2339: Property 'load' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: any; ... 4 more ...; selectColor: (namespace: string) => string | number; }'. +node_modules/debug/src/common.js(244,34): error TS2339: Property 'load' does not exist on type '{ (namespace: string): Function; debug: ...; default: ...; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: { (value: number, options?: { ...; } | undefined): string; (value: string): number; }; ... 4 more ...; selectColor: (namespace...'. node_modules/debug/src/index.js(7,47): error TS2339: Property 'type' does not exist on type 'Process'. node_modules/debug/src/index.js(7,78): error TS2339: Property 'browser' does not exist on type 'Process'. node_modules/debug/src/index.js(7,106): error TS2339: Property '__nwjs' does not exist on type 'Process'. diff --git a/tests/baselines/reference/user/follow-redirects.log b/tests/baselines/reference/user/follow-redirects.log index 7e3f419696e43..a5a924432271e 100644 --- a/tests/baselines/reference/user/follow-redirects.log +++ b/tests/baselines/reference/user/follow-redirects.log @@ -2,12 +2,16 @@ Exit Code: 1 Standard output: node_modules/follow-redirects/index.js(105,10): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'. node_modules/follow-redirects/index.js(106,10): error TS2339: Property 'abort' does not exist on type 'RedirectableRequest'. -node_modules/follow-redirects/index.js(173,10): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'. -node_modules/follow-redirects/index.js(212,16): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'. -node_modules/follow-redirects/index.js(259,12): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'. -node_modules/follow-redirects/index.js(293,35): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. +node_modules/follow-redirects/index.js(153,10): error TS2339: Property 'once' does not exist on type 'RedirectableRequest'. +node_modules/follow-redirects/index.js(156,12): error TS2339: Property 'socket' does not exist on type 'RedirectableRequest'. +node_modules/follow-redirects/index.js(166,8): error TS2339: Property 'once' does not exist on type 'RedirectableRequest'. +node_modules/follow-redirects/index.js(167,8): error TS2339: Property 'once' does not exist on type 'RedirectableRequest'. +node_modules/follow-redirects/index.js(206,10): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'. +node_modules/follow-redirects/index.js(245,16): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'. +node_modules/follow-redirects/index.js(292,12): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'. +node_modules/follow-redirects/index.js(326,35): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'. -node_modules/follow-redirects/index.js(306,10): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'. +node_modules/follow-redirects/index.js(339,10): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'. diff --git a/tests/baselines/reference/user/npm.log b/tests/baselines/reference/user/npm.log index 91a408b91d7c1..525a1007870f2 100644 --- a/tests/baselines/reference/user/npm.log +++ b/tests/baselines/reference/user/npm.log @@ -802,9 +802,9 @@ node_modules/npm/lib/utils/error-handler.js(146,27): error TS2339: Property 'con node_modules/npm/lib/utils/error-handler.js(166,14): error TS2339: Property 'code' does not exist on type 'Error'. node_modules/npm/lib/utils/error-handler.js(167,16): error TS2339: Property 'code' does not exist on type 'Error'. node_modules/npm/lib/utils/error-handler.js(168,8): error TS2339: Property 'code' does not exist on type 'Error'. -node_modules/npm/lib/utils/error-handler.js(186,40): error TS2345: Argument of type '{ (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | ... 1 more ... | undefined): string; }' is not assignable to parameter of type '(value: string, index: number, array: string[]) => string'. +node_modules/npm/lib/utils/error-handler.js(186,40): error TS2345: Argument of type '{ (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | ... 1 more ... | undefined): string; }' is not assignable to parameter of type '(value: string, index: number, array: string[]) => string'. Types of parameters 'replacer' and 'index' are incompatible. - Type 'number' is not assignable to type '((key: string, value: any) => any) | undefined'. + Type 'number' is not assignable to type '((this: any, key: string, value: any) => any) | undefined'. node_modules/npm/lib/utils/error-handler.js(188,33): error TS2339: Property 'version' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/utils/error-handler.js(205,11): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/utils/error-handler.js(208,18): error TS2339: Property 'code' does not exist on type 'Error'. diff --git a/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.errors.txt b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.errors.txt new file mode 100644 index 0000000000000..47f97958f0d53 --- /dev/null +++ b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.errors.txt @@ -0,0 +1,82 @@ +tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts(63,6): error TS2345: Argument of type 'NeededInfo>' is not assignable to parameter of type 'NeededInfo<{}>'. + Types of property 'ASchema' are incompatible. + Type 'ToA>' is not assignable to type 'ToA<{}>'. + Type '{}' is not assignable to type 'ToB<{ initialize: any; }>'. +tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts(66,38): error TS2344: Type 'NeededInfo>' does not satisfy the constraint 'NeededInfo<{}>'. + + +==== tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts (2 errors) ==== + type Either = Left | Right; + + class Left { + readonly _tag: 'Left' = 'Left' + readonly _A!: A + readonly _L!: L + constructor(readonly value: L) {} + /** The given function is applied if this is a `Right` */ + map(f: (a: A) => B): Either { + return this as any + } + ap(fab: Either B>): Either { + return null as any + } + } + + class Right { + readonly _tag: 'Right' = 'Right' + readonly _A!: A + readonly _L!: L + constructor(readonly value: A) {} + map(f: (a: A) => B): Either { + return new Right(f(this.value)) + } + ap(fab: Either B>): Either { + return null as any; + } + } + + class Type { + readonly _A!: A; + readonly _O!: O; + readonly _I!: I; + constructor( + /** a unique name for this codec */ + readonly name: string, + /** a custom type guard */ + readonly is: (u: unknown) => u is A, + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: (input: I, context: {}[]) => Either<{}[], A>, + /** converts a value of type A to a value of type O */ + readonly encode: (a: A) => O + ) {} + /** a version of `validate` with a default context */ + decode(i: I): Either<{}[], A> { return null as any; } + } + + interface Any extends Type {} + + type TypeOf = C["_A"]; + + type ToB = { [k in keyof S]: TypeOf }; + type ToA = { [k in keyof S]: Type }; + + type NeededInfo = { + ASchema: ToA; + }; + + export type MyInfo = NeededInfo>; + + const tmp1: MyInfo = null!; + function tmp2(n: N) {} + tmp2(tmp1); // uncommenting this line removes a type error from a completely unrelated line ?? + ~~~~ +!!! error TS2345: Argument of type 'NeededInfo>' is not assignable to parameter of type 'NeededInfo<{}>'. +!!! error TS2345: Types of property 'ASchema' are incompatible. +!!! error TS2345: Type 'ToA>' is not assignable to type 'ToA<{}>'. +!!! error TS2345: Type '{}' is not assignable to type 'ToB<{ initialize: any; }>'. +!!! related TS2728 tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts:59:39: 'initialize' is declared here. + + class Server {} + export class MyServer extends Server {} // not assignable error at `MyInfo` + ~~~~~~ +!!! error TS2344: Type 'NeededInfo>' does not satisfy the constraint 'NeededInfo<{}>'. \ No newline at end of file diff --git a/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.js b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.js new file mode 100644 index 0000000000000..cbac03d7a82cc --- /dev/null +++ b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.js @@ -0,0 +1,146 @@ +//// [varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts] +type Either = Left | Right; + +class Left { + readonly _tag: 'Left' = 'Left' + readonly _A!: A + readonly _L!: L + constructor(readonly value: L) {} + /** The given function is applied if this is a `Right` */ + map(f: (a: A) => B): Either { + return this as any + } + ap(fab: Either B>): Either { + return null as any + } +} + +class Right { + readonly _tag: 'Right' = 'Right' + readonly _A!: A + readonly _L!: L + constructor(readonly value: A) {} + map(f: (a: A) => B): Either { + return new Right(f(this.value)) + } + ap(fab: Either B>): Either { + return null as any; + } +} + +class Type { + readonly _A!: A; + readonly _O!: O; + readonly _I!: I; + constructor( + /** a unique name for this codec */ + readonly name: string, + /** a custom type guard */ + readonly is: (u: unknown) => u is A, + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: (input: I, context: {}[]) => Either<{}[], A>, + /** converts a value of type A to a value of type O */ + readonly encode: (a: A) => O + ) {} + /** a version of `validate` with a default context */ + decode(i: I): Either<{}[], A> { return null as any; } +} + +interface Any extends Type {} + +type TypeOf = C["_A"]; + +type ToB = { [k in keyof S]: TypeOf }; +type ToA = { [k in keyof S]: Type }; + +type NeededInfo = { + ASchema: ToA; +}; + +export type MyInfo = NeededInfo>; + +const tmp1: MyInfo = null!; +function tmp2(n: N) {} +tmp2(tmp1); // uncommenting this line removes a type error from a completely unrelated line ?? + +class Server {} +export class MyServer extends Server {} // not assignable error at `MyInfo` + +//// [varianceProblingAndZeroOrderIndexSignatureRelationsAlign.js] +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +exports.__esModule = true; +var Left = /** @class */ (function () { + function Left(value) { + this.value = value; + this._tag = 'Left'; + } + /** The given function is applied if this is a `Right` */ + Left.prototype.map = function (f) { + return this; + }; + Left.prototype.ap = function (fab) { + return null; + }; + return Left; +}()); +var Right = /** @class */ (function () { + function Right(value) { + this.value = value; + this._tag = 'Right'; + } + Right.prototype.map = function (f) { + return new Right(f(this.value)); + }; + Right.prototype.ap = function (fab) { + return null; + }; + return Right; +}()); +var Type = /** @class */ (function () { + function Type( + /** a unique name for this codec */ + name, + /** a custom type guard */ + is, + /** succeeds if a value of type I can be decoded to a value of type A */ + validate, + /** converts a value of type A to a value of type O */ + encode) { + this.name = name; + this.is = is; + this.validate = validate; + this.encode = encode; + } + /** a version of `validate` with a default context */ + Type.prototype.decode = function (i) { return null; }; + return Type; +}()); +var tmp1 = null; +function tmp2(n) { } +tmp2(tmp1); // uncommenting this line removes a type error from a completely unrelated line ?? +var Server = /** @class */ (function () { + function Server() { + } + return Server; +}()); +var MyServer = /** @class */ (function (_super) { + __extends(MyServer, _super); + function MyServer() { + return _super !== null && _super.apply(this, arguments) || this; + } + return MyServer; +}(Server)); // not assignable error at `MyInfo` +exports.MyServer = MyServer; diff --git a/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.symbols b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.symbols new file mode 100644 index 0000000000000..bd9792840637a --- /dev/null +++ b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.symbols @@ -0,0 +1,246 @@ +=== tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts === +type Either = Left | Right; +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 0)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 12)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 14)) +>Left : Symbol(Left, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 45)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 12)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 14)) +>Right : Symbol(Right, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 14, 1)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 12)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 14)) + +class Left { +>Left : Symbol(Left, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 45)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 2, 11)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 2, 13)) + + readonly _tag: 'Left' = 'Left' +>_tag : Symbol(Left._tag, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 2, 18)) + + readonly _A!: A +>_A : Symbol(Left._A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 3, 34)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 2, 13)) + + readonly _L!: L +>_L : Symbol(Left._L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 4, 19)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 2, 11)) + + constructor(readonly value: L) {} +>value : Symbol(Left.value, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 6, 16)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 2, 11)) + + /** The given function is applied if this is a `Right` */ + map(f: (a: A) => B): Either { +>map : Symbol(Left.map, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 6, 37)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 8, 8)) +>f : Symbol(f, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 8, 11)) +>a : Symbol(a, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 8, 15)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 2, 13)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 8, 8)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 0)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 2, 11)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 8, 8)) + + return this as any +>this : Symbol(Left, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 45)) + } + ap(fab: Either B>): Either { +>ap : Symbol(Left.ap, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 10, 5)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 11, 7)) +>fab : Symbol(fab, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 11, 10)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 0)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 2, 11)) +>a : Symbol(a, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 11, 26)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 2, 13)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 11, 7)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 0)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 2, 11)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 11, 7)) + + return null as any + } +} + +class Right { +>Right : Symbol(Right, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 14, 1)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 16, 12)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 16, 14)) + + readonly _tag: 'Right' = 'Right' +>_tag : Symbol(Right._tag, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 16, 19)) + + readonly _A!: A +>_A : Symbol(Right._A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 17, 36)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 16, 14)) + + readonly _L!: L +>_L : Symbol(Right._L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 18, 19)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 16, 12)) + + constructor(readonly value: A) {} +>value : Symbol(Right.value, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 20, 16)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 16, 14)) + + map(f: (a: A) => B): Either { +>map : Symbol(Right.map, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 20, 37)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 21, 8)) +>f : Symbol(f, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 21, 11)) +>a : Symbol(a, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 21, 15)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 16, 14)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 21, 8)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 0)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 16, 12)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 21, 8)) + + return new Right(f(this.value)) +>Right : Symbol(Right, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 14, 1)) +>f : Symbol(f, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 21, 11)) +>this.value : Symbol(Right.value, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 20, 16)) +>this : Symbol(Right, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 14, 1)) +>value : Symbol(Right.value, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 20, 16)) + } + ap(fab: Either B>): Either { +>ap : Symbol(Right.ap, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 23, 5)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 24, 7)) +>fab : Symbol(fab, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 24, 10)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 0)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 16, 12)) +>a : Symbol(a, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 24, 26)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 16, 14)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 24, 7)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 0)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 16, 12)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 24, 7)) + + return null as any; + } +} + +class Type { +>Type : Symbol(Type, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 27, 1)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 29, 11)) +>O : Symbol(O, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 29, 13)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 29, 11)) +>I : Symbol(I, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 29, 20)) + + readonly _A!: A; +>_A : Symbol(Type._A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 29, 35)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 29, 11)) + + readonly _O!: O; +>_O : Symbol(Type._O, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 30, 18)) +>O : Symbol(O, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 29, 13)) + + readonly _I!: I; +>_I : Symbol(Type._I, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 31, 18)) +>I : Symbol(I, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 29, 20)) + + constructor( + /** a unique name for this codec */ + readonly name: string, +>name : Symbol(Type.name, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 33, 14)) + + /** a custom type guard */ + readonly is: (u: unknown) => u is A, +>is : Symbol(Type.is, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 35, 26)) +>u : Symbol(u, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 37, 18)) +>u : Symbol(u, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 37, 18)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 29, 11)) + + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: (input: I, context: {}[]) => Either<{}[], A>, +>validate : Symbol(Type.validate, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 37, 40)) +>input : Symbol(input, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 39, 24)) +>I : Symbol(I, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 29, 20)) +>context : Symbol(context, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 39, 33)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 0)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 29, 11)) + + /** converts a value of type A to a value of type O */ + readonly encode: (a: A) => O +>encode : Symbol(Type.encode, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 39, 68)) +>a : Symbol(a, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 41, 22)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 29, 11)) +>O : Symbol(O, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 29, 13)) + + ) {} + /** a version of `validate` with a default context */ + decode(i: I): Either<{}[], A> { return null as any; } +>decode : Symbol(Type.decode, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 42, 6)) +>i : Symbol(i, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 44, 9)) +>I : Symbol(I, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 29, 20)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 0, 0)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 29, 11)) +} + +interface Any extends Type {} +>Any : Symbol(Any, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 45, 1)) +>Type : Symbol(Type, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 27, 1)) + +type TypeOf = C["_A"]; +>TypeOf : Symbol(TypeOf, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 47, 44)) +>C : Symbol(C, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 49, 12)) +>Any : Symbol(Any, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 45, 1)) +>C : Symbol(C, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 49, 12)) + +type ToB = { [k in keyof S]: TypeOf }; +>ToB : Symbol(ToB, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 49, 37)) +>S : Symbol(S, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 51, 9)) +>k : Symbol(k, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 51, 29)) +>S : Symbol(S, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 51, 9)) +>TypeOf : Symbol(TypeOf, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 47, 44)) +>S : Symbol(S, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 51, 9)) +>k : Symbol(k, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 51, 29)) + +type ToA = { [k in keyof S]: Type }; +>ToA : Symbol(ToA, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 51, 59)) +>S : Symbol(S, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 52, 9)) +>k : Symbol(k, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 52, 17)) +>S : Symbol(S, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 52, 9)) +>Type : Symbol(Type, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 27, 1)) +>S : Symbol(S, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 52, 9)) +>k : Symbol(k, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 52, 17)) + +type NeededInfo = { +>NeededInfo : Symbol(NeededInfo, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 52, 45)) +>MyNamespaceSchema : Symbol(MyNamespaceSchema, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 54, 16)) + + ASchema: ToA; +>ASchema : Symbol(ASchema, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 54, 43)) +>ToA : Symbol(ToA, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 51, 59)) +>MyNamespaceSchema : Symbol(MyNamespaceSchema, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 54, 16)) + +}; + +export type MyInfo = NeededInfo>; +>MyInfo : Symbol(MyInfo, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 56, 2)) +>NeededInfo : Symbol(NeededInfo, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 52, 45)) +>ToB : Symbol(ToB, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 49, 37)) +>initialize : Symbol(initialize, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 58, 37)) + +const tmp1: MyInfo = null!; +>tmp1 : Symbol(tmp1, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 60, 5)) +>MyInfo : Symbol(MyInfo, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 56, 2)) + +function tmp2(n: N) {} +>tmp2 : Symbol(tmp2, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 60, 27)) +>N : Symbol(N, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 61, 14)) +>NeededInfo : Symbol(NeededInfo, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 52, 45)) +>n : Symbol(n, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 61, 36)) +>N : Symbol(N, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 61, 14)) + +tmp2(tmp1); // uncommenting this line removes a type error from a completely unrelated line ?? +>tmp2 : Symbol(tmp2, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 60, 27)) +>tmp1 : Symbol(tmp1, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 60, 5)) + +class Server {} +>Server : Symbol(Server, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 62, 11)) +>X : Symbol(X, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 64, 13)) +>NeededInfo : Symbol(NeededInfo, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 52, 45)) + +export class MyServer extends Server {} // not assignable error at `MyInfo` +>MyServer : Symbol(MyServer, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 64, 37)) +>Server : Symbol(Server, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 62, 11)) +>MyInfo : Symbol(MyInfo, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts, 56, 2)) + diff --git a/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.types b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.types new file mode 100644 index 0000000000000..d360372d5aaee --- /dev/null +++ b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.types @@ -0,0 +1,168 @@ +=== tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts === +type Either = Left | Right; +>Either : Either + +class Left { +>Left : Left + + readonly _tag: 'Left' = 'Left' +>_tag : "Left" +>'Left' : "Left" + + readonly _A!: A +>_A : A + + readonly _L!: L +>_L : L + + constructor(readonly value: L) {} +>value : L + + /** The given function is applied if this is a `Right` */ + map(f: (a: A) => B): Either { +>map : (f: (a: A) => B) => Either +>f : (a: A) => B +>a : A + + return this as any +>this as any : any +>this : this + } + ap(fab: Either B>): Either { +>ap : (fab: Either B>) => Either +>fab : Either B> +>a : A + + return null as any +>null as any : any +>null : null + } +} + +class Right { +>Right : Right + + readonly _tag: 'Right' = 'Right' +>_tag : "Right" +>'Right' : "Right" + + readonly _A!: A +>_A : A + + readonly _L!: L +>_L : L + + constructor(readonly value: A) {} +>value : A + + map(f: (a: A) => B): Either { +>map : (f: (a: A) => B) => Either +>f : (a: A) => B +>a : A + + return new Right(f(this.value)) +>new Right(f(this.value)) : Right +>Right : typeof Right +>f(this.value) : B +>f : (a: A) => B +>this.value : A +>this : this +>value : A + } + ap(fab: Either B>): Either { +>ap : (fab: Either B>) => Either +>fab : Either B> +>a : A + + return null as any; +>null as any : any +>null : null + } +} + +class Type { +>Type : Type + + readonly _A!: A; +>_A : A + + readonly _O!: O; +>_O : O + + readonly _I!: I; +>_I : I + + constructor( + /** a unique name for this codec */ + readonly name: string, +>name : string + + /** a custom type guard */ + readonly is: (u: unknown) => u is A, +>is : (u: unknown) => u is A +>u : unknown + + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: (input: I, context: {}[]) => Either<{}[], A>, +>validate : (input: I, context: {}[]) => Either<{}[], A> +>input : I +>context : {}[] + + /** converts a value of type A to a value of type O */ + readonly encode: (a: A) => O +>encode : (a: A) => O +>a : A + + ) {} + /** a version of `validate` with a default context */ + decode(i: I): Either<{}[], A> { return null as any; } +>decode : (i: I) => Either<{}[], A> +>i : I +>null as any : any +>null : null +} + +interface Any extends Type {} + +type TypeOf = C["_A"]; +>TypeOf : C["_A"] + +type ToB = { [k in keyof S]: TypeOf }; +>ToB : ToB + +type ToA = { [k in keyof S]: Type }; +>ToA : ToA + +type NeededInfo = { +>NeededInfo : NeededInfo + + ASchema: ToA; +>ASchema : ToA + +}; + +export type MyInfo = NeededInfo>; +>MyInfo : NeededInfo> +>initialize : any + +const tmp1: MyInfo = null!; +>tmp1 : NeededInfo> +>null! : never +>null : null + +function tmp2(n: N) {} +>tmp2 : >(n: N) => void +>n : N + +tmp2(tmp1); // uncommenting this line removes a type error from a completely unrelated line ?? +>tmp2(tmp1) : any +>tmp2 : >(n: N) => void +>tmp1 : NeededInfo> + +class Server {} +>Server : Server + +export class MyServer extends Server {} // not assignable error at `MyInfo` +>MyServer : MyServer +>Server : Server>> + diff --git a/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.errors.txt b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.errors.txt new file mode 100644 index 0000000000000..aba1bc1db66d9 --- /dev/null +++ b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.errors.txt @@ -0,0 +1,79 @@ +tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts(66,38): error TS2344: Type 'NeededInfo>' does not satisfy the constraint 'NeededInfo<{}>'. + Types of property 'ASchema' are incompatible. + Type 'ToA>' is not assignable to type 'ToA<{}>'. + Type '{}' is not assignable to type 'ToB<{ initialize: any; }>'. + + +==== tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts (1 errors) ==== + type Either = Left | Right; + + class Left { + readonly _tag: 'Left' = 'Left' + readonly _A!: A + readonly _L!: L + constructor(readonly value: L) {} + /** The given function is applied if this is a `Right` */ + map(f: (a: A) => B): Either { + return this as any + } + ap(fab: Either B>): Either { + return null as any + } + } + + class Right { + readonly _tag: 'Right' = 'Right' + readonly _A!: A + readonly _L!: L + constructor(readonly value: A) {} + map(f: (a: A) => B): Either { + return new Right(f(this.value)) + } + ap(fab: Either B>): Either { + return null as any; + } + } + + class Type { + readonly _A!: A; + readonly _O!: O; + readonly _I!: I; + constructor( + /** a unique name for this codec */ + readonly name: string, + /** a custom type guard */ + readonly is: (u: unknown) => u is A, + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: (input: I, context: {}[]) => Either<{}[], A>, + /** converts a value of type A to a value of type O */ + readonly encode: (a: A) => O + ) {} + /** a version of `validate` with a default context */ + decode(i: I): Either<{}[], A> { return null as any; } + } + + interface Any extends Type {} + + type TypeOf = C["_A"]; + + type ToB = { [k in keyof S]: TypeOf }; + type ToA = { [k in keyof S]: Type }; + + type NeededInfo = { + ASchema: ToA; + }; + + export type MyInfo = NeededInfo>; + + const tmp1: MyInfo = null!; + function tmp2(n: N) {} + // tmp2(tmp1); // uncommenting this line removes a type error from a completely unrelated line ?? (see test 1, needs to behave the same) + + class Server {} + export class MyServer extends Server {} // not assignable error at `MyInfo` + ~~~~~~ +!!! error TS2344: Type 'NeededInfo>' does not satisfy the constraint 'NeededInfo<{}>'. +!!! error TS2344: Types of property 'ASchema' are incompatible. +!!! error TS2344: Type 'ToA>' is not assignable to type 'ToA<{}>'. +!!! error TS2344: Type '{}' is not assignable to type 'ToB<{ initialize: any; }>'. +!!! related TS2728 tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts:59:39: 'initialize' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.js b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.js new file mode 100644 index 0000000000000..8a4340ada95a6 --- /dev/null +++ b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.js @@ -0,0 +1,146 @@ +//// [varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts] +type Either = Left | Right; + +class Left { + readonly _tag: 'Left' = 'Left' + readonly _A!: A + readonly _L!: L + constructor(readonly value: L) {} + /** The given function is applied if this is a `Right` */ + map(f: (a: A) => B): Either { + return this as any + } + ap(fab: Either B>): Either { + return null as any + } +} + +class Right { + readonly _tag: 'Right' = 'Right' + readonly _A!: A + readonly _L!: L + constructor(readonly value: A) {} + map(f: (a: A) => B): Either { + return new Right(f(this.value)) + } + ap(fab: Either B>): Either { + return null as any; + } +} + +class Type { + readonly _A!: A; + readonly _O!: O; + readonly _I!: I; + constructor( + /** a unique name for this codec */ + readonly name: string, + /** a custom type guard */ + readonly is: (u: unknown) => u is A, + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: (input: I, context: {}[]) => Either<{}[], A>, + /** converts a value of type A to a value of type O */ + readonly encode: (a: A) => O + ) {} + /** a version of `validate` with a default context */ + decode(i: I): Either<{}[], A> { return null as any; } +} + +interface Any extends Type {} + +type TypeOf = C["_A"]; + +type ToB = { [k in keyof S]: TypeOf }; +type ToA = { [k in keyof S]: Type }; + +type NeededInfo = { + ASchema: ToA; +}; + +export type MyInfo = NeededInfo>; + +const tmp1: MyInfo = null!; +function tmp2(n: N) {} +// tmp2(tmp1); // uncommenting this line removes a type error from a completely unrelated line ?? (see test 1, needs to behave the same) + +class Server {} +export class MyServer extends Server {} // not assignable error at `MyInfo` + +//// [varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.js] +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +exports.__esModule = true; +var Left = /** @class */ (function () { + function Left(value) { + this.value = value; + this._tag = 'Left'; + } + /** The given function is applied if this is a `Right` */ + Left.prototype.map = function (f) { + return this; + }; + Left.prototype.ap = function (fab) { + return null; + }; + return Left; +}()); +var Right = /** @class */ (function () { + function Right(value) { + this.value = value; + this._tag = 'Right'; + } + Right.prototype.map = function (f) { + return new Right(f(this.value)); + }; + Right.prototype.ap = function (fab) { + return null; + }; + return Right; +}()); +var Type = /** @class */ (function () { + function Type( + /** a unique name for this codec */ + name, + /** a custom type guard */ + is, + /** succeeds if a value of type I can be decoded to a value of type A */ + validate, + /** converts a value of type A to a value of type O */ + encode) { + this.name = name; + this.is = is; + this.validate = validate; + this.encode = encode; + } + /** a version of `validate` with a default context */ + Type.prototype.decode = function (i) { return null; }; + return Type; +}()); +var tmp1 = null; +function tmp2(n) { } +// tmp2(tmp1); // uncommenting this line removes a type error from a completely unrelated line ?? (see test 1, needs to behave the same) +var Server = /** @class */ (function () { + function Server() { + } + return Server; +}()); +var MyServer = /** @class */ (function (_super) { + __extends(MyServer, _super); + function MyServer() { + return _super !== null && _super.apply(this, arguments) || this; + } + return MyServer; +}(Server)); // not assignable error at `MyInfo` +exports.MyServer = MyServer; diff --git a/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.symbols b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.symbols new file mode 100644 index 0000000000000..6d8983bd953d4 --- /dev/null +++ b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.symbols @@ -0,0 +1,244 @@ +=== tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts === +type Either = Left | Right; +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 0)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 12)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 14)) +>Left : Symbol(Left, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 45)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 12)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 14)) +>Right : Symbol(Right, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 14, 1)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 12)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 14)) + +class Left { +>Left : Symbol(Left, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 45)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 2, 11)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 2, 13)) + + readonly _tag: 'Left' = 'Left' +>_tag : Symbol(Left._tag, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 2, 18)) + + readonly _A!: A +>_A : Symbol(Left._A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 3, 34)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 2, 13)) + + readonly _L!: L +>_L : Symbol(Left._L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 4, 19)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 2, 11)) + + constructor(readonly value: L) {} +>value : Symbol(Left.value, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 6, 16)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 2, 11)) + + /** The given function is applied if this is a `Right` */ + map(f: (a: A) => B): Either { +>map : Symbol(Left.map, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 6, 37)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 8, 8)) +>f : Symbol(f, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 8, 11)) +>a : Symbol(a, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 8, 15)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 2, 13)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 8, 8)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 0)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 2, 11)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 8, 8)) + + return this as any +>this : Symbol(Left, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 45)) + } + ap(fab: Either B>): Either { +>ap : Symbol(Left.ap, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 10, 5)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 11, 7)) +>fab : Symbol(fab, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 11, 10)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 0)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 2, 11)) +>a : Symbol(a, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 11, 26)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 2, 13)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 11, 7)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 0)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 2, 11)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 11, 7)) + + return null as any + } +} + +class Right { +>Right : Symbol(Right, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 14, 1)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 16, 12)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 16, 14)) + + readonly _tag: 'Right' = 'Right' +>_tag : Symbol(Right._tag, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 16, 19)) + + readonly _A!: A +>_A : Symbol(Right._A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 17, 36)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 16, 14)) + + readonly _L!: L +>_L : Symbol(Right._L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 18, 19)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 16, 12)) + + constructor(readonly value: A) {} +>value : Symbol(Right.value, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 20, 16)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 16, 14)) + + map(f: (a: A) => B): Either { +>map : Symbol(Right.map, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 20, 37)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 21, 8)) +>f : Symbol(f, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 21, 11)) +>a : Symbol(a, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 21, 15)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 16, 14)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 21, 8)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 0)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 16, 12)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 21, 8)) + + return new Right(f(this.value)) +>Right : Symbol(Right, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 14, 1)) +>f : Symbol(f, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 21, 11)) +>this.value : Symbol(Right.value, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 20, 16)) +>this : Symbol(Right, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 14, 1)) +>value : Symbol(Right.value, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 20, 16)) + } + ap(fab: Either B>): Either { +>ap : Symbol(Right.ap, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 23, 5)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 24, 7)) +>fab : Symbol(fab, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 24, 10)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 0)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 16, 12)) +>a : Symbol(a, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 24, 26)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 16, 14)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 24, 7)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 0)) +>L : Symbol(L, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 16, 12)) +>B : Symbol(B, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 24, 7)) + + return null as any; + } +} + +class Type { +>Type : Symbol(Type, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 27, 1)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 29, 11)) +>O : Symbol(O, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 29, 13)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 29, 11)) +>I : Symbol(I, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 29, 20)) + + readonly _A!: A; +>_A : Symbol(Type._A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 29, 35)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 29, 11)) + + readonly _O!: O; +>_O : Symbol(Type._O, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 30, 18)) +>O : Symbol(O, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 29, 13)) + + readonly _I!: I; +>_I : Symbol(Type._I, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 31, 18)) +>I : Symbol(I, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 29, 20)) + + constructor( + /** a unique name for this codec */ + readonly name: string, +>name : Symbol(Type.name, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 33, 14)) + + /** a custom type guard */ + readonly is: (u: unknown) => u is A, +>is : Symbol(Type.is, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 35, 26)) +>u : Symbol(u, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 37, 18)) +>u : Symbol(u, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 37, 18)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 29, 11)) + + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: (input: I, context: {}[]) => Either<{}[], A>, +>validate : Symbol(Type.validate, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 37, 40)) +>input : Symbol(input, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 39, 24)) +>I : Symbol(I, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 29, 20)) +>context : Symbol(context, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 39, 33)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 0)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 29, 11)) + + /** converts a value of type A to a value of type O */ + readonly encode: (a: A) => O +>encode : Symbol(Type.encode, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 39, 68)) +>a : Symbol(a, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 41, 22)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 29, 11)) +>O : Symbol(O, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 29, 13)) + + ) {} + /** a version of `validate` with a default context */ + decode(i: I): Either<{}[], A> { return null as any; } +>decode : Symbol(Type.decode, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 42, 6)) +>i : Symbol(i, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 44, 9)) +>I : Symbol(I, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 29, 20)) +>Either : Symbol(Either, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 0, 0)) +>A : Symbol(A, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 29, 11)) +} + +interface Any extends Type {} +>Any : Symbol(Any, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 45, 1)) +>Type : Symbol(Type, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 27, 1)) + +type TypeOf = C["_A"]; +>TypeOf : Symbol(TypeOf, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 47, 44)) +>C : Symbol(C, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 49, 12)) +>Any : Symbol(Any, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 45, 1)) +>C : Symbol(C, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 49, 12)) + +type ToB = { [k in keyof S]: TypeOf }; +>ToB : Symbol(ToB, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 49, 37)) +>S : Symbol(S, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 51, 9)) +>k : Symbol(k, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 51, 29)) +>S : Symbol(S, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 51, 9)) +>TypeOf : Symbol(TypeOf, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 47, 44)) +>S : Symbol(S, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 51, 9)) +>k : Symbol(k, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 51, 29)) + +type ToA = { [k in keyof S]: Type }; +>ToA : Symbol(ToA, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 51, 59)) +>S : Symbol(S, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 52, 9)) +>k : Symbol(k, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 52, 17)) +>S : Symbol(S, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 52, 9)) +>Type : Symbol(Type, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 27, 1)) +>S : Symbol(S, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 52, 9)) +>k : Symbol(k, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 52, 17)) + +type NeededInfo = { +>NeededInfo : Symbol(NeededInfo, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 52, 45)) +>MyNamespaceSchema : Symbol(MyNamespaceSchema, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 54, 16)) + + ASchema: ToA; +>ASchema : Symbol(ASchema, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 54, 43)) +>ToA : Symbol(ToA, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 51, 59)) +>MyNamespaceSchema : Symbol(MyNamespaceSchema, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 54, 16)) + +}; + +export type MyInfo = NeededInfo>; +>MyInfo : Symbol(MyInfo, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 56, 2)) +>NeededInfo : Symbol(NeededInfo, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 52, 45)) +>ToB : Symbol(ToB, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 49, 37)) +>initialize : Symbol(initialize, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 58, 37)) + +const tmp1: MyInfo = null!; +>tmp1 : Symbol(tmp1, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 60, 5)) +>MyInfo : Symbol(MyInfo, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 56, 2)) + +function tmp2(n: N) {} +>tmp2 : Symbol(tmp2, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 60, 27)) +>N : Symbol(N, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 61, 14)) +>NeededInfo : Symbol(NeededInfo, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 52, 45)) +>n : Symbol(n, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 61, 36)) +>N : Symbol(N, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 61, 14)) + +// tmp2(tmp1); // uncommenting this line removes a type error from a completely unrelated line ?? (see test 1, needs to behave the same) + +class Server {} +>Server : Symbol(Server, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 61, 44)) +>X : Symbol(X, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 64, 13)) +>NeededInfo : Symbol(NeededInfo, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 52, 45)) + +export class MyServer extends Server {} // not assignable error at `MyInfo` +>MyServer : Symbol(MyServer, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 64, 37)) +>Server : Symbol(Server, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 61, 44)) +>MyInfo : Symbol(MyInfo, Decl(varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts, 56, 2)) + diff --git a/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.types b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.types new file mode 100644 index 0000000000000..02a69f2fab0a5 --- /dev/null +++ b/tests/baselines/reference/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.types @@ -0,0 +1,165 @@ +=== tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts === +type Either = Left | Right; +>Either : Either + +class Left { +>Left : Left + + readonly _tag: 'Left' = 'Left' +>_tag : "Left" +>'Left' : "Left" + + readonly _A!: A +>_A : A + + readonly _L!: L +>_L : L + + constructor(readonly value: L) {} +>value : L + + /** The given function is applied if this is a `Right` */ + map(f: (a: A) => B): Either { +>map : (f: (a: A) => B) => Either +>f : (a: A) => B +>a : A + + return this as any +>this as any : any +>this : this + } + ap(fab: Either B>): Either { +>ap : (fab: Either B>) => Either +>fab : Either B> +>a : A + + return null as any +>null as any : any +>null : null + } +} + +class Right { +>Right : Right + + readonly _tag: 'Right' = 'Right' +>_tag : "Right" +>'Right' : "Right" + + readonly _A!: A +>_A : A + + readonly _L!: L +>_L : L + + constructor(readonly value: A) {} +>value : A + + map(f: (a: A) => B): Either { +>map : (f: (a: A) => B) => Either +>f : (a: A) => B +>a : A + + return new Right(f(this.value)) +>new Right(f(this.value)) : Right +>Right : typeof Right +>f(this.value) : B +>f : (a: A) => B +>this.value : A +>this : this +>value : A + } + ap(fab: Either B>): Either { +>ap : (fab: Either B>) => Either +>fab : Either B> +>a : A + + return null as any; +>null as any : any +>null : null + } +} + +class Type { +>Type : Type + + readonly _A!: A; +>_A : A + + readonly _O!: O; +>_O : O + + readonly _I!: I; +>_I : I + + constructor( + /** a unique name for this codec */ + readonly name: string, +>name : string + + /** a custom type guard */ + readonly is: (u: unknown) => u is A, +>is : (u: unknown) => u is A +>u : unknown + + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: (input: I, context: {}[]) => Either<{}[], A>, +>validate : (input: I, context: {}[]) => Either<{}[], A> +>input : I +>context : {}[] + + /** converts a value of type A to a value of type O */ + readonly encode: (a: A) => O +>encode : (a: A) => O +>a : A + + ) {} + /** a version of `validate` with a default context */ + decode(i: I): Either<{}[], A> { return null as any; } +>decode : (i: I) => Either<{}[], A> +>i : I +>null as any : any +>null : null +} + +interface Any extends Type {} + +type TypeOf = C["_A"]; +>TypeOf : C["_A"] + +type ToB = { [k in keyof S]: TypeOf }; +>ToB : ToB + +type ToA = { [k in keyof S]: Type }; +>ToA : ToA + +type NeededInfo = { +>NeededInfo : NeededInfo + + ASchema: ToA; +>ASchema : ToA + +}; + +export type MyInfo = NeededInfo>; +>MyInfo : NeededInfo> +>initialize : any + +const tmp1: MyInfo = null!; +>tmp1 : NeededInfo> +>null! : never +>null : null + +function tmp2(n: N) {} +>tmp2 : >(n: N) => void +>n : N + +// tmp2(tmp1); // uncommenting this line removes a type error from a completely unrelated line ?? (see test 1, needs to behave the same) + +class Server {} +>Server : Server + +export class MyServer extends Server {} // not assignable error at `MyInfo` +>MyServer : MyServer +>Server : Server>> + diff --git a/tests/baselines/reference/voidAsNonAmbiguousReturnType.errors.txt b/tests/baselines/reference/voidAsNonAmbiguousReturnType.errors.txt index ce8b52f316c9e..09dfef337b2d9 100644 --- a/tests/baselines/reference/voidAsNonAmbiguousReturnType.errors.txt +++ b/tests/baselines/reference/voidAsNonAmbiguousReturnType.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/voidAsNonAmbiguousReturnType_0.ts(1,17): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/voidAsNonAmbiguousReturnType_0.ts(1,17): error TS2394: This overload signature is not compatible with its implementation signature. ==== tests/cases/compiler/voidAsNonAmbiguousReturnType_1.ts (0 errors) ==== @@ -12,6 +12,7 @@ tests/cases/compiler/voidAsNonAmbiguousReturnType_0.ts(1,17): error TS2394: Over ==== tests/cases/compiler/voidAsNonAmbiguousReturnType_0.ts (1 errors) ==== export function mkdirSync(path: string, mode?: number): void; ~~~~~~~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. +!!! error TS2394: This overload signature is not compatible with its implementation signature. +!!! related TS2750 tests/cases/compiler/voidAsNonAmbiguousReturnType_0.ts:2:17: The implementation signature is declared here. export function mkdirSync(path: string, mode?: string): void {} \ No newline at end of file diff --git a/tests/cases/compiler/conditionalTypeRelaxingConstraintAssignability.ts b/tests/cases/compiler/conditionalTypeRelaxingConstraintAssignability.ts new file mode 100644 index 0000000000000..2f18e464e3b1d --- /dev/null +++ b/tests/cases/compiler/conditionalTypeRelaxingConstraintAssignability.ts @@ -0,0 +1,24 @@ +// @strict: true +export type ElChildren = + | ElChildren.Void + | ElChildren.Text; +export namespace ElChildren { + export type Void = undefined; + export type Text = string; +} + +type Relax = C extends ElChildren.Text ? ElChildren.Text : C; + +export class Elem< + C extends ElChildren, + > { + constructor( + private children_: Relax, + ) { + } +} + +new Elem(undefined as ElChildren.Void); +new Elem('' as ElChildren.Text); +new Elem('' as ElChildren.Void | ElChildren.Text); // error +new Elem('' as ElChildren); // error \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmitExpandoPropertyPrivateName.ts b/tests/cases/compiler/declarationEmitExpandoPropertyPrivateName.ts new file mode 100644 index 0000000000000..09be2a08ff89b --- /dev/null +++ b/tests/cases/compiler/declarationEmitExpandoPropertyPrivateName.ts @@ -0,0 +1,9 @@ +// @declaration: true +// @filename: a.ts +interface I {} +export function f(): I { return null as I; } +// @filename: b.ts +import {f} from "./a"; + +export function q() {} +q.val = f(); diff --git a/tests/cases/compiler/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts b/tests/cases/compiler/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts new file mode 100644 index 0000000000000..3638ae796a77d --- /dev/null +++ b/tests/cases/compiler/emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts @@ -0,0 +1,42 @@ +// This should behave the same as emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts +// Begin types from Lodash. +interface Dictionary { + [index: string]: T; +} + +interface NumericDictionary { + [index: number]: T; +} + +type ObjectIterator = ( + value: TObject[keyof TObject], + key: string, + collection: TObject +) => TResult; + +type DictionaryIterator = ObjectIterator, TResult>; + +// In lodash.d.ts this function has many overloads, but this seems to be the problematic one. +function mapValues( + obj: Dictionary | NumericDictionary | null | undefined, + callback: DictionaryIterator +): Dictionary { + return null as any; +} +// End types from Lodash. + +interface Foo { + foo: string; +} + +interface Bar { + bar: string; +} + +export function fooToBar( + foos: Record +): Record { + const result = foos == null ? {} : mapValues(foos, f => f.foo); + // This line _should_ fail, because `result` is not the right type. + return result; +} diff --git a/tests/cases/compiler/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts b/tests/cases/compiler/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts new file mode 100644 index 0000000000000..3c59e141b304d --- /dev/null +++ b/tests/cases/compiler/emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts @@ -0,0 +1,43 @@ +// This should behave the same as emptyObjectNotSubtypeOfIndexSignatureContainingObject1.ts +// Begin types from Lodash. +interface Dictionary { + [index: string]: T; +} + +interface NumericDictionary { + [index: number]: T; +} + +type ObjectIterator = ( + value: TObject[keyof TObject], + key: string, + collection: TObject +) => TResult; + +type DictionaryIterator = ObjectIterator, TResult>; + +// In lodash.d.ts this function has many overloads, but this seems to be the problematic one. +function mapValues( + obj: Dictionary | NumericDictionary | null | undefined, + callback: DictionaryIterator +): Dictionary { + return null as any; +} +// End types from Lodash. + +interface Foo { + foo: string; +} + +interface Bar { + bar: string; +} + +export function fooToBar( + foos: Record +): Record { + const wat = mapValues(foos, f => f.foo); + const result = foos == null ? {} : mapValues(foos, f => f.foo); + // This line _should_ fail, because `result` is not the right type. + return result; +} diff --git a/tests/cases/compiler/inlinedAliasAssignableToConstraintSameAsAlias.ts b/tests/cases/compiler/inlinedAliasAssignableToConstraintSameAsAlias.ts new file mode 100644 index 0000000000000..165ec0dc17e16 --- /dev/null +++ b/tests/cases/compiler/inlinedAliasAssignableToConstraintSameAsAlias.ts @@ -0,0 +1,24 @@ +interface RelationFields { + x: A; + y: A[]; + z: A[]; +} +type Name = keyof RelationFields; +type ShouldA = RF[N] extends A[] + ? RF[N][0] + : never; + +class A { + x: A; + y: A[]; + z: A[]; + + whereRelated< // Works // Type is same as A1, but is not assignable to type A + RF extends RelationFields = RelationFields, + N extends Name = Name, + A1 extends A = RF[N] extends A[] ? RF[N][0] : never, + A2 extends A = ShouldA + >(): number { + return 1; + } +} diff --git a/tests/cases/compiler/jqueryInference.ts b/tests/cases/compiler/jqueryInference.ts index 6016591625789..5784638e453ba 100644 --- a/tests/cases/compiler/jqueryInference.ts +++ b/tests/cases/compiler/jqueryInference.ts @@ -10,4 +10,4 @@ declare function shouldBeIdentity(p: DoNothingAlias): MyPromise; var p2 = shouldBeIdentity(p1); -var p2: MyPromise; +var p2: MyPromise; diff --git a/tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts b/tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts new file mode 100644 index 0000000000000..c84abda5e5617 --- /dev/null +++ b/tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign.ts @@ -0,0 +1,67 @@ +// @strict: true +type Either = Left | Right; + +class Left { + readonly _tag: 'Left' = 'Left' + readonly _A!: A + readonly _L!: L + constructor(readonly value: L) {} + /** The given function is applied if this is a `Right` */ + map(f: (a: A) => B): Either { + return this as any + } + ap(fab: Either B>): Either { + return null as any + } +} + +class Right { + readonly _tag: 'Right' = 'Right' + readonly _A!: A + readonly _L!: L + constructor(readonly value: A) {} + map(f: (a: A) => B): Either { + return new Right(f(this.value)) + } + ap(fab: Either B>): Either { + return null as any; + } +} + +class Type { + readonly _A!: A; + readonly _O!: O; + readonly _I!: I; + constructor( + /** a unique name for this codec */ + readonly name: string, + /** a custom type guard */ + readonly is: (u: unknown) => u is A, + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: (input: I, context: {}[]) => Either<{}[], A>, + /** converts a value of type A to a value of type O */ + readonly encode: (a: A) => O + ) {} + /** a version of `validate` with a default context */ + decode(i: I): Either<{}[], A> { return null as any; } +} + +interface Any extends Type {} + +type TypeOf = C["_A"]; + +type ToB = { [k in keyof S]: TypeOf }; +type ToA = { [k in keyof S]: Type }; + +type NeededInfo = { + ASchema: ToA; +}; + +export type MyInfo = NeededInfo>; + +const tmp1: MyInfo = null!; +function tmp2(n: N) {} +tmp2(tmp1); // uncommenting this line removes a type error from a completely unrelated line ?? + +class Server {} +export class MyServer extends Server {} // not assignable error at `MyInfo` \ No newline at end of file diff --git a/tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts b/tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts new file mode 100644 index 0000000000000..14d835e618595 --- /dev/null +++ b/tests/cases/compiler/varianceProblingAndZeroOrderIndexSignatureRelationsAlign2.ts @@ -0,0 +1,67 @@ +// @strict: true +type Either = Left | Right; + +class Left { + readonly _tag: 'Left' = 'Left' + readonly _A!: A + readonly _L!: L + constructor(readonly value: L) {} + /** The given function is applied if this is a `Right` */ + map(f: (a: A) => B): Either { + return this as any + } + ap(fab: Either B>): Either { + return null as any + } +} + +class Right { + readonly _tag: 'Right' = 'Right' + readonly _A!: A + readonly _L!: L + constructor(readonly value: A) {} + map(f: (a: A) => B): Either { + return new Right(f(this.value)) + } + ap(fab: Either B>): Either { + return null as any; + } +} + +class Type { + readonly _A!: A; + readonly _O!: O; + readonly _I!: I; + constructor( + /** a unique name for this codec */ + readonly name: string, + /** a custom type guard */ + readonly is: (u: unknown) => u is A, + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: (input: I, context: {}[]) => Either<{}[], A>, + /** converts a value of type A to a value of type O */ + readonly encode: (a: A) => O + ) {} + /** a version of `validate` with a default context */ + decode(i: I): Either<{}[], A> { return null as any; } +} + +interface Any extends Type {} + +type TypeOf = C["_A"]; + +type ToB = { [k in keyof S]: TypeOf }; +type ToA = { [k in keyof S]: Type }; + +type NeededInfo = { + ASchema: ToA; +}; + +export type MyInfo = NeededInfo>; + +const tmp1: MyInfo = null!; +function tmp2(n: N) {} +// tmp2(tmp1); // uncommenting this line removes a type error from a completely unrelated line ?? (see test 1, needs to behave the same) + +class Server {} +export class MyServer extends Server {} // not assignable error at `MyInfo` \ No newline at end of file diff --git a/tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts b/tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts index 14bb765a84011..031cf840d33f4 100644 --- a/tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts +++ b/tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts @@ -152,4 +152,31 @@ var g2 = applySpec({ foo: { bar: { baz: (x: any) => true } } }); const foo = (object: T, partial: Partial) => object; let o = {a: 5, b: 7}; foo(o, {b: 9}); -o = foo(o, {b: 9}); \ No newline at end of file +o = foo(o, {b: 9}); + +// Inferring to { [P in K]: X }, where K extends keyof T, produces same inferences as +// inferring to { [P in keyof T]: X }. + +declare function f20(obj: Pick): T; +declare function f21(obj: Pick): K; +declare function f22(obj: Boxified>): T; +declare function f23(obj: Pick): T; +declare function f24(obj: Pick): T & U; + +let x0 = f20({ foo: 42, bar: "hello" }); +let x1 = f21({ foo: 42, bar: "hello" }); +let x2 = f22({ foo: { value: 42} , bar: { value: "hello" } }); +let x3 = f23({ foo: 42, bar: "hello" }); +let x4 = f24({ foo: 42, bar: "hello" }); + +// Repro from #29765 + +function getProps(obj: T, list: K[]): Pick { + return {} as any; +} + +const myAny: any = {}; + +const o1 = getProps(myAny, ['foo', 'bar']); + +const o2: { foo: any; bar: any } = getProps(myAny, ['foo', 'bar']); diff --git a/tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts b/tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts index 84bf81195b0b1..d5623a000a20d 100644 --- a/tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts +++ b/tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts @@ -70,3 +70,17 @@ declare function take(cb: (a: number, b: string) => void): void; (function foo(...rest){}(1, '')); take(function(...rest){}); + +// Repro from #29833 + +type ArgsUnion = [number, string] | [number, Error]; +type TupleUnionFunc = (...params: ArgsUnion) => number; + +const funcUnionTupleNoRest: TupleUnionFunc = (num, strOrErr) => { + return num; +}; + +const funcUnionTupleRest: TupleUnionFunc = (...params) => { + const [num, strOrErr] = params; + return num; +}; diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference1.ts b/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference1.ts index 7066c3e679084..d4c7d25615e46 100644 --- a/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference1.ts +++ b/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference1.ts @@ -1,3 +1,5 @@ +// @target: es2015 + // Repro from #2264 interface Y { 'i am a very certain type': Y } @@ -70,3 +72,21 @@ declare var mbp: Man & Bear; pigify(mbp).oinks; // OK, mbp is treated as Pig pigify(mbp).walks; // Ok, mbp is treated as Man + +// Repros from #29815 + +interface ITest { + name: 'test' +} + +const createTestAsync = (): Promise => Promise.resolve().then(() => ({ name: 'test' })) + +const createTest = (): ITest => { + return { name: 'test' } +} + +declare function f1(x: T | U): T | U; +declare function f2(x: T & U): T & U; + +let x1: string = f1('a'); +let x2: string = f2('a'); diff --git a/tests/cases/fourslash/codeFixAddMissingMember9.ts b/tests/cases/fourslash/codeFixAddMissingMember9.ts index b583cd28e9ad5..e22e854c2e51a 100644 --- a/tests/cases/fourslash/codeFixAddMissingMember9.ts +++ b/tests/cases/fourslash/codeFixAddMissingMember9.ts @@ -18,7 +18,7 @@ verify.codeFixAll({ const x = 0; this.y(x, "a", this.z); } - y(x: number, arg1: string, z: boolean): any { + y(x: number, arg1: string, z: boolean) { throw new Error("Method not implemented."); } }`, diff --git a/tests/cases/fourslash/codeFixAddMissingMember_all.ts b/tests/cases/fourslash/codeFixAddMissingMember_all.ts index 6c7076dd341a8..9c0c86f282dcf 100644 --- a/tests/cases/fourslash/codeFixAddMissingMember_all.ts +++ b/tests/cases/fourslash/codeFixAddMissingMember_all.ts @@ -36,7 +36,7 @@ verify.codeFixAll({ this.y(); this.x = ""; } - y(): any { + y() { throw new Error("Method not implemented."); } } diff --git a/tests/cases/fourslash/codeFixAddMissingMember_generator_function.ts b/tests/cases/fourslash/codeFixAddMissingMember_generator_function.ts index 6742cc43348dd..ad0bd7b47cad5 100644 --- a/tests/cases/fourslash/codeFixAddMissingMember_generator_function.ts +++ b/tests/cases/fourslash/codeFixAddMissingMember_generator_function.ts @@ -14,7 +14,7 @@ verify.codeFixAll({ *method() { yield* this.y(); } - *y(): any { + *y() { throw new Error("Method not implemented."); } }`, diff --git a/tests/cases/fourslash/codeFixAddMissingMember_non_generator_function.ts b/tests/cases/fourslash/codeFixAddMissingMember_non_generator_function.ts index a868646446aef..c3773bf285c30 100644 --- a/tests/cases/fourslash/codeFixAddMissingMember_non_generator_function.ts +++ b/tests/cases/fourslash/codeFixAddMissingMember_non_generator_function.ts @@ -14,7 +14,7 @@ verify.codeFixAll({ method() { yield* this.y(); } - y(): any { + y() { throw new Error("Method not implemented."); } }`, diff --git a/tests/cases/fourslash/codeFixUndeclaredAcrossFiles1.ts b/tests/cases/fourslash/codeFixUndeclaredAcrossFiles1.ts index 8f775d5158e66..a8171668751d2 100644 --- a/tests/cases/fourslash/codeFixUndeclaredAcrossFiles1.ts +++ b/tests/cases/fourslash/codeFixUndeclaredAcrossFiles1.ts @@ -23,15 +23,15 @@ verify.getAndApplyCodeFix(/*errorCode*/undefined, 0); verify.getAndApplyCodeFix(/*errorCode*/undefined, 0); verify.rangeIs(` - m2(c: C): any { + m2(c: C) { throw new Error("Method not implemented."); } y: {}; - m1(): any { + m1() { throw new Error("Method not implemented."); } static x: any; - static m0(arg0: number, arg1: string, arg2: undefined[]): any { + static m0(arg0: number, arg1: string, arg2: undefined[]) { throw new Error("Method not implemented."); } `); diff --git a/tests/cases/fourslash/codeFixUndeclaredAcrossFiles3.ts b/tests/cases/fourslash/codeFixUndeclaredAcrossFiles3.ts index dcf5c999d6a3d..9ea5ac1a1652b 100644 --- a/tests/cases/fourslash/codeFixUndeclaredAcrossFiles3.ts +++ b/tests/cases/fourslash/codeFixUndeclaredAcrossFiles3.ts @@ -20,7 +20,7 @@ verify.getAndApplyCodeFix(/*errorCode*/ undefined, 0); verify.rangeIs(` - m0(arg0: import("./f2").D): any { + m0(arg0: import("./f2").D) { throw new Error("Method not implemented."); } `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUndeclaredInStaticMethod.ts b/tests/cases/fourslash/codeFixUndeclaredInStaticMethod.ts index a406360c5000d..17fcd9ce688f5 100644 --- a/tests/cases/fourslash/codeFixUndeclaredInStaticMethod.ts +++ b/tests/cases/fourslash/codeFixUndeclaredInStaticMethod.ts @@ -20,7 +20,7 @@ verify.codeFix({ this.prop1 = 10; A.prop2 = "asdf"; } - static m1(arg0: number, arg1: number, arg2: number): any { + static m1(arg0: number, arg1: number, arg2: number) { throw new Error("Method not implemented."); } }`, @@ -38,10 +38,10 @@ verify.codeFix({ this.prop1 = 10; A.prop2 = "asdf"; } - static m2(arg0: number, arg1: number): any { + static m2(arg0: number, arg1: number) { throw new Error("Method not implemented."); } - static m1(arg0: number, arg1: number, arg2: number): any { + static m1(arg0: number, arg1: number, arg2: number) { throw new Error("Method not implemented."); } }`, @@ -60,10 +60,10 @@ verify.codeFix({ this.prop1 = 10; A.prop2 = "asdf"; } - static m2(arg0: number, arg1: number): any { + static m2(arg0: number, arg1: number) { throw new Error("Method not implemented."); } - static m1(arg0: number, arg1: number, arg2: number): any { + static m1(arg0: number, arg1: number, arg2: number) { throw new Error("Method not implemented."); } }`, @@ -83,10 +83,10 @@ verify.codeFix({ this.prop1 = 10; A.prop2 = "asdf"; } - static m2(arg0: number, arg1: number): any { + static m2(arg0: number, arg1: number) { throw new Error("Method not implemented."); } - static m1(arg0: number, arg1: number, arg2: number): any { + static m1(arg0: number, arg1: number, arg2: number) { throw new Error("Method not implemented."); } }`, diff --git a/tests/cases/fourslash/codeFixUndeclaredMethod.ts b/tests/cases/fourslash/codeFixUndeclaredMethod.ts index 151192078f3c9..32713e5dd19b8 100644 --- a/tests/cases/fourslash/codeFixUndeclaredMethod.ts +++ b/tests/cases/fourslash/codeFixUndeclaredMethod.ts @@ -15,7 +15,7 @@ verify.codeFix({ index: 0, newFileContent: `class A { - foo1(arg0: number, arg1: number, arg2: number): any { + foo1(arg0: number, arg1: number, arg2: number) { throw new Error("Method not implemented."); } constructor() { @@ -34,10 +34,10 @@ verify.codeFix({ index: 0, newFileContent: `class A { - foo2(): any { + foo2() { throw new Error("Method not implemented."); } - foo1(arg0: number, arg1: number, arg2: number): any { + foo1(arg0: number, arg1: number, arg2: number) { throw new Error("Method not implemented."); } constructor() { @@ -56,13 +56,13 @@ verify.codeFix({ index: 0, newFileContent: `class A { - foo3(): any { + foo3() { throw new Error("Method not implemented."); } - foo2(): any { + foo2() { throw new Error("Method not implemented."); } - foo1(arg0: number, arg1: number, arg2: number): any { + foo1(arg0: number, arg1: number, arg2: number) { throw new Error("Method not implemented."); } constructor() { diff --git a/tests/cases/fourslash/codeFixUndeclaredMethodFunctionArgs.ts b/tests/cases/fourslash/codeFixUndeclaredMethodFunctionArgs.ts index 478b2a7c64751..c4056625b70b9 100644 --- a/tests/cases/fourslash/codeFixUndeclaredMethodFunctionArgs.ts +++ b/tests/cases/fourslash/codeFixUndeclaredMethodFunctionArgs.ts @@ -11,7 +11,7 @@ verify.codeFix({ description: "Declare method 'foo1'", index: 0, newRangeContent: ` - foo1(arg0: () => number, arg1: () => string, arg2: () => boolean): any { + foo1(arg0: () => number, arg1: () => string, arg2: () => boolean) { throw new Error("Method not implemented."); } `, @@ -22,10 +22,10 @@ verify.codeFix({ description: "Declare method 'foo2'", index: 0, newRangeContent: ` - foo2(arg0: (a: number) => number, arg1: (b: string) => string, arg2: (c: boolean) => boolean): any { + foo2(arg0: (a: number) => number, arg1: (b: string) => string, arg2: (c: boolean) => boolean) { throw new Error("Method not implemented."); } - foo1(arg0: () => number, arg1: () => string, arg2: () => boolean): any { + foo1(arg0: () => number, arg1: () => string, arg2: () => boolean) { throw new Error("Method not implemented."); } `, diff --git a/tests/cases/fourslash/codeFixUndeclaredMethodObjectLiteralArgs.ts b/tests/cases/fourslash/codeFixUndeclaredMethodObjectLiteralArgs.ts index bd434cf9d9d6b..5c0698ad653e9 100644 --- a/tests/cases/fourslash/codeFixUndeclaredMethodObjectLiteralArgs.ts +++ b/tests/cases/fourslash/codeFixUndeclaredMethodObjectLiteralArgs.ts @@ -3,6 +3,8 @@ //// class A {[| //// |]constructor() { //// this.foo1(null, {}, { a: 1, b: "2"}); +//// const bar = this.foo2(null, {}, { a: 1, b: "2"}); +//// const baz: number = this.foo3(null, {}, { a: 1, b: "2"}); //// } //// } @@ -10,7 +12,38 @@ verify.codeFix({ description: "Declare method 'foo1'", index: 0, newRangeContent: ` - foo1(arg0: null, arg1: {}, arg2: { a: number; b: string; }): any { + foo1(arg0: null, arg1: {}, arg2: { a: number; b: string; }) { + throw new Error("Method not implemented."); + } + `, + applyChanges: true +}); + +verify.codeFix({ + description: "Declare method 'foo2'", + index: 0, + newRangeContent: ` + foo2(arg0: null, arg1: {}, arg2: { a: number; b: string; }) { + throw new Error("Method not implemented."); + } + foo1(arg0: null, arg1: {}, arg2: { a: number; b: string; }) { + throw new Error("Method not implemented."); + } + `, + applyChanges: true +}); + +verify.codeFix({ + description: "Declare method 'foo3'", + index: 0, + newRangeContent: ` + foo3(arg0: null, arg1: {}, arg2: { a: number; b: string; }): number { + throw new Error("Method not implemented."); + } + foo2(arg0: null, arg1: {}, arg2: { a: number; b: string; }) { + throw new Error("Method not implemented."); + } + foo1(arg0: null, arg1: {}, arg2: { a: number; b: string; }) { throw new Error("Method not implemented."); } ` diff --git a/tests/cases/fourslash/completionsWithOptionalProperties.ts b/tests/cases/fourslash/completionsWithOptionalProperties.ts new file mode 100644 index 0000000000000..e40029ddefac0 --- /dev/null +++ b/tests/cases/fourslash/completionsWithOptionalProperties.ts @@ -0,0 +1,18 @@ +/// +// @strict: true + +//// interface Options { +//// hello?: boolean; +//// world?: boolean; +//// } +//// declare function foo(options?: Options): void; +//// foo({ +//// hello: true, +//// /**/ +//// }); + +verify.completions({ + marker: "", + includes: ['world'] +}); + diff --git a/tests/cases/fourslash/formatTypeParameters.ts b/tests/cases/fourslash/formatTypeParameters.ts new file mode 100644 index 0000000000000..a6823a4d0bf74 --- /dev/null +++ b/tests/cases/fourslash/formatTypeParameters.ts @@ -0,0 +1,8 @@ +/// + +/////**/type Bar = T + + +format.document(); +goTo.marker(); +verify.currentLineContentIs('type Bar = T'); \ No newline at end of file diff --git a/tslint.json b/tslint.json index a3ca10e75edbc..5952c770c5e7e 100644 --- a/tslint.json +++ b/tslint.json @@ -5,6 +5,11 @@ "no-unnecessary-type-assertion": true, "array-type": [true, "array"], + "ban": [ + true, + "setInterval", + "setTimeout" + ], "ban-types": { "options": [ ["Object", "Avoid using the `Object` type. Did you mean `object`?"], @@ -34,6 +39,7 @@ ], "no-bom": true, "no-double-space": true, + "no-eval": true, "no-in-operator": true, "no-increment-decrement": true, "no-inferrable-types": true, @@ -100,7 +106,6 @@ "no-console": false, "no-debugger": false, "no-empty-interface": false, - "no-eval": false, "no-object-literal-type-assertion": false, "no-shadowed-variable": false, "no-submodule-imports": false,