diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index a25c2e07c8892..0000000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,50 +0,0 @@ -workflows: - version: 2 - main: - jobs: - - node9 - - node8 - - node6 - nightly: - triggers: - - schedule: - cron: "0 8 * * *" - filters: - branches: - only: master - jobs: - - node9: - context: nightlies - - node8: - context: nightlies - - node6: - context: nightlies - -base: &base - environment: - - workerCount: 4 - - timeout: 400000 - steps: - - checkout - - run: | - git submodule update --init --recursive - npm uninstall typescript --no-save - npm uninstall tslint --no-save - npm install - #npm update Appeared in Jenkins only - npm test - -version: 2 -jobs: - node9: - docker: - - image: circleci/node:9 - <<: *base - node8: - docker: - - image: circleci/node:8 - <<: *base - node6: - docker: - - image: circleci/node:6 - <<: *base diff --git a/Gulpfile.js b/Gulpfile.js index afa7e775dcd56..09dd06f3986fb 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -146,7 +146,8 @@ const es2017LibrarySourceMap = es2017LibrarySource.map(source => const es2018LibrarySource = [ "es2018.regexp.d.ts", - "es2018.promise.d.ts" + "es2018.promise.d.ts", + "es2018.intl.d.ts" ]; const es2018LibrarySourceMap = es2018LibrarySource.map(source => ({ target: "lib." + source, sources: ["header.d.ts", source] })); diff --git a/Jakefile.js b/Jakefile.js index 3eb8736445b62..4596352530b73 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -127,7 +127,8 @@ var es2017LibrarySourceMap = es2017LibrarySource.map(function (source) { var es2018LibrarySource = [ "es2018.regexp.d.ts", - "es2018.promise.d.ts" + "es2018.promise.d.ts", + "es2018.intl.d.ts" ]; var es2018LibrarySourceMap = es2018LibrarySource.map(function (source) { diff --git a/issue_template.md b/issue_template.md index dc2f223b72e50..2e3895d4d7dcd 100644 --- a/issue_template.md +++ b/issue_template.md @@ -24,7 +24,7 @@ Please help us by doing the following steps before logging an issue: --> -**TypeScript Version:** 2.7.0-dev.201xxxxx +**TypeScript Version:** 2.9.0-dev.201xxxxx **Search Terms:** diff --git a/jenkins.sh b/jenkins.sh deleted file mode 100755 index b716f5bbeb2b6..0000000000000 --- a/jenkins.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# Set up NVM -export NVM_DIR="/home/dotnet-bot/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" - -nvm install $1 - -npm uninstall typescript --no-save -npm uninstall tslint --no-save -npm install -npm update -npm test diff --git a/netci.groovy b/netci.groovy deleted file mode 100644 index 5fa8b02baf278..0000000000000 --- a/netci.groovy +++ /dev/null @@ -1,22 +0,0 @@ -// Import the utility functionality. -import jobs.generation.Utilities; - -// Defines a the new of the repo, used elsewhere in the file -def project = GithubProject -def branch = GithubBranchName - -def nodeVersions = ['stable', '8', '6'] - -nodeVersions.each { nodeVer -> - - def newJobName = "typescript_node.${nodeVer}" - def newJob = job(Utilities.getFullJobName(project, newJobName, true)) { - steps { - shell("./jenkins.sh ${nodeVer}") - } - } - - Utilities.standardJobSetup(newJob, project, true, "*/${branch}") - Utilities.setMachineAffinity(newJob, 'Ubuntu14.04', '20161020') - Utilities.addGithubPRTriggerForBranch(newJob, branch, "TypeScript Test Run ${newJobName}") -} diff --git a/package-lock.json b/package-lock.json index 265d4233ad8a2..43128f9163648 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,11 +10,11 @@ "integrity": "sha1-z6I7xYQPkQTOMqZedNt+epdLvuE=", "dev": true, "requires": { - "acorn": "5.5.3", - "css": "2.2.1", - "normalize-path": "2.1.1", - "source-map": "0.5.7", - "through2": "2.0.3" + "acorn": "^5.0.3", + "css": "^2.2.1", + "normalize-path": "^2.1.1", + "source-map": "^0.5.6", + "through2": "^2.0.3" }, "dependencies": { "acorn": { @@ -31,8 +31,8 @@ "integrity": "sha1-iQrnxdjId/bThIYCFazp1+yUW9o=", "dev": true, "requires": { - "normalize-path": "2.1.1", - "through2": "2.0.3" + "normalize-path": "^2.0.1", + "through2": "^2.0.3" } }, "@types/browserify": { @@ -41,8 +41,8 @@ "integrity": "sha512-mY6dYfq1Ns3Xqz/JFUcyoWaXtm0XDoNhkU1vCwM/ULM5zqNL+SbtacJhce/JCgPeCdbqdVqq77tJ4HwdtypSxg==", "dev": true, "requires": { - "@types/insert-module-globals": "7.0.0", - "@types/node": "8.5.5" + "@types/insert-module-globals": "*", + "@types/node": "*" } }, "@types/chai": { @@ -63,7 +63,7 @@ "integrity": "sha512-y6qRq6raBuu965clKgx6FHuiPu3oHdtmzMPXi8Uahsjdq1L6DL5fS/aY5/s71YwM7k6K1QIWvem5vNwlnNGIkQ==", "dev": true, "requires": { - "@types/glob": "5.0.35" + "@types/glob": "*" } }, "@types/events": { @@ -78,9 +78,9 @@ "integrity": "sha512-wc+VveszMLyMWFvXLkloixT4n0harUIVZjnpzztaZ0nKLuul7Z32iMt2fUFGAaZ4y1XWjFRMtCI5ewvyh4aIeg==", "dev": true, "requires": { - "@types/events": "1.2.0", - "@types/minimatch": "3.0.3", - "@types/node": "8.5.5" + "@types/events": "*", + "@types/minimatch": "*", + "@types/node": "*" } }, "@types/gulp": { @@ -89,9 +89,9 @@ "integrity": "sha512-u6/zWPzYRNPAtvyFJ3/RSXjmBaBM1dVs5kW22/jU6J786ZGLfSndhLoNOpFI6FGQvqTA+QzFHjSMhpkAN+wxcQ==", "dev": true, "requires": { - "@types/node": "8.5.5", - "@types/orchestrator": "0.3.2", - "@types/vinyl": "2.0.2" + "@types/node": "*", + "@types/orchestrator": "*", + "@types/vinyl": "*" } }, "@types/gulp-concat": { @@ -100,7 +100,7 @@ "integrity": "sha512-CUCFADlITzzBfBa2bdGzhKtvBr4eFh+evb+4igVbvPoO5RyPfHifmyQlZl6lM7q19+OKncRlFXDU7B4X9Ayo2g==", "dev": true, "requires": { - "@types/node": "8.5.5" + "@types/node": "*" } }, "@types/gulp-help": { @@ -109,9 +109,9 @@ "integrity": "sha512-MkW7psZznxxJg2MBk2P2qHE+T8jEZVFz3FG/qGjUYazkyJt7hBJWx5Nuewmay5RVNtUvSWPrdZLr/WTXY3T/6A==", "dev": true, "requires": { - "@types/gulp": "3.8.36", - "@types/node": "8.5.5", - "@types/orchestrator": "0.3.2" + "@types/gulp": "*", + "@types/node": "*", + "@types/orchestrator": "*" } }, "@types/gulp-newer": { @@ -120,7 +120,7 @@ "integrity": "sha512-e7J/Zv5Wd7CC0WpuA2syWVitgwrkG0u221e41w7r07XUR6hMH6kHPkq9tUrusHkbeW8QbuLbis5fODOwQCyggQ==", "dev": true, "requires": { - "@types/node": "8.5.5" + "@types/node": "*" } }, "@types/gulp-sourcemaps": { @@ -129,7 +129,7 @@ "integrity": "sha512-+7BAmptW2bxyJnJcCEuie7vLoop3FwWgCdBMzyv7MYXED/HeNMeQuX7uPCkp4vfU1TTu4CYFH0IckNPvo0VePA==", "dev": true, "requires": { - "@types/node": "8.5.5" + "@types/node": "*" } }, "@types/insert-module-globals": { @@ -138,7 +138,7 @@ "integrity": "sha512-zudCJPwluh1VUDB6Gl/OQdRp+fYy3+47huJB/JMQubMS2p+sH18MCVK4WUz3FqaWLB12yh5ELxVR/+tqwlm/qA==", "dev": true, "requires": { - "@types/node": "8.5.5" + "@types/node": "*" } }, "@types/merge2": { @@ -147,7 +147,7 @@ "integrity": "sha512-GjaXY4OultxbaOOk7lCLO7xvEcFpdjExC605YmfI6X29vhHKpJfMWKCDZd3x+BITrZaXKg97DgV/SdGVSwdzxA==", "dev": true, "requires": { - "@types/node": "8.5.5" + "@types/node": "*" } }, "@types/minimatch": { @@ -168,7 +168,7 @@ "integrity": "sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg==", "dev": true, "requires": { - "@types/node": "8.5.5" + "@types/node": "*" } }, "@types/mocha": { @@ -189,8 +189,8 @@ "integrity": "sha512-cKB4yTX0wGaRCSkdHDX2fkGQbMAA8UOshC2U7DQky1CE5o+5q2iQQ8VkbPbE/88uaTtsusvBPMcCX7dgmjxBhQ==", "dev": true, "requires": { - "@types/node": "8.5.5", - "@types/q": "1.5.0" + "@types/node": "*", + "@types/q": "*" } }, "@types/q": { @@ -205,8 +205,8 @@ "integrity": "sha512-XwGr1b4yCGUILKeBkzmeWcxmGHQ0vFFFpA6D6y1yLO6gKmYorF+PHqdU5KG+nWt38OvtrkDptmrSmlHX/XtpLw==", "dev": true, "requires": { - "@types/gulp": "3.8.36", - "@types/node": "8.5.5" + "@types/gulp": "*", + "@types/node": "*" } }, "@types/through2": { @@ -215,7 +215,7 @@ "integrity": "sha1-H/LoihAN+1sUDnu5h5HxGUQA0TE=", "dev": true, "requires": { - "@types/node": "8.5.5" + "@types/node": "*" } }, "@types/travis-fold": { @@ -230,7 +230,7 @@ "integrity": "sha512-2iYpNuOl98SrLPBZfEN9Mh2JCJ2EI9HU35SfgBEb51DcmaHkhp8cKMblYeBqMQiwXMgAD3W60DbQ4i/UdLiXhw==", "dev": true, "requires": { - "@types/node": "8.5.5" + "@types/node": "*" } }, "@types/xml2js": { @@ -239,7 +239,7 @@ "integrity": "sha512-8aKUBSj3oGcnuiBmDLm3BIk09RYg01mz9HlQ2u4aS17oJ25DxjQrEUVGFSBVNOfM45pQW4OjcBPplq6r/exJdA==", "dev": true, "requires": { - "@types/node": "8.5.5" + "@types/node": "*" } }, "JSONStream": { @@ -248,8 +248,8 @@ "integrity": "sha1-wQI3G27Dp887hHygDCC7D85Mbeo=", "dev": true, "requires": { - "jsonparse": "1.3.1", - "through": "2.3.8" + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" } }, "abbrev": { @@ -270,8 +270,8 @@ "integrity": "sha512-efP54n3d1aLfjL2UMdaXa6DsswwzJeI5rqhbFvXMrKiJ6eJFpf+7R0zN7t8IC+XKn2YOAFAv6xbBNgHUkoHWLw==", "dev": true, "requires": { - "acorn": "5.5.3", - "xtend": "4.0.1" + "acorn": "^5.4.1", + "xtend": "^4.0.1" }, "dependencies": { "acorn": { @@ -288,9 +288,9 @@ "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", "dev": true, "requires": { - "kind-of": "3.2.2", - "longest": "1.0.1", - "repeat-string": "1.6.1" + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" }, "dependencies": { "kind-of": { @@ -299,7 +299,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -316,7 +316,7 @@ "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", "dev": true, "requires": { - "ansi-wrap": "0.1.0" + "ansi-wrap": "^0.1.0" } }, "ansi-cyan": { @@ -358,7 +358,7 @@ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { - "color-convert": "1.9.1" + "color-convert": "^1.9.0" } }, "ansi-wrap": { @@ -373,7 +373,7 @@ "integrity": "sha1-2CIM9GYIFSXv6lBhTz3mUU36WPE=", "dev": true, "requires": { - "buffer-equal": "1.0.0" + "buffer-equal": "^1.0.0" } }, "archy": { @@ -388,7 +388,7 @@ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { - "sprintf-js": "1.0.3" + "sprintf-js": "~1.0.2" } }, "arr-diff": { @@ -451,7 +451,7 @@ "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", "dev": true, "requires": { - "array-uniq": "1.0.3" + "array-uniq": "^1.0.1" } }, "array-uniq": { @@ -472,9 +472,9 @@ "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", "dev": true, "requires": { - "bn.js": "4.11.8", - "inherits": "2.0.3", - "minimalistic-assert": "1.0.1" + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" } }, "assert": { @@ -504,7 +504,7 @@ "integrity": "sha1-e9QXhNMkk5h66yOba04cV6hzuRc=", "dev": true, "requires": { - "acorn": "4.0.13" + "acorn": "^4.0.3" } }, "async": { @@ -525,9 +525,9 @@ "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", "dev": true, "requires": { - "chalk": "1.1.3", - "esutils": "2.0.2", - "js-tokens": "3.0.2" + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" }, "dependencies": { "ansi-styles": { @@ -542,11 +542,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" } }, "supports-color": { @@ -569,13 +569,13 @@ "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", "dev": true, "requires": { - "cache-base": "1.0.1", - "class-utils": "0.3.6", - "component-emitter": "1.2.1", - "define-property": "1.0.0", - "isobject": "3.0.1", - "mixin-deep": "1.3.1", - "pascalcase": "0.1.1" + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" }, "dependencies": { "define-property": { @@ -584,7 +584,7 @@ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "dev": true, "requires": { - "is-descriptor": "1.0.2" + "is-descriptor": "^1.0.0" } }, "is-accessor-descriptor": { @@ -593,7 +593,7 @@ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, "requires": { - "kind-of": "6.0.2" + "kind-of": "^6.0.0" } }, "is-data-descriptor": { @@ -602,7 +602,7 @@ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, "requires": { - "kind-of": "6.0.2" + "kind-of": "^6.0.0" } }, "is-descriptor": { @@ -611,9 +611,9 @@ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, "requires": { - "is-accessor-descriptor": "1.0.0", - "is-data-descriptor": "1.0.0", - "kind-of": "6.0.2" + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" } } } @@ -642,7 +642,7 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -652,16 +652,16 @@ "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", "dev": true, "requires": { - "arr-flatten": "1.1.0", - "array-unique": "0.3.2", - "extend-shallow": "2.0.1", - "fill-range": "4.0.0", - "isobject": "3.0.1", - "repeat-element": "1.1.2", - "snapdragon": "0.8.2", - "snapdragon-node": "2.1.1", - "split-string": "3.1.0", - "to-regex": "3.0.2" + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" }, "dependencies": { "extend-shallow": { @@ -670,7 +670,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "0.1.1" + "is-extendable": "^0.1.0" } } } @@ -687,12 +687,12 @@ "integrity": "sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA==", "dev": true, "requires": { - "JSONStream": "1.3.2", - "combine-source-map": "0.8.0", - "defined": "1.0.0", - "safe-buffer": "5.1.2", - "through2": "2.0.3", - "umd": "3.0.3" + "JSONStream": "^1.0.3", + "combine-source-map": "~0.8.0", + "defined": "^1.0.0", + "safe-buffer": "^5.1.1", + "through2": "^2.0.0", + "umd": "^3.0.0" } }, "browser-resolve": { @@ -716,54 +716,54 @@ "integrity": "sha512-yotdAkp/ZbgDesHQBYU37zjc29JDH4iXT8hjzM1fdUVWogjARX0S1cKeX24Ci6zZ+jG+ADmCTRt6xvtmJnI+BQ==", "dev": true, "requires": { - "JSONStream": "1.3.2", - "assert": "1.4.1", - "browser-pack": "6.1.0", - "browser-resolve": "1.11.2", - "browserify-zlib": "0.2.0", - "buffer": "5.1.0", - "cached-path-relative": "1.0.1", - "concat-stream": "1.6.2", - "console-browserify": "1.1.0", - "constants-browserify": "1.0.0", - "crypto-browserify": "3.12.0", - "defined": "1.0.0", - "deps-sort": "2.0.0", - "domain-browser": "1.2.0", - "duplexer2": "0.1.4", - "events": "2.0.0", - "glob": "7.1.2", - "has": "1.0.1", - "htmlescape": "1.1.1", - "https-browserify": "1.0.0", - "inherits": "2.0.3", - "insert-module-globals": "7.0.6", - "labeled-stream-splicer": "2.0.1", - "mkdirp": "0.5.1", - "module-deps": "6.0.2", - "os-browserify": "0.3.0", - "parents": "1.0.1", - "path-browserify": "0.0.0", - "process": "0.11.10", - "punycode": "1.4.1", - "querystring-es3": "0.2.1", - "read-only-stream": "2.0.0", - "readable-stream": "2.3.6", - "resolve": "1.1.7", - "shasum": "1.0.2", - "shell-quote": "1.6.1", - "stream-browserify": "2.0.1", - "stream-http": "2.8.1", - "string_decoder": "1.1.1", - "subarg": "1.0.0", - "syntax-error": "1.4.0", - "through2": "2.0.3", - "timers-browserify": "1.4.2", + "JSONStream": "^1.0.3", + "assert": "^1.4.0", + "browser-pack": "^6.0.1", + "browser-resolve": "^1.11.0", + "browserify-zlib": "~0.2.0", + "buffer": "^5.0.2", + "cached-path-relative": "^1.0.0", + "concat-stream": "^1.6.0", + "console-browserify": "^1.1.0", + "constants-browserify": "~1.0.0", + "crypto-browserify": "^3.0.0", + "defined": "^1.0.0", + "deps-sort": "^2.0.0", + "domain-browser": "^1.2.0", + "duplexer2": "~0.1.2", + "events": "^2.0.0", + "glob": "^7.1.0", + "has": "^1.0.0", + "htmlescape": "^1.1.0", + "https-browserify": "^1.0.0", + "inherits": "~2.0.1", + "insert-module-globals": "^7.0.0", + "labeled-stream-splicer": "^2.0.0", + "mkdirp": "^0.5.0", + "module-deps": "^6.0.0", + "os-browserify": "~0.3.0", + "parents": "^1.0.1", + "path-browserify": "~0.0.0", + "process": "~0.11.0", + "punycode": "^1.3.2", + "querystring-es3": "~0.2.0", + "read-only-stream": "^2.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.1.4", + "shasum": "^1.0.0", + "shell-quote": "^1.6.1", + "stream-browserify": "^2.0.0", + "stream-http": "^2.0.0", + "string_decoder": "^1.1.1", + "subarg": "^1.0.0", + "syntax-error": "^1.1.1", + "through2": "^2.0.0", + "timers-browserify": "^1.0.1", "tty-browserify": "0.0.1", - "url": "0.11.0", - "util": "0.10.3", - "vm-browserify": "1.0.1", - "xtend": "4.0.1" + "url": "~0.11.0", + "util": "~0.10.1", + "vm-browserify": "^1.0.0", + "xtend": "^4.0.0" } }, "browserify-aes": { @@ -772,12 +772,12 @@ "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "dev": true, "requires": { - "buffer-xor": "1.0.3", - "cipher-base": "1.0.4", - "create-hash": "1.2.0", - "evp_bytestokey": "1.0.3", - "inherits": "2.0.3", - "safe-buffer": "5.1.2" + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" } }, "browserify-cipher": { @@ -786,9 +786,9 @@ "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", "dev": true, "requires": { - "browserify-aes": "1.2.0", - "browserify-des": "1.0.1", - "evp_bytestokey": "1.0.3" + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" } }, "browserify-des": { @@ -797,9 +797,9 @@ "integrity": "sha512-zy0Cobe3hhgpiOM32Tj7KQ3Vl91m0njwsjzZQK1L+JDf11dzP9qIvjreVinsvXrgfjhStXwUWAEpB9D7Gwmayw==", "dev": true, "requires": { - "cipher-base": "1.0.4", - "des.js": "1.0.0", - "inherits": "2.0.3" + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1" } }, "browserify-rsa": { @@ -808,8 +808,8 @@ "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { - "bn.js": "4.11.8", - "randombytes": "2.0.6" + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" } }, "browserify-sign": { @@ -818,13 +818,13 @@ "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", "dev": true, "requires": { - "bn.js": "4.11.8", - "browserify-rsa": "4.0.1", - "create-hash": "1.2.0", - "create-hmac": "1.1.7", - "elliptic": "6.4.0", - "inherits": "2.0.3", - "parse-asn1": "5.1.1" + "bn.js": "^4.1.1", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.2", + "elliptic": "^6.0.0", + "inherits": "^2.0.1", + "parse-asn1": "^5.0.0" } }, "browserify-zlib": { @@ -833,7 +833,7 @@ "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", "dev": true, "requires": { - "pako": "1.0.6" + "pako": "~1.0.5" } }, "buffer": { @@ -842,8 +842,8 @@ "integrity": "sha512-YkIRgwsZwJWTnyQrsBTWefizHh+8GYj3kbL1BTiAQ/9pwpino0G7B2gp5tx/FUBqUlvtxV85KNR3mwfAtv15Yw==", "dev": true, "requires": { - "base64-js": "1.3.0", - "ieee754": "1.1.11" + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" } }, "buffer-crc32": { @@ -888,15 +888,15 @@ "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", "dev": true, "requires": { - "collection-visit": "1.0.0", - "component-emitter": "1.2.1", - "get-value": "2.0.6", - "has-value": "1.0.0", - "isobject": "3.0.1", - "set-value": "2.0.0", - "to-object-path": "0.3.0", - "union-value": "1.0.0", - "unset-value": "1.0.0" + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" } }, "cached-path-relative": { @@ -919,8 +919,8 @@ "dev": true, "optional": true, "requires": { - "align-text": "0.1.4", - "lazy-cache": "1.0.4" + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" } }, "chai": { @@ -929,23 +929,23 @@ "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", "dev": true, "requires": { - "assertion-error": "1.1.0", - "check-error": "1.0.2", - "deep-eql": "3.0.1", - "get-func-name": "2.0.0", - "pathval": "1.1.0", - "type-detect": "4.0.8" + "assertion-error": "^1.0.1", + "check-error": "^1.0.1", + "deep-eql": "^3.0.0", + "get-func-name": "^2.0.0", + "pathval": "^1.0.0", + "type-detect": "^4.0.0" } }, "chalk": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.0.tgz", - "integrity": "sha512-Wr/w0f4o9LuE7K53cD0qmbAMM+2XNLzR29vFn5hqko4sxGlUsyy363NvmyGIyk5tpe9cjTr9SJYbysEyPkRnFw==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "dev": true, "requires": { - "ansi-styles": "3.2.1", - "escape-string-regexp": "1.0.5", - "supports-color": "5.4.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" } }, "check-error": { @@ -960,8 +960,8 @@ "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", "dev": true, "requires": { - "inherits": "2.0.3", - "safe-buffer": "5.1.2" + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" } }, "class-utils": { @@ -970,10 +970,10 @@ "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", "dev": true, "requires": { - "arr-union": "3.1.0", - "define-property": "0.2.5", - "isobject": "3.0.1", - "static-extend": "0.1.2" + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" }, "dependencies": { "define-property": { @@ -982,7 +982,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "0.1.6" + "is-descriptor": "^0.1.0" } } } @@ -994,8 +994,8 @@ "dev": true, "optional": true, "requires": { - "center-align": "0.1.3", - "right-align": "0.1.3", + "center-align": "^0.1.1", + "right-align": "^0.1.1", "wordwrap": "0.0.2" }, "dependencies": { @@ -1032,9 +1032,9 @@ "integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==", "dev": true, "requires": { - "inherits": "2.0.3", - "process-nextick-args": "2.0.0", - "readable-stream": "2.3.6" + "inherits": "^2.0.1", + "process-nextick-args": "^2.0.0", + "readable-stream": "^2.3.5" } }, "collection-visit": { @@ -1043,8 +1043,8 @@ "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", "dev": true, "requires": { - "map-visit": "1.0.0", - "object-visit": "1.0.1" + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" } }, "color-convert": { @@ -1053,7 +1053,7 @@ "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", "dev": true, "requires": { - "color-name": "1.1.3" + "color-name": "^1.1.1" } }, "color-name": { @@ -1074,10 +1074,10 @@ "integrity": "sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos=", "dev": true, "requires": { - "convert-source-map": "1.1.3", - "inline-source-map": "0.6.2", - "lodash.memoize": "3.0.4", - "source-map": "0.5.7" + "convert-source-map": "~1.1.0", + "inline-source-map": "~0.6.0", + "lodash.memoize": "~3.0.3", + "source-map": "~0.5.3" }, "dependencies": { "convert-source-map": { @@ -1112,19 +1112,19 @@ "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", "dev": true, "requires": { - "buffer-from": "1.0.0", - "inherits": "2.0.3", - "readable-stream": "2.3.6", - "typedarray": "0.0.6" + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" } }, "concat-with-sourcemaps": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.0.5.tgz", - "integrity": "sha512-YtnS0VEY+e2Khzsey/6mra9EoM6h/5gxaC0e3mcHpA5yfDxafhygytNmcJWodvUgyXzSiL5MSkPO6bQGgfliHw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.0.7.tgz", + "integrity": "sha512-5i4Spc9NNvVXzkR77x2kjcYCDZMNPLzP7ZBzJMNKZjXzk+E6tRVL/lPlYw60VM3hb7gf+iBQn2x1T8TpMN0SEw==", "dev": true, "requires": { - "source-map": "0.6.1" + "source-map": "^0.6.1" }, "dependencies": { "source-map": { @@ -1141,7 +1141,7 @@ "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", "dev": true, "requires": { - "date-now": "0.1.4" + "date-now": "^0.1.4" } }, "constants-browserify": { @@ -1174,8 +1174,8 @@ "integrity": "sha512-iZvCCg8XqHQZ1ioNBTzXS/cQSkqkqcPs8xSX4upNB+DAk9Ht3uzQf2J32uAHNCne8LDmKr29AgZrEs4oIrwLuQ==", "dev": true, "requires": { - "bn.js": "4.11.8", - "elliptic": "6.4.0" + "bn.js": "^4.1.0", + "elliptic": "^6.0.0" } }, "create-hash": { @@ -1184,11 +1184,11 @@ "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "dev": true, "requires": { - "cipher-base": "1.0.4", - "inherits": "2.0.3", - "md5.js": "1.3.4", - "ripemd160": "2.0.2", - "sha.js": "2.4.11" + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" } }, "create-hmac": { @@ -1197,12 +1197,12 @@ "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "dev": true, "requires": { - "cipher-base": "1.0.4", - "create-hash": "1.2.0", - "inherits": "2.0.3", - "ripemd160": "2.0.2", - "safe-buffer": "5.1.2", - "sha.js": "2.4.11" + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" } }, "crypto-browserify": { @@ -1211,17 +1211,17 @@ "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", "dev": true, "requires": { - "browserify-cipher": "1.0.1", - "browserify-sign": "4.0.4", - "create-ecdh": "4.0.1", - "create-hash": "1.2.0", - "create-hmac": "1.1.7", - "diffie-hellman": "5.0.3", - "inherits": "2.0.3", - "pbkdf2": "3.0.16", - "public-encrypt": "4.0.2", - "randombytes": "2.0.6", - "randomfill": "1.0.4" + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" } }, "css": { @@ -1230,10 +1230,10 @@ "integrity": "sha1-c6TIHehdtmTU7mdPfUcIXjstVdw=", "dev": true, "requires": { - "inherits": "2.0.3", - "source-map": "0.1.43", - "source-map-resolve": "0.3.1", - "urix": "0.1.0" + "inherits": "^2.0.1", + "source-map": "^0.1.38", + "source-map-resolve": "^0.3.0", + "urix": "^0.1.0" }, "dependencies": { "atob": { @@ -1248,7 +1248,7 @@ "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=", "dev": true, "requires": { - "amdefine": "1.0.1" + "amdefine": ">=0.0.4" } }, "source-map-resolve": { @@ -1257,10 +1257,10 @@ "integrity": "sha1-YQ9hIqRFuN1RU1oqcbeD38Ekh2E=", "dev": true, "requires": { - "atob": "1.1.3", - "resolve-url": "0.2.1", - "source-map-url": "0.3.0", - "urix": "0.1.0" + "atob": "~1.1.0", + "resolve-url": "~0.2.1", + "source-map-url": "~0.3.0", + "urix": "~0.1.0" } }, "source-map-url": { @@ -1277,7 +1277,7 @@ "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", "dev": true, "requires": { - "es5-ext": "0.10.42" + "es5-ext": "^0.10.9" } }, "date-now": { @@ -1307,9 +1307,9 @@ "integrity": "sha512-GZqvGIgKNlUnHUPQhepnUZFIMoi3dgZKQBzKDeL2g7oJF9SNAji/AAu36dusFUas0O+pae74lNeoIPHqXWDkLg==", "dev": true, "requires": { - "debug": "3.1.0", - "memoizee": "0.4.12", - "object-assign": "4.1.1" + "debug": "3.X", + "memoizee": "0.4.X", + "object-assign": "4.X" }, "dependencies": { "debug": { @@ -1342,7 +1342,7 @@ "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", "dev": true, "requires": { - "type-detect": "4.0.8" + "type-detect": "^4.0.0" } }, "deep-is": { @@ -1357,7 +1357,7 @@ "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", "dev": true, "requires": { - "clone": "1.0.4" + "clone": "^1.0.2" } }, "define-properties": { @@ -1366,8 +1366,8 @@ "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", "dev": true, "requires": { - "foreach": "2.0.5", - "object-keys": "1.0.11" + "foreach": "^2.0.5", + "object-keys": "^1.0.8" } }, "define-property": { @@ -1376,8 +1376,8 @@ "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", "dev": true, "requires": { - "is-descriptor": "1.0.2", - "isobject": "3.0.1" + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" }, "dependencies": { "is-accessor-descriptor": { @@ -1386,7 +1386,7 @@ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, "requires": { - "kind-of": "6.0.2" + "kind-of": "^6.0.0" } }, "is-data-descriptor": { @@ -1395,7 +1395,7 @@ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, "requires": { - "kind-of": "6.0.2" + "kind-of": "^6.0.0" } }, "is-descriptor": { @@ -1404,9 +1404,9 @@ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, "requires": { - "is-accessor-descriptor": "1.0.0", - "is-data-descriptor": "1.0.0", - "kind-of": "6.0.2" + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" } } } @@ -1423,12 +1423,12 @@ "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", "dev": true, "requires": { - "globby": "6.1.0", - "is-path-cwd": "1.0.0", - "is-path-in-cwd": "1.0.1", - "p-map": "1.2.0", - "pify": "3.0.0", - "rimraf": "2.6.2" + "globby": "^6.1.0", + "is-path-cwd": "^1.0.0", + "is-path-in-cwd": "^1.0.0", + "p-map": "^1.1.1", + "pify": "^3.0.0", + "rimraf": "^2.2.8" } }, "deprecated": { @@ -1443,10 +1443,10 @@ "integrity": "sha1-CRckkC6EZYJg65EHSMzNGvbiH7U=", "dev": true, "requires": { - "JSONStream": "1.3.2", - "shasum": "1.0.2", - "subarg": "1.0.0", - "through2": "2.0.3" + "JSONStream": "^1.0.3", + "shasum": "^1.0.0", + "subarg": "^1.0.0", + "through2": "^2.0.0" } }, "des.js": { @@ -1455,8 +1455,8 @@ "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", "dev": true, "requires": { - "inherits": "2.0.3", - "minimalistic-assert": "1.0.1" + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" } }, "detect-file": { @@ -1477,9 +1477,9 @@ "integrity": "sha512-TFHMqfOvxlgrfVzTEkNBSh9SvSNX/HfF4OFI2QFGCyPm02EsyILqnUeb5P6q7JZ3SFNTBL5t2sePRgrN4epUWQ==", "dev": true, "requires": { - "acorn-node": "1.3.0", - "defined": "1.0.0", - "minimist": "1.2.0" + "acorn-node": "^1.3.0", + "defined": "^1.0.0", + "minimist": "^1.1.1" } }, "diff": { @@ -1494,9 +1494,9 @@ "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", "dev": true, "requires": { - "bn.js": "4.11.8", - "miller-rabin": "4.0.1", - "randombytes": "2.0.6" + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" } }, "domain-browser": { @@ -1511,7 +1511,7 @@ "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", "dev": true, "requires": { - "readable-stream": "2.3.6" + "readable-stream": "^2.0.2" } }, "duplexify": { @@ -1520,10 +1520,10 @@ "integrity": "sha512-JzYSLYMhoVVBe8+mbHQ4KgpvHpm0DZpJuL8PY93Vyv1fW7jYJ90LoXa1di/CVbJM+TgMs91rbDapE/RNIfnJsA==", "dev": true, "requires": { - "end-of-stream": "1.4.1", - "inherits": "2.0.3", - "readable-stream": "2.3.6", - "stream-shift": "1.0.0" + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" }, "dependencies": { "end-of-stream": { @@ -1532,7 +1532,7 @@ "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "dev": true, "requires": { - "once": "1.4.0" + "once": "^1.4.0" } } } @@ -1543,13 +1543,13 @@ "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", "dev": true, "requires": { - "bn.js": "4.11.8", - "brorand": "1.1.0", - "hash.js": "1.1.3", - "hmac-drbg": "1.0.1", - "inherits": "2.0.3", - "minimalistic-assert": "1.0.1", - "minimalistic-crypto-utils": "1.0.1" + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" } }, "end-of-stream": { @@ -1558,7 +1558,7 @@ "integrity": "sha1-jhdyBsPICDfYVjLouTWd/osvbq8=", "dev": true, "requires": { - "once": "1.3.3" + "once": "~1.3.0" }, "dependencies": { "once": { @@ -1567,7 +1567,7 @@ "integrity": "sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA=", "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } } } @@ -1578,9 +1578,9 @@ "integrity": "sha512-AJxO1rmPe1bDEfSR6TJ/FgMFYuTBhR5R57KW58iCkYACMyFbrkqVyzXSurYoScDGvgyMpk7uRF/lPUPPTmsRSA==", "dev": true, "requires": { - "es6-iterator": "2.0.3", - "es6-symbol": "3.1.1", - "next-tick": "1.0.0" + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.1", + "next-tick": "1" } }, "es6-iterator": { @@ -1589,9 +1589,9 @@ "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.42", - "es6-symbol": "3.1.1" + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" } }, "es6-promise": { @@ -1606,8 +1606,8 @@ "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.42" + "d": "1", + "es5-ext": "~0.10.14" } }, "es6-weak-map": { @@ -1616,10 +1616,10 @@ "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.42", - "es6-iterator": "2.0.3", - "es6-symbol": "3.1.1" + "d": "1", + "es5-ext": "^0.10.14", + "es6-iterator": "^2.0.1", + "es6-symbol": "^3.1.1" } }, "escape-string-regexp": { @@ -1634,11 +1634,11 @@ "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", "dev": true, "requires": { - "esprima": "2.7.3", - "estraverse": "1.9.3", - "esutils": "2.0.2", - "optionator": "0.8.2", - "source-map": "0.2.0" + "esprima": "^2.7.1", + "estraverse": "^1.9.1", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.2.0" }, "dependencies": { "source-map": { @@ -1648,7 +1648,7 @@ "dev": true, "optional": true, "requires": { - "amdefine": "1.0.1" + "amdefine": ">=0.0.4" } } } @@ -1677,8 +1677,8 @@ "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.42" + "d": "1", + "es5-ext": "~0.10.14" } }, "events": { @@ -1693,8 +1693,8 @@ "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", "dev": true, "requires": { - "md5.js": "1.3.4", - "safe-buffer": "5.1.2" + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" } }, "expand-brackets": { @@ -1703,13 +1703,13 @@ "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", "dev": true, "requires": { - "debug": "2.6.9", - "define-property": "0.2.5", - "extend-shallow": "2.0.1", - "posix-character-classes": "0.1.1", - "regex-not": "1.0.2", - "snapdragon": "0.8.2", - "to-regex": "3.0.2" + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" }, "dependencies": { "define-property": { @@ -1718,7 +1718,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "0.1.6" + "is-descriptor": "^0.1.0" } }, "extend-shallow": { @@ -1727,7 +1727,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "0.1.1" + "is-extendable": "^0.1.0" } } } @@ -1738,7 +1738,7 @@ "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", "dev": true, "requires": { - "homedir-polyfill": "1.0.1" + "homedir-polyfill": "^1.0.1" } }, "extend": { @@ -1753,8 +1753,8 @@ "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", "dev": true, "requires": { - "assign-symbols": "1.0.0", - "is-extendable": "1.0.1" + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" }, "dependencies": { "is-extendable": { @@ -1763,7 +1763,7 @@ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, "requires": { - "is-plain-object": "2.0.4" + "is-plain-object": "^2.0.4" } } } @@ -1774,14 +1774,14 @@ "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", "dev": true, "requires": { - "array-unique": "0.3.2", - "define-property": "1.0.0", - "expand-brackets": "2.1.4", - "extend-shallow": "2.0.1", - "fragment-cache": "0.2.1", - "regex-not": "1.0.2", - "snapdragon": "0.8.2", - "to-regex": "3.0.2" + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" }, "dependencies": { "define-property": { @@ -1790,7 +1790,7 @@ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "dev": true, "requires": { - "is-descriptor": "1.0.2" + "is-descriptor": "^1.0.0" } }, "extend-shallow": { @@ -1799,7 +1799,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "0.1.1" + "is-extendable": "^0.1.0" } }, "is-accessor-descriptor": { @@ -1808,7 +1808,7 @@ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, "requires": { - "kind-of": "6.0.2" + "kind-of": "^6.0.0" } }, "is-data-descriptor": { @@ -1817,7 +1817,7 @@ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, "requires": { - "kind-of": "6.0.2" + "kind-of": "^6.0.0" } }, "is-descriptor": { @@ -1826,9 +1826,9 @@ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, "requires": { - "is-accessor-descriptor": "1.0.0", - "is-data-descriptor": "1.0.0", - "kind-of": "6.0.2" + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" } } } @@ -1839,9 +1839,9 @@ "integrity": "sha1-9BEl49hPLn2JpD0G2VjI94vha+E=", "dev": true, "requires": { - "ansi-gray": "0.1.1", - "color-support": "1.1.3", - "time-stamp": "1.1.0" + "ansi-gray": "^0.1.1", + "color-support": "^1.1.3", + "time-stamp": "^1.0.0" } }, "fast-levenshtein": { @@ -1856,8 +1856,8 @@ "integrity": "sha1-WKZBrR9XV0on/oekQO8xiDS1Vxk=", "dev": true, "requires": { - "minimatch": "3.0.4", - "utilities": "0.0.37" + "minimatch": "^3.0.3", + "utilities": "^0.0.37" }, "dependencies": { "utilities": { @@ -1874,10 +1874,10 @@ "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", "dev": true, "requires": { - "extend-shallow": "2.0.1", - "is-number": "3.0.0", - "repeat-string": "1.6.1", - "to-regex-range": "2.1.1" + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" }, "dependencies": { "extend-shallow": { @@ -1886,7 +1886,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "0.1.1" + "is-extendable": "^0.1.0" } } } @@ -1903,10 +1903,10 @@ "integrity": "sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw=", "dev": true, "requires": { - "detect-file": "1.0.0", - "is-glob": "3.1.0", - "micromatch": "3.1.10", - "resolve-dir": "1.0.1" + "detect-file": "^1.0.0", + "is-glob": "^3.1.0", + "micromatch": "^3.0.4", + "resolve-dir": "^1.0.1" } }, "fined": { @@ -1915,11 +1915,11 @@ "integrity": "sha1-s33IRLdqL15wgeiE98CuNE8VNHY=", "dev": true, "requires": { - "expand-tilde": "2.0.2", - "is-plain-object": "2.0.4", - "object.defaults": "1.1.0", - "object.pick": "1.3.0", - "parse-filepath": "1.0.2" + "expand-tilde": "^2.0.2", + "is-plain-object": "^2.0.3", + "object.defaults": "^1.1.0", + "object.pick": "^1.2.0", + "parse-filepath": "^1.0.1" } }, "first-chunk-stream": { @@ -1940,8 +1940,8 @@ "integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==", "dev": true, "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.6" + "inherits": "^2.0.1", + "readable-stream": "^2.0.4" } }, "for-in": { @@ -1956,7 +1956,7 @@ "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", "dev": true, "requires": { - "for-in": "1.0.2" + "for-in": "^1.0.1" } }, "foreach": { @@ -1971,7 +1971,7 @@ "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", "dev": true, "requires": { - "map-cache": "0.2.2" + "map-cache": "^0.2.2" } }, "fs-mkdirp-stream": { @@ -1980,8 +1980,8 @@ "integrity": "sha1-C3gV/DIBxqaeFNuYzgmMFpNSWes=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "through2": "2.0.3" + "graceful-fs": "^4.1.11", + "through2": "^2.0.3" }, "dependencies": { "graceful-fs": { @@ -2010,7 +2010,7 @@ "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", "dev": true, "requires": { - "globule": "0.1.0" + "globule": "~0.1.0" } }, "get-func-name": { @@ -2031,12 +2031,12 @@ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "glob-parent": { @@ -2045,8 +2045,8 @@ "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", "dev": true, "requires": { - "is-glob": "3.1.0", - "path-dirname": "1.0.2" + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" } }, "glob-stream": { @@ -2055,12 +2055,12 @@ "integrity": "sha1-kXCl8St5Awb9/lmPMT+PeVT9FDs=", "dev": true, "requires": { - "glob": "4.5.3", - "glob2base": "0.0.12", - "minimatch": "2.0.10", - "ordered-read-streams": "0.1.0", - "through2": "0.6.5", - "unique-stream": "1.0.0" + "glob": "^4.3.1", + "glob2base": "^0.0.12", + "minimatch": "^2.0.1", + "ordered-read-streams": "^0.1.0", + "through2": "^0.6.1", + "unique-stream": "^1.0.0" }, "dependencies": { "glob": { @@ -2069,10 +2069,10 @@ "integrity": "sha1-xstz0yJsHv7wTePFbQEvAzd+4V8=", "dev": true, "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "2.0.10", - "once": "1.4.0" + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^2.0.1", + "once": "^1.3.0" } }, "isarray": { @@ -2087,7 +2087,7 @@ "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", "dev": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.0.0" } }, "readable-stream": { @@ -2096,10 +2096,10 @@ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", "isarray": "0.0.1", - "string_decoder": "0.10.31" + "string_decoder": "~0.10.x" } }, "string_decoder": { @@ -2114,8 +2114,8 @@ "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { - "readable-stream": "1.0.34", - "xtend": "4.0.1" + "readable-stream": ">=1.0.33-1 <1.1.0-0", + "xtend": ">=4.0.0 <4.1.0-0" } } } @@ -2126,7 +2126,7 @@ "integrity": "sha1-uVtKjfdLOcgymLDAXJeLTZo7cQs=", "dev": true, "requires": { - "gaze": "0.5.2" + "gaze": "^0.5.1" } }, "glob2base": { @@ -2135,7 +2135,7 @@ "integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=", "dev": true, "requires": { - "find-index": "0.1.1" + "find-index": "^0.1.1" } }, "global-modules": { @@ -2144,9 +2144,9 @@ "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "dev": true, "requires": { - "global-prefix": "1.0.2", - "is-windows": "1.0.2", - "resolve-dir": "1.0.1" + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" } }, "global-prefix": { @@ -2155,11 +2155,11 @@ "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", "dev": true, "requires": { - "expand-tilde": "2.0.2", - "homedir-polyfill": "1.0.1", - "ini": "1.3.5", - "is-windows": "1.0.2", - "which": "1.3.0" + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" } }, "globby": { @@ -2168,11 +2168,11 @@ "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", "dev": true, "requires": { - "array-union": "1.0.2", - "glob": "7.1.2", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" }, "dependencies": { "pify": { @@ -2189,9 +2189,9 @@ "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", "dev": true, "requires": { - "glob": "3.1.21", - "lodash": "1.0.2", - "minimatch": "0.2.14" + "glob": "~3.1.21", + "lodash": "~1.0.1", + "minimatch": "~0.2.11" }, "dependencies": { "glob": { @@ -2200,9 +2200,9 @@ "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", "dev": true, "requires": { - "graceful-fs": "1.2.3", - "inherits": "1.0.2", - "minimatch": "0.2.14" + "graceful-fs": "~1.2.0", + "inherits": "1", + "minimatch": "~0.2.11" } }, "graceful-fs": { @@ -2223,8 +2223,8 @@ "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", "dev": true, "requires": { - "lru-cache": "2.7.3", - "sigmund": "1.0.1" + "lru-cache": "2", + "sigmund": "~1.0.0" } } } @@ -2235,7 +2235,7 @@ "integrity": "sha512-ynYqXLoluBKf9XGR1gA59yEJisIL7YHEH4xr3ZziHB5/yl4qWfaK8Js9jGe6gBGCSCKVqiyO30WnRZADvemUNw==", "dev": true, "requires": { - "sparkles": "1.0.0" + "sparkles": "^1.0.0" } }, "graceful-fs": { @@ -2244,7 +2244,7 @@ "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", "dev": true, "requires": { - "natives": "1.1.3" + "natives": "^1.1.0" } }, "growl": { @@ -2259,19 +2259,19 @@ "integrity": "sha1-VxzkWSjdQK9lFPxAEYZgFsE4RbQ=", "dev": true, "requires": { - "archy": "1.0.0", - "chalk": "1.1.3", - "deprecated": "0.0.1", - "gulp-util": "3.0.8", - "interpret": "1.1.0", - "liftoff": "2.5.0", - "minimist": "1.2.0", - "orchestrator": "0.3.8", - "pretty-hrtime": "1.0.3", - "semver": "4.3.6", - "tildify": "1.2.0", - "v8flags": "2.1.1", - "vinyl-fs": "0.3.14" + "archy": "^1.0.0", + "chalk": "^1.0.0", + "deprecated": "^0.0.1", + "gulp-util": "^3.0.0", + "interpret": "^1.0.0", + "liftoff": "^2.1.0", + "minimist": "^1.1.0", + "orchestrator": "^0.3.0", + "pretty-hrtime": "^1.0.0", + "semver": "^4.1.0", + "tildify": "^1.0.0", + "v8flags": "^2.0.2", + "vinyl-fs": "^0.3.0" }, "dependencies": { "ansi-styles": { @@ -2286,11 +2286,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" } }, "supports-color": { @@ -2307,8 +2307,8 @@ "integrity": "sha512-SLg/KsHBbinR/pCX3PF5l1YlR28hLp0X+bcpf77PtMJ6zvAQ5kRjtCPV5Wt1wHXsXWZN0eTUZ15R8ZYpi/CdCA==", "dev": true, "requires": { - "plugin-error": "0.1.2", - "through2": "2.0.3" + "plugin-error": "^0.1.2", + "through2": "^2.0.3" } }, "gulp-concat": { @@ -2317,9 +2317,9 @@ "integrity": "sha1-Yz0WyV2IUEYorQJmVmPO5aR5M1M=", "dev": true, "requires": { - "concat-with-sourcemaps": "1.0.5", - "through2": "2.0.3", - "vinyl": "2.1.0" + "concat-with-sourcemaps": "^1.0.0", + "through2": "^2.0.0", + "vinyl": "^2.0.0" } }, "gulp-help": { @@ -2328,8 +2328,8 @@ "integrity": "sha1-Jh2xhuGDl/7z9qLCLpwxW/qIrgw=", "dev": true, "requires": { - "chalk": "1.1.3", - "object-assign": "3.0.0" + "chalk": "^1.0.0", + "object-assign": "^3.0.0" }, "dependencies": { "ansi-styles": { @@ -2344,11 +2344,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" } }, "object-assign": { @@ -2371,7 +2371,7 @@ "integrity": "sha1-MjE/E+SiPPWsylzl8MCAkjx3hgI=", "dev": true, "requires": { - "readable-stream": "1.1.14", + "readable-stream": "^1.0.26-4", "streamqueue": "0.0.6" }, "dependencies": { @@ -2387,10 +2387,10 @@ "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", "isarray": "0.0.1", - "string_decoder": "0.10.31" + "string_decoder": "~0.10.x" } }, "string_decoder": { @@ -2407,9 +2407,9 @@ "integrity": "sha512-h79fGO55S/P9eAADbLAP9aTtVYpLSR1ONj08VPaSdVVNVYhTS8p1CO1TW7kEMu+hC+sytmCqcUr5LesvZEtDoQ==", "dev": true, "requires": { - "glob": "7.1.2", - "kew": "0.7.0", - "plugin-error": "0.1.2" + "glob": "^7.0.3", + "kew": "^0.7.0", + "plugin-error": "^0.1.2" } }, "gulp-sourcemaps": { @@ -2418,17 +2418,17 @@ "integrity": "sha1-y7IAhFCxvM5s0jv5gze+dRv24wo=", "dev": true, "requires": { - "@gulp-sourcemaps/identity-map": "1.0.1", - "@gulp-sourcemaps/map-sources": "1.0.0", - "acorn": "5.5.3", - "convert-source-map": "1.5.1", - "css": "2.2.1", - "debug-fabulous": "1.1.0", - "detect-newline": "2.1.0", - "graceful-fs": "4.1.11", - "source-map": "0.6.1", - "strip-bom-string": "1.0.0", - "through2": "2.0.3" + "@gulp-sourcemaps/identity-map": "1.X", + "@gulp-sourcemaps/map-sources": "1.X", + "acorn": "5.X", + "convert-source-map": "1.X", + "css": "2.X", + "debug-fabulous": "1.X", + "detect-newline": "2.X", + "graceful-fs": "4.X", + "source-map": "~0.6.0", + "strip-bom-string": "1.X", + "through2": "2.X" }, "dependencies": { "acorn": { @@ -2457,12 +2457,12 @@ "integrity": "sha512-Hhbn5Aa2l3T+tnn0KqsG6RRJmcYEsr3byTL2nBpNBeAK8pqug9Od4AwddU4JEI+hRw7mzZyjRbB8DDWR6paGVA==", "dev": true, "requires": { - "ansi-colors": "1.1.0", - "plugin-error": "0.1.2", - "source-map": "0.6.1", - "through2": "2.0.3", - "vinyl": "2.1.0", - "vinyl-fs": "3.0.2" + "ansi-colors": "^1.0.1", + "plugin-error": "^0.1.2", + "source-map": "^0.6.1", + "through2": "^2.0.3", + "vinyl": "^2.1.0", + "vinyl-fs": "^3.0.0" }, "dependencies": { "glob-stream": { @@ -2471,16 +2471,16 @@ "integrity": "sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=", "dev": true, "requires": { - "extend": "3.0.1", - "glob": "7.1.2", - "glob-parent": "3.1.0", - "is-negated-glob": "1.0.0", - "ordered-read-streams": "1.0.1", - "pumpify": "1.4.0", - "readable-stream": "2.3.6", - "remove-trailing-separator": "1.1.0", - "to-absolute-glob": "2.0.2", - "unique-stream": "2.2.1" + "extend": "^3.0.0", + "glob": "^7.1.1", + "glob-parent": "^3.1.0", + "is-negated-glob": "^1.0.0", + "ordered-read-streams": "^1.0.0", + "pumpify": "^1.3.5", + "readable-stream": "^2.1.5", + "remove-trailing-separator": "^1.0.1", + "to-absolute-glob": "^2.0.0", + "unique-stream": "^2.0.2" } }, "graceful-fs": { @@ -2495,7 +2495,7 @@ "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", "dev": true, "requires": { - "jsonify": "0.0.0" + "jsonify": "~0.0.0" } }, "ordered-read-streams": { @@ -2504,7 +2504,7 @@ "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=", "dev": true, "requires": { - "readable-stream": "2.3.6" + "readable-stream": "^2.0.1" } }, "source-map": { @@ -2519,8 +2519,8 @@ "integrity": "sha1-WqADz76Uxf+GbE59ZouxxNuts2k=", "dev": true, "requires": { - "json-stable-stringify": "1.0.1", - "through2-filter": "2.0.0" + "json-stable-stringify": "^1.0.0", + "through2-filter": "^2.0.0" } }, "vinyl-fs": { @@ -2529,23 +2529,23 @@ "integrity": "sha512-AUSFda1OukBwuLPBTbyuO4IRWgfXmqC4UTW0f8xrCa8Hkv9oyIU+NSqBlgfOLZRoUt7cHdo75hKQghCywpIyIw==", "dev": true, "requires": { - "fs-mkdirp-stream": "1.0.0", - "glob-stream": "6.1.0", - "graceful-fs": "4.1.11", - "is-valid-glob": "1.0.0", - "lazystream": "1.0.0", - "lead": "1.0.0", - "object.assign": "4.1.0", - "pumpify": "1.4.0", - "readable-stream": "2.3.6", - "remove-bom-buffer": "3.0.0", - "remove-bom-stream": "1.2.0", - "resolve-options": "1.1.0", - "through2": "2.0.3", - "to-through": "2.0.0", - "value-or-function": "3.0.0", - "vinyl": "2.1.0", - "vinyl-sourcemap": "1.1.0" + "fs-mkdirp-stream": "^1.0.0", + "glob-stream": "^6.1.0", + "graceful-fs": "^4.0.0", + "is-valid-glob": "^1.0.0", + "lazystream": "^1.0.0", + "lead": "^1.0.0", + "object.assign": "^4.0.4", + "pumpify": "^1.3.5", + "readable-stream": "^2.3.3", + "remove-bom-buffer": "^3.0.0", + "remove-bom-stream": "^1.2.0", + "resolve-options": "^1.1.0", + "through2": "^2.0.0", + "to-through": "^2.0.0", + "value-or-function": "^3.0.0", + "vinyl": "^2.0.0", + "vinyl-sourcemap": "^1.1.0" } } } @@ -2556,24 +2556,24 @@ "integrity": "sha1-AFTh50RQLifATBh8PsxQXdVLu08=", "dev": true, "requires": { - "array-differ": "1.0.0", - "array-uniq": "1.0.3", - "beeper": "1.1.1", - "chalk": "1.1.3", - "dateformat": "2.2.0", - "fancy-log": "1.3.2", - "gulplog": "1.0.0", - "has-gulplog": "0.1.0", - "lodash._reescape": "3.0.0", - "lodash._reevaluate": "3.0.0", - "lodash._reinterpolate": "3.0.0", - "lodash.template": "3.6.2", - "minimist": "1.2.0", - "multipipe": "0.1.2", - "object-assign": "3.0.0", + "array-differ": "^1.0.0", + "array-uniq": "^1.0.2", + "beeper": "^1.0.0", + "chalk": "^1.0.0", + "dateformat": "^2.0.0", + "fancy-log": "^1.1.0", + "gulplog": "^1.0.0", + "has-gulplog": "^0.1.0", + "lodash._reescape": "^3.0.0", + "lodash._reevaluate": "^3.0.0", + "lodash._reinterpolate": "^3.0.0", + "lodash.template": "^3.0.0", + "minimist": "^1.1.0", + "multipipe": "^0.1.2", + "object-assign": "^3.0.0", "replace-ext": "0.0.1", - "through2": "2.0.3", - "vinyl": "0.5.3" + "through2": "^2.0.0", + "vinyl": "^0.5.0" }, "dependencies": { "ansi-styles": { @@ -2588,11 +2588,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" } }, "object-assign": { @@ -2613,8 +2613,8 @@ "integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=", "dev": true, "requires": { - "clone": "1.0.4", - "clone-stats": "0.0.1", + "clone": "^1.0.0", + "clone-stats": "^0.0.1", "replace-ext": "0.0.1" } } @@ -2626,7 +2626,7 @@ "integrity": "sha1-4oxNRdBey77YGDY86PnFkmIp/+U=", "dev": true, "requires": { - "glogg": "1.0.1" + "glogg": "^1.0.0" } }, "handlebars": { @@ -2635,10 +2635,10 @@ "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", "dev": true, "requires": { - "async": "1.5.2", - "optimist": "0.6.1", - "source-map": "0.4.4", - "uglify-js": "2.8.29" + "async": "^1.4.0", + "optimist": "^0.6.1", + "source-map": "^0.4.4", + "uglify-js": "^2.6" }, "dependencies": { "source-map": { @@ -2647,7 +2647,7 @@ "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { - "amdefine": "1.0.1" + "amdefine": ">=0.0.4" } } } @@ -2658,7 +2658,7 @@ "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", "dev": true, "requires": { - "function-bind": "1.1.1" + "function-bind": "^1.0.2" } }, "has-ansi": { @@ -2667,7 +2667,7 @@ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "has-color": { @@ -2688,7 +2688,7 @@ "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", "dev": true, "requires": { - "sparkles": "1.0.0" + "sparkles": "^1.0.0" } }, "has-symbols": { @@ -2703,9 +2703,9 @@ "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", "dev": true, "requires": { - "get-value": "2.0.6", - "has-values": "1.0.0", - "isobject": "3.0.1" + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" } }, "has-values": { @@ -2714,8 +2714,8 @@ "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", "dev": true, "requires": { - "is-number": "3.0.0", - "kind-of": "4.0.0" + "is-number": "^3.0.0", + "kind-of": "^4.0.0" }, "dependencies": { "kind-of": { @@ -2724,7 +2724,7 @@ "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -2735,8 +2735,8 @@ "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", "dev": true, "requires": { - "inherits": "2.0.3", - "safe-buffer": "5.1.2" + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" } }, "hash.js": { @@ -2745,8 +2745,8 @@ "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", "dev": true, "requires": { - "inherits": "2.0.3", - "minimalistic-assert": "1.0.1" + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.0" } }, "he": { @@ -2761,9 +2761,9 @@ "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "dev": true, "requires": { - "hash.js": "1.1.3", - "minimalistic-assert": "1.0.1", - "minimalistic-crypto-utils": "1.0.1" + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" } }, "homedir-polyfill": { @@ -2772,7 +2772,7 @@ "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=", "dev": true, "requires": { - "parse-passwd": "1.0.0" + "parse-passwd": "^1.0.0" } }, "htmlescape": { @@ -2799,8 +2799,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -2821,7 +2821,7 @@ "integrity": "sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU=", "dev": true, "requires": { - "source-map": "0.5.7" + "source-map": "~0.5.3" } }, "insert-module-globals": { @@ -2830,15 +2830,15 @@ "integrity": "sha512-R3sidKJr3SsggqQQ5cEwQb3pWG8RNx0UnpyeiOSR6jorRIeAOzH2gkTWnNdMnyRiVbjrG047K7UCtlMkQ1Mo9w==", "dev": true, "requires": { - "JSONStream": "1.3.2", - "combine-source-map": "0.8.0", - "concat-stream": "1.6.2", - "is-buffer": "1.1.6", - "lexical-scope": "1.2.0", - "path-is-absolute": "1.0.1", - "process": "0.11.10", - "through2": "2.0.3", - "xtend": "4.0.1" + "JSONStream": "^1.0.3", + "combine-source-map": "^0.8.0", + "concat-stream": "^1.6.1", + "is-buffer": "^1.1.0", + "lexical-scope": "^1.2.0", + "path-is-absolute": "^1.0.1", + "process": "~0.11.0", + "through2": "^2.0.0", + "xtend": "^4.0.0" } }, "interpret": { @@ -2853,8 +2853,8 @@ "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", "dev": true, "requires": { - "is-relative": "1.0.0", - "is-windows": "1.0.2" + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" } }, "is-accessor-descriptor": { @@ -2863,7 +2863,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -2872,7 +2872,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -2889,7 +2889,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -2898,7 +2898,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -2909,9 +2909,9 @@ "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "dev": true, "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" }, "dependencies": { "kind-of": { @@ -2940,7 +2940,7 @@ "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", "dev": true, "requires": { - "is-extglob": "2.1.1" + "is-extglob": "^2.1.0" } }, "is-negated-glob": { @@ -2955,7 +2955,7 @@ "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -2964,7 +2964,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -2975,7 +2975,7 @@ "integrity": "sha512-OTiixgpZAT1M4NHgS5IguFp/Vz2VI3U7Goh4/HA1adtwyLtSBrxYlcSYkhpAE07s4fKEcjrFxyvtQBND4vFQyQ==", "dev": true, "requires": { - "is-number": "4.0.0" + "is-number": "^4.0.0" }, "dependencies": { "is-number": { @@ -2998,7 +2998,7 @@ "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", "dev": true, "requires": { - "is-path-inside": "1.0.1" + "is-path-inside": "^1.0.0" } }, "is-path-inside": { @@ -3007,7 +3007,7 @@ "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", "dev": true, "requires": { - "path-is-inside": "1.0.2" + "path-is-inside": "^1.0.1" } }, "is-plain-object": { @@ -3016,7 +3016,7 @@ "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, "requires": { - "isobject": "3.0.1" + "isobject": "^3.0.1" } }, "is-promise": { @@ -3031,7 +3031,7 @@ "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", "dev": true, "requires": { - "is-unc-path": "1.0.0" + "is-unc-path": "^1.0.0" } }, "is-unc-path": { @@ -3040,7 +3040,7 @@ "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", "dev": true, "requires": { - "unc-path-regex": "0.1.2" + "unc-path-regex": "^0.1.2" } }, "is-utf8": { @@ -3085,20 +3085,20 @@ "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", "dev": true, "requires": { - "abbrev": "1.0.9", - "async": "1.5.2", - "escodegen": "1.8.1", - "esprima": "2.7.3", - "glob": "5.0.15", - "handlebars": "4.0.11", - "js-yaml": "3.11.0", - "mkdirp": "0.5.1", - "nopt": "3.0.6", - "once": "1.4.0", - "resolve": "1.1.7", - "supports-color": "3.2.3", - "which": "1.3.0", - "wordwrap": "1.0.0" + "abbrev": "1.0.x", + "async": "1.x", + "escodegen": "1.8.x", + "esprima": "2.7.x", + "glob": "^5.0.15", + "handlebars": "^4.0.1", + "js-yaml": "3.x", + "mkdirp": "0.5.x", + "nopt": "3.x", + "once": "1.x", + "resolve": "1.1.x", + "supports-color": "^3.1.0", + "which": "^1.1.1", + "wordwrap": "^1.0.0" }, "dependencies": { "glob": { @@ -3107,11 +3107,11 @@ "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", "dev": true, "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "has-flag": { @@ -3126,7 +3126,7 @@ "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", "dev": true, "requires": { - "has-flag": "1.0.0" + "has-flag": "^1.0.0" } } } @@ -3137,11 +3137,11 @@ "integrity": "sha512-qUTOVCKFkiz3tHgV1WMy7HTxDZgo+sO4X9GxFLAU+Mks4WsDGe9+ONHK6tPsSp8I3x6sPl0TwGbXHwTOhTyzog==", "dev": true, "requires": { - "async": "0.9.2", - "chalk": "0.4.0", - "filelist": "0.0.6", - "minimatch": "3.0.4", - "utilities": "1.0.5" + "async": "0.9.x", + "chalk": "0.4.x", + "filelist": "0.0.x", + "minimatch": "3.x", + "utilities": "1.0.x" }, "dependencies": { "ansi-styles": { @@ -3162,9 +3162,9 @@ "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", "dev": true, "requires": { - "ansi-styles": "1.0.0", - "has-color": "0.1.7", - "strip-ansi": "0.1.1" + "ansi-styles": "~1.0.0", + "has-color": "~0.1.0", + "strip-ansi": "~0.1.0" } }, "strip-ansi": { @@ -3187,8 +3187,8 @@ "integrity": "sha512-saJstZWv7oNeOyBh3+Dx1qWzhW0+e6/8eDzo7p5rDFqxntSztloLtuKu+Ejhtq82jsilwOIZYsCz+lIjthg1Hw==", "dev": true, "requires": { - "argparse": "1.0.10", - "esprima": "4.0.0" + "argparse": "^1.0.7", + "esprima": "^4.0.0" }, "dependencies": { "esprima": { @@ -3205,7 +3205,7 @@ "integrity": "sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U=", "dev": true, "requires": { - "jsonify": "0.0.0" + "jsonify": "~0.0.0" } }, "jsonify": { @@ -3238,9 +3238,9 @@ "integrity": "sha512-MC94mHZRvJ3LfykJlTUipBqenZz1pacOZEMhhQ8dMGcDHs0SBE5GbsavUXV7YtP3icBW17W0Zy1I0lfASmo9Pg==", "dev": true, "requires": { - "inherits": "2.0.3", - "isarray": "2.0.4", - "stream-splicer": "2.0.0" + "inherits": "^2.0.1", + "isarray": "^2.0.4", + "stream-splicer": "^2.0.0" }, "dependencies": { "isarray": { @@ -3264,7 +3264,7 @@ "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", "dev": true, "requires": { - "readable-stream": "2.3.6" + "readable-stream": "^2.0.5" } }, "lead": { @@ -3273,7 +3273,7 @@ "integrity": "sha1-bxT5mje+Op3XhPVJVpDlkDRm7kI=", "dev": true, "requires": { - "flush-write-stream": "1.0.3" + "flush-write-stream": "^1.0.2" } }, "levn": { @@ -3282,8 +3282,8 @@ "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", "dev": true, "requires": { - "prelude-ls": "1.1.2", - "type-check": "0.3.2" + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" } }, "lexical-scope": { @@ -3292,7 +3292,7 @@ "integrity": "sha1-/Ope3HBKSzqHls3KQZw6CvryLfQ=", "dev": true, "requires": { - "astw": "2.2.0" + "astw": "^2.0.0" } }, "liftoff": { @@ -3301,14 +3301,14 @@ "integrity": "sha1-IAkpG7Mc6oYbvxCnwVooyvdcMew=", "dev": true, "requires": { - "extend": "3.0.1", - "findup-sync": "2.0.0", - "fined": "1.1.0", - "flagged-respawn": "1.0.0", - "is-plain-object": "2.0.4", - "object.map": "1.0.1", - "rechoir": "0.6.2", - "resolve": "1.1.7" + "extend": "^3.0.0", + "findup-sync": "^2.0.0", + "fined": "^1.0.1", + "flagged-respawn": "^1.0.0", + "is-plain-object": "^2.0.4", + "object.map": "^1.0.0", + "rechoir": "^0.6.2", + "resolve": "^1.1.7" } }, "lodash": { @@ -3377,7 +3377,7 @@ "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", "dev": true, "requires": { - "lodash._root": "3.0.1" + "lodash._root": "^3.0.0" } }, "lodash.isarguments": { @@ -3398,9 +3398,9 @@ "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", "dev": true, "requires": { - "lodash._getnative": "3.9.1", - "lodash.isarguments": "3.1.0", - "lodash.isarray": "3.0.4" + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" } }, "lodash.memoize": { @@ -3421,15 +3421,15 @@ "integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=", "dev": true, "requires": { - "lodash._basecopy": "3.0.1", - "lodash._basetostring": "3.0.1", - "lodash._basevalues": "3.0.0", - "lodash._isiterateecall": "3.0.9", - "lodash._reinterpolate": "3.0.0", - "lodash.escape": "3.2.0", - "lodash.keys": "3.1.2", - "lodash.restparam": "3.6.1", - "lodash.templatesettings": "3.1.1" + "lodash._basecopy": "^3.0.0", + "lodash._basetostring": "^3.0.0", + "lodash._basevalues": "^3.0.0", + "lodash._isiterateecall": "^3.0.0", + "lodash._reinterpolate": "^3.0.0", + "lodash.escape": "^3.0.0", + "lodash.keys": "^3.0.0", + "lodash.restparam": "^3.0.0", + "lodash.templatesettings": "^3.0.0" } }, "lodash.templatesettings": { @@ -3438,8 +3438,8 @@ "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", "dev": true, "requires": { - "lodash._reinterpolate": "3.0.0", - "lodash.escape": "3.2.0" + "lodash._reinterpolate": "^3.0.0", + "lodash.escape": "^3.0.0" } }, "longest": { @@ -3460,7 +3460,7 @@ "integrity": "sha1-Jzi9nw089PhEkMVzbEhpmsYyzaM=", "dev": true, "requires": { - "es5-ext": "0.10.42" + "es5-ext": "~0.10.2" } }, "make-iterator": { @@ -3469,7 +3469,7 @@ "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", "dev": true, "requires": { - "kind-of": "6.0.2" + "kind-of": "^6.0.2" } }, "map-cache": { @@ -3484,7 +3484,7 @@ "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", "dev": true, "requires": { - "object-visit": "1.0.1" + "object-visit": "^1.0.0" } }, "md5.js": { @@ -3493,8 +3493,8 @@ "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", "dev": true, "requires": { - "hash-base": "3.0.4", - "inherits": "2.0.3" + "hash-base": "^3.0.0", + "inherits": "^2.0.1" } }, "memoizee": { @@ -3503,14 +3503,14 @@ "integrity": "sha512-sprBu6nwxBWBvBOh5v2jcsGqiGLlL2xr2dLub3vR8dnE8YB17omwtm/0NSHl8jjNbcsJd5GMWJAnTSVe/O0Wfg==", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.42", - "es6-weak-map": "2.0.2", - "event-emitter": "0.3.5", - "is-promise": "2.1.0", - "lru-queue": "0.1.0", - "next-tick": "1.0.0", - "timers-ext": "0.1.5" + "d": "1", + "es5-ext": "^0.10.30", + "es6-weak-map": "^2.0.2", + "event-emitter": "^0.3.5", + "is-promise": "^2.1", + "lru-queue": "0.1", + "next-tick": "1", + "timers-ext": "^0.1.2" } }, "merge2": { @@ -3525,19 +3525,19 @@ "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", "dev": true, "requires": { - "arr-diff": "4.0.0", - "array-unique": "0.3.2", - "braces": "2.3.2", - "define-property": "2.0.2", - "extend-shallow": "3.0.2", - "extglob": "2.0.4", - "fragment-cache": "0.2.1", - "kind-of": "6.0.2", - "nanomatch": "1.2.9", - "object.pick": "1.3.0", - "regex-not": "1.0.2", - "snapdragon": "0.8.2", - "to-regex": "3.0.2" + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" } }, "miller-rabin": { @@ -3546,8 +3546,8 @@ "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", "dev": true, "requires": { - "bn.js": "4.11.8", - "brorand": "1.1.0" + "bn.js": "^4.0.0", + "brorand": "^1.0.1" } }, "minimalistic-assert": { @@ -3568,7 +3568,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -3583,8 +3583,8 @@ "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", "dev": true, "requires": { - "for-in": "1.0.2", - "is-extendable": "1.0.1" + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" }, "dependencies": { "is-extendable": { @@ -3593,7 +3593,7 @@ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, "requires": { - "is-plain-object": "2.0.4" + "is-plain-object": "^2.0.4" } } } @@ -3655,7 +3655,7 @@ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "^2.0.0" } } } @@ -3672,21 +3672,21 @@ "integrity": "sha512-KWBI3009iRnHjRlxRhe8nJ6kdeBTg4sMi5N6AZgg5f1/v5S7EBCRBOY854I4P5Anl4kx6AJH+4bBBC2Gi3nkvg==", "dev": true, "requires": { - "JSONStream": "1.3.2", - "browser-resolve": "1.11.2", - "cached-path-relative": "1.0.1", - "concat-stream": "1.6.2", - "defined": "1.0.0", - "detective": "5.1.0", - "duplexer2": "0.1.4", - "inherits": "2.0.3", - "parents": "1.0.1", - "readable-stream": "2.3.6", - "resolve": "1.7.1", - "stream-combiner2": "1.1.1", - "subarg": "1.0.0", - "through2": "2.0.3", - "xtend": "4.0.1" + "JSONStream": "^1.0.3", + "browser-resolve": "^1.7.0", + "cached-path-relative": "^1.0.0", + "concat-stream": "~1.6.0", + "defined": "^1.0.0", + "detective": "^5.0.2", + "duplexer2": "^0.1.2", + "inherits": "^2.0.1", + "parents": "^1.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.4.0", + "stream-combiner2": "^1.1.1", + "subarg": "^1.0.0", + "through2": "^2.0.0", + "xtend": "^4.0.0" }, "dependencies": { "resolve": { @@ -3695,7 +3695,7 @@ "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", "dev": true, "requires": { - "path-parse": "1.0.5" + "path-parse": "^1.0.5" } } } @@ -3721,7 +3721,7 @@ "integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=", "dev": true, "requires": { - "readable-stream": "1.1.14" + "readable-stream": "~1.1.9" } }, "isarray": { @@ -3736,10 +3736,10 @@ "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", "isarray": "0.0.1", - "string_decoder": "0.10.31" + "string_decoder": "~0.10.x" } }, "string_decoder": { @@ -3756,18 +3756,18 @@ "integrity": "sha512-n8R9bS8yQ6eSXaV6jHUpKzD8gLsin02w1HSFiegwrs9E098Ylhw5jdyKPaYqvHknHaSCKTPp7C8dGCQ0q9koXA==", "dev": true, "requires": { - "arr-diff": "4.0.0", - "array-unique": "0.3.2", - "define-property": "2.0.2", - "extend-shallow": "3.0.2", - "fragment-cache": "0.2.1", - "is-odd": "2.0.0", - "is-windows": "1.0.2", - "kind-of": "6.0.2", - "object.pick": "1.3.0", - "regex-not": "1.0.2", - "snapdragon": "0.8.2", - "to-regex": "3.0.2" + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-odd": "^2.0.0", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" } }, "natives": { @@ -3788,7 +3788,7 @@ "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", "dev": true, "requires": { - "abbrev": "1.0.9" + "abbrev": "1" } }, "normalize-path": { @@ -3797,7 +3797,7 @@ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { - "remove-trailing-separator": "1.1.0" + "remove-trailing-separator": "^1.0.1" } }, "now-and-later": { @@ -3806,7 +3806,7 @@ "integrity": "sha1-vGHLtFbXnLMiB85HygUTb/Ln1u4=", "dev": true, "requires": { - "once": "1.4.0" + "once": "^1.3.2" } }, "object-assign": { @@ -3821,9 +3821,9 @@ "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", "dev": true, "requires": { - "copy-descriptor": "0.1.1", - "define-property": "0.2.5", - "kind-of": "3.2.2" + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" }, "dependencies": { "define-property": { @@ -3832,7 +3832,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "0.1.6" + "is-descriptor": "^0.1.0" } }, "kind-of": { @@ -3841,7 +3841,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -3858,7 +3858,7 @@ "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", "dev": true, "requires": { - "isobject": "3.0.1" + "isobject": "^3.0.0" } }, "object.assign": { @@ -3867,10 +3867,10 @@ "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", "dev": true, "requires": { - "define-properties": "1.1.2", - "function-bind": "1.1.1", - "has-symbols": "1.0.0", - "object-keys": "1.0.11" + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" } }, "object.defaults": { @@ -3879,10 +3879,10 @@ "integrity": "sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8=", "dev": true, "requires": { - "array-each": "1.0.1", - "array-slice": "1.1.0", - "for-own": "1.0.0", - "isobject": "3.0.1" + "array-each": "^1.0.1", + "array-slice": "^1.0.0", + "for-own": "^1.0.0", + "isobject": "^3.0.0" } }, "object.map": { @@ -3891,8 +3891,8 @@ "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=", "dev": true, "requires": { - "for-own": "1.0.0", - "make-iterator": "1.0.1" + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" } }, "object.pick": { @@ -3901,7 +3901,7 @@ "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", "dev": true, "requires": { - "isobject": "3.0.1" + "isobject": "^3.0.1" } }, "once": { @@ -3910,7 +3910,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "optimist": { @@ -3919,8 +3919,8 @@ "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", "dev": true, "requires": { - "minimist": "0.0.10", - "wordwrap": "0.0.3" + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" }, "dependencies": { "minimist": { @@ -3943,12 +3943,12 @@ "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", "dev": true, "requires": { - "deep-is": "0.1.3", - "fast-levenshtein": "2.0.6", - "levn": "0.3.0", - "prelude-ls": "1.1.2", - "type-check": "0.3.2", - "wordwrap": "1.0.0" + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" } }, "orchestrator": { @@ -3957,9 +3957,9 @@ "integrity": "sha1-FOfp4nZPcxX7rBhOUGx6pt+UrX4=", "dev": true, "requires": { - "end-of-stream": "0.1.5", - "sequencify": "0.0.7", - "stream-consume": "0.1.1" + "end-of-stream": "~0.1.5", + "sequencify": "~0.0.7", + "stream-consume": "~0.1.0" } }, "ordered-read-streams": { @@ -3998,7 +3998,7 @@ "integrity": "sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E=", "dev": true, "requires": { - "path-platform": "0.11.15" + "path-platform": "~0.11.15" } }, "parse-asn1": { @@ -4007,11 +4007,11 @@ "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", "dev": true, "requires": { - "asn1.js": "4.10.1", - "browserify-aes": "1.2.0", - "create-hash": "1.2.0", - "evp_bytestokey": "1.0.3", - "pbkdf2": "3.0.16" + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3" } }, "parse-filepath": { @@ -4020,9 +4020,9 @@ "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=", "dev": true, "requires": { - "is-absolute": "1.0.0", - "map-cache": "0.2.2", - "path-root": "0.1.1" + "is-absolute": "^1.0.0", + "map-cache": "^0.2.0", + "path-root": "^0.1.1" } }, "parse-passwd": { @@ -4079,7 +4079,7 @@ "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=", "dev": true, "requires": { - "path-root-regex": "0.1.2" + "path-root-regex": "^0.1.0" } }, "path-root-regex": { @@ -4100,11 +4100,11 @@ "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", "dev": true, "requires": { - "create-hash": "1.2.0", - "create-hmac": "1.1.7", - "ripemd160": "2.0.2", - "safe-buffer": "5.1.2", - "sha.js": "2.4.11" + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" } }, "pify": { @@ -4125,7 +4125,7 @@ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { - "pinkie": "2.0.4" + "pinkie": "^2.0.0" } }, "plugin-error": { @@ -4134,11 +4134,11 @@ "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", "dev": true, "requires": { - "ansi-cyan": "0.1.1", - "ansi-red": "0.1.1", - "arr-diff": "1.1.0", - "arr-union": "2.1.0", - "extend-shallow": "1.1.4" + "ansi-cyan": "^0.1.1", + "ansi-red": "^0.1.1", + "arr-diff": "^1.0.1", + "arr-union": "^2.0.1", + "extend-shallow": "^1.1.2" }, "dependencies": { "arr-diff": { @@ -4147,8 +4147,8 @@ "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", "dev": true, "requires": { - "arr-flatten": "1.1.0", - "array-slice": "0.2.3" + "arr-flatten": "^1.0.1", + "array-slice": "^0.2.3" } }, "arr-union": { @@ -4169,7 +4169,7 @@ "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", "dev": true, "requires": { - "kind-of": "1.1.0" + "kind-of": "^1.1.0" } }, "kind-of": { @@ -4216,11 +4216,11 @@ "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", "dev": true, "requires": { - "bn.js": "4.11.8", - "browserify-rsa": "4.0.1", - "create-hash": "1.2.0", - "parse-asn1": "5.1.1", - "randombytes": "2.0.6" + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1" } }, "pump": { @@ -4229,8 +4229,8 @@ "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", "dev": true, "requires": { - "end-of-stream": "1.4.1", - "once": "1.4.0" + "end-of-stream": "^1.1.0", + "once": "^1.3.1" }, "dependencies": { "end-of-stream": { @@ -4239,7 +4239,7 @@ "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "dev": true, "requires": { - "once": "1.4.0" + "once": "^1.4.0" } } } @@ -4250,9 +4250,9 @@ "integrity": "sha512-2kmNR9ry+Pf45opRVirpNuIFotsxUGLaYqxIwuR77AYrYRMuFCz9eryHBS52L360O+NcR383CL4QYlMKPq4zYA==", "dev": true, "requires": { - "duplexify": "3.5.4", - "inherits": "2.0.3", - "pump": "2.0.1" + "duplexify": "^3.5.3", + "inherits": "^2.0.3", + "pump": "^2.0.0" } }, "punycode": { @@ -4285,7 +4285,7 @@ "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "^5.1.0" } }, "randomfill": { @@ -4294,8 +4294,8 @@ "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", "dev": true, "requires": { - "randombytes": "2.0.6", - "safe-buffer": "5.1.2" + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" } }, "read-only-stream": { @@ -4304,7 +4304,7 @@ "integrity": "sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A=", "dev": true, "requires": { - "readable-stream": "2.3.6" + "readable-stream": "^2.0.2" } }, "readable-stream": { @@ -4313,13 +4313,13 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "rechoir": { @@ -4328,7 +4328,7 @@ "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", "dev": true, "requires": { - "resolve": "1.1.7" + "resolve": "^1.1.6" } }, "regex-not": { @@ -4337,8 +4337,8 @@ "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", "dev": true, "requires": { - "extend-shallow": "3.0.2", - "safe-regex": "1.1.0" + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" } }, "remove-bom-buffer": { @@ -4347,8 +4347,8 @@ "integrity": "sha512-8v2rWhaakv18qcvNeli2mZ/TMTL2nEyAKRvzo1WtnZBl15SHyEhrCu2/xKlJyUFKHiHgfXIyuY6g2dObJJycXQ==", "dev": true, "requires": { - "is-buffer": "1.1.6", - "is-utf8": "0.2.1" + "is-buffer": "^1.1.5", + "is-utf8": "^0.2.1" } }, "remove-bom-stream": { @@ -4357,9 +4357,9 @@ "integrity": "sha1-BfGlk/FuQuH7kOv1nejlaVJflSM=", "dev": true, "requires": { - "remove-bom-buffer": "3.0.0", - "safe-buffer": "5.1.2", - "through2": "2.0.3" + "remove-bom-buffer": "^3.0.0", + "safe-buffer": "^5.1.0", + "through2": "^2.0.3" } }, "remove-trailing-separator": { @@ -4398,8 +4398,8 @@ "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", "dev": true, "requires": { - "expand-tilde": "2.0.2", - "global-modules": "1.0.0" + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" } }, "resolve-options": { @@ -4408,7 +4408,7 @@ "integrity": "sha1-MrueOcBtZzONyTeMDW1gdFZq0TE=", "dev": true, "requires": { - "value-or-function": "3.0.0" + "value-or-function": "^3.0.0" } }, "resolve-url": { @@ -4430,7 +4430,7 @@ "dev": true, "optional": true, "requires": { - "align-text": "0.1.4" + "align-text": "^0.1.1" } }, "rimraf": { @@ -4439,7 +4439,7 @@ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { - "glob": "7.1.2" + "glob": "^7.0.5" } }, "ripemd160": { @@ -4448,8 +4448,8 @@ "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", "dev": true, "requires": { - "hash-base": "3.0.4", - "inherits": "2.0.3" + "hash-base": "^3.0.0", + "inherits": "^2.0.1" } }, "run-sequence": { @@ -4458,9 +4458,9 @@ "integrity": "sha512-qkzZnQWMZjcKbh3CNly2srtrkaO/2H/SI5f2eliMCapdRD3UhMrwjfOAZJAnZ2H8Ju4aBzFZkBGXUqFs9V0yxw==", "dev": true, "requires": { - "chalk": "1.1.3", - "fancy-log": "1.3.2", - "plugin-error": "0.1.2" + "chalk": "^1.1.3", + "fancy-log": "^1.3.2", + "plugin-error": "^0.1.2" }, "dependencies": { "ansi-styles": { @@ -4475,11 +4475,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" } }, "supports-color": { @@ -4502,7 +4502,7 @@ "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { - "ret": "0.1.15" + "ret": "~0.1.10" } }, "sander": { @@ -4511,10 +4511,10 @@ "integrity": "sha1-dB4kXiMfB8r7b98PEzrfohalAq0=", "dev": true, "requires": { - "es6-promise": "3.3.1", - "graceful-fs": "4.1.11", - "mkdirp": "0.5.1", - "rimraf": "2.6.2" + "es6-promise": "^3.1.2", + "graceful-fs": "^4.1.3", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.2" }, "dependencies": { "graceful-fs": { @@ -4549,10 +4549,10 @@ "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", "dev": true, "requires": { - "extend-shallow": "2.0.1", - "is-extendable": "0.1.1", - "is-plain-object": "2.0.4", - "split-string": "3.1.0" + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" }, "dependencies": { "extend-shallow": { @@ -4561,7 +4561,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "0.1.1" + "is-extendable": "^0.1.0" } } } @@ -4572,8 +4572,8 @@ "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "dev": true, "requires": { - "inherits": "2.0.3", - "safe-buffer": "5.1.2" + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" } }, "shasum": { @@ -4582,8 +4582,8 @@ "integrity": "sha1-5wEjENj0F/TetXEhUOVni4euVl8=", "dev": true, "requires": { - "json-stable-stringify": "0.0.1", - "sha.js": "2.4.11" + "json-stable-stringify": "~0.0.0", + "sha.js": "~2.4.4" } }, "shell-quote": { @@ -4592,10 +4592,10 @@ "integrity": "sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=", "dev": true, "requires": { - "array-filter": "0.0.1", - "array-map": "0.0.0", - "array-reduce": "0.0.0", - "jsonify": "0.0.0" + "array-filter": "~0.0.0", + "array-map": "~0.0.0", + "array-reduce": "~0.0.0", + "jsonify": "~0.0.0" } }, "sigmund": { @@ -4610,14 +4610,14 @@ "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", "dev": true, "requires": { - "base": "0.11.2", - "debug": "2.6.9", - "define-property": "0.2.5", - "extend-shallow": "2.0.1", - "map-cache": "0.2.2", - "source-map": "0.5.7", - "source-map-resolve": "0.5.1", - "use": "3.1.0" + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" }, "dependencies": { "define-property": { @@ -4626,7 +4626,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "0.1.6" + "is-descriptor": "^0.1.0" } }, "extend-shallow": { @@ -4635,7 +4635,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "0.1.1" + "is-extendable": "^0.1.0" } } } @@ -4646,9 +4646,9 @@ "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", "dev": true, "requires": { - "define-property": "1.0.0", - "isobject": "3.0.1", - "snapdragon-util": "3.0.1" + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" }, "dependencies": { "define-property": { @@ -4657,7 +4657,7 @@ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "dev": true, "requires": { - "is-descriptor": "1.0.2" + "is-descriptor": "^1.0.0" } }, "is-accessor-descriptor": { @@ -4666,7 +4666,7 @@ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, "requires": { - "kind-of": "6.0.2" + "kind-of": "^6.0.0" } }, "is-data-descriptor": { @@ -4675,7 +4675,7 @@ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, "requires": { - "kind-of": "6.0.2" + "kind-of": "^6.0.0" } }, "is-descriptor": { @@ -4684,9 +4684,9 @@ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, "requires": { - "is-accessor-descriptor": "1.0.0", - "is-data-descriptor": "1.0.0", - "kind-of": "6.0.2" + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" } } } @@ -4697,7 +4697,7 @@ "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.2.0" }, "dependencies": { "kind-of": { @@ -4706,7 +4706,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -4717,10 +4717,10 @@ "integrity": "sha1-iukK19fLBfxZ8asMY3hF1cFaUrc=", "dev": true, "requires": { - "buffer-crc32": "0.2.13", - "minimist": "1.2.0", - "sander": "0.5.1", - "sourcemap-codec": "1.4.1" + "buffer-crc32": "^0.2.5", + "minimist": "^1.2.0", + "sander": "^0.5.0", + "sourcemap-codec": "^1.3.0" } }, "source-map": { @@ -4735,11 +4735,11 @@ "integrity": "sha512-0KW2wvzfxm8NCTb30z0LMNyPqWCdDGE2viwzUaucqJdkTRXtZiSY3I+2A6nVAjmdOy0I4gU8DwnVVGsk9jvP2A==", "dev": true, "requires": { - "atob": "2.1.0", - "decode-uri-component": "0.2.0", - "resolve-url": "0.2.1", - "source-map-url": "0.4.0", - "urix": "0.1.0" + "atob": "^2.0.0", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" } }, "source-map-support": { @@ -4748,8 +4748,8 @@ "integrity": "sha512-mR7/Nd5l1z6g99010shcXJiNEaf3fEtmLhRB/sBcQVJGodcHCULPp2y4Sfa43Kv2zq7T+Izmfp/WHCR6dYkQCA==", "dev": true, "requires": { - "buffer-from": "1.0.0", - "source-map": "0.6.1" + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" }, "dependencies": { "source-map": { @@ -4784,7 +4784,7 @@ "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", "dev": true, "requires": { - "extend-shallow": "3.0.2" + "extend-shallow": "^3.0.0" } }, "sprintf-js": { @@ -4799,8 +4799,8 @@ "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", "dev": true, "requires": { - "define-property": "0.2.5", - "object-copy": "0.1.0" + "define-property": "^0.2.5", + "object-copy": "^0.1.0" }, "dependencies": { "define-property": { @@ -4809,7 +4809,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "0.1.6" + "is-descriptor": "^0.1.0" } } } @@ -4820,8 +4820,8 @@ "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", "dev": true, "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.6" + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" } }, "stream-combiner2": { @@ -4830,8 +4830,8 @@ "integrity": "sha1-+02KFCDqNidk4hrUeAOXvry0HL4=", "dev": true, "requires": { - "duplexer2": "0.1.4", - "readable-stream": "2.3.6" + "duplexer2": "~0.1.0", + "readable-stream": "^2.0.2" } }, "stream-consume": { @@ -4846,11 +4846,11 @@ "integrity": "sha512-cQ0jo17BLca2r0GfRdZKYAGLU6JRoIWxqSOakUMuKOT6MOK7AAlE856L33QuDmAy/eeOrhLee3dZKX0Uadu93A==", "dev": true, "requires": { - "builtin-status-codes": "3.0.0", - "inherits": "2.0.3", - "readable-stream": "2.3.6", - "to-arraybuffer": "1.0.1", - "xtend": "4.0.1" + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.3.3", + "to-arraybuffer": "^1.0.0", + "xtend": "^4.0.0" } }, "stream-shift": { @@ -4865,8 +4865,8 @@ "integrity": "sha1-G2O+Q4oTPktnHMGTUZdgAXWRDYM=", "dev": true, "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.6" + "inherits": "^2.0.1", + "readable-stream": "^2.0.2" } }, "streamqueue": { @@ -4875,7 +4875,7 @@ "integrity": "sha1-ZvX17JTpuK8knkrsLdH3Qb/pTeM=", "dev": true, "requires": { - "readable-stream": "1.1.14" + "readable-stream": "^1.0.26-2" }, "dependencies": { "isarray": { @@ -4890,10 +4890,10 @@ "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", "isarray": "0.0.1", - "string_decoder": "0.10.31" + "string_decoder": "~0.10.x" } }, "string_decoder": { @@ -4910,7 +4910,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.0" } }, "strip-ansi": { @@ -4919,7 +4919,7 @@ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "strip-bom": { @@ -4928,8 +4928,8 @@ "integrity": "sha1-hbiGLzhEtabV7IRnqTWYFzo295Q=", "dev": true, "requires": { - "first-chunk-stream": "1.0.0", - "is-utf8": "0.2.1" + "first-chunk-stream": "^1.0.0", + "is-utf8": "^0.2.0" } }, "strip-bom-string": { @@ -4944,7 +4944,7 @@ "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", "dev": true, "requires": { - "minimist": "1.2.0" + "minimist": "^1.1.0" } }, "supports-color": { @@ -4953,7 +4953,7 @@ "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "dev": true, "requires": { - "has-flag": "3.0.0" + "has-flag": "^3.0.0" } }, "syntax-error": { @@ -4962,7 +4962,7 @@ "integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==", "dev": true, "requires": { - "acorn-node": "1.3.0" + "acorn-node": "^1.2.0" } }, "through": { @@ -4977,8 +4977,8 @@ "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", "dev": true, "requires": { - "readable-stream": "2.3.6", - "xtend": "4.0.1" + "readable-stream": "^2.1.5", + "xtend": "~4.0.1" } }, "through2-filter": { @@ -4987,8 +4987,8 @@ "integrity": "sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw=", "dev": true, "requires": { - "through2": "2.0.3", - "xtend": "4.0.1" + "through2": "~2.0.0", + "xtend": "~4.0.0" } }, "tildify": { @@ -4997,7 +4997,7 @@ "integrity": "sha1-3OwD9V3Km3qj5bBPIYF+tW5jWIo=", "dev": true, "requires": { - "os-homedir": "1.0.2" + "os-homedir": "^1.0.0" } }, "time-stamp": { @@ -5012,7 +5012,7 @@ "integrity": "sha1-ycWLV1voQHN1y14kYtrO50NZ9B0=", "dev": true, "requires": { - "process": "0.11.10" + "process": "~0.11.0" } }, "timers-ext": { @@ -5021,8 +5021,8 @@ "integrity": "sha512-tsEStd7kmACHENhsUPaxb8Jf8/+GZZxyNFQbZD07HQOyooOa6At1rQqjffgvg7n+dxscQa9cjjMdWhJtsP2sxg==", "dev": true, "requires": { - "es5-ext": "0.10.42", - "next-tick": "1.0.0" + "es5-ext": "~0.10.14", + "next-tick": "1" } }, "to-absolute-glob": { @@ -5031,8 +5031,8 @@ "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", "dev": true, "requires": { - "is-absolute": "1.0.0", - "is-negated-glob": "1.0.0" + "is-absolute": "^1.0.0", + "is-negated-glob": "^1.0.0" } }, "to-arraybuffer": { @@ -5047,7 +5047,7 @@ "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", "dev": true, "requires": { - "kind-of": "3.2.2" + "kind-of": "^3.0.2" }, "dependencies": { "kind-of": { @@ -5056,7 +5056,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.6" + "is-buffer": "^1.1.5" } } } @@ -5067,10 +5067,10 @@ "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", "dev": true, "requires": { - "define-property": "2.0.2", - "extend-shallow": "3.0.2", - "regex-not": "1.0.2", - "safe-regex": "1.1.0" + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" } }, "to-regex-range": { @@ -5079,8 +5079,8 @@ "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", "dev": true, "requires": { - "is-number": "3.0.0", - "repeat-string": "1.6.1" + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" } }, "to-through": { @@ -5089,7 +5089,7 @@ "integrity": "sha1-/JKtq6ByZHvAtn1rA2ZKoZUJOvY=", "dev": true, "requires": { - "through2": "2.0.3" + "through2": "^2.0.3" } }, "travis-fold": { @@ -5110,18 +5110,18 @@ "integrity": "sha1-ElX4ej/1frCw4fDmEKi0dIBGya4=", "dev": true, "requires": { - "babel-code-frame": "6.26.0", - "builtin-modules": "1.1.1", - "chalk": "2.4.0", - "commander": "2.15.1", - "diff": "3.5.0", - "glob": "7.1.2", - "js-yaml": "3.11.0", - "minimatch": "3.0.4", - "resolve": "1.7.1", - "semver": "5.5.0", - "tslib": "1.9.0", - "tsutils": "2.26.1" + "babel-code-frame": "^6.22.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^3.2.0", + "glob": "^7.1.1", + "js-yaml": "^3.7.0", + "minimatch": "^3.0.4", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.12.1" }, "dependencies": { "commander": { @@ -5136,7 +5136,7 @@ "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", "dev": true, "requires": { - "path-parse": "1.0.5" + "path-parse": "^1.0.5" } }, "semver": { @@ -5148,12 +5148,12 @@ } }, "tsutils": { - "version": "2.26.1", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.26.1.tgz", - "integrity": "sha512-bnm9bcjOqOr1UljleL94wVCDlpa6KjfGaTkefeLch4GRafgDkROxPizbB/FxTEdI++5JqhxczRy/Qub0syNqZA==", + "version": "2.26.2", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.26.2.tgz", + "integrity": "sha512-uzwnhmrSbyinPCiwfzGsOY3IulBTwoky7r83HmZdz9QNCjhSCzavkh47KLWuU0zF2F2WbpmmzoJUIEiYyd+jEQ==", "dev": true, "requires": { - "tslib": "1.9.0" + "tslib": "^1.8.1" } }, "tty-browserify": { @@ -5168,7 +5168,7 @@ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", "dev": true, "requires": { - "prelude-ls": "1.1.2" + "prelude-ls": "~1.1.2" } }, "type-detect": { @@ -5184,9 +5184,9 @@ "dev": true }, "typescript": { - "version": "2.9.0-dev.20180425", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.0-dev.20180425.tgz", - "integrity": "sha512-6t/l13ofVeTSJVD78b20E0rkoOcFPrst5bK9vCGDbbjzx+Ab3HoV7fSTuwB8zMEvpxHwQtR+0kR3XUy06HzwUg==", + "version": "2.9.0-dev.20180430", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.0-dev.20180430.tgz", + "integrity": "sha512-KaYA4BpYsxHrnsZFs2DS/fhUkv9dTw72WMZBnCT2VFzn8R036PWjK8StbMaNHh4na9DEViGEEFg5bYBF3wDiIA==", "dev": true }, "uglify-js": { @@ -5196,9 +5196,9 @@ "dev": true, "optional": true, "requires": { - "source-map": "0.5.7", - "uglify-to-browserify": "1.0.2", - "yargs": "3.10.0" + "source-map": "~0.5.1", + "uglify-to-browserify": "~1.0.0", + "yargs": "~3.10.0" } }, "uglify-to-browserify": { @@ -5226,10 +5226,10 @@ "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", "dev": true, "requires": { - "arr-union": "3.1.0", - "get-value": "2.0.6", - "is-extendable": "0.1.1", - "set-value": "0.4.3" + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" }, "dependencies": { "extend-shallow": { @@ -5238,7 +5238,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "0.1.1" + "is-extendable": "^0.1.0" } }, "set-value": { @@ -5247,10 +5247,10 @@ "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", "dev": true, "requires": { - "extend-shallow": "2.0.1", - "is-extendable": "0.1.1", - "is-plain-object": "2.0.4", - "to-object-path": "0.3.0" + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" } } } @@ -5267,8 +5267,8 @@ "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", "dev": true, "requires": { - "has-value": "0.3.1", - "isobject": "3.0.1" + "has-value": "^0.3.1", + "isobject": "^3.0.0" }, "dependencies": { "has-value": { @@ -5277,9 +5277,9 @@ "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", "dev": true, "requires": { - "get-value": "2.0.6", - "has-values": "0.1.4", - "isobject": "2.1.0" + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" }, "dependencies": { "isobject": { @@ -5331,7 +5331,7 @@ "integrity": "sha512-6UJEQM/L+mzC3ZJNM56Q4DFGLX/evKGRg15UJHGB9X5j5Z3AFbgZvjUh2yq/UJUY4U5dh7Fal++XbNg1uzpRAw==", "dev": true, "requires": { - "kind-of": "6.0.2" + "kind-of": "^6.0.2" } }, "user-home": { @@ -5375,7 +5375,7 @@ "integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", "dev": true, "requires": { - "user-home": "1.1.1" + "user-home": "^1.1.1" } }, "value-or-function": { @@ -5390,18 +5390,18 @@ "integrity": "sha1-Ah+cLPlR1rk5lDyJ617lrdT9kkw=", "dev": true, "requires": { - "clone": "2.1.2", - "clone-buffer": "1.0.0", - "clone-stats": "1.0.0", - "cloneable-readable": "1.1.2", - "remove-trailing-separator": "1.1.0", - "replace-ext": "1.0.0" + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" }, "dependencies": { "clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.1.tgz", + "integrity": "sha1-0hfR6WERjjrJpLi7oyhVU79kfNs=", "dev": true }, "clone-stats": { @@ -5424,14 +5424,14 @@ "integrity": "sha1-mmhRzhysHBzqX+hsCTHWIMLPqeY=", "dev": true, "requires": { - "defaults": "1.0.3", - "glob-stream": "3.1.18", - "glob-watcher": "0.0.6", - "graceful-fs": "3.0.11", - "mkdirp": "0.5.1", - "strip-bom": "1.0.0", - "through2": "0.6.5", - "vinyl": "0.4.6" + "defaults": "^1.0.0", + "glob-stream": "^3.1.5", + "glob-watcher": "^0.0.6", + "graceful-fs": "^3.0.0", + "mkdirp": "^0.5.0", + "strip-bom": "^1.0.0", + "through2": "^0.6.1", + "vinyl": "^0.4.0" }, "dependencies": { "clone": { @@ -5452,10 +5452,10 @@ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", "isarray": "0.0.1", - "string_decoder": "0.10.31" + "string_decoder": "~0.10.x" } }, "string_decoder": { @@ -5470,8 +5470,8 @@ "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { - "readable-stream": "1.0.34", - "xtend": "4.0.1" + "readable-stream": ">=1.0.33-1 <1.1.0-0", + "xtend": ">=4.0.0 <4.1.0-0" } }, "vinyl": { @@ -5480,8 +5480,8 @@ "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", "dev": true, "requires": { - "clone": "0.2.0", - "clone-stats": "0.0.1" + "clone": "^0.2.0", + "clone-stats": "^0.0.1" } } } @@ -5492,13 +5492,13 @@ "integrity": "sha1-kqgAWTo4cDqM2xHYswCtS+Y7PhY=", "dev": true, "requires": { - "append-buffer": "1.0.2", - "convert-source-map": "1.5.1", - "graceful-fs": "4.1.11", - "normalize-path": "2.1.1", - "now-and-later": "2.0.0", - "remove-bom-buffer": "3.0.0", - "vinyl": "2.1.0" + "append-buffer": "^1.0.2", + "convert-source-map": "^1.5.0", + "graceful-fs": "^4.1.6", + "normalize-path": "^2.1.1", + "now-and-later": "^2.0.0", + "remove-bom-buffer": "^3.0.0", + "vinyl": "^2.0.0" }, "dependencies": { "graceful-fs": { @@ -5521,7 +5521,7 @@ "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "dev": true, "requires": { - "isexe": "2.0.0" + "isexe": "^2.0.0" } }, "window-size": { @@ -5549,8 +5549,8 @@ "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", "dev": true, "requires": { - "sax": "1.2.4", - "xmlbuilder": "9.0.7" + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" } }, "xmlbuilder": { @@ -5572,9 +5572,9 @@ "dev": true, "optional": true, "requires": { - "camelcase": "1.2.1", - "cliui": "2.1.0", - "decamelize": "1.2.0", + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", "window-size": "0.1.0" } } diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 2557e3b707827..d470a9d778509 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -118,6 +118,7 @@ namespace ts { let thisParentContainer: Node; // Container one level up let blockScopeContainer: Node; let lastContainer: Node; + let delayedTypedefs: { typedef: JSDocTypedefTag, container: Node, lastContainer: Node, blockScopeContainer: Node, parent: Node }[]; let seenThisKeyword: boolean; // state used by control flow analysis @@ -176,6 +177,7 @@ namespace ts { bind(file); file.symbolCount = symbolCount; file.classifiableNames = classifiableNames; + delayedBindJSDocTypedefTag(); } file = undefined; @@ -186,6 +188,7 @@ namespace ts { thisParentContainer = undefined; blockScopeContainer = undefined; lastContainer = undefined; + delayedTypedefs = undefined; seenThisKeyword = false; currentFlow = undefined; currentBreakTarget = undefined; @@ -450,8 +453,7 @@ namespace ts { // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. if (node.kind === SyntaxKind.JSDocTypedefTag) Debug.assert(isInJavaScriptFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. - const isJSDocTypedefInJSDocNamespace = isJSDocTypedefTag(node) && node.name && node.name.kind === SyntaxKind.Identifier && node.name.isInJSDocNamespace; - if ((!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) || isJSDocTypedefInJSDocNamespace) { + if ((!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) || isJSDocTypedefTag(node)) { if (hasModifier(node, ModifierFlags.Default) && !getDeclarationName(node)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default! } @@ -1727,7 +1729,7 @@ namespace ts { declareModuleMember(node, symbolFlags, symbolExcludes); break; case SyntaxKind.SourceFile: - if (isExternalModule(container)) { + if (isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; } @@ -1745,6 +1747,24 @@ namespace ts { bindBlockScopedDeclaration(node, SymbolFlags.BlockScopedVariable, SymbolFlags.BlockScopedVariableExcludes); } + function delayedBindJSDocTypedefTag() { + if (!delayedTypedefs) { + return; + } + const saveContainer = container; + const saveLastContainer = lastContainer; + const saveBlockScopeContainer = blockScopeContainer; + const saveParent = parent; + for (const delay of delayedTypedefs) { + ({ container, lastContainer, blockScopeContainer, parent } = delay); + bindBlockScopedDeclaration(delay.typedef, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes); + } + container = saveContainer; + lastContainer = saveLastContainer; + blockScopeContainer = saveBlockScopeContainer; + parent = saveParent; + } + // The binder visits every node in the syntax tree so it is a convenient place to perform a single localized // check for reserved words used as identifiers in strict mode code. function checkStrictModeIdentifier(node: Identifier) { @@ -2194,7 +2214,7 @@ namespace ts { case SyntaxKind.JSDocTypedefTag: { const { fullName } = node as JSDocTypedefTag; if (!fullName || fullName.kind === SyntaxKind.Identifier) { - return bindBlockScopedDeclaration(node, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes); + (delayedTypedefs || (delayedTypedefs = [])).push({ typedef: node as JSDocTypedefTag, container, lastContainer, blockScopeContainer, parent }); } break; } @@ -2304,7 +2324,10 @@ namespace ts { return s; }); if (symbol) { - declareSymbol(symbol.exports, symbol, lhs, SymbolFlags.Property | SymbolFlags.ExportValue, SymbolFlags.None); + const flags = isClassExpression(node.right) ? + SymbolFlags.Property | SymbolFlags.ExportValue | SymbolFlags.Class : + SymbolFlags.Property | SymbolFlags.ExportValue; + declareSymbol(symbol.exports, symbol, lhs, flags, SymbolFlags.None); } } diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 92e651061eda3..6dd3226e550ee 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -249,7 +249,7 @@ namespace ts { export function createBuilderProgram(kind: BuilderProgramKind, { newProgram, host, oldProgram, configFileParsingDiagnostics }: BuilderCreationParameters) { // Return same program if underlying program doesnt change let oldState = oldProgram && oldProgram.getState(); - if (oldState && newProgram === oldState.program && configFileParsingDiagnostics !== newProgram.getConfigFileParsingDiagnostics()) { + if (oldState && newProgram === oldState.program && configFileParsingDiagnostics === newProgram.getConfigFileParsingDiagnostics()) { newProgram = undefined; oldState = undefined; return oldProgram; diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fa485b68a9237..d825b0d971758 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -60,7 +60,7 @@ namespace ts { const compilerOptions = host.getCompilerOptions(); const languageVersion = getEmitScriptTarget(compilerOptions); - const modulekind = getEmitModuleKind(compilerOptions); + const moduleKind = getEmitModuleKind(compilerOptions); const allowSyntheticDefaultImports = getAllowSyntheticDefaultImports(compilerOptions); const strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks"); const strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes"); @@ -75,6 +75,8 @@ namespace ts { const undefinedSymbol = createSymbol(SymbolFlags.Property, "undefined" as __String); undefinedSymbol.declarations = []; const argumentsSymbol = createSymbol(SymbolFlags.Property, "arguments" as __String); + const requireSymbol = createSymbol(SymbolFlags.Property, "require" as __String); + const moduleSymbol = createSymbol(SymbolFlags.Property, "module" as __String); /** This will be set during calls to `getResolvedSignature` where services determines an apparent number of arguments greater than what is actually provided. */ let apparentArgumentCount: number | undefined; @@ -443,6 +445,7 @@ namespace ts { let deferredGlobalAsyncIteratorType: GenericType; let deferredGlobalAsyncIterableIteratorType: GenericType; let deferredGlobalTemplateStringsArrayType: ObjectType; + let deferredGlobalImportMetaType: ObjectType; let deferredGlobalExtractSymbol: Symbol; let deferredNodes: Node[]; @@ -617,22 +620,6 @@ namespace ts { Both = Source | Target, } - const enum TypeIncludes { - Any = 1 << 0, - Undefined = 1 << 1, - Null = 1 << 2, - Never = 1 << 3, - NonWideningType = 1 << 4, - String = 1 << 5, - Number = 1 << 6, - ESSymbol = 1 << 7, - LiteralOrUniqueESSymbol = 1 << 8, - ObjectType = 1 << 9, - EmptyObject = 1 << 10, - Union = 1 << 11, - Wildcard = 1 << 12, - } - const enum MembersOrExportsResolutionKind { resolvedExports = "resolvedExports", resolvedMembers = "resolvedMembers" @@ -1094,7 +1081,7 @@ namespace ts { const declarationFile = getSourceFileOfNode(declaration); const useFile = getSourceFileOfNode(usage); if (declarationFile !== useFile) { - if ((modulekind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) || + if ((moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) || (!compilerOptions.outFile && !compilerOptions.out) || isInTypeQuery(usage) || declaration.flags & NodeFlags.Ambient) { @@ -1126,6 +1113,10 @@ namespace ts { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration as VariableDeclaration, usage); } + else if (isClassDeclaration(declaration)) { + // still might be illegal if the usage is within a computed property name in the class (eg class A { static p = "a"; [A.p]() {} }) + return !findAncestor(usage, n => isComputedPropertyName(n) && n.parent.parent === declaration); + } return true; } @@ -1481,7 +1472,17 @@ namespace ts { result = lookup(globals, name, meaning); } } - + if (!result) { + if (originalLocation && isInJavaScriptFile(originalLocation) && originalLocation.parent) { + if (isRequireCall(originalLocation.parent, /*checkArgumentIsStringLiteralLike*/ false)) { + return requireSymbol; + } + if (isIdentifier(originalLocation) && isPropertyAccessExpression(originalLocation.parent) && + originalLocation.escapedText === "module" && originalLocation.parent.name.escapedText === "exports") { + return moduleSymbol; + } + } + } if (!result) { if (nameNotFoundMessage) { if (!errorLocation || @@ -4180,7 +4181,7 @@ namespace ts { const isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (ModifierFlags.Private | ModifierFlags.Protected); const isSetOnlyAccessor = prop.flags & SymbolFlags.SetAccessor && !(prop.flags & SymbolFlags.GetAccessor); if (!inNamesToRemove && !isPrivate && !isClassMethod(prop) && !isSetOnlyAccessor) { - members.set(prop.escapedName, prop); + members.set(prop.escapedName, getNonReadonlySymbol(prop)); } } const stringIndexInfo = getIndexInfoOfType(source, IndexKind.String); @@ -4227,12 +4228,29 @@ namespace ts { const isLate = isLateBindableName(name); const isWellKnown = isComputedPropertyName(name) && isWellKnownSymbolSyntactically(name.expression); if (!isLate && !isWellKnown && isComputedNonLiteralName(name)) { - return anyType; + const exprType = checkExpression((name as ComputedPropertyName).expression); + if (isTypeAssignableToKind(exprType, TypeFlags.ESSymbolLike)) { + if (noImplicitAny) { + error(declaration, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(exprType), typeToString(parentType)); + } + return anyType; + } + const indexerType = isTypeAssignableToKind(exprType, TypeFlags.NumberLike) && getIndexTypeOfType(parentType, IndexKind.Number) || getIndexTypeOfType(parentType, IndexKind.String); + if (!indexerType && noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) { + if (getIndexTypeOfType(parentType, IndexKind.Number)) { + error(declaration, Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number); + } + else { + error(declaration, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(parentType)); + } + } + return indexerType || anyType; } // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. - const text = isLate ? getLateBoundNameFromType(checkComputedPropertyName(name as ComputedPropertyName) as LiteralType | UniqueESSymbolType) : + const nameType = isLate && checkComputedPropertyName(name as ComputedPropertyName) as LiteralType | UniqueESSymbolType; + const text = isLate ? getLateBoundNameFromType(nameType) : isWellKnown ? getPropertyNameForKnownSymbolName(idText(((name as ComputedPropertyName).expression as PropertyAccessExpression).name)) : getTextOfPropertyName(name); @@ -4240,6 +4258,12 @@ namespace ts { if (strictNullChecks && declaration.flags & NodeFlags.Ambient && isParameterDeclaration(declaration)) { parentType = getNonNullableType(parentType); } + if (isLate && nameType && !getPropertyOfType(parentType, text) && isTypeAssignableToKind(nameType, TypeFlags.ESSymbolLike)) { + if (noImplicitAny) { + error(declaration, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(nameType), typeToString(parentType)); + } + return anyType; + } const declaredType = getConstraintForLocation(getTypeOfPropertyOfType(parentType, text), declaration.name); type = declaredType && getFlowTypeOfReference(declaration, declaredType) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, IndexKind.Number) || @@ -4671,6 +4695,10 @@ namespace ts { if (symbol.flags & SymbolFlags.Prototype) { return links.type = getTypeOfPrototypeProperty(symbol); } + // CommonsJS require/module/exports all have type any. + if (symbol === requireSymbol || symbol === moduleSymbol) { + return links.type = anyType; + } // Handle catch clause variables const declaration = symbol.valueDeclaration; if (isCatchClauseVariableDeclarationOrBindingElement(declaration)) { @@ -6470,6 +6498,47 @@ namespace ts { return getConstraintOfDistributiveConditionalType(type) || getDefaultConstraintOfConditionalType(type); } + function getUnionConstraintOfIntersection(type: IntersectionType, targetIsUnion: boolean) { + let constraints: Type[]; + let hasDisjointDomainType = false; + for (const t of type.types) { + if (t.flags & TypeFlags.Instantiable) { + // We keep following constraints as long as we have an instantiable type that is known + // not to be circular or infinite (hence we stop on index access types). + let constraint = getConstraintOfType(t); + while (constraint && constraint.flags & (TypeFlags.TypeParameter | TypeFlags.Index | TypeFlags.Conditional)) { + constraint = getConstraintOfType(constraint); + } + if (constraint) { + // A constraint that isn't a union type implies that the final type would be a non-union + // type as well. Since non-union constraints are of no interest, we can exit here. + if (!(constraint.flags & TypeFlags.Union)) { + return undefined; + } + constraints = append(constraints, constraint); + } + } + else if (t.flags & TypeFlags.DisjointDomains) { + hasDisjointDomainType = true; + } + } + // If the target is a union type or if we are intersecting with types belonging to one of the + // disjoint domans, we may end up producing a constraint that hasn't been examined before. + if (constraints && (targetIsUnion || hasDisjointDomainType)) { + if (hasDisjointDomainType) { + // We add any types belong to one of the disjoint domans because they might cause the final + // intersection operation to reduce the union constraints. + for (const t of type.types) { + if (t.flags & TypeFlags.DisjointDomains) { + constraints = append(constraints, t); + } + } + } + return getIntersectionType(constraints); + } + return undefined; + } + function getBaseConstraintOfInstantiableNonPrimitiveUnionOrIntersection(type: Type) { if (type.flags & (TypeFlags.InstantiableNonPrimitive | TypeFlags.UnionOrIntersection)) { const constraint = getResolvedBaseConstraint(type); @@ -6677,7 +6746,15 @@ namespace ts { let nameType: Type; const propTypes: Type[] = []; let first = true; + let commonValueDeclaration: Declaration; + let hasNonUniformValueDeclaration = false; for (const prop of props) { + if (!commonValueDeclaration) { + commonValueDeclaration = prop.valueDeclaration; + } + else if (prop.valueDeclaration !== commonValueDeclaration) { + hasNonUniformValueDeclaration = true; + } declarations = addRange(declarations, prop.declarations); const type = getTypeOfSymbol(prop); if (first) { @@ -6694,6 +6771,9 @@ namespace ts { } const result = createSymbol(SymbolFlags.Property | commonFlags, name, syntheticFlag | checkFlags); result.containingType = containingType; + if (!hasNonUniformValueDeclaration && commonValueDeclaration) { + result.valueDeclaration = commonValueDeclaration; + } result.declarations = declarations; result.nameType = nameType; result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes); @@ -7562,23 +7642,38 @@ namespace ts { return unknownType; } - // A jsdoc TypeReference may have resolved to a value (as opposed to a type). If - // the symbol is a constructor function, return the inferred class type; otherwise, - // the type of this reference is just the type of the value we resolved to. + const jsdocType = getJSDocTypeReference(node, symbol, typeArguments); + if (jsdocType) { + return jsdocType; + } + + // Resolve the type reference as a Type for the purpose of reporting errors. + resolveTypeReferenceName(getTypeReferenceName(node), SymbolFlags.Type); + return getTypeOfSymbol(symbol); + } + + /** + * A jsdoc TypeReference may have resolved to a value (as opposed to a type). If + * the symbol is a constructor function, return the inferred class type; otherwise, + * the type of this reference is just the type of the value we resolved to. + */ + function getJSDocTypeReference(node: NodeWithTypeArguments, symbol: Symbol, typeArguments: Type[]): Type | undefined { const assignedType = getAssignedClassType(symbol); const valueType = getTypeOfSymbol(symbol); - const referenceType = valueType.symbol && !isInferredClassType(valueType) && getTypeReferenceTypeWorker(node, valueType.symbol, typeArguments); + const referenceType = valueType.symbol && valueType.symbol !== symbol && !isInferredClassType(valueType) && getTypeReferenceTypeWorker(node, valueType.symbol, typeArguments); if (referenceType || assignedType) { return referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType; } - - // Resolve the type reference as a Type for the purpose of reporting errors. - resolveTypeReferenceName(getTypeReferenceName(node), SymbolFlags.Type); - return valueType; } function getTypeReferenceTypeWorker(node: NodeWithTypeArguments, symbol: Symbol, typeArguments: Type[]): Type | undefined { if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { + if (symbol.valueDeclaration && isBinaryExpression(symbol.valueDeclaration.parent)) { + const jsdocType = getJSDocTypeReference(node, symbol, typeArguments); + if (jsdocType) { + return jsdocType; + } + } return getTypeFromClassOrInterfaceReference(node, symbol, typeArguments); } @@ -7785,6 +7880,10 @@ namespace ts { return deferredGlobalTemplateStringsArrayType || (deferredGlobalTemplateStringsArrayType = getGlobalType("TemplateStringsArray" as __String, /*arity*/ 0, /*reportErrors*/ true)) || emptyObjectType; } + function getGlobalImportMetaType() { + return deferredGlobalImportMetaType || (deferredGlobalImportMetaType = getGlobalType("ImportMeta" as __String, /*arity*/ 0, /*reportErrors*/ true)) || emptyObjectType; + } + function getGlobalESSymbolConstructorSymbol(reportErrors: boolean) { return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol" as __String, reportErrors)); } @@ -7940,8 +8039,14 @@ namespace ts { return binarySearch(types, type, getTypeId, compareValues) >= 0; } - // Return true if the given intersection type contains (a) more than one unit type or (b) an object - // type and a nullable type (null or undefined). + // Return true if the given intersection type contains + // more than one unit type or, + // an object type and a nullable type (null or undefined), or + // a string-like type and a type known to be non-string-like, or + // a number-like type and a type known to be non-number-like, or + // a symbol-like type and a type known to be non-symbol-like, or + // a void-like type and a type known to be non-void-like, or + // a non-primitive type and a type known to be primitive. function isEmptyIntersectionType(type: IntersectionType) { let combined: TypeFlags = 0; for (const t of type.types) { @@ -7949,42 +8054,43 @@ namespace ts { return true; } combined |= t.flags; - if (combined & TypeFlags.Nullable && combined & (TypeFlags.Object | TypeFlags.NonPrimitive)) { + if (combined & TypeFlags.Nullable && combined & (TypeFlags.Object | TypeFlags.NonPrimitive) || + combined & TypeFlags.NonPrimitive && combined & (TypeFlags.DisjointDomains & ~TypeFlags.NonPrimitive) || + combined & TypeFlags.StringLike && combined & (TypeFlags.DisjointDomains & ~TypeFlags.StringLike) || + combined & TypeFlags.NumberLike && combined & (TypeFlags.DisjointDomains & ~TypeFlags.NumberLike) || + combined & TypeFlags.ESSymbolLike && combined & (TypeFlags.DisjointDomains & ~TypeFlags.ESSymbolLike) || + combined & TypeFlags.VoidLike && combined & (TypeFlags.DisjointDomains & ~TypeFlags.VoidLike)) { return true; } } return false; } - function addTypeToUnion(typeSet: Type[], includes: TypeIncludes, type: Type) { + function addTypeToUnion(typeSet: Type[], includes: TypeFlags, type: Type) { const flags = type.flags; if (flags & TypeFlags.Union) { - includes = addTypesToUnion(typeSet, includes, (type).types); - } - else if (flags & TypeFlags.Any) { - includes |= TypeIncludes.Any; - if (type === wildcardType) includes |= TypeIncludes.Wildcard; - } - else if (!strictNullChecks && flags & TypeFlags.Nullable) { - if (flags & TypeFlags.Undefined) includes |= TypeIncludes.Undefined; - if (flags & TypeFlags.Null) includes |= TypeIncludes.Null; - if (!(flags & TypeFlags.ContainsWideningType)) includes |= TypeIncludes.NonWideningType; - } - else if (!(flags & TypeFlags.Never || flags & TypeFlags.Intersection && isEmptyIntersectionType(type))) { - // We ignore 'never' types in unions. Likewise, we ignore intersections of unit types as they are - // another form of 'never' (in that they have an empty value domain). We could in theory turn - // intersections of unit types into 'never' upon construction, but deferring the reduction makes it - // easier to reason about their origin. - if (flags & TypeFlags.String) includes |= TypeIncludes.String; - if (flags & TypeFlags.Number) includes |= TypeIncludes.Number; - if (flags & TypeFlags.ESSymbol) includes |= TypeIncludes.ESSymbol; - if (flags & TypeFlags.StringOrNumberLiteralOrUnique) includes |= TypeIncludes.LiteralOrUniqueESSymbol; - const len = typeSet.length; - const index = len && type.id > typeSet[len - 1].id ? ~len : binarySearch(typeSet, type, getTypeId, compareValues); - if (index < 0) { - if (!(flags & TypeFlags.Object && (type).objectFlags & ObjectFlags.Anonymous && - type.symbol && type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method) && containsIdenticalType(typeSet, type))) { - typeSet.splice(~index, 0, type); + return addTypesToUnion(typeSet, includes, (type).types); + } + // We ignore 'never' types in unions. Likewise, we ignore intersections of unit types as they are + // another form of 'never' (in that they have an empty value domain). We could in theory turn + // 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 (flags & TypeFlags.Any) { + if (type === wildcardType) includes |= TypeFlags.Wildcard; + } + else if (!strictNullChecks && flags & TypeFlags.Nullable) { + if (!(flags & TypeFlags.ContainsWideningType)) includes |= TypeFlags.NonWideningType; + } + else { + const len = typeSet.length; + const index = len && type.id > typeSet[len - 1].id ? ~len : binarySearch(typeSet, type, getTypeId, compareValues); + if (index < 0) { + if (!(flags & TypeFlags.Object && (type).objectFlags & ObjectFlags.Anonymous && + type.symbol && type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method) && containsIdenticalType(typeSet, type))) { + typeSet.splice(~index, 0, type); + } } } } @@ -7993,7 +8099,7 @@ namespace ts { // Add the given types to the given type set. Order is preserved, duplicates are removed, // and nested types of the given kind are flattened into the set. - function addTypesToUnion(typeSet: Type[], includes: TypeIncludes, types: Type[]): TypeIncludes { + function addTypesToUnion(typeSet: Type[], includes: TypeFlags, types: Type[]): TypeFlags { for (const type of types) { includes = addTypeToUnion(typeSet, includes, type); } @@ -8050,15 +8156,15 @@ namespace ts { } } - function removeRedundantLiteralTypes(types: Type[], includes: TypeIncludes) { + function removeRedundantLiteralTypes(types: Type[], includes: TypeFlags) { let i = types.length; while (i > 0) { i--; const t = types[i]; const remove = - t.flags & TypeFlags.StringLiteral && includes & TypeIncludes.String || - t.flags & TypeFlags.NumberLiteral && includes & TypeIncludes.Number || - t.flags & TypeFlags.UniqueESSymbol && includes & TypeIncludes.ESSymbol || + t.flags & TypeFlags.StringLiteral && includes & TypeFlags.String || + t.flags & TypeFlags.NumberLiteral && includes & TypeFlags.Number || + t.flags & TypeFlags.UniqueESSymbol && includes & TypeFlags.ESSymbol || t.flags & TypeFlags.StringOrNumberLiteral && t.flags & TypeFlags.FreshLiteral && containsType(types, (t).regularType); if (remove) { orderedRemoveItemAt(types, i); @@ -8082,12 +8188,12 @@ namespace ts { } const typeSet: Type[] = []; const includes = addTypesToUnion(typeSet, 0, types); - if (includes & TypeIncludes.Any) { - return includes & TypeIncludes.Wildcard ? wildcardType : anyType; + if (includes & TypeFlags.Any) { + return includes & TypeFlags.Wildcard ? wildcardType : anyType; } switch (unionReduction) { case UnionReduction.Literal: - if (includes & TypeIncludes.LiteralOrUniqueESSymbol) { + if (includes & TypeFlags.StringOrNumberLiteralOrUnique) { removeRedundantLiteralTypes(typeSet, includes); } break; @@ -8096,8 +8202,8 @@ namespace ts { break; } if (typeSet.length === 0) { - return includes & TypeIncludes.Null ? includes & TypeIncludes.NonWideningType ? nullType : nullWideningType : - includes & TypeIncludes.Undefined ? includes & TypeIncludes.NonWideningType ? undefinedType : undefinedWideningType : + return includes & TypeFlags.Null ? includes & TypeFlags.NonWideningType ? nullType : nullWideningType : + includes & TypeFlags.Undefined ? includes & TypeFlags.NonWideningType ? undefinedType : undefinedWideningType : neverType; } return getUnionTypeFromSortedList(typeSet, aliasSymbol, aliasTypeArguments); @@ -8175,30 +8281,23 @@ namespace ts { return links.resolvedType; } - function addTypeToIntersection(typeSet: Type[], includes: TypeIncludes, type: Type) { + function addTypeToIntersection(typeSet: Type[], includes: TypeFlags, type: Type) { const flags = type.flags; if (flags & TypeFlags.Intersection) { - includes = addTypesToIntersection(typeSet, includes, (type).types); + return addTypesToIntersection(typeSet, includes, (type).types); } - else if (flags & TypeFlags.Any) { - includes |= TypeIncludes.Any; - if (type === wildcardType) includes |= TypeIncludes.Wildcard; + if (getObjectFlags(type) & ObjectFlags.Anonymous && isEmptyObjectType(type)) { + includes |= TypeFlags.EmptyObject; } - else if (flags & TypeFlags.Never) { - includes |= TypeIncludes.Never; - } - else if (getObjectFlags(type) & ObjectFlags.Anonymous && isEmptyObjectType(type)) { - includes |= TypeIncludes.EmptyObject; - } - else if ((strictNullChecks || !(flags & TypeFlags.Nullable)) && !contains(typeSet, type)) { - if (flags & TypeFlags.Object) { - includes |= TypeIncludes.ObjectType; - } - if (flags & TypeFlags.Union) { - includes |= TypeIncludes.Union; - } - if (!(flags & TypeFlags.Object && (type).objectFlags & ObjectFlags.Anonymous && - type.symbol && type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method) && containsIdenticalType(typeSet, type))) { + else { + includes |= flags & ~TypeFlags.ConstructionFlags; + if (flags & TypeFlags.Any) { + if (type === wildcardType) includes |= TypeFlags.Wildcard; + } + else if ((strictNullChecks || !(flags & TypeFlags.Nullable)) && !contains(typeSet, type) && + !(flags & TypeFlags.Object && (type).objectFlags & ObjectFlags.Anonymous && + type.symbol && type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method) && + containsIdenticalType(typeSet, type))) { typeSet.push(type); } } @@ -8207,13 +8306,28 @@ namespace ts { // Add the given types to the given type set. Order is preserved, freshness is removed from literal // types, duplicates are removed, and nested types of the given kind are flattened into the set. - function addTypesToIntersection(typeSet: Type[], includes: TypeIncludes, types: Type[]) { + function addTypesToIntersection(typeSet: Type[], includes: TypeFlags, types: Type[]) { for (const type of types) { includes = addTypeToIntersection(typeSet, includes, getRegularTypeOfLiteralType(type)); } return includes; } + function removeRedundantPrimitiveTypes(types: Type[], includes: TypeFlags) { + let i = types.length; + while (i > 0) { + i--; + const t = types[i]; + const remove = + t.flags & TypeFlags.String && includes & TypeFlags.StringLiteral || + t.flags & TypeFlags.Number && includes & TypeFlags.NumberLiteral || + t.flags & TypeFlags.ESSymbol && includes & TypeFlags.UniqueESSymbol; + if (remove) { + orderedRemoveItemAt(types, i); + } + } + } + // We normalize combinations of intersection and union types based on the distributive property of the '&' // operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection // types with union type constituents into equivalent union types with intersection type constituents and @@ -8230,19 +8344,24 @@ namespace ts { } const typeSet: Type[] = []; const includes = addTypesToIntersection(typeSet, 0, types); - if (includes & TypeIncludes.Never) { + if (includes & TypeFlags.Never) { return neverType; } - if (includes & TypeIncludes.Any) { - return includes & TypeIncludes.Wildcard ? wildcardType : anyType; + if (includes & TypeFlags.Any) { + return includes & TypeFlags.Wildcard ? wildcardType : anyType; } - if (includes & TypeIncludes.EmptyObject && !(includes & TypeIncludes.ObjectType)) { + if (includes & TypeFlags.String && includes & TypeFlags.StringLiteral || + includes & TypeFlags.Number && includes & TypeFlags.NumberLiteral || + includes & TypeFlags.ESSymbol && includes & TypeFlags.UniqueESSymbol) { + removeRedundantPrimitiveTypes(typeSet, includes); + } + if (includes & TypeFlags.EmptyObject && !(includes & TypeFlags.Object)) { typeSet.push(emptyObjectType); } if (typeSet.length === 1) { return typeSet[0]; } - if (includes & TypeIncludes.Union) { + if (includes & TypeFlags.Union) { // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. const unionIndex = findIndex(typeSet, t => (t.flags & TypeFlags.Union) !== 0); @@ -10169,6 +10288,23 @@ namespace ts { } } } + if (!result && source.flags & TypeFlags.Intersection) { + // The combined constraint of an intersection type is the intersection of the constraints of + // the constituents. When an intersection type contains instantiable types with union type + // constraints, there are situations where we need to examine the combined constraint. One is + // when the target is a union type. Another is when the intersection contains types belonging + // to one of the disjoint domains. For example, given type variables T and U, each with the + // constraint 'string | number', the combined constraint of 'T & U' is 'string | number' and + // we need to check this constraint against a union on the target side. Also, given a type + // variable V constrained to 'string | number', 'V & number' has a combined constraint of + // 'string & number | number & number' which reduces to just 'number'. + const constraint = getUnionConstraintOfIntersection(source, !!(target.flags & TypeFlags.Union)); + if (constraint) { + if (result = isRelatedTo(constraint, target, reportErrors)) { + errorInfo = saveErrorInfo; + } + } + } isIntersectionConstituent = saveIsIntersectionConstituent; @@ -10526,11 +10662,14 @@ namespace ts { } } // A type S is assignable to keyof T if S is assignable to keyof C, where C is the - // constraint of T. - const constraint = getConstraintForRelation((target).type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint, (target as IndexType).stringsOnly), reportErrors)) { - return result; + // simplified form of T or, if T doesn't simplify, the constraint of T. + if (relation !== definitelyAssignableRelation) { + const simplified = getSimplifiedType((target).type); + const constraint = simplified !== (target).type ? simplified : getConstraintOfType((target).type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint, (target as IndexType).stringsOnly), reportErrors)) { + return result; + } } } } @@ -10566,23 +10705,8 @@ namespace ts { } } - if (source.flags & TypeFlags.TypeParameter) { - let constraint = getConstraintForRelation(source); - // A type parameter with no constraint is not related to the non-primitive object type. - if (constraint || !(target.flags & TypeFlags.NonPrimitive)) { - if (!constraint || constraint.flags & TypeFlags.Any) { - constraint = emptyObjectType; - } - // Report constraint errors only if the constraint is not the empty object type - const reportConstraintErrors = reportErrors && constraint !== emptyObjectType; - if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { - errorInfo = saveErrorInfo; - return result; - } - } - } - else if (source.flags & TypeFlags.IndexedAccess) { - if (target.flags & TypeFlags.IndexedAccess) { + if (source.flags & TypeFlags.TypeVariable) { + if (source.flags & TypeFlags.IndexedAccess && target.flags & TypeFlags.IndexedAccess) { // A type S[K] is related to a type T[J] if S is related to T and K is related to J. if (result = isRelatedTo((source).objectType, (target).objectType, reportErrors)) { result &= isRelatedTo((source).indexType, (target).indexType, reportErrors); @@ -10592,11 +10716,15 @@ namespace ts { return result; } } - // A type S[K] is related to a type T if C is related to T, where C is the - // constraint of S[K]. - const constraint = getConstraintForRelation(source); - if (constraint) { - if (result = isRelatedTo(constraint, target, reportErrors)) { + let constraint = getConstraintForRelation(source); + // A type variable with no constraint is not related to the non-primitive object type. + if (constraint || !(target.flags & TypeFlags.NonPrimitive)) { + if (!constraint || constraint.flags & TypeFlags.Any) { + constraint = emptyObjectType; + } + // Report constraint errors only if the constraint is not the empty object type + const reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { errorInfo = saveErrorInfo; return result; } @@ -10774,13 +10902,14 @@ namespace ts { const sourcePropFlags = getDeclarationModifierFlagsFromSymbol(sourceProp); const targetPropFlags = getDeclarationModifierFlagsFromSymbol(targetProp); if (sourcePropFlags & ModifierFlags.Private || targetPropFlags & ModifierFlags.Private) { - if (getCheckFlags(sourceProp) & CheckFlags.ContainsPrivate) { + const hasDifferingDeclarations = sourceProp.valueDeclaration !== targetProp.valueDeclaration; + if (getCheckFlags(sourceProp) & CheckFlags.ContainsPrivate && hasDifferingDeclarations) { if (reportErrors) { reportError(Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source)); } return Ternary.False; } - if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { + if (hasDifferingDeclarations) { if (reportErrors) { if (sourcePropFlags & ModifierFlags.Private && targetPropFlags & ModifierFlags.Private) { reportError(Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); @@ -11463,6 +11592,10 @@ namespace ts { return !!getPropertyOfType(type, "0" as __String); } + function isNeitherUnitTypeNorNever(type: Type): boolean { + return !(type.flags & (TypeFlags.Unit | TypeFlags.Never)); + } + function isUnitType(type: Type): boolean { return !!(type.flags & TypeFlags.Unit); } @@ -12942,8 +13075,7 @@ namespace ts { function getTypeOfSwitchClause(clause: CaseClause | DefaultClause) { if (clause.kind === SyntaxKind.CaseClause) { - const caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); - return isUnitType(caseType) ? caseType : undefined; + return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; } @@ -12951,15 +13083,9 @@ namespace ts { function getSwitchClauseTypes(switchStatement: SwitchStatement): Type[] { const links = getNodeLinks(switchStatement); if (!links.switchTypes) { - // If all case clauses specify expressions that have unit types, we return an array - // of those unit types. Otherwise we return an empty array. links.switchTypes = []; for (const clause of switchStatement.caseBlock.clauses) { - const type = getTypeOfSwitchClause(clause); - if (type === undefined) { - return links.switchTypes = emptyArray; - } - links.switchTypes.push(type); + links.switchTypes.push(getTypeOfSwitchClause(clause)); } } return links.switchTypes; @@ -13599,7 +13725,7 @@ namespace ts { const doubleEquals = operator === SyntaxKind.EqualsEqualsToken || operator === SyntaxKind.ExclamationEqualsToken; const facts = doubleEquals ? assumeTrue ? TypeFacts.EQUndefinedOrNull : TypeFacts.NEUndefinedOrNull : - value.kind === SyntaxKind.NullKeyword ? + valueType.flags & TypeFlags.Null ? assumeTrue ? TypeFacts.EQNull : TypeFacts.NENull : assumeTrue ? TypeFacts.EQUndefined : TypeFacts.NEUndefined; return getTypeWithFacts(type, facts); @@ -18746,11 +18872,10 @@ namespace ts { // Make sure require is not a local function if (!isIdentifier(node.expression)) return Debug.fail(); const resolvedRequire = resolveName(node.expression, node.expression.escapedText, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); - if (!resolvedRequire) { - // project does not contain symbol named 'require' - assume commonjs require + if (resolvedRequire === requireSymbol) { return true; } - // project includes symbol named 'require' - make sure that it it ambient and local non-alias + // project includes symbol named 'require' - make sure that it is ambient and local non-alias if (resolvedRequire.flags & SymbolFlags.Alias) { return false; } @@ -18801,6 +18926,17 @@ namespace ts { function checkMetaProperty(node: MetaProperty) { checkGrammarMetaProperty(node); + + if (node.keywordToken === SyntaxKind.NewKeyword) { + return checkNewTargetMetaProperty(node); + } + + if (node.keywordToken === SyntaxKind.ImportKeyword) { + return checkImportMetaProperty(node); + } + } + + function checkNewTargetMetaProperty(node: MetaProperty) { const container = getNewTargetContainer(node); if (!container) { error(node, Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); @@ -18816,6 +18952,16 @@ namespace ts { } } + function checkImportMetaProperty(node: MetaProperty) { + if (languageVersion < ScriptTarget.ESNext || moduleKind < ModuleKind.ESNext) { + error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options); + } + const file = getSourceFileOfNode(node); + Debug.assert(!!(file.flags & NodeFlags.PossiblyContainsImportMeta), "Containing file is missing import meta node flag."); + Debug.assert(!!file.externalModuleIndicator, "Containing file should be a module."); + return node.name.escapedText === "meta" ? getGlobalImportMetaType() : unknownType; + } + function getTypeOfParameter(symbol: Symbol) { const type = getTypeOfSymbol(symbol); if (strictNullChecks) { @@ -19063,7 +19209,7 @@ namespace ts { return false; } const switchTypes = getSwitchClauseTypes(node); - if (!switchTypes.length) { + if (!switchTypes.length || some(switchTypes, isNeitherUnitTypeNorNever)) { return false; } return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); @@ -19915,6 +20061,7 @@ namespace ts { getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], UnionReduction.Subtype) : leftType; case SyntaxKind.EqualsToken: + checkSpecialAssignment(left, right); checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); case SyntaxKind.CommaToken: @@ -19924,6 +20071,24 @@ namespace ts { return rightType; } + function checkSpecialAssignment(left: Node, right: Expression) { + const special = getSpecialPropertyAssignmentKind(left.parent as BinaryExpression); + if (special === SpecialPropertyAssignmentKind.ModuleExports) { + const rightType = checkExpression(right, checkMode); + for (const prop of getPropertiesOfObjectType(rightType)) { + const propType = getTypeOfSymbol(prop); + if (propType.symbol && propType.symbol.flags & SymbolFlags.Class) { + const name = prop.escapedName; + const symbol = resolveName(prop.valueDeclaration, name, SymbolFlags.Type, undefined, name, /*isUse*/ false); + if (symbol) { + grammarErrorOnNode(symbol.declarations[0], Diagnostics.Duplicate_identifier_0, unescapeLeadingUnderscores(name)); + return grammarErrorOnNode(prop.valueDeclaration, Diagnostics.Duplicate_identifier_0, unescapeLeadingUnderscores(name)); + } + } + } + } + } + function isEvalNode(node: Expression) { return node.kind === SyntaxKind.Identifier && (node as Identifier).escapedText === "eval"; } @@ -22438,7 +22603,7 @@ namespace ts { function checkCollisionWithRequireExportsInGeneratedCode(node: Node, name: Identifier) { // No need to check for require or exports for ES6 modules and later - if (modulekind >= ModuleKind.ES2015 || compilerOptions.noEmit) { + if (moduleKind >= ModuleKind.ES2015 || compilerOptions.noEmit) { return; } @@ -24634,7 +24799,7 @@ namespace ts { } } else { - if (modulekind >= ModuleKind.ES2015 && !(node.flags & NodeFlags.Ambient)) { + if (moduleKind >= ModuleKind.ES2015 && !(node.flags & NodeFlags.Ambient)) { // Import equals declaration is deprecated in es6 or above grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } @@ -24672,7 +24837,7 @@ namespace ts { error(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); } - if (modulekind !== ModuleKind.System && modulekind !== ModuleKind.ES2015 && modulekind !== ModuleKind.ESNext) { + if (moduleKind !== ModuleKind.System && moduleKind !== ModuleKind.ES2015 && moduleKind !== ModuleKind.ESNext) { checkExternalEmitHelpers(node, ExternalEmitHelpers.ExportStar); } } @@ -24745,11 +24910,11 @@ namespace ts { } if (node.isExportEquals && !(node.flags & NodeFlags.Ambient)) { - if (modulekind >= ModuleKind.ES2015) { + if (moduleKind >= ModuleKind.ES2015) { // export assignment is not supported in es6 modules grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead); } - else if (modulekind === ModuleKind.System) { + else if (moduleKind === ModuleKind.System) { // system modules does not support export assignment grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); } @@ -27697,10 +27862,18 @@ namespace ts { } function checkGrammarMetaProperty(node: MetaProperty) { - if (node.keywordToken === SyntaxKind.NewKeyword) { - if (node.name.escapedText !== "target") { - return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, tokenToString(node.keywordToken), "target"); - } + const escapedText = node.name.escapedText; + switch (node.keywordToken) { + case SyntaxKind.NewKeyword: + if (escapedText !== "target") { + return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, tokenToString(node.keywordToken), "target"); + } + break; + case SyntaxKind.ImportKeyword: + if (escapedText !== "meta") { + return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, tokenToString(node.keywordToken), "meta"); + } + break; } } @@ -27899,7 +28072,7 @@ namespace ts { } function checkGrammarImportCallExpression(node: ImportCall): boolean { - if (modulekind === ModuleKind.ES2015) { + if (moduleKind === ModuleKind.ES2015) { return grammarErrorOnNode(node, Diagnostics.Dynamic_import_cannot_be_used_when_targeting_ECMAScript_2015_modules); } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 126c1529094a9..c313cb3b3e999 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -145,6 +145,7 @@ namespace ts { "es2017.string": "lib.es2017.string.d.ts", "es2017.intl": "lib.es2017.intl.d.ts", "es2017.typedarrays": "lib.es2017.typedarrays.d.ts", + "es2018.intl": "lib.es2018.intl.d.ts", "es2018.promise": "lib.es2018.promise.d.ts", "es2018.regexp": "lib.es2018.regexp.d.ts", "esnext.array": "lib.esnext.array.d.ts", diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 034725bf0d0f2..042941b970117 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1762,6 +1762,10 @@ namespace ts { return compareComparableValues(a, b); } + export function getStringComparer(ignoreCase?: boolean) { + return ignoreCase ? compareStringsCaseInsensitive : compareStringsCaseSensitive; + } + /** * Creates a string comparer for use with string collation in the UI. */ @@ -2274,7 +2278,7 @@ namespace ts { const aComponents = getNormalizedPathComponents(a, currentDirectory); const bComponents = getNormalizedPathComponents(b, currentDirectory); const sharedLength = Math.min(aComponents.length, bComponents.length); - const comparer = ignoreCase ? compareStringsCaseInsensitive : compareStringsCaseSensitive; + const comparer = getStringComparer(ignoreCase); for (let i = 0; i < sharedLength; i++) { const result = comparer(aComponents[i], bComponents[i]); if (result !== Comparison.EqualTo) { @@ -2615,7 +2619,7 @@ namespace ts { } // Sort the offsets array using either the literal or canonical path representations. - includeBasePaths.sort(useCaseSensitiveFileNames ? compareStringsCaseSensitive : compareStringsCaseInsensitive); + includeBasePaths.sort(getStringComparer(!useCaseSensitiveFileNames)); // Iterate over each include base path and include unique base paths that are not a // subpath of an existing base path diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 46de24d8f856b..8f796aa1e9196 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -971,6 +971,10 @@ "category": "Error", "code": 1342 }, + "The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options.": { + "category": "Error", + "code": 1343 + }, "Duplicate identifier '{0}'.": { "category": "Error", @@ -3898,6 +3902,10 @@ "category": "Suggestion", "code": 80004 }, + "'require' call may be converted to an import.": { + "category": "Suggestion", + "code": 80005 + }, "Add missing 'super()' call": { "category": "Message", @@ -4175,6 +4183,14 @@ "category": "Message", "code": 95046 }, + "Convert 'require' to 'import'": { + "category": "Message", + "code": 95047 + }, + "Convert all 'require' to 'import'": { + "category": "Message", + "code": 95048 + }, "Move to a new file": { "category": "Message", "code": 95047 diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 8547eb171147a..32e7ca19dd313 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -540,7 +540,7 @@ namespace ts { const newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); // Because new source file node is created, it may not have the flag PossiblyContainDynamicImport. This is the case if there is no new edit to add dynamic import. // We will manually port the flag to the new source file. - newSourceFile.flags |= (sourceFile.flags & NodeFlags.PossiblyContainsDynamicImport); + newSourceFile.flags |= (sourceFile.flags & NodeFlags.PermanentlySetIncrementalFlags); return newSourceFile; } @@ -2625,6 +2625,20 @@ namespace ts { return token() === SyntaxKind.OpenParenToken || token() === SyntaxKind.LessThanToken; } + function nextTokenIsDot() { + return nextToken() === SyntaxKind.DotToken; + } + + function nextTokenIsOpenParenOrLessThanOrDot() { + switch (nextToken()) { + case SyntaxKind.OpenParenToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.DotToken: + return true; + } + return false; + } + function parseTypeLiteral(): TypeLiteralNode { const node = createNode(SyntaxKind.TypeLiteral); node.members = parseObjectTypeMembers(); @@ -3093,7 +3107,7 @@ namespace ts { case SyntaxKind.Identifier: return true; case SyntaxKind.ImportKeyword: - return lookAhead(nextTokenIsOpenParenOrLessThan); + return lookAhead(nextTokenIsOpenParenOrLessThanOrDot); default: return isIdentifier(); } @@ -3955,14 +3969,31 @@ namespace ts { // 3)we have a MemberExpression which either completes the LeftHandSideExpression, // or starts the beginning of the first four CallExpression productions. let expression: MemberExpression; - if (token() === SyntaxKind.ImportKeyword && lookAhead(nextTokenIsOpenParenOrLessThan)) { - // We don't want to eagerly consume all import keyword as import call expression so we look a head to find "(" - // For example: - // var foo3 = require("subfolder - // import * as foo1 from "module-from-node - // We want this import to be a statement rather than import call expression - sourceFile.flags |= NodeFlags.PossiblyContainsDynamicImport; - expression = parseTokenNode(); + if (token() === SyntaxKind.ImportKeyword) { + if (lookAhead(nextTokenIsOpenParenOrLessThan)) { + // We don't want to eagerly consume all import keyword as import call expression so we look ahead to find "(" + // For example: + // var foo3 = require("subfolder + // import * as foo1 from "module-from-node + // We want this import to be a statement rather than import call expression + sourceFile.flags |= NodeFlags.PossiblyContainsDynamicImport; + expression = parseTokenNode(); + } + else if (lookAhead(nextTokenIsDot)) { + // This is an 'import.*' metaproperty (i.e. 'import.meta') + const fullStart = scanner.getStartPos(); + nextToken(); // advance past the 'import' + nextToken(); // advance past the dot + const node = createNode(SyntaxKind.MetaProperty, fullStart) as MetaProperty; + node.keywordToken = SyntaxKind.ImportKeyword; + node.name = parseIdentifierName(); + expression = finishNode(node); + + sourceFile.flags |= NodeFlags.PossiblyContainsImportMeta; + } + else { + expression = parseMemberExpressionOrHigher(); + } } else { expression = token() === SyntaxKind.SuperKeyword ? parseSuperExpression() : parseMemberExpressionOrHigher(); @@ -4523,7 +4554,7 @@ namespace ts { case SyntaxKind.FunctionKeyword: return parseFunctionExpression(); case SyntaxKind.NewKeyword: - return parseNewExpression(); + return parseNewExpressionOrNewDotTarget(); case SyntaxKind.SlashToken: case SyntaxKind.SlashEqualsToken: if (reScanSlashToken() === SyntaxKind.RegularExpressionLiteral) { @@ -4674,7 +4705,7 @@ namespace ts { return isIdentifier() ? parseIdentifier() : undefined; } - function parseNewExpression(): NewExpression | MetaProperty { + function parseNewExpressionOrNewDotTarget(): NewExpression | MetaProperty { const fullStart = scanner.getStartPos(); parseExpected(SyntaxKind.NewKeyword); if (parseOptional(SyntaxKind.DotToken)) { @@ -5122,7 +5153,7 @@ namespace ts { return true; case SyntaxKind.ImportKeyword: - return isStartOfDeclaration() || lookAhead(nextTokenIsOpenParenOrLessThan); + return isStartOfDeclaration() || lookAhead(nextTokenIsOpenParenOrLessThanOrDot); case SyntaxKind.ConstKeyword: case SyntaxKind.ExportKeyword: @@ -6108,14 +6139,35 @@ namespace ts { } function setExternalModuleIndicator(sourceFile: SourceFile) { - sourceFile.externalModuleIndicator = forEach(sourceFile.statements, node => - hasModifier(node, ModifierFlags.Export) - || node.kind === SyntaxKind.ImportEqualsDeclaration && (node).moduleReference.kind === SyntaxKind.ExternalModuleReference - || node.kind === SyntaxKind.ImportDeclaration - || node.kind === SyntaxKind.ExportAssignment - || node.kind === SyntaxKind.ExportDeclaration + // Try to use the first top-level import/export when available, then + // fall back to looking for an 'import.meta' somewhere in the tree if necessary. + sourceFile.externalModuleIndicator = + forEach(sourceFile.statements, isAnExternalModuleIndicatorNode) || + getImportMetaIfNecessary(sourceFile); + } + + function isAnExternalModuleIndicatorNode(node: Node) { + return hasModifier(node, ModifierFlags.Export) + || node.kind === SyntaxKind.ImportEqualsDeclaration && (node).moduleReference.kind === SyntaxKind.ExternalModuleReference + || node.kind === SyntaxKind.ImportDeclaration + || node.kind === SyntaxKind.ExportAssignment + || node.kind === SyntaxKind.ExportDeclaration ? node - : undefined); + : undefined; + } + + function getImportMetaIfNecessary(sourceFile: SourceFile) { + return sourceFile.flags & NodeFlags.PossiblyContainsImportMeta ? + walkTreeForExternalModuleIndicators(sourceFile) : + undefined; + } + + function walkTreeForExternalModuleIndicators(node: Node): Node { + return isImportMeta(node) ? node : forEachChild(node, walkTreeForExternalModuleIndicators); + } + + function isImportMeta(node: Node): boolean { + return isMetaProperty(node) && node.keywordToken === SyntaxKind.ImportKeyword && node.name.escapedText === "meta"; } const enum ParsingContext { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 75cdd07845f2c..cc5cd564373f5 100755 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -986,7 +986,7 @@ namespace ts { // moduleAugmentations has changed oldProgram.structureIsReused = StructureIsReused.SafeModules; } - if ((oldSourceFile.flags & NodeFlags.PossiblyContainsDynamicImport) !== (newSourceFile.flags & NodeFlags.PossiblyContainsDynamicImport)) { + if ((oldSourceFile.flags & NodeFlags.PermanentlySetIncrementalFlags) !== (newSourceFile.flags & NodeFlags.PermanentlySetIncrementalFlags)) { // dynamicImport has changed oldProgram.structureIsReused = StructureIsReused.SafeModules; } @@ -2062,6 +2062,10 @@ namespace ts { } function verifyCompilerOptions() { + if (options.strictPropertyInitialization && !options.strictNullChecks) { + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks"); + } + if (options.isolatedModules) { if (options.declaration) { createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"); diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index be95e06eb46cb..688400fc6d5c2 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -698,7 +698,7 @@ namespace ts { createWatchDirectoryUsing(dynamicPollingWatchFile || createDynamicPriorityPollingWatchFile({ getModifiedTime, setTimeout })) : watchDirectoryUsingFsWatch; const watchDirectoryRecursively = createRecursiveDirectoryWatcher({ - filePathComparer: useCaseSensitiveFileNames ? compareStringsCaseSensitive : compareStringsCaseInsensitive, + filePathComparer: getStringComparer(!useCaseSensitiveFileNames), directoryExists, getAccessibleSortedChildDirectories: path => getAccessibleFileSystemEntries(path).directories, watchDirectory, diff --git a/src/compiler/transformers/destructuring.ts b/src/compiler/transformers/destructuring.ts index 35101d3be7fd2..2dd8946e8e2b8 100644 --- a/src/compiler/transformers/destructuring.ts +++ b/src/compiler/transformers/destructuring.ts @@ -46,7 +46,7 @@ namespace ts { value = node.right; } else { - return value; + return visitNode(value, visitor, isExpression); } } } diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 3c73eba86ef1a..e45a95f7989df 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -154,9 +154,12 @@ namespace ts { function updateWatchCompilationHost(watchCompilerHost: WatchCompilerHost) { const compileUsingBuilder = watchCompilerHost.createProgram; - watchCompilerHost.createProgram = (rootNames, options, host, oldProgram) => { - enableStatistics(options); - return compileUsingBuilder(rootNames, options, host, oldProgram); + watchCompilerHost.createProgram = (rootNames, options, host, oldProgram, configFileParsingDiagnostics) => { + Debug.assert(rootNames !== undefined || (options === undefined && !!oldProgram)); + if (options !== undefined) { + enableStatistics(options); + } + return compileUsingBuilder(rootNames, options, host, oldProgram, configFileParsingDiagnostics); }; const emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate; watchCompilerHost.afterProgramCreate = builderProgram => { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 2aea2e2974202..3608b6b5c3232 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -490,19 +490,21 @@ namespace ts { ThisNodeOrAnySubNodesHasError = 1 << 17, // If this node or any of its children had an error HasAggregatedChildData = 1 << 18, // If we've computed data from children and cached it in this node - // This flag will be set when the parser encounters a dynamic import expression so that module resolution - // will not have to walk the tree if the flag is not set. However, this flag is just a approximation because - // once it is set, the flag never gets cleared (hence why it's named "PossiblyContainsDynamicImport"). - // During editing, if dynamic import is removed, incremental parsing will *NOT* update this flag. This means that the tree will always be traversed - // during module resolution. However, the removal operation should not occur often and in the case of the + // These flags will be set when the parser encounters a dynamic import expression or 'import.meta' to avoid + // walking the tree if the flags are not set. However, these flags are just a approximation + // (hence why it's named "PossiblyContainsDynamicImport") because once set, the flags never get cleared. + // During editing, if a dynamic import is removed, incremental parsing will *NOT* clear this flag. + // This means that the tree will always be traversed during module resolution, or when looking for external module indicators. + // However, the removal operation should not occur often and in the case of the // removal, it is likely that users will add the import anyway. // The advantage of this approach is its simplicity. For the case of batch compilation, // we guarantee that users won't have to pay the price of walking the tree if a dynamic import isn't used. - /* @internal */ - PossiblyContainsDynamicImport = 1 << 19, - JSDoc = 1 << 20, // If node was parsed inside jsdoc - /* @internal */ Ambient = 1 << 21, // If node was inside an ambient context -- a declaration file, or inside something with the `declare` modifier. - /* @internal */ InWithStatement = 1 << 22, // If any ancestor of node was the `statement` of a WithStatement (not the `expression`) + /* @internal */ PossiblyContainsDynamicImport = 1 << 19, + /* @internal */ PossiblyContainsImportMeta = 1 << 20, + + JSDoc = 1 << 21, // If node was parsed inside jsdoc + /* @internal */ Ambient = 1 << 22, // If node was inside an ambient context -- a declaration file, or inside something with the `declare` modifier. + /* @internal */ InWithStatement = 1 << 23, // If any ancestor of node was the `statement` of a WithStatement (not the `expression`) BlockScoped = Let | Const, @@ -514,6 +516,11 @@ namespace ts { // Exclude these flags when parsing a Type TypeExcludesFlags = YieldContext | AwaitContext, + + // Represents all flags that are potentially set once and + // never cleared on SourceFiles which get re-used in between incremental parses. + // See the comment above on `PossiblyContainsDynamicImport` and `PossiblyContainsImportMeta`. + /* @internal */ PermanentlySetIncrementalFlags = PossiblyContainsDynamicImport | PossiblyContainsImportMeta, } export const enum ModifierFlags { @@ -1756,7 +1763,7 @@ namespace ts { // for the same reasons we treat NewExpression as a PrimaryExpression. export interface MetaProperty extends PrimaryExpression { kind: SyntaxKind.MetaProperty; - keywordToken: SyntaxKind.NewKeyword; + keywordToken: SyntaxKind.NewKeyword | SyntaxKind.ImportKeyword; name: Identifier; } @@ -2557,7 +2564,11 @@ namespace ts { languageVersion: ScriptTarget; /* @internal */ scriptKind: ScriptKind; - // The first node that causes this file to be an external module + /** + * The first "most obvious" node that makes a file an external module. + * This is intended to be the first top-level import/export, + * but could be arbitrarily nested (e.g. `import.meta`). + */ /* @internal */ externalModuleIndicator: Node; // The first node that causes this file to be a CommonJS module /* @internal */ commonJsModuleIndicator: Node; @@ -3620,6 +3631,9 @@ namespace ts { BooleanLike = Boolean | BooleanLiteral, EnumLike = Enum | EnumLiteral, ESSymbolLike = ESSymbol | UniqueESSymbol, + VoidLike = Void | Undefined, + /* @internal */ + DisjointDomains = NonPrimitive | StringLike | NumberLike | BooleanLike | ESSymbolLike | VoidLike | Null, UnionOrIntersection = Union | Intersection, StructuredType = Object | Union | Intersection, TypeVariable = TypeParameter | IndexedAccess, @@ -3636,7 +3650,15 @@ namespace ts { RequiresWidening = ContainsWideningType | ContainsObjectLiteral, /* @internal */ PropagatingFlags = ContainsWideningType | ContainsObjectLiteral | ContainsAnyFunctionType, + // The following flags are used for different purposes during union and intersection type construction + /* @internal */ + NonWideningType = ContainsWideningType, + /* @internal */ + Wildcard = ContainsObjectLiteral, + /* @internal */ + EmptyObject = ContainsAnyFunctionType, /* @internal */ + ConstructionFlags = NonWideningType | Wildcard | EmptyObject } export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index f0bb151b8146e..6b3adfcf3a4ca 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -531,13 +531,13 @@ namespace ts { const watchLogLevel = trace ? compilerOptions.extendedDiagnostics ? WatchLogLevel.Verbose : compilerOptions.diagnostis ? WatchLogLevel.TriggerOnly : WatchLogLevel.None : WatchLogLevel.None; const writeLog: (s: string) => void = watchLogLevel !== WatchLogLevel.None ? trace : noop; - const { watchFile, watchFilePath, watchDirectory: watchDirectoryWorker } = getWatchFactory(watchLogLevel, writeLog); + const { watchFile, watchFilePath, watchDirectory } = getWatchFactory(watchLogLevel, writeLog); const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames); writeLog(`Current directory: ${currentDirectory} CaseSensitiveFileNames: ${useCaseSensitiveFileNames}`); if (configFileName) { - watchFile(host, configFileName, scheduleProgramReload, PollingInterval.High); + watchFile(host, configFileName, scheduleProgramReload, PollingInterval.High, "Config file"); } const compilerHost: CompilerHost & ResolutionCacheHost = { @@ -563,8 +563,8 @@ namespace ts { // Members for ResolutionCacheHost toPath, getCompilationSettings: () => compilerOptions, - watchDirectoryOfFailedLookupLocation: watchDirectory, - watchTypeRootsDirectory: watchDirectory, + watchDirectoryOfFailedLookupLocation: (dir, cb, flags) => watchDirectory(host, dir, cb, flags, "Failed Lookup Locations"), + watchTypeRootsDirectory: (dir, cb, flags) => watchDirectory(host, dir, cb, flags, "Type roots"), getCachedDirectoryStructureHost: () => cachedDirectoryStructureHost, onInvalidatedResolution: scheduleProgramUpdate, onChangedAutomaticTypeDirectiveNames: () => { @@ -625,9 +625,19 @@ namespace ts { builderProgram = createProgram(/*rootNames*/ undefined, /*options*/ undefined, compilerHost, builderProgram, configFileParsingDiagnostics); hasChangedConfigFileParsingErrors = false; } - return builderProgram; } + else { + createNewProgram(program, hasInvalidatedResolution); + } + + if (host.afterProgramCreate) { + host.afterProgramCreate(builderProgram); + } + + return builderProgram; + } + function createNewProgram(program: Program, hasInvalidatedResolution: HasInvalidatedResolution) { // Compile the program if (watchLogLevel !== WatchLogLevel.None) { writeLog("CreatingProgramWith::"); @@ -663,12 +673,6 @@ namespace ts { } missingFilePathsRequestedForRelease = undefined; } - - if (host.afterProgramCreate) { - host.afterProgramCreate(builderProgram); - } - - return builderProgram; } function updateRootFileNames(files: string[]) { @@ -724,7 +728,7 @@ namespace ts { (hostSourceFile as FilePresentOnHost).sourceFile = sourceFile; sourceFile.version = hostSourceFile.version.toString(); if (!(hostSourceFile as FilePresentOnHost).fileWatcher) { - (hostSourceFile as FilePresentOnHost).fileWatcher = watchFilePath(host, fileName, onSourceFileChange, PollingInterval.Low, path); + (hostSourceFile as FilePresentOnHost).fileWatcher = watchFilePath(host, fileName, onSourceFileChange, PollingInterval.Low, path, "Source file"); } } else { @@ -738,7 +742,7 @@ namespace ts { else { if (sourceFile) { sourceFile.version = initialVersion.toString(); - const fileWatcher = watchFilePath(host, fileName, onSourceFileChange, PollingInterval.Low, path); + const fileWatcher = watchFilePath(host, fileName, onSourceFileChange, PollingInterval.Low, path, "Source file"); sourceFilesCache.set(path, { sourceFile, version: initialVersion, fileWatcher }); } else { @@ -823,6 +827,7 @@ namespace ts { if (timerToUpdateProgram) { host.clearTimeout(timerToUpdateProgram); } + writeLog("Scheduling update"); timerToUpdateProgram = host.setTimeout(updateProgram, 250); } @@ -848,6 +853,7 @@ namespace ts { } function reloadFileNamesFromConfigFile() { + writeLog("Reloading new file names and options"); const result = getFileNamesFromConfigSpecs(configFileSpecs, getDirectoryPath(configFileName), compilerOptions, parseConfigFileHost); if (result.fileNames.length) { configFileParsingDiagnostics = filter(configFileParsingDiagnostics, error => !isErrorNoInputFiles(error)); @@ -909,12 +915,8 @@ namespace ts { } } - function watchDirectory(directory: string, cb: DirectoryWatcherCallback, flags: WatchDirectoryFlags) { - return watchDirectoryWorker(host, directory, cb, flags); - } - function watchMissingFilePath(missingFilePath: Path) { - return watchFilePath(host, missingFilePath, onMissingFileChange, PollingInterval.Medium, missingFilePath); + return watchFilePath(host, missingFilePath, onMissingFileChange, PollingInterval.Medium, missingFilePath, "Missing file"); } function onMissingFileChange(fileName: string, eventKind: FileWatcherEventKind, missingFilePath: Path) { @@ -947,6 +949,7 @@ namespace ts { function watchWildcardDirectory(directory: string, flags: WatchDirectoryFlags) { return watchDirectory( + host, directory, fileOrDirectory => { Debug.assert(!!configFileName); @@ -974,7 +977,8 @@ namespace ts { scheduleProgramUpdate(); } }, - flags + flags, + "Wild card directories" ); } diff --git a/src/compiler/watchUtilities.ts b/src/compiler/watchUtilities.ts index 4fa9b28e162c0..fca4f858e1660 100644 --- a/src/compiler/watchUtilities.ts +++ b/src/compiler/watchUtilities.ts @@ -352,11 +352,11 @@ namespace ts { watchDirectory: WatchDirectory; } - export function getWatchFactory(watchLogLevel: WatchLogLevel, log: (s: string) => void, getDetailWatchInfo?: GetDetailWatchInfo): WatchFactory { + export function getWatchFactory(watchLogLevel: WatchLogLevel, log: (s: string) => void, getDetailWatchInfo?: GetDetailWatchInfo): WatchFactory { return getWatchFactoryWith(watchLogLevel, log, getDetailWatchInfo, watchFile, watchDirectory); } - function getWatchFactoryWith(watchLogLevel: WatchLogLevel, log: (s: string) => void, getDetailWatchInfo: GetDetailWatchInfo | undefined, + 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); @@ -422,8 +422,8 @@ namespace ts { }, flags); } - function getWatchInfo(file: string, flags: T, detailInfo1: X | undefined, detailInfo2: Y | undefined, getDetailWatchInfo: GetDetailWatchInfo | undefined) { - return `WatchInfo: ${file} ${flags} ${getDetailWatchInfo ? getDetailWatchInfo(detailInfo1, detailInfo2) : ""}`; + function getWatchInfo(file: string, flags: T, detailInfo1: X, detailInfo2: Y | undefined, getDetailWatchInfo: GetDetailWatchInfo | undefined) { + return `WatchInfo: ${file} ${flags} ${getDetailWatchInfo ? getDetailWatchInfo(detailInfo1, detailInfo2) : detailInfo1}`; } export function closeFileWatcherOf(objWithWatcher: T) { diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 8ccb493191639..4f0898d274bcc 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -324,8 +324,10 @@ namespace FourSlash { this.languageServiceAdapterHost.addScript(fileName, file, /*isRootFile*/ true); } }); - this.languageServiceAdapterHost.addScript(Harness.Compiler.defaultLibFileName, - Harness.Compiler.getDefaultLibrarySourceFile().text, /*isRootFile*/ false); + if (!compilationOptions.noLib) { + this.languageServiceAdapterHost.addScript(Harness.Compiler.defaultLibFileName, + Harness.Compiler.getDefaultLibrarySourceFile().text, /*isRootFile*/ false); + } } for (const file of testData.files) { diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 9fe26ed51c3ba..c955c1acb59d2 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -217,7 +217,7 @@ namespace Utils { for (const childName in node) { if (childName === "parent" || childName === "nextContainer" || childName === "modifiers" || childName === "externalModuleIndicator" || // for now ignore jsdoc comments - childName === "jsDocComment" || childName === "checkJsDirective") { + childName === "jsDocComment" || childName === "checkJsDirective" || childName === "commonJsModuleIndicator") { continue; } const child = (node)[childName]; diff --git a/src/harness/tsconfig.json b/src/harness/tsconfig.json index 44b83f257bbe6..0dcd8cfd9a6f3 100644 --- a/src/harness/tsconfig.json +++ b/src/harness/tsconfig.json @@ -112,6 +112,7 @@ "../services/codefixes/inferFromUsage.ts", "../services/codefixes/fixInvalidImportSyntax.ts", "../services/codefixes/fixStrictClassInitialization.ts", + "../services/codefixes/requireInTs.ts", "../services/codefixes/useDefaultImport.ts", "../services/refactors/extractSymbol.ts", "../services/refactors/generateGetAccessorAndSetAccessor.ts", diff --git a/src/harness/unittests/commandLineParsing.ts b/src/harness/unittests/commandLineParsing.ts index 00ea059dae59c..269f83e5eb959 100644 --- a/src/harness/unittests/commandLineParsing.ts +++ b/src/harness/unittests/commandLineParsing.ts @@ -60,7 +60,7 @@ namespace ts { assertParseResult(["--lib", "es5,invalidOption", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.asynciterable'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.asynciterable'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, file: undefined, @@ -262,7 +262,7 @@ namespace ts { assertParseResult(["--lib", "es5,", "es7", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.asynciterable'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.asynciterable'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, file: undefined, @@ -281,7 +281,7 @@ namespace ts { assertParseResult(["--lib", "es5, ", "es7", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.asynciterable'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.asynciterable'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, file: undefined, diff --git a/src/harness/unittests/convertCompilerOptionsFromJson.ts b/src/harness/unittests/convertCompilerOptionsFromJson.ts index 8178d4d05290d..f429ce17b30d9 100644 --- a/src/harness/unittests/convertCompilerOptionsFromJson.ts +++ b/src/harness/unittests/convertCompilerOptionsFromJson.ts @@ -266,7 +266,7 @@ namespace ts { file: undefined, start: 0, length: 0, - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.asynciterable'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.asynciterable'.", code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category }] @@ -297,7 +297,7 @@ namespace ts { file: undefined, start: 0, length: 0, - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.asynciterable'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.asynciterable'.", code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category }] @@ -328,7 +328,7 @@ namespace ts { file: undefined, start: 0, length: 0, - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.asynciterable'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.asynciterable'.", code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category }] @@ -359,7 +359,7 @@ namespace ts { file: undefined, start: 0, length: 0, - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.asynciterable'.", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.asynciterable'.", code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category }] diff --git a/src/harness/unittests/tscWatchMode.ts b/src/harness/unittests/tscWatchMode.ts index 44565c0ddbe24..b64b02e301a73 100644 --- a/src/harness/unittests/tscWatchMode.ts +++ b/src/harness/unittests/tscWatchMode.ts @@ -418,6 +418,28 @@ namespace ts.tscWatch { checkProgramRootFiles(watch(), [commonFile1.path]); }); + it("works correctly when config file is changed but its content havent", () => { + const configFile: FileOrFolder = { + path: "/a/b/tsconfig.json", + content: `{ + "compilerOptions": {}, + "files": ["${commonFile1.path}", "${commonFile2.path}"] + }` + }; + const files = [libFile, commonFile1, commonFile2, configFile]; + const host = createWatchedSystem(files); + const watch = createWatchOfConfigFile(configFile.path, host); + + checkProgramActualFiles(watch(), [libFile.path, commonFile1.path, commonFile2.path]); + checkOutputErrorsInitial(host, emptyArray); + + host.modifyFile(configFile.path, configFile.content); + host.checkTimeoutQueueLengthAndRun(1); // reload the configured project + + checkProgramActualFiles(watch(), [libFile.path, commonFile1.path, commonFile2.path]); + checkOutputErrorsIncremental(host, emptyArray); + }); + it("files explicitly excluded in config file", () => { const configFile: FileOrFolder = { path: "/a/b/tsconfig.json", @@ -2235,16 +2257,17 @@ declare module "fs" { "CreatingProgramWith::\n", " roots: [\"f.ts\"]\n", " options: {\"extendedDiagnostics\":true}\n", - "FileWatcher:: Added:: WatchInfo: f.ts 250 \n", - "FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 \n" + "FileWatcher:: Added:: WatchInfo: f.ts 250 Source file\n", + "FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 Source file\n" ]); file.content = "//"; host.reloadFS(files); host.runQueuedTimeoutCallbacks(); checkOutputErrorsIncremental(host, emptyArray, disableConsoleClear, options.extendedDiagnostics && [ - "FileWatcher:: Triggered with /f.ts1:: WatchInfo: f.ts 250 \n", - "Elapsed:: 0ms FileWatcher:: Triggered with /f.ts1:: WatchInfo: f.ts 250 \n" + "FileWatcher:: Triggered with /f.ts1:: WatchInfo: f.ts 250 Source file\n", + "Scheduling update\n", + "Elapsed:: 0ms FileWatcher:: Triggered with /f.ts1:: WatchInfo: f.ts 250 Source file\n" ], options.extendedDiagnostics && [ "Synchronizing program\n", "CreatingProgramWith::\n", diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 1c0dd0beb5ce0..bfa999a3790d5 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -678,7 +678,10 @@ namespace ts.projectSystem { projectService.openClientFile(commonFile1.path); projectService.openClientFile(commonFile2.path); - checkNumberOfInferredProjects(projectService, 2); + projectService.checkNumberOfProjects({ inferredProjects: 2 }); + checkProjectActualFiles(projectService.inferredProjects[0], [commonFile1.path, libFile.path]); + checkProjectActualFiles(projectService.inferredProjects[1], [commonFile2.path, libFile.path]); + const configFileLocations = ["/", "/a/", "/a/b/"]; const watchedFiles = flatMap(configFileLocations, location => [location + "tsconfig.json", location + "jsconfig.json"]).concat(libFile.path); checkWatchedFiles(host, watchedFiles); @@ -686,18 +689,26 @@ namespace ts.projectSystem { // Add a tsconfig file host.reloadFS(filesWithConfig); host.checkTimeoutQueueLengthAndRun(1); - checkNumberOfInferredProjects(projectService, 1); - checkNumberOfConfiguredProjects(projectService, 1); + + projectService.checkNumberOfProjects({ inferredProjects: 2, configuredProjects: 1 }); + assert.isTrue(projectService.inferredProjects[0].isOrphan()); + checkProjectActualFiles(projectService.inferredProjects[1], [commonFile2.path, libFile.path]); + checkProjectActualFiles(projectService.configuredProjects.get(configFile.path), [libFile.path, commonFile1.path, configFile.path]); + checkWatchedFiles(host, watchedFiles); // remove the tsconfig file host.reloadFS(filesWithoutConfig); - checkNumberOfInferredProjects(projectService, 1); + projectService.checkNumberOfProjects({ inferredProjects: 2 }); + assert.isTrue(projectService.inferredProjects[0].isOrphan()); + checkProjectActualFiles(projectService.inferredProjects[1], [commonFile2.path, libFile.path]); + host.checkTimeoutQueueLengthAndRun(1); // Refresh inferred projects - checkNumberOfInferredProjects(projectService, 2); - checkNumberOfConfiguredProjects(projectService, 0); + projectService.checkNumberOfProjects({ inferredProjects: 2 }); + checkProjectActualFiles(projectService.inferredProjects[0], [commonFile1.path, libFile.path]); + checkProjectActualFiles(projectService.inferredProjects[1], [commonFile2.path, libFile.path]); checkWatchedFiles(host, watchedFiles); }); @@ -934,6 +945,10 @@ namespace ts.projectSystem { path: "/a/module1.ts", content: `export interface T {}` }; + const randomFile: FileOrFolder = { + path: "/a/file1.ts", + content: `export interface T {}` + }; const configFile: FileOrFolder = { path: "/a/b/tsconfig.json", content: `{ @@ -943,17 +958,18 @@ namespace ts.projectSystem { "files": ["${file1.path}"] }` }; - const files = [file1, nodeModuleFile, classicModuleFile, configFile]; + const files = [file1, nodeModuleFile, classicModuleFile, configFile, randomFile]; const host = createServerHost(files); const projectService = createProjectService(host); projectService.openClientFile(file1.path); projectService.openClientFile(nodeModuleFile.path); projectService.openClientFile(classicModuleFile.path); - checkNumberOfConfiguredProjects(projectService, 1); + checkNumberOfProjects(projectService, { configuredProjects: 1, inferredProjects: 1 }); const project = configuredProjectAt(projectService, 0); + const inferredProject0 = projectService.inferredProjects[0]; checkProjectActualFiles(project, [file1.path, nodeModuleFile.path, configFile.path]); - checkNumberOfInferredProjects(projectService, 1); + checkProjectActualFiles(projectService.inferredProjects[0], [classicModuleFile.path]); configFile.content = `{ "compilerOptions": { @@ -963,8 +979,22 @@ namespace ts.projectSystem { }`; host.reloadFS(files); host.checkTimeoutQueueLengthAndRun(2); + + checkNumberOfProjects(projectService, { configuredProjects: 1, inferredProjects: 2 }); // will not remove project 1 checkProjectActualFiles(project, [file1.path, classicModuleFile.path, configFile.path]); - checkNumberOfInferredProjects(projectService, 1); + assert.strictEqual(projectService.inferredProjects[0], inferredProject0); + assert.isTrue(projectService.inferredProjects[0].isOrphan()); + const inferredProject1 = projectService.inferredProjects[1]; + checkProjectActualFiles(projectService.inferredProjects[1], [nodeModuleFile.path]); + + // Open random file and it will reuse first inferred project + projectService.openClientFile(randomFile.path); + checkNumberOfProjects(projectService, { configuredProjects: 1, inferredProjects: 2 }); + checkProjectActualFiles(project, [file1.path, classicModuleFile.path, configFile.path]); + assert.strictEqual(projectService.inferredProjects[0], inferredProject0); + checkProjectActualFiles(projectService.inferredProjects[0], [randomFile.path]); // Reuses first inferred project + assert.strictEqual(projectService.inferredProjects[1], inferredProject1); + checkProjectActualFiles(projectService.inferredProjects[1], [nodeModuleFile.path]); }); it("should keep the configured project when the opened file is referenced by the project but not its root", () => { @@ -1304,20 +1334,21 @@ namespace ts.projectSystem { assert.isUndefined(projectService.configuredProjects.get(config2.path)); projectService.closeClientFile(file3.path); - checkNumberOfProjects(projectService, { configuredProjects: 1 }); + checkNumberOfProjects(projectService, { configuredProjects: 1, inferredProjects: 1 }); assert.strictEqual(projectService.configuredProjects.get(config1.path), proj1); assert.isUndefined(projectService.configuredProjects.get(config2.path)); + assert.isTrue(projectService.inferredProjects[0].isOrphan()); projectService.closeClientFile(file1.path); - checkNumberOfProjects(projectService, { configuredProjects: 1 }); + checkNumberOfProjects(projectService, { configuredProjects: 1, inferredProjects: 1 }); assert.strictEqual(projectService.configuredProjects.get(config1.path), proj1); assert.isUndefined(projectService.configuredProjects.get(config2.path)); + assert.isTrue(projectService.inferredProjects[0].isOrphan()); projectService.openClientFile(file2.path, file2.content); checkNumberOfProjects(projectService, { configuredProjects: 1 }); assert.isUndefined(projectService.configuredProjects.get(config1.path)); assert.isDefined(projectService.configuredProjects.get(config2.path)); - }); describe("ignoreConfigFiles", () => { @@ -1579,12 +1610,15 @@ namespace ts.projectSystem { const projectService = createProjectService(host); projectService.openClientFile(file1.path); - - checkNumberOfInferredProjects(projectService, 1); + checkNumberOfProjects(projectService, { inferredProjects: 1 }); + const inferredProject0 = projectService.inferredProjects[0]; checkProjectActualFiles(projectService.inferredProjects[0], [file1.path, file2.path]); projectService.openClientFile(file3.path); - checkNumberOfInferredProjects(projectService, 2); + checkNumberOfProjects(projectService, { inferredProjects: 2 }); + assert.strictEqual(projectService.inferredProjects[0], inferredProject0); + checkProjectActualFiles(projectService.inferredProjects[0], [file1.path, file2.path]); + const inferredProject1 = projectService.inferredProjects[1]; checkProjectActualFiles(projectService.inferredProjects[1], [file3.path]); const modifiedFile2 = { @@ -1594,8 +1628,11 @@ namespace ts.projectSystem { host.reloadFS([file1, modifiedFile2, file3]); host.checkTimeoutQueueLengthAndRun(2); - checkNumberOfInferredProjects(projectService, 1); + checkNumberOfProjects(projectService, { inferredProjects: 2 }); + assert.strictEqual(projectService.inferredProjects[0], inferredProject0); checkProjectActualFiles(projectService.inferredProjects[0], [file1.path, modifiedFile2.path, file3.path]); + assert.strictEqual(projectService.inferredProjects[1], inferredProject1); + assert.isTrue(inferredProject1.isOrphan()); }); it("deleted files affect project structure", () => { @@ -1767,8 +1804,10 @@ namespace ts.projectSystem { host.reloadFS([file1, file2, file3, configFile]); host.checkTimeoutQueueLengthAndRun(1); - checkNumberOfProjects(projectService, { configuredProjects: 1 }); + checkNumberOfProjects(projectService, { configuredProjects: 1, inferredProjects: 2 }); checkProjectActualFiles(configuredProjectAt(projectService, 0), [file1.path, file2.path, file3.path, configFile.path]); + assert.isTrue(projectService.inferredProjects[0].isOrphan()); + assert.isTrue(projectService.inferredProjects[1].isOrphan()); }); it("correctly migrate files between projects", () => { @@ -1792,19 +1831,46 @@ namespace ts.projectSystem { projectService.openClientFile(file2.path); checkNumberOfProjects(projectService, { inferredProjects: 1 }); checkProjectActualFiles(projectService.inferredProjects[0], [file2.path]); + let inferredProjects = projectService.inferredProjects.slice(); projectService.openClientFile(file3.path); checkNumberOfProjects(projectService, { inferredProjects: 2 }); + assert.strictEqual(projectService.inferredProjects[0], inferredProjects[0]); checkProjectActualFiles(projectService.inferredProjects[0], [file2.path]); checkProjectActualFiles(projectService.inferredProjects[1], [file3.path]); + inferredProjects = projectService.inferredProjects.slice(); projectService.openClientFile(file1.path); checkNumberOfProjects(projectService, { inferredProjects: 1 }); + assert.notStrictEqual(projectService.inferredProjects[0], inferredProjects[0]); + assert.notStrictEqual(projectService.inferredProjects[0], inferredProjects[1]); checkProjectRootFiles(projectService.inferredProjects[0], [file1.path]); checkProjectActualFiles(projectService.inferredProjects[0], [file1.path, file2.path, file3.path]); + inferredProjects = projectService.inferredProjects.slice(); projectService.closeClientFile(file1.path); + checkNumberOfProjects(projectService, { inferredProjects: 3 }); + assert.strictEqual(projectService.inferredProjects[0], inferredProjects[0]); + assert.isTrue(projectService.inferredProjects[0].isOrphan()); + checkProjectActualFiles(projectService.inferredProjects[1], [file2.path]); + checkProjectActualFiles(projectService.inferredProjects[2], [file3.path]); + inferredProjects = projectService.inferredProjects.slice(); + + projectService.closeClientFile(file3.path); + checkNumberOfProjects(projectService, { inferredProjects: 3 }); + assert.strictEqual(projectService.inferredProjects[0], inferredProjects[0]); + assert.strictEqual(projectService.inferredProjects[1], inferredProjects[1]); + assert.strictEqual(projectService.inferredProjects[2], inferredProjects[2]); + assert.isTrue(projectService.inferredProjects[0].isOrphan()); + checkProjectActualFiles(projectService.inferredProjects[1], [file2.path]); + assert.isTrue(projectService.inferredProjects[2].isOrphan()); + + projectService.openClientFile(file3.path); checkNumberOfProjects(projectService, { inferredProjects: 2 }); + assert.strictEqual(projectService.inferredProjects[0], inferredProjects[2]); + assert.strictEqual(projectService.inferredProjects[1], inferredProjects[1]); + checkProjectActualFiles(projectService.inferredProjects[0], [file3.path]); + checkProjectActualFiles(projectService.inferredProjects[1], [file2.path]); }); it("can correctly update configured project when set of root files has changed (new file on disk)", () => { @@ -2286,10 +2352,17 @@ namespace ts.projectSystem { projectService.openClientFile(modFile.path); checkNumberOfProjects(projectService, { inferredProjects: 2 }); + const inferredProjects = projectService.inferredProjects.slice(); + checkProjectActualFiles(inferredProjects[0], [file1.path]); + checkProjectActualFiles(inferredProjects[1], [modFile.path]); projectService.setCompilerOptionsForInferredProjects({ moduleResolution: ModuleResolutionKind.Classic }); host.checkTimeoutQueueLengthAndRun(3); - checkNumberOfProjects(projectService, { inferredProjects: 1 }); + checkNumberOfProjects(projectService, { inferredProjects: 2 }); + assert.strictEqual(projectService.inferredProjects[0], inferredProjects[0]); + assert.strictEqual(projectService.inferredProjects[1], inferredProjects[1]); + checkProjectActualFiles(inferredProjects[0], [file1.path, modFile.path]); + assert.isTrue(inferredProjects[1].isOrphan()); }); it("syntax tree cache handles changes in project settings", () => { @@ -2423,9 +2496,9 @@ namespace ts.projectSystem { verifyScriptInfos(); checkOpenFiles(projectService, files); - verifyConfiguredProjectStateAfterUpdate(/*hasOpenRef*/ true); // file1, file2, file3 - checkNumberOfInferredProjects(projectService, 1); - const inferredProject3 = projectService.inferredProjects[0]; + verifyConfiguredProjectStateAfterUpdate(/*hasOpenRef*/ true, 2); // file1, file2, file3 + assert.isTrue(projectService.inferredProjects[0].isOrphan()); + const inferredProject3 = projectService.inferredProjects[1]; checkProjectActualFiles(inferredProject3, [file4.path]); assert.strictEqual(inferredProject3, inferredProject2); @@ -2435,22 +2508,21 @@ namespace ts.projectSystem { verifyScriptInfos(); checkOpenFiles(projectService, [file3]); - verifyConfiguredProjectStateAfterUpdate(/*hasOpenRef*/ true); // file3 - checkNumberOfInferredProjects(projectService, 0); + verifyConfiguredProjectStateAfterUpdate(/*hasOpenRef*/ true, 2); // file3 + assert.isTrue(projectService.inferredProjects[0].isOrphan()); + assert.isTrue(projectService.inferredProjects[1].isOrphan()); projectService.openClientFile(file4.path); verifyScriptInfos(); checkOpenFiles(projectService, [file3, file4]); - verifyConfiguredProjectStateAfterUpdate(/*hasOpenRef*/ true); // file3 - checkNumberOfInferredProjects(projectService, 1); + verifyConfiguredProjectStateAfterUpdate(/*hasOpenRef*/ true, 1); // file3 const inferredProject4 = projectService.inferredProjects[0]; checkProjectActualFiles(inferredProject4, [file4.path]); projectService.closeClientFile(file3.path); verifyScriptInfos(); checkOpenFiles(projectService, [file4]); - verifyConfiguredProjectStateAfterUpdate(/*hasOpenRef*/ false); // No open files - checkNumberOfInferredProjects(projectService, 1); + verifyConfiguredProjectStateAfterUpdate(/*hasOpenRef*/ false, 1); // No open files const inferredProject5 = projectService.inferredProjects[0]; checkProjectActualFiles(inferredProject4, [file4.path]); assert.strictEqual(inferredProject5, inferredProject4); @@ -2465,7 +2537,9 @@ namespace ts.projectSystem { assert.strictEqual(projectService.getScriptInfoForPath(file4.path as Path), find(infos, info => info.path === file4.path)); assert.isDefined(projectService.getScriptInfoForPath(file5.path as Path)); checkOpenFiles(projectService, [file4, file5]); - checkNumberOfConfiguredProjects(projectService, 0); + checkNumberOfProjects(projectService, { inferredProjects: 2 }); + checkProjectActualFiles(projectService.inferredProjects[0], [file4.path]); + checkProjectActualFiles(projectService.inferredProjects[1], [file5.path]); function verifyScriptInfos() { infos.forEach(info => assert.strictEqual(projectService.getScriptInfoForPath(info.path), info)); @@ -2477,8 +2551,8 @@ namespace ts.projectSystem { } } - function verifyConfiguredProjectStateAfterUpdate(hasOpenRef: boolean) { - checkNumberOfConfiguredProjects(projectService, 1); + function verifyConfiguredProjectStateAfterUpdate(hasOpenRef: boolean, inferredProjects: number) { + checkNumberOfProjects(projectService, { configuredProjects: 1, inferredProjects }); const configProject2 = projectService.configuredProjects.get(configFile.path); assert.strictEqual(configProject2, configProject1); checkProjectActualFiles(configProject2, [file1.path, file2.path, file3.path, configFile.path]); @@ -2543,11 +2617,13 @@ namespace ts.projectSystem { checkProjectActualFiles(inferredProject2, [file4.path]); host.runQueuedTimeoutCallbacks(); - checkNumberOfProjects(projectService, { configuredProjects: 1, inferredProjects: 1 }); + checkNumberOfProjects(projectService, { configuredProjects: 1, inferredProjects: 2 }); assert.strictEqual(projectService.configuredProjects.get(configFile.path), configuredProject); assert.isTrue(configuredProject.hasOpenRef()); // file2 checkProjectActualFiles(configuredProject, [file1.path, file2.path, file3.path, configFile.path]); - assert.strictEqual(projectService.inferredProjects[0], inferredProject2); + assert.strictEqual(projectService.inferredProjects[0], inferredProject1); + assert.isTrue(inferredProject1.isOrphan()); + assert.strictEqual(projectService.inferredProjects[1], inferredProject2); checkProjectActualFiles(inferredProject2, [file4.path]); }); @@ -4903,7 +4979,8 @@ namespace ts.projectSystem { command: server.protocol.CommandTypes.Close, arguments: { file: f1.path } }); - checkScriptInfoAndProjects(0, f1.content, "contents of closed file"); + checkScriptInfoAndProjects(f1.content, "contents of closed file"); + checkInferredProjectIsOrphan(); // Can reload contents of the file when its not open and has no project // reload from temp file @@ -4911,21 +4988,23 @@ namespace ts.projectSystem { command: server.protocol.CommandTypes.Reload, arguments: { file: f1.path, tmpfile: tmp.path } }); - checkScriptInfoAndProjects(0, tmp.content, "contents of temp file"); + checkScriptInfoAndProjects(tmp.content, "contents of temp file"); + checkInferredProjectIsOrphan(); // reload from own file session.executeCommandSeq({ command: server.protocol.CommandTypes.Reload, arguments: { file: f1.path } }); - checkScriptInfoAndProjects(0, f1.content, "contents of closed file"); + checkScriptInfoAndProjects(f1.content, "contents of closed file"); + checkInferredProjectIsOrphan(); // Open file again without setting its content session.executeCommandSeq({ command: server.protocol.CommandTypes.Open, arguments: { file: f1.path } }); - checkScriptInfoAndProjects(1, f1.content, "contents of file when opened without specifying contents"); + checkScriptInfoAndProjects(f1.content, "contents of file when opened without specifying contents"); const snap = info.getSnapshot(); // send close request @@ -4933,27 +5012,35 @@ namespace ts.projectSystem { command: server.protocol.CommandTypes.Close, arguments: { file: f1.path } }); - checkScriptInfoAndProjects(0, f1.content, "contents of closed file"); + checkScriptInfoAndProjects(f1.content, "contents of closed file"); assert.strictEqual(info.getSnapshot(), snap); + checkInferredProjectIsOrphan(); // reload from temp file session.executeCommandSeq({ command: server.protocol.CommandTypes.Reload, arguments: { file: f1.path, tmpfile: tmp.path } }); - checkScriptInfoAndProjects(0, tmp.content, "contents of temp file"); + checkScriptInfoAndProjects(tmp.content, "contents of temp file"); assert.notStrictEqual(info.getSnapshot(), snap); + checkInferredProjectIsOrphan(); // reload from own file session.executeCommandSeq({ command: server.protocol.CommandTypes.Reload, arguments: { file: f1.path } }); - checkScriptInfoAndProjects(0, f1.content, "contents of closed file"); + checkScriptInfoAndProjects(f1.content, "contents of closed file"); assert.notStrictEqual(info.getSnapshot(), snap); + checkInferredProjectIsOrphan(); - function checkScriptInfoAndProjects(inferredProjects: number, contentsOfInfo: string, captionForContents: string) { - checkNumberOfProjects(projectService, { inferredProjects }); + function checkInferredProjectIsOrphan() { + assert.isTrue(projectService.inferredProjects[0].isOrphan()); + assert.equal(info.containingProjects.length, 0); + } + + function checkScriptInfoAndProjects(contentsOfInfo: string, captionForContents: string) { + checkNumberOfProjects(projectService, { inferredProjects: 1 }); assert.strictEqual(projectService.getScriptInfo(f1.path), info); checkScriptInfoContents(contentsOfInfo, captionForContents); } diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index 3756f435d4371..323a51c25ae7b 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -393,21 +393,7 @@ interface Array {}` if (isString(fileOrDirectory.content)) { // Update file if (currentEntry.content !== fileOrDirectory.content) { - if (options && options.invokeFileDeleteCreateAsPartInsteadOfChange) { - this.removeFileOrFolder(currentEntry, returnFalse); - this.ensureFileOrFolder(fileOrDirectory); - } - else { - currentEntry.content = fileOrDirectory.content; - currentEntry.modifiedTime = this.now(); - this.fs.get(getDirectoryPath(currentEntry.path)).modifiedTime = this.now(); - if (options && options.invokeDirectoryWatcherInsteadOfFileChanged) { - this.invokeDirectoryWatcher(getDirectoryPath(currentEntry.fullPath), currentEntry.fullPath); - } - else { - this.invokeFileWatcher(currentEntry.fullPath, FileWatcherEventKind.Changed); - } - } + this.modifyFile(fileOrDirectory.path, fileOrDirectory.content, options); } } else { @@ -446,6 +432,30 @@ interface Array {}` } } + modifyFile(filePath: string, content: string, options?: Partial) { + const path = this.toFullPath(filePath); + const currentEntry = this.fs.get(path); + if (!currentEntry || !isFile(currentEntry)) { + throw new Error(`file not present: ${filePath}`); + } + + if (options && options.invokeFileDeleteCreateAsPartInsteadOfChange) { + this.removeFileOrFolder(currentEntry, returnFalse); + this.ensureFileOrFolder({ path: filePath, content }); + } + else { + currentEntry.content = content; + currentEntry.modifiedTime = this.now(); + this.fs.get(getDirectoryPath(currentEntry.path)).modifiedTime = this.now(); + if (options && options.invokeDirectoryWatcherInsteadOfFileChanged) { + this.invokeDirectoryWatcher(getDirectoryPath(currentEntry.fullPath), currentEntry.fullPath); + } + else { + this.invokeFileWatcher(currentEntry.fullPath, FileWatcherEventKind.Changed); + } + } + } + renameFolder(folderName: string, newFolderName: string) { const fullPath = getNormalizedAbsolutePath(folderName, this.currentDirectory); const path = this.toPath(fullPath); diff --git a/src/lib/es2017.intl.d.ts b/src/lib/es2017.intl.d.ts index b878353019082..6f6495da022c2 100644 --- a/src/lib/es2017.intl.d.ts +++ b/src/lib/es2017.intl.d.ts @@ -1,10 +1,12 @@ -type DateTimeFormatPartTypes = "day" | "dayPeriod" | "era" | "hour" | "literal" | "minute" | "month" | "second" | "timeZoneName" | "weekday" | "year"; +declare namespace Intl { + type DateTimeFormatPartTypes = "day" | "dayPeriod" | "era" | "hour" | "literal" | "minute" | "month" | "second" | "timeZoneName" | "weekday" | "year"; -interface DateTimeFormatPart { - type: DateTimeFormatPartTypes; - value: string; -} + interface DateTimeFormatPart { + type: DateTimeFormatPartTypes; + value: string; + } -interface DateTimeFormat { - formatToParts(date?: Date | number): DateTimeFormatPart[]; + interface DateTimeFormat { + formatToParts(date?: Date | number): DateTimeFormatPart[]; + } } diff --git a/src/lib/es2018.d.ts b/src/lib/es2018.d.ts index 1abddc6fe2209..54d108440e0ab 100644 --- a/src/lib/es2018.d.ts +++ b/src/lib/es2018.d.ts @@ -1,3 +1,4 @@ /// /// -/// \ No newline at end of file +/// +/// diff --git a/src/lib/es2018.intl.d.ts b/src/lib/es2018.intl.d.ts new file mode 100644 index 0000000000000..ab5c725c8cd3b --- /dev/null +++ b/src/lib/es2018.intl.d.ts @@ -0,0 +1,31 @@ +declare namespace Intl { + interface PluralRulesOptions { + localeMatcher?: 'lookup' | 'best fit'; + type?: 'cardinal' | 'ordinal'; + } + + interface ResolvedPluralRulesOptions { + locale: string; + pluralCategories: string[]; + type: 'cardinal' | 'ordinal'; + minimumIntegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits: number; + maximumSignificantDigits: number; + } + + interface PluralRules { + resolvedOptions(): ResolvedPluralRulesOptions; + select(n: number): string; + } + + const PluralRules: { + new (locales?: string | string[], options?: PluralRulesOptions): PluralRules; + (locales?: string | string[], options?: PluralRulesOptions): PluralRules; + supportedLocalesOf( + locales: string | string[], + options?: PluralRulesOptions, + ): string[]; + }; +} diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 384d45cd75f07..0f1782ef3e6d4 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -507,6 +507,15 @@ interface TemplateStringsArray extends ReadonlyArray { readonly raw: ReadonlyArray; } +/** + * The type of `import.meta`. + * + * If you need to declare that a given property exists on `import.meta`, + * this type may be augmented via interface merging. + */ +interface ImportMeta { +} + interface Math { /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ readonly E: number; diff --git a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl index 546572f66c2cf..1cfc21834fe4a 100644 --- a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1251,6 +1251,15 @@ + + + + + + + + + @@ -6507,6 +6516,9 @@ + + + @@ -8760,6 +8772,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl index 203d2c22ab963..2690ba4fe89f5 100644 --- a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1260,6 +1260,15 @@ + + + + + + + + + @@ -6513,6 +6522,15 @@ + + + + + + + + + @@ -8763,6 +8781,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl index 5f93b90c20e84..42785ba47cb24 100644 --- a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1260,6 +1260,15 @@ + + + + + + + + + @@ -6516,6 +6525,9 @@ + + + @@ -7425,6 +7437,12 @@ + + + + + + @@ -8769,6 +8787,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl index 619c6ea41aff8..fa924a9d85626 100644 --- a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1251,6 +1251,15 @@ + + + + + + + + + @@ -6504,6 +6513,15 @@ + + + + + + + + + @@ -8754,6 +8772,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl index f8a6325f4a1cd..f7c9f90e59e55 100644 --- a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1241,6 +1241,15 @@ + + + + + + + + + @@ -6494,6 +6503,9 @@ + + + @@ -8747,6 +8759,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl index 3be5ddb0dbb8f..098f08d8cd212 100644 --- a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1250,6 +1250,15 @@ + + + + + + + + + @@ -6506,6 +6515,9 @@ + + + @@ -8759,6 +8771,15 @@ + + + + + + + + + diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index dfd5539cca3d6..ef82e6de30e03 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -708,17 +708,11 @@ namespace ts.server { this.handleDeletedFile(info); } else if (!info.isScriptOpen()) { - if (info.containingProjects.length === 0) { - // Orphan script info, remove it as we can always reload it on next open file request - this.stopWatchingScriptInfo(info); - this.deleteScriptInfo(info); - } - else { - // file has been changed which might affect the set of referenced files in projects that include - // this file and set of inferred projects - info.delayReloadNonMixedContentFile(); - this.delayUpdateProjectGraphs(info.containingProjects); - } + Debug.assert(info.containingProjects.length !== 0); + // file has been changed which might affect the set of referenced files in projects that include + // this file and set of inferred projects + info.delayReloadNonMixedContentFile(); + this.delayUpdateProjectGraphs(info.containingProjects); } } @@ -851,15 +845,23 @@ namespace ts.server { const project = this.getOrCreateInferredProjectForProjectRootPathIfEnabled(info, projectRootPath) || this.getOrCreateSingleInferredProjectIfEnabled() || - this.createInferredProject(info.isDynamic ? this.currentDirectory : getDirectoryPath(info.path)); + this.getOrCreateSingleInferredWithoutProjectRoot(info.isDynamic ? this.currentDirectory : getDirectoryPath(info.path)); project.addRoot(info); + if (info.containingProjects[0] !== project) { + // Ensure this is first project, we could be in this scenario because info could be part of orphan project + info.detachFromProject(project); + info.containingProjects.unshift(project); + } project.updateGraph(); if (!this.useSingleInferredProject && !project.projectRootPath) { // Note that we need to create a copy of the array since the list of project can change - for (const inferredProject of this.inferredProjects.slice(0, this.inferredProjects.length - 1)) { - Debug.assert(inferredProject !== project); + for (const inferredProject of this.inferredProjects) { + if (inferredProject === project || inferredProject.isOrphan()) { + continue; + } + // Remove the inferred project if the root of it is now part of newly created inferred project // e.g through references // Which means if any root of inferred project is part of more than 1 project can be removed @@ -870,8 +872,8 @@ namespace ts.server { // instead of scanning all open files const roots = inferredProject.getRootScriptInfos(); Debug.assert(roots.length === 1 || !!inferredProject.projectRootPath); - if (roots.length === 1 && roots[0].containingProjects.length > 1) { - this.removeProject(inferredProject); + if (roots.length === 1 && forEach(roots[0].containingProjects, p => p !== roots[0].containingProjects[0] && !p.isOrphan())) { + inferredProject.removeFile(roots[0], /*fileExists*/ true, /*detachFromProject*/ true); } } } @@ -891,15 +893,13 @@ namespace ts.server { info.close(fileExists); this.stopWatchingConfigFilesForClosedScriptInfo(info); - this.openFiles.delete(info.path); const canonicalFileName = this.toCanonicalFileName(info.fileName); if (this.openFilesWithNonRootedDiskPath.get(canonicalFileName) === info) { this.openFilesWithNonRootedDiskPath.delete(canonicalFileName); } - // collect all projects that should be removed - let projectsToRemove: Project[]; + let ensureProjectsForOpenFiles = false; for (const p of info.containingProjects) { if (p.projectKind === ProjectKind.Configured) { if (info.hasMixedContent) { @@ -909,15 +909,14 @@ namespace ts.server { // if it would need to be re-created with next file open } else if (p.projectKind === ProjectKind.Inferred && p.isRoot(info)) { - // If this was the open root file of inferred project + // If this was the last open root file of inferred project if ((p as InferredProject).isProjectWithSingleRoot()) { - // - when useSingleInferredProject is not set, we can guarantee that this will be the only root - // - other wise remove the project if it is the only root - (projectsToRemove || (projectsToRemove = [])).push(p); - } - else { - p.removeFile(info, fileExists, /*detachFromProject*/ true); + ensureProjectsForOpenFiles = true; } + + p.removeFile(info, fileExists, /*detachFromProject*/ true); + // Do not remove the project even if this was last root of the inferred project + // so that we can reuse this project, if it would need to be re-created with next file open } if (!p.languageServiceEnabled) { @@ -927,24 +926,24 @@ namespace ts.server { p.markAsDirty(); } } - if (projectsToRemove) { - for (const project of projectsToRemove) { - this.removeProject(project); - } + this.openFiles.delete(info.path); + + if (ensureProjectsForOpenFiles) { // collect orphaned files and assign them to inferred project just like we treat open of a file this.openFiles.forEach((projectRootPath, path) => { - const f = this.getScriptInfoForPath(path as Path); - if (f.isOrphan()) { - this.assignOrphanScriptInfoToInferredProject(f, projectRootPath); + const info = this.getScriptInfoForPath(path as Path); + // collect all orphaned script infos from open files + if (info.isOrphan()) { + this.assignOrphanScriptInfoToInferredProject(info, projectRootPath); } }); - - // Cleanup script infos that arent part of any project (eg. those could be closed script infos not referenced by any project) - // is postponed to next file open so that if file from same project is opened, - // we wont end up creating same script infos } + // Cleanup script infos that arent part of any project (eg. those could be closed script infos not referenced by any project) + // is postponed to next file open so that if file from same project is opened, + // we wont end up creating same script infos + // If the current info is being just closed - add the watcher file to track changes // But if file was deleted, handle that part if (fileExists) { @@ -955,16 +954,6 @@ namespace ts.server { } } - private deleteOrphanScriptInfoNotInAnyProject() { - this.filenameToScriptInfo.forEach(info => { - if (!info.isScriptOpen() && info.isOrphan()) { - // if there are not projects that include this script info - delete it - this.stopWatchingScriptInfo(info); - this.deleteScriptInfo(info); - } - }); - } - private deleteScriptInfo(info: ScriptInfo) { this.filenameToScriptInfo.delete(info.path); const realpath = info.getRealpathIfDifferent(); @@ -1141,7 +1130,7 @@ namespace ts.server { * This is called by inferred project whenever script info is added as a root */ /* @internal */ - startWatchingConfigFilesForInferredProjectRoot(info: ScriptInfo, projectRootPath: NormalizedPath | undefined) { + startWatchingConfigFilesForInferredProjectRoot(info: ScriptInfo) { Debug.assert(info.isScriptOpen()); this.forEachConfigFileLocation(info, (configFileName, canonicalConfigFilePath) => { let configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath); @@ -1163,7 +1152,7 @@ namespace ts.server { !this.getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath)) { this.createConfigFileWatcherOfConfigFileExistence(configFileName, canonicalConfigFilePath, configFileExistenceInfo); } - }, projectRootPath); + }); } /** @@ -1194,14 +1183,14 @@ namespace ts.server { * The server must start searching from the directory containing * the newly opened file. */ - private forEachConfigFileLocation(info: ScriptInfo, - action: (configFileName: NormalizedPath, canonicalConfigFilePath: string) => boolean | void, - projectRootPath?: NormalizedPath) { - + private forEachConfigFileLocation(info: ScriptInfo, action: (configFileName: NormalizedPath, canonicalConfigFilePath: string) => boolean | void) { if (this.syntaxOnly) { return undefined; } + Debug.assert(this.openFiles.has(info.path)); + const projectRootPath = this.openFiles.get(info.path); + let searchPath = asNormalizedPath(getDirectoryPath(info.fileName)); while (!projectRootPath || containsPath(projectRootPath, searchPath, this.currentDirectory, !this.host.useCaseSensitiveFileNames)) { @@ -1236,13 +1225,12 @@ namespace ts.server { * The server must start searching from the directory containing * the newly opened file. */ - private getConfigFileNameForFile(info: ScriptInfo, projectRootPath: NormalizedPath | undefined) { + private getConfigFileNameForFile(info: ScriptInfo) { Debug.assert(info.isScriptOpen()); this.logger.info(`Search path: ${getDirectoryPath(info.fileName)}`); const configFileName = this.forEachConfigFileLocation(info, (configFileName, canonicalConfigFilePath) => this.configFileExists(configFileName, canonicalConfigFilePath, info), - projectRootPath ); if (configFileName) { this.logger.info(`For info: ${info.fileName} :: Config file name: ${configFileName}`); @@ -1670,6 +1658,21 @@ namespace ts.server { return this.createInferredProject(/*currentDirectory*/ undefined, /*isSingleInferredProject*/ true); } + private getOrCreateSingleInferredWithoutProjectRoot(currentDirectory: string | undefined): InferredProject { + Debug.assert(!this.useSingleInferredProject); + const expectedCurrentDirectory = this.toCanonicalFileName(this.getNormalizedAbsolutePath(currentDirectory || "")); + // Reuse the project with same current directory but no roots + for (const inferredProject of this.inferredProjects) { + if (!inferredProject.projectRootPath && + inferredProject.isOrphan() && + inferredProject.canonicalCurrentDirectory === expectedCurrentDirectory) { + return inferredProject; + } + } + + return this.createInferredProject(currentDirectory); + } + private createInferredProject(currentDirectory: string | undefined, isSingleInferredProject?: boolean, projectRootPath?: NormalizedPath): InferredProject { const compilerOptions = projectRootPath && this.compilerOptionsForInferredProjectsPerProjectRoot.get(projectRootPath) || this.compilerOptionsForInferredProjects; const project = new InferredProject(this, this.documentRegistry, compilerOptions, projectRootPath, currentDirectory); @@ -1716,6 +1719,7 @@ namespace ts.server { for (const project of toAddInfo.containingProjects) { // Add the projects only if they can use symLink targets and not already in the list if (project.languageServiceEnabled && + !project.isOrphan() && !project.getCompilerOptions().preserveSymlinks && !contains(info.containingProjects, project)) { if (!projects) { @@ -1905,7 +1909,7 @@ namespace ts.server { // we first detect if there is already a configured project created for it: if so, // we re- read the tsconfig file content and update the project only if we havent already done so // otherwise we create a new one. - const configFileName = this.getConfigFileNameForFile(info, this.openFiles.get(path)); + const configFileName = this.getConfigFileNameForFile(info); if (configFileName) { const project = this.findConfiguredProjectByProjectName(configFileName); if (!project) { @@ -1944,16 +1948,14 @@ namespace ts.server { // so it will be added to inferred project as a root. (for sake of this example assume single inferred project is false) // So at this poing a.ts is part of first inferred project and second inferred project (of which c.ts is root) // And hence it needs to be removed from the first inferred project. - if (info.containingProjects.length > 1 && - info.containingProjects[0].projectKind === ProjectKind.Inferred && - info.containingProjects[0].isRoot(info)) { - const inferredProject = info.containingProjects[0] as InferredProject; - if (inferredProject.isProjectWithSingleRoot()) { - this.removeProject(inferredProject); - } - else { - inferredProject.removeFile(info, /*fileExists*/ true, /*detachFromProject*/ true); - } + Debug.assert(info.containingProjects.length > 0); + const firstProject = info.containingProjects[0]; + + if (!firstProject.isOrphan() && + firstProject.projectKind === ProjectKind.Inferred && + firstProject.isRoot(info) && + forEach(info.containingProjects, p => p !== firstProject && !p.isOrphan())) { + firstProject.removeFile(info, /*fileExists*/ true, /*detachFromProject*/ true); } } @@ -2008,9 +2010,10 @@ namespace ts.server { let configFileErrors: ReadonlyArray; const info = this.getOrCreateScriptInfoOpenedByClientForNormalizedPath(fileName, projectRootPath ? this.getNormalizedAbsolutePath(projectRootPath) : this.currentDirectory, fileContent, scriptKind, hasMixedContent); + this.openFiles.set(info.path, projectRootPath); let project: ConfiguredProject | ExternalProject | undefined = this.findExternalProjectContainingOpenScriptInfo(info); if (!project && !this.syntaxOnly) { // Checking syntaxOnly is an optimization - configFileName = this.getConfigFileNameForFile(info, projectRootPath); + configFileName = this.getConfigFileNameForFile(info); if (configFileName) { project = this.findConfiguredProjectByProjectName(configFileName); if (!project) { @@ -2046,9 +2049,8 @@ namespace ts.server { if (info.isOrphan()) { this.assignOrphanScriptInfoToInferredProject(info, projectRootPath); } - Debug.assert(!info.isOrphan()); - this.openFiles.set(info.path, projectRootPath); + // Remove the configured projects that have zero references from open files. // This was postponed from closeOpenFile to after opening next file, @@ -2059,11 +2061,26 @@ namespace ts.server { } }); + // Remove orphan inferred projects now that we have reused projects + // We need to create a duplicate because we cant guarantee order after removal + for (const inferredProject of this.inferredProjects.slice()) { + if (inferredProject.isOrphan()) { + this.removeProject(inferredProject); + } + } + // Delete the orphan files here because there might be orphan script infos (which are not part of project) // when some file/s were closed which resulted in project removal. // It was then postponed to cleanup these script infos so that they can be reused if // the file from that old project is reopened because of opening file from here. - this.deleteOrphanScriptInfoNotInAnyProject(); + this.filenameToScriptInfo.forEach(info => { + if (!info.isScriptOpen() && info.isOrphan()) { + // if there are not projects that include this script info - delete it + this.stopWatchingScriptInfo(info); + this.deleteScriptInfo(info); + } + }); + this.printProjects(); return { configFileName, configFileErrors }; diff --git a/src/server/project.ts b/src/server/project.ts index 92645cfca5248..4a5ca9bffafa9 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -591,6 +591,11 @@ namespace ts.server { return this.rootFiles && this.rootFiles.length > 0; } + /*@internal*/ + isOrphan() { + return false; + } + getRootFiles() { return this.rootFiles && this.rootFiles.map(info => info.fileName); } @@ -834,6 +839,10 @@ namespace ts.server { /*@internal*/ updateTypingFiles(typingFiles: SortedReadonlyArray) { + enumerateInsertsAndDeletes(typingFiles, this.typingFiles, getStringComparer(!this.useCaseSensitiveFileNames()), + /*inserted*/ noop, + removed => this.detachScriptInfoFromProject(removed) + ); this.typingFiles = typingFiles; // Invalidate files with unresolved imports this.resolutionCache.setFilesWithInvalidatedNonRelativeUnresolvedImports(this.cachedUnresolvedImportsPerFile); @@ -894,7 +903,7 @@ namespace ts.server { const oldExternalFiles = this.externalFiles || emptyArray as SortedReadonlyArray; this.externalFiles = this.getExternalFiles(); - enumerateInsertsAndDeletes(this.externalFiles, oldExternalFiles, compareStringsCaseSensitive, + enumerateInsertsAndDeletes(this.externalFiles, oldExternalFiles, getStringComparer(!this.useCaseSensitiveFileNames()), // Ensure a ScriptInfo is created for new external files. This is performed indirectly // by the LSHost for files in the program when the program is retrieved above but // the program doesn't contain external files so this must be done explicitly. @@ -1169,6 +1178,10 @@ namespace ts.server { /** this is canonical project root path */ readonly projectRootPath: string | undefined; + /*@internal*/ + /** stored only if their is no projectRootPath and this isnt single inferred project */ + readonly canonicalCurrentDirectory: string | undefined; + /*@internal*/ constructor( projectService: ProjectService, @@ -1187,12 +1200,15 @@ namespace ts.server { projectService.host, currentDirectory); this.projectRootPath = projectRootPath && projectService.toCanonicalFileName(projectRootPath); + if (!projectRootPath && !projectService.useSingleInferredProject) { + this.canonicalCurrentDirectory = projectService.toCanonicalFileName(this.currentDirectory); + } this.enableGlobalPlugins(); } addRoot(info: ScriptInfo) { Debug.assert(info.isScriptOpen()); - this.projectService.startWatchingConfigFilesForInferredProjectRoot(info, this.projectService.openFiles.get(info.path)); + this.projectService.startWatchingConfigFilesForInferredProjectRoot(info); if (!this._isJsInferredProject && info.isJavaScript()) { this.toggleJsInferredProject(/*isJsInferredProject*/ true); } @@ -1209,6 +1225,11 @@ namespace ts.server { } } + /*@internal*/ + isOrphan() { + return !this.hasRoots(); + } + isProjectWithSingleRoot() { // - when useSingleInferredProject is not set and projectRootPath is not set, // we can guarantee that this will be the only root diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index 589975769b121..efae3a5faa68d 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -460,7 +460,7 @@ namespace ts.server { } isOrphan() { - return this.containingProjects.length === 0; + return !forEach(this.containingProjects, p => !p.isOrphan()); } /** diff --git a/src/server/session.ts b/src/server/session.ts index 19a9ee007726e..baed5a2dbe3e0 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -865,7 +865,7 @@ namespace ts.server { symLinkedProjects = this.projectService.getSymlinkedProjects(scriptInfo); } // filter handles case when 'projects' is undefined - projects = filter(projects, p => p.languageServiceEnabled); + projects = filter(projects, p => p.languageServiceEnabled && !p.isOrphan()); if ((!projects || !projects.length) && !symLinkedProjects) { return Errors.ThrowNoProject(); } @@ -1336,7 +1336,7 @@ namespace ts.server { symLinkedProjects ? { projects, symLinkedProjects } : projects, (project, info) => { let result: protocol.CompileOnSaveAffectedFileListSingleProject; - if (project.compileOnSaveEnabled && project.languageServiceEnabled && !project.getCompilationSettings().noEmit) { + if (project.compileOnSaveEnabled && project.languageServiceEnabled && !project.isOrphan() && !project.getCompilationSettings().noEmit) { result = { projectFileName: project.getProjectName(), fileNames: project.getCompileOnSaveAffectedFileList(info), diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json index 7ab06cf0666a0..87a76a1e3c416 100644 --- a/src/server/tsconfig.json +++ b/src/server/tsconfig.json @@ -108,6 +108,7 @@ "../services/codefixes/inferFromUsage.ts", "../services/codefixes/fixInvalidImportSyntax.ts", "../services/codefixes/fixStrictClassInitialization.ts", + "../services/codefixes/requireInTs.ts", "../services/codefixes/useDefaultImport.ts", "../services/refactors/extractSymbol.ts", "../services/refactors/generateGetAccessorAndSetAccessor.ts", diff --git a/src/server/tsconfig.library.json b/src/server/tsconfig.library.json index a57331f7d1550..3dc0402e9a733 100644 --- a/src/server/tsconfig.library.json +++ b/src/server/tsconfig.library.json @@ -114,6 +114,7 @@ "../services/codefixes/inferFromUsage.ts", "../services/codefixes/fixInvalidImportSyntax.ts", "../services/codefixes/fixStrictClassInitialization.ts", + "../services/codefixes/requireInTs.ts", "../services/codefixes/useDefaultImport.ts", "../services/refactors/extractSymbol.ts", "../services/refactors/generateGetAccessorAndSetAccessor.ts", diff --git a/src/services/codefixes/requireInTs.ts b/src/services/codefixes/requireInTs.ts new file mode 100644 index 0000000000000..7efd9bd7fa6fc --- /dev/null +++ b/src/services/codefixes/requireInTs.ts @@ -0,0 +1,29 @@ +/* @internal */ +namespace ts.codefix { + const fixId = "requireInTs"; + const errorCodes = [Diagnostics.require_call_may_be_converted_to_an_import.code]; + registerCodeFix({ + errorCodes, + getCodeActions(context) { + const changes = textChanges.ChangeTracker.with(context, t => doChange(t, context.sourceFile, context.span.start, context.program)); + return [createCodeFixAction(fixId, changes, Diagnostics.Convert_require_to_import, fixId, Diagnostics.Convert_all_require_to_import)]; + }, + fixIds: [fixId], + getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => doChange(changes, diag.file, diag.start, context.program)), + }); + + function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, pos: number, program: Program) { + const { statement, name, required } = getInfo(sourceFile, pos); + changes.replaceNode(sourceFile, statement, getAllowSyntheticDefaultImports(program.getCompilerOptions()) + ? createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createImportClause(name, /*namedBindings*/ undefined), required) + : createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, name, createExternalModuleReference(required))); + } + + interface Info { readonly statement: VariableStatement; readonly name: Identifier; readonly required: StringLiteralLike; } + function getInfo(sourceFile: SourceFile, pos: number): Info { + const { parent } = getTokenAtPosition(sourceFile, pos, /*includeJsDocComment*/ false); + if (!isRequireCall(parent, /*checkArgumentIsStringLiteralLike*/ true)) throw Debug.failBadSyntaxKind(parent); + const decl = cast(parent.parent, isVariableDeclaration); + return { statement: cast(decl.parent.parent, isVariableStatement), name: cast(decl.name, isIdentifier), required: parent.arguments[0] }; + } +} diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 36ea7de23b4d7..a658cc41c65dc 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -126,8 +126,8 @@ namespace ts.formatting { rule("SpaceBetweenAsyncAndOpenParen", SyntaxKind.AsyncKeyword, SyntaxKind.OpenParenToken, [isArrowFunctionContext, isNonJsxSameLineTokenContext], RuleAction.Space), rule("SpaceBetweenAsyncAndFunctionKeyword", SyntaxKind.AsyncKeyword, SyntaxKind.FunctionKeyword, [isNonJsxSameLineTokenContext], RuleAction.Space), - // template string - rule("NoSpaceBetweenTagAndTemplateString", SyntaxKind.Identifier, [SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead], [isNonJsxSameLineTokenContext], RuleAction.Delete), + // Template string + rule("NoSpaceBetweenTagAndTemplateString", [SyntaxKind.Identifier, SyntaxKind.CloseParenToken], [SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead], [isNonJsxSameLineTokenContext], RuleAction.Delete), // JSX opening elements rule("SpaceBeforeJsxAttribute", anyToken, SyntaxKind.Identifier, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], RuleAction.Space), diff --git a/src/services/suggestionDiagnostics.ts b/src/services/suggestionDiagnostics.ts index d04f3f15cf909..0c8ec58798c94 100644 --- a/src/services/suggestionDiagnostics.ts +++ b/src/services/suggestionDiagnostics.ts @@ -32,6 +32,19 @@ namespace ts { } check(sourceFile); + if (!isJsFile) { + for (const statement of sourceFile.statements) { + if (isVariableStatement(statement) && + statement.declarationList.flags & NodeFlags.Const && + statement.declarationList.declarations.length === 1) { + const init = statement.declarationList.declarations[0].initializer; + if (init && isRequireCall(init, /*checkArgumentIsStringLiteralLike*/ true)) { + diags.push(createDiagnosticForNode(init, Diagnostics.require_call_may_be_converted_to_an_import)); + } + } + } + } + if (getAllowSyntheticDefaultImports(program.getCompilerOptions())) { for (const moduleSpecifier of sourceFile.imports) { const importNode = importFromModuleSpecifier(moduleSpecifier); diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index 2236c89300a25..c38a7324b30cd 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -105,6 +105,7 @@ "codefixes/inferFromUsage.ts", "codefixes/fixInvalidImportSyntax.ts", "codefixes/fixStrictClassInitialization.ts", + "codefixes/requireInTs.ts", "codefixes/useDefaultImport.ts", "refactors/extractSymbol.ts", "refactors/generateGetAccessorAndSetAccessor.ts", diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 5e09f5aa951ed..70f99eaa8d59c 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -414,11 +414,11 @@ declare namespace ts { JavaScriptFile = 65536, ThisNodeOrAnySubNodesHasError = 131072, HasAggregatedChildData = 262144, - JSDoc = 1048576, + JSDoc = 2097152, BlockScoped = 3, ReachabilityCheckFlags = 384, ReachabilityAndEmitFlags = 1408, - ContextFlags = 6387712, + ContextFlags = 12679168, TypeExcludesFlags = 20480 } enum ModifierFlags { @@ -1072,7 +1072,7 @@ declare namespace ts { } interface MetaProperty extends PrimaryExpression { kind: SyntaxKind.MetaProperty; - keywordToken: SyntaxKind.NewKeyword; + keywordToken: SyntaxKind.NewKeyword | SyntaxKind.ImportKeyword; name: Identifier; } interface JsxElement extends PrimaryExpression { @@ -2111,6 +2111,7 @@ declare namespace ts { BooleanLike = 136, EnumLike = 272, ESSymbolLike = 1536, + VoidLike = 6144, UnionOrIntersection = 393216, StructuredType = 458752, TypeVariable = 1081344, @@ -8073,7 +8074,6 @@ declare namespace ts.server { * @param info The file that has been closed or newly configured */ private closeOpenFile; - private deleteOrphanScriptInfoNotInAnyProject; private deleteScriptInfo; private configFileExists; private setConfigFileExistenceByNewConfiguredProject; @@ -8130,6 +8130,7 @@ declare namespace ts.server { private sendConfigFileDiagEvent; private getOrCreateInferredProjectForProjectRootPathIfEnabled; private getOrCreateSingleInferredProjectIfEnabled; + private getOrCreateSingleInferredWithoutProjectRoot; private createInferredProject; getScriptInfo(uncheckedFileName: string): ScriptInfo; private watchClosedScriptInfo; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 9d87ec68d43a7..d54eff0acbdc9 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -414,11 +414,11 @@ declare namespace ts { JavaScriptFile = 65536, ThisNodeOrAnySubNodesHasError = 131072, HasAggregatedChildData = 262144, - JSDoc = 1048576, + JSDoc = 2097152, BlockScoped = 3, ReachabilityCheckFlags = 384, ReachabilityAndEmitFlags = 1408, - ContextFlags = 6387712, + ContextFlags = 12679168, TypeExcludesFlags = 20480 } enum ModifierFlags { @@ -1072,7 +1072,7 @@ declare namespace ts { } interface MetaProperty extends PrimaryExpression { kind: SyntaxKind.MetaProperty; - keywordToken: SyntaxKind.NewKeyword; + keywordToken: SyntaxKind.NewKeyword | SyntaxKind.ImportKeyword; name: Identifier; } interface JsxElement extends PrimaryExpression { @@ -2111,6 +2111,7 @@ declare namespace ts { BooleanLike = 136, EnumLike = 272, ESSymbolLike = 1536, + VoidLike = 6144, UnionOrIntersection = 393216, StructuredType = 458752, TypeVariable = 1081344, diff --git a/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.errors.txt b/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.errors.txt new file mode 100644 index 0000000000000..f7b8244f01327 --- /dev/null +++ b/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.errors.txt @@ -0,0 +1,25 @@ +tests/cases/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.ts(5,22): error TS2449: Class 'A' used before its declaration. +tests/cases/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.ts(6,13): error TS2449: Class 'A' used before its declaration. +tests/cases/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.ts(7,6): error TS2449: Class 'A' used before its declaration. +tests/cases/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.ts(8,6): error TS2449: Class 'A' used before its declaration. + + +==== tests/cases/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.ts (4 errors) ==== + class A { + static readonly p1 = Symbol(); + static readonly p2 = Symbol(); + // All of the below should be out of scope or TDZ - `A` has not finished being constructed as they are executed + static readonly [A.p1] = 0; + ~ +!!! error TS2449: Class 'A' used before its declaration. + static [A.p2]() { return 0 }; + ~ +!!! error TS2449: Class 'A' used before its declaration. + [A.p1]() { } + ~ +!!! error TS2449: Class 'A' used before its declaration. + [A.p2] = 0 + ~ +!!! error TS2449: Class 'A' used before its declaration. + } + \ No newline at end of file diff --git a/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.js b/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.js new file mode 100644 index 0000000000000..2ac05b483c8fa --- /dev/null +++ b/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.js @@ -0,0 +1,28 @@ +//// [classDeclarationShouldBeOutOfScopeInComputedNames.ts] +class A { + static readonly p1 = Symbol(); + static readonly p2 = Symbol(); + // All of the below should be out of scope or TDZ - `A` has not finished being constructed as they are executed + static readonly [A.p1] = 0; + static [A.p2]() { return 0 }; + [A.p1]() { } + [A.p2] = 0 +} + + +//// [classDeclarationShouldBeOutOfScopeInComputedNames.js] +var A = /** @class */ (function () { + function A() { + this[_a] = 0; + } + A[(_b = A.p1, A.p2)] = function () { return 0; }; + ; + A.prototype[A.p1] = function () { }; + _a = A.p2; + A.p1 = Symbol(); + A.p2 = Symbol(); + // All of the below should be out of scope or TDZ - `A` has not finished being constructed as they are executed + A[_b] = 0; + return A; + var _b, _a; +}()); diff --git a/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.symbols b/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.symbols new file mode 100644 index 0000000000000..368751f55025e --- /dev/null +++ b/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.symbols @@ -0,0 +1,38 @@ +=== tests/cases/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.ts === +class A { +>A : Symbol(A, Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 0, 0)) + + static readonly p1 = Symbol(); +>p1 : Symbol(A.p1, Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 0, 9)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + + static readonly p2 = Symbol(); +>p2 : Symbol(A.p2, Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 1, 34)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + + // All of the below should be out of scope or TDZ - `A` has not finished being constructed as they are executed + static readonly [A.p1] = 0; +>[A.p1] : Symbol(A[A.p1], Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 2, 34)) +>A.p1 : Symbol(A.p1, Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 0, 9)) +>A : Symbol(A, Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 0, 0)) +>p1 : Symbol(A.p1, Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 0, 9)) + + static [A.p2]() { return 0 }; +>[A.p2] : Symbol(A[A.p2], Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 4, 31)) +>A.p2 : Symbol(A.p2, Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 1, 34)) +>A : Symbol(A, Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 0, 0)) +>p2 : Symbol(A.p2, Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 1, 34)) + + [A.p1]() { } +>[A.p1] : Symbol(A[A.p1], Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 5, 33)) +>A.p1 : Symbol(A.p1, Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 0, 9)) +>A : Symbol(A, Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 0, 0)) +>p1 : Symbol(A.p1, Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 0, 9)) + + [A.p2] = 0 +>[A.p2] : Symbol(A[A.p2], Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 6, 16)) +>A.p2 : Symbol(A.p2, Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 1, 34)) +>A : Symbol(A, Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 0, 0)) +>p2 : Symbol(A.p2, Decl(classDeclarationShouldBeOutOfScopeInComputedNames.ts, 1, 34)) +} + diff --git a/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.types b/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.types new file mode 100644 index 0000000000000..8ed676a6401f9 --- /dev/null +++ b/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.ts === +class A { +>A : A + + static readonly p1 = Symbol(); +>p1 : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + + static readonly p2 = Symbol(); +>p2 : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + + // All of the below should be out of scope or TDZ - `A` has not finished being constructed as they are executed + static readonly [A.p1] = 0; +>[A.p1] : 0 +>A.p1 : unique symbol +>A : typeof A +>p1 : unique symbol +>0 : 0 + + static [A.p2]() { return 0 }; +>[A.p2] : () => number +>A.p2 : unique symbol +>A : typeof A +>p2 : unique symbol +>0 : 0 + + [A.p1]() { } +>[A.p1] : () => void +>A.p1 : unique symbol +>A : typeof A +>p1 : unique symbol + + [A.p2] = 0 +>[A.p2] : number +>A.p2 : unique symbol +>A : typeof A +>p2 : unique symbol +>0 : 0 +} + diff --git a/tests/baselines/reference/computedPropertyNamesWithStaticProperty.errors.txt b/tests/baselines/reference/computedPropertyNamesWithStaticProperty.errors.txt new file mode 100644 index 0000000000000..5ce2c8bfe1ce5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesWithStaticProperty.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesWithStaticProperty.ts(3,10): error TS2449: Class 'C' used before its declaration. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesWithStaticProperty.ts(6,10): error TS2449: Class 'C' used before its declaration. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesWithStaticProperty.ts(9,6): error TS2449: Class 'C' used before its declaration. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesWithStaticProperty.ts (3 errors) ==== + class C { + static staticProp = 10; + get [C.staticProp]() { + ~ +!!! error TS2449: Class 'C' used before its declaration. + return "hello"; + } + set [C.staticProp](x: string) { + ~ +!!! error TS2449: Class 'C' used before its declaration. + var y = x; + } + [C.staticProp]() { } + ~ +!!! error TS2449: Class 'C' used before its declaration. + } \ No newline at end of file diff --git a/tests/baselines/reference/controlFlowNullTypeAndLiteral.errors.txt b/tests/baselines/reference/controlFlowNullTypeAndLiteral.errors.txt new file mode 100644 index 0000000000000..5a74b4f2d6505 --- /dev/null +++ b/tests/baselines/reference/controlFlowNullTypeAndLiteral.errors.txt @@ -0,0 +1,36 @@ +tests/cases/compiler/controlFlowNullTypeAndLiteral.ts(15,12): error TS2345: Argument of type 'null' is not assignable to parameter of type 'number'. +tests/cases/compiler/controlFlowNullTypeAndLiteral.ts(17,12): error TS2345: Argument of type 'null' is not assignable to parameter of type 'number'. +tests/cases/compiler/controlFlowNullTypeAndLiteral.ts(21,15): error TS2322: Type 'null' is not assignable to type 'string'. + + +==== tests/cases/compiler/controlFlowNullTypeAndLiteral.ts (3 errors) ==== + // Repros from #23771 + + const myNull: null = null; + const objWithValMaybeNull: { val: number | null } = { val: 1 }; + const addOne = function (num: number) { + return num + 1; + } + + if (objWithValMaybeNull.val !== null) + addOne(objWithValMaybeNull.val); + if (objWithValMaybeNull.val !== myNull) + addOne(objWithValMaybeNull.val); + + if (objWithValMaybeNull.val === null) + addOne(objWithValMaybeNull.val); // Error + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'null' is not assignable to parameter of type 'number'. + if (objWithValMaybeNull.val === myNull) + addOne(objWithValMaybeNull.val); // Error + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'null' is not assignable to parameter of type 'number'. + + function f(x: number | null) { + if(x === myNull) { + const s: string = x; // Error + ~ +!!! error TS2322: Type 'null' is not assignable to type 'string'. + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/controlFlowNullTypeAndLiteral.js b/tests/baselines/reference/controlFlowNullTypeAndLiteral.js new file mode 100644 index 0000000000000..dc23aeddf279b --- /dev/null +++ b/tests/baselines/reference/controlFlowNullTypeAndLiteral.js @@ -0,0 +1,47 @@ +//// [controlFlowNullTypeAndLiteral.ts] +// Repros from #23771 + +const myNull: null = null; +const objWithValMaybeNull: { val: number | null } = { val: 1 }; +const addOne = function (num: number) { + return num + 1; +} + +if (objWithValMaybeNull.val !== null) + addOne(objWithValMaybeNull.val); +if (objWithValMaybeNull.val !== myNull) + addOne(objWithValMaybeNull.val); + +if (objWithValMaybeNull.val === null) + addOne(objWithValMaybeNull.val); // Error +if (objWithValMaybeNull.val === myNull) + addOne(objWithValMaybeNull.val); // Error + +function f(x: number | null) { + if(x === myNull) { + const s: string = x; // Error + } +} + + +//// [controlFlowNullTypeAndLiteral.js] +"use strict"; +// Repros from #23771 +var myNull = null; +var objWithValMaybeNull = { val: 1 }; +var addOne = function (num) { + return num + 1; +}; +if (objWithValMaybeNull.val !== null) + addOne(objWithValMaybeNull.val); +if (objWithValMaybeNull.val !== myNull) + addOne(objWithValMaybeNull.val); +if (objWithValMaybeNull.val === null) + addOne(objWithValMaybeNull.val); // Error +if (objWithValMaybeNull.val === myNull) + addOne(objWithValMaybeNull.val); // Error +function f(x) { + if (x === myNull) { + var s = x; // Error + } +} diff --git a/tests/baselines/reference/controlFlowNullTypeAndLiteral.symbols b/tests/baselines/reference/controlFlowNullTypeAndLiteral.symbols new file mode 100644 index 0000000000000..d78f38975ab6c --- /dev/null +++ b/tests/baselines/reference/controlFlowNullTypeAndLiteral.symbols @@ -0,0 +1,79 @@ +=== tests/cases/compiler/controlFlowNullTypeAndLiteral.ts === +// Repros from #23771 + +const myNull: null = null; +>myNull : Symbol(myNull, Decl(controlFlowNullTypeAndLiteral.ts, 2, 5)) + +const objWithValMaybeNull: { val: number | null } = { val: 1 }; +>objWithValMaybeNull : Symbol(objWithValMaybeNull, Decl(controlFlowNullTypeAndLiteral.ts, 3, 5)) +>val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) +>val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 53)) + +const addOne = function (num: number) { +>addOne : Symbol(addOne, Decl(controlFlowNullTypeAndLiteral.ts, 4, 5)) +>num : Symbol(num, Decl(controlFlowNullTypeAndLiteral.ts, 4, 25)) + + return num + 1; +>num : Symbol(num, Decl(controlFlowNullTypeAndLiteral.ts, 4, 25)) +} + +if (objWithValMaybeNull.val !== null) +>objWithValMaybeNull.val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) +>objWithValMaybeNull : Symbol(objWithValMaybeNull, Decl(controlFlowNullTypeAndLiteral.ts, 3, 5)) +>val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) + + addOne(objWithValMaybeNull.val); +>addOne : Symbol(addOne, Decl(controlFlowNullTypeAndLiteral.ts, 4, 5)) +>objWithValMaybeNull.val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) +>objWithValMaybeNull : Symbol(objWithValMaybeNull, Decl(controlFlowNullTypeAndLiteral.ts, 3, 5)) +>val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) + +if (objWithValMaybeNull.val !== myNull) +>objWithValMaybeNull.val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) +>objWithValMaybeNull : Symbol(objWithValMaybeNull, Decl(controlFlowNullTypeAndLiteral.ts, 3, 5)) +>val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) +>myNull : Symbol(myNull, Decl(controlFlowNullTypeAndLiteral.ts, 2, 5)) + + addOne(objWithValMaybeNull.val); +>addOne : Symbol(addOne, Decl(controlFlowNullTypeAndLiteral.ts, 4, 5)) +>objWithValMaybeNull.val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) +>objWithValMaybeNull : Symbol(objWithValMaybeNull, Decl(controlFlowNullTypeAndLiteral.ts, 3, 5)) +>val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) + +if (objWithValMaybeNull.val === null) +>objWithValMaybeNull.val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) +>objWithValMaybeNull : Symbol(objWithValMaybeNull, Decl(controlFlowNullTypeAndLiteral.ts, 3, 5)) +>val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) + + addOne(objWithValMaybeNull.val); // Error +>addOne : Symbol(addOne, Decl(controlFlowNullTypeAndLiteral.ts, 4, 5)) +>objWithValMaybeNull.val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) +>objWithValMaybeNull : Symbol(objWithValMaybeNull, Decl(controlFlowNullTypeAndLiteral.ts, 3, 5)) +>val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) + +if (objWithValMaybeNull.val === myNull) +>objWithValMaybeNull.val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) +>objWithValMaybeNull : Symbol(objWithValMaybeNull, Decl(controlFlowNullTypeAndLiteral.ts, 3, 5)) +>val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) +>myNull : Symbol(myNull, Decl(controlFlowNullTypeAndLiteral.ts, 2, 5)) + + addOne(objWithValMaybeNull.val); // Error +>addOne : Symbol(addOne, Decl(controlFlowNullTypeAndLiteral.ts, 4, 5)) +>objWithValMaybeNull.val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) +>objWithValMaybeNull : Symbol(objWithValMaybeNull, Decl(controlFlowNullTypeAndLiteral.ts, 3, 5)) +>val : Symbol(val, Decl(controlFlowNullTypeAndLiteral.ts, 3, 28)) + +function f(x: number | null) { +>f : Symbol(f, Decl(controlFlowNullTypeAndLiteral.ts, 16, 36)) +>x : Symbol(x, Decl(controlFlowNullTypeAndLiteral.ts, 18, 11)) + + if(x === myNull) { +>x : Symbol(x, Decl(controlFlowNullTypeAndLiteral.ts, 18, 11)) +>myNull : Symbol(myNull, Decl(controlFlowNullTypeAndLiteral.ts, 2, 5)) + + const s: string = x; // Error +>s : Symbol(s, Decl(controlFlowNullTypeAndLiteral.ts, 20, 13)) +>x : Symbol(x, Decl(controlFlowNullTypeAndLiteral.ts, 18, 11)) + } +} + diff --git a/tests/baselines/reference/controlFlowNullTypeAndLiteral.types b/tests/baselines/reference/controlFlowNullTypeAndLiteral.types new file mode 100644 index 0000000000000..0c0afe63d18cd --- /dev/null +++ b/tests/baselines/reference/controlFlowNullTypeAndLiteral.types @@ -0,0 +1,99 @@ +=== tests/cases/compiler/controlFlowNullTypeAndLiteral.ts === +// Repros from #23771 + +const myNull: null = null; +>myNull : null +>null : null +>null : null + +const objWithValMaybeNull: { val: number | null } = { val: 1 }; +>objWithValMaybeNull : { val: number | null; } +>val : number | null +>null : null +>{ val: 1 } : { val: number; } +>val : number +>1 : 1 + +const addOne = function (num: number) { +>addOne : (num: number) => number +>function (num: number) { return num + 1;} : (num: number) => number +>num : number + + return num + 1; +>num + 1 : number +>num : number +>1 : 1 +} + +if (objWithValMaybeNull.val !== null) +>objWithValMaybeNull.val !== null : boolean +>objWithValMaybeNull.val : number | null +>objWithValMaybeNull : { val: number | null; } +>val : number | null +>null : null + + addOne(objWithValMaybeNull.val); +>addOne(objWithValMaybeNull.val) : number +>addOne : (num: number) => number +>objWithValMaybeNull.val : number +>objWithValMaybeNull : { val: number | null; } +>val : number + +if (objWithValMaybeNull.val !== myNull) +>objWithValMaybeNull.val !== myNull : boolean +>objWithValMaybeNull.val : number | null +>objWithValMaybeNull : { val: number | null; } +>val : number | null +>myNull : null + + addOne(objWithValMaybeNull.val); +>addOne(objWithValMaybeNull.val) : number +>addOne : (num: number) => number +>objWithValMaybeNull.val : number +>objWithValMaybeNull : { val: number | null; } +>val : number + +if (objWithValMaybeNull.val === null) +>objWithValMaybeNull.val === null : boolean +>objWithValMaybeNull.val : number | null +>objWithValMaybeNull : { val: number | null; } +>val : number | null +>null : null + + addOne(objWithValMaybeNull.val); // Error +>addOne(objWithValMaybeNull.val) : number +>addOne : (num: number) => number +>objWithValMaybeNull.val : null +>objWithValMaybeNull : { val: number | null; } +>val : null + +if (objWithValMaybeNull.val === myNull) +>objWithValMaybeNull.val === myNull : boolean +>objWithValMaybeNull.val : number | null +>objWithValMaybeNull : { val: number | null; } +>val : number | null +>myNull : null + + addOne(objWithValMaybeNull.val); // Error +>addOne(objWithValMaybeNull.val) : number +>addOne : (num: number) => number +>objWithValMaybeNull.val : null +>objWithValMaybeNull : { val: number | null; } +>val : null + +function f(x: number | null) { +>f : (x: number | null) => void +>x : number | null +>null : null + + if(x === myNull) { +>x === myNull : boolean +>x : number | null +>myNull : null + + const s: string = x; // Error +>s : string +>x : null + } +} + diff --git a/tests/baselines/reference/doubleMixinConditionalTypeBaseClassWorks.js b/tests/baselines/reference/doubleMixinConditionalTypeBaseClassWorks.js new file mode 100644 index 0000000000000..6ea7a46bb6851 --- /dev/null +++ b/tests/baselines/reference/doubleMixinConditionalTypeBaseClassWorks.js @@ -0,0 +1,42 @@ +//// [doubleMixinConditionalTypeBaseClassWorks.ts] +type Constructor = new (...args: any[]) => {}; + +const Mixin1 = (Base: C) => class extends Base { private _fooPrivate: {}; } + +type FooConstructor = typeof Mixin1 extends (a: Constructor) => infer Cls ? Cls : never; +const Mixin2 = (Base: C) => class extends Base {}; + +class C extends Mixin2(Mixin1(Object)) {} + +//// [doubleMixinConditionalTypeBaseClassWorks.js] +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var Mixin1 = function (Base) { return /** @class */ (function (_super) { + __extends(class_1, _super); + function class_1() { + return _super !== null && _super.apply(this, arguments) || this; + } + return class_1; +}(Base)); }; +var Mixin2 = function (Base) { return /** @class */ (function (_super) { + __extends(class_2, _super); + function class_2() { + return _super !== null && _super.apply(this, arguments) || this; + } + return class_2; +}(Base)); }; +var C = /** @class */ (function (_super) { + __extends(C, _super); + function C() { + return _super !== null && _super.apply(this, arguments) || this; + } + return C; +}(Mixin2(Mixin1(Object)))); diff --git a/tests/baselines/reference/doubleMixinConditionalTypeBaseClassWorks.symbols b/tests/baselines/reference/doubleMixinConditionalTypeBaseClassWorks.symbols new file mode 100644 index 0000000000000..f1f0187a7eb7c --- /dev/null +++ b/tests/baselines/reference/doubleMixinConditionalTypeBaseClassWorks.symbols @@ -0,0 +1,36 @@ +=== tests/cases/compiler/doubleMixinConditionalTypeBaseClassWorks.ts === +type Constructor = new (...args: any[]) => {}; +>Constructor : Symbol(Constructor, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 0, 0)) +>args : Symbol(args, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 0, 24)) + +const Mixin1 = (Base: C) => class extends Base { private _fooPrivate: {}; } +>Mixin1 : Symbol(Mixin1, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 2, 5)) +>C : Symbol(C, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 2, 16)) +>Constructor : Symbol(Constructor, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 0, 0)) +>Base : Symbol(Base, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 2, 39)) +>C : Symbol(C, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 2, 16)) +>Base : Symbol(Base, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 2, 39)) +>_fooPrivate : Symbol((Anonymous class)._fooPrivate, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 2, 71)) + +type FooConstructor = typeof Mixin1 extends (a: Constructor) => infer Cls ? Cls : never; +>FooConstructor : Symbol(FooConstructor, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 2, 98)) +>Mixin1 : Symbol(Mixin1, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 2, 5)) +>a : Symbol(a, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 4, 45)) +>Constructor : Symbol(Constructor, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 0, 0)) +>Cls : Symbol(Cls, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 4, 69)) +>Cls : Symbol(Cls, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 4, 69)) + +const Mixin2 = (Base: C) => class extends Base {}; +>Mixin2 : Symbol(Mixin2, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 5, 5)) +>C : Symbol(C, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 5, 16)) +>FooConstructor : Symbol(FooConstructor, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 2, 98)) +>Base : Symbol(Base, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 5, 42)) +>C : Symbol(C, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 5, 16)) +>Base : Symbol(Base, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 5, 42)) + +class C extends Mixin2(Mixin1(Object)) {} +>C : Symbol(C, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 5, 76)) +>Mixin2 : Symbol(Mixin2, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 5, 5)) +>Mixin1 : Symbol(Mixin1, Decl(doubleMixinConditionalTypeBaseClassWorks.ts, 2, 5)) +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + diff --git a/tests/baselines/reference/doubleMixinConditionalTypeBaseClassWorks.types b/tests/baselines/reference/doubleMixinConditionalTypeBaseClassWorks.types new file mode 100644 index 0000000000000..5fd92f6e2eb5e --- /dev/null +++ b/tests/baselines/reference/doubleMixinConditionalTypeBaseClassWorks.types @@ -0,0 +1,42 @@ +=== tests/cases/compiler/doubleMixinConditionalTypeBaseClassWorks.ts === +type Constructor = new (...args: any[]) => {}; +>Constructor : Constructor +>args : any[] + +const Mixin1 = (Base: C) => class extends Base { private _fooPrivate: {}; } +>Mixin1 : (Base: C) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C +>(Base: C) => class extends Base { private _fooPrivate: {}; } : (Base: C) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C +>C : C +>Constructor : Constructor +>Base : C +>C : C +>class extends Base { private _fooPrivate: {}; } : { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C +>Base : {} +>_fooPrivate : {} + +type FooConstructor = typeof Mixin1 extends (a: Constructor) => infer Cls ? Cls : never; +>FooConstructor : { new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); } & Constructor +>Mixin1 : (Base: C) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C +>a : Constructor +>Constructor : Constructor +>Cls : Cls +>Cls : Cls + +const Mixin2 = (Base: C) => class extends Base {}; +>Mixin2 : .(Anonymous class); prototype: .(Anonymous class); } & Constructor>(Base: C) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C +>(Base: C) => class extends Base {} : .(Anonymous class); prototype: .(Anonymous class); } & Constructor>(Base: C) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C +>C : C +>FooConstructor : { new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); } & Constructor +>Base : C +>C : C +>class extends Base {} : { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C +>Base : .(Anonymous class) + +class C extends Mixin2(Mixin1(Object)) {} +>C : C +>Mixin2(Mixin1(Object)) : <{ new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); } & ObjectConstructor>.(Anonymous class) & .(Anonymous class) & Object +>Mixin2 : .(Anonymous class); prototype: .(Anonymous class); } & Constructor>(Base: C) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C +>Mixin1(Object) : { new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); } & ObjectConstructor +>Mixin1 : (Base: C) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C +>Object : ObjectConstructor + diff --git a/tests/baselines/reference/dynamicRequire.symbols b/tests/baselines/reference/dynamicRequire.symbols index ba593556f259b..8b31e95e77247 100644 --- a/tests/baselines/reference/dynamicRequire.symbols +++ b/tests/baselines/reference/dynamicRequire.symbols @@ -5,5 +5,6 @@ function foo(name) { var s = require("t/" + name) >s : Symbol(s, Decl(a.js, 1, 7)) +>require : Symbol(require) >name : Symbol(name, Decl(a.js, 0, 13)) } diff --git a/tests/baselines/reference/emptyArrayDestructuringExpressionVisitedByTransformer.js b/tests/baselines/reference/emptyArrayDestructuringExpressionVisitedByTransformer.js new file mode 100644 index 0000000000000..5e7e333f7a6b4 --- /dev/null +++ b/tests/baselines/reference/emptyArrayDestructuringExpressionVisitedByTransformer.js @@ -0,0 +1,7 @@ +//// [emptyArrayDestructuringExpressionVisitedByTransformer.ts] +var a = [] = [1].map(_ => _); +var b = [1].map(_ => _); + +//// [emptyArrayDestructuringExpressionVisitedByTransformer.js] +var a = [1].map(function (_) { return _; }); +var b = [1].map(function (_) { return _; }); diff --git a/tests/baselines/reference/emptyArrayDestructuringExpressionVisitedByTransformer.symbols b/tests/baselines/reference/emptyArrayDestructuringExpressionVisitedByTransformer.symbols new file mode 100644 index 0000000000000..5694d47c8c879 --- /dev/null +++ b/tests/baselines/reference/emptyArrayDestructuringExpressionVisitedByTransformer.symbols @@ -0,0 +1,15 @@ +=== tests/cases/compiler/emptyArrayDestructuringExpressionVisitedByTransformer.ts === +var a = [] = [1].map(_ => _); +>a : Symbol(a, Decl(emptyArrayDestructuringExpressionVisitedByTransformer.ts, 0, 3)) +>[1].map : Symbol(Array.map, Decl(lib.d.ts, --, --)) +>map : Symbol(Array.map, Decl(lib.d.ts, --, --)) +>_ : Symbol(_, Decl(emptyArrayDestructuringExpressionVisitedByTransformer.ts, 0, 21)) +>_ : Symbol(_, Decl(emptyArrayDestructuringExpressionVisitedByTransformer.ts, 0, 21)) + +var b = [1].map(_ => _); +>b : Symbol(b, Decl(emptyArrayDestructuringExpressionVisitedByTransformer.ts, 1, 3)) +>[1].map : Symbol(Array.map, Decl(lib.d.ts, --, --)) +>map : Symbol(Array.map, Decl(lib.d.ts, --, --)) +>_ : Symbol(_, Decl(emptyArrayDestructuringExpressionVisitedByTransformer.ts, 1, 16)) +>_ : Symbol(_, Decl(emptyArrayDestructuringExpressionVisitedByTransformer.ts, 1, 16)) + diff --git a/tests/baselines/reference/emptyArrayDestructuringExpressionVisitedByTransformer.types b/tests/baselines/reference/emptyArrayDestructuringExpressionVisitedByTransformer.types new file mode 100644 index 0000000000000..450a24a0fa74c --- /dev/null +++ b/tests/baselines/reference/emptyArrayDestructuringExpressionVisitedByTransformer.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/emptyArrayDestructuringExpressionVisitedByTransformer.ts === +var a = [] = [1].map(_ => _); +>a : number[] +>[] = [1].map(_ => _) : number[] +>[] : undefined[] +>[1].map(_ => _) : number[] +>[1].map : (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[] +>[1] : number[] +>1 : 1 +>map : (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[] +>_ => _ : (_: number) => number +>_ : number +>_ : number + +var b = [1].map(_ => _); +>b : number[] +>[1].map(_ => _) : number[] +>[1].map : (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[] +>[1] : number[] +>1 : 1 +>map : (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[] +>_ => _ : (_: number) => number +>_ : number +>_ : number + diff --git a/tests/baselines/reference/errorMessagesIntersectionTypes04.errors.txt b/tests/baselines/reference/errorMessagesIntersectionTypes04.errors.txt index d2e81844da151..25fdc65f5e8eb 100644 --- a/tests/baselines/reference/errorMessagesIntersectionTypes04.errors.txt +++ b/tests/baselines/reference/errorMessagesIntersectionTypes04.errors.txt @@ -1,11 +1,9 @@ tests/cases/compiler/errorMessagesIntersectionTypes04.ts(17,5): error TS2322: Type 'A & B' is not assignable to type 'number'. tests/cases/compiler/errorMessagesIntersectionTypes04.ts(18,5): error TS2322: Type 'A & B' is not assignable to type 'boolean'. tests/cases/compiler/errorMessagesIntersectionTypes04.ts(19,5): error TS2322: Type 'A & B' is not assignable to type 'string'. -tests/cases/compiler/errorMessagesIntersectionTypes04.ts(21,5): error TS2322: Type '(number & true) | (number & false)' is not assignable to type 'string'. - Type 'number & true' is not assignable to type 'string'. -==== tests/cases/compiler/errorMessagesIntersectionTypes04.ts (4 errors) ==== +==== tests/cases/compiler/errorMessagesIntersectionTypes04.ts (3 errors) ==== interface A { a; } @@ -33,7 +31,4 @@ tests/cases/compiler/errorMessagesIntersectionTypes04.ts(21,5): error TS2322: Ty !!! error TS2322: Type 'A & B' is not assignable to type 'string'. str = num_and_bool; - ~~~ -!!! error TS2322: Type '(number & true) | (number & false)' is not assignable to type 'string'. -!!! error TS2322: Type 'number & true' is not assignable to type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/errorMessagesIntersectionTypes04.types b/tests/baselines/reference/errorMessagesIntersectionTypes04.types index 9d8db5dba3d46..b24597d4b3389 100644 --- a/tests/baselines/reference/errorMessagesIntersectionTypes04.types +++ b/tests/baselines/reference/errorMessagesIntersectionTypes04.types @@ -36,7 +36,7 @@ function f(): void { >B : B let num_and_bool: number & boolean; ->num_and_bool : (number & true) | (number & false) +>num_and_bool : never num = a_and_b; >num = a_and_b : A & B @@ -54,7 +54,7 @@ function f(): void { >a_and_b : A & B str = num_and_bool; ->str = num_and_bool : (number & true) | (number & false) +>str = num_and_bool : never >str : string ->num_and_bool : (number & true) | (number & false) +>num_and_bool : never } diff --git a/tests/baselines/reference/exportNestedNamespaces2.errors.txt b/tests/baselines/reference/exportNestedNamespaces2.errors.txt index 38dc2fc2c608d..d6c2a3a1e0416 100644 --- a/tests/baselines/reference/exportNestedNamespaces2.errors.txt +++ b/tests/baselines/reference/exportNestedNamespaces2.errors.txt @@ -1,25 +1,19 @@ -tests/cases/conformance/salsa/first.js(1,11): error TS2304: Cannot find name 'require'. tests/cases/conformance/salsa/first.js(2,9): error TS2339: Property 'formatters' does not exist on type 'typeof import("tests/cases/conformance/salsa/first")'. -tests/cases/conformance/salsa/second.js(1,11): error TS2304: Cannot find name 'require'. tests/cases/conformance/salsa/second.js(2,9): error TS2339: Property 'formatters' does not exist on type 'typeof import("tests/cases/conformance/salsa/second")'. ==== tests/cases/conformance/salsa/mod.js (0 errors) ==== // Based on a pattern from adonis exports.formatters = {} -==== tests/cases/conformance/salsa/first.js (2 errors) ==== +==== tests/cases/conformance/salsa/first.js (1 errors) ==== exports = require('./mod') - ~~~~~~~ -!!! error TS2304: Cannot find name 'require'. exports.formatters.j = function (v) { ~~~~~~~~~~ !!! error TS2339: Property 'formatters' does not exist on type 'typeof import("tests/cases/conformance/salsa/first")'. return v } -==== tests/cases/conformance/salsa/second.js (2 errors) ==== +==== tests/cases/conformance/salsa/second.js (1 errors) ==== exports = require('./mod') - ~~~~~~~ -!!! error TS2304: Cannot find name 'require'. exports.formatters.o = function (v) { ~~~~~~~~~~ !!! error TS2339: Property 'formatters' does not exist on type 'typeof import("tests/cases/conformance/salsa/second")'. diff --git a/tests/baselines/reference/exportNestedNamespaces2.symbols b/tests/baselines/reference/exportNestedNamespaces2.symbols index bc14f9f8889ff..6f4e14c953524 100644 --- a/tests/baselines/reference/exportNestedNamespaces2.symbols +++ b/tests/baselines/reference/exportNestedNamespaces2.symbols @@ -8,6 +8,7 @@ exports.formatters = {} === tests/cases/conformance/salsa/first.js === exports = require('./mod') >exports : Symbol("tests/cases/conformance/salsa/first", Decl(first.js, 0, 0)) +>require : Symbol(require) >'./mod' : Symbol("tests/cases/conformance/salsa/mod", Decl(mod.js, 0, 0)) exports.formatters.j = function (v) { @@ -20,6 +21,7 @@ exports.formatters.j = function (v) { === tests/cases/conformance/salsa/second.js === exports = require('./mod') >exports : Symbol("tests/cases/conformance/salsa/second", Decl(second.js, 0, 0)) +>require : Symbol(require) >'./mod' : Symbol("tests/cases/conformance/salsa/mod", Decl(mod.js, 0, 0)) exports.formatters.o = function (v) { diff --git a/tests/baselines/reference/importMeta.errors.txt b/tests/baselines/reference/importMeta.errors.txt new file mode 100644 index 0000000000000..999c883f26618 --- /dev/null +++ b/tests/baselines/reference/importMeta.errors.txt @@ -0,0 +1,71 @@ +error TS2468: Cannot find global value 'Promise'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,44): error TS2339: Property 'blah' does not exist on type 'ImportMeta'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. +tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option. +tests/cases/conformance/es2019/importMeta/example.ts(3,71): error TS2339: Property 'url' does not exist on type 'ImportMeta'. +tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'. +tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? +tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? +tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,22): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? +tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? + + +!!! error TS2468: Cannot find global value 'Promise'. +==== tests/cases/conformance/es2019/importMeta/example.ts (3 errors) ==== + // Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example + (async () => { + ~~~~~~~~~~~~~ +!!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option. + const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); + ~~~ +!!! error TS2339: Property 'url' does not exist on type 'ImportMeta'. + const blob = await response.blob(); + + const size = import.meta.scriptElement.dataset.size || 300; + ~~~~~~~~~~~~~ +!!! error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'. + + const image = new Image(); + image.src = URL.createObjectURL(blob); + image.width = image.height = size; + + document.body.appendChild(image); + })(); + +==== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts (2 errors) ==== + export let x = import.meta; + export let y = import.metal; + ~~~~~ +!!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? + export let z = import.import.import.malkovich; + ~~~~~~ +!!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? + +==== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts (2 errors) ==== + let globalA = import.meta; + let globalB = import.metal; + ~~~~~ +!!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? + let globalC = import.import.import.malkovich; + ~~~~~~ +!!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? + +==== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts (3 errors) ==== + export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta; + ~~~~ +!!! error TS2339: Property 'blah' does not exist on type 'ImportMeta'. + ~~~~ +!!! error TS2339: Property 'blue' does not exist on type 'ImportMeta'. + import.meta = foo; + ~~~~~~~~~~~ +!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access. + + // @Filename augmentations.ts + declare global { + interface ImportMeta { + wellKnownProperty: { a: number, b: string, c: boolean }; + } + } + + const { a, b, c } = import.meta.wellKnownProperty; \ No newline at end of file diff --git a/tests/baselines/reference/importMeta.js b/tests/baselines/reference/importMeta.js new file mode 100644 index 0000000000000..4b6fa5436f567 --- /dev/null +++ b/tests/baselines/reference/importMeta.js @@ -0,0 +1,63 @@ +//// [tests/cases/conformance/es2019/importMeta/importMeta.ts] //// + +//// [example.ts] +// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example +(async () => { + const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); + const blob = await response.blob(); + + const size = import.meta.scriptElement.dataset.size || 300; + + const image = new Image(); + image.src = URL.createObjectURL(blob); + image.width = image.height = size; + + document.body.appendChild(image); +})(); + +//// [moduleLookingFile01.ts] +export let x = import.meta; +export let y = import.metal; +export let z = import.import.import.malkovich; + +//// [scriptLookingFile01.ts] +let globalA = import.meta; +let globalB = import.metal; +let globalC = import.import.import.malkovich; + +//// [assignmentTargets.ts] +export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta; +import.meta = foo; + +// @Filename augmentations.ts +declare global { + interface ImportMeta { + wellKnownProperty: { a: number, b: string, c: boolean }; + } +} + +const { a, b, c } = import.meta.wellKnownProperty; + +//// [example.js] +// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example +(async () => { + const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); + const blob = await response.blob(); + const size = import.meta.scriptElement.dataset.size || 300; + const image = new Image(); + image.src = URL.createObjectURL(blob); + image.width = image.height = size; + document.body.appendChild(image); +})(); +//// [moduleLookingFile01.js] +export let x = import.meta; +export let y = import.metal; +export let z = import.import.import.malkovich; +//// [scriptLookingFile01.js] +let globalA = import.meta; +let globalB = import.metal; +let globalC = import.import.import.malkovich; +//// [assignmentTargets.js] +export const foo = import.meta.blah = import.meta.blue = import.meta; +import.meta = foo; +const { a, b, c } = import.meta.wellKnownProperty; diff --git a/tests/baselines/reference/importMeta.symbols b/tests/baselines/reference/importMeta.symbols new file mode 100644 index 0000000000000..58d8f9807d4c1 --- /dev/null +++ b/tests/baselines/reference/importMeta.symbols @@ -0,0 +1,101 @@ +=== tests/cases/conformance/es2019/importMeta/example.ts === +// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example +(async () => { + const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); +>response : Symbol(response, Decl(example.ts, 2, 7)) +>fetch : Symbol(fetch, Decl(lib.dom.d.ts, --, --)) +>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --)) +>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --)) + + const blob = await response.blob(); +>blob : Symbol(blob, Decl(example.ts, 3, 7)) +>response.blob : Symbol(Body.blob, Decl(lib.dom.d.ts, --, --)) +>response : Symbol(response, Decl(example.ts, 2, 7)) +>blob : Symbol(Body.blob, Decl(lib.dom.d.ts, --, --)) + + const size = import.meta.scriptElement.dataset.size || 300; +>size : Symbol(size, Decl(example.ts, 5, 7)) + + const image = new Image(); +>image : Symbol(image, Decl(example.ts, 7, 7)) +>Image : Symbol(Image, Decl(lib.dom.d.ts, --, --)) + + image.src = URL.createObjectURL(blob); +>image.src : Symbol(HTMLImageElement.src, Decl(lib.dom.d.ts, --, --)) +>image : Symbol(image, Decl(example.ts, 7, 7)) +>src : Symbol(HTMLImageElement.src, Decl(lib.dom.d.ts, --, --)) +>URL.createObjectURL : Symbol(createObjectURL, Decl(lib.dom.d.ts, --, --)) +>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>createObjectURL : Symbol(createObjectURL, Decl(lib.dom.d.ts, --, --)) +>blob : Symbol(blob, Decl(example.ts, 3, 7)) + + image.width = image.height = size; +>image.width : Symbol(HTMLImageElement.width, Decl(lib.dom.d.ts, --, --)) +>image : Symbol(image, Decl(example.ts, 7, 7)) +>width : Symbol(HTMLImageElement.width, Decl(lib.dom.d.ts, --, --)) +>image.height : Symbol(HTMLImageElement.height, Decl(lib.dom.d.ts, --, --)) +>image : Symbol(image, Decl(example.ts, 7, 7)) +>height : Symbol(HTMLImageElement.height, Decl(lib.dom.d.ts, --, --)) +>size : Symbol(size, Decl(example.ts, 5, 7)) + + document.body.appendChild(image); +>document.body.appendChild : Symbol(Node.appendChild, Decl(lib.dom.d.ts, --, --)) +>document.body : Symbol(Document.body, Decl(lib.dom.d.ts, --, --)) +>document : Symbol(document, Decl(lib.dom.d.ts, --, --)) +>body : Symbol(Document.body, Decl(lib.dom.d.ts, --, --)) +>appendChild : Symbol(Node.appendChild, Decl(lib.dom.d.ts, --, --)) +>image : Symbol(image, Decl(example.ts, 7, 7)) + +})(); + +=== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts === +export let x = import.meta; +>x : Symbol(x, Decl(moduleLookingFile01.ts, 0, 10)) + +export let y = import.metal; +>y : Symbol(y, Decl(moduleLookingFile01.ts, 1, 10)) + +export let z = import.import.import.malkovich; +>z : Symbol(z, Decl(moduleLookingFile01.ts, 2, 10)) + +=== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts === +let globalA = import.meta; +>globalA : Symbol(globalA, Decl(scriptLookingFile01.ts, 0, 3)) + +let globalB = import.metal; +>globalB : Symbol(globalB, Decl(scriptLookingFile01.ts, 1, 3)) + +let globalC = import.import.import.malkovich; +>globalC : Symbol(globalC, Decl(scriptLookingFile01.ts, 2, 3)) + +=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts === +export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta; +>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12)) +>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16)) + +import.meta = foo; +>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12)) + +// @Filename augmentations.ts +declare global { +>global : Symbol(global, Decl(assignmentTargets.ts, 1, 18)) + + interface ImportMeta { +>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16)) + + wellKnownProperty: { a: number, b: string, c: boolean }; +>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24)) +>a : Symbol(a, Decl(assignmentTargets.ts, 6, 24)) +>b : Symbol(b, Decl(assignmentTargets.ts, 6, 35)) +>c : Symbol(c, Decl(assignmentTargets.ts, 6, 46)) + } +} + +const { a, b, c } = import.meta.wellKnownProperty; +>a : Symbol(a, Decl(assignmentTargets.ts, 10, 7)) +>b : Symbol(b, Decl(assignmentTargets.ts, 10, 10)) +>c : Symbol(c, Decl(assignmentTargets.ts, 10, 13)) +>import.meta.wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24)) +>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24)) + diff --git a/tests/baselines/reference/importMeta.types b/tests/baselines/reference/importMeta.types new file mode 100644 index 0000000000000..c6140c8d05d03 --- /dev/null +++ b/tests/baselines/reference/importMeta.types @@ -0,0 +1,169 @@ +=== tests/cases/conformance/es2019/importMeta/example.ts === +// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example +(async () => { +>(async () => { const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); const blob = await response.blob(); const size = import.meta.scriptElement.dataset.size || 300; const image = new Image(); image.src = URL.createObjectURL(blob); image.width = image.height = size; document.body.appendChild(image);})() : Promise +>(async () => { const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); const blob = await response.blob(); const size = import.meta.scriptElement.dataset.size || 300; const image = new Image(); image.src = URL.createObjectURL(blob); image.width = image.height = size; document.body.appendChild(image);}) : () => Promise +>async () => { const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); const blob = await response.blob(); const size = import.meta.scriptElement.dataset.size || 300; const image = new Image(); image.src = URL.createObjectURL(blob); image.width = image.height = size; document.body.appendChild(image);} : () => Promise + + const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); +>response : Response +>await fetch(new URL("../hamsters.jpg", import.meta.url).toString()) : Response +>fetch(new URL("../hamsters.jpg", import.meta.url).toString()) : Promise +>fetch : (input?: string | Request, init?: RequestInit) => Promise +>new URL("../hamsters.jpg", import.meta.url).toString() : string +>new URL("../hamsters.jpg", import.meta.url).toString : () => string +>new URL("../hamsters.jpg", import.meta.url) : URL +>URL : { new (url: string, base?: string | URL): URL; prototype: URL; createObjectURL(object: any, options?: ObjectURLOptions): string; revokeObjectURL(url: string): void; } +>"../hamsters.jpg" : "../hamsters.jpg" +>import.meta.url : any +>import.meta : ImportMeta +>meta : any +>url : any +>toString : () => string + + const blob = await response.blob(); +>blob : Blob +>await response.blob() : Blob +>response.blob() : Promise +>response.blob : () => Promise +>response : Response +>blob : () => Promise + + const size = import.meta.scriptElement.dataset.size || 300; +>size : any +>import.meta.scriptElement.dataset.size || 300 : any +>import.meta.scriptElement.dataset.size : any +>import.meta.scriptElement.dataset : any +>import.meta.scriptElement : any +>import.meta : ImportMeta +>meta : any +>scriptElement : any +>dataset : any +>size : any +>300 : 300 + + const image = new Image(); +>image : HTMLImageElement +>new Image() : HTMLImageElement +>Image : new (width?: number, height?: number) => HTMLImageElement + + image.src = URL.createObjectURL(blob); +>image.src = URL.createObjectURL(blob) : string +>image.src : string +>image : HTMLImageElement +>src : string +>URL.createObjectURL(blob) : string +>URL.createObjectURL : (object: any, options?: ObjectURLOptions) => string +>URL : { new (url: string, base?: string | URL): URL; prototype: URL; createObjectURL(object: any, options?: ObjectURLOptions): string; revokeObjectURL(url: string): void; } +>createObjectURL : (object: any, options?: ObjectURLOptions) => string +>blob : Blob + + image.width = image.height = size; +>image.width = image.height = size : any +>image.width : number +>image : HTMLImageElement +>width : number +>image.height = size : any +>image.height : number +>image : HTMLImageElement +>height : number +>size : any + + document.body.appendChild(image); +>document.body.appendChild(image) : HTMLImageElement +>document.body.appendChild : (newChild: T) => T +>document.body : HTMLElement +>document : Document +>body : HTMLElement +>appendChild : (newChild: T) => T +>image : HTMLImageElement + +})(); + +=== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts === +export let x = import.meta; +>x : ImportMeta +>import.meta : ImportMeta +>meta : any + +export let y = import.metal; +>y : any +>import.metal : any +>metal : any + +export let z = import.import.import.malkovich; +>z : any +>import.import.import.malkovich : any +>import.import.import : any +>import.import : any +>import : any +>import : any +>malkovich : any + +=== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts === +let globalA = import.meta; +>globalA : ImportMeta +>import.meta : ImportMeta +>meta : any + +let globalB = import.metal; +>globalB : any +>import.metal : any +>metal : any + +let globalC = import.import.import.malkovich; +>globalC : any +>import.import.import.malkovich : any +>import.import.import : any +>import.import : any +>import : any +>import : any +>malkovich : any + +=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts === +export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta; +>foo : ImportMeta +>ImportMeta : ImportMeta +>import.meta.blah = import.meta.blue = import.meta : ImportMeta +>import.meta.blah : any +>import.meta : ImportMeta +>meta : any +>blah : any +>import.meta.blue = import.meta : ImportMeta +>import.meta.blue : any +>import.meta : ImportMeta +>meta : any +>blue : any +>import.meta : ImportMeta +>meta : any + +import.meta = foo; +>import.meta = foo : ImportMeta +>import.meta : ImportMeta +>meta : any +>foo : ImportMeta + +// @Filename augmentations.ts +declare global { +>global : any + + interface ImportMeta { +>ImportMeta : ImportMeta + + wellKnownProperty: { a: number, b: string, c: boolean }; +>wellKnownProperty : { a: number; b: string; c: boolean; } +>a : number +>b : string +>c : boolean + } +} + +const { a, b, c } = import.meta.wellKnownProperty; +>a : number +>b : string +>c : boolean +>import.meta.wellKnownProperty : { a: number; b: string; c: boolean; } +>import.meta : ImportMeta +>meta : any +>wellKnownProperty : { a: number; b: string; c: boolean; } + diff --git a/tests/baselines/reference/importMetaES5.errors.txt b/tests/baselines/reference/importMetaES5.errors.txt new file mode 100644 index 0000000000000..71b67efae0143 --- /dev/null +++ b/tests/baselines/reference/importMetaES5.errors.txt @@ -0,0 +1,110 @@ +error TS2468: Cannot find global value 'Promise'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,44): error TS2339: Property 'blah' does not exist on type 'ImportMeta'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. +tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option. +tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. +tests/cases/conformance/es2019/importMeta/example.ts(3,71): error TS2339: Property 'url' does not exist on type 'ImportMeta'. +tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. +tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'. +tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. +tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. +tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? +tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. +tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? +tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. +tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. +tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,22): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? +tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. +tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? + + +!!! error TS2468: Cannot find global value 'Promise'. +==== tests/cases/conformance/es2019/importMeta/example.ts (5 errors) ==== + // Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example + (async () => { + ~~~~~~~~~~~~~ +!!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option. + const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); + ~~~~~~~~~~~ +!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. + ~~~ +!!! error TS2339: Property 'url' does not exist on type 'ImportMeta'. + const blob = await response.blob(); + + const size = import.meta.scriptElement.dataset.size || 300; + ~~~~~~~~~~~ +!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. + ~~~~~~~~~~~~~ +!!! error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'. + + const image = new Image(); + image.src = URL.createObjectURL(blob); + image.width = image.height = size; + + document.body.appendChild(image); + })(); + +==== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts (5 errors) ==== + export let x = import.meta; + ~~~~~~~~~~~ +!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. + export let y = import.metal; + ~~~~~~~~~~~~ +!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. + ~~~~~ +!!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? + export let z = import.import.import.malkovich; + ~~~~~~~~~~~~~ +!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. + ~~~~~~ +!!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? + +==== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts (5 errors) ==== + let globalA = import.meta; + ~~~~~~~~~~~ +!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. + let globalB = import.metal; + ~~~~~~~~~~~~ +!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. + ~~~~~ +!!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? + let globalC = import.import.import.malkovich; + ~~~~~~~~~~~~~ +!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. + ~~~~~~ +!!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? + +==== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts (8 errors) ==== + export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta; + ~~~~~~~~~~~ +!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. + ~~~~ +!!! error TS2339: Property 'blah' does not exist on type 'ImportMeta'. + ~~~~~~~~~~~ +!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. + ~~~~ +!!! error TS2339: Property 'blue' does not exist on type 'ImportMeta'. + ~~~~~~~~~~~ +!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. + import.meta = foo; + ~~~~~~~~~~~ +!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. + ~~~~~~~~~~~ +!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access. + + // @Filename augmentations.ts + declare global { + interface ImportMeta { + wellKnownProperty: { a: number, b: string, c: boolean }; + } + } + + const { a, b, c } = import.meta.wellKnownProperty; + ~~~~~~~~~~~ +!!! error TS1343: The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options. \ No newline at end of file diff --git a/tests/baselines/reference/importMetaES5.js b/tests/baselines/reference/importMetaES5.js new file mode 100644 index 0000000000000..8ac695412ff7e --- /dev/null +++ b/tests/baselines/reference/importMetaES5.js @@ -0,0 +1,117 @@ +//// [tests/cases/conformance/es2019/importMeta/importMetaES5.ts] //// + +//// [example.ts] +// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example +(async () => { + const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); + const blob = await response.blob(); + + const size = import.meta.scriptElement.dataset.size || 300; + + const image = new Image(); + image.src = URL.createObjectURL(blob); + image.width = image.height = size; + + document.body.appendChild(image); +})(); + +//// [moduleLookingFile01.ts] +export let x = import.meta; +export let y = import.metal; +export let z = import.import.import.malkovich; + +//// [scriptLookingFile01.ts] +let globalA = import.meta; +let globalB = import.metal; +let globalC = import.import.import.malkovich; + +//// [assignmentTargets.ts] +export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta; +import.meta = foo; + +// @Filename augmentations.ts +declare global { + interface ImportMeta { + wellKnownProperty: { a: number, b: string, c: boolean }; + } +} + +const { a, b, c } = import.meta.wellKnownProperty; + +//// [example.js] +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var _this = this; +Object.defineProperty(exports, "__esModule", { value: true }); +// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example +(function () { return __awaiter(_this, void 0, void 0, function () { + var response, blob, size, image; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, fetch(new URL("../hamsters.jpg", import.meta.url).toString())]; + case 1: + response = _a.sent(); + return [4 /*yield*/, response.blob()]; + case 2: + blob = _a.sent(); + size = import.meta.scriptElement.dataset.size || 300; + image = new Image(); + image.src = URL.createObjectURL(blob); + image.width = image.height = size; + document.body.appendChild(image); + return [2 /*return*/]; + } + }); +}); })(); +//// [moduleLookingFile01.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = (import.meta); +exports.y = (import.metal); +exports.z = import.import.import.malkovich; +//// [scriptLookingFile01.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var globalA = import.meta; +var globalB = import.metal; +var globalC = import.import.import.malkovich; +//// [assignmentTargets.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = import.meta.blah = import.meta.blue = import.meta; +import.meta = exports.foo; +var _a = import.meta.wellKnownProperty, a = _a.a, b = _a.b, c = _a.c; diff --git a/tests/baselines/reference/importMetaES5.symbols b/tests/baselines/reference/importMetaES5.symbols new file mode 100644 index 0000000000000..58d8f9807d4c1 --- /dev/null +++ b/tests/baselines/reference/importMetaES5.symbols @@ -0,0 +1,101 @@ +=== tests/cases/conformance/es2019/importMeta/example.ts === +// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example +(async () => { + const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); +>response : Symbol(response, Decl(example.ts, 2, 7)) +>fetch : Symbol(fetch, Decl(lib.dom.d.ts, --, --)) +>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --)) +>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --)) + + const blob = await response.blob(); +>blob : Symbol(blob, Decl(example.ts, 3, 7)) +>response.blob : Symbol(Body.blob, Decl(lib.dom.d.ts, --, --)) +>response : Symbol(response, Decl(example.ts, 2, 7)) +>blob : Symbol(Body.blob, Decl(lib.dom.d.ts, --, --)) + + const size = import.meta.scriptElement.dataset.size || 300; +>size : Symbol(size, Decl(example.ts, 5, 7)) + + const image = new Image(); +>image : Symbol(image, Decl(example.ts, 7, 7)) +>Image : Symbol(Image, Decl(lib.dom.d.ts, --, --)) + + image.src = URL.createObjectURL(blob); +>image.src : Symbol(HTMLImageElement.src, Decl(lib.dom.d.ts, --, --)) +>image : Symbol(image, Decl(example.ts, 7, 7)) +>src : Symbol(HTMLImageElement.src, Decl(lib.dom.d.ts, --, --)) +>URL.createObjectURL : Symbol(createObjectURL, Decl(lib.dom.d.ts, --, --)) +>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>createObjectURL : Symbol(createObjectURL, Decl(lib.dom.d.ts, --, --)) +>blob : Symbol(blob, Decl(example.ts, 3, 7)) + + image.width = image.height = size; +>image.width : Symbol(HTMLImageElement.width, Decl(lib.dom.d.ts, --, --)) +>image : Symbol(image, Decl(example.ts, 7, 7)) +>width : Symbol(HTMLImageElement.width, Decl(lib.dom.d.ts, --, --)) +>image.height : Symbol(HTMLImageElement.height, Decl(lib.dom.d.ts, --, --)) +>image : Symbol(image, Decl(example.ts, 7, 7)) +>height : Symbol(HTMLImageElement.height, Decl(lib.dom.d.ts, --, --)) +>size : Symbol(size, Decl(example.ts, 5, 7)) + + document.body.appendChild(image); +>document.body.appendChild : Symbol(Node.appendChild, Decl(lib.dom.d.ts, --, --)) +>document.body : Symbol(Document.body, Decl(lib.dom.d.ts, --, --)) +>document : Symbol(document, Decl(lib.dom.d.ts, --, --)) +>body : Symbol(Document.body, Decl(lib.dom.d.ts, --, --)) +>appendChild : Symbol(Node.appendChild, Decl(lib.dom.d.ts, --, --)) +>image : Symbol(image, Decl(example.ts, 7, 7)) + +})(); + +=== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts === +export let x = import.meta; +>x : Symbol(x, Decl(moduleLookingFile01.ts, 0, 10)) + +export let y = import.metal; +>y : Symbol(y, Decl(moduleLookingFile01.ts, 1, 10)) + +export let z = import.import.import.malkovich; +>z : Symbol(z, Decl(moduleLookingFile01.ts, 2, 10)) + +=== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts === +let globalA = import.meta; +>globalA : Symbol(globalA, Decl(scriptLookingFile01.ts, 0, 3)) + +let globalB = import.metal; +>globalB : Symbol(globalB, Decl(scriptLookingFile01.ts, 1, 3)) + +let globalC = import.import.import.malkovich; +>globalC : Symbol(globalC, Decl(scriptLookingFile01.ts, 2, 3)) + +=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts === +export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta; +>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12)) +>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16)) + +import.meta = foo; +>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12)) + +// @Filename augmentations.ts +declare global { +>global : Symbol(global, Decl(assignmentTargets.ts, 1, 18)) + + interface ImportMeta { +>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16)) + + wellKnownProperty: { a: number, b: string, c: boolean }; +>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24)) +>a : Symbol(a, Decl(assignmentTargets.ts, 6, 24)) +>b : Symbol(b, Decl(assignmentTargets.ts, 6, 35)) +>c : Symbol(c, Decl(assignmentTargets.ts, 6, 46)) + } +} + +const { a, b, c } = import.meta.wellKnownProperty; +>a : Symbol(a, Decl(assignmentTargets.ts, 10, 7)) +>b : Symbol(b, Decl(assignmentTargets.ts, 10, 10)) +>c : Symbol(c, Decl(assignmentTargets.ts, 10, 13)) +>import.meta.wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24)) +>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24)) + diff --git a/tests/baselines/reference/importMetaES5.types b/tests/baselines/reference/importMetaES5.types new file mode 100644 index 0000000000000..c6140c8d05d03 --- /dev/null +++ b/tests/baselines/reference/importMetaES5.types @@ -0,0 +1,169 @@ +=== tests/cases/conformance/es2019/importMeta/example.ts === +// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example +(async () => { +>(async () => { const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); const blob = await response.blob(); const size = import.meta.scriptElement.dataset.size || 300; const image = new Image(); image.src = URL.createObjectURL(blob); image.width = image.height = size; document.body.appendChild(image);})() : Promise +>(async () => { const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); const blob = await response.blob(); const size = import.meta.scriptElement.dataset.size || 300; const image = new Image(); image.src = URL.createObjectURL(blob); image.width = image.height = size; document.body.appendChild(image);}) : () => Promise +>async () => { const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); const blob = await response.blob(); const size = import.meta.scriptElement.dataset.size || 300; const image = new Image(); image.src = URL.createObjectURL(blob); image.width = image.height = size; document.body.appendChild(image);} : () => Promise + + const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); +>response : Response +>await fetch(new URL("../hamsters.jpg", import.meta.url).toString()) : Response +>fetch(new URL("../hamsters.jpg", import.meta.url).toString()) : Promise +>fetch : (input?: string | Request, init?: RequestInit) => Promise +>new URL("../hamsters.jpg", import.meta.url).toString() : string +>new URL("../hamsters.jpg", import.meta.url).toString : () => string +>new URL("../hamsters.jpg", import.meta.url) : URL +>URL : { new (url: string, base?: string | URL): URL; prototype: URL; createObjectURL(object: any, options?: ObjectURLOptions): string; revokeObjectURL(url: string): void; } +>"../hamsters.jpg" : "../hamsters.jpg" +>import.meta.url : any +>import.meta : ImportMeta +>meta : any +>url : any +>toString : () => string + + const blob = await response.blob(); +>blob : Blob +>await response.blob() : Blob +>response.blob() : Promise +>response.blob : () => Promise +>response : Response +>blob : () => Promise + + const size = import.meta.scriptElement.dataset.size || 300; +>size : any +>import.meta.scriptElement.dataset.size || 300 : any +>import.meta.scriptElement.dataset.size : any +>import.meta.scriptElement.dataset : any +>import.meta.scriptElement : any +>import.meta : ImportMeta +>meta : any +>scriptElement : any +>dataset : any +>size : any +>300 : 300 + + const image = new Image(); +>image : HTMLImageElement +>new Image() : HTMLImageElement +>Image : new (width?: number, height?: number) => HTMLImageElement + + image.src = URL.createObjectURL(blob); +>image.src = URL.createObjectURL(blob) : string +>image.src : string +>image : HTMLImageElement +>src : string +>URL.createObjectURL(blob) : string +>URL.createObjectURL : (object: any, options?: ObjectURLOptions) => string +>URL : { new (url: string, base?: string | URL): URL; prototype: URL; createObjectURL(object: any, options?: ObjectURLOptions): string; revokeObjectURL(url: string): void; } +>createObjectURL : (object: any, options?: ObjectURLOptions) => string +>blob : Blob + + image.width = image.height = size; +>image.width = image.height = size : any +>image.width : number +>image : HTMLImageElement +>width : number +>image.height = size : any +>image.height : number +>image : HTMLImageElement +>height : number +>size : any + + document.body.appendChild(image); +>document.body.appendChild(image) : HTMLImageElement +>document.body.appendChild : (newChild: T) => T +>document.body : HTMLElement +>document : Document +>body : HTMLElement +>appendChild : (newChild: T) => T +>image : HTMLImageElement + +})(); + +=== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts === +export let x = import.meta; +>x : ImportMeta +>import.meta : ImportMeta +>meta : any + +export let y = import.metal; +>y : any +>import.metal : any +>metal : any + +export let z = import.import.import.malkovich; +>z : any +>import.import.import.malkovich : any +>import.import.import : any +>import.import : any +>import : any +>import : any +>malkovich : any + +=== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts === +let globalA = import.meta; +>globalA : ImportMeta +>import.meta : ImportMeta +>meta : any + +let globalB = import.metal; +>globalB : any +>import.metal : any +>metal : any + +let globalC = import.import.import.malkovich; +>globalC : any +>import.import.import.malkovich : any +>import.import.import : any +>import.import : any +>import : any +>import : any +>malkovich : any + +=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts === +export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta; +>foo : ImportMeta +>ImportMeta : ImportMeta +>import.meta.blah = import.meta.blue = import.meta : ImportMeta +>import.meta.blah : any +>import.meta : ImportMeta +>meta : any +>blah : any +>import.meta.blue = import.meta : ImportMeta +>import.meta.blue : any +>import.meta : ImportMeta +>meta : any +>blue : any +>import.meta : ImportMeta +>meta : any + +import.meta = foo; +>import.meta = foo : ImportMeta +>import.meta : ImportMeta +>meta : any +>foo : ImportMeta + +// @Filename augmentations.ts +declare global { +>global : any + + interface ImportMeta { +>ImportMeta : ImportMeta + + wellKnownProperty: { a: number, b: string, c: boolean }; +>wellKnownProperty : { a: number; b: string; c: boolean; } +>a : number +>b : string +>c : boolean + } +} + +const { a, b, c } = import.meta.wellKnownProperty; +>a : number +>b : string +>c : boolean +>import.meta.wellKnownProperty : { a: number; b: string; c: boolean; } +>import.meta : ImportMeta +>meta : any +>wellKnownProperty : { a: number; b: string; c: boolean; } + diff --git a/tests/baselines/reference/intersectionReduction.js b/tests/baselines/reference/intersectionReduction.js new file mode 100644 index 0000000000000..1b985a79b9f83 --- /dev/null +++ b/tests/baselines/reference/intersectionReduction.js @@ -0,0 +1,20 @@ +//// [intersectionReduction.ts] +// @strict + +declare const sym1: unique symbol; +declare const sym2: unique symbol; + +type T1 = string & 'a'; // 'a' +type T2 = 'a' & string & 'b'; // 'a' & 'b' +type T3 = number & 10; // 10 +type T4 = 10 & number & 20; // 10 & 20 +type T5 = symbol & typeof sym1; // typeof sym1 +type T6 = typeof sym1 & symbol & typeof sym2; // typeof sym1 & typeof sym2 +type T7 = string & 'a' & number & 10 & symbol & typeof sym1; // 'a' & 10 & typeof sym1 + +type T10 = string & ('a' | 'b'); // 'a' | 'b' +type T11 = (string | number) & ('a' | 10); // 'a' | 10 + + +//// [intersectionReduction.js] +// @strict diff --git a/tests/baselines/reference/intersectionReduction.symbols b/tests/baselines/reference/intersectionReduction.symbols new file mode 100644 index 0000000000000..607ea1d6c480d --- /dev/null +++ b/tests/baselines/reference/intersectionReduction.symbols @@ -0,0 +1,40 @@ +=== tests/cases/conformance/types/intersection/intersectionReduction.ts === +// @strict + +declare const sym1: unique symbol; +>sym1 : Symbol(sym1, Decl(intersectionReduction.ts, 2, 13)) + +declare const sym2: unique symbol; +>sym2 : Symbol(sym2, Decl(intersectionReduction.ts, 3, 13)) + +type T1 = string & 'a'; // 'a' +>T1 : Symbol(T1, Decl(intersectionReduction.ts, 3, 34)) + +type T2 = 'a' & string & 'b'; // 'a' & 'b' +>T2 : Symbol(T2, Decl(intersectionReduction.ts, 5, 23)) + +type T3 = number & 10; // 10 +>T3 : Symbol(T3, Decl(intersectionReduction.ts, 6, 29)) + +type T4 = 10 & number & 20; // 10 & 20 +>T4 : Symbol(T4, Decl(intersectionReduction.ts, 7, 22)) + +type T5 = symbol & typeof sym1; // typeof sym1 +>T5 : Symbol(T5, Decl(intersectionReduction.ts, 8, 27)) +>sym1 : Symbol(sym1, Decl(intersectionReduction.ts, 2, 13)) + +type T6 = typeof sym1 & symbol & typeof sym2; // typeof sym1 & typeof sym2 +>T6 : Symbol(T6, Decl(intersectionReduction.ts, 9, 31)) +>sym1 : Symbol(sym1, Decl(intersectionReduction.ts, 2, 13)) +>sym2 : Symbol(sym2, Decl(intersectionReduction.ts, 3, 13)) + +type T7 = string & 'a' & number & 10 & symbol & typeof sym1; // 'a' & 10 & typeof sym1 +>T7 : Symbol(T7, Decl(intersectionReduction.ts, 10, 45)) +>sym1 : Symbol(sym1, Decl(intersectionReduction.ts, 2, 13)) + +type T10 = string & ('a' | 'b'); // 'a' | 'b' +>T10 : Symbol(T10, Decl(intersectionReduction.ts, 11, 60)) + +type T11 = (string | number) & ('a' | 10); // 'a' | 10 +>T11 : Symbol(T11, Decl(intersectionReduction.ts, 13, 32)) + diff --git a/tests/baselines/reference/intersectionReduction.types b/tests/baselines/reference/intersectionReduction.types new file mode 100644 index 0000000000000..f8c178cfca43f --- /dev/null +++ b/tests/baselines/reference/intersectionReduction.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/types/intersection/intersectionReduction.ts === +// @strict + +declare const sym1: unique symbol; +>sym1 : unique symbol + +declare const sym2: unique symbol; +>sym2 : unique symbol + +type T1 = string & 'a'; // 'a' +>T1 : "a" + +type T2 = 'a' & string & 'b'; // 'a' & 'b' +>T2 : T2 + +type T3 = number & 10; // 10 +>T3 : 10 + +type T4 = 10 & number & 20; // 10 & 20 +>T4 : T4 + +type T5 = symbol & typeof sym1; // typeof sym1 +>T5 : unique symbol +>sym1 : unique symbol + +type T6 = typeof sym1 & symbol & typeof sym2; // typeof sym1 & typeof sym2 +>T6 : T6 +>sym1 : unique symbol +>sym2 : unique symbol + +type T7 = string & 'a' & number & 10 & symbol & typeof sym1; // 'a' & 10 & typeof sym1 +>T7 : T7 +>sym1 : unique symbol + +type T10 = string & ('a' | 'b'); // 'a' | 'b' +>T10 : "a" | "b" + +type T11 = (string | number) & ('a' | 10); // 'a' | 10 +>T11 : "a" | 10 + diff --git a/tests/baselines/reference/intersectionWithUnionConstraint.errors.txt b/tests/baselines/reference/intersectionWithUnionConstraint.errors.txt new file mode 100644 index 0000000000000..9bdfc6f30f9ad --- /dev/null +++ b/tests/baselines/reference/intersectionWithUnionConstraint.errors.txt @@ -0,0 +1,83 @@ +tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(7,9): error TS2322: Type 'T & U' is not assignable to type 'string | number'. + Type 'string | undefined' is not assignable to type 'string | number'. + Type 'undefined' is not assignable to type 'string | number'. + Type 'T & U' is not assignable to type 'number'. +tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(8,9): error TS2322: Type 'T & U' is not assignable to type 'string | null'. + Type 'string | undefined' is not assignable to type 'string | null'. + Type 'undefined' is not assignable to type 'string | null'. + Type 'T & U' is not assignable to type 'string'. +tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(10,9): error TS2322: Type 'T & U' is not assignable to type 'number | null'. + Type 'string | undefined' is not assignable to type 'number | null'. + Type 'undefined' is not assignable to type 'number | null'. + Type 'T & U' is not assignable to type 'number'. +tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(11,9): error TS2322: Type 'T & U' is not assignable to type 'number | undefined'. + Type 'string | undefined' is not assignable to type 'number | undefined'. + Type 'string' is not assignable to type 'number | undefined'. + Type 'T & U' is not assignable to type 'number'. +tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(12,9): error TS2322: Type 'T & U' is not assignable to type 'null | undefined'. + Type 'string | undefined' is not assignable to type 'null | undefined'. + Type 'string' is not assignable to type 'null | undefined'. + Type 'T & U' is not assignable to type 'null'. + + +==== tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts (5 errors) ==== + function f1(x: T & U) { + // Combined constraint of 'T & U' is 'string | number' + let y: string | number = x; + } + + function f2(x: T & U) { + let y1: string | number = x; // Error + ~~ +!!! error TS2322: Type 'T & U' is not assignable to type 'string | number'. +!!! error TS2322: Type 'string | undefined' is not assignable to type 'string | number'. +!!! error TS2322: Type 'undefined' is not assignable to type 'string | number'. +!!! error TS2322: Type 'T & U' is not assignable to type 'number'. + let y2: string | null = x; // Error + ~~ +!!! error TS2322: Type 'T & U' is not assignable to type 'string | null'. +!!! error TS2322: Type 'string | undefined' is not assignable to type 'string | null'. +!!! error TS2322: Type 'undefined' is not assignable to type 'string | null'. +!!! error TS2322: Type 'T & U' is not assignable to type 'string'. + let y3: string | undefined = x; + let y4: number | null = x; // Error + ~~ +!!! error TS2322: Type 'T & U' is not assignable to type 'number | null'. +!!! error TS2322: Type 'string | undefined' is not assignable to type 'number | null'. +!!! error TS2322: Type 'undefined' is not assignable to type 'number | null'. +!!! error TS2322: Type 'T & U' is not assignable to type 'number'. + let y5: number | undefined = x; // Error + ~~ +!!! error TS2322: Type 'T & U' is not assignable to type 'number | undefined'. +!!! error TS2322: Type 'string | undefined' is not assignable to type 'number | undefined'. +!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. +!!! error TS2322: Type 'T & U' is not assignable to type 'number'. + let y6: null | undefined = x; // Error + ~~ +!!! error TS2322: Type 'T & U' is not assignable to type 'null | undefined'. +!!! error TS2322: Type 'string | undefined' is not assignable to type 'null | undefined'. +!!! error TS2322: Type 'string' is not assignable to type 'null | undefined'. +!!! error TS2322: Type 'T & U' is not assignable to type 'null'. + } + + type T1 = (string | number | undefined) & (string | null | undefined); // string | undefined + + function f3(x: T & (number | object | undefined)) { + const y: number | undefined = x; + } + + function f4(x: T & (number | object)) { + const y: number = x; + } + + function f5(x: keyof T & U) { + let y: keyof any = x; + } + + // Repro from #23648 + + type Example = { [K in keyof T]: K extends keyof U ? UnexpectedError : NoErrorHere } + + type UnexpectedError = T + type NoErrorHere = T + \ No newline at end of file diff --git a/tests/baselines/reference/intersectionWithUnionConstraint.js b/tests/baselines/reference/intersectionWithUnionConstraint.js new file mode 100644 index 0000000000000..fc3e50309c6f5 --- /dev/null +++ b/tests/baselines/reference/intersectionWithUnionConstraint.js @@ -0,0 +1,60 @@ +//// [intersectionWithUnionConstraint.ts] +function f1(x: T & U) { + // Combined constraint of 'T & U' is 'string | number' + let y: string | number = x; +} + +function f2(x: T & U) { + let y1: string | number = x; // Error + let y2: string | null = x; // Error + let y3: string | undefined = x; + let y4: number | null = x; // Error + let y5: number | undefined = x; // Error + let y6: null | undefined = x; // Error +} + +type T1 = (string | number | undefined) & (string | null | undefined); // string | undefined + +function f3(x: T & (number | object | undefined)) { + const y: number | undefined = x; +} + +function f4(x: T & (number | object)) { + const y: number = x; +} + +function f5(x: keyof T & U) { + let y: keyof any = x; +} + +// Repro from #23648 + +type Example = { [K in keyof T]: K extends keyof U ? UnexpectedError : NoErrorHere } + +type UnexpectedError = T +type NoErrorHere = T + + +//// [intersectionWithUnionConstraint.js] +"use strict"; +function f1(x) { + // Combined constraint of 'T & U' is 'string | number' + var y = x; +} +function f2(x) { + var y1 = x; // Error + var y2 = x; // Error + var y3 = x; + var y4 = x; // Error + var y5 = x; // Error + var y6 = x; // Error +} +function f3(x) { + var y = x; +} +function f4(x) { + var y = x; +} +function f5(x) { + var y = x; +} diff --git a/tests/baselines/reference/intersectionWithUnionConstraint.symbols b/tests/baselines/reference/intersectionWithUnionConstraint.symbols new file mode 100644 index 0000000000000..0b7d7455977ca --- /dev/null +++ b/tests/baselines/reference/intersectionWithUnionConstraint.symbols @@ -0,0 +1,114 @@ +=== tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts === +function f1(x: T & U) { +>f1 : Symbol(f1, Decl(intersectionWithUnionConstraint.ts, 0, 0)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 0, 12)) +>U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 0, 38)) +>x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 0, 66)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 0, 12)) +>U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 0, 38)) + + // Combined constraint of 'T & U' is 'string | number' + let y: string | number = x; +>y : Symbol(y, Decl(intersectionWithUnionConstraint.ts, 2, 7)) +>x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 0, 66)) +} + +function f2(x: T & U) { +>f2 : Symbol(f2, Decl(intersectionWithUnionConstraint.ts, 3, 1)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 5, 12)) +>U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 5, 50)) +>x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 5, 88)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 5, 12)) +>U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 5, 50)) + + let y1: string | number = x; // Error +>y1 : Symbol(y1, Decl(intersectionWithUnionConstraint.ts, 6, 7)) +>x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 5, 88)) + + let y2: string | null = x; // Error +>y2 : Symbol(y2, Decl(intersectionWithUnionConstraint.ts, 7, 7)) +>x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 5, 88)) + + let y3: string | undefined = x; +>y3 : Symbol(y3, Decl(intersectionWithUnionConstraint.ts, 8, 7)) +>x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 5, 88)) + + let y4: number | null = x; // Error +>y4 : Symbol(y4, Decl(intersectionWithUnionConstraint.ts, 9, 7)) +>x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 5, 88)) + + let y5: number | undefined = x; // Error +>y5 : Symbol(y5, Decl(intersectionWithUnionConstraint.ts, 10, 7)) +>x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 5, 88)) + + let y6: null | undefined = x; // Error +>y6 : Symbol(y6, Decl(intersectionWithUnionConstraint.ts, 11, 7)) +>x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 5, 88)) +} + +type T1 = (string | number | undefined) & (string | null | undefined); // string | undefined +>T1 : Symbol(T1, Decl(intersectionWithUnionConstraint.ts, 12, 1)) + +function f3(x: T & (number | object | undefined)) { +>f3 : Symbol(f3, Decl(intersectionWithUnionConstraint.ts, 14, 70)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 16, 12)) +>x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 16, 51)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 16, 12)) + + const y: number | undefined = x; +>y : Symbol(y, Decl(intersectionWithUnionConstraint.ts, 17, 9)) +>x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 16, 51)) +} + +function f4(x: T & (number | object)) { +>f4 : Symbol(f4, Decl(intersectionWithUnionConstraint.ts, 18, 1)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 20, 12)) +>x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 20, 39)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 20, 12)) + + const y: number = x; +>y : Symbol(y, Decl(intersectionWithUnionConstraint.ts, 21, 9)) +>x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 20, 39)) +} + +function f5(x: keyof T & U) { +>f5 : Symbol(f5, Decl(intersectionWithUnionConstraint.ts, 22, 1)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 24, 12)) +>U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 24, 14)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 24, 12)) +>x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 24, 34)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 24, 12)) +>U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 24, 14)) + + let y: keyof any = x; +>y : Symbol(y, Decl(intersectionWithUnionConstraint.ts, 25, 7)) +>x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 24, 34)) +} + +// Repro from #23648 + +type Example = { [K in keyof T]: K extends keyof U ? UnexpectedError : NoErrorHere } +>Example : Symbol(Example, Decl(intersectionWithUnionConstraint.ts, 26, 1)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 30, 13)) +>U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 30, 15)) +>K : Symbol(K, Decl(intersectionWithUnionConstraint.ts, 30, 24)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 30, 13)) +>K : Symbol(K, Decl(intersectionWithUnionConstraint.ts, 30, 24)) +>U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 30, 15)) +>UnexpectedError : Symbol(UnexpectedError, Decl(intersectionWithUnionConstraint.ts, 30, 96)) +>K : Symbol(K, Decl(intersectionWithUnionConstraint.ts, 30, 24)) +>NoErrorHere : Symbol(NoErrorHere, Decl(intersectionWithUnionConstraint.ts, 32, 47)) +>K : Symbol(K, Decl(intersectionWithUnionConstraint.ts, 30, 24)) + +type UnexpectedError = T +>UnexpectedError : Symbol(UnexpectedError, Decl(intersectionWithUnionConstraint.ts, 30, 96)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 32, 21)) +>PropertyKey : Symbol(PropertyKey, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 32, 21)) + +type NoErrorHere = T +>NoErrorHere : Symbol(NoErrorHere, Decl(intersectionWithUnionConstraint.ts, 32, 47)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 33, 17)) +>PropertyKey : Symbol(PropertyKey, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 33, 17)) + diff --git a/tests/baselines/reference/intersectionWithUnionConstraint.types b/tests/baselines/reference/intersectionWithUnionConstraint.types new file mode 100644 index 0000000000000..bef278feba1f2 --- /dev/null +++ b/tests/baselines/reference/intersectionWithUnionConstraint.types @@ -0,0 +1,119 @@ +=== tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts === +function f1(x: T & U) { +>f1 : (x: T & U) => void +>T : T +>U : U +>x : T & U +>T : T +>U : U + + // Combined constraint of 'T & U' is 'string | number' + let y: string | number = x; +>y : string | number +>x : T & U +} + +function f2(x: T & U) { +>f2 : (x: T & U) => void +>T : T +>U : U +>null : null +>x : T & U +>T : T +>U : U + + let y1: string | number = x; // Error +>y1 : string | number +>x : T & U + + let y2: string | null = x; // Error +>y2 : string | null +>null : null +>x : T & U + + let y3: string | undefined = x; +>y3 : string | undefined +>x : T & U + + let y4: number | null = x; // Error +>y4 : number | null +>null : null +>x : T & U + + let y5: number | undefined = x; // Error +>y5 : number | undefined +>x : T & U + + let y6: null | undefined = x; // Error +>y6 : null | undefined +>null : null +>x : T & U +} + +type T1 = (string | number | undefined) & (string | null | undefined); // string | undefined +>T1 : string | undefined +>null : null + +function f3(x: T & (number | object | undefined)) { +>f3 : (x: (T & undefined) | (T & number) | (T & object)) => void +>T : T +>x : (T & undefined) | (T & number) | (T & object) +>T : T + + const y: number | undefined = x; +>y : number | undefined +>x : (T & undefined) | (T & number) | (T & object) +} + +function f4(x: T & (number | object)) { +>f4 : (x: (T & number) | (T & object)) => void +>T : T +>x : (T & number) | (T & object) +>T : T + + const y: number = x; +>y : number +>x : (T & number) | (T & object) +} + +function f5(x: keyof T & U) { +>f5 : (x: keyof T & U) => void +>T : T +>U : U +>T : T +>x : keyof T & U +>T : T +>U : U + + let y: keyof any = x; +>y : string | number | symbol +>x : keyof T & U +} + +// Repro from #23648 + +type Example = { [K in keyof T]: K extends keyof U ? UnexpectedError : NoErrorHere } +>Example : Example +>T : T +>U : U +>K : K +>T : T +>K : K +>U : U +>UnexpectedError : T +>K : K +>NoErrorHere : T +>K : K + +type UnexpectedError = T +>UnexpectedError : T +>T : T +>PropertyKey : string | number | symbol +>T : T + +type NoErrorHere = T +>NoErrorHere : T +>T : T +>PropertyKey : string | number | symbol +>T : T + diff --git a/tests/baselines/reference/jsdocReferenceGlobalTypeInCommonJs.errors.txt b/tests/baselines/reference/jsdocReferenceGlobalTypeInCommonJs.errors.txt index 408ea126188fb..7a78efb724e55 100644 --- a/tests/baselines/reference/jsdocReferenceGlobalTypeInCommonJs.errors.txt +++ b/tests/baselines/reference/jsdocReferenceGlobalTypeInCommonJs.errors.txt @@ -1,11 +1,8 @@ -tests/cases/compiler/a.js(1,15): error TS2304: Cannot find name 'require'. tests/cases/compiler/a.js(4,1): error TS2686: 'Puppeteer' refers to a UMD global, but the current file is a module. Consider adding an import instead. -==== tests/cases/compiler/a.js (2 errors) ==== +==== tests/cases/compiler/a.js (1 errors) ==== const other = require('./other'); - ~~~~~~~ -!!! error TS2304: Cannot find name 'require'. /** @type {Puppeteer.Keyboard} */ var ppk; Puppeteer.connect; diff --git a/tests/baselines/reference/jsdocReferenceGlobalTypeInCommonJs.symbols b/tests/baselines/reference/jsdocReferenceGlobalTypeInCommonJs.symbols index a3a3ed721368f..5980105ddef89 100644 --- a/tests/baselines/reference/jsdocReferenceGlobalTypeInCommonJs.symbols +++ b/tests/baselines/reference/jsdocReferenceGlobalTypeInCommonJs.symbols @@ -1,6 +1,7 @@ === tests/cases/compiler/a.js === const other = require('./other'); >other : Symbol(other, Decl(a.js, 0, 5)) +>require : Symbol(require) >'./other' : Symbol("tests/cases/compiler/other", Decl(other.d.ts, 0, 0)) /** @type {Puppeteer.Keyboard} */ diff --git a/tests/baselines/reference/jsdocTypeFromChainedAssignment2.errors.txt b/tests/baselines/reference/jsdocTypeFromChainedAssignment2.errors.txt index 454039d3693e7..bac759ea1838f 100644 --- a/tests/baselines/reference/jsdocTypeFromChainedAssignment2.errors.txt +++ b/tests/baselines/reference/jsdocTypeFromChainedAssignment2.errors.txt @@ -1,11 +1,10 @@ -tests/cases/conformance/jsdoc/use.js(3,7): error TS2345: Argument of type '"no"' is not assignable to parameter of type 'number'. -tests/cases/conformance/jsdoc/use.js(4,7): error TS2345: Argument of type '"also no"' is not assignable to parameter of type 'number'. -tests/cases/conformance/jsdoc/use.js(5,7): error TS2345: Argument of type '0' is not assignable to parameter of type 'string'. -tests/cases/conformance/jsdoc/use.js(6,7): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/conformance/jsdoc/use.js(2,7): error TS2345: Argument of type '"no"' is not assignable to parameter of type 'number'. +tests/cases/conformance/jsdoc/use.js(3,7): error TS2345: Argument of type '"also no"' is not assignable to parameter of type 'number'. +tests/cases/conformance/jsdoc/use.js(4,7): error TS2345: Argument of type '0' is not assignable to parameter of type 'string'. +tests/cases/conformance/jsdoc/use.js(5,7): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. ==== tests/cases/conformance/jsdoc/use.js (4 errors) ==== - /// var mod = require('./mod'); mod.f('no') ~~~~ @@ -20,13 +19,7 @@ tests/cases/conformance/jsdoc/use.js(6,7): error TS2345: Argument of type '1' is ~ !!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. -==== tests/cases/conformance/jsdoc/types.d.ts (0 errors) ==== - declare function require(name: string): any; - declare var exports: any; - declare var module: { exports: any }; ==== tests/cases/conformance/jsdoc/mod.js (0 errors) ==== - /// - /** @param {number} n */ exports.f = exports.g = function fg(n) { return n + 1 diff --git a/tests/baselines/reference/jsdocTypeFromChainedAssignment2.symbols b/tests/baselines/reference/jsdocTypeFromChainedAssignment2.symbols index d7a3b91588e1c..b85eafa6925e3 100644 --- a/tests/baselines/reference/jsdocTypeFromChainedAssignment2.symbols +++ b/tests/baselines/reference/jsdocTypeFromChainedAssignment2.symbols @@ -1,73 +1,56 @@ === tests/cases/conformance/jsdoc/use.js === -/// var mod = require('./mod'); ->mod : Symbol(mod, Decl(use.js, 1, 3)) ->require : Symbol(require, Decl(types.d.ts, 0, 0)) +>mod : Symbol(mod, Decl(use.js, 0, 3)) +>require : Symbol(require) >'./mod' : Symbol("tests/cases/conformance/jsdoc/mod", Decl(mod.js, 0, 0)) mod.f('no') >mod.f : Symbol(f, Decl(mod.js, 0, 0)) ->mod : Symbol(mod, Decl(use.js, 1, 3)) +>mod : Symbol(mod, Decl(use.js, 0, 3)) >f : Symbol(f, Decl(mod.js, 0, 0)) mod.g('also no') ->mod.g : Symbol(g, Decl(mod.js, 3, 11)) ->mod : Symbol(mod, Decl(use.js, 1, 3)) ->g : Symbol(g, Decl(mod.js, 3, 11)) +>mod.g : Symbol(g, Decl(mod.js, 1, 11)) +>mod : Symbol(mod, Decl(use.js, 0, 3)) +>g : Symbol(g, Decl(mod.js, 1, 11)) mod.h(0) ->mod.h : Symbol(h, Decl(mod.js, 5, 1)) ->mod : Symbol(mod, Decl(use.js, 1, 3)) ->h : Symbol(h, Decl(mod.js, 5, 1)) +>mod.h : Symbol(h, Decl(mod.js, 3, 1)) +>mod : Symbol(mod, Decl(use.js, 0, 3)) +>h : Symbol(h, Decl(mod.js, 3, 1)) mod.i(1) ->mod.i : Symbol(i, Decl(mod.js, 7, 18)) ->mod : Symbol(mod, Decl(use.js, 1, 3)) ->i : Symbol(i, Decl(mod.js, 7, 18)) - -=== tests/cases/conformance/jsdoc/types.d.ts === -declare function require(name: string): any; ->require : Symbol(require, Decl(types.d.ts, 0, 0)) ->name : Symbol(name, Decl(types.d.ts, 0, 25)) - -declare var exports: any; ->exports : Symbol(exports, Decl(types.d.ts, 1, 11)) - -declare var module: { exports: any }; ->module : Symbol(module, Decl(types.d.ts, 2, 11)) ->exports : Symbol(exports, Decl(types.d.ts, 2, 21)) +>mod.i : Symbol(i, Decl(mod.js, 5, 18)) +>mod : Symbol(mod, Decl(use.js, 0, 3)) +>i : Symbol(i, Decl(mod.js, 5, 18)) === tests/cases/conformance/jsdoc/mod.js === -/// - /** @param {number} n */ exports.f = exports.g = function fg(n) { >exports.f : Symbol(f, Decl(mod.js, 0, 0)) >exports : Symbol(f, Decl(mod.js, 0, 0)) >f : Symbol(f, Decl(mod.js, 0, 0)) ->exports.g : Symbol(g, Decl(mod.js, 3, 11)) ->exports : Symbol(g, Decl(mod.js, 3, 11)) ->g : Symbol(g, Decl(mod.js, 3, 11)) ->fg : Symbol(fg, Decl(mod.js, 3, 23)) ->n : Symbol(n, Decl(mod.js, 3, 36)) +>exports.g : Symbol(g, Decl(mod.js, 1, 11)) +>exports : Symbol(g, Decl(mod.js, 1, 11)) +>g : Symbol(g, Decl(mod.js, 1, 11)) +>fg : Symbol(fg, Decl(mod.js, 1, 23)) +>n : Symbol(n, Decl(mod.js, 1, 36)) return n + 1 ->n : Symbol(n, Decl(mod.js, 3, 36)) +>n : Symbol(n, Decl(mod.js, 1, 36)) } /** @param {string} mom */ module.exports.h = module.exports.i = function hi(mom) { ->module.exports : Symbol(h, Decl(mod.js, 5, 1)) ->module : Symbol(module, Decl(types.d.ts, 2, 11)) ->exports : Symbol(exports, Decl(types.d.ts, 2, 21)) ->h : Symbol(h, Decl(mod.js, 5, 1)) ->module.exports : Symbol(i, Decl(mod.js, 7, 18)) ->module : Symbol(module, Decl(types.d.ts, 2, 11)) ->exports : Symbol(exports, Decl(types.d.ts, 2, 21)) ->i : Symbol(i, Decl(mod.js, 7, 18)) ->hi : Symbol(hi, Decl(mod.js, 7, 37)) ->mom : Symbol(mom, Decl(mod.js, 7, 50)) +>module.exports : Symbol(h, Decl(mod.js, 3, 1)) +>module : Symbol(module) +>h : Symbol(h, Decl(mod.js, 3, 1)) +>module.exports : Symbol(i, Decl(mod.js, 5, 18)) +>module : Symbol(module) +>i : Symbol(i, Decl(mod.js, 5, 18)) +>hi : Symbol(hi, Decl(mod.js, 5, 37)) +>mom : Symbol(mom, Decl(mod.js, 5, 50)) return `hi, ${mom}!`; ->mom : Symbol(mom, Decl(mod.js, 7, 50)) +>mom : Symbol(mom, Decl(mod.js, 5, 50)) } diff --git a/tests/baselines/reference/jsdocTypeFromChainedAssignment2.types b/tests/baselines/reference/jsdocTypeFromChainedAssignment2.types index ac264107bfa01..de2a38cce7981 100644 --- a/tests/baselines/reference/jsdocTypeFromChainedAssignment2.types +++ b/tests/baselines/reference/jsdocTypeFromChainedAssignment2.types @@ -1,9 +1,8 @@ === tests/cases/conformance/jsdoc/use.js === -/// var mod = require('./mod'); >mod : typeof import("tests/cases/conformance/jsdoc/mod") >require('./mod') : typeof import("tests/cases/conformance/jsdoc/mod") ->require : (name: string) => any +>require : any >'./mod' : "./mod" mod.f('no') @@ -34,21 +33,7 @@ mod.i(1) >i : (mom: string) => string >1 : 1 -=== tests/cases/conformance/jsdoc/types.d.ts === -declare function require(name: string): any; ->require : (name: string) => any ->name : string - -declare var exports: any; ->exports : any - -declare var module: { exports: any }; ->module : { exports: any; } ->exports : any - === tests/cases/conformance/jsdoc/mod.js === -/// - /** @param {number} n */ exports.f = exports.g = function fg(n) { >exports.f = exports.g = function fg(n) { return n + 1} : (n: number) => number @@ -73,13 +58,13 @@ module.exports.h = module.exports.i = function hi(mom) { >module.exports.h = module.exports.i = function hi(mom) { return `hi, ${mom}!`;} : (mom: string) => string >module.exports.h : any >module.exports : any ->module : { exports: any; } +>module : any >exports : any >h : any >module.exports.i = function hi(mom) { return `hi, ${mom}!`;} : (mom: string) => string >module.exports.i : any >module.exports : any ->module : { exports: any; } +>module : any >exports : any >i : any >function hi(mom) { return `hi, ${mom}!`;} : (mom: string) => string diff --git a/tests/baselines/reference/jsdocTypedefNoCrash.symbols b/tests/baselines/reference/jsdocTypedefNoCrash.symbols index 8724c9da8d171..51f5fdcc259fc 100644 --- a/tests/baselines/reference/jsdocTypedefNoCrash.symbols +++ b/tests/baselines/reference/jsdocTypedefNoCrash.symbols @@ -4,5 +4,5 @@ * }} */ export const foo = 5; ->foo : Symbol(foo, Decl(export.js, 4, 12)) +>foo : Symbol(foo, Decl(export.js, 4, 12), Decl(export.js, 1, 3)) diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index f0af336563cb1..3d222583ffd4b 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -319,6 +319,20 @@ function f90(x1: S2[keyof S2], x2: T[keyof S2] x4.length; } +function f91(x: T, y: T[keyof T], z: T[K]) { + let a: {}; + a = x; + a = y; + a = z; +} + +function f92(x: T, y: T[keyof T], z: T[K]) { + let a: {} | null | undefined; + a = x; + a = y; + a = z; +} + // Repros from #12011 class Base { @@ -566,6 +580,15 @@ type Predicates = { [T in keyof TaggedRecord]: (variant: TaggedRecord[keyof TaggedRecord]) => variant is TaggedRecord[T] } +// Repros from #23592 + +type Example = { [K in keyof T]: T[K]["prop"] }; +type Result = Example<{ a: { prop: string }; b: { prop: number } }>; + +type Helper2 = { [K in keyof T]: Extract }; +type Example2 = { [K in keyof Helper2]: Helper2[K]["prop"] }; +type Result2 = Example2<{ 1: { prop: string }; 2: { prop: number } }>; + // Repro from #23618 type DBBoolTable = { [k in K]: 0 | 1 } @@ -583,6 +606,27 @@ type DynamicDBRecord = ({ dynamicField: number } | { dynami function getFlagsFromDynamicRecord(record: DynamicDBRecord, flags: Flag[]) { return record[flags[0]]; } + +// Repro from #21368 + +interface I { + foo: string; +} + +declare function take(p: T): void; + +function fn(o: T, k: K) { + take<{} | null | undefined>(o[k]); + take(o[k]); +} + +// Repro from #23133 + +class Unbounded { + foo(x: T[keyof T]) { + let y: {} | undefined | null = x; + } +} //// [keyofAndIndexedAccess.js] @@ -821,6 +865,18 @@ function f90(x1, x2, x3, x4) { x3.length; x4.length; } +function f91(x, y, z) { + var a; + a = x; + a = y; + a = z; +} +function f92(x, y, z) { + var a; + a = x; + a = y; + a = z; +} // Repros from #12011 var Base = /** @class */ (function () { function Base() { @@ -977,6 +1033,19 @@ function getFlagsFromSimpleRecord(record, flags) { function getFlagsFromDynamicRecord(record, flags) { return record[flags[0]]; } +function fn(o, k) { + take(o[k]); + take(o[k]); +} +// Repro from #23133 +var Unbounded = /** @class */ (function () { + function Unbounded() { + } + Unbounded.prototype.foo = function (x) { + var y = x; + }; + return Unbounded; +}()); //// [keyofAndIndexedAccess.d.ts] @@ -1117,6 +1186,8 @@ declare type S2 = { b: string; }; declare function f90(x1: S2[keyof S2], x2: T[keyof S2], x3: S2[K], x4: T[K]): void; +declare function f91(x: T, y: T[keyof T], z: T[K]): void; +declare function f92(x: T, y: T[keyof T], z: T[K]): void; declare class Base { get(prop: K): this[K]; set(prop: K, value: this[K]): void; @@ -1241,6 +1312,37 @@ declare function f3>(t: T, k: K, tk: T[K]) declare type Predicates = { [T in keyof TaggedRecord]: (variant: TaggedRecord[keyof TaggedRecord]) => variant is TaggedRecord[T]; }; +declare type Example = { + [K in keyof T]: T[K]["prop"]; +}; +declare type Result = Example<{ + a: { + prop: string; + }; + b: { + prop: number; + }; +}>; +declare type Helper2 = { + [K in keyof T]: Extract; +}; +declare type Example2 = { + [K in keyof Helper2]: Helper2[K]["prop"]; +}; +declare type Result2 = Example2<{ + 1: { + prop: string; + }; + 2: { + prop: number; + }; +}>; declare type DBBoolTable = { [k in K]: 0 | 1; }; @@ -1258,3 +1360,11 @@ declare type DynamicDBRecord = ({ dynamicField: string; }) & DBBoolTable; declare function getFlagsFromDynamicRecord(record: DynamicDBRecord, flags: Flag[]): DynamicDBRecord[Flag]; +interface I { + foo: string; +} +declare function take(p: T): void; +declare function fn(o: T, k: K): void; +declare class Unbounded { + foo(x: T[keyof T]): void; +} diff --git a/tests/baselines/reference/keyofAndIndexedAccess.symbols b/tests/baselines/reference/keyofAndIndexedAccess.symbols index 27c7128e42dc8..a40a2347d91a8 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess.symbols @@ -1239,835 +1239,999 @@ function f90(x1: S2[keyof S2], x2: T[keyof S2] >length : Symbol(String.length, Decl(lib.d.ts, --, --)) } +function f91(x: T, y: T[keyof T], z: T[K]) { +>f91 : Symbol(f91, Decl(keyofAndIndexedAccess.ts, 318, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 320, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 320, 15)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 320, 13)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 320, 35)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 320, 13)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 320, 40)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 320, 13)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 320, 13)) +>z : Symbol(z, Decl(keyofAndIndexedAccess.ts, 320, 55)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 320, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 320, 15)) + + let a: {}; +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 321, 7)) + + a = x; +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 321, 7)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 320, 35)) + + a = y; +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 321, 7)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 320, 40)) + + a = z; +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 321, 7)) +>z : Symbol(z, Decl(keyofAndIndexedAccess.ts, 320, 55)) +} + +function f92(x: T, y: T[keyof T], z: T[K]) { +>f92 : Symbol(f92, Decl(keyofAndIndexedAccess.ts, 325, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 327, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 327, 15)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 327, 13)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 327, 35)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 327, 13)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 327, 40)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 327, 13)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 327, 13)) +>z : Symbol(z, Decl(keyofAndIndexedAccess.ts, 327, 55)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 327, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 327, 15)) + + let a: {} | null | undefined; +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 328, 7)) + + a = x; +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 328, 7)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 327, 35)) + + a = y; +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 328, 7)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 327, 40)) + + a = z; +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 328, 7)) +>z : Symbol(z, Decl(keyofAndIndexedAccess.ts, 327, 55)) +} + // Repros from #12011 class Base { ->Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 318, 1)) +>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 332, 1)) get(prop: K) { ->get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 322, 12)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 323, 8)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 323, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 323, 8)) +>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 336, 12)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 337, 8)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 337, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 337, 8)) return this[prop]; ->this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 318, 1)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 323, 30)) +>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 332, 1)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 337, 30)) } set(prop: K, value: this[K]) { ->set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 325, 5)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 326, 8)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 326, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 326, 8)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 326, 38)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 326, 8)) +>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 339, 5)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 340, 8)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 340, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 340, 8)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 340, 38)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 340, 8)) this[prop] = value; ->this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 318, 1)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 326, 30)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 326, 38)) +>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 332, 1)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 340, 30)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 340, 38)) } } class Person extends Base { ->Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 329, 1)) ->Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 318, 1)) +>Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 343, 1)) +>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 332, 1)) parts: number; ->parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 331, 27)) +>parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 345, 27)) constructor(parts: number) { ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 333, 16)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 347, 16)) super(); ->super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 318, 1)) +>super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 332, 1)) this.set("parts", parts); ->this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 325, 5)) ->this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 329, 1)) ->set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 325, 5)) ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 333, 16)) +>this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 339, 5)) +>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 343, 1)) +>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 339, 5)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 347, 16)) } getParts() { ->getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 336, 5)) +>getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 350, 5)) return this.get("parts") ->this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 322, 12)) ->this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 329, 1)) ->get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 322, 12)) +>this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 336, 12)) +>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 343, 1)) +>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 336, 12)) } } class OtherPerson { ->OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 340, 1)) +>OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 354, 1)) parts: number; ->parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 342, 19)) +>parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 356, 19)) constructor(parts: number) { ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 344, 16)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 358, 16)) setProperty(this, "parts", parts); >setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 80, 1)) ->this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 340, 1)) ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 344, 16)) +>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 354, 1)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 358, 16)) } getParts() { ->getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 346, 5)) +>getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 360, 5)) return getProperty(this, "parts") >getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 76, 26)) ->this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 340, 1)) +>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 354, 1)) } } // Modified repro from #12544 function path(obj: T, key1: K1): T[K1]; ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 350, 1), Decl(keyofAndIndexedAccess.ts, 354, 62), Decl(keyofAndIndexedAccess.ts, 355, 100), Decl(keyofAndIndexedAccess.ts, 356, 142), Decl(keyofAndIndexedAccess.ts, 357, 59)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 354, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 354, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 354, 14)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 354, 37)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 354, 14)) ->key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 354, 44)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 354, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 354, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 354, 16)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 364, 1), Decl(keyofAndIndexedAccess.ts, 368, 62), Decl(keyofAndIndexedAccess.ts, 369, 100), Decl(keyofAndIndexedAccess.ts, 370, 142), Decl(keyofAndIndexedAccess.ts, 371, 59)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 368, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 368, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 368, 14)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 368, 37)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 368, 14)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 368, 44)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 368, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 368, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 368, 16)) function path(obj: T, key1: K1, key2: K2): T[K1][K2]; ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 350, 1), Decl(keyofAndIndexedAccess.ts, 354, 62), Decl(keyofAndIndexedAccess.ts, 355, 100), Decl(keyofAndIndexedAccess.ts, 356, 142), Decl(keyofAndIndexedAccess.ts, 357, 59)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 355, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 355, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 355, 14)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 355, 36)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 355, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 355, 16)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 355, 61)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 355, 14)) ->key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 355, 68)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 355, 16)) ->key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 355, 78)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 355, 36)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 355, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 355, 16)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 355, 36)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 364, 1), Decl(keyofAndIndexedAccess.ts, 368, 62), Decl(keyofAndIndexedAccess.ts, 369, 100), Decl(keyofAndIndexedAccess.ts, 370, 142), Decl(keyofAndIndexedAccess.ts, 371, 59)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 369, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 369, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 369, 14)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 369, 36)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 369, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 369, 16)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 369, 61)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 369, 14)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 369, 68)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 369, 16)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 369, 78)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 369, 36)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 369, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 369, 16)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 369, 36)) function path(obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 350, 1), Decl(keyofAndIndexedAccess.ts, 354, 62), Decl(keyofAndIndexedAccess.ts, 355, 100), Decl(keyofAndIndexedAccess.ts, 356, 142), Decl(keyofAndIndexedAccess.ts, 357, 59)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 356, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 356, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 356, 14)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 356, 36)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 356, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 356, 16)) ->K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 356, 60)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 356, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 356, 16)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 356, 36)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 356, 89)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 356, 14)) ->key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 356, 96)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 356, 16)) ->key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 356, 106)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 356, 36)) ->key3 : Symbol(key3, Decl(keyofAndIndexedAccess.ts, 356, 116)) ->K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 356, 60)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 356, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 356, 16)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 356, 36)) ->K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 356, 60)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 364, 1), Decl(keyofAndIndexedAccess.ts, 368, 62), Decl(keyofAndIndexedAccess.ts, 369, 100), Decl(keyofAndIndexedAccess.ts, 370, 142), Decl(keyofAndIndexedAccess.ts, 371, 59)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 370, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 370, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 370, 14)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 370, 36)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 370, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 370, 16)) +>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 370, 60)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 370, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 370, 16)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 370, 36)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 370, 89)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 370, 14)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 370, 96)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 370, 16)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 370, 106)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 370, 36)) +>key3 : Symbol(key3, Decl(keyofAndIndexedAccess.ts, 370, 116)) +>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 370, 60)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 370, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 370, 16)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 370, 36)) +>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 370, 60)) function path(obj: any, ...keys: (string | number)[]): any; ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 350, 1), Decl(keyofAndIndexedAccess.ts, 354, 62), Decl(keyofAndIndexedAccess.ts, 355, 100), Decl(keyofAndIndexedAccess.ts, 356, 142), Decl(keyofAndIndexedAccess.ts, 357, 59)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 357, 14)) ->keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 357, 23)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 364, 1), Decl(keyofAndIndexedAccess.ts, 368, 62), Decl(keyofAndIndexedAccess.ts, 369, 100), Decl(keyofAndIndexedAccess.ts, 370, 142), Decl(keyofAndIndexedAccess.ts, 371, 59)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 371, 14)) +>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 371, 23)) function path(obj: any, ...keys: (string | number)[]): any { ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 350, 1), Decl(keyofAndIndexedAccess.ts, 354, 62), Decl(keyofAndIndexedAccess.ts, 355, 100), Decl(keyofAndIndexedAccess.ts, 356, 142), Decl(keyofAndIndexedAccess.ts, 357, 59)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 358, 14)) ->keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 358, 23)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 364, 1), Decl(keyofAndIndexedAccess.ts, 368, 62), Decl(keyofAndIndexedAccess.ts, 369, 100), Decl(keyofAndIndexedAccess.ts, 370, 142), Decl(keyofAndIndexedAccess.ts, 371, 59)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 372, 14)) +>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 372, 23)) let result = obj; ->result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 359, 7)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 358, 14)) +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 373, 7)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 372, 14)) for (let k of keys) { ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 360, 12)) ->keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 358, 23)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 374, 12)) +>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 372, 23)) result = result[k]; ->result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 359, 7)) ->result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 359, 7)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 360, 12)) +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 373, 7)) +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 373, 7)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 374, 12)) } return result; ->result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 359, 7)) +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 373, 7)) } type Thing = { ->Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 364, 1)) +>Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 378, 1)) a: { x: number, y: string }, ->a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 366, 14)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 367, 8)) ->y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 367, 19)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 380, 14)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 381, 8)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 381, 19)) b: boolean ->b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 367, 32)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 381, 32)) }; function f1(thing: Thing) { ->f1 : Symbol(f1, Decl(keyofAndIndexedAccess.ts, 369, 2)) ->thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 372, 12)) ->Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 364, 1)) +>f1 : Symbol(f1, Decl(keyofAndIndexedAccess.ts, 383, 2)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 386, 12)) +>Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 378, 1)) let x1 = path(thing, 'a'); // { x: number, y: string } ->x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 373, 7)) ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 350, 1), Decl(keyofAndIndexedAccess.ts, 354, 62), Decl(keyofAndIndexedAccess.ts, 355, 100), Decl(keyofAndIndexedAccess.ts, 356, 142), Decl(keyofAndIndexedAccess.ts, 357, 59)) ->thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 372, 12)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 387, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 364, 1), Decl(keyofAndIndexedAccess.ts, 368, 62), Decl(keyofAndIndexedAccess.ts, 369, 100), Decl(keyofAndIndexedAccess.ts, 370, 142), Decl(keyofAndIndexedAccess.ts, 371, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 386, 12)) let x2 = path(thing, 'a', 'y'); // string ->x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 374, 7)) ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 350, 1), Decl(keyofAndIndexedAccess.ts, 354, 62), Decl(keyofAndIndexedAccess.ts, 355, 100), Decl(keyofAndIndexedAccess.ts, 356, 142), Decl(keyofAndIndexedAccess.ts, 357, 59)) ->thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 372, 12)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 388, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 364, 1), Decl(keyofAndIndexedAccess.ts, 368, 62), Decl(keyofAndIndexedAccess.ts, 369, 100), Decl(keyofAndIndexedAccess.ts, 370, 142), Decl(keyofAndIndexedAccess.ts, 371, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 386, 12)) let x3 = path(thing, 'b'); // boolean ->x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 375, 7)) ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 350, 1), Decl(keyofAndIndexedAccess.ts, 354, 62), Decl(keyofAndIndexedAccess.ts, 355, 100), Decl(keyofAndIndexedAccess.ts, 356, 142), Decl(keyofAndIndexedAccess.ts, 357, 59)) ->thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 372, 12)) +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 389, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 364, 1), Decl(keyofAndIndexedAccess.ts, 368, 62), Decl(keyofAndIndexedAccess.ts, 369, 100), Decl(keyofAndIndexedAccess.ts, 370, 142), Decl(keyofAndIndexedAccess.ts, 371, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 386, 12)) let x4 = path(thing, ...['a', 'x']); // any ->x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 376, 7)) ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 350, 1), Decl(keyofAndIndexedAccess.ts, 354, 62), Decl(keyofAndIndexedAccess.ts, 355, 100), Decl(keyofAndIndexedAccess.ts, 356, 142), Decl(keyofAndIndexedAccess.ts, 357, 59)) ->thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 372, 12)) +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 390, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 364, 1), Decl(keyofAndIndexedAccess.ts, 368, 62), Decl(keyofAndIndexedAccess.ts, 369, 100), Decl(keyofAndIndexedAccess.ts, 370, 142), Decl(keyofAndIndexedAccess.ts, 371, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 386, 12)) } // Repro from comment in #12114 const assignTo2 = (object: T, key1: K1, key2: K2) => ->assignTo2 : Symbol(assignTo2, Decl(keyofAndIndexedAccess.ts, 381, 5)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 381, 19)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 381, 21)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 381, 19)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 381, 41)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 381, 19)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 381, 21)) ->object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 381, 66)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 381, 19)) ->key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 381, 76)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 381, 21)) ->key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 381, 86)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 381, 41)) +>assignTo2 : Symbol(assignTo2, Decl(keyofAndIndexedAccess.ts, 395, 5)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 395, 19)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 395, 21)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 395, 19)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 395, 41)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 395, 19)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 395, 21)) +>object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 395, 66)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 395, 19)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 395, 76)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 395, 21)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 395, 86)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 395, 41)) (value: T[K1][K2]) => object[key1][key2] = value; ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 382, 5)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 381, 19)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 381, 21)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 381, 41)) ->object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 381, 66)) ->key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 381, 76)) ->key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 381, 86)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 382, 5)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 396, 5)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 395, 19)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 395, 21)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 395, 41)) +>object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 395, 66)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 395, 76)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 395, 86)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 396, 5)) // Modified repro from #12573 declare function one(handler: (t: T) => void): T ->one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 382, 53)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 386, 21)) ->handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 386, 24)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 386, 34)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 386, 21)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 386, 21)) +>one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 396, 53)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 400, 21)) +>handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 400, 24)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 400, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 400, 21)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 400, 21)) var empty = one(() => {}) // inferred as {}, expected ->empty : Symbol(empty, Decl(keyofAndIndexedAccess.ts, 387, 3)) ->one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 382, 53)) +>empty : Symbol(empty, Decl(keyofAndIndexedAccess.ts, 401, 3)) +>one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 396, 53)) type Handlers = { [K in keyof T]: (t: T[K]) => void } ->Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 387, 25)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 389, 14)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 389, 22)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 389, 14)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 389, 38)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 389, 14)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 389, 22)) +>Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 401, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 403, 14)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 403, 22)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 403, 14)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 403, 38)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 403, 14)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 403, 22)) declare function on(handlerHash: Handlers): T ->on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 389, 56)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 390, 20)) ->handlerHash : Symbol(handlerHash, Decl(keyofAndIndexedAccess.ts, 390, 23)) ->Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 387, 25)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 390, 20)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 390, 20)) +>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 403, 56)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 404, 20)) +>handlerHash : Symbol(handlerHash, Decl(keyofAndIndexedAccess.ts, 404, 23)) +>Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 401, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 404, 20)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 404, 20)) var hashOfEmpty1 = on({ test: () => {} }); // {} ->hashOfEmpty1 : Symbol(hashOfEmpty1, Decl(keyofAndIndexedAccess.ts, 391, 3)) ->on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 389, 56)) ->test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 391, 23)) +>hashOfEmpty1 : Symbol(hashOfEmpty1, Decl(keyofAndIndexedAccess.ts, 405, 3)) +>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 403, 56)) +>test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 405, 23)) var hashOfEmpty2 = on({ test: (x: boolean) => {} }); // { test: boolean } ->hashOfEmpty2 : Symbol(hashOfEmpty2, Decl(keyofAndIndexedAccess.ts, 392, 3)) ->on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 389, 56)) ->test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 392, 23)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 392, 31)) +>hashOfEmpty2 : Symbol(hashOfEmpty2, Decl(keyofAndIndexedAccess.ts, 406, 3)) +>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 403, 56)) +>test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 406, 23)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 406, 31)) // Repro from #12624 interface Options1 { ->Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 392, 52)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 396, 19)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 396, 24)) +>Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 406, 52)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 410, 19)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 410, 24)) data?: Data ->data : Symbol(Options1.data, Decl(keyofAndIndexedAccess.ts, 396, 36)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 396, 19)) +>data : Symbol(Options1.data, Decl(keyofAndIndexedAccess.ts, 410, 36)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 410, 19)) computed?: Computed; ->computed : Symbol(Options1.computed, Decl(keyofAndIndexedAccess.ts, 397, 15)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 396, 24)) +>computed : Symbol(Options1.computed, Decl(keyofAndIndexedAccess.ts, 411, 15)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 410, 24)) } declare class Component1 { ->Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 399, 1)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 401, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 401, 30)) +>Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 413, 1)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 415, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 415, 30)) constructor(options: Options1); ->options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 402, 16)) ->Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 392, 52)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 401, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 401, 30)) +>options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 416, 16)) +>Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 406, 52)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 415, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 415, 30)) get(key: K): (Data & Computed)[K]; ->get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 402, 51)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 403, 8)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 401, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 401, 30)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 403, 43)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 403, 8)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 401, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 401, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 403, 8)) +>get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 416, 51)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 417, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 415, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 415, 30)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 417, 43)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 417, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 415, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 415, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 417, 8)) } let c1 = new Component1({ ->c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 406, 3)) ->Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 399, 1)) +>c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 420, 3)) +>Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 413, 1)) data: { ->data : Symbol(data, Decl(keyofAndIndexedAccess.ts, 406, 25)) +>data : Symbol(data, Decl(keyofAndIndexedAccess.ts, 420, 25)) hello: "" ->hello : Symbol(hello, Decl(keyofAndIndexedAccess.ts, 407, 11)) +>hello : Symbol(hello, Decl(keyofAndIndexedAccess.ts, 421, 11)) } }); c1.get("hello"); ->c1.get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 402, 51)) ->c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 406, 3)) ->get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 402, 51)) +>c1.get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 416, 51)) +>c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 420, 3)) +>get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 416, 51)) // Repro from #12625 interface Options2 { ->Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 412, 16)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 416, 19)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 416, 24)) +>Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 426, 16)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 430, 19)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 430, 24)) data?: Data ->data : Symbol(Options2.data, Decl(keyofAndIndexedAccess.ts, 416, 36)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 416, 19)) +>data : Symbol(Options2.data, Decl(keyofAndIndexedAccess.ts, 430, 36)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 430, 19)) computed?: Computed; ->computed : Symbol(Options2.computed, Decl(keyofAndIndexedAccess.ts, 417, 15)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 416, 24)) +>computed : Symbol(Options2.computed, Decl(keyofAndIndexedAccess.ts, 431, 15)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 430, 24)) } declare class Component2 { ->Component2 : Symbol(Component2, Decl(keyofAndIndexedAccess.ts, 419, 1)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 421, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 421, 30)) +>Component2 : Symbol(Component2, Decl(keyofAndIndexedAccess.ts, 433, 1)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 435, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 435, 30)) constructor(options: Options2); ->options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 422, 16)) ->Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 412, 16)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 421, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 421, 30)) +>options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 436, 16)) +>Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 426, 16)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 435, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 435, 30)) get(key: K): (Data & Computed)[K]; ->get : Symbol(Component2.get, Decl(keyofAndIndexedAccess.ts, 422, 51)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 423, 8)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 421, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 421, 30)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 423, 47)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 423, 8)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 421, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 421, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 423, 8)) +>get : Symbol(Component2.get, Decl(keyofAndIndexedAccess.ts, 436, 51)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 437, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 435, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 435, 30)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 437, 47)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 437, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 435, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 435, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 437, 8)) } // Repro from #12641 interface R { ->R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 424, 1)) +>R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 438, 1)) p: number; ->p : Symbol(R.p, Decl(keyofAndIndexedAccess.ts, 428, 13)) +>p : Symbol(R.p, Decl(keyofAndIndexedAccess.ts, 442, 13)) } function f(p: K) { ->f : Symbol(f, Decl(keyofAndIndexedAccess.ts, 430, 1)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 432, 11)) ->R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 424, 1)) ->p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 432, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 432, 11)) +>f : Symbol(f, Decl(keyofAndIndexedAccess.ts, 444, 1)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 446, 11)) +>R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 438, 1)) +>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 446, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 446, 11)) let a: any; ->a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 433, 7)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 447, 7)) a[p].add; // any ->a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 433, 7)) ->p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 432, 30)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 447, 7)) +>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 446, 30)) } // Repro from #12651 type MethodDescriptor = { ->MethodDescriptor : Symbol(MethodDescriptor, Decl(keyofAndIndexedAccess.ts, 435, 1)) +>MethodDescriptor : Symbol(MethodDescriptor, Decl(keyofAndIndexedAccess.ts, 449, 1)) name: string; ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 439, 25)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 453, 25)) args: any[]; ->args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 440, 14)) +>args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 454, 14)) returnValue: any; ->returnValue : Symbol(returnValue, Decl(keyofAndIndexedAccess.ts, 441, 13)) +>returnValue : Symbol(returnValue, Decl(keyofAndIndexedAccess.ts, 455, 13)) } declare function dispatchMethod(name: M['name'], args: M['args']): M['returnValue']; ->dispatchMethod : Symbol(dispatchMethod, Decl(keyofAndIndexedAccess.ts, 443, 1)) ->M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 445, 32)) ->MethodDescriptor : Symbol(MethodDescriptor, Decl(keyofAndIndexedAccess.ts, 435, 1)) ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 445, 60)) ->M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 445, 32)) ->args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 445, 76)) ->M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 445, 32)) ->M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 445, 32)) +>dispatchMethod : Symbol(dispatchMethod, Decl(keyofAndIndexedAccess.ts, 457, 1)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 459, 32)) +>MethodDescriptor : Symbol(MethodDescriptor, Decl(keyofAndIndexedAccess.ts, 449, 1)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 459, 60)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 459, 32)) +>args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 459, 76)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 459, 32)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 459, 32)) type SomeMethodDescriptor = { ->SomeMethodDescriptor : Symbol(SomeMethodDescriptor, Decl(keyofAndIndexedAccess.ts, 445, 112)) +>SomeMethodDescriptor : Symbol(SomeMethodDescriptor, Decl(keyofAndIndexedAccess.ts, 459, 112)) name: "someMethod"; ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 447, 29)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 461, 29)) args: [string, number]; ->args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 448, 20)) +>args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 462, 20)) returnValue: string[]; ->returnValue : Symbol(returnValue, Decl(keyofAndIndexedAccess.ts, 449, 24)) +>returnValue : Symbol(returnValue, Decl(keyofAndIndexedAccess.ts, 463, 24)) } let result = dispatchMethod("someMethod", ["hello", 35]); ->result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 453, 3)) ->dispatchMethod : Symbol(dispatchMethod, Decl(keyofAndIndexedAccess.ts, 443, 1)) ->SomeMethodDescriptor : Symbol(SomeMethodDescriptor, Decl(keyofAndIndexedAccess.ts, 445, 112)) +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 467, 3)) +>dispatchMethod : Symbol(dispatchMethod, Decl(keyofAndIndexedAccess.ts, 457, 1)) +>SomeMethodDescriptor : Symbol(SomeMethodDescriptor, Decl(keyofAndIndexedAccess.ts, 459, 112)) // Repro from #13073 type KeyTypes = "a" | "b" ->KeyTypes : Symbol(KeyTypes, Decl(keyofAndIndexedAccess.ts, 453, 79)) +>KeyTypes : Symbol(KeyTypes, Decl(keyofAndIndexedAccess.ts, 467, 79)) let MyThingy: { [key in KeyTypes]: string[] }; ->MyThingy : Symbol(MyThingy, Decl(keyofAndIndexedAccess.ts, 458, 3)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 458, 17)) ->KeyTypes : Symbol(KeyTypes, Decl(keyofAndIndexedAccess.ts, 453, 79)) +>MyThingy : Symbol(MyThingy, Decl(keyofAndIndexedAccess.ts, 472, 3)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 472, 17)) +>KeyTypes : Symbol(KeyTypes, Decl(keyofAndIndexedAccess.ts, 467, 79)) function addToMyThingy(key: S) { ->addToMyThingy : Symbol(addToMyThingy, Decl(keyofAndIndexedAccess.ts, 458, 46)) ->S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 460, 23)) ->KeyTypes : Symbol(KeyTypes, Decl(keyofAndIndexedAccess.ts, 453, 79)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 460, 43)) ->S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 460, 23)) +>addToMyThingy : Symbol(addToMyThingy, Decl(keyofAndIndexedAccess.ts, 472, 46)) +>S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 474, 23)) +>KeyTypes : Symbol(KeyTypes, Decl(keyofAndIndexedAccess.ts, 467, 79)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 474, 43)) +>S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 474, 23)) MyThingy[key].push("a"); >MyThingy[key].push : Symbol(Array.push, Decl(lib.d.ts, --, --)) ->MyThingy : Symbol(MyThingy, Decl(keyofAndIndexedAccess.ts, 458, 3)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 460, 43)) +>MyThingy : Symbol(MyThingy, Decl(keyofAndIndexedAccess.ts, 472, 3)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 474, 43)) >push : Symbol(Array.push, Decl(lib.d.ts, --, --)) } // Repro from #13102 type Handler = { ->Handler : Symbol(Handler, Decl(keyofAndIndexedAccess.ts, 462, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 466, 13)) +>Handler : Symbol(Handler, Decl(keyofAndIndexedAccess.ts, 476, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 480, 13)) onChange: (name: keyof T) => void; ->onChange : Symbol(onChange, Decl(keyofAndIndexedAccess.ts, 466, 19)) ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 467, 15)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 466, 13)) +>onChange : Symbol(onChange, Decl(keyofAndIndexedAccess.ts, 480, 19)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 481, 15)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 480, 13)) }; function onChangeGenericFunction(handler: Handler) { ->onChangeGenericFunction : Symbol(onChangeGenericFunction, Decl(keyofAndIndexedAccess.ts, 468, 2)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 470, 33)) ->handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 470, 36)) ->Handler : Symbol(Handler, Decl(keyofAndIndexedAccess.ts, 462, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 470, 33)) ->preset : Symbol(preset, Decl(keyofAndIndexedAccess.ts, 470, 58)) +>onChangeGenericFunction : Symbol(onChangeGenericFunction, Decl(keyofAndIndexedAccess.ts, 482, 2)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 484, 33)) +>handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 484, 36)) +>Handler : Symbol(Handler, Decl(keyofAndIndexedAccess.ts, 476, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 484, 33)) +>preset : Symbol(preset, Decl(keyofAndIndexedAccess.ts, 484, 58)) handler.onChange('preset') ->handler.onChange : Symbol(onChange, Decl(keyofAndIndexedAccess.ts, 466, 19)) ->handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 470, 36)) ->onChange : Symbol(onChange, Decl(keyofAndIndexedAccess.ts, 466, 19)) +>handler.onChange : Symbol(onChange, Decl(keyofAndIndexedAccess.ts, 480, 19)) +>handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 484, 36)) +>onChange : Symbol(onChange, Decl(keyofAndIndexedAccess.ts, 480, 19)) } // Repro from #13285 function updateIds, K extends string>( ->updateIds : Symbol(updateIds, Decl(keyofAndIndexedAccess.ts, 472, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 476, 19)) +>updateIds : Symbol(updateIds, Decl(keyofAndIndexedAccess.ts, 486, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 490, 19)) >Record : Symbol(Record, Decl(lib.d.ts, --, --)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 476, 47)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 476, 47)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 490, 47)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 490, 47)) obj: T, ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 476, 66)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 476, 19)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 490, 66)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 490, 19)) idFields: K[], ->idFields : Symbol(idFields, Decl(keyofAndIndexedAccess.ts, 477, 11)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 476, 47)) +>idFields : Symbol(idFields, Decl(keyofAndIndexedAccess.ts, 491, 11)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 490, 47)) idMapping: { [oldId: string]: string } ->idMapping : Symbol(idMapping, Decl(keyofAndIndexedAccess.ts, 478, 18)) ->oldId : Symbol(oldId, Decl(keyofAndIndexedAccess.ts, 479, 18)) +>idMapping : Symbol(idMapping, Decl(keyofAndIndexedAccess.ts, 492, 18)) +>oldId : Symbol(oldId, Decl(keyofAndIndexedAccess.ts, 493, 18)) ): Record { >Record : Symbol(Record, Decl(lib.d.ts, --, --)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 476, 47)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 490, 47)) for (const idField of idFields) { ->idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 481, 14)) ->idFields : Symbol(idFields, Decl(keyofAndIndexedAccess.ts, 477, 11)) +>idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 495, 14)) +>idFields : Symbol(idFields, Decl(keyofAndIndexedAccess.ts, 491, 11)) const newId = idMapping[obj[idField]]; ->newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 482, 13)) ->idMapping : Symbol(idMapping, Decl(keyofAndIndexedAccess.ts, 478, 18)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 476, 66)) ->idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 481, 14)) +>newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 496, 13)) +>idMapping : Symbol(idMapping, Decl(keyofAndIndexedAccess.ts, 492, 18)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 490, 66)) +>idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 495, 14)) if (newId) { ->newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 482, 13)) +>newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 496, 13)) obj[idField] = newId; ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 476, 66)) ->idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 481, 14)) ->newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 482, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 490, 66)) +>idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 495, 14)) +>newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 496, 13)) } } return obj; ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 476, 66)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 490, 66)) } // Repro from #13285 function updateIds2( ->updateIds2 : Symbol(updateIds2, Decl(keyofAndIndexedAccess.ts, 488, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 492, 20)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 492, 33)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 492, 54)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 492, 20)) +>updateIds2 : Symbol(updateIds2, Decl(keyofAndIndexedAccess.ts, 502, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 506, 20)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 506, 33)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 506, 54)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 506, 20)) obj: T, ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 492, 74)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 492, 20)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 506, 74)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 506, 20)) key: K, ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 493, 11)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 492, 54)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 507, 11)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 506, 54)) stringMap: { [oldId: string]: string } ->stringMap : Symbol(stringMap, Decl(keyofAndIndexedAccess.ts, 494, 11)) ->oldId : Symbol(oldId, Decl(keyofAndIndexedAccess.ts, 495, 18)) +>stringMap : Symbol(stringMap, Decl(keyofAndIndexedAccess.ts, 508, 11)) +>oldId : Symbol(oldId, Decl(keyofAndIndexedAccess.ts, 509, 18)) ) { var x = obj[key]; ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 497, 7)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 492, 74)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 493, 11)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 511, 7)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 506, 74)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 507, 11)) stringMap[x]; // Should be OK. ->stringMap : Symbol(stringMap, Decl(keyofAndIndexedAccess.ts, 494, 11)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 497, 7)) +>stringMap : Symbol(stringMap, Decl(keyofAndIndexedAccess.ts, 508, 11)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 511, 7)) } // Repro from #13514 declare function head>(list: T): T[0]; ->head : Symbol(head, Decl(keyofAndIndexedAccess.ts, 499, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 503, 22)) +>head : Symbol(head, Decl(keyofAndIndexedAccess.ts, 513, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 517, 22)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->list : Symbol(list, Decl(keyofAndIndexedAccess.ts, 503, 44)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 503, 22)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 503, 22)) +>list : Symbol(list, Decl(keyofAndIndexedAccess.ts, 517, 44)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 517, 22)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 517, 22)) // Repro from #13604 class A { ->A : Symbol(A, Decl(keyofAndIndexedAccess.ts, 503, 59)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 507, 8)) +>A : Symbol(A, Decl(keyofAndIndexedAccess.ts, 517, 59)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 521, 8)) props: T & { foo: string }; ->props : Symbol(A.props, Decl(keyofAndIndexedAccess.ts, 507, 12)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 507, 8)) ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 508, 13)) +>props : Symbol(A.props, Decl(keyofAndIndexedAccess.ts, 521, 12)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 521, 8)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 522, 13)) } class B extends A<{ x: number}> { ->B : Symbol(B, Decl(keyofAndIndexedAccess.ts, 509, 1)) ->A : Symbol(A, Decl(keyofAndIndexedAccess.ts, 503, 59)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 511, 19)) +>B : Symbol(B, Decl(keyofAndIndexedAccess.ts, 523, 1)) +>A : Symbol(A, Decl(keyofAndIndexedAccess.ts, 517, 59)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 525, 19)) f(p: this["props"]) { ->f : Symbol(B.f, Decl(keyofAndIndexedAccess.ts, 511, 33)) ->p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 512, 3)) +>f : Symbol(B.f, Decl(keyofAndIndexedAccess.ts, 525, 33)) +>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 526, 3)) p.x; ->p.x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 511, 19)) ->p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 512, 3)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 511, 19)) +>p.x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 525, 19)) +>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 526, 3)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 525, 19)) } } // Repro from #13749 class Form { ->Form : Symbol(Form, Decl(keyofAndIndexedAccess.ts, 515, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 519, 11)) +>Form : Symbol(Form, Decl(keyofAndIndexedAccess.ts, 529, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 533, 11)) private childFormFactories: {[K in keyof T]: (v: T[K]) => Form} ->childFormFactories : Symbol(Form.childFormFactories, Decl(keyofAndIndexedAccess.ts, 519, 15)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 520, 34)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 519, 11)) ->v : Symbol(v, Decl(keyofAndIndexedAccess.ts, 520, 50)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 519, 11)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 520, 34)) ->Form : Symbol(Form, Decl(keyofAndIndexedAccess.ts, 515, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 519, 11)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 520, 34)) +>childFormFactories : Symbol(Form.childFormFactories, Decl(keyofAndIndexedAccess.ts, 533, 15)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 534, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 533, 11)) +>v : Symbol(v, Decl(keyofAndIndexedAccess.ts, 534, 50)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 533, 11)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 534, 34)) +>Form : Symbol(Form, Decl(keyofAndIndexedAccess.ts, 529, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 533, 11)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 534, 34)) public set(prop: K, value: T[K]) { ->set : Symbol(Form.set, Decl(keyofAndIndexedAccess.ts, 520, 73)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 522, 15)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 519, 11)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 522, 34)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 522, 15)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 522, 42)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 519, 11)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 522, 15)) +>set : Symbol(Form.set, Decl(keyofAndIndexedAccess.ts, 534, 73)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 536, 15)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 533, 11)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 536, 34)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 536, 15)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 536, 42)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 533, 11)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 536, 15)) this.childFormFactories[prop](value) ->this.childFormFactories : Symbol(Form.childFormFactories, Decl(keyofAndIndexedAccess.ts, 519, 15)) ->this : Symbol(Form, Decl(keyofAndIndexedAccess.ts, 515, 1)) ->childFormFactories : Symbol(Form.childFormFactories, Decl(keyofAndIndexedAccess.ts, 519, 15)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 522, 34)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 522, 42)) +>this.childFormFactories : Symbol(Form.childFormFactories, Decl(keyofAndIndexedAccess.ts, 533, 15)) +>this : Symbol(Form, Decl(keyofAndIndexedAccess.ts, 529, 1)) +>childFormFactories : Symbol(Form.childFormFactories, Decl(keyofAndIndexedAccess.ts, 533, 15)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 536, 34)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 536, 42)) } } // Repro from #13787 class SampleClass

{ ->SampleClass : Symbol(SampleClass, Decl(keyofAndIndexedAccess.ts, 525, 1)) ->P : Symbol(P, Decl(keyofAndIndexedAccess.ts, 529, 18)) +>SampleClass : Symbol(SampleClass, Decl(keyofAndIndexedAccess.ts, 539, 1)) +>P : Symbol(P, Decl(keyofAndIndexedAccess.ts, 543, 18)) public props: Readonly

; ->props : Symbol(SampleClass.props, Decl(keyofAndIndexedAccess.ts, 529, 22)) +>props : Symbol(SampleClass.props, Decl(keyofAndIndexedAccess.ts, 543, 22)) >Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) ->P : Symbol(P, Decl(keyofAndIndexedAccess.ts, 529, 18)) +>P : Symbol(P, Decl(keyofAndIndexedAccess.ts, 543, 18)) constructor(props: P) { ->props : Symbol(props, Decl(keyofAndIndexedAccess.ts, 531, 16)) ->P : Symbol(P, Decl(keyofAndIndexedAccess.ts, 529, 18)) +>props : Symbol(props, Decl(keyofAndIndexedAccess.ts, 545, 16)) +>P : Symbol(P, Decl(keyofAndIndexedAccess.ts, 543, 18)) this.props = Object.freeze(props); ->this.props : Symbol(SampleClass.props, Decl(keyofAndIndexedAccess.ts, 529, 22)) ->this : Symbol(SampleClass, Decl(keyofAndIndexedAccess.ts, 525, 1)) ->props : Symbol(SampleClass.props, Decl(keyofAndIndexedAccess.ts, 529, 22)) +>this.props : Symbol(SampleClass.props, Decl(keyofAndIndexedAccess.ts, 543, 22)) +>this : Symbol(SampleClass, Decl(keyofAndIndexedAccess.ts, 539, 1)) +>props : Symbol(SampleClass.props, Decl(keyofAndIndexedAccess.ts, 543, 22)) >Object.freeze : Symbol(ObjectConstructor.freeze, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >freeze : Symbol(ObjectConstructor.freeze, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->props : Symbol(props, Decl(keyofAndIndexedAccess.ts, 531, 16)) +>props : Symbol(props, Decl(keyofAndIndexedAccess.ts, 545, 16)) } } interface Foo { ->Foo : Symbol(Foo, Decl(keyofAndIndexedAccess.ts, 534, 1)) +>Foo : Symbol(Foo, Decl(keyofAndIndexedAccess.ts, 548, 1)) foo: string; ->foo : Symbol(Foo.foo, Decl(keyofAndIndexedAccess.ts, 536, 15)) +>foo : Symbol(Foo.foo, Decl(keyofAndIndexedAccess.ts, 550, 15)) } declare function merge(obj1: T, obj2: U): T & U; ->merge : Symbol(merge, Decl(keyofAndIndexedAccess.ts, 538, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 540, 23)) ->U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 540, 25)) ->obj1 : Symbol(obj1, Decl(keyofAndIndexedAccess.ts, 540, 29)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 540, 23)) ->obj2 : Symbol(obj2, Decl(keyofAndIndexedAccess.ts, 540, 37)) ->U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 540, 25)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 540, 23)) ->U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 540, 25)) +>merge : Symbol(merge, Decl(keyofAndIndexedAccess.ts, 552, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 554, 23)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 554, 25)) +>obj1 : Symbol(obj1, Decl(keyofAndIndexedAccess.ts, 554, 29)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 554, 23)) +>obj2 : Symbol(obj2, Decl(keyofAndIndexedAccess.ts, 554, 37)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 554, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 554, 23)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 554, 25)) class AnotherSampleClass extends SampleClass { ->AnotherSampleClass : Symbol(AnotherSampleClass, Decl(keyofAndIndexedAccess.ts, 540, 54)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 542, 25)) ->SampleClass : Symbol(SampleClass, Decl(keyofAndIndexedAccess.ts, 525, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 542, 25)) ->Foo : Symbol(Foo, Decl(keyofAndIndexedAccess.ts, 534, 1)) +>AnotherSampleClass : Symbol(AnotherSampleClass, Decl(keyofAndIndexedAccess.ts, 554, 54)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 556, 25)) +>SampleClass : Symbol(SampleClass, Decl(keyofAndIndexedAccess.ts, 539, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 556, 25)) +>Foo : Symbol(Foo, Decl(keyofAndIndexedAccess.ts, 548, 1)) constructor(props: T) { ->props : Symbol(props, Decl(keyofAndIndexedAccess.ts, 543, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 542, 25)) +>props : Symbol(props, Decl(keyofAndIndexedAccess.ts, 557, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 556, 25)) const foo: Foo = { foo: "bar" }; ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 544, 13)) ->Foo : Symbol(Foo, Decl(keyofAndIndexedAccess.ts, 534, 1)) ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 544, 26)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 558, 13)) +>Foo : Symbol(Foo, Decl(keyofAndIndexedAccess.ts, 548, 1)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 558, 26)) super(merge(props, foo)); ->super : Symbol(SampleClass, Decl(keyofAndIndexedAccess.ts, 525, 1)) ->merge : Symbol(merge, Decl(keyofAndIndexedAccess.ts, 538, 1)) ->props : Symbol(props, Decl(keyofAndIndexedAccess.ts, 543, 16)) ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 544, 13)) +>super : Symbol(SampleClass, Decl(keyofAndIndexedAccess.ts, 539, 1)) +>merge : Symbol(merge, Decl(keyofAndIndexedAccess.ts, 552, 1)) +>props : Symbol(props, Decl(keyofAndIndexedAccess.ts, 557, 16)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 558, 13)) } public brokenMethod() { ->brokenMethod : Symbol(AnotherSampleClass.brokenMethod, Decl(keyofAndIndexedAccess.ts, 546, 5)) +>brokenMethod : Symbol(AnotherSampleClass.brokenMethod, Decl(keyofAndIndexedAccess.ts, 560, 5)) this.props.foo.concat; >this.props.foo.concat : Symbol(String.concat, Decl(lib.d.ts, --, --)) ->this.props.foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 536, 15)) ->this.props : Symbol(SampleClass.props, Decl(keyofAndIndexedAccess.ts, 529, 22)) ->this : Symbol(AnotherSampleClass, Decl(keyofAndIndexedAccess.ts, 540, 54)) ->props : Symbol(SampleClass.props, Decl(keyofAndIndexedAccess.ts, 529, 22)) ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 536, 15)) +>this.props.foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 550, 15)) +>this.props : Symbol(SampleClass.props, Decl(keyofAndIndexedAccess.ts, 543, 22)) +>this : Symbol(AnotherSampleClass, Decl(keyofAndIndexedAccess.ts, 554, 54)) +>props : Symbol(SampleClass.props, Decl(keyofAndIndexedAccess.ts, 543, 22)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 550, 15)) >concat : Symbol(String.concat, Decl(lib.d.ts, --, --)) } } new AnotherSampleClass({}); ->AnotherSampleClass : Symbol(AnotherSampleClass, Decl(keyofAndIndexedAccess.ts, 540, 54)) +>AnotherSampleClass : Symbol(AnotherSampleClass, Decl(keyofAndIndexedAccess.ts, 554, 54)) // Positive repro from #17166 function f3>(t: T, k: K, tk: T[K]): void { ->f3 : Symbol(f3, Decl(keyofAndIndexedAccess.ts, 552, 27)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 555, 12)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 555, 14)) +>f3 : Symbol(f3, Decl(keyofAndIndexedAccess.ts, 566, 27)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 569, 12)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 569, 14)) >Extract : Symbol(Extract, Decl(lib.d.ts, --, --)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 555, 12)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 555, 51)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 555, 12)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 555, 56)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 555, 14)) ->tk : Symbol(tk, Decl(keyofAndIndexedAccess.ts, 555, 62)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 555, 12)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 555, 14)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 569, 12)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 569, 51)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 569, 12)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 569, 56)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 569, 14)) +>tk : Symbol(tk, Decl(keyofAndIndexedAccess.ts, 569, 62)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 569, 12)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 569, 14)) for (let key in t) { ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 556, 12)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 555, 51)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 570, 12)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 569, 51)) key = k // ok, K ==> keyof T ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 556, 12)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 555, 56)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 570, 12)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 569, 56)) t[key] = tk; // ok, T[K] ==> T[keyof T] ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 555, 51)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 556, 12)) ->tk : Symbol(tk, Decl(keyofAndIndexedAccess.ts, 555, 62)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 569, 51)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 570, 12)) +>tk : Symbol(tk, Decl(keyofAndIndexedAccess.ts, 569, 62)) } } // # 21185 type Predicates = { ->Predicates : Symbol(Predicates, Decl(keyofAndIndexedAccess.ts, 560, 1)) ->TaggedRecord : Symbol(TaggedRecord, Decl(keyofAndIndexedAccess.ts, 563, 16)) +>Predicates : Symbol(Predicates, Decl(keyofAndIndexedAccess.ts, 574, 1)) +>TaggedRecord : Symbol(TaggedRecord, Decl(keyofAndIndexedAccess.ts, 577, 16)) [T in keyof TaggedRecord]: (variant: TaggedRecord[keyof TaggedRecord]) => variant is TaggedRecord[T] ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 564, 3)) ->TaggedRecord : Symbol(TaggedRecord, Decl(keyofAndIndexedAccess.ts, 563, 16)) ->variant : Symbol(variant, Decl(keyofAndIndexedAccess.ts, 564, 30)) ->TaggedRecord : Symbol(TaggedRecord, Decl(keyofAndIndexedAccess.ts, 563, 16)) ->TaggedRecord : Symbol(TaggedRecord, Decl(keyofAndIndexedAccess.ts, 563, 16)) ->variant : Symbol(variant, Decl(keyofAndIndexedAccess.ts, 564, 30)) ->TaggedRecord : Symbol(TaggedRecord, Decl(keyofAndIndexedAccess.ts, 563, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 564, 3)) -} +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 578, 3)) +>TaggedRecord : Symbol(TaggedRecord, Decl(keyofAndIndexedAccess.ts, 577, 16)) +>variant : Symbol(variant, Decl(keyofAndIndexedAccess.ts, 578, 30)) +>TaggedRecord : Symbol(TaggedRecord, Decl(keyofAndIndexedAccess.ts, 577, 16)) +>TaggedRecord : Symbol(TaggedRecord, Decl(keyofAndIndexedAccess.ts, 577, 16)) +>variant : Symbol(variant, Decl(keyofAndIndexedAccess.ts, 578, 30)) +>TaggedRecord : Symbol(TaggedRecord, Decl(keyofAndIndexedAccess.ts, 577, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 578, 3)) +} + +// Repros from #23592 + +type Example = { [K in keyof T]: T[K]["prop"] }; +>Example : Symbol(Example, Decl(keyofAndIndexedAccess.ts, 579, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 583, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 583, 26)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 583, 13)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 583, 42)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 583, 63)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 583, 13)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 583, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 583, 63)) + +type Result = Example<{ a: { prop: string }; b: { prop: number } }>; +>Result : Symbol(Result, Decl(keyofAndIndexedAccess.ts, 583, 93)) +>Example : Symbol(Example, Decl(keyofAndIndexedAccess.ts, 579, 1)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 584, 23)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 584, 28)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 584, 44)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 584, 49)) + +type Helper2 = { [K in keyof T]: Extract }; +>Helper2 : Symbol(Helper2, Decl(keyofAndIndexedAccess.ts, 584, 68)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 586, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 586, 21)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 586, 13)) +>Extract : Symbol(Extract, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 586, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 586, 21)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 586, 51)) + +type Example2 = { [K in keyof Helper2]: Helper2[K]["prop"] }; +>Example2 : Symbol(Example2, Decl(keyofAndIndexedAccess.ts, 586, 67)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 587, 14)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 587, 22)) +>Helper2 : Symbol(Helper2, Decl(keyofAndIndexedAccess.ts, 584, 68)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 587, 14)) +>Helper2 : Symbol(Helper2, Decl(keyofAndIndexedAccess.ts, 584, 68)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 587, 14)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 587, 22)) + +type Result2 = Example2<{ 1: { prop: string }; 2: { prop: number } }>; +>Result2 : Symbol(Result2, Decl(keyofAndIndexedAccess.ts, 587, 70)) +>Example2 : Symbol(Example2, Decl(keyofAndIndexedAccess.ts, 586, 67)) +>1 : Symbol(1, Decl(keyofAndIndexedAccess.ts, 588, 25)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 588, 30)) +>2 : Symbol(2, Decl(keyofAndIndexedAccess.ts, 588, 46)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 588, 51)) // Repro from #23618 type DBBoolTable = { [k in K]: 0 | 1 } ->DBBoolTable : Symbol(DBBoolTable, Decl(keyofAndIndexedAccess.ts, 565, 1)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 569, 17)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 569, 40)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 569, 17)) +>DBBoolTable : Symbol(DBBoolTable, Decl(keyofAndIndexedAccess.ts, 588, 70)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 592, 17)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 592, 40)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 592, 17)) enum Flag { ->Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 569, 56)) +>Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 592, 56)) FLAG_1 = "flag_1", ->FLAG_1 : Symbol(Flag.FLAG_1, Decl(keyofAndIndexedAccess.ts, 570, 11)) +>FLAG_1 : Symbol(Flag.FLAG_1, Decl(keyofAndIndexedAccess.ts, 593, 11)) FLAG_2 = "flag_2" ->FLAG_2 : Symbol(Flag.FLAG_2, Decl(keyofAndIndexedAccess.ts, 571, 22)) +>FLAG_2 : Symbol(Flag.FLAG_2, Decl(keyofAndIndexedAccess.ts, 594, 22)) } type SimpleDBRecord = { staticField: number } & DBBoolTable ->SimpleDBRecord : Symbol(SimpleDBRecord, Decl(keyofAndIndexedAccess.ts, 573, 1)) ->Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 575, 20)) ->staticField : Symbol(staticField, Decl(keyofAndIndexedAccess.ts, 575, 44)) ->DBBoolTable : Symbol(DBBoolTable, Decl(keyofAndIndexedAccess.ts, 565, 1)) ->Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 575, 20)) +>SimpleDBRecord : Symbol(SimpleDBRecord, Decl(keyofAndIndexedAccess.ts, 596, 1)) +>Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 598, 20)) +>staticField : Symbol(staticField, Decl(keyofAndIndexedAccess.ts, 598, 44)) +>DBBoolTable : Symbol(DBBoolTable, Decl(keyofAndIndexedAccess.ts, 588, 70)) +>Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 598, 20)) function getFlagsFromSimpleRecord(record: SimpleDBRecord, flags: Flag[]) { ->getFlagsFromSimpleRecord : Symbol(getFlagsFromSimpleRecord, Decl(keyofAndIndexedAccess.ts, 575, 86)) ->Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 576, 34)) ->record : Symbol(record, Decl(keyofAndIndexedAccess.ts, 576, 55)) ->SimpleDBRecord : Symbol(SimpleDBRecord, Decl(keyofAndIndexedAccess.ts, 573, 1)) ->Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 576, 34)) ->flags : Symbol(flags, Decl(keyofAndIndexedAccess.ts, 576, 84)) ->Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 576, 34)) +>getFlagsFromSimpleRecord : Symbol(getFlagsFromSimpleRecord, Decl(keyofAndIndexedAccess.ts, 598, 86)) +>Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 599, 34)) +>record : Symbol(record, Decl(keyofAndIndexedAccess.ts, 599, 55)) +>SimpleDBRecord : Symbol(SimpleDBRecord, Decl(keyofAndIndexedAccess.ts, 596, 1)) +>Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 599, 34)) +>flags : Symbol(flags, Decl(keyofAndIndexedAccess.ts, 599, 84)) +>Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 599, 34)) return record[flags[0]]; ->record : Symbol(record, Decl(keyofAndIndexedAccess.ts, 576, 55)) ->flags : Symbol(flags, Decl(keyofAndIndexedAccess.ts, 576, 84)) +>record : Symbol(record, Decl(keyofAndIndexedAccess.ts, 599, 55)) +>flags : Symbol(flags, Decl(keyofAndIndexedAccess.ts, 599, 84)) } type DynamicDBRecord = ({ dynamicField: number } | { dynamicField: string }) & DBBoolTable ->DynamicDBRecord : Symbol(DynamicDBRecord, Decl(keyofAndIndexedAccess.ts, 578, 1)) ->Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 580, 21)) ->dynamicField : Symbol(dynamicField, Decl(keyofAndIndexedAccess.ts, 580, 46)) ->dynamicField : Symbol(dynamicField, Decl(keyofAndIndexedAccess.ts, 580, 73)) ->DBBoolTable : Symbol(DBBoolTable, Decl(keyofAndIndexedAccess.ts, 565, 1)) ->Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 580, 21)) +>DynamicDBRecord : Symbol(DynamicDBRecord, Decl(keyofAndIndexedAccess.ts, 601, 1)) +>Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 603, 21)) +>dynamicField : Symbol(dynamicField, Decl(keyofAndIndexedAccess.ts, 603, 46)) +>dynamicField : Symbol(dynamicField, Decl(keyofAndIndexedAccess.ts, 603, 73)) +>DBBoolTable : Symbol(DBBoolTable, Decl(keyofAndIndexedAccess.ts, 588, 70)) +>Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 603, 21)) function getFlagsFromDynamicRecord(record: DynamicDBRecord, flags: Flag[]) { ->getFlagsFromDynamicRecord : Symbol(getFlagsFromDynamicRecord, Decl(keyofAndIndexedAccess.ts, 580, 117)) ->Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 581, 35)) ->record : Symbol(record, Decl(keyofAndIndexedAccess.ts, 581, 56)) ->DynamicDBRecord : Symbol(DynamicDBRecord, Decl(keyofAndIndexedAccess.ts, 578, 1)) ->Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 581, 35)) ->flags : Symbol(flags, Decl(keyofAndIndexedAccess.ts, 581, 86)) ->Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 581, 35)) +>getFlagsFromDynamicRecord : Symbol(getFlagsFromDynamicRecord, Decl(keyofAndIndexedAccess.ts, 603, 117)) +>Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 604, 35)) +>record : Symbol(record, Decl(keyofAndIndexedAccess.ts, 604, 56)) +>DynamicDBRecord : Symbol(DynamicDBRecord, Decl(keyofAndIndexedAccess.ts, 601, 1)) +>Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 604, 35)) +>flags : Symbol(flags, Decl(keyofAndIndexedAccess.ts, 604, 86)) +>Flag : Symbol(Flag, Decl(keyofAndIndexedAccess.ts, 604, 35)) return record[flags[0]]; ->record : Symbol(record, Decl(keyofAndIndexedAccess.ts, 581, 56)) ->flags : Symbol(flags, Decl(keyofAndIndexedAccess.ts, 581, 86)) +>record : Symbol(record, Decl(keyofAndIndexedAccess.ts, 604, 56)) +>flags : Symbol(flags, Decl(keyofAndIndexedAccess.ts, 604, 86)) +} + +// Repro from #21368 + +interface I { +>I : Symbol(I, Decl(keyofAndIndexedAccess.ts, 606, 1)) + + foo: string; +>foo : Symbol(I.foo, Decl(keyofAndIndexedAccess.ts, 610, 13)) +} + +declare function take(p: T): void; +>take : Symbol(take, Decl(keyofAndIndexedAccess.ts, 612, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 614, 22)) +>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 614, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 614, 22)) + +function fn(o: T, k: K) { +>fn : Symbol(fn, Decl(keyofAndIndexedAccess.ts, 614, 37)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 616, 12)) +>I : Symbol(I, Decl(keyofAndIndexedAccess.ts, 606, 1)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 616, 24)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 616, 12)) +>o : Symbol(o, Decl(keyofAndIndexedAccess.ts, 616, 44)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 616, 12)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 616, 49)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 616, 24)) + + take<{} | null | undefined>(o[k]); +>take : Symbol(take, Decl(keyofAndIndexedAccess.ts, 612, 1)) +>o : Symbol(o, Decl(keyofAndIndexedAccess.ts, 616, 44)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 616, 49)) + + take(o[k]); +>take : Symbol(take, Decl(keyofAndIndexedAccess.ts, 612, 1)) +>o : Symbol(o, Decl(keyofAndIndexedAccess.ts, 616, 44)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 616, 49)) +} + +// Repro from #23133 + +class Unbounded { +>Unbounded : Symbol(Unbounded, Decl(keyofAndIndexedAccess.ts, 619, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 623, 16)) + + foo(x: T[keyof T]) { +>foo : Symbol(Unbounded.foo, Decl(keyofAndIndexedAccess.ts, 623, 20)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 624, 8)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 623, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 623, 16)) + + let y: {} | undefined | null = x; +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 625, 11)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 624, 8)) + } } diff --git a/tests/baselines/reference/keyofAndIndexedAccess.types b/tests/baselines/reference/keyofAndIndexedAccess.types index de35c620d3318..0d6a350bd3ca2 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.types +++ b/tests/baselines/reference/keyofAndIndexedAccess.types @@ -1497,6 +1497,73 @@ function f90(x1: S2[keyof S2], x2: T[keyof S2] >length : number } +function f91(x: T, y: T[keyof T], z: T[K]) { +>f91 : (x: T, y: T[keyof T], z: T[K]) => void +>T : T +>K : K +>T : T +>x : T +>T : T +>y : T[keyof T] +>T : T +>T : T +>z : T[K] +>T : T +>K : K + + let a: {}; +>a : {} + + a = x; +>a = x : T +>a : {} +>x : T + + a = y; +>a = y : T[keyof T] +>a : {} +>y : T[keyof T] + + a = z; +>a = z : T[K] +>a : {} +>z : T[K] +} + +function f92(x: T, y: T[keyof T], z: T[K]) { +>f92 : (x: T, y: T[keyof T], z: T[K]) => void +>T : T +>K : K +>T : T +>x : T +>T : T +>y : T[keyof T] +>T : T +>T : T +>z : T[K] +>T : T +>K : K + + let a: {} | null | undefined; +>a : {} | null | undefined +>null : null + + a = x; +>a = x : T +>a : {} | null | undefined +>x : T + + a = y; +>a = y : T[keyof T] +>a : {} | null | undefined +>y : T[keyof T] + + a = z; +>a = z : T[K] +>a : {} | null | undefined +>z : T[K] +} + // Repros from #12011 class Base { @@ -2345,6 +2412,55 @@ type Predicates = { >T : T } +// Repros from #23592 + +type Example = { [K in keyof T]: T[K]["prop"] }; +>Example : Example +>T : T +>K : K +>T : T +>prop : any +>K : K +>T : T +>T : T +>K : K + +type Result = Example<{ a: { prop: string }; b: { prop: number } }>; +>Result : Example<{ a: { prop: string; }; b: { prop: number; }; }> +>Example : Example +>a : { prop: string; } +>prop : string +>b : { prop: number; } +>prop : number + +type Helper2 = { [K in keyof T]: Extract }; +>Helper2 : Helper2 +>T : T +>K : K +>T : T +>Extract : Extract +>T : T +>K : K +>prop : any + +type Example2 = { [K in keyof Helper2]: Helper2[K]["prop"] }; +>Example2 : Example2 +>T : T +>K : K +>Helper2 : Helper2 +>T : T +>Helper2 : Helper2 +>T : T +>K : K + +type Result2 = Example2<{ 1: { prop: string }; 2: { prop: number } }>; +>Result2 : Example2<{ 1: { prop: string; }; 2: { prop: number; }; }> +>Example2 : Example2 +>1 : { prop: string; } +>prop : string +>2 : { prop: number; } +>prop : number + // Repro from #23618 type DBBoolTable = { [k in K]: 0 | 1 } @@ -2414,3 +2530,64 @@ function getFlagsFromDynamicRecord(record: DynamicDBRecord< >0 : 0 } +// Repro from #21368 + +interface I { +>I : I + + foo: string; +>foo : string +} + +declare function take(p: T): void; +>take : (p: T) => void +>T : T +>p : T +>T : T + +function fn(o: T, k: K) { +>fn : (o: T, k: K) => void +>T : T +>I : I +>K : K +>T : T +>o : T +>T : T +>k : K +>K : K + + take<{} | null | undefined>(o[k]); +>take<{} | null | undefined>(o[k]) : void +>take : (p: T) => void +>null : null +>o[k] : T[K] +>o : T +>k : K + + take(o[k]); +>take(o[k]) : void +>take : (p: T) => void +>o[k] : T[K] +>o : T +>k : K +} + +// Repro from #23133 + +class Unbounded { +>Unbounded : Unbounded +>T : T + + foo(x: T[keyof T]) { +>foo : (x: T[keyof T]) => void +>x : T[keyof T] +>T : T +>T : T + + let y: {} | undefined | null = x; +>y : {} | null | undefined +>null : null +>x : T[keyof T] + } +} + diff --git a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt index bbd4685a4923d..c74c90c510f1b 100644 --- a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt @@ -44,6 +44,7 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(87,5): error tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(103,9): error TS2322: Type 'Extract' is not assignable to type 'K'. Type 'string & keyof T' is not assignable to type 'K'. Type 'string' is not assignable to type 'K'. + Type 'string' is not assignable to type 'K'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(105,9): error TS2322: Type 'T[Extract]' is not assignable to type 'T[K]'. Type 'Extract' is not assignable to type 'K'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(108,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. @@ -55,6 +56,7 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(114,5): error Type 'Extract' is not assignable to type 'J'. Type 'string & keyof T' is not assignable to type 'J'. Type 'string' is not assignable to type 'J'. + Type 'string' is not assignable to type 'J'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(117,5): error TS2322: Type 'T[K]' is not assignable to type 'U[J]'. Type 'T' is not assignable to type 'U'. @@ -238,6 +240,7 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(117,5): error !!! error TS2322: Type 'Extract' is not assignable to type 'K'. !!! error TS2322: Type 'string & keyof T' is not assignable to type 'K'. !!! error TS2322: Type 'string' is not assignable to type 'K'. +!!! error TS2322: Type 'string' is not assignable to type 'K'. t[key] = tk; // ok, T[K] ==> T[keyof T] tk = t[key]; // error, T[keyof T] =/=> T[K] ~~ @@ -264,6 +267,7 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(117,5): error !!! error TS2322: Type 'Extract' is not assignable to type 'J'. !!! error TS2322: Type 'string & keyof T' is not assignable to type 'J'. !!! error TS2322: Type 'string' is not assignable to type 'J'. +!!! error TS2322: Type 'string' is not assignable to type 'J'. tk = uj; uj = tk; // error diff --git a/tests/baselines/reference/keyofAndIndexedAccessErrors.types b/tests/baselines/reference/keyofAndIndexedAccessErrors.types index 6a474c1810729..6f90eb2c18797 100644 --- a/tests/baselines/reference/keyofAndIndexedAccessErrors.types +++ b/tests/baselines/reference/keyofAndIndexedAccessErrors.types @@ -34,19 +34,19 @@ type T02 = keyof keyof Object; >Object : Object type T03 = keyof keyof keyof Object; ->T03 : "toString" | "valueOf" | ("toString" & number) | ("toLocaleString" & number) | ("valueOf" & number) | ("toFixed" & number) | ("toExponential" & number) | ("toPrecision" & number) +>T03 : "toString" | "valueOf" >Object : Object type T04 = keyof keyof keyof keyof Object; ->T04 : number | "length" | "toString" | "valueOf" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "substr" | ("toString" & number) | ("valueOf" & number) | (number & "length") | (number & "toString") | (number & "toLocaleString") | (number & "valueOf") | (number & "charAt") | (number & "charCodeAt") | (number & "concat") | (number & "indexOf") | (number & "lastIndexOf") | (number & "localeCompare") | (number & "match") | (number & "replace") | (number & "search") | (number & "slice") | (number & "split") | (number & "substring") | (number & "toLowerCase") | (number & "toLocaleLowerCase") | (number & "toUpperCase") | (number & "toLocaleUpperCase") | (number & "trim") | (number & "substr") | (number & "toFixed") | (number & "toExponential") | (number & "toPrecision") | ("length" & number) | ("charAt" & number) | ("charCodeAt" & number) | ("concat" & number) | ("indexOf" & number) | ("lastIndexOf" & number) | ("localeCompare" & number) | ("match" & number) | ("replace" & number) | ("search" & number) | ("slice" & number) | ("split" & number) | ("substring" & number) | ("toLowerCase" & number) | ("toLocaleLowerCase" & number) | ("toUpperCase" & number) | ("toLocaleUpperCase" & number) | ("trim" & number) | ("substr" & number) +>T04 : number | "length" | "toString" | "valueOf" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "substr" >Object : Object type T05 = keyof keyof keyof keyof keyof Object; ->T05 : "toString" | "valueOf" | ("toString" & number) | ("toLocaleString" & number) | ("valueOf" & number) | ("toFixed" & number) | ("toExponential" & number) | ("toPrecision" & number) +>T05 : "toString" | "valueOf" >Object : Object type T06 = keyof keyof keyof keyof keyof keyof Object; ->T06 : number | "length" | "toString" | "valueOf" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "substr" | ("toString" & number) | ("valueOf" & number) | (number & "length") | (number & "toString") | (number & "toLocaleString") | (number & "valueOf") | (number & "charAt") | (number & "charCodeAt") | (number & "concat") | (number & "indexOf") | (number & "lastIndexOf") | (number & "localeCompare") | (number & "match") | (number & "replace") | (number & "search") | (number & "slice") | (number & "split") | (number & "substring") | (number & "toLowerCase") | (number & "toLocaleLowerCase") | (number & "toUpperCase") | (number & "toLocaleUpperCase") | (number & "trim") | (number & "substr") | (number & "toFixed") | (number & "toExponential") | (number & "toPrecision") | ("length" & number) | ("charAt" & number) | ("charCodeAt" & number) | ("concat" & number) | ("indexOf" & number) | ("lastIndexOf" & number) | ("localeCompare" & number) | ("match" & number) | ("replace" & number) | ("search" & number) | ("slice" & number) | ("split" & number) | ("substring" & number) | ("toLowerCase" & number) | ("toLocaleLowerCase" & number) | ("toUpperCase" & number) | ("toLocaleUpperCase" & number) | ("trim" & number) | ("substr" & number) +>T06 : number | "length" | "toString" | "valueOf" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "substr" >Object : Object type T10 = Shape["name"]; diff --git a/tests/baselines/reference/lateBoundDestructuringImplicitAnyError.errors.txt b/tests/baselines/reference/lateBoundDestructuringImplicitAnyError.errors.txt new file mode 100644 index 0000000000000..2e926ac1b83d3 --- /dev/null +++ b/tests/baselines/reference/lateBoundDestructuringImplicitAnyError.errors.txt @@ -0,0 +1,49 @@ +tests/cases/compiler/lateBoundDestructuringImplicitAnyError.ts(2,15): error TS7017: Element implicitly has an 'any' type because type '{ prop: string; }' has no index signature. +tests/cases/compiler/lateBoundDestructuringImplicitAnyError.ts(13,15): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'. +tests/cases/compiler/lateBoundDestructuringImplicitAnyError.ts(21,15): error TS2536: Type 'unique symbol' cannot be used to index type '{ [idx: number]: string; }'. +tests/cases/compiler/lateBoundDestructuringImplicitAnyError.ts(23,15): error TS2536: Type 'unique symbol' cannot be used to index type '{ [idx: string]: string; }'. +tests/cases/compiler/lateBoundDestructuringImplicitAnyError.ts(25,16): error TS2536: Type 'symbol' cannot be used to index type '{ [idx: number]: string; }'. +tests/cases/compiler/lateBoundDestructuringImplicitAnyError.ts(27,16): error TS2536: Type 'symbol' cannot be used to index type '{ [idx: string]: string; }'. + + +==== tests/cases/compiler/lateBoundDestructuringImplicitAnyError.ts (6 errors) ==== + let named = "foo"; + let {[named]: prop} = {prop: "foo"}; + ~~~~ +!!! error TS7017: Element implicitly has an 'any' type because type '{ prop: string; }' has no index signature. + void prop; + + const numIndexed: {[idx: number]: string} = null as any; + const strIndexed: {[idx: string]: string} = null as any; + + let numed = 6; + + const symed = Symbol(); + let symed2 = Symbol(); + + let {[named]: prop2} = numIndexed; + ~~~~~ +!!! error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'. + void prop2; + let {[numed]: prop3} = numIndexed; + void prop3; + let {[named]: prop4} = strIndexed; + void prop4; + let {[numed]: prop5} = strIndexed; + void prop5; + let {[symed]: prop6} = numIndexed; + ~~~~~ +!!! error TS2536: Type 'unique symbol' cannot be used to index type '{ [idx: number]: string; }'. + void prop6; + let {[symed]: prop7} = strIndexed; + ~~~~~ +!!! error TS2536: Type 'unique symbol' cannot be used to index type '{ [idx: string]: string; }'. + void prop7; + let {[symed2]: prop8} = numIndexed; + ~~~~~ +!!! error TS2536: Type 'symbol' cannot be used to index type '{ [idx: number]: string; }'. + void prop8; + let {[symed2]: prop9} = strIndexed; + ~~~~~ +!!! error TS2536: Type 'symbol' cannot be used to index type '{ [idx: string]: string; }'. + void prop9; \ No newline at end of file diff --git a/tests/baselines/reference/lateBoundDestructuringImplicitAnyError.js b/tests/baselines/reference/lateBoundDestructuringImplicitAnyError.js new file mode 100644 index 0000000000000..61331a135649f --- /dev/null +++ b/tests/baselines/reference/lateBoundDestructuringImplicitAnyError.js @@ -0,0 +1,55 @@ +//// [lateBoundDestructuringImplicitAnyError.ts] +let named = "foo"; +let {[named]: prop} = {prop: "foo"}; +void prop; + +const numIndexed: {[idx: number]: string} = null as any; +const strIndexed: {[idx: string]: string} = null as any; + +let numed = 6; + +const symed = Symbol(); +let symed2 = Symbol(); + +let {[named]: prop2} = numIndexed; +void prop2; +let {[numed]: prop3} = numIndexed; +void prop3; +let {[named]: prop4} = strIndexed; +void prop4; +let {[numed]: prop5} = strIndexed; +void prop5; +let {[symed]: prop6} = numIndexed; +void prop6; +let {[symed]: prop7} = strIndexed; +void prop7; +let {[symed2]: prop8} = numIndexed; +void prop8; +let {[symed2]: prop9} = strIndexed; +void prop9; + +//// [lateBoundDestructuringImplicitAnyError.js] +var named = "foo"; +var _a = named, prop = { prop: "foo" }[_a]; +void prop; +var numIndexed = null; +var strIndexed = null; +var numed = 6; +var symed = Symbol(); +var symed2 = Symbol(); +var _b = named, prop2 = numIndexed[_b]; +void prop2; +var _c = numed, prop3 = numIndexed[_c]; +void prop3; +var _d = named, prop4 = strIndexed[_d]; +void prop4; +var _e = numed, prop5 = strIndexed[_e]; +void prop5; +var _f = symed, prop6 = numIndexed[_f]; +void prop6; +var _g = symed, prop7 = strIndexed[_g]; +void prop7; +var _h = symed2, prop8 = numIndexed[_h]; +void prop8; +var _j = symed2, prop9 = strIndexed[_j]; +void prop9; diff --git a/tests/baselines/reference/lateBoundDestructuringImplicitAnyError.symbols b/tests/baselines/reference/lateBoundDestructuringImplicitAnyError.symbols new file mode 100644 index 0000000000000..28bdf34a2abee --- /dev/null +++ b/tests/baselines/reference/lateBoundDestructuringImplicitAnyError.symbols @@ -0,0 +1,95 @@ +=== tests/cases/compiler/lateBoundDestructuringImplicitAnyError.ts === +let named = "foo"; +>named : Symbol(named, Decl(lateBoundDestructuringImplicitAnyError.ts, 0, 3)) + +let {[named]: prop} = {prop: "foo"}; +>named : Symbol(named, Decl(lateBoundDestructuringImplicitAnyError.ts, 0, 3)) +>prop : Symbol(prop, Decl(lateBoundDestructuringImplicitAnyError.ts, 1, 5)) +>prop : Symbol(prop, Decl(lateBoundDestructuringImplicitAnyError.ts, 1, 23)) + +void prop; +>prop : Symbol(prop, Decl(lateBoundDestructuringImplicitAnyError.ts, 1, 5)) + +const numIndexed: {[idx: number]: string} = null as any; +>numIndexed : Symbol(numIndexed, Decl(lateBoundDestructuringImplicitAnyError.ts, 4, 5)) +>idx : Symbol(idx, Decl(lateBoundDestructuringImplicitAnyError.ts, 4, 20)) + +const strIndexed: {[idx: string]: string} = null as any; +>strIndexed : Symbol(strIndexed, Decl(lateBoundDestructuringImplicitAnyError.ts, 5, 5)) +>idx : Symbol(idx, Decl(lateBoundDestructuringImplicitAnyError.ts, 5, 20)) + +let numed = 6; +>numed : Symbol(numed, Decl(lateBoundDestructuringImplicitAnyError.ts, 7, 3)) + +const symed = Symbol(); +>symed : Symbol(symed, Decl(lateBoundDestructuringImplicitAnyError.ts, 9, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +let symed2 = Symbol(); +>symed2 : Symbol(symed2, Decl(lateBoundDestructuringImplicitAnyError.ts, 10, 3)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +let {[named]: prop2} = numIndexed; +>named : Symbol(named, Decl(lateBoundDestructuringImplicitAnyError.ts, 0, 3)) +>prop2 : Symbol(prop2, Decl(lateBoundDestructuringImplicitAnyError.ts, 12, 5)) +>numIndexed : Symbol(numIndexed, Decl(lateBoundDestructuringImplicitAnyError.ts, 4, 5)) + +void prop2; +>prop2 : Symbol(prop2, Decl(lateBoundDestructuringImplicitAnyError.ts, 12, 5)) + +let {[numed]: prop3} = numIndexed; +>numed : Symbol(numed, Decl(lateBoundDestructuringImplicitAnyError.ts, 7, 3)) +>prop3 : Symbol(prop3, Decl(lateBoundDestructuringImplicitAnyError.ts, 14, 5)) +>numIndexed : Symbol(numIndexed, Decl(lateBoundDestructuringImplicitAnyError.ts, 4, 5)) + +void prop3; +>prop3 : Symbol(prop3, Decl(lateBoundDestructuringImplicitAnyError.ts, 14, 5)) + +let {[named]: prop4} = strIndexed; +>named : Symbol(named, Decl(lateBoundDestructuringImplicitAnyError.ts, 0, 3)) +>prop4 : Symbol(prop4, Decl(lateBoundDestructuringImplicitAnyError.ts, 16, 5)) +>strIndexed : Symbol(strIndexed, Decl(lateBoundDestructuringImplicitAnyError.ts, 5, 5)) + +void prop4; +>prop4 : Symbol(prop4, Decl(lateBoundDestructuringImplicitAnyError.ts, 16, 5)) + +let {[numed]: prop5} = strIndexed; +>numed : Symbol(numed, Decl(lateBoundDestructuringImplicitAnyError.ts, 7, 3)) +>prop5 : Symbol(prop5, Decl(lateBoundDestructuringImplicitAnyError.ts, 18, 5)) +>strIndexed : Symbol(strIndexed, Decl(lateBoundDestructuringImplicitAnyError.ts, 5, 5)) + +void prop5; +>prop5 : Symbol(prop5, Decl(lateBoundDestructuringImplicitAnyError.ts, 18, 5)) + +let {[symed]: prop6} = numIndexed; +>symed : Symbol(symed, Decl(lateBoundDestructuringImplicitAnyError.ts, 9, 5)) +>prop6 : Symbol(prop6, Decl(lateBoundDestructuringImplicitAnyError.ts, 20, 5)) +>numIndexed : Symbol(numIndexed, Decl(lateBoundDestructuringImplicitAnyError.ts, 4, 5)) + +void prop6; +>prop6 : Symbol(prop6, Decl(lateBoundDestructuringImplicitAnyError.ts, 20, 5)) + +let {[symed]: prop7} = strIndexed; +>symed : Symbol(symed, Decl(lateBoundDestructuringImplicitAnyError.ts, 9, 5)) +>prop7 : Symbol(prop7, Decl(lateBoundDestructuringImplicitAnyError.ts, 22, 5)) +>strIndexed : Symbol(strIndexed, Decl(lateBoundDestructuringImplicitAnyError.ts, 5, 5)) + +void prop7; +>prop7 : Symbol(prop7, Decl(lateBoundDestructuringImplicitAnyError.ts, 22, 5)) + +let {[symed2]: prop8} = numIndexed; +>symed2 : Symbol(symed2, Decl(lateBoundDestructuringImplicitAnyError.ts, 10, 3)) +>prop8 : Symbol(prop8, Decl(lateBoundDestructuringImplicitAnyError.ts, 24, 5)) +>numIndexed : Symbol(numIndexed, Decl(lateBoundDestructuringImplicitAnyError.ts, 4, 5)) + +void prop8; +>prop8 : Symbol(prop8, Decl(lateBoundDestructuringImplicitAnyError.ts, 24, 5)) + +let {[symed2]: prop9} = strIndexed; +>symed2 : Symbol(symed2, Decl(lateBoundDestructuringImplicitAnyError.ts, 10, 3)) +>prop9 : Symbol(prop9, Decl(lateBoundDestructuringImplicitAnyError.ts, 26, 5)) +>strIndexed : Symbol(strIndexed, Decl(lateBoundDestructuringImplicitAnyError.ts, 5, 5)) + +void prop9; +>prop9 : Symbol(prop9, Decl(lateBoundDestructuringImplicitAnyError.ts, 26, 5)) + diff --git a/tests/baselines/reference/lateBoundDestructuringImplicitAnyError.types b/tests/baselines/reference/lateBoundDestructuringImplicitAnyError.types new file mode 100644 index 0000000000000..92d2c4c662c4b --- /dev/null +++ b/tests/baselines/reference/lateBoundDestructuringImplicitAnyError.types @@ -0,0 +1,114 @@ +=== tests/cases/compiler/lateBoundDestructuringImplicitAnyError.ts === +let named = "foo"; +>named : string +>"foo" : "foo" + +let {[named]: prop} = {prop: "foo"}; +>named : string +>prop : any +>{prop: "foo"} : { prop: string; } +>prop : string +>"foo" : "foo" + +void prop; +>void prop : undefined +>prop : any + +const numIndexed: {[idx: number]: string} = null as any; +>numIndexed : { [idx: number]: string; } +>idx : number +>null as any : any +>null : null + +const strIndexed: {[idx: string]: string} = null as any; +>strIndexed : { [idx: string]: string; } +>idx : string +>null as any : any +>null : null + +let numed = 6; +>numed : number +>6 : 6 + +const symed = Symbol(); +>symed : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +let symed2 = Symbol(); +>symed2 : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +let {[named]: prop2} = numIndexed; +>named : string +>prop2 : any +>numIndexed : { [idx: number]: string; } + +void prop2; +>void prop2 : undefined +>prop2 : any + +let {[numed]: prop3} = numIndexed; +>numed : number +>prop3 : string +>numIndexed : { [idx: number]: string; } + +void prop3; +>void prop3 : undefined +>prop3 : string + +let {[named]: prop4} = strIndexed; +>named : string +>prop4 : string +>strIndexed : { [idx: string]: string; } + +void prop4; +>void prop4 : undefined +>prop4 : string + +let {[numed]: prop5} = strIndexed; +>numed : number +>prop5 : string +>strIndexed : { [idx: string]: string; } + +void prop5; +>void prop5 : undefined +>prop5 : string + +let {[symed]: prop6} = numIndexed; +>symed : unique symbol +>prop6 : any +>numIndexed : { [idx: number]: string; } + +void prop6; +>void prop6 : undefined +>prop6 : any + +let {[symed]: prop7} = strIndexed; +>symed : unique symbol +>prop7 : any +>strIndexed : { [idx: string]: string; } + +void prop7; +>void prop7 : undefined +>prop7 : any + +let {[symed2]: prop8} = numIndexed; +>symed2 : symbol +>prop8 : any +>numIndexed : { [idx: number]: string; } + +void prop8; +>void prop8 : undefined +>prop8 : any + +let {[symed2]: prop9} = strIndexed; +>symed2 : symbol +>prop9 : any +>strIndexed : { [idx: string]: string; } + +void prop9; +>void prop9 : undefined +>prop9 : any + diff --git a/tests/baselines/reference/literalTypes1.types b/tests/baselines/reference/literalTypes1.types index ed2df4ca14cfe..cb612cab4dd43 100644 --- a/tests/baselines/reference/literalTypes1.types +++ b/tests/baselines/reference/literalTypes1.types @@ -61,19 +61,19 @@ function f2(x: 0 | 1 | 2) { >zero : 0 x; ->x : 0 | 1 | 2 +>x : 0 break; case oneOrTwo: >oneOrTwo : 1 | 2 x; ->x : 0 | 1 | 2 +>x : 1 | 2 break; default: x; ->x : 0 | 1 | 2 +>x : 1 | 2 } } diff --git a/tests/baselines/reference/moduleExportAlias.symbols b/tests/baselines/reference/moduleExportAlias.symbols index 9e2e0e554d2d7..7d17348aa881c 100644 --- a/tests/baselines/reference/moduleExportAlias.symbols +++ b/tests/baselines/reference/moduleExportAlias.symbols @@ -120,23 +120,27 @@ exports.func2 = function () { }; var moduleExportsAlias = module.exports; >moduleExportsAlias : Symbol(moduleExportsAlias, Decl(b.js, 4, 3)) +>module : Symbol(module) moduleExportsAlias.func3 = function () { }; >moduleExportsAlias : Symbol(moduleExportsAlias, Decl(b.js, 4, 3)) module.exports.func4 = function () { }; >module.exports : Symbol(func4, Decl(b.js, 5, 43)) +>module : Symbol(module) >func4 : Symbol(func4, Decl(b.js, 5, 43)) var multipleDeclarationAlias1 = exports = module.exports; >multipleDeclarationAlias1 : Symbol(multipleDeclarationAlias1, Decl(b.js, 8, 3)) >exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0)) +>module : Symbol(module) multipleDeclarationAlias1.func5 = function () { }; >multipleDeclarationAlias1 : Symbol(multipleDeclarationAlias1, Decl(b.js, 8, 3)) var multipleDeclarationAlias2 = module.exports = exports; >multipleDeclarationAlias2 : Symbol(multipleDeclarationAlias2, Decl(b.js, 11, 3)) +>module : Symbol(module) >exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0)) multipleDeclarationAlias2.func6 = function () { }; @@ -160,12 +164,14 @@ multipleDeclarationAlias3.func7 = function () { }; var multipleDeclarationAlias4 = someOtherVariable = module.exports; >multipleDeclarationAlias4 : Symbol(multipleDeclarationAlias4, Decl(b.js, 18, 3)) >someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3)) +>module : Symbol(module) multipleDeclarationAlias4.func8 = function () { }; >multipleDeclarationAlias4 : Symbol(multipleDeclarationAlias4, Decl(b.js, 18, 3)) var multipleDeclarationAlias5 = module.exports = exports = {}; >multipleDeclarationAlias5 : Symbol(multipleDeclarationAlias5, Decl(b.js, 21, 3)) +>module : Symbol(module) >exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0)) multipleDeclarationAlias5.func9 = function () { }; @@ -174,12 +180,14 @@ multipleDeclarationAlias5.func9 = function () { }; var multipleDeclarationAlias6 = exports = module.exports = {}; >multipleDeclarationAlias6 : Symbol(multipleDeclarationAlias6, Decl(b.js, 24, 3)) >exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0)) +>module : Symbol(module) multipleDeclarationAlias6.func10 = function () { }; >multipleDeclarationAlias6 : Symbol(multipleDeclarationAlias6, Decl(b.js, 24, 3)) exports = module.exports = someOtherVariable = {}; >exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0)) +>module : Symbol(module) >someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3)) exports.func11 = function () { }; @@ -189,10 +197,12 @@ exports.func11 = function () { }; module.exports.func12 = function () { }; >module.exports : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33)) +>module : Symbol(module) >func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33)) exports = module.exports = someOtherVariable = {}; >exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0)) +>module : Symbol(module) >someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3)) exports.func11 = function () { }; @@ -202,10 +212,12 @@ exports.func11 = function () { }; module.exports.func12 = function () { }; >module.exports : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33)) +>module : Symbol(module) >func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33)) exports = module.exports = {}; >exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0)) +>module : Symbol(module) exports.func13 = function () { }; >exports.func13 : Symbol(func13, Decl(b.js, 35, 30)) @@ -214,10 +226,12 @@ exports.func13 = function () { }; module.exports.func14 = function () { }; >module.exports : Symbol(func14, Decl(b.js, 36, 33)) +>module : Symbol(module) >func14 : Symbol(func14, Decl(b.js, 36, 33)) exports = module.exports = {}; >exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0)) +>module : Symbol(module) exports.func15 = function () { }; >exports.func15 : Symbol(func15, Decl(b.js, 39, 30)) @@ -226,9 +240,11 @@ exports.func15 = function () { }; module.exports.func16 = function () { }; >module.exports : Symbol(func16, Decl(b.js, 40, 33)) +>module : Symbol(module) >func16 : Symbol(func16, Decl(b.js, 40, 33)) module.exports = exports = {}; +>module : Symbol(module) >exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0)) exports.func17 = function () { }; @@ -238,9 +254,12 @@ exports.func17 = function () { }; module.exports.func18 = function () { }; >module.exports : Symbol(func18, Decl(b.js, 44, 33)) +>module : Symbol(module) >func18 : Symbol(func18, Decl(b.js, 44, 33)) module.exports = {}; +>module : Symbol(module) + exports.func19 = function () { }; >exports.func19 : Symbol(func19, Decl(b.js, 47, 20)) >exports : Symbol(func19, Decl(b.js, 47, 20)) @@ -248,6 +267,7 @@ exports.func19 = function () { }; module.exports.func20 = function () { }; >module.exports : Symbol(func20, Decl(b.js, 48, 33)) +>module : Symbol(module) >func20 : Symbol(func20, Decl(b.js, 48, 33)) diff --git a/tests/baselines/reference/moduleExportNestedNamespaces.errors.txt b/tests/baselines/reference/moduleExportNestedNamespaces.errors.txt deleted file mode 100644 index bdf81a5522897..0000000000000 --- a/tests/baselines/reference/moduleExportNestedNamespaces.errors.txt +++ /dev/null @@ -1,37 +0,0 @@ -tests/cases/conformance/salsa/mod.js(1,1): error TS2304: Cannot find name 'module'. -tests/cases/conformance/salsa/mod.js(2,1): error TS2304: Cannot find name 'module'. -tests/cases/conformance/salsa/mod.js(5,1): error TS2304: Cannot find name 'module'. - - -==== tests/cases/conformance/salsa/mod.js (3 errors) ==== - module.exports.n = {}; - ~~~~~~ -!!! error TS2304: Cannot find name 'module'. - module.exports.n.K = function C() { - ~~~~~~ -!!! error TS2304: Cannot find name 'module'. - this.x = 10; - } - module.exports.Classic = class { - ~~~~~~ -!!! error TS2304: Cannot find name 'module'. - constructor() { - this.p = 1 - } - } - -==== tests/cases/conformance/salsa/use.js (0 errors) ==== - import * as s from './mod' - - var k = new s.n.K() - k.x - var classic = new s.Classic() - - - /** @param {s.n.K} c - @param {s.Classic} classic */ - function f(c, classic) { - c.x - classic.p - } - \ No newline at end of file diff --git a/tests/baselines/reference/moduleExportNestedNamespaces.symbols b/tests/baselines/reference/moduleExportNestedNamespaces.symbols index 2fb74e80364c8..2128a6efb6098 100644 --- a/tests/baselines/reference/moduleExportNestedNamespaces.symbols +++ b/tests/baselines/reference/moduleExportNestedNamespaces.symbols @@ -1,10 +1,12 @@ === tests/cases/conformance/salsa/mod.js === module.exports.n = {}; >module.exports : Symbol(n, Decl(mod.js, 0, 0)) +>module : Symbol(module) >n : Symbol(n, Decl(mod.js, 0, 0)) module.exports.n.K = function C() { >module.exports.n : Symbol(K, Decl(mod.js, 0, 22)) +>module : Symbol(module) >K : Symbol(K, Decl(mod.js, 0, 22)) >C : Symbol(C, Decl(mod.js, 1, 20)) @@ -13,6 +15,7 @@ module.exports.n.K = function C() { } module.exports.Classic = class { >module.exports : Symbol(Classic, Decl(mod.js, 3, 1)) +>module : Symbol(module) >Classic : Symbol(Classic, Decl(mod.js, 3, 1)) constructor() { diff --git a/tests/baselines/reference/objectRestReadonly.js b/tests/baselines/reference/objectRestReadonly.js new file mode 100644 index 0000000000000..a940dbf52cc11 --- /dev/null +++ b/tests/baselines/reference/objectRestReadonly.js @@ -0,0 +1,36 @@ +//// [objectRestReadonly.ts] +// #23734 +type ObjType = { + foo: string + baz: string + quux: string +} + +const obj: Readonly = { + foo: 'bar', + baz: 'qux', + quux: 'quuz', +} + +const { foo, ...rest } = obj + +delete rest.baz + + +//// [objectRestReadonly.js] +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +}; +var obj = { + foo: 'bar', + baz: 'qux', + quux: 'quuz' +}; +var foo = obj.foo, rest = __rest(obj, ["foo"]); +delete rest.baz; diff --git a/tests/baselines/reference/objectRestReadonly.symbols b/tests/baselines/reference/objectRestReadonly.symbols new file mode 100644 index 0000000000000..91c95f915e19c --- /dev/null +++ b/tests/baselines/reference/objectRestReadonly.symbols @@ -0,0 +1,40 @@ +=== tests/cases/conformance/types/rest/objectRestReadonly.ts === +// #23734 +type ObjType = { +>ObjType : Symbol(ObjType, Decl(objectRestReadonly.ts, 0, 0)) + + foo: string +>foo : Symbol(foo, Decl(objectRestReadonly.ts, 1, 16)) + + baz: string +>baz : Symbol(baz, Decl(objectRestReadonly.ts, 2, 13)) + + quux: string +>quux : Symbol(quux, Decl(objectRestReadonly.ts, 3, 13)) +} + +const obj: Readonly = { +>obj : Symbol(obj, Decl(objectRestReadonly.ts, 7, 5)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>ObjType : Symbol(ObjType, Decl(objectRestReadonly.ts, 0, 0)) + + foo: 'bar', +>foo : Symbol(foo, Decl(objectRestReadonly.ts, 7, 32)) + + baz: 'qux', +>baz : Symbol(baz, Decl(objectRestReadonly.ts, 8, 13)) + + quux: 'quuz', +>quux : Symbol(quux, Decl(objectRestReadonly.ts, 9, 13)) +} + +const { foo, ...rest } = obj +>foo : Symbol(foo, Decl(objectRestReadonly.ts, 13, 7)) +>rest : Symbol(rest, Decl(objectRestReadonly.ts, 13, 12)) +>obj : Symbol(obj, Decl(objectRestReadonly.ts, 7, 5)) + +delete rest.baz +>rest.baz : Symbol(baz, Decl(objectRestReadonly.ts, 2, 13)) +>rest : Symbol(rest, Decl(objectRestReadonly.ts, 13, 12)) +>baz : Symbol(baz, Decl(objectRestReadonly.ts, 2, 13)) + diff --git a/tests/baselines/reference/objectRestReadonly.types b/tests/baselines/reference/objectRestReadonly.types new file mode 100644 index 0000000000000..30fd21e896bd4 --- /dev/null +++ b/tests/baselines/reference/objectRestReadonly.types @@ -0,0 +1,45 @@ +=== tests/cases/conformance/types/rest/objectRestReadonly.ts === +// #23734 +type ObjType = { +>ObjType : ObjType + + foo: string +>foo : string + + baz: string +>baz : string + + quux: string +>quux : string +} + +const obj: Readonly = { +>obj : Readonly +>Readonly : Readonly +>ObjType : ObjType +>{ foo: 'bar', baz: 'qux', quux: 'quuz',} : { foo: string; baz: string; quux: string; } + + foo: 'bar', +>foo : string +>'bar' : "bar" + + baz: 'qux', +>baz : string +>'qux' : "qux" + + quux: 'quuz', +>quux : string +>'quuz' : "quuz" +} + +const { foo, ...rest } = obj +>foo : string +>rest : { baz: string; quux: string; } +>obj : Readonly + +delete rest.baz +>delete rest.baz : boolean +>rest.baz : string +>rest : { baz: string; quux: string; } +>baz : string + diff --git a/tests/baselines/reference/optionsStrictPropertyInitializationStrictNullChecks.errors.txt b/tests/baselines/reference/optionsStrictPropertyInitializationStrictNullChecks.errors.txt new file mode 100644 index 0000000000000..8ce2ddcaaa323 --- /dev/null +++ b/tests/baselines/reference/optionsStrictPropertyInitializationStrictNullChecks.errors.txt @@ -0,0 +1,7 @@ +error TS5052: Option 'strictPropertyInitialization' cannot be specified without specifying option 'strictNullChecks'. + + +!!! error TS5052: Option 'strictPropertyInitialization' cannot be specified without specifying option 'strictNullChecks'. +==== tests/cases/compiler/optionsStrictPropertyInitializationStrictNullChecks.ts (0 errors) ==== + var x; + \ No newline at end of file diff --git a/tests/baselines/reference/optionsStrictPropertyInitializationStrictNullChecks.js b/tests/baselines/reference/optionsStrictPropertyInitializationStrictNullChecks.js new file mode 100644 index 0000000000000..fc564c722dabb --- /dev/null +++ b/tests/baselines/reference/optionsStrictPropertyInitializationStrictNullChecks.js @@ -0,0 +1,6 @@ +//// [optionsStrictPropertyInitializationStrictNullChecks.ts] +var x; + + +//// [optionsStrictPropertyInitializationStrictNullChecks.js] +var x; diff --git a/tests/baselines/reference/optionsStrictPropertyInitializationStrictNullChecks.symbols b/tests/baselines/reference/optionsStrictPropertyInitializationStrictNullChecks.symbols new file mode 100644 index 0000000000000..7482215b8227c --- /dev/null +++ b/tests/baselines/reference/optionsStrictPropertyInitializationStrictNullChecks.symbols @@ -0,0 +1,4 @@ +=== tests/cases/compiler/optionsStrictPropertyInitializationStrictNullChecks.ts === +var x; +>x : Symbol(x, Decl(optionsStrictPropertyInitializationStrictNullChecks.ts, 0, 3)) + diff --git a/tests/baselines/reference/optionsStrictPropertyInitializationStrictNullChecks.types b/tests/baselines/reference/optionsStrictPropertyInitializationStrictNullChecks.types new file mode 100644 index 0000000000000..f59278f8382b4 --- /dev/null +++ b/tests/baselines/reference/optionsStrictPropertyInitializationStrictNullChecks.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/optionsStrictPropertyInitializationStrictNullChecks.ts === +var x; +>x : any + diff --git a/tests/baselines/reference/stringLiteralsWithSwitchStatements03.types b/tests/baselines/reference/stringLiteralsWithSwitchStatements03.types index 2b4b3e0fae927..70f6d6cc9733b 100644 --- a/tests/baselines/reference/stringLiteralsWithSwitchStatements03.types +++ b/tests/baselines/reference/stringLiteralsWithSwitchStatements03.types @@ -51,7 +51,7 @@ switch (x) { >"baz" : "baz" x; ->x : "foo" +>x : never y; >y : "foo" | "bar" diff --git a/tests/baselines/reference/switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.js b/tests/baselines/reference/switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.js new file mode 100644 index 0000000000000..800209fde7ab5 --- /dev/null +++ b/tests/baselines/reference/switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.js @@ -0,0 +1,83 @@ +//// [switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts] +export const narrowToLiterals = (str: string) => { + switch (str) { + case 'abc': { + // inferred type as `abc` + return str; + } + default: + return 'defaultValue'; + } + }; + + export const narrowToString = (str: string, someOtherStr: string) => { + switch (str) { + case 'abc': { + // inferred type should be `abc` + return str; + } + case someOtherStr: { + // `string` + return str; + } + default: + return 'defaultValue'; + } + }; + + export const narrowToStringOrNumber = (str: string | number, someNumber: number) => { + switch (str) { + case 'abc': { + // inferred type should be `abc` + return str; + } + case someNumber: { + // inferred type should be `number` + return str; + } + default: + return 'defaultValue'; + } + }; + +//// [switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.js] +"use strict"; +exports.__esModule = true; +exports.narrowToLiterals = function (str) { + switch (str) { + case 'abc': { + // inferred type as `abc` + return str; + } + default: + return 'defaultValue'; + } +}; +exports.narrowToString = function (str, someOtherStr) { + switch (str) { + case 'abc': { + // inferred type should be `abc` + return str; + } + case someOtherStr: { + // `string` + return str; + } + default: + return 'defaultValue'; + } +}; +exports.narrowToStringOrNumber = function (str, someNumber) { + switch (str) { + case 'abc': { + // inferred type should be `abc` + return str; + } + case someNumber: { + // inferred type should be `number` + return str; + } + default: + return 'defaultValue'; + } +}; diff --git a/tests/baselines/reference/switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.symbols b/tests/baselines/reference/switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.symbols new file mode 100644 index 0000000000000..64b8ad44c97b1 --- /dev/null +++ b/tests/baselines/reference/switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.symbols @@ -0,0 +1,67 @@ +=== tests/cases/compiler/switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts === +export const narrowToLiterals = (str: string) => { +>narrowToLiterals : Symbol(narrowToLiterals, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 0, 12)) +>str : Symbol(str, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 0, 33)) + + switch (str) { +>str : Symbol(str, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 0, 33)) + + case 'abc': { + // inferred type as `abc` + return str; +>str : Symbol(str, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 0, 33)) + } + default: + return 'defaultValue'; + } + }; + + export const narrowToString = (str: string, someOtherStr: string) => { +>narrowToString : Symbol(narrowToString, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 11, 14)) +>str : Symbol(str, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 11, 33)) +>someOtherStr : Symbol(someOtherStr, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 11, 45)) + + switch (str) { +>str : Symbol(str, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 11, 33)) + + case 'abc': { + // inferred type should be `abc` + return str; +>str : Symbol(str, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 11, 33)) + } + case someOtherStr: { +>someOtherStr : Symbol(someOtherStr, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 11, 45)) + + // `string` + return str; +>str : Symbol(str, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 11, 33)) + } + default: + return 'defaultValue'; + } + }; + + export const narrowToStringOrNumber = (str: string | number, someNumber: number) => { +>narrowToStringOrNumber : Symbol(narrowToStringOrNumber, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 26, 14)) +>str : Symbol(str, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 26, 41)) +>someNumber : Symbol(someNumber, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 26, 62)) + + switch (str) { +>str : Symbol(str, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 26, 41)) + + case 'abc': { + // inferred type should be `abc` + return str; +>str : Symbol(str, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 26, 41)) + } + case someNumber: { +>someNumber : Symbol(someNumber, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 26, 62)) + + // inferred type should be `number` + return str; +>str : Symbol(str, Decl(switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts, 26, 41)) + } + default: + return 'defaultValue'; + } + }; diff --git a/tests/baselines/reference/switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.types b/tests/baselines/reference/switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.types new file mode 100644 index 0000000000000..f8c147450750b --- /dev/null +++ b/tests/baselines/reference/switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.types @@ -0,0 +1,79 @@ +=== tests/cases/compiler/switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts === +export const narrowToLiterals = (str: string) => { +>narrowToLiterals : (str: string) => "abc" | "defaultValue" +>(str: string) => { switch (str) { case 'abc': { // inferred type as `abc` return str; } default: return 'defaultValue'; } } : (str: string) => "abc" | "defaultValue" +>str : string + + switch (str) { +>str : string + + case 'abc': { +>'abc' : "abc" + + // inferred type as `abc` + return str; +>str : "abc" + } + default: + return 'defaultValue'; +>'defaultValue' : "defaultValue" + } + }; + + export const narrowToString = (str: string, someOtherStr: string) => { +>narrowToString : (str: string, someOtherStr: string) => string +>(str: string, someOtherStr: string) => { switch (str) { case 'abc': { // inferred type should be `abc` return str; } case someOtherStr: { // `string` return str; } default: return 'defaultValue'; } } : (str: string, someOtherStr: string) => string +>str : string +>someOtherStr : string + + switch (str) { +>str : string + + case 'abc': { +>'abc' : "abc" + + // inferred type should be `abc` + return str; +>str : "abc" + } + case someOtherStr: { +>someOtherStr : string + + // `string` + return str; +>str : string + } + default: + return 'defaultValue'; +>'defaultValue' : "defaultValue" + } + }; + + export const narrowToStringOrNumber = (str: string | number, someNumber: number) => { +>narrowToStringOrNumber : (str: string | number, someNumber: number) => number | "abc" | "defaultValue" +>(str: string | number, someNumber: number) => { switch (str) { case 'abc': { // inferred type should be `abc` return str; } case someNumber: { // inferred type should be `number` return str; } default: return 'defaultValue'; } } : (str: string | number, someNumber: number) => number | "abc" | "defaultValue" +>str : string | number +>someNumber : number + + switch (str) { +>str : string | number + + case 'abc': { +>'abc' : "abc" + + // inferred type should be `abc` + return str; +>str : "abc" + } + case someNumber: { +>someNumber : number + + // inferred type should be `number` + return str; +>str : number + } + default: + return 'defaultValue'; +>'defaultValue' : "defaultValue" + } + }; diff --git a/tests/baselines/reference/switchCaseWithIntersectionTypes01.errors.txt b/tests/baselines/reference/switchCaseWithIntersectionTypes01.errors.txt index 3aca9d926b763..380e98c3c3ddf 100644 --- a/tests/baselines/reference/switchCaseWithIntersectionTypes01.errors.txt +++ b/tests/baselines/reference/switchCaseWithIntersectionTypes01.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts(18,10): error TS2678: Type '(number & true) | (number & false)' is not comparable to type 'string & number'. - Type 'number & false' is not comparable to type 'string & number'. - Type 'number & false' is not comparable to type 'string'. tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts(22,10): error TS2678: Type 'boolean' is not comparable to type 'string & number'. -==== tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts (2 errors) ==== +==== tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts (1 errors) ==== var strAndNum: string & number; var numAndBool: number & boolean; var str: string; @@ -23,10 +20,6 @@ tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithInterse // Overlap in constituents case numAndBool: - ~~~~~~~~~~ -!!! error TS2678: Type '(number & true) | (number & false)' is not comparable to type 'string & number'. -!!! error TS2678: Type 'number & false' is not comparable to type 'string & number'. -!!! error TS2678: Type 'number & false' is not comparable to type 'string'. break; // No relation diff --git a/tests/baselines/reference/switchCaseWithIntersectionTypes01.types b/tests/baselines/reference/switchCaseWithIntersectionTypes01.types index 4a578f223199d..9ba884985dc24 100644 --- a/tests/baselines/reference/switchCaseWithIntersectionTypes01.types +++ b/tests/baselines/reference/switchCaseWithIntersectionTypes01.types @@ -3,7 +3,7 @@ var strAndNum: string & number; >strAndNum : string & number var numAndBool: number & boolean; ->numAndBool : (number & true) | (number & false) +>numAndBool : never var str: string; >str : string @@ -34,7 +34,7 @@ switch (strAndNum) { // Overlap in constituents case numAndBool: ->numAndBool : (number & true) | (number & false) +>numAndBool : never break; diff --git a/tests/baselines/reference/typeGuardsWithInstanceOf.types b/tests/baselines/reference/typeGuardsWithInstanceOf.types index 7fce8cd45594e..3fd47f43fc303 100644 --- a/tests/baselines/reference/typeGuardsWithInstanceOf.types +++ b/tests/baselines/reference/typeGuardsWithInstanceOf.types @@ -25,7 +25,7 @@ if (!(result instanceof RegExp)) { } else if (!result.global) { >!result.global : boolean ->result.global : (string & true) | (string & false) +>result.global : never >result : I & RegExp ->global : (string & true) | (string & false) +>global : never } diff --git a/tests/baselines/reference/typedefCrossModule.symbols b/tests/baselines/reference/typedefCrossModule.symbols new file mode 100644 index 0000000000000..2ba91903ba3ad --- /dev/null +++ b/tests/baselines/reference/typedefCrossModule.symbols @@ -0,0 +1,70 @@ +=== tests/cases/conformance/jsdoc/commonjs.d.ts === +declare var module: { exports: any}; +>module : Symbol(module, Decl(commonjs.d.ts, 0, 11)) +>exports : Symbol(exports, Decl(commonjs.d.ts, 0, 21)) + +=== tests/cases/conformance/jsdoc/mod1.js === +/// +/** @typedef {{ type: "a", x: 1 }} A */ +/** @typedef {{ type: "b", y: 1 }} B */ +/** @typedef {A | B} Both */ +module.exports = C +>module.exports : Symbol(exports, Decl(commonjs.d.ts, 0, 21)) +>module : Symbol(export=, Decl(mod1.js, 0, 0)) +>exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>C : Symbol(C, Decl(mod1.js, 4, 18)) + +function C() { +>C : Symbol(C, Decl(mod1.js, 4, 18)) + + this.p = 1 +>p : Symbol(C.p, Decl(mod1.js, 5, 14)) +} + +=== tests/cases/conformance/jsdoc/mod2.js === +/// +/** @typedef {{ type: "a", x: 1 }} A */ +/** @typedef {{ type: "b", y: 1 }} B */ +/** @typedef {A | B} Both */ + +export function C() { +>C : Symbol(C, Decl(mod2.js, 0, 0)) + + this.p = 1 +>p : Symbol(C.p, Decl(mod2.js, 5, 21)) +} + +=== tests/cases/conformance/jsdoc/mod3.js === +/// +/** @typedef {{ type: "a", x: 1 }} A */ +/** @typedef {{ type: "b", y: 1 }} B */ +/** @typedef {A | B} Both */ + +exports.C = function() { +>exports.C : Symbol(C, Decl(mod3.js, 0, 0)) +>exports : Symbol(C, Decl(mod3.js, 0, 0)) +>C : Symbol(C, Decl(mod3.js, 0, 0)) + + this.p = 1 +>p : Symbol(C.p, Decl(mod3.js, 5, 24)) +} + +=== tests/cases/conformance/jsdoc/use.js === +/** @type {import('./mod1').Both} */ +var both1 = { type: 'a', x: 1 }; +>both1 : Symbol(both1, Decl(use.js, 1, 3)) +>type : Symbol(type, Decl(use.js, 1, 13)) +>x : Symbol(x, Decl(use.js, 1, 24)) + +/** @type {import('./mod2').Both} */ +var both2 = both1; +>both2 : Symbol(both2, Decl(use.js, 3, 3)) +>both1 : Symbol(both1, Decl(use.js, 1, 3)) + +/** @type {import('./mod3').Both} */ +var both3 = both2; +>both3 : Symbol(both3, Decl(use.js, 5, 3)) +>both2 : Symbol(both2, Decl(use.js, 3, 3)) + + + diff --git a/tests/baselines/reference/typedefCrossModule.types b/tests/baselines/reference/typedefCrossModule.types new file mode 100644 index 0000000000000..665fa4989918b --- /dev/null +++ b/tests/baselines/reference/typedefCrossModule.types @@ -0,0 +1,88 @@ +=== tests/cases/conformance/jsdoc/commonjs.d.ts === +declare var module: { exports: any}; +>module : { exports: any; } +>exports : any + +=== tests/cases/conformance/jsdoc/mod1.js === +/// +/** @typedef {{ type: "a", x: 1 }} A */ +/** @typedef {{ type: "b", y: 1 }} B */ +/** @typedef {A | B} Both */ +module.exports = C +>module.exports = C : typeof C +>module.exports : any +>module : { exports: any; } +>exports : any +>C : typeof C + +function C() { +>C : typeof C + + this.p = 1 +>this.p = 1 : 1 +>this.p : any +>this : any +>p : any +>1 : 1 +} + +=== tests/cases/conformance/jsdoc/mod2.js === +/// +/** @typedef {{ type: "a", x: 1 }} A */ +/** @typedef {{ type: "b", y: 1 }} B */ +/** @typedef {A | B} Both */ + +export function C() { +>C : typeof C + + this.p = 1 +>this.p = 1 : 1 +>this.p : any +>this : any +>p : any +>1 : 1 +} + +=== tests/cases/conformance/jsdoc/mod3.js === +/// +/** @typedef {{ type: "a", x: 1 }} A */ +/** @typedef {{ type: "b", y: 1 }} B */ +/** @typedef {A | B} Both */ + +exports.C = function() { +>exports.C = function() { this.p = 1} : typeof C +>exports.C : typeof C +>exports : typeof import("tests/cases/conformance/jsdoc/mod3") +>C : typeof C +>function() { this.p = 1} : typeof C + + this.p = 1 +>this.p = 1 : 1 +>this.p : any +>this : any +>p : any +>1 : 1 +} + +=== tests/cases/conformance/jsdoc/use.js === +/** @type {import('./mod1').Both} */ +var both1 = { type: 'a', x: 1 }; +>both1 : { type: "a"; x: 1; } | { type: "b"; y: 1; } +>{ type: 'a', x: 1 } : { type: "a"; x: 1; } +>type : "a" +>'a' : "a" +>x : 1 +>1 : 1 + +/** @type {import('./mod2').Both} */ +var both2 = both1; +>both2 : { type: "a"; x: 1; } | { type: "b"; y: 1; } +>both1 : { type: "a"; x: 1; } + +/** @type {import('./mod3').Both} */ +var both3 = both2; +>both3 : { type: "a"; x: 1; } | { type: "b"; y: 1; } +>both2 : { type: "a"; x: 1; } + + + diff --git a/tests/baselines/reference/typedefCrossModule2.errors.txt b/tests/baselines/reference/typedefCrossModule2.errors.txt new file mode 100644 index 0000000000000..c2977b9655508 --- /dev/null +++ b/tests/baselines/reference/typedefCrossModule2.errors.txt @@ -0,0 +1,55 @@ +tests/cases/conformance/jsdoc/mod1.js(3,23): error TS2300: Duplicate identifier 'Foo'. +tests/cases/conformance/jsdoc/mod1.js(4,7): error TS2300: Duplicate identifier 'Foo'. +tests/cases/conformance/jsdoc/mod1.js(6,23): error TS2300: Duplicate identifier 'Bar'. +tests/cases/conformance/jsdoc/mod1.js(7,9): error TS2300: Duplicate identifier 'Bar'. +tests/cases/conformance/jsdoc/mod1.js(9,5): error TS2300: Duplicate identifier 'Baz'. +tests/cases/conformance/jsdoc/mod1.js(11,5): error TS2300: Duplicate identifier 'Baz'. + + +==== tests/cases/conformance/jsdoc/use.js (0 errors) ==== + var mod = require('./mod1.js'); + /** @type {import("./mod1.js").Baz} */ + var b; + /** @type {mod.Baz} */ + var bb; + var bbb = new mod.Baz(); + +==== tests/cases/conformance/jsdoc/mod1.js (6 errors) ==== + // error + + /** @typedef {number} Foo */ + ~~~ +!!! error TS2300: Duplicate identifier 'Foo'. + class Foo { } // should error + ~~~ +!!! error TS2300: Duplicate identifier 'Foo'. + + /** @typedef {number} Bar */ + ~~~ +!!! error TS2300: Duplicate identifier 'Bar'. + exports.Bar = class { } + ~~~ +!!! error TS2300: Duplicate identifier 'Bar'. + + /** @typedef {number} Baz */ + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'Baz'. + module.exports = { + Baz: class { } + ~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'Baz'. + } + + // ok + + /** @typedef {number} Qux */ + var Qux = 2; + + /** @typedef {number} Quid */ + exports.Quid = 2; + + /** @typedef {number} Quack */ + module.exports = { + Quack: 2 + } + \ No newline at end of file diff --git a/tests/baselines/reference/typedefCrossModule2.symbols b/tests/baselines/reference/typedefCrossModule2.symbols new file mode 100644 index 0000000000000..79fbb1ab509a2 --- /dev/null +++ b/tests/baselines/reference/typedefCrossModule2.symbols @@ -0,0 +1,61 @@ +=== tests/cases/conformance/jsdoc/use.js === +var mod = require('./mod1.js'); +>mod : Symbol(mod, Decl(use.js, 0, 3)) +>require : Symbol(require) +>'./mod1.js' : Symbol("tests/cases/conformance/jsdoc/mod1", Decl(mod1.js, 0, 0)) + +/** @type {import("./mod1.js").Baz} */ +var b; +>b : Symbol(b, Decl(use.js, 2, 3)) + +/** @type {mod.Baz} */ +var bb; +>bb : Symbol(bb, Decl(use.js, 4, 3)) + +var bbb = new mod.Baz(); +>bbb : Symbol(bbb, Decl(use.js, 5, 3)) +>mod : Symbol(mod, Decl(use.js, 0, 3)) + +=== tests/cases/conformance/jsdoc/mod1.js === +// error + +/** @typedef {number} Foo */ +class Foo { } // should error +>Foo : Symbol(Foo, Decl(mod1.js, 0, 0)) + +/** @typedef {number} Bar */ +exports.Bar = class { } +>exports.Bar : Symbol(Bar, Decl(mod1.js, 3, 13)) +>exports : Symbol(Bar, Decl(mod1.js, 3, 13)) +>Bar : Symbol(Bar, Decl(mod1.js, 3, 13)) + +/** @typedef {number} Baz */ +module.exports = { +>module : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17)) +>exports : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17)) + + Baz: class { } +>Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) +} + +// ok + +/** @typedef {number} Qux */ +var Qux = 2; +>Qux : Symbol(Qux, Decl(mod1.js, 16, 3), Decl(mod1.js, 15, 4)) + +/** @typedef {number} Quid */ +exports.Quid = 2; +>exports.Quid : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4)) +>exports : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4)) +>Quid : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4)) + +/** @typedef {number} Quack */ +module.exports = { +>module : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17)) +>exports : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17)) + + Quack: 2 +>Quack : Symbol(Quack, Decl(mod1.js, 22, 18)) +} + diff --git a/tests/baselines/reference/typedefCrossModule2.types b/tests/baselines/reference/typedefCrossModule2.types new file mode 100644 index 0000000000000..67e4b7a4e890e --- /dev/null +++ b/tests/baselines/reference/typedefCrossModule2.types @@ -0,0 +1,78 @@ +=== tests/cases/conformance/jsdoc/use.js === +var mod = require('./mod1.js'); +>mod : { [x: string]: any; Baz: any; Bar: typeof Bar; Quid: any; } | { [x: string]: any; Quack: any; Bar: typeof Bar; Quid: any; } +>require('./mod1.js') : { [x: string]: any; Baz: any; Bar: typeof Bar; Quid: any; } | { [x: string]: any; Quack: any; Bar: typeof Bar; Quid: any; } +>require : any +>'./mod1.js' : "./mod1.js" + +/** @type {import("./mod1.js").Baz} */ +var b; +>b : number + +/** @type {mod.Baz} */ +var bb; +>bb : number + +var bbb = new mod.Baz(); +>bbb : any +>new mod.Baz() : any +>mod.Baz : any +>mod : { [x: string]: any; Baz: any; Bar: typeof Bar; Quid: any; } | { [x: string]: any; Quack: any; Bar: typeof Bar; Quid: any; } +>Baz : any + +=== tests/cases/conformance/jsdoc/mod1.js === +// error + +/** @typedef {number} Foo */ +class Foo { } // should error +>Foo : Foo + +/** @typedef {number} Bar */ +exports.Bar = class { } +>exports.Bar = class { } : typeof Bar +>exports.Bar : typeof Bar +>exports : typeof import("tests/cases/conformance/jsdoc/mod1") +>Bar : typeof Bar +>class { } : typeof Bar + +/** @typedef {number} Baz */ +module.exports = { +>module.exports = { Baz: class { }} : { [x: string]: any; Baz: typeof Baz; } +>module.exports : any +>module : any +>exports : any +>{ Baz: class { }} : { [x: string]: any; Baz: typeof Baz; } + + Baz: class { } +>Baz : typeof Baz +>class { } : typeof Baz +} + +// ok + +/** @typedef {number} Qux */ +var Qux = 2; +>Qux : number +>2 : 2 + +/** @typedef {number} Quid */ +exports.Quid = 2; +>exports.Quid = 2 : 2 +>exports.Quid : any +>exports : typeof import("tests/cases/conformance/jsdoc/mod1") +>Quid : any +>2 : 2 + +/** @typedef {number} Quack */ +module.exports = { +>module.exports = { Quack: 2} : { [x: string]: any; Quack: number; } +>module.exports : any +>module : any +>exports : any +>{ Quack: 2} : { [x: string]: any; Quack: number; } + + Quack: 2 +>Quack : number +>2 : 2 +} + diff --git a/tests/baselines/reference/typedefCrossModule3.errors.txt b/tests/baselines/reference/typedefCrossModule3.errors.txt new file mode 100644 index 0000000000000..643d51a1823c8 --- /dev/null +++ b/tests/baselines/reference/typedefCrossModule3.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/jsdoc/mod2.js(1,5): error TS2300: Duplicate identifier 'Foo'. +tests/cases/conformance/jsdoc/mod2.js(3,1): error TS2300: Duplicate identifier 'Foo'. + + +==== tests/cases/conformance/jsdoc/mod2.js (2 errors) ==== + /** @typedef {number} Foo */ + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'Foo'. + const ns = {}; + ns.Foo = class {} + ~~~~~~ +!!! error TS2300: Duplicate identifier 'Foo'. + module.exports = ns; + + \ No newline at end of file diff --git a/tests/baselines/reference/typedefCrossModule3.symbols b/tests/baselines/reference/typedefCrossModule3.symbols new file mode 100644 index 0000000000000..3e1c8a55535df --- /dev/null +++ b/tests/baselines/reference/typedefCrossModule3.symbols @@ -0,0 +1,16 @@ +=== tests/cases/conformance/jsdoc/mod2.js === +/** @typedef {number} Foo */ +const ns = {}; +>ns : Symbol(ns, Decl(mod2.js, 1, 5), Decl(mod2.js, 1, 14)) + +ns.Foo = class {} +>ns.Foo : Symbol(Foo, Decl(mod2.js, 1, 14)) +>ns : Symbol(ns, Decl(mod2.js, 1, 5), Decl(mod2.js, 1, 14)) +>Foo : Symbol(Foo, Decl(mod2.js, 1, 14)) + +module.exports = ns; +>module : Symbol(export=, Decl(mod2.js, 2, 17)) +>exports : Symbol(export=, Decl(mod2.js, 2, 17)) +>ns : Symbol(ns, Decl(mod2.js, 1, 5), Decl(mod2.js, 1, 14)) + + diff --git a/tests/baselines/reference/typedefCrossModule3.types b/tests/baselines/reference/typedefCrossModule3.types new file mode 100644 index 0000000000000..9d3767dcbbaba --- /dev/null +++ b/tests/baselines/reference/typedefCrossModule3.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/jsdoc/mod2.js === +/** @typedef {number} Foo */ +const ns = {}; +>ns : { [x: string]: any; Foo: typeof Foo; } +>{} : { [x: string]: any; Foo: typeof Foo; } + +ns.Foo = class {} +>ns.Foo = class {} : typeof Foo +>ns.Foo : typeof Foo +>ns : { [x: string]: any; Foo: typeof Foo; } +>Foo : typeof Foo +>class {} : typeof Foo + +module.exports = ns; +>module.exports = ns : { [x: string]: any; Foo: typeof Foo; } +>module.exports : any +>module : any +>exports : any +>ns : { [x: string]: any; Foo: typeof Foo; } + + diff --git a/tests/baselines/reference/typedefCrossModule4.errors.txt b/tests/baselines/reference/typedefCrossModule4.errors.txt new file mode 100644 index 0000000000000..37696843b34aa --- /dev/null +++ b/tests/baselines/reference/typedefCrossModule4.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/jsdoc/mod3.js(1,5): error TS2300: Duplicate identifier 'Foo'. +tests/cases/conformance/jsdoc/mod3.js(3,20): error TS2300: Duplicate identifier 'Foo'. + + +==== tests/cases/conformance/jsdoc/mod3.js (2 errors) ==== + /** @typedef {number} Foo */ + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'Foo'. + class Bar { } + module.exports = { Foo: Bar }; + ~~~~~~~~ +!!! error TS2300: Duplicate identifier 'Foo'. + + \ No newline at end of file diff --git a/tests/baselines/reference/typedefCrossModule4.symbols b/tests/baselines/reference/typedefCrossModule4.symbols new file mode 100644 index 0000000000000..aa478df301a9c --- /dev/null +++ b/tests/baselines/reference/typedefCrossModule4.symbols @@ -0,0 +1,12 @@ +=== tests/cases/conformance/jsdoc/mod3.js === +/** @typedef {number} Foo */ +class Bar { } +>Bar : Symbol(Bar, Decl(mod3.js, 0, 0)) + +module.exports = { Foo: Bar }; +>module : Symbol(export=, Decl(mod3.js, 1, 13)) +>exports : Symbol(export=, Decl(mod3.js, 1, 13)) +>Foo : Symbol(Foo, Decl(mod3.js, 2, 18)) +>Bar : Symbol(Bar, Decl(mod3.js, 0, 0)) + + diff --git a/tests/baselines/reference/typedefCrossModule4.types b/tests/baselines/reference/typedefCrossModule4.types new file mode 100644 index 0000000000000..a0d14942ef3b5 --- /dev/null +++ b/tests/baselines/reference/typedefCrossModule4.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/jsdoc/mod3.js === +/** @typedef {number} Foo */ +class Bar { } +>Bar : Bar + +module.exports = { Foo: Bar }; +>module.exports = { Foo: Bar } : { [x: string]: any; Foo: typeof Bar; } +>module.exports : any +>module : any +>exports : any +>{ Foo: Bar } : { [x: string]: any; Foo: typeof Bar; } +>Foo : typeof Bar +>Bar : typeof Bar + + diff --git a/tests/baselines/reference/varRequireFromJavascript.errors.txt b/tests/baselines/reference/varRequireFromJavascript.errors.txt deleted file mode 100644 index 29b1afe34205c..0000000000000 --- a/tests/baselines/reference/varRequireFromJavascript.errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -tests/cases/conformance/salsa/use.js(1,10): error TS2304: Cannot find name 'require'. - - -==== tests/cases/conformance/salsa/use.js (1 errors) ==== - var ex = require('./ex') - ~~~~~~~ -!!! error TS2304: Cannot find name 'require'. - - // values work - var crunch = new ex.Crunch(1); - crunch.n - - - // types work - /** - * @param {ex.Crunch} wrap - */ - function f(wrap) { - wrap.n - } - -==== tests/cases/conformance/salsa/ex.js (0 errors) ==== - export class Crunch { - /** @param {number} n */ - constructor(n) { - this.n = n - } - m() { - return this.n - } - } - \ No newline at end of file diff --git a/tests/baselines/reference/varRequireFromJavascript.symbols b/tests/baselines/reference/varRequireFromJavascript.symbols index e892ed6bcb9fe..03a2a2516dee2 100644 --- a/tests/baselines/reference/varRequireFromJavascript.symbols +++ b/tests/baselines/reference/varRequireFromJavascript.symbols @@ -1,6 +1,7 @@ === tests/cases/conformance/salsa/use.js === var ex = require('./ex') >ex : Symbol(ex, Decl(use.js, 0, 3)) +>require : Symbol(require) >'./ex' : Symbol("tests/cases/conformance/salsa/ex", Decl(ex.js, 0, 0)) // values work diff --git a/tests/baselines/reference/varRequireFromTypescript.errors.txt b/tests/baselines/reference/varRequireFromTypescript.errors.txt deleted file mode 100644 index 39172d6f33d33..0000000000000 --- a/tests/baselines/reference/varRequireFromTypescript.errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -tests/cases/conformance/salsa/use.js(1,10): error TS2304: Cannot find name 'require'. - - -==== tests/cases/conformance/salsa/use.js (1 errors) ==== - var ex = require('./ex') - ~~~~~~~ -!!! error TS2304: Cannot find name 'require'. - - // values work - var crunch = new ex.Crunch(1); - crunch.n - - - // types work - /** - * @param {ex.Greatest} greatest - * @param {ex.Crunch} wrap - */ - function f(greatest, wrap) { - greatest.day - wrap.n - } - -==== tests/cases/conformance/salsa/ex.d.ts (0 errors) ==== - export type Greatest = { day: 1 } - export class Crunch { - n: number - m(): number - constructor(n: number) - } - \ No newline at end of file diff --git a/tests/baselines/reference/varRequireFromTypescript.symbols b/tests/baselines/reference/varRequireFromTypescript.symbols index f8e1223c46e46..70c918aba056c 100644 --- a/tests/baselines/reference/varRequireFromTypescript.symbols +++ b/tests/baselines/reference/varRequireFromTypescript.symbols @@ -1,6 +1,7 @@ === tests/cases/conformance/salsa/use.js === var ex = require('./ex') >ex : Symbol(ex, Decl(use.js, 0, 3)) +>require : Symbol(require) >'./ex' : Symbol("tests/cases/conformance/salsa/ex", Decl(ex.d.ts, 0, 0)) // values work diff --git a/tests/cases/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.ts b/tests/cases/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.ts new file mode 100644 index 0000000000000..c7e5a723bdff3 --- /dev/null +++ b/tests/cases/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.ts @@ -0,0 +1,10 @@ +// @lib: es6 +class A { + static readonly p1 = Symbol(); + static readonly p2 = Symbol(); + // All of the below should be out of scope or TDZ - `A` has not finished being constructed as they are executed + static readonly [A.p1] = 0; + static [A.p2]() { return 0 }; + [A.p1]() { } + [A.p2] = 0 +} diff --git a/tests/cases/compiler/controlFlowNullTypeAndLiteral.ts b/tests/cases/compiler/controlFlowNullTypeAndLiteral.ts new file mode 100644 index 0000000000000..ee66f441f1427 --- /dev/null +++ b/tests/cases/compiler/controlFlowNullTypeAndLiteral.ts @@ -0,0 +1,25 @@ +// @strict: true + +// Repros from #23771 + +const myNull: null = null; +const objWithValMaybeNull: { val: number | null } = { val: 1 }; +const addOne = function (num: number) { + return num + 1; +} + +if (objWithValMaybeNull.val !== null) + addOne(objWithValMaybeNull.val); +if (objWithValMaybeNull.val !== myNull) + addOne(objWithValMaybeNull.val); + +if (objWithValMaybeNull.val === null) + addOne(objWithValMaybeNull.val); // Error +if (objWithValMaybeNull.val === myNull) + addOne(objWithValMaybeNull.val); // Error + +function f(x: number | null) { + if(x === myNull) { + const s: string = x; // Error + } +} diff --git a/tests/cases/compiler/doubleMixinConditionalTypeBaseClassWorks.ts b/tests/cases/compiler/doubleMixinConditionalTypeBaseClassWorks.ts new file mode 100644 index 0000000000000..616e5f56b3fd9 --- /dev/null +++ b/tests/cases/compiler/doubleMixinConditionalTypeBaseClassWorks.ts @@ -0,0 +1,8 @@ +type Constructor = new (...args: any[]) => {}; + +const Mixin1 = (Base: C) => class extends Base { private _fooPrivate: {}; } + +type FooConstructor = typeof Mixin1 extends (a: Constructor) => infer Cls ? Cls : never; +const Mixin2 = (Base: C) => class extends Base {}; + +class C extends Mixin2(Mixin1(Object)) {} \ No newline at end of file diff --git a/tests/cases/compiler/emptyArrayDestructuringExpressionVisitedByTransformer.ts b/tests/cases/compiler/emptyArrayDestructuringExpressionVisitedByTransformer.ts new file mode 100644 index 0000000000000..01ad2d611223e --- /dev/null +++ b/tests/cases/compiler/emptyArrayDestructuringExpressionVisitedByTransformer.ts @@ -0,0 +1,2 @@ +var a = [] = [1].map(_ => _); +var b = [1].map(_ => _); \ No newline at end of file diff --git a/tests/cases/compiler/lateBoundDestructuringImplicitAnyError.ts b/tests/cases/compiler/lateBoundDestructuringImplicitAnyError.ts new file mode 100644 index 0000000000000..800675c7823f7 --- /dev/null +++ b/tests/cases/compiler/lateBoundDestructuringImplicitAnyError.ts @@ -0,0 +1,30 @@ +// @lib: es6 +// @noImplicitAny: true +let named = "foo"; +let {[named]: prop} = {prop: "foo"}; +void prop; + +const numIndexed: {[idx: number]: string} = null as any; +const strIndexed: {[idx: string]: string} = null as any; + +let numed = 6; + +const symed = Symbol(); +let symed2 = Symbol(); + +let {[named]: prop2} = numIndexed; +void prop2; +let {[numed]: prop3} = numIndexed; +void prop3; +let {[named]: prop4} = strIndexed; +void prop4; +let {[numed]: prop5} = strIndexed; +void prop5; +let {[symed]: prop6} = numIndexed; +void prop6; +let {[symed]: prop7} = strIndexed; +void prop7; +let {[symed2]: prop8} = numIndexed; +void prop8; +let {[symed2]: prop9} = strIndexed; +void prop9; \ No newline at end of file diff --git a/tests/cases/compiler/optionsStrictPropertyInitializationStrictNullChecks.ts b/tests/cases/compiler/optionsStrictPropertyInitializationStrictNullChecks.ts new file mode 100644 index 0000000000000..53afb64ccd4a4 --- /dev/null +++ b/tests/cases/compiler/optionsStrictPropertyInitializationStrictNullChecks.ts @@ -0,0 +1,3 @@ +// @strictPropertyInitialization: true + +var x; diff --git a/tests/cases/compiler/switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts b/tests/cases/compiler/switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts new file mode 100644 index 0000000000000..2d3ebdd1e2a1d --- /dev/null +++ b/tests/cases/compiler/switchCaseNarrowsMatchingClausesEvenWhenNonMatchingClausesExist.ts @@ -0,0 +1,40 @@ +export const narrowToLiterals = (str: string) => { + switch (str) { + case 'abc': { + // inferred type as `abc` + return str; + } + default: + return 'defaultValue'; + } + }; + + export const narrowToString = (str: string, someOtherStr: string) => { + switch (str) { + case 'abc': { + // inferred type should be `abc` + return str; + } + case someOtherStr: { + // `string` + return str; + } + default: + return 'defaultValue'; + } + }; + + export const narrowToStringOrNumber = (str: string | number, someNumber: number) => { + switch (str) { + case 'abc': { + // inferred type should be `abc` + return str; + } + case someNumber: { + // inferred type should be `number` + return str; + } + default: + return 'defaultValue'; + } + }; \ No newline at end of file diff --git a/tests/cases/conformance/es2019/importMeta/importMeta.ts b/tests/cases/conformance/es2019/importMeta/importMeta.ts new file mode 100644 index 0000000000000..71d635a6534cc --- /dev/null +++ b/tests/cases/conformance/es2019/importMeta/importMeta.ts @@ -0,0 +1,42 @@ + +// @target: esnext +// @module: esnext +// @lib: es5,dom + +// @Filename: example.ts +// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example +(async () => { + const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); + const blob = await response.blob(); + + const size = import.meta.scriptElement.dataset.size || 300; + + const image = new Image(); + image.src = URL.createObjectURL(blob); + image.width = image.height = size; + + document.body.appendChild(image); +})(); + +// @Filename: moduleLookingFile01.ts +export let x = import.meta; +export let y = import.metal; +export let z = import.import.import.malkovich; + +// @Filename: scriptLookingFile01.ts +let globalA = import.meta; +let globalB = import.metal; +let globalC = import.import.import.malkovich; + +// @Filename: assignmentTargets.ts +export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta; +import.meta = foo; + +// @Filename augmentations.ts +declare global { + interface ImportMeta { + wellKnownProperty: { a: number, b: string, c: boolean }; + } +} + +const { a, b, c } = import.meta.wellKnownProperty; \ No newline at end of file diff --git a/tests/cases/conformance/es2019/importMeta/importMetaES5.ts b/tests/cases/conformance/es2019/importMeta/importMetaES5.ts new file mode 100644 index 0000000000000..b11a32ecc9b22 --- /dev/null +++ b/tests/cases/conformance/es2019/importMeta/importMetaES5.ts @@ -0,0 +1,42 @@ + +// @target: es5 +// @module: commonjs +// @lib: es5,dom + +// @Filename: example.ts +// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example +(async () => { + const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); + const blob = await response.blob(); + + const size = import.meta.scriptElement.dataset.size || 300; + + const image = new Image(); + image.src = URL.createObjectURL(blob); + image.width = image.height = size; + + document.body.appendChild(image); +})(); + +// @Filename: moduleLookingFile01.ts +export let x = import.meta; +export let y = import.metal; +export let z = import.import.import.malkovich; + +// @Filename: scriptLookingFile01.ts +let globalA = import.meta; +let globalB = import.metal; +let globalC = import.import.import.malkovich; + +// @Filename: assignmentTargets.ts +export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta; +import.meta = foo; + +// @Filename augmentations.ts +declare global { + interface ImportMeta { + wellKnownProperty: { a: number, b: string, c: boolean }; + } +} + +const { a, b, c } = import.meta.wellKnownProperty; \ No newline at end of file diff --git a/tests/cases/conformance/jsdoc/jsdocTypeFromChainedAssignment2.ts b/tests/cases/conformance/jsdoc/jsdocTypeFromChainedAssignment2.ts index d44f014464fce..ba0647e964783 100644 --- a/tests/cases/conformance/jsdoc/jsdocTypeFromChainedAssignment2.ts +++ b/tests/cases/conformance/jsdoc/jsdocTypeFromChainedAssignment2.ts @@ -2,12 +2,7 @@ // @allowJs: true // @checkJs: true // @noImplicitAny: true -// @Filename: types.d.ts -declare function require(name: string): any; -declare var exports: any; -declare var module: { exports: any }; // @Filename: mod.js -/// /** @param {number} n */ exports.f = exports.g = function fg(n) { @@ -19,7 +14,6 @@ module.exports.h = module.exports.i = function hi(mom) { } // @Filename: use.js -/// var mod = require('./mod'); mod.f('no') mod.g('also no') diff --git a/tests/cases/conformance/jsdoc/typedefCrossModule.ts b/tests/cases/conformance/jsdoc/typedefCrossModule.ts new file mode 100644 index 0000000000000..772a41da7bf82 --- /dev/null +++ b/tests/cases/conformance/jsdoc/typedefCrossModule.ts @@ -0,0 +1,44 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @Filename: commonjs.d.ts +declare var module: { exports: any}; +// @Filename: mod1.js +/// +/** @typedef {{ type: "a", x: 1 }} A */ +/** @typedef {{ type: "b", y: 1 }} B */ +/** @typedef {A | B} Both */ +module.exports = C +function C() { + this.p = 1 +} + +// @Filename: mod2.js +/// +/** @typedef {{ type: "a", x: 1 }} A */ +/** @typedef {{ type: "b", y: 1 }} B */ +/** @typedef {A | B} Both */ + +export function C() { + this.p = 1 +} + +// @Filename: mod3.js +/// +/** @typedef {{ type: "a", x: 1 }} A */ +/** @typedef {{ type: "b", y: 1 }} B */ +/** @typedef {A | B} Both */ + +exports.C = function() { + this.p = 1 +} + +// @Filename: use.js +/** @type {import('./mod1').Both} */ +var both1 = { type: 'a', x: 1 }; +/** @type {import('./mod2').Both} */ +var both2 = both1; +/** @type {import('./mod3').Both} */ +var both3 = both2; + + diff --git a/tests/cases/conformance/jsdoc/typedefCrossModule2.ts b/tests/cases/conformance/jsdoc/typedefCrossModule2.ts new file mode 100644 index 0000000000000..6bb00957ef396 --- /dev/null +++ b/tests/cases/conformance/jsdoc/typedefCrossModule2.ts @@ -0,0 +1,39 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @Filename: mod1.js + +// error + +/** @typedef {number} Foo */ +class Foo { } // should error + +/** @typedef {number} Bar */ +exports.Bar = class { } + +/** @typedef {number} Baz */ +module.exports = { + Baz: class { } +} + +// ok + +/** @typedef {number} Qux */ +var Qux = 2; + +/** @typedef {number} Quid */ +exports.Quid = 2; + +/** @typedef {number} Quack */ +module.exports = { + Quack: 2 +} + +// @Filename: use.js + +var mod = require('./mod1.js'); +/** @type {import("./mod1.js").Baz} */ +var b; +/** @type {mod.Baz} */ +var bb; +var bbb = new mod.Baz(); diff --git a/tests/cases/conformance/jsdoc/typedefCrossModule3.ts b/tests/cases/conformance/jsdoc/typedefCrossModule3.ts new file mode 100644 index 0000000000000..d6005b541dcb7 --- /dev/null +++ b/tests/cases/conformance/jsdoc/typedefCrossModule3.ts @@ -0,0 +1,10 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @Filename: mod2.js + +/** @typedef {number} Foo */ +const ns = {}; +ns.Foo = class {} +module.exports = ns; + diff --git a/tests/cases/conformance/jsdoc/typedefCrossModule4.ts b/tests/cases/conformance/jsdoc/typedefCrossModule4.ts new file mode 100644 index 0000000000000..09d27246c7c8f --- /dev/null +++ b/tests/cases/conformance/jsdoc/typedefCrossModule4.ts @@ -0,0 +1,9 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @Filename: mod3.js + +/** @typedef {number} Foo */ +class Bar { } +module.exports = { Foo: Bar }; + diff --git a/tests/cases/conformance/types/intersection/intersectionReduction.ts b/tests/cases/conformance/types/intersection/intersectionReduction.ts new file mode 100644 index 0000000000000..b3b8950c33064 --- /dev/null +++ b/tests/cases/conformance/types/intersection/intersectionReduction.ts @@ -0,0 +1,15 @@ +// @strict + +declare const sym1: unique symbol; +declare const sym2: unique symbol; + +type T1 = string & 'a'; // 'a' +type T2 = 'a' & string & 'b'; // 'a' & 'b' +type T3 = number & 10; // 10 +type T4 = 10 & number & 20; // 10 & 20 +type T5 = symbol & typeof sym1; // typeof sym1 +type T6 = typeof sym1 & symbol & typeof sym2; // typeof sym1 & typeof sym2 +type T7 = string & 'a' & number & 10 & symbol & typeof sym1; // 'a' & 10 & typeof sym1 + +type T10 = string & ('a' | 'b'); // 'a' | 'b' +type T11 = (string | number) & ('a' | 10); // 'a' | 10 diff --git a/tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts b/tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts new file mode 100644 index 0000000000000..278d72595cd65 --- /dev/null +++ b/tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts @@ -0,0 +1,36 @@ +// @strict: true + +function f1(x: T & U) { + // Combined constraint of 'T & U' is 'string | number' + let y: string | number = x; +} + +function f2(x: T & U) { + let y1: string | number = x; // Error + let y2: string | null = x; // Error + let y3: string | undefined = x; + let y4: number | null = x; // Error + let y5: number | undefined = x; // Error + let y6: null | undefined = x; // Error +} + +type T1 = (string | number | undefined) & (string | null | undefined); // string | undefined + +function f3(x: T & (number | object | undefined)) { + const y: number | undefined = x; +} + +function f4(x: T & (number | object)) { + const y: number = x; +} + +function f5(x: keyof T & U) { + let y: keyof any = x; +} + +// Repro from #23648 + +type Example = { [K in keyof T]: K extends keyof U ? UnexpectedError : NoErrorHere } + +type UnexpectedError = T +type NoErrorHere = T diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts index 03d4ae01ea1fa..83687e8c87251 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts @@ -321,6 +321,20 @@ function f90(x1: S2[keyof S2], x2: T[keyof S2] x4.length; } +function f91(x: T, y: T[keyof T], z: T[K]) { + let a: {}; + a = x; + a = y; + a = z; +} + +function f92(x: T, y: T[keyof T], z: T[K]) { + let a: {} | null | undefined; + a = x; + a = y; + a = z; +} + // Repros from #12011 class Base { @@ -568,6 +582,15 @@ type Predicates = { [T in keyof TaggedRecord]: (variant: TaggedRecord[keyof TaggedRecord]) => variant is TaggedRecord[T] } +// Repros from #23592 + +type Example = { [K in keyof T]: T[K]["prop"] }; +type Result = Example<{ a: { prop: string }; b: { prop: number } }>; + +type Helper2 = { [K in keyof T]: Extract }; +type Example2 = { [K in keyof Helper2]: Helper2[K]["prop"] }; +type Result2 = Example2<{ 1: { prop: string }; 2: { prop: number } }>; + // Repro from #23618 type DBBoolTable = { [k in K]: 0 | 1 } @@ -585,3 +608,24 @@ type DynamicDBRecord = ({ dynamicField: number } | { dynami function getFlagsFromDynamicRecord(record: DynamicDBRecord, flags: Flag[]) { return record[flags[0]]; } + +// Repro from #21368 + +interface I { + foo: string; +} + +declare function take(p: T): void; + +function fn(o: T, k: K) { + take<{} | null | undefined>(o[k]); + take(o[k]); +} + +// Repro from #23133 + +class Unbounded { + foo(x: T[keyof T]) { + let y: {} | undefined | null = x; + } +} diff --git a/tests/cases/conformance/types/rest/objectRestReadonly.ts b/tests/cases/conformance/types/rest/objectRestReadonly.ts new file mode 100644 index 0000000000000..be6006203481b --- /dev/null +++ b/tests/cases/conformance/types/rest/objectRestReadonly.ts @@ -0,0 +1,16 @@ +// #23734 +type ObjType = { + foo: string + baz: string + quux: string +} + +const obj: Readonly = { + foo: 'bar', + baz: 'qux', + quux: 'quuz', +} + +const { foo, ...rest } = obj + +delete rest.baz diff --git a/tests/cases/fourslash/codeFixRequireInTs.ts b/tests/cases/fourslash/codeFixRequireInTs.ts new file mode 100644 index 0000000000000..345b15f69f250 --- /dev/null +++ b/tests/cases/fourslash/codeFixRequireInTs.ts @@ -0,0 +1,15 @@ +/// + +// @Filename: /a.ts +////const a = [|require("a")|]; + +verify.getSuggestionDiagnostics([{ + message: "'require' call may be converted to an import.", + code: 80005, +}]); + +verify.codeFix({ + description: "Convert 'require' to 'import'", + newFileContent: +`import a = require("a");`, +}); diff --git a/tests/cases/fourslash/codeFixRequireInTs_all.ts b/tests/cases/fourslash/codeFixRequireInTs_all.ts new file mode 100644 index 0000000000000..9f9fe4824a8f5 --- /dev/null +++ b/tests/cases/fourslash/codeFixRequireInTs_all.ts @@ -0,0 +1,13 @@ +/// + +// @Filename: /a.ts +////const a = [|require("a")|]; +////const b = [|require("b")|]; + +verify.codeFixAll({ + fixId: "requireInTs", + fixAllDescription: "Convert all 'require' to 'import'", + newFileContent: +`import a = require("a"); +import b = require("b");`, +}); diff --git a/tests/cases/fourslash/codeFixRequireInTs_allowSyntheticDefaultImports.ts b/tests/cases/fourslash/codeFixRequireInTs_allowSyntheticDefaultImports.ts new file mode 100644 index 0000000000000..949387af2e542 --- /dev/null +++ b/tests/cases/fourslash/codeFixRequireInTs_allowSyntheticDefaultImports.ts @@ -0,0 +1,11 @@ +/// + +// @allowSyntheticDefaultImports: true + +// @Filename: /a.ts +////const a = [|require("a")|]; + +verify.codeFix({ + description: "Convert 'require' to 'import'", + newFileContent: `import a from "a";`, +}); diff --git a/tests/cases/fourslash/findAllRefsClassExpression2.ts b/tests/cases/fourslash/findAllRefsClassExpression2.ts index f25e64a2c68e8..1214e3f7c8856 100644 --- a/tests/cases/fourslash/findAllRefsClassExpression2.ts +++ b/tests/cases/fourslash/findAllRefsClassExpression2.ts @@ -10,7 +10,7 @@ ////[|A|]; const [r0, r1, r2] = test.ranges(); -const defs = { definition: "(property) A: typeof A", ranges: [r0] }; -const imports = { definition: "(alias) (property) A: typeof A\nimport A", ranges: [r1, r2] }; +const defs = { definition: "class A\n(property) A: typeof A", ranges: [r0] }; +const imports = { definition: "(alias) class A\n(alias) (property) A: typeof A\nimport A", ranges: [r1, r2] }; verify.referenceGroups([r0], [defs, imports]); verify.referenceGroups([r1, r2], [imports, defs]); diff --git a/tests/cases/fourslash/formatNoSpaceBetweenClosingParenAndTemplateString.ts b/tests/cases/fourslash/formatNoSpaceBetweenClosingParenAndTemplateString.ts new file mode 100644 index 0000000000000..259252b6cb0b3 --- /dev/null +++ b/tests/cases/fourslash/formatNoSpaceBetweenClosingParenAndTemplateString.ts @@ -0,0 +1,12 @@ +/// + +//// foo() `abc`; +//// bar()`def`; +//// baz()`a${x}b`; + +format.document(); +verify.currentFileContentIs( +`foo()\`abc\`; +bar()\`def\`; +baz()\`a\${x}b\`;` +); diff --git a/tests/cases/fourslash/refactorConvertToEs6Module_export_named.ts b/tests/cases/fourslash/refactorConvertToEs6Module_export_named.ts index e7ee290858038..f8eba2b02134b 100644 --- a/tests/cases/fourslash/refactorConvertToEs6Module_export_named.ts +++ b/tests/cases/fourslash/refactorConvertToEs6Module_export_named.ts @@ -21,7 +21,9 @@ verify.codeFix({ description: "Convert to ES6 module", newFileContent: `export function f() {} -export class C {} +const _C = class { +}; +export { _C as C }; export const x = 0; export function a1() {} export function a2() { return 0; } diff --git a/tests/cases/fourslash/refactorConvertToEs6Module_export_namedClassExpression.ts b/tests/cases/fourslash/refactorConvertToEs6Module_export_namedClassExpression.ts index e1cb86e8d682e..47b8a5e0b32cf 100644 --- a/tests/cases/fourslash/refactorConvertToEs6Module_export_namedClassExpression.ts +++ b/tests/cases/fourslash/refactorConvertToEs6Module_export_namedClassExpression.ts @@ -10,6 +10,12 @@ verify.codeFix({ description: "Convert to ES6 module", newFileContent: -`export const C = class E { static instance = new E(); } -export class D { static instance = new D(); }`, +`const _C = class E { + static instance = new E(); +}; +export { _C as C }; +const _D = class D { + static instance = new D(); +}; +export { _D as D };`, }); diff --git a/tests/cases/fourslash/refactorConvertToEs6Module_expressionToDeclaration.ts b/tests/cases/fourslash/refactorConvertToEs6Module_expressionToDeclaration.ts index 47ff26f459ed2..b360334767f9e 100644 --- a/tests/cases/fourslash/refactorConvertToEs6Module_expressionToDeclaration.ts +++ b/tests/cases/fourslash/refactorConvertToEs6Module_expressionToDeclaration.ts @@ -11,5 +11,8 @@ verify.codeFix({ description: "Convert to ES6 module", newFileContent: `export async function* f(p) { p; } -export class C extends D { m() {} }`, +const _C = class C extends D { + m() { } +}; +export { _C as C };`, });