diff --git a/.eslintrc.json b/.eslintrc.json index 0bdba32ded5..affed4dbc01 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -17,7 +17,9 @@ "@typescript-eslint/adjacent-overload-signatures": "error", "@typescript-eslint/array-type": "error", - "camelcase": "off", + "brace-style": "off", + "@typescript-eslint/brace-style": ["error", "stroustrup", { "allowSingleLine": true }], + "@typescript-eslint/naming-convention": [ "error", { "selector": "typeLike", "format": ["PascalCase"], "filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false } }, @@ -32,6 +34,10 @@ ], "@typescript-eslint/consistent-type-definitions": ["error", "interface"], + + "no-duplicate-imports": "off", + "@typescript-eslint/no-duplicate-imports": "error", + "@typescript-eslint/no-inferrable-types": "error", "@typescript-eslint/no-misused-new": "error", "@typescript-eslint/no-this-alias": "error", @@ -86,7 +92,6 @@ "jsdoc/check-alignment": "error", // eslint - "brace-style": ["error", "stroustrup", { "allowSingleLine": true }], "constructor-super": "error", "curly": ["error", "multi-line"], "dot-notation": "error", @@ -95,7 +100,6 @@ "new-parens": "error", "no-caller": "error", "no-duplicate-case": "error", - "no-duplicate-imports": "error", "no-empty": "error", "no-eval": "error", "no-extra-bind": "error", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89d895e5d8c..ae0e4fbdaa9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,6 +42,9 @@ jobs: - name: Linter run: npm run lint:ci + - name: Adding playwright + run: npm install --no-save --no-package-lock playwright + - name: Validate the browser can import TypeScript run: gulp test-browser-integration diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 24c3ed774f3..abe704bb564 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -22,7 +22,7 @@ jobs: - name: Setup and publish nightly run: | npm whoami - npm i + npm ci gulp configure-nightly gulp LKG gulp runtests-parallel diff --git a/README.md b/README.md index bb0452217c1..0b4478e1845 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,8 @@ There are many ways to [contribute](https://github.com/microsoft/TypeScript/blob * Help each other in the [TypeScript Community Discord](https://discord.gg/typescript). * Join the [#typescript](https://twitter.com/search?q=%23TypeScript) discussion on Twitter. * [Contribute bug fixes](https://github.com/microsoft/TypeScript/blob/master/CONTRIBUTING.md). -* Read the language specification ([docx](https://github.com/microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.docx?raw=true), - [pdf](https://github.com/microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.pdf?raw=true), [md](https://github.com/microsoft/TypeScript/blob/master/doc/spec.md)). +* Read the archived language specification ([docx](https://github.com/microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification%20-%20ARCHIVED.docx?raw=true), + [pdf](https://github.com/microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification%20-%20ARCHIVED.pdf?raw=true), [md](https://github.com/microsoft/TypeScript/blob/master/doc/spec-archived.md)). This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) @@ -78,8 +78,6 @@ gulp LKG # Replace the last known good with the built one. # Bootstrapping step to be executed when the built compiler reaches a stable state. gulp tests # Build the test infrastructure using the built compiler. gulp runtests # Run tests using the built compiler and test infrastructure. - # Some low-value tests are skipped when not on a CI machine - you can use the - # --skipPercent=0 command to override this behavior and run all tests locally. # You can override the specific suite runner used or specify a test for this command. # Use --tests= for a specific test and/or --runner= for a specific suite. # Valid runners include conformance, compiler, fourslash, project, user, and docker diff --git a/package-lock.json b/package-lock.json index 97940b9dab1..af6c8e9c8ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -141,6 +141,41 @@ "tslib": "^1.9.3" } }, + "@eslint/eslintrc": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.2.1.tgz", + "integrity": "sha512-XRUeBZ5zBWLYgSANMpThFddrZZkEbGHgUdt5UJjZfnlN9BGCiUBrf+nvbRupSjMvqzwnQN0qwCmOxITt1cfywA==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "lodash": "^4.17.19", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "debug": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + } + } + }, "@gulp-sourcemaps/identity-map": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@gulp-sourcemaps/identity-map/-/identity-map-1.0.2.tgz", @@ -268,9 +303,9 @@ } }, "@octokit/endpoint": { - "version": "6.0.6", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.6.tgz", - "integrity": "sha512-7Cc8olaCoL/mtquB7j/HTbPM+sY6Ebr4k2X2y4JoXpVKQ7r5xB4iGQE0IoO58wIPsUk4AzoT65AMEpymSbWTgQ==", + "version": "6.0.8", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.8.tgz", + "integrity": "sha512-MuRrgv+bM4Q+e9uEvxAB/Kf+Sj0O2JAOBA131uo1o6lgdq1iS8ejKwtqHgdfY91V3rN9R/hdGKFiQYMzVzVBEQ==", "dev": true, "requires": { "@octokit/types": "^5.0.0", @@ -381,9 +416,9 @@ } }, "@types/chai": { - "version": "4.2.12", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.12.tgz", - "integrity": "sha512-aN5IAC8QNtSUdQzxu7lGBgYAOuU1tmRU4c9dIq5OKGf/SBVjXo+ffM2wEjudAWbgpOhy60nLoAGH1xm8fpCKFQ==", + "version": "4.2.14", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.14.tgz", + "integrity": "sha512-G+ITQPXkwTrslfG5L/BksmbLUA0M1iybEsmCWPqzSxsRRhJZimBKJkoMi8fr/CPygPTj4zO5pJH7I2/cm9M7SQ==", "dev": true }, "@types/color-name": { @@ -398,12 +433,6 @@ "integrity": "sha512-laiDIXqqthjJlyAMYAXOtN3N8+UlbM+KvZi4BaY5ZOekmVkBs/UxfK5O0HWeJVG2eW8F+Mu2ww13fTX+kY1FlQ==", "dev": true }, - "@types/eslint-visitor-keys": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", - "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==", - "dev": true - }, "@types/expect": { "version": "1.20.4", "resolved": "https://registry.npmjs.org/@types/expect/-/expect-1.20.4.tgz", @@ -496,9 +525,15 @@ } }, "@types/json-schema": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.5.tgz", - "integrity": "sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz", + "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==", + "dev": true + }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", "dev": true }, "@types/merge2": { @@ -511,9 +546,9 @@ } }, "@types/microsoft__typescript-etw": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@types/microsoft__typescript-etw/-/microsoft__typescript-etw-0.1.0.tgz", - "integrity": "sha512-ShankhBwAF3LZAkkby3w++HNhwPjWJDv0rSjrHNXO/Nlt/63mSZKNhfu99PNq+Nmyy1xGNknreKacpEuvpeWNA==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@types/microsoft__typescript-etw/-/microsoft__typescript-etw-0.1.1.tgz", + "integrity": "sha512-zdgHyZJEwbFKI6zhOqWPsNMhlrAk6qMrn9VMA6VQtRt/F+jNJKeaHIMysuO9oTLv0fWcli0gwUrMv8MeFyb3Sw==", "dev": true }, "@types/minimatch": { @@ -550,9 +585,9 @@ "dev": true }, "@types/node": { - "version": "14.10.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.10.2.tgz", - "integrity": "sha512-IzMhbDYCpv26pC2wboJ4MMOa9GKtjplXfcAqrMeNJpUUwpM/2ATt2w1JPUXwS6spu856TvKZL2AOmeU2rAxskw==", + "version": "14.14.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.2.tgz", + "integrity": "sha512-jeYJU2kl7hL9U5xuI/BhKPZ4vqGM/OmK6whiFAXVhlstzZhVamWhDSmHyGLIp+RVyuF9/d0dqr2P85aFj4BvJg==", "dev": true }, "@types/node-fetch": { @@ -650,12 +685,13 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.9.1.tgz", - "integrity": "sha512-XIr+Mfv7i4paEdBf0JFdIl9/tVxyj+rlilWIfZ97Be0lZ7hPvUbS5iHt9Glc8kRI53dsr0PcAEudbf8rO2wGgg==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.5.0.tgz", + "integrity": "sha512-mjb/gwNcmDKNt+6mb7Aj/TjKzIJjOPcoCJpjBQC9ZnTRnBt1p4q5dJSSmIqAtsZ/Pff5N+hJlbiPc5bl6QN4OQ==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "3.9.1", + "@typescript-eslint/experimental-utils": "4.5.0", + "@typescript-eslint/scope-manager": "4.5.0", "debug": "^4.1.1", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", @@ -664,58 +700,79 @@ }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", "dev": true, "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } } } }, "@typescript-eslint/experimental-utils": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.9.1.tgz", - "integrity": "sha512-lkiZ8iBBaYoyEKhCkkw4SAeatXyBq9Ece5bZXdLe1LWBUwTszGbmbiqmQbwWA8cSYDnjWXp9eDbXpf9Sn0hLAg==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.5.0.tgz", + "integrity": "sha512-bW9IpSAKYvkqDGRZzayBXIgPsj2xmmVHLJ+flGSoN0fF98pGoKFhbunIol0VF2Crka7z984EEhFi623Rl7e6gg==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/types": "3.9.1", - "@typescript-eslint/typescript-estree": "3.9.1", + "@typescript-eslint/scope-manager": "4.5.0", + "@typescript-eslint/types": "4.5.0", + "@typescript-eslint/typescript-estree": "4.5.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" } }, "@typescript-eslint/parser": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.9.1.tgz", - "integrity": "sha512-y5QvPFUn4Vl4qM40lI+pNWhTcOWtpZAJ8pOEQ21fTTW4xTJkRplMjMRje7LYTXqVKKX9GJhcyweMz2+W1J5bMg==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.5.0.tgz", + "integrity": "sha512-xb+gmyhQcnDWe+5+xxaQk5iCw6KqXd8VQxGiTeELTMoYeRjpocZYYRP1gFVM2C8Yl0SpUvLa1lhprwqZ00w3Iw==", "dev": true, "requires": { - "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "3.9.1", - "@typescript-eslint/types": "3.9.1", - "@typescript-eslint/typescript-estree": "3.9.1", - "eslint-visitor-keys": "^1.1.0" + "@typescript-eslint/scope-manager": "4.5.0", + "@typescript-eslint/types": "4.5.0", + "@typescript-eslint/typescript-estree": "4.5.0", + "debug": "^4.1.1" + }, + "dependencies": { + "debug": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + } + } + }, + "@typescript-eslint/scope-manager": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.5.0.tgz", + "integrity": "sha512-C0cEO0cTMPJ/w4RA/KVe4LFFkkSh9VHoFzKmyaaDWAnPYIEzVCtJ+Un8GZoJhcvq+mPFXEsXa01lcZDHDG6Www==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.5.0", + "@typescript-eslint/visitor-keys": "4.5.0" } }, "@typescript-eslint/types": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.9.1.tgz", - "integrity": "sha512-15JcTlNQE1BsYy5NBhctnEhEoctjXOjOK+Q+rk8ugC+WXU9rAcS2BYhoh6X4rOaXJEpIYDl+p7ix+A5U0BqPTw==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.5.0.tgz", + "integrity": "sha512-n2uQoXnyWNk0Les9MtF0gCK3JiWd987JQi97dMSxBOzVoLZXCNtxFckVqt1h8xuI1ix01t+iMY4h4rFMj/303g==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.9.1.tgz", - "integrity": "sha512-IqM0gfGxOmIKPhiHW/iyAEXwSVqMmR2wJ9uXHNdFpqVvPaQ3dWg302vW127sBpAiqM9SfHhyS40NKLsoMpN2KA==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.5.0.tgz", + "integrity": "sha512-gN1mffq3zwRAjlYWzb5DanarOPdajQwx5MEWkWCk0XvqC8JpafDTeioDoow2L4CA/RkYZu7xEsGZRhqrTsAG8w==", "dev": true, "requires": { - "@typescript-eslint/types": "3.9.1", - "@typescript-eslint/visitor-keys": "3.9.1", + "@typescript-eslint/types": "4.5.0", + "@typescript-eslint/visitor-keys": "4.5.0", "debug": "^4.1.1", - "glob": "^7.1.6", + "globby": "^11.0.1", "is-glob": "^4.0.1", "lodash": "^4.17.15", "semver": "^7.3.2", @@ -723,25 +780,46 @@ }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", "dev": true, "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" + } + }, + "globby": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.1.tgz", + "integrity": "sha512-iH9RmgwCmUJHi2z5o2l3eTtGBtXek1OYlHrbcxOYugyHLmAsZrPj43OtHThd62Buh/Vv6VyCBD2bdyWcGNQqoQ==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" } } } }, "@typescript-eslint/visitor-keys": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.9.1.tgz", - "integrity": "sha512-zxdtUjeoSh+prCpogswMwVUJfEFmCOjdzK9rpNjNBfm6EyPt99x3RrJoBOGZO23FCt0WPKUCOL5mb/9D5LjdwQ==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.5.0.tgz", + "integrity": "sha512-UHq4FSa55NDZqscRU//O5ROFhHa9Hqn9KWTEvJGTArtTQp5GKv9Zqf6d/Q3YXXcFv4woyBml7fJQlQ+OuqRcHA==", "dev": true, "requires": { - "eslint-visitor-keys": "^1.1.0" + "@typescript-eslint/types": "4.5.0", + "eslint-visitor-keys": "^2.0.0" } }, + "@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, "JSONStream": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", @@ -759,15 +837,15 @@ "dev": true }, "acorn": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz", - "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==", + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "dev": true }, "acorn-jsx": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz", - "integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", + "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", "dev": true }, "acorn-node": { @@ -787,15 +865,6 @@ "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", "dev": true }, - "agent-base": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", - "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", - "dev": true, - "requires": { - "es6-promisify": "^5.0.0" - } - }, "aggregate-error": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", @@ -807,9 +876,9 @@ } }, "ajv": { - "version": "6.12.4", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.4.tgz", - "integrity": "sha512-eienB2c9qVQs2KWexhkrdMLVDoIQCz5KSeLxwg9Lzk4DOfBtIK9PQwwufcsn1jjGuf9WZmqPMbGxOzfcuphJCQ==", + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -843,23 +912,6 @@ "ansi-wrap": "0.1.0" } }, - "ansi-escapes": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", - "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", - "dev": true, - "requires": { - "type-fest": "^0.11.0" - }, - "dependencies": { - "type-fest": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", - "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", - "dev": true - } - } - }, "ansi-gray": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/ansi-gray/-/ansi-gray-0.1.1.tgz", @@ -987,6 +1039,12 @@ "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", "dev": true }, + "array-filter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz", + "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=", + "dev": true + }, "array-includes": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.1.tgz", @@ -1080,18 +1138,6 @@ "es-abstract": "^1.17.0-next.1" } }, - "array.prototype.map": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array.prototype.map/-/array.prototype.map-1.0.2.tgz", - "integrity": "sha512-Az3OYxgsa1g7xDYp86l0nnN4bcmuEITGe1rbdEBVkrqkzMgDcbdQ2R7r41pNzti+4NMces3H8gMmuioZUilLgw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "es-array-method-boxes-properly": "^1.0.0", - "is-string": "^1.0.4" - } - }, "asn1.js": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", @@ -1181,12 +1227,6 @@ "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", "dev": true }, - "async-limiter": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", - "dev": true - }, "async-settle": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/async-settle/-/async-settle-1.0.0.tgz", @@ -1214,6 +1254,15 @@ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", "dev": true }, + "available-typed-arrays": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz", + "integrity": "sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ==", + "dev": true, + "requires": { + "array-filter": "^1.0.0" + } + }, "azure-devops-node-api": { "version": "10.1.1", "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-10.1.1.tgz", @@ -1424,9 +1473,9 @@ "dev": true }, "browserify": { - "version": "16.5.2", - "resolved": "https://registry.npmjs.org/browserify/-/browserify-16.5.2.tgz", - "integrity": "sha512-TkOR1cQGdmXU9zW4YukWzWVSJwrxmNdADFbqbE3HFgQWe5wqZmOawqZ7J/8MPCwk/W8yY7Y0h+7mOtcZxLP23g==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/browserify/-/browserify-17.0.0.tgz", + "integrity": "sha512-SaHqzhku9v/j6XsQMRxPyBrSP3gnwmE27gLJYZgMT2GeK3J0+0toN+MnuNYDfHwVGQfLiMZ7KSNSIXHemy905w==", "dev": true, "requires": { "JSONStream": "^1.0.3", @@ -1441,31 +1490,31 @@ "constants-browserify": "~1.0.0", "crypto-browserify": "^3.0.0", "defined": "^1.0.0", - "deps-sort": "^2.0.0", + "deps-sort": "^2.0.1", "domain-browser": "^1.2.0", "duplexer2": "~0.1.2", - "events": "^2.0.0", + "events": "^3.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", + "insert-module-globals": "^7.2.1", "labeled-stream-splicer": "^2.0.0", "mkdirp-classic": "^0.5.2", "module-deps": "^6.2.3", "os-browserify": "~0.3.0", "parents": "^1.0.1", - "path-browserify": "~0.0.0", + "path-browserify": "^1.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", + "shasum-object": "^1.0.0", "shell-quote": "^1.6.1", - "stream-browserify": "^2.0.0", + "stream-browserify": "^3.0.0", "stream-http": "^3.0.0", "string_decoder": "^1.1.1", "subarg": "^1.0.0", @@ -1474,7 +1523,7 @@ "timers-browserify": "^1.0.1", "tty-browserify": "0.0.1", "url": "~0.11.0", - "util": "~0.10.1", + "util": "~0.12.0", "vm-browserify": "^1.0.0", "xtend": "^4.0.0" }, @@ -1489,11 +1538,12 @@ }, "dependencies": { "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.18.1.tgz", + "integrity": "sha512-lDfCPaMKfOJXjy0dPayzPdF1phampNWr3qFCjAu+rw/qbQmr5jWH5xN2hwh9QKfw9E5v4hwV7A+jrCmL8yjjqA==", "dev": true, "requires": { + "is-core-module": "^2.0.0", "path-parse": "^1.0.6" } } @@ -1621,12 +1671,6 @@ "ieee754": "^1.1.4" } }, - "buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", - "dev": true - }, "buffer-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz", @@ -1710,12 +1754,6 @@ "supports-color": "^7.1.0" } }, - "chardet": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", - "dev": true - }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -1781,21 +1819,6 @@ "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", "dev": true }, - "cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dev": true, - "requires": { - "restore-cursor": "^3.1.0" - } - }, - "cli-width": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", - "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", - "dev": true - }, "cliui": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", @@ -2271,7 +2294,6 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, "requires": { "object-keys": "^1.0.12" } @@ -2523,9 +2545,9 @@ } }, "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, "end-of-stream": { @@ -2537,6 +2559,23 @@ "once": "^1.4.0" } }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + }, + "dependencies": { + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + } + } + }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -2547,50 +2586,74 @@ } }, "es-abstract": { - "version": "1.17.6", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", - "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", + "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", "dev": true, "requires": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", - "is-regex": "^1.1.0", - "object-inspect": "^1.7.0", + "is-callable": "^1.2.2", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", "object-keys": "^1.1.1", - "object.assign": "^4.1.0", + "object.assign": "^4.1.1", "string.prototype.trimend": "^1.0.1", "string.prototype.trimstart": "^1.0.1" - } - }, - "es-array-method-boxes-properly": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", - "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", - "dev": true - }, - "es-get-iterator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.0.tgz", - "integrity": "sha512-UfrmHuWQlNMTs35e1ypnvikg6jCz3SK8v8ImvmDsh36fCVUR1MqoFDiyn0/k52C8NqO3YsO8Oe0azeesNuqSsQ==", - "dev": true, - "requires": { - "es-abstract": "^1.17.4", - "has-symbols": "^1.0.1", - "is-arguments": "^1.0.4", - "is-map": "^2.0.1", - "is-set": "^2.0.1", - "is-string": "^1.0.5", - "isarray": "^2.0.5" }, "dependencies": { - "isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true + "es-abstract": { + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + }, + "object.assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.1.tgz", + "integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==", + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.0", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + }, + "dependencies": { + "es-abstract": { + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + } + } } } }, @@ -2598,7 +2661,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, "requires": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", @@ -2627,21 +2689,6 @@ "es6-symbol": "^3.1.1" } }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", - "dev": true - }, - "es6-promisify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", - "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", - "dev": true, - "requires": { - "es6-promise": "^4.0.3" - } - }, "es6-symbol": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", @@ -2708,22 +2755,24 @@ } }, "eslint": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", - "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.12.1.tgz", + "integrity": "sha512-HlMTEdr/LicJfN08LB3nM1rRYliDXOmfoO4vj39xN6BLpFzF00hbwBoqHk8UcJ2M/3nlARZWy/mslvGEuZFvsg==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", + "@eslint/eslintrc": "^0.2.1", "ajv": "^6.10.0", - "chalk": "^2.1.0", - "cross-spawn": "^6.0.5", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", "debug": "^4.0.1", "doctrine": "^3.0.0", - "eslint-scope": "^5.0.0", - "eslint-utils": "^1.4.3", - "eslint-visitor-keys": "^1.1.0", - "espree": "^6.1.2", - "esquery": "^1.0.1", + "enquirer": "^2.3.5", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.0", + "esquery": "^1.2.0", "esutils": "^2.0.2", "file-entry-cache": "^5.0.1", "functional-red-black-tree": "^1.0.1", @@ -2732,77 +2781,42 @@ "ignore": "^4.0.6", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", - "inquirer": "^7.0.0", "is-glob": "^4.0.0", "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.3.0", - "lodash": "^4.17.14", + "levn": "^0.4.1", + "lodash": "^4.17.19", "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", - "optionator": "^0.8.3", + "optionator": "^0.9.1", "progress": "^2.0.0", - "regexpp": "^2.0.1", - "semver": "^6.1.2", - "strip-ansi": "^5.2.0", - "strip-json-comments": "^3.0.1", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", "table": "^5.2.3", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "dev": true, "requires": { - "color-convert": "^1.9.0" + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" } }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", "dev": true, "requires": { - "ms": "^2.1.1" - } - }, - "eslint-utils": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", - "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" + "ms": "2.1.2" } }, "glob-parent": { @@ -2814,70 +2828,91 @@ "is-glob": "^4.0.1" } }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, "requires": { - "minimist": "^1.2.5" + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" } }, - "regexpp": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", - "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", - "dev": true - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" } } } }, "eslint-formatter-autolinkable-stylish": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/eslint-formatter-autolinkable-stylish/-/eslint-formatter-autolinkable-stylish-1.1.2.tgz", - "integrity": "sha512-vgBkDdzxRsr6/NnWqv7I3MhBBNNIMAs+aGgkIrR2NYtgI4qKbeFlajPEgWdSS5wdQDNGPdtkaxZEvYUnw6wsAg==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/eslint-formatter-autolinkable-stylish/-/eslint-formatter-autolinkable-stylish-1.1.4.tgz", + "integrity": "sha512-aw8TKZLTiSMMstbfWNQiFZ0Em0sBW32NP8O8RUVPiF9kPjoYWg6M1lXcBr6MGijt39tmSFrdibgWQ2S6HYVsMA==", "dev": true, "requires": { - "chalk": "^3.0.0", - "plur": "^3.1.1" - }, - "dependencies": { - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - } + "chalk": "^4.1.0", + "plur": "^4.0.0" } }, "eslint-import-resolver-node": { @@ -2891,11 +2926,12 @@ }, "dependencies": { "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.18.1.tgz", + "integrity": "sha512-lDfCPaMKfOJXjy0dPayzPdF1phampNWr3qFCjAu+rw/qbQmr5jWH5xN2hwh9QKfw9E5v4hwV7A+jrCmL8yjjqA==", "dev": true, "requires": { + "is-core-module": "^2.0.0", "path-parse": "^1.0.6" } } @@ -2912,23 +2948,24 @@ } }, "eslint-plugin-import": { - "version": "2.20.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.20.2.tgz", - "integrity": "sha512-FObidqpXrR8OnCh4iNsxy+WACztJLXAHBO5hK79T1Hc77PgQZkyDGA5Ag9xAvRpglvLNxhH/zSmZ70/pZ31dHg==", + "version": "2.22.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", + "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==", "dev": true, "requires": { - "array-includes": "^3.0.3", - "array.prototype.flat": "^1.2.1", + "array-includes": "^3.1.1", + "array.prototype.flat": "^1.2.3", "contains-path": "^0.1.0", "debug": "^2.6.9", "doctrine": "1.5.0", - "eslint-import-resolver-node": "^0.3.2", - "eslint-module-utils": "^2.4.1", + "eslint-import-resolver-node": "^0.3.4", + "eslint-module-utils": "^2.6.0", "has": "^1.0.3", "minimatch": "^3.0.4", - "object.values": "^1.1.0", + "object.values": "^1.1.1", "read-pkg-up": "^2.0.0", - "resolve": "^1.12.0" + "resolve": "^1.17.0", + "tsconfig-paths": "^3.9.0" }, "dependencies": { "doctrine": { @@ -2942,45 +2979,40 @@ } }, "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.18.1.tgz", + "integrity": "sha512-lDfCPaMKfOJXjy0dPayzPdF1phampNWr3qFCjAu+rw/qbQmr5jWH5xN2hwh9QKfw9E5v4hwV7A+jrCmL8yjjqA==", "dev": true, "requires": { + "is-core-module": "^2.0.0", "path-parse": "^1.0.6" } } } }, "eslint-plugin-jsdoc": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-22.1.0.tgz", - "integrity": "sha512-54NdbICM7KrxsGUqQsev9aIMqPXyvyBx2218Qcm0TQ16P9CtBI+YY4hayJR6adrxlq4Ej0JLpgfUXWaQVFqmQg==", + "version": "30.7.6", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.7.6.tgz", + "integrity": "sha512-w18IOiS/9ahKgRfQOuHbce+EQYx3fwIkZhUZDEK+augNlhJkzgTSZkrBkzaflSbFNZ9/Tk4xzUABEaTbsBSzew==", "dev": true, "requires": { - "comment-parser": "^0.7.2", - "debug": "^4.1.1", - "jsdoctypeparser": "^6.1.0", - "lodash": "^4.17.15", - "regextras": "^0.7.0", - "semver": "^6.3.0", - "spdx-expression-parse": "^3.0.0" + "comment-parser": "^0.7.6", + "debug": "^4.2.0", + "jsdoctypeparser": "^9.0.0", + "lodash": "^4.17.20", + "regextras": "^0.7.1", + "semver": "^7.3.2", + "spdx-expression-parse": "^3.0.1" }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", "dev": true, "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true } } }, @@ -2991,12 +3023,12 @@ "dev": true }, "eslint-scope": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz", - "integrity": "sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, "requires": { - "esrecurse": "^4.1.0", + "esrecurse": "^4.3.0", "estraverse": "^4.1.1" } }, @@ -3007,23 +3039,39 @@ "dev": true, "requires": { "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } } }, "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", + "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", "dev": true }, "espree": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", - "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.0.tgz", + "integrity": "sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw==", "dev": true, "requires": { - "acorn": "^7.1.1", + "acorn": "^7.4.0", "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.1.0" + "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } } }, "esprima": { @@ -3050,12 +3098,20 @@ } }, "esrecurse": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", - "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, "requires": { - "estraverse": "^4.1.0" + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } } }, "estraverse": { @@ -3081,9 +3137,9 @@ } }, "events": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/events/-/events-2.1.0.tgz", - "integrity": "sha512-3Zmiobend8P9DjmKAty0Era4jV8oJ0yGYe2nJJAxgymF9+N8F2m0hhZiMoWtcfepExzNKZumFU3ksdQbInGWCg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz", + "integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==", "dev": true }, "evp_bytestokey": { @@ -3208,17 +3264,6 @@ } } }, - "external-editor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", - "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "dev": true, - "requires": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - } - }, "extglob": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", @@ -3284,29 +3329,6 @@ } } }, - "extract-zip": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", - "integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==", - "dev": true, - "requires": { - "concat-stream": "^1.6.2", - "debug": "^2.6.9", - "mkdirp": "^0.5.4", - "yauzl": "^2.10.0" - }, - "dependencies": { - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - } - } - }, "fancy-log": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.3.tgz", @@ -3420,24 +3442,6 @@ "reusify": "^1.0.4" } }, - "fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", - "dev": true, - "requires": { - "pend": "~1.2.0" - } - }, - "figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, "file-entry-cache": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", @@ -3529,21 +3533,10 @@ "dev": true }, "flat": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", - "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", - "dev": true, - "requires": { - "is-buffer": "~2.0.3" - }, - "dependencies": { - "is-buffer": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", - "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", - "dev": true - } - } + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true }, "flat-cache": { "version": "2.0.1", @@ -3598,6 +3591,12 @@ "for-in": "^1.0.1" } }, + "foreach": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", + "dev": true + }, "form-data": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", @@ -3672,8 +3671,7 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, "functional-red-black-tree": { "version": "1.0.1", @@ -4109,7 +4107,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, "requires": { "function-bind": "^1.1.1" } @@ -4123,8 +4120,7 @@ "has-symbols": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", - "dev": true + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==" }, "has-value": { "version": "1.0.0", @@ -4242,36 +4238,6 @@ "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", "dev": true }, - "https-proxy-agent": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-3.0.1.tgz", - "integrity": "sha512-+ML2Rbh6DAuee7d07tYGEKOEi2voWPUGan+ExdPbPW6Z3svq+JCqr0v8WmKPOkz1vOVykPCBSuobe7G8GJUtVg==", - "dev": true, - "requires": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, "ieee754": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", @@ -4285,9 +4251,9 @@ "dev": true }, "import-fresh": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", - "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.2.tgz", + "integrity": "sha512-cTPNrlvJT6twpYy+YmKUKrTSjWFs3bjYjAhCwm+z4EOCubZxAuO+hHpRN64TqjEaYSHs7tJAE0w1CKMGmsG/lw==", "dev": true, "requires": { "parent-module": "^1.0.0", @@ -4337,42 +4303,10 @@ "source-map": "~0.5.3" } }, - "inquirer": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", - "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==", - "dev": true, - "requires": { - "ansi-escapes": "^4.2.1", - "chalk": "^4.1.0", - "cli-cursor": "^3.1.0", - "cli-width": "^3.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.19", - "mute-stream": "0.0.8", - "run-async": "^2.4.0", - "rxjs": "^6.6.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6" - }, - "dependencies": { - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - } - } - }, "insert-module-globals": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.2.0.tgz", - "integrity": "sha512-VE6NlW+WGn2/AeOMd496AHFYmE7eLKkUY6Ty31k4og5vmA3Fjuwe9v6ifH6Xx/Hz27QvdoMoviw1/pqWRB09Sw==", + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.2.1.tgz", + "integrity": "sha512-ufS5Qq9RZN+Bu899eA9QCAYThY+gGW7oRkmb0vC93Vlyu/CFGcH0OYPEjVkDXA5FEbTt1+VWzdoOD3Ny9N+8tg==", "dev": true, "requires": { "JSONStream": "^1.0.3", @@ -4412,9 +4346,9 @@ "dev": true }, "irregular-plurals": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-2.0.0.tgz", - "integrity": "sha512-Y75zBYLkh0lJ9qxeHlMjQ7bSbyiSqNW/UOPWDmzC7cXskL1hekSITh1Oc6JV0XCWWZ9DE8VYSB71xocLk3gmGw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-3.2.0.tgz", + "integrity": "sha512-YqTdPLfwP7YFN0SsD3QUVCkm9ZG2VzOXv3DOrw5G5mkMbVwptTwVcFv7/C0vOpBmgTxAeTG19XpUs1E522LW9Q==", "dev": true }, "is-absolute": { @@ -4475,10 +4409,18 @@ "dev": true }, "is-callable": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz", - "integrity": "sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw==", - "dev": true + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", + "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==" + }, + "is-core-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.0.0.tgz", + "integrity": "sha512-jq1AH6C8MuteOoBPwkxHafmByhL9j5q4OaPGdbuD+ZtQJVzH+i6E3BJDQcBA09k57i2Hh2yQbEG8yObZ0jdlWw==", + "dev": true, + "requires": { + "has": "^1.0.3" + } }, "is-data-descriptor": { "version": "0.1.4", @@ -4503,8 +4445,7 @@ "is-date-object": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", - "dev": true + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==" }, "is-descriptor": { "version": "0.1.6", @@ -4538,9 +4479,15 @@ "dev": true }, "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-generator-function": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.7.tgz", + "integrity": "sha512-YZc5EwyO4f2kWCax7oegfuSr9mFz1ZvieNYBEjmukLxgXfBUbxAWGVF7GZf0zidYtoBl3WvC07YK0wT76a+Rtw==", "dev": true }, "is-glob": { @@ -4552,18 +4499,17 @@ "is-extglob": "^2.1.1" } }, - "is-map": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.1.tgz", - "integrity": "sha512-T/S49scO8plUiAOA2DBTBG3JHpn1yiw0kRp6dgiZ0v2/6twi5eiB0rHtHFH9ZIrvlWc6+4O+m4zg5+Z833aXgw==", - "dev": true - }, "is-negated-glob": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", "dev": true }, + "is-negative-zero": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", + "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=" + }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", @@ -4597,9 +4543,9 @@ "dev": true }, "is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", "dev": true }, "is-plain-object": { @@ -4618,7 +4564,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", - "dev": true, "requires": { "has-symbols": "^1.0.1" } @@ -4632,12 +4577,6 @@ "is-unc-path": "^1.0.0" } }, - "is-set": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.1.tgz", - "integrity": "sha512-eJEzOtVyenDs1TMzSQ3kU3K+E0GUS9sno+F0OBT97xsgcJsF9nXMBtkT9/kut5JEpM7oL7X/0qxR17K3mcwIAA==", - "dev": true - }, "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", @@ -4654,8 +4593,19 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "requires": { + "has-symbols": "^1.0.1" + } + }, + "is-typed-array": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.3.tgz", + "integrity": "sha512-BSYUBOK/HJibQ30wWkWold5txYwMUXQct9YHAQJr8fSwvZoiglcqB0pd7vEN23+Tsi9IUEjztdOSzl4qLVYGTQ==", "dev": true, "requires": { + "available-typed-arrays": "^1.0.0", + "es-abstract": "^1.17.4", + "foreach": "^2.0.5", "has-symbols": "^1.0.1" } }, @@ -4777,28 +4727,6 @@ } } }, - "iterate-iterator": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/iterate-iterator/-/iterate-iterator-1.0.1.tgz", - "integrity": "sha512-3Q6tudGN05kbkDQDI4CqjaBf4qf85w6W6GnuZDtUVYwKgtC1q8yxYX7CZed7N+tLzQqS6roujWvszf13T+n9aw==", - "dev": true - }, - "iterate-value": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/iterate-value/-/iterate-value-1.0.2.tgz", - "integrity": "sha512-A6fMAio4D2ot2r/TYzr4yUWrmwNdsN5xL7+HUiyACE4DXm+q8HtPcnFTp+NnW3k4N05tZ7FVYFFb2CR13NxyHQ==", - "dev": true, - "requires": { - "es-get-iterator": "^1.0.2", - "iterate-iterator": "^1.0.1" - } - }, - "jpeg-js": { - "version": "0.3.7", - "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.3.7.tgz", - "integrity": "sha512-9IXdWudL61npZjvLuVe/ktHiA41iE8qFyLB+4VDTblEsWBzeg8WQTlktdUK4CdncUqtUgUg0bbOmTE2bKBKaBQ==", - "dev": true - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -4816,9 +4744,9 @@ } }, "jsdoctypeparser": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsdoctypeparser/-/jsdoctypeparser-6.1.0.tgz", - "integrity": "sha512-UCQBZ3xCUBv/PLfwKAJhp6jmGOSLFNKzrotXGNgbKhWvz27wPsCsVeP7gIcHPElQw2agBmynAitXqhxR58XAmA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/jsdoctypeparser/-/jsdoctypeparser-9.0.0.tgz", + "integrity": "sha512-jrTA2jJIL6/DAEILBEh2/w9QxCuwmvNXIry39Ay/HVfhE3o2yVV0U44blYkqdHA/OKloJEqvJy0xU+GSdE2SIw==", "dev": true }, "json-schema-traverse": { @@ -4827,21 +4755,21 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, - "json-stable-stringify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz", - "integrity": "sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U=", - "dev": true, - "requires": { - "jsonify": "~0.0.0" - } - }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, "jsonfile": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz", @@ -4852,12 +4780,6 @@ "universalify": "^1.0.0" } }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", - "dev": true - }, "jsonparse": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", @@ -5269,15 +5191,16 @@ "dev": true }, "mocha": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.1.3.tgz", - "integrity": "sha512-ZbaYib4hT4PpF4bdSO2DohooKXIn4lDeiYqB+vTmCdr6l2woW0b6H3pf5x4sM5nwQMru9RvjjHYWVGltR50ZBw==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.2.0.tgz", + "integrity": "sha512-lEWEMq2LMfNJMKeuEwb5UELi+OgFDollXaytR5ggQcHpzG3NP/R7rvixAvF+9/lLsTWhWG+4yD2M70GsM06nxw==", "dev": true, "requires": { + "@ungap/promise-all-settled": "1.1.2", "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", - "chokidar": "3.4.2", - "debug": "4.1.1", + "chokidar": "3.4.3", + "debug": "4.2.0", "diff": "4.0.2", "escape-string-regexp": "4.0.0", "find-up": "5.0.0", @@ -5288,17 +5211,16 @@ "log-symbols": "4.0.0", "minimatch": "3.0.4", "ms": "2.1.2", - "object.assign": "4.1.0", - "promise.allsettled": "1.0.2", - "serialize-javascript": "4.0.0", - "strip-json-comments": "3.0.1", - "supports-color": "7.1.0", + "nanoid": "3.1.12", + "serialize-javascript": "5.0.1", + "strip-json-comments": "3.1.1", + "supports-color": "7.2.0", "which": "2.0.2", "wide-align": "1.1.3", - "workerpool": "6.0.0", + "workerpool": "6.0.2", "yargs": "13.3.2", "yargs-parser": "13.1.2", - "yargs-unparser": "1.6.1" + "yargs-unparser": "2.0.0" }, "dependencies": { "ansi-colors": { @@ -5307,6 +5229,12 @@ "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", "dev": true }, + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -5348,9 +5276,9 @@ "dev": true }, "chokidar": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.2.tgz", - "integrity": "sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsbErJA4mHWfpRrD8B97kSFN4cQz6nGBGiuFia1MKR4d6c1o8Cv7A==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz", + "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==", "dev": true, "requires": { "anymatch": "~3.1.1", @@ -5360,7 +5288,7 @@ "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.4.0" + "readdirp": "~3.5.0" } }, "cliui": { @@ -5390,20 +5318,14 @@ "dev": true }, "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", "dev": true, "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, "escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -5460,12 +5382,6 @@ "binary-extensions": "^2.0.0" } }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -5512,9 +5428,9 @@ "dev": true }, "readdirp": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", - "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", "dev": true, "requires": { "picomatch": "^2.2.1" @@ -5526,22 +5442,23 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" + "ansi-regex": "^4.1.0" } }, - "strip-json-comments": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", - "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", - "dev": true + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } }, "to-regex-range": { "version": "5.0.1", @@ -5698,11 +5615,12 @@ } }, "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.18.1.tgz", + "integrity": "sha512-lDfCPaMKfOJXjy0dPayzPdF1phampNWr3qFCjAu+rw/qbQmr5jWH5xN2hwh9QKfw9E5v4hwV7A+jrCmL8yjjqA==", "dev": true, "requires": { + "is-core-module": "^2.0.0", "path-parse": "^1.0.6" } }, @@ -5730,12 +5648,6 @@ "integrity": "sha512-kDcwXR4PS7caBpuRYYBUz9iVixUk3anO3f5OYFiIPwK/20vCzKCHyKoulbiDY1S53zD2bxUpxN/IJ+TnXjfvxg==", "dev": true }, - "mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", - "dev": true - }, "nan": { "version": "2.14.1", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz", @@ -5743,6 +5655,12 @@ "dev": true, "optional": true }, + "nanoid": { + "version": "3.1.12", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.12.tgz", + "integrity": "sha512-1qstj9z5+x491jfiC4Nelk+f8XBad7LN20PmyWINJEMRSf3wcAjAWysw1qaA8z6NSKe2sjq1hRSDpBH5paCb6A==", + "dev": true + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -5900,14 +5818,12 @@ "object-inspect": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", - "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", - "dev": true + "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==" }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" }, "object-visit": { "version": "1.0.1", @@ -5992,15 +5908,6 @@ "wrappy": "1" } }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, "optionator": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", @@ -6039,12 +5946,6 @@ "lcid": "^1.0.0" } }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, "p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", @@ -6172,9 +6073,9 @@ "dev": true }, "path-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", - "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", "dev": true }, "path-dirname": { @@ -6253,12 +6154,6 @@ "sha.js": "^2.4.8" } }, - "pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", - "dev": true - }, "picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", @@ -6295,43 +6190,6 @@ "find-up": "^2.1.0" } }, - "playwright": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-0.12.1.tgz", - "integrity": "sha512-icF4+I8y7A5HjhbTsa4Eqtl2fuGe3ECvW0Wrn6aRM5eL5/AqUIgIf2U/0e1S1bEsDfz1JVvClGl5Gqw4aI5H4w==", - "dev": true, - "requires": { - "playwright-core": "=0.12.1" - } - }, - "playwright-core": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-0.12.1.tgz", - "integrity": "sha512-NZ8Qe/kqsgAmFBxWZnUeE+MoZ04UzNI0DHOKA+I1p/5rbpaWhe1Vx5zVNa05A1iEvOtnKV1PdIEe4IPumG2y2w==", - "dev": true, - "requires": { - "debug": "^4.1.0", - "extract-zip": "^1.6.6", - "https-proxy-agent": "^3.0.0", - "jpeg-js": "^0.3.6", - "pngjs": "^3.4.0", - "progress": "^2.0.3", - "proxy-from-env": "^1.1.0", - "rimraf": "^3.0.2", - "ws": "^6.1.0" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } - }, "plugin-error": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz", @@ -6345,20 +6203,14 @@ } }, "plur": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/plur/-/plur-3.1.1.tgz", - "integrity": "sha512-t1Ax8KUvV3FFII8ltczPn2tJdjqbd1sIzu6t4JL7nQ3EyeL/lTrj5PWKb06ic5/6XYDr65rQ4uzQEGN70/6X5w==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/plur/-/plur-4.0.0.tgz", + "integrity": "sha512-4UGewrYgqDFw9vV6zNV+ADmPAUAfJPKtGvb/VdpQAx25X5f3xXdGdyOEVFwkl8Hl/tl7+xbeHqSEM+D5/TirUg==", "dev": true, "requires": { - "irregular-plurals": "^2.0.0" + "irregular-plurals": "^3.2.0" } }, - "pngjs": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", - "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==", - "dev": true - }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -6405,25 +6257,6 @@ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true }, - "promise.allsettled": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/promise.allsettled/-/promise.allsettled-1.0.2.tgz", - "integrity": "sha512-UpcYW5S1RaNKT6pd+s9jp9K9rlQge1UXKskec0j6Mmuq7UJCvlS2J2/s/yuPN8ehftf9HXMxWlKiPbGGUzpoRg==", - "dev": true, - "requires": { - "array.prototype.map": "^1.0.1", - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", - "iterate-value": "^1.0.0" - } - }, - "proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "dev": true - }, "public-encrypt": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", @@ -6868,16 +6701,6 @@ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, - "restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dev": true, - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", @@ -6909,27 +6732,12 @@ "inherits": "^2.0.1" } }, - "run-async": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", - "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", - "dev": true - }, "run-parallel": { "version": "1.1.9", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz", "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==", "dev": true }, - "rxjs": { - "version": "6.6.2", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.2.tgz", - "integrity": "sha512-BHdBMVoWC2sL26w//BCu3YzKT4s2jip/WhwsGEDmeKYBhKDZeYezVUnHatYB7L85v5xs0BAQmg6BEYJEKxBabg==", - "dev": true, - "requires": { - "tslib": "^1.9.0" - } - }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -6973,9 +6781,9 @@ } }, "serialize-javascript": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", - "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", + "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", "dev": true, "requires": { "randombytes": "^2.1.0" @@ -7029,16 +6837,6 @@ "safe-buffer": "^5.0.1" } }, - "shasum": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/shasum/-/shasum-1.0.2.tgz", - "integrity": "sha1-5wEjENj0F/TetXEhUOVni4euVl8=", - "dev": true, - "requires": { - "json-stable-stringify": "~0.0.0", - "sha.js": "~2.4.4" - } - }, "shasum-object": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/shasum-object/-/shasum-object-1.0.0.tgz", @@ -7121,12 +6919,6 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true } } }, @@ -7361,13 +7153,26 @@ } }, "stream-browserify": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", - "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", + "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", "dev": true, "requires": { - "inherits": "~2.0.1", - "readable-stream": "^2.0.2" + "inherits": "~2.0.4", + "readable-stream": "^3.5.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } } }, "stream-combiner2": { @@ -7463,45 +7268,113 @@ } }, "string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" }, "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^4.1.0" } } } }, "string.prototype.trimend": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", - "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", - "dev": true, + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.2.tgz", + "integrity": "sha512-8oAG/hi14Z4nOVP0z6mdiVZ/wqjDtWSLygMigTzAb+7aPEDTleeFf+WrF+alzecxIRkckkJVn+dTlwzJXORATw==", "requires": { "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" + "es-abstract": "^1.18.0-next.1" + }, + "dependencies": { + "es-abstract": { + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + }, + "object.assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.1.tgz", + "integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==", + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.0", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + } } }, "string.prototype.trimstart": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", - "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", - "dev": true, + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.2.tgz", + "integrity": "sha512-7F6CdBTl5zyu30BJFdzSTlSlLPwODC23Od+iLoVH8X6+3fvDPPuBVVj9iaB1GOsSTSIgVfsfm27R2FGrAPznWg==", "requires": { "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" + "es-abstract": "^1.18.0-next.1" + }, + "dependencies": { + "es-abstract": { + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + }, + "object.assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.1.tgz", + "integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==", + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.0", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + } } }, "string_decoder": { @@ -7514,20 +7387,12 @@ } }, "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - } + "ansi-regex": "^5.0.0" } }, "strip-bom": { @@ -7601,31 +7466,6 @@ "lodash": "^4.17.14", "slice-ansi": "^2.1.0", "string-width": "^3.0.0" - }, - "dependencies": { - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - } } }, "text-table": { @@ -7709,15 +7549,6 @@ "next-tick": "1" } }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - }, "to-absolute-glob": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", @@ -7797,6 +7628,18 @@ "integrity": "sha1-/sAF+dyqJZo/lFnOWmkGq6TFRdo=", "dev": true }, + "tsconfig-paths": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", + "integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" + } + }, "tslib": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", @@ -7875,9 +7718,9 @@ "dev": true }, "uglify-js": { - "version": "3.10.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.10.4.tgz", - "integrity": "sha512-kBFT3U4Dcj4/pJ52vfjCSfyLyvG9VYYuGYPmrPvAxRw/i7xHiT4VvCev+uiEMcEEiu6UNB6KgWmGtSUYIWScbw==", + "version": "3.11.3", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.11.3.tgz", + "integrity": "sha512-wDRziHG94mNj2n3R864CvYw/+pc9y/RNImiTyrrf8BzgWn75JgFSwYvXrtZQMnMnOp/4UTrf3iCSQxSStPiByA==", "dev": true, "optional": true }, @@ -8025,9 +7868,9 @@ "dev": true }, "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", + "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", "dev": true, "requires": { "punycode": "^2.1.0" @@ -8072,20 +7915,17 @@ "dev": true }, "util": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", - "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.3.tgz", + "integrity": "sha512-I8XkoQwE+fPQEhy9v012V+TSdH2kp9ts29i20TaaDUXsg7x/onePbhFJUExBfv/2ay1ZOp/Vsm3nDlmnFGSAog==", "dev": true, "requires": { - "inherits": "2.0.3" - }, - "dependencies": { - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - } + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "safe-buffer": "^5.1.2", + "which-typed-array": "^1.1.2" } }, "util-deprecate": { @@ -8095,9 +7935,9 @@ "dev": true }, "v8-compile-cache": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", - "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", + "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==", "dev": true }, "v8flags": { @@ -8126,9 +7966,9 @@ "dev": true }, "vinyl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", - "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.1.tgz", + "integrity": "sha512-LII3bXRFBZLlezoG5FfZVcXflZgWP/4dCwKtxd5ky9+LOtM4CS3bIRQsmR1KMnMW07jpE8fqR2lcxPZ+8sJIcw==", "dev": true, "requires": { "clone": "^2.1.1", @@ -8232,6 +8072,20 @@ "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", "dev": true }, + "which-typed-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.2.tgz", + "integrity": "sha512-KT6okrd1tE6JdZAy3o2VhMoYPh3+J6EMZLyrxBQsZflI1QCZIxMrIYLkosd8Twf+YfknVIHmYQPgJt238p8dnQ==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.2", + "es-abstract": "^1.17.5", + "foreach": "^2.0.5", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.1", + "is-typed-array": "^1.1.3" + } + }, "wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", @@ -8247,12 +8101,6 @@ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -8287,9 +8135,9 @@ "dev": true }, "workerpool": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.0.0.tgz", - "integrity": "sha512-fU2OcNA/GVAJLLyKUoHkAgIhKb0JoCpSjLC/G2vYKxUjVmQwGbRVeoPJ1a8U4pnVofz4AQV5Y/NEw8oKqxEBtA==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.0.2.tgz", + "integrity": "sha512-DSNyvOpFKrNusaaUwk+ej6cBj1bmhLcBfj80elGk+ZIo5JSkq+unB1dLKEOcNfJDZgjGICfhQ0Q5TbP0PvF4+Q==", "dev": true }, "wrap-ansi": { @@ -8365,15 +8213,6 @@ } } }, - "ws": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", - "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", - "dev": true, - "requires": { - "async-limiter": "~1.0.0" - } - }, "xml2js": { "version": "0.4.23", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", @@ -8544,200 +8383,30 @@ } }, "yargs-unparser": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.1.tgz", - "integrity": "sha512-qZV14lK9MWsGCmcr7u5oXGH0dbGqZAIxTDrWXZDo5zUr6b6iUmelNKO6x6R1dQT24AH3LgRxJpr8meWy2unolA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", "dev": true, "requires": { - "camelcase": "^5.3.1", - "decamelize": "^1.2.0", - "flat": "^4.1.0", - "is-plain-obj": "^1.1.0", - "yargs": "^14.2.3" + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.1.0.tgz", + "integrity": "sha512-WCMml9ivU60+8rEJgELlFp1gxFcEGxwYleE3bziHEDeqsqAWGHdimB7beBFGjLzVNgPGyDsfgXLQEYMpmIFnVQ==", "dev": true }, - "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dev": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - } - }, - "y18n": { + "decamelize": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", "dev": true - }, - "yargs": { - "version": "14.2.3", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.3.tgz", - "integrity": "sha512-ZbotRWhF+lkjijC/VhmOT9wSgyBQ7+zr13+YLkhfsSiTriYsMzkTUFP18pFhWwBeMa5gUc1MzbhrO6/VB7c9Xg==", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "decamelize": "^1.2.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^15.0.1" - } - }, - "yargs-parser": { - "version": "15.0.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-15.0.1.tgz", - "integrity": "sha512-0OAMV2mAZQrs3FkNpDQcBk1x5HXb8X4twADss4S0Iuk+2dGnLOE/fRHrsYm542GduMveyA77OF4wrNJuanRCWw==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } } } - }, - "yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", - "dev": true, - "requires": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } } } } diff --git a/package.json b/package.json index 75bddd8d2f7..8692d8475e4 100644 --- a/package.json +++ b/package.json @@ -54,9 +54,9 @@ "@types/through2": "latest", "@types/travis-fold": "latest", "@types/xml2js": "^0.4.0", - "@typescript-eslint/eslint-plugin": "^3.6.1-alpha.1", - "@typescript-eslint/experimental-utils": "^3.4.1-alpha.1", - "@typescript-eslint/parser": "^3.4.1-alpha.1", + "@typescript-eslint/eslint-plugin": "4.5.0", + "@typescript-eslint/experimental-utils": "4.5.0", + "@typescript-eslint/parser": "4.5.0", "async": "latest", "azure-devops-node-api": "^10.1.0", "browser-resolve": "^1.11.2", @@ -66,10 +66,10 @@ "convert-source-map": "latest", "del": "5.1.0", "diff": "^4.0.2", - "eslint": "6.8.0", - "eslint-formatter-autolinkable-stylish": "1.1.2", - "eslint-plugin-import": "2.20.2", - "eslint-plugin-jsdoc": "22.1.0", + "eslint": "7.12.1", + "eslint-formatter-autolinkable-stylish": "1.1.4", + "eslint-plugin-import": "2.22.1", + "eslint-plugin-jsdoc": "30.7.6", "eslint-plugin-no-null": "1.0.2", "fancy-log": "latest", "fs-extra": "^9.0.0", @@ -88,7 +88,6 @@ "mocha-fivemat-progress-reporter": "latest", "ms": "latest", "node-fetch": "^2.6.0", - "playwright": "0.12.1", "plugin-error": "latest", "pretty-hrtime": "^1.0.3", "prex": "^0.4.3", diff --git a/scripts/browserIntegrationTest.js b/scripts/browserIntegrationTest.js index 218cef8c0fb..622af7cb43d 100644 --- a/scripts/browserIntegrationTest.js +++ b/scripts/browserIntegrationTest.js @@ -1,14 +1,24 @@ -const playwright = require("playwright"); +// @ts-check const chalk = require("chalk"); const { join } = require("path"); const { readFileSync } = require("fs"); +try { + // eslint-disable-next-line import/no-extraneous-dependencies + require("playwright"); +} +catch (error) { + throw new Error("Playwright is expected to be installed manually before running this script"); +} + +// eslint-disable-next-line import/no-extraneous-dependencies +const playwright = require("playwright"); // Turning this on will leave the Chromium browser open, giving you the // chance to open up the web inspector. const debugging = false; (async () => { - for (const browserType of ["chromium", "firefox", "webkit"]) { + for (const browserType of ["chromium", "firefox"]) { const browser = await playwright[browserType].launch({ headless: !debugging }); const context = await browser.newContext(); const page = await context.newPage(); @@ -21,7 +31,6 @@ const debugging = false; page.on("error", errorCaught); page.on("pageerror", errorCaught); - page.on("console", log => console[log._type](log._text)); await page.setContent(` @@ -35,5 +44,14 @@ const debugging = false; else { console.log("Not closing the browser, you'll need to exit the process in your terminal manually"); } + console.log(`${browserType} :+1:`); } })(); + +process.on("unhandledRejection", (/** @type {any}*/ err) => { + if (err) { + console.error(err.stack || err.message); + } + process.exit(1); +}); + diff --git a/scripts/produceLKG.ts b/scripts/produceLKG.ts index 7439abe9fce..af99441208b 100644 --- a/scripts/produceLKG.ts +++ b/scripts/produceLKG.ts @@ -15,9 +15,9 @@ async function produceLKG() { await copyLibFiles(); await copyLocalizedDiagnostics(); await copyTypesMap(); - await buildProtocol(); await copyScriptOutputs(); await copyDeclarationOutputs(); + await buildProtocol(); await writeGitAttributes(); } diff --git a/scripts/tsconfig.eslint.json b/scripts/tsconfig.eslint.json deleted file mode 100644 index 84403f66a5b..00000000000 --- a/scripts/tsconfig.eslint.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": ["*.ts", "types"] -} diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index aec962016a2..6b28594a5e5 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -174,14 +174,15 @@ namespace ts { const binder = createBinder(); export function bindSourceFile(file: SourceFile, options: CompilerOptions) { - tracing.begin(tracing.Phase.Bind, "bindSourceFile", { path: file.path }); + const tracingData: tracing.EventData = [tracing.Phase.Bind, "bindSourceFile", { path: file.path }]; + tracing.begin(...tracingData); performance.mark("beforeBind"); perfLogger.logStartBindFile("" + file.fileName); binder(file, options); perfLogger.logStopBindFile(); performance.mark("afterBind"); performance.measure("Bind", "beforeBind", "afterBind"); - tracing.end(); + tracing.end(...tracingData); } function createBinder(): (file: SourceFile, options: CompilerOptions) => void { @@ -217,6 +218,9 @@ namespace ts { // or if compiler options contain alwaysStrict. let inStrictMode: boolean; + // If we are binding an assignment pattern, we will bind certain expressions differently. + let inAssignmentPattern = false; + let symbolCount = 0; let Symbol: new (flags: SymbolFlags, name: __String) => Symbol; @@ -274,6 +278,7 @@ namespace ts { currentExceptionTarget = undefined; activeLabelList = undefined; hasExplicitReturn = false; + inAssignmentPattern = false; emitFlags = NodeFlags.None; } @@ -586,6 +591,9 @@ namespace ts { } function jsdocTreatAsExported(node: Node) { + if (node.parent && isModuleDeclaration(node)) { + node = node.parent; + } if (!isJSDocTypeAlias(node)) return false; // jsdoc typedef handling is a bit of a doozy, but to summarize, treat the typedef as exported if: // 1. It has an explicit name (since by default typedefs are always directly exported, either at the top level or in a container), or @@ -729,9 +737,14 @@ namespace ts { } function bindChildren(node: Node): void { + const saveInAssignmentPattern = inAssignmentPattern; + // Most nodes aren't valid in an assignment pattern, so we clear the value here + // and set it before we descend into nodes that could actually be part of an assignment pattern. + inAssignmentPattern = false; if (checkUnreachable(node)) { bindEachChild(node); bindJSDoc(node); + inAssignmentPattern = saveInAssignmentPattern; return; } if (node.kind >= SyntaxKind.FirstStatement && node.kind <= SyntaxKind.LastStatement && !options.allowUnreachableCode) { @@ -787,6 +800,13 @@ namespace ts { bindPostfixUnaryExpressionFlow(node); break; case SyntaxKind.BinaryExpression: + if (isDestructuringAssignment(node)) { + // Carry over whether we are in an assignment pattern to + // binary expressions that could actually be an initializer + inAssignmentPattern = saveInAssignmentPattern; + bindDestructuringAssignmentFlow(node); + return; + } bindBinaryExpressionFlow(node); break; case SyntaxKind.DeleteExpression: @@ -823,11 +843,23 @@ namespace ts { case SyntaxKind.ModuleBlock: bindEachFunctionsFirst((node as Block).statements); break; + case SyntaxKind.BindingElement: + bindBindingElementFlow(node); + break; + case SyntaxKind.ObjectLiteralExpression: + case SyntaxKind.ArrayLiteralExpression: + case SyntaxKind.PropertyAssignment: + case SyntaxKind.SpreadElement: + // Carry over whether we are in an assignment pattern of Object and Array literals + // as well as their children that are valid assignment targets. + inAssignmentPattern = saveInAssignmentPattern; + // falls through default: bindEachChild(node); break; } bindJSDoc(node); + inAssignmentPattern = saveInAssignmentPattern; } function isNarrowingExpression(expr: Expression): boolean { @@ -841,7 +873,8 @@ namespace ts { case SyntaxKind.CallExpression: return hasNarrowableArgument(expr); case SyntaxKind.ParenthesizedExpression: - return isNarrowingExpression((expr).expression); + case SyntaxKind.NonNullExpression: + return isNarrowingExpression((expr).expression); case SyntaxKind.BinaryExpression: return isNarrowingBinaryExpression(expr); case SyntaxKind.PrefixUnaryExpression: @@ -855,6 +888,7 @@ namespace ts { function isNarrowableReference(expr: Expression): boolean { return expr.kind === SyntaxKind.Identifier || expr.kind === SyntaxKind.PrivateIdentifier || expr.kind === SyntaxKind.ThisKeyword || expr.kind === SyntaxKind.SuperKeyword || (isPropertyAccessExpression(expr) || isNonNullExpression(expr) || isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression) || + isBinaryExpression(expr) && expr.operatorToken.kind === SyntaxKind.CommaToken && isNarrowableReference(expr.right) || isElementAccessExpression(expr) && isStringOrNumericLiteralLike(expr.argumentExpression) && isNarrowableReference(expr.expression) || isAssignmentExpression(expr) && isNarrowableReference(expr.left); } @@ -1331,10 +1365,14 @@ namespace ts { function bindExpressionStatement(node: ExpressionStatement): void { bind(node.expression); - // A top level call expression with a dotted function name and at least one argument + maybeBindExpressionFlowIfCall(node.expression); + } + + function maybeBindExpressionFlowIfCall(node: Expression) { + // A top level or LHS of comma expression call expression with a dotted function name and at least one argument // is potentially an assertion and is therefore included in the control flow. - if (node.expression.kind === SyntaxKind.CallExpression) { - const call = node.expression; + if (node.kind === SyntaxKind.CallExpression) { + const call = node; if (isDottedName(call.expression) && call.expression.kind !== SyntaxKind.SuperKeyword) { currentFlow = createFlowCall(currentFlow, call); } @@ -1445,6 +1483,24 @@ namespace ts { } } + function bindDestructuringAssignmentFlow(node: DestructuringAssignment) { + if (inAssignmentPattern) { + inAssignmentPattern = false; + bind(node.operatorToken); + bind(node.right); + inAssignmentPattern = true; + bind(node.left); + } + else { + inAssignmentPattern = true; + bind(node.left); + inAssignmentPattern = false; + bind(node.operatorToken); + bind(node.right); + } + bindAssignmentTargetFlow(node.left); + } + const enum BindBinaryExpressionFlowState { BindThenBindChildren, MaybeBindLeft, @@ -1505,6 +1561,9 @@ namespace ts { break; } case BindBinaryExpressionFlowState.BindToken: { + if (node.operatorToken.kind === SyntaxKind.CommaToken) { + maybeBindExpressionFlowIfCall(node.left); + } advanceState(BindBinaryExpressionFlowState.BindRight); maybeBind(node.operatorToken); break; @@ -1558,7 +1617,7 @@ namespace ts { * If `node` is a BinaryExpression, adds it to the local work stack, otherwise recursively binds it */ function maybeBind(node: Node) { - if (node && isBinaryExpression(node)) { + if (node && isBinaryExpression(node) && !isDestructuringAssignment(node)) { stackIndex++; workStacks.expr[stackIndex] = node; workStacks.state[stackIndex] = BindBinaryExpressionFlowState.BindThenBindChildren; @@ -1613,6 +1672,25 @@ namespace ts { } } + function bindBindingElementFlow(node: BindingElement) { + if (isBindingPattern(node.name)) { + // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: + // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + bindEach(node.decorators); + bindEach(node.modifiers); + bind(node.dotDotDotToken); + bind(node.propertyName); + bind(node.initializer); + bind(node.name); + } + else { + bindEachChild(node); + } + } + function bindJSDocTypeAlias(node: JSDocTypedefTag | JSDocCallbackTag | JSDocEnumTag) { setParent(node.tagName, node); if (node.kind !== SyntaxKind.JSDocEnumTag && node.fullName) { @@ -2828,6 +2906,11 @@ namespace ts { return; } + if (isObjectLiteralExpression(assignedExpression) && every(assignedExpression.properties, isShorthandPropertyAssignment)) { + forEach(assignedExpression.properties, bindExportAssignedObjectMemberAlias); + return; + } + // 'module.exports = expr' assignment const flags = exportAssignmentIsAlias(node) ? SymbolFlags.Alias // An export= with an EntityNameExpression or a ClassExpression exports all meanings of that identifier or class @@ -2836,6 +2919,10 @@ namespace ts { setValueDeclaration(symbol, node); } + function bindExportAssignedObjectMemberAlias(node: ShorthandPropertyAssignment) { + declareSymbol(file.symbol.exports!, file.symbol, node, SymbolFlags.Alias | SymbolFlags.Assignment, SymbolFlags.None); + } + function bindThisPropertyAssignment(node: BindablePropertyAssignmentExpression | PropertyAccessExpression | LiteralLikeElementAccessExpression) { Debug.assert(isInJSFile(node)); // private identifiers *must* be declared (even in JS files) diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 7765a753312..8d09baa2705 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -274,7 +274,7 @@ namespace ts { result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map(r => convertToDiagnosticRelatedInformation(r, newProgram, toPath)) : - emptyArray : + [] : undefined; return result; }); @@ -493,10 +493,10 @@ namespace ts { return !state.semanticDiagnosticsFromOldState.size; } - function isChangedSignagure(state: BuilderProgramState, path: Path) { + function isChangedSignature(state: BuilderProgramState, path: Path) { const newSignature = Debug.checkDefined(state.currentAffectedFilesSignatures).get(path); - const oldSignagure = Debug.checkDefined(state.fileInfos.get(path)).signature; - return newSignature !== oldSignagure; + const oldSignature = Debug.checkDefined(state.fileInfos.get(path)).signature; + return newSignature !== oldSignature; } /** @@ -509,7 +509,7 @@ namespace ts { return; } - if (!isChangedSignagure(state, affectedFile.resolvedPath)) return; + if (!isChangedSignature(state, affectedFile.resolvedPath)) return; // Since isolated modules dont change js files, files affected by change in signature is itself // But we need to cleanup semantic diagnostics and queue dts emit for affected files @@ -522,7 +522,7 @@ namespace ts { if (!seenFileNamesMap.has(currentPath)) { seenFileNamesMap.set(currentPath, true); const result = fn(state, currentPath); - if (result && isChangedSignagure(state, currentPath)) { + if (result && isChangedSignature(state, currentPath)) { const currentSourceFile = Debug.checkDefined(state.program).getSourceFileByPath(currentPath)!; queue.push(...BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath)); } @@ -824,7 +824,7 @@ namespace ts { result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map(r => convertToReusableDiagnosticRelatedInformation(r, relativeToBuildInfo)) : - emptyArray : + [] : undefined; return result; }); @@ -900,7 +900,7 @@ namespace ts { /** * Computing hash to for signature verification */ - const computeHash = host.createHash || generateDjb2Hash; + const computeHash = maybeBind(host, host.createHash); let state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState); let backupState: BuilderProgramState | undefined; newProgram.getProgramBuildInfo = () => getProgramBuildInfo(state, getCanonicalFileName); @@ -1019,31 +1019,57 @@ namespace ts { * in that order would be used to write the files */ function emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult { + let restorePendingEmitOnHandlingNoEmitSuccess = false; + let savedAffectedFilesPendingEmit; + let savedAffectedFilesPendingEmitKind; + let savedAffectedFilesPendingEmitIndex; + // Backup and restore affected pendings emit state for non emit Builder if noEmitOnError is enabled and emitBuildInfo could be written in case there are errors + // This ensures pending files to emit is updated in tsbuildinfo + // Note that when there are no errors, emit proceeds as if everything is emitted as it is callers reponsibility to write the files to disk if at all (because its builder that doesnt track files to emit) + if (kind !== BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram && + !targetSourceFile && + !outFile(state.compilerOptions) && + !state.compilerOptions.noEmit && + state.compilerOptions.noEmitOnError) { + restorePendingEmitOnHandlingNoEmitSuccess = true; + savedAffectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(); + savedAffectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new Map(state.affectedFilesPendingEmitKind); + savedAffectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex; + } + if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) { assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile); - const result = handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken); - if (result) return result; - if (!targetSourceFile) { - // Emit and report any errors we ran into. - let sourceMaps: SourceMapEmitResult[] = []; - let emitSkipped = false; - let diagnostics: Diagnostic[] | undefined; - let emittedFiles: string[] = []; + } + const result = handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken); + if (result) return result; - let affectedEmitResult: AffectedFileResult; - while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) { - emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped; - diagnostics = addRange(diagnostics, affectedEmitResult.result.diagnostics); - emittedFiles = addRange(emittedFiles, affectedEmitResult.result.emittedFiles); - sourceMaps = addRange(sourceMaps, affectedEmitResult.result.sourceMaps); - } - return { - emitSkipped, - diagnostics: diagnostics || emptyArray, - emittedFiles, - sourceMaps - }; + if (restorePendingEmitOnHandlingNoEmitSuccess) { + state.affectedFilesPendingEmit = savedAffectedFilesPendingEmit; + state.affectedFilesPendingEmitKind = savedAffectedFilesPendingEmitKind; + state.affectedFilesPendingEmitIndex = savedAffectedFilesPendingEmitIndex; + } + + // Emit only affected files if using builder for emit + if (!targetSourceFile && kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) { + // Emit and report any errors we ran into. + let sourceMaps: SourceMapEmitResult[] = []; + let emitSkipped = false; + let diagnostics: Diagnostic[] | undefined; + let emittedFiles: string[] = []; + + let affectedEmitResult: AffectedFileResult; + while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) { + emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped; + diagnostics = addRange(diagnostics, affectedEmitResult.result.diagnostics); + emittedFiles = addRange(emittedFiles, affectedEmitResult.result.emittedFiles); + sourceMaps = addRange(sourceMaps, affectedEmitResult.result.sourceMaps); } + return { + emitSkipped, + diagnostics: diagnostics || emptyArray, + emittedFiles, + sourceMaps + }; } return Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers); } @@ -1069,7 +1095,8 @@ namespace ts { } // Add file to affected file pending emit to handle for later emit time - if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) { + // Apart for emit builder do this for tsbuildinfo, do this for non emit builder when noEmit is set as tsbuildinfo is written and reused between emitters + if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram || state.compilerOptions.noEmit || state.compilerOptions.noEmitOnError) { addToAffectedFilesPendingEmit(state, (affected as SourceFile).resolvedPath, BuilderFileEmit.Full); } diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts index 1c26513897a..72c5c37b233 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -77,7 +77,7 @@ namespace ts { /** * Compute the hash to store the shape of the file */ - export type ComputeHash = (data: string) => string; + export type ComputeHash = ((data: string) => string) | undefined; /** * Exported modules to from declaration emit being computed. @@ -337,7 +337,7 @@ namespace ts { emitOutput.outputFiles.length > 0 ? emitOutput.outputFiles[0] : undefined; if (firstDts) { Debug.assert(fileExtensionIs(firstDts.name, Extension.Dts), "File extension for signature expected to be dts", () => `Found: ${getAnyExtensionFromPath(firstDts.name)} for ${firstDts.name}:: All output files: ${JSON.stringify(emitOutput.outputFiles.map(f => f.name))}`); - latestSignature = computeHash(firstDts.text); + latestSignature = (computeHash || generateDjb2Hash)(firstDts.text); if (exportedModulesMapCache && latestSignature !== prevSignature) { updateExportedModules(sourceFile, emitOutput.exportedModulesFromDeclarationEmit, exportedModulesMapCache); } @@ -521,7 +521,7 @@ namespace ts { /** * When program emits modular code, gets the files affected by the sourceFile whose shape has changed */ - function getFilesAffectedByUpdatedShapeWhenModuleEmit(state: BuilderState, programOfThisState: Program, sourceFileWithUpdatedShape: SourceFile, cacheToUpdateSignature: ESMap, cancellationToken: CancellationToken | undefined, computeHash: ComputeHash | undefined, exportedModulesMapCache: ComputingExportedModulesMap | undefined) { + function getFilesAffectedByUpdatedShapeWhenModuleEmit(state: BuilderState, programOfThisState: Program, sourceFileWithUpdatedShape: SourceFile, cacheToUpdateSignature: ESMap, cancellationToken: CancellationToken | undefined, computeHash: ComputeHash, exportedModulesMapCache: ComputingExportedModulesMap | undefined) { if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) { return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape); } @@ -544,13 +544,12 @@ namespace ts { if (!seenFileNamesMap.has(currentPath)) { const currentSourceFile = programOfThisState.getSourceFileByPath(currentPath)!; seenFileNamesMap.set(currentPath, currentSourceFile); - if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash!, exportedModulesMapCache)) { // TODO: GH#18217 + if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) { queue.push(...getReferencedByPaths(state, currentSourceFile.resolvedPath)); } } } - // Return array of values that needs emit // Return array of values that needs emit return arrayFrom(mapDefinedIterator(seenFileNamesMap.values(), value => value)); } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ccba60fe42d..07996e0bcdd 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -256,6 +256,20 @@ namespace ts { VoidIsNonOptional = 1 << 1, } + const enum IntrinsicTypeKind { + Uppercase, + Lowercase, + Capitalize, + Uncapitalize + } + + const intrinsicTypeKinds: ReadonlyESMap = new Map(getEntries({ + Uppercase: IntrinsicTypeKind.Uppercase, + Lowercase: IntrinsicTypeKind.Lowercase, + Capitalize: IntrinsicTypeKind.Capitalize, + Uncapitalize: IntrinsicTypeKind.Uncapitalize + })); + function SymbolLinks(this: SymbolLinks) { } @@ -493,6 +507,7 @@ namespace ts { }, getAugmentedPropertiesOfType, getRootSymbols, + getSymbolOfExpando, getContextualType: (nodeIn: Expression, contextFlags?: ContextFlags) => { const node = getParseTreeNode(nodeIn, isExpression); if (!node) { @@ -705,6 +720,7 @@ namespace ts { const literalTypes = new Map(); const indexedAccessTypes = new Map(); const templateLiteralTypes = new Map(); + const stringMappingTypes = new Map(); const substitutionTypes = new Map(); const evolvingArrayTypes: EvolvingArrayType[] = []; const undefinedProperties: SymbolTable = new Map(); @@ -717,6 +733,7 @@ namespace ts { const wildcardType = createIntrinsicType(TypeFlags.Any, "any"); const errorType = createIntrinsicType(TypeFlags.Any, "error"); const nonInferrableAnyType = createIntrinsicType(TypeFlags.Any, "any", ObjectFlags.ContainsWideningType); + const intrinsicMarkerType = createIntrinsicType(TypeFlags.Any, "intrinsic"); const unknownType = createIntrinsicType(TypeFlags.Unknown, "unknown"); const undefinedType = createIntrinsicType(TypeFlags.Undefined, "undefined"); const undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(TypeFlags.Undefined, "undefined", ObjectFlags.ContainsWideningType); @@ -755,7 +772,7 @@ namespace ts { const stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]); const keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType; const numberOrBigIntType = getUnionType([numberType, bigintType]); - const templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType]); + const templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]) as UnionType; const restrictiveMapper: TypeMapper = makeFunctionTypeMapper(t => t.flags & TypeFlags.TypeParameter ? getRestrictiveTypeParameter(t) : t); const permissiveMapper: TypeMapper = makeFunctionTypeMapper(t => t.flags & TypeFlags.TypeParameter ? wildcardType : t); @@ -1938,6 +1955,15 @@ namespace ts { } } break; + case SyntaxKind.InferType: + if (meaning & SymbolFlags.TypeParameter) { + const parameterName = (location).typeParameter.name; + if (parameterName && name === parameterName.escapedText) { + result = (location).typeParameter.symbol; + break loop; + } + } + break; } if (isSelfReferenceLocation(location)) { lastSelfReferenceLocation = location; @@ -1997,7 +2023,15 @@ namespace ts { } } if (!suggestion) { - error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg!)); + if (nameArg) { + const lib = getSuggestedLibForNonExistentName(nameArg); + if (lib) { + error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), lib); + } + else { + error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg)); + } + } } suggestionCount++; } @@ -2090,7 +2124,7 @@ namespace ts { return isTypeQueryNode(location) || (( isFunctionLikeDeclaration(location) || (location.kind === SyntaxKind.PropertyDeclaration && !hasSyntacticModifier(location, ModifierFlags.Static)) - ) && (!lastLocation || lastLocation !== (location as FunctionLike | PropertyDeclaration).name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred + ) && (!lastLocation || lastLocation !== (location as SignatureDeclaration | PropertyDeclaration).name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred } if (lastLocation && lastLocation === (location as FunctionExpression | ArrowFunction).name) { return false; @@ -2423,10 +2457,11 @@ namespace ts { } function getTargetOfImportEqualsDeclaration(node: ImportEqualsDeclaration | VariableDeclaration, dontResolveAlias: boolean): Symbol | undefined { - if (isVariableDeclaration(node) && node.initializer && isPropertyAccessExpression(node.initializer)) { - const name = (getLeftmostAccessExpression(node.initializer.expression) as CallExpression).arguments[0] as StringLiteral; - return isIdentifier(node.initializer.name) - ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), node.initializer.name.escapedText)) + const commonJSPropertyAccess = getCommonJSPropertyAccess(node); + if (commonJSPropertyAccess) { + const name = (getLeftmostAccessExpression(commonJSPropertyAccess.expression) as CallExpression).arguments[0] as StringLiteral; + return isIdentifier(commonJSPropertyAccess.name) + ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : undefined; } if (isVariableDeclaration(node) || node.moduleReference.kind === SyntaxKind.ExternalModuleReference) { @@ -2462,10 +2497,7 @@ namespace ts { function resolveExportByName(moduleSymbol: Symbol, name: __String, sourceNode: TypeOnlyCompatibleAliasDeclaration | undefined, dontResolveAlias: boolean) { const exportValue = moduleSymbol.exports!.get(InternalSymbolName.ExportEquals); - if (exportValue) { - return getPropertyOfType(getTypeOfSymbol(exportValue), name); - } - const exportSymbol = moduleSymbol.exports!.get(name); + const exportSymbol = exportValue ? getPropertyOfType(getTypeOfSymbol(exportValue), name) : moduleSymbol.exports!.get(name); const resolved = resolveSymbol(exportSymbol, dontResolveAlias); markSymbolOfAliasDeclarationIfTypeOnly(sourceNode, exportSymbol, resolved, /*overwriteEmpty*/ false); return resolved; @@ -2621,12 +2653,8 @@ namespace ts { return result; } - function getExportOfModule(symbol: Symbol, specifier: ImportOrExportSpecifier | BindingElement, dontResolveAlias: boolean): Symbol | undefined { + function getExportOfModule(symbol: Symbol, name: Identifier, specifier: Declaration, dontResolveAlias: boolean): Symbol | undefined { if (symbol.flags & SymbolFlags.Module) { - const name = specifier.propertyName ?? specifier.name; - if (!isIdentifier(name)) { - return undefined; - } const exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText); const resolved = resolveSymbol(exportSymbol, dontResolveAlias); markSymbolOfAliasDeclarationIfTypeOnly(specifier, exportSymbol, resolved, /*overwriteEmpty*/ false); @@ -2643,10 +2671,10 @@ namespace ts { } } - function getExternalModuleMember(node: ImportDeclaration | ExportDeclaration | VariableDeclaration, specifier: ImportOrExportSpecifier | BindingElement, dontResolveAlias = false): Symbol | undefined { + function getExternalModuleMember(node: ImportDeclaration | ExportDeclaration | VariableDeclaration, specifier: ImportOrExportSpecifier | BindingElement | PropertyAccessExpression, dontResolveAlias = false): Symbol | undefined { const moduleSpecifier = getExternalModuleRequireArgument(node) || (node as ImportDeclaration | ExportDeclaration).moduleSpecifier!; const moduleSymbol = resolveExternalModuleName(node, moduleSpecifier)!; // TODO: GH#18217 - const name = specifier.propertyName || specifier.name; + const name = !isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name; if (!isIdentifier(name)) { return undefined; } @@ -2666,10 +2694,10 @@ namespace ts { else { symbolFromVariable = getPropertyOfVariable(targetSymbol, name.escapedText); } - // if symbolFromVariable is export - get its final target symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias); - let symbolFromModule = getExportOfModule(targetSymbol, specifier, dontResolveAlias); + + let symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias); if (symbolFromModule === undefined && name.escapedText === InternalSymbolName.Default) { const file = find(moduleSymbol.declarations, isSourceFile); if (canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias)) { @@ -2757,11 +2785,23 @@ namespace ts { } function getTargetOfImportSpecifier(node: ImportSpecifier | BindingElement, dontResolveAlias: boolean): Symbol | undefined { - const resolved = getExternalModuleMember(isBindingElement(node) ? getRootDeclaration(node) as VariableDeclaration : node.parent.parent.parent, node, dontResolveAlias); + const root = isBindingElement(node) ? getRootDeclaration(node) as VariableDeclaration : node.parent.parent.parent; + const commonJSPropertyAccess = getCommonJSPropertyAccess(root); + const resolved = getExternalModuleMember(root, commonJSPropertyAccess || node, dontResolveAlias); + const name = node.propertyName || node.name; + if (commonJSPropertyAccess && resolved && isIdentifier(name)) { + return getPropertyOfType(getTypeOfSymbol(resolved), name.escapedText); + } markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false); return resolved; } + function getCommonJSPropertyAccess(node: Node) { + if (isVariableDeclaration(node) && node.initializer && isPropertyAccessExpression(node.initializer)) { + return node.initializer; + } + } + function getTargetOfNamespaceExportDeclaration(node: NamespaceExportDeclaration, dontResolveAlias: boolean): Symbol { const resolved = resolveExternalModuleSymbol(node.parent.symbol, dontResolveAlias); markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false); @@ -2915,7 +2955,7 @@ namespace ts { finalTarget: Symbol | undefined, overwriteEmpty: boolean, ): boolean { - if (!aliasDeclaration) return false; + if (!aliasDeclaration || isPropertyAccessExpression(aliasDeclaration)) return false; // If the declaration itself is type-only, mark it and return. // No need to check what it resolves to. @@ -3277,7 +3317,7 @@ namespace ts { packageId.name, mangleScopedPackageName(packageId.name)) : chainDiagnosticMessages( /*details*/ undefined, - Diagnostics.Try_npm_install_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0, + Diagnostics.Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0, moduleReference, mangleScopedPackageName(packageId.name)) : undefined; @@ -4121,6 +4161,14 @@ namespace ts { && isDeclarationVisible(declaration.parent)) { return addVisibleAlias(declaration, declaration); } + else if (symbol.flags & SymbolFlags.Alias && isBindingElement(declaration) && isInJSFile(declaration) && declaration.parent?.parent // exported import-like top-level JS require statement + && isVariableDeclaration(declaration.parent.parent) + && declaration.parent.parent.parent?.parent && isVariableStatement(declaration.parent.parent.parent.parent) + && !hasSyntacticModifier(declaration.parent.parent.parent.parent, ModifierFlags.Export) + && declaration.parent.parent.parent.parent.parent // check if the thing containing the variable statement is visible (ie, the file) + && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) { + return addVisibleAlias(declaration, declaration.parent.parent.parent.parent); + } // Declaration is not visible return false; @@ -4344,7 +4392,7 @@ namespace ts { if (type.flags & TypeFlags.Any) { context.approximateLength += 3; - return factory.createKeywordTypeNode(SyntaxKind.AnyKeyword); + return factory.createKeywordTypeNode(type === intrinsicMarkerType ? SyntaxKind.IntrinsicKeyword : SyntaxKind.AnyKeyword); } if (type.flags & TypeFlags.Unknown) { return factory.createKeywordTypeNode(SyntaxKind.UnknownKeyword); @@ -4368,13 +4416,26 @@ namespace ts { if (type.flags & TypeFlags.EnumLiteral && !(type.flags & TypeFlags.Union)) { const parentSymbol = getParentOfSymbol(type.symbol)!; const parentName = symbolToTypeNode(parentSymbol, context, SymbolFlags.Type); - const enumLiteralName = getDeclaredTypeOfSymbol(parentSymbol) === type - ? parentName - : appendReferenceToType( + if (getDeclaredTypeOfSymbol(parentSymbol) === type) { + return parentName; + } + const memberName = symbolName(type.symbol); + if (isIdentifierText(memberName, ScriptTarget.ES3)) { + return appendReferenceToType( parentName as TypeReferenceNode | ImportTypeNode, - factory.createTypeReferenceNode(symbolName(type.symbol), /*typeArguments*/ undefined) + factory.createTypeReferenceNode(memberName, /*typeArguments*/ undefined) ); - return enumLiteralName; + } + if (isImportTypeNode(parentName)) { + (parentName as any).isTypeOf = true; // mutably update, node is freshly manufactured anyhow + return factory.createIndexedAccessTypeNode(parentName, factory.createLiteralTypeNode(factory.createStringLiteral(memberName))); + } + else if (isTypeReferenceNode(parentName)) { + return factory.createIndexedAccessTypeNode(factory.createTypeQueryNode(parentName.typeName), factory.createLiteralTypeNode(factory.createStringLiteral(memberName))); + } + else { + return Debug.fail("Unhandled type node kind returned from `symbolToTypeNode`."); + } } if (type.flags & TypeFlags.EnumLike) { return symbolToTypeNode(type.symbol, context, SymbolFlags.Type); @@ -4505,17 +4566,19 @@ namespace ts { } if (type.flags & TypeFlags.TemplateLiteral) { const texts = (type).texts; - const casings = (type).casings; const types = (type).types; const templateHead = factory.createTemplateHead(texts[0]); const templateSpans = factory.createNodeArray( map(types, (t, i) => factory.createTemplateLiteralTypeSpan( - casings[i], typeToTypeNodeHelper(t, context), (i < types.length - 1 ? factory.createTemplateMiddle : factory.createTemplateTail)(texts[i + 1])))); context.approximateLength += 2; return factory.createTemplateLiteralType(templateHead, templateSpans); } + if (type.flags & TypeFlags.StringMapping) { + const typeNode = typeToTypeNodeHelper((type).type, context); + return symbolToTypeNode((type).symbol, context, SymbolFlags.Type, [typeNode]); + } if (type.flags & TypeFlags.IndexedAccess) { const objectTypeNode = typeToTypeNodeHelper((type).objectType, context); const indexTypeNode = typeToTypeNodeHelper((type).indexType, context); @@ -5421,7 +5484,7 @@ namespace ts { specifierCompilerOptions, contextFile, moduleResolverHost, - { importModuleSpecifierPreference: isBundle ? "non-relative" : "relative" }, + { importModuleSpecifierPreference: isBundle ? "non-relative" : "relative", importModuleSpecifierEnding: isBundle ? "minimal" : undefined }, )); links.specifierCache ??= new Map(); links.specifierCache.set(contextFile.path, specifier); @@ -5762,7 +5825,7 @@ namespace ts { } const oldFlags = context.flags; if (type.flags & TypeFlags.UniqueESSymbol && - type.symbol === symbol) { + type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, d => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration!)))) { context.flags |= NodeBuilderFlags.AllowUniqueESSymbolType; } const result = typeToTypeNodeHelper(type, context); @@ -6725,21 +6788,49 @@ namespace ts { const targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); // the target may be within the same scope - attempt to serialize it first switch (node.kind) { + case SyntaxKind.BindingElement: + if (node.parent?.parent?.kind === SyntaxKind.VariableDeclaration) { + // const { SomeClass } = require('./lib'); + const specifier = getSpecifierForModuleSymbol(target.parent || target, context); // './lib' + const { propertyName } = node as BindingElement; + addResult(factory.createImportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, + factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, factory.createNamedImports([factory.createImportSpecifier( + propertyName && isIdentifier(propertyName) ? factory.createIdentifier(idText(propertyName)) : undefined, + factory.createIdentifier(localName) + )])), + factory.createStringLiteral(specifier) + ), ModifierFlags.None); + break; + } + // We don't know how to serialize this (nested?) binding element + Debug.failBadSyntaxKind(node.parent?.parent || node, "Unhandled binding element grandparent kind in declaration serialization"); + break; + case SyntaxKind.ShorthandPropertyAssignment: + if (node.parent?.parent?.kind === SyntaxKind.BinaryExpression) { + // module.exports = { SomeClass } + serializeExportSpecifier( + unescapeLeadingUnderscores(symbol.escapedName), + targetName + ); + } + break; case SyntaxKind.VariableDeclaration: // commonjs require: const x = require('y') if (isPropertyAccessExpression((node as VariableDeclaration).initializer!)) { // const x = require('y').z const initializer = (node as VariableDeclaration).initializer! as PropertyAccessExpression; // require('y').z - const uniqueName = factory.createUniqueName((getExternalModuleRequireArgument(node) as StringLiteral).text); // _y + const uniqueName = factory.createUniqueName(localName); // _x const specifier = getSpecifierForModuleSymbol(target.parent || target, context); // 'y' - // import _y = require('y'); + // import _x = require('y'); addResult(factory.createImportEqualsDeclaration( /*decorators*/ undefined, /*modifiers*/ undefined, uniqueName, factory.createExternalModuleReference(factory.createStringLiteral(specifier)) ), ModifierFlags.None); - // import x = _y.z + // import x = _x.z addResult(factory.createImportEqualsDeclaration( /*decorators*/ undefined, /*modifiers*/ undefined, @@ -6750,7 +6841,9 @@ namespace ts { } // else fall through and treat commonjs require just like import= case SyntaxKind.ImportEqualsDeclaration: - if (target.escapedName === InternalSymbolName.ExportEquals) { + // This _specifically_ only exists to handle json declarations - where we make aliases, but since + // we emit no declarations for the json document, must not refer to it in the declarations + if (target.escapedName === InternalSymbolName.ExportEquals && some(target.declarations, isJsonSourceFile)) { serializeMaybeAliasAssignment(symbol); break; } @@ -6869,7 +6962,7 @@ namespace ts { const name = unescapeLeadingUnderscores(symbol.escapedName); const isExportEquals = name === InternalSymbolName.ExportEquals; const isDefault = name === InternalSymbolName.Default; - const isExportAssignment = isExportEquals || isDefault; + const isExportAssignmentCompatibleSymbolName = isExportEquals || isDefault; // synthesize export = ref // ref should refer to either be a locally scoped symbol which we need to emit, or // a reference to another namespace/module which we may need to emit an `import` statement for @@ -6881,8 +6974,8 @@ namespace ts { // In case `target` refers to a namespace member, look at the declaration and serialize the leftmost symbol in it // eg, `namespace A { export class B {} }; exports = A.B;` // Technically, this is all that's required in the case where the assignment is an entity name expression - const expr = isExportAssignment ? getExportAssignmentExpression(aliasDecl as ExportAssignment | BinaryExpression) : getPropertyAssignmentAliasLikeExpression(aliasDecl as ShorthandPropertyAssignment | PropertyAssignment | PropertyAccessExpression); - const first = isEntityNameExpression(expr) ? getFirstNonModuleExportsIdentifier(expr) : undefined; + const expr = aliasDecl && ((isExportAssignment(aliasDecl) || isBinaryExpression(aliasDecl)) ? getExportAssignmentExpression(aliasDecl) : getPropertyAssignmentAliasLikeExpression(aliasDecl as ShorthandPropertyAssignment | PropertyAssignment | PropertyAccessExpression)); + const first = expr && isEntityNameExpression(expr) ? getFirstNonModuleExportsIdentifier(expr) : undefined; const referenced = first && resolveEntityName(first, SymbolFlags.All, /*ignoreErrors*/ true, /*dontResolveAlias*/ true, enclosingDeclaration); if (referenced || target) { includePrivateSymbol(referenced || target); @@ -6895,7 +6988,7 @@ namespace ts { // into the containing scope anyway, so we want to skip the visibility checks. const oldTrack = context.tracker.trackSymbol; context.tracker.trackSymbol = noop; - if (isExportAssignment) { + if (isExportAssignmentCompatibleSymbolName) { results.push(factory.createExportAssignment( /*decorators*/ undefined, /*modifiers*/ undefined, @@ -6904,11 +6997,11 @@ namespace ts { )); } else { - if (first === expr) { + if (first === expr && first) { // serialize as `export {target as name}` serializeExportSpecifier(name, idText(first)); } - else if (isClassExpression(expr)) { + else if (expr && isClassExpression(expr)) { serializeExportSpecifier(name, getInternalSymbolName(target, symbolName(target))); } else { @@ -6934,7 +7027,7 @@ namespace ts { const typeToSerialize = getWidenedType(getTypeOfSymbol(getMergedSymbol(symbol))); if (isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, symbol)) { // If there are no index signatures and `typeToSerialize` is an object type, emit as a namespace instead of a const - serializeAsFunctionNamespaceMerge(typeToSerialize, symbol, varName, isExportAssignment ? ModifierFlags.None : ModifierFlags.Export); + serializeAsFunctionNamespaceMerge(typeToSerialize, symbol, varName, isExportAssignmentCompatibleSymbolName ? ModifierFlags.None : ModifierFlags.Export); } else { const statement = factory.createVariableStatement(/*modifiers*/ undefined, factory.createVariableDeclarationList([ @@ -6947,7 +7040,7 @@ namespace ts { : name === varName ? ModifierFlags.Export : ModifierFlags.None); } - if (isExportAssignment) { + if (isExportAssignmentCompatibleSymbolName) { results.push(factory.createExportAssignment( /*decorators*/ undefined, /*modifiers*/ undefined, @@ -7760,9 +7853,13 @@ namespace ts { const propName = getDestructuringPropertyName(node); if (propName) { const literal = setTextRange(parseNodeFactory.createStringLiteral(propName), node); - const result = setTextRange(parseNodeFactory.createElementAccessExpression(parentAccess, literal), node); + const lhsExpr = isLeftHandSideExpression(parentAccess) ? parentAccess : parseNodeFactory.createParenthesizedExpression(parentAccess); + const result = setTextRange(parseNodeFactory.createElementAccessExpression(lhsExpr, literal), node); setParent(literal, result); setParent(result, node); + if (lhsExpr !== parentAccess) { + setParent(lhsExpr, result); + } result.flowNode = parentAccess.flowNode; return result; } @@ -7837,7 +7934,7 @@ namespace ts { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) const name = declaration.propertyName || declaration.name; const indexType = getLiteralTypeFromPropertyName(name); - const declaredType = getConstraintForLocation(getIndexedAccessType(parentType, indexType, name, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, AccessFlags.ExpressionPosition), declaration.name); + const declaredType = getConstraintForLocation(getIndexedAccessType(parentType, indexType, /*noUncheckedIndexedAccessCandidate*/ undefined, name, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, AccessFlags.ExpressionPosition), declaration.name); type = getFlowTypeOfDestructuring(declaration, declaredType); } } @@ -7858,7 +7955,7 @@ namespace ts { else if (isArrayLikeType(parentType)) { const indexType = getLiteralType(index); const accessFlags = hasDefaultValue(declaration) ? AccessFlags.NoTupleBoundsCheck : 0; - const declaredType = getConstraintForLocation(getIndexedAccessTypeOrUndefined(parentType, indexType, declaration.name, accessFlags | AccessFlags.ExpressionPosition) || errorType, declaration.name); + const declaredType = getConstraintForLocation(getIndexedAccessTypeOrUndefined(parentType, indexType, /*noUncheckedIndexedAccessCandidate*/ undefined, declaration.name, accessFlags | AccessFlags.ExpressionPosition) || errorType, declaration.name); type = getFlowTypeOfDestructuring(declaration, declaredType); } else { @@ -8692,9 +8789,9 @@ namespace ts { let links = getSymbolLinks(symbol); const originalLinks = links; if (!links.type) { - const jsDeclaration = symbol.valueDeclaration && getDeclarationOfExpando(symbol.valueDeclaration); - if (jsDeclaration) { - const merged = mergeJSSymbols(symbol, getSymbolOfNode(jsDeclaration)); + const expando = symbol.valueDeclaration && getSymbolOfExpando(symbol.valueDeclaration, /*allowDeclaration*/ false); + if (expando) { + const merged = mergeJSSymbols(symbol, expando); if (merged) { // note:we overwrite links because we just cloned the symbol symbol = links = merged; @@ -10458,7 +10555,7 @@ namespace ts { existingProp.keyType = getUnionType([existingProp.keyType, keyType]); } else { - const modifiersProp = getPropertyOfType(modifiersType, propName); + const modifiersProp = isTypeUsableAsPropertyName(keyType) ? getPropertyOfType(modifiersType, getPropertyNameFromType(keyType)) : undefined; const isOptional = !!(templateModifiers & MappedTypeModifiers.IncludeOptional || !(templateModifiers & MappedTypeModifiers.ExcludeOptional) && modifiersProp && modifiersProp.flags & SymbolFlags.Optional); const isReadonly = !!(templateModifiers & MappedTypeModifiers.IncludeReadonly || @@ -10726,14 +10823,14 @@ namespace ts { function getConstraintFromIndexedAccess(type: IndexedAccessType) { const indexConstraint = getSimplifiedTypeOrConstraint(type.indexType); if (indexConstraint && indexConstraint !== type.indexType) { - const indexedAccess = getIndexedAccessTypeOrUndefined(type.objectType, indexConstraint); + const indexedAccess = getIndexedAccessTypeOrUndefined(type.objectType, indexConstraint, type.noUncheckedIndexedAccessCandidate); if (indexedAccess) { return indexedAccess; } } const objectConstraint = getSimplifiedTypeOrConstraint(type.objectType); if (objectConstraint && objectConstraint !== type.objectType) { - return getIndexedAccessTypeOrUndefined(objectConstraint, type.indexType); + return getIndexedAccessTypeOrUndefined(objectConstraint, type.indexType, type.noUncheckedIndexedAccessCandidate); } return undefined; } @@ -10824,7 +10921,7 @@ namespace ts { } function getBaseConstraintOfType(type: Type): Type | undefined { - if (type.flags & (TypeFlags.InstantiableNonPrimitive | TypeFlags.UnionOrIntersection | TypeFlags.TemplateLiteral)) { + if (type.flags & (TypeFlags.InstantiableNonPrimitive | TypeFlags.UnionOrIntersection | TypeFlags.TemplateLiteral | TypeFlags.StringMapping)) { const constraint = getResolvedBaseConstraint(type); return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined; } @@ -10849,9 +10946,12 @@ namespace ts { * circularly references the type variable. */ function getResolvedBaseConstraint(type: InstantiableType | UnionOrIntersectionType): Type { + if (type.resolvedBaseConstraint) { + return type.resolvedBaseConstraint; + } let nonTerminating = false; - return type.resolvedBaseConstraint || - (type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), type)); + const stack: Type[] = []; + return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), type); function getImmediateBaseConstraint(t: Type): Type { if (!t.immediateBaseConstraint) { @@ -10868,9 +10968,14 @@ namespace ts { nonTerminating = true; return t.immediateBaseConstraint = noConstraintType; } - constraintDepth++; - let result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false)); - constraintDepth--; + let result; + if (!isDeeplyNestedType(t, stack, stack.length)) { + stack.push(t); + constraintDepth++; + result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false)); + constraintDepth--; + stack.pop(); + } if (!popTypeResolution()) { if (t.flags & TypeFlags.TypeParameter) { const errorNode = getConstraintDeclaration(t); @@ -10922,12 +11027,16 @@ namespace ts { if (t.flags & TypeFlags.TemplateLiteral) { const types = (t).types; const constraints = mapDefined(types, getBaseConstraint); - return constraints.length === types.length ? getTemplateLiteralType((t).texts, (t).casings, constraints) : stringType; + return constraints.length === types.length ? getTemplateLiteralType((t).texts, constraints) : stringType; + } + if (t.flags & TypeFlags.StringMapping) { + const constraint = getBaseConstraint((t).type); + return constraint ? getStringMappingType((t).symbol, constraint) : stringType; } if (t.flags & TypeFlags.IndexedAccess) { const baseObjectType = getBaseConstraint((t).objectType); const baseIndexType = getBaseConstraint((t).indexType); - const baseIndexedAccess = baseObjectType && baseIndexType && getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType); + const baseIndexedAccess = baseObjectType && baseIndexType && getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, (t).noUncheckedIndexedAccessCandidate); return baseIndexedAccess && getBaseConstraint(baseIndexedAccess); } if (t.flags & TypeFlags.Conditional) { @@ -11910,12 +12019,12 @@ namespace ts { // (such as 'Foo'), T's constraint is inferred from the constraint of the // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are // present, we form an intersection of the inferred constraint types. - const grandParent = declaration.parent.parent; + const [childTypeParameter = declaration.parent, grandParent] = walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent); if (grandParent.kind === SyntaxKind.TypeReference) { const typeReference = grandParent; const typeParameters = getTypeParametersForTypeReference(typeReference); if (typeParameters) { - const index = typeReference.typeArguments!.indexOf(declaration.parent); + const index = typeReference.typeArguments!.indexOf(childTypeParameter); if (index < typeParameters.length) { const declaredConstraint = getConstraintOfTypeParameter(typeParameters[index]); if (declaredConstraint) { @@ -12128,6 +12237,9 @@ namespace ts { function getTypeAliasInstantiation(symbol: Symbol, typeArguments: readonly Type[] | undefined): Type { const type = getDeclaredTypeOfSymbol(symbol); + if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName as string) && typeArguments && typeArguments.length === 1) { + return getStringMappingType(symbol, typeArguments[0]); + } const links = getSymbolLinks(symbol); const typeParameters = links.typeParameters!; const id = getTypeListId(typeArguments); @@ -12231,7 +12343,7 @@ namespace ts { if (symbol.valueDeclaration) { const isImportTypeWithQualifier = node.kind === SyntaxKind.ImportType && (node as ImportTypeNode).qualifier; // valueType might not have a symbol, eg, {import('./b').STRING_LITERAL} - if (valueType.symbol && isImportTypeWithQualifier) { + if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); } } @@ -12989,6 +13101,20 @@ namespace ts { } } + function removeStringLiteralsMatchedByTemplateLiterals(types: Type[]) { + const templates = filter(types, isPatternLiteralType); + if (templates.length) { + let i = types.length; + while (i > 0) { + i--; + const t = types[i]; + if (t.flags & TypeFlags.StringLiteral && some(templates, template => isTypeSubtypeOf(t, template))) { + orderedRemoveItemAt(types, i); + } + } + } + } + // We sort and deduplicate the constituent types based on object identity. If the subtypeReduction // flag is specified we also reduce the constituent type set to only include types that aren't subtypes // of other types. Subtype reduction is expensive for large union types and is possible only when union @@ -13014,6 +13140,9 @@ namespace ts { if (includes & (TypeFlags.Literal | TypeFlags.UniqueESSymbol)) { removeRedundantLiteralTypes(typeSet, includes); } + if (includes & TypeFlags.StringLiteral && includes & TypeFlags.TemplateLiteral) { + removeStringLiteralsMatchedByTemplateLiterals(typeSet); + } break; case UnionReduction.Subtype: if (!removeSubtypes(typeSet, !(includes & TypeFlags.IncludesStructuredOrInstantiable))) { @@ -13173,6 +13302,30 @@ namespace ts { return true; } + /** + * Returns `true` if the intersection of the template literals and string literals is the empty set, eg `get${string}` & "setX", and should reduce to `never` + */ + function extractRedundantTemplateLiterals(types: Type[]): boolean { + let i = types.length; + const literals = filter(types, t => !!(t.flags & TypeFlags.StringLiteral)); + while (i > 0) { + i--; + const t = types[i]; + if (!(t.flags & TypeFlags.TemplateLiteral)) continue; + for (const t2 of literals) { + if (isTypeSubtypeOf(t2, t)) { + // eg, ``get${T}` & "getX"` is just `"getX"` + orderedRemoveItemAt(types, i); + break; + } + else if (isPatternLiteralType(t)) { + return true; + } + } + } + return false; + } + function extractIrreducible(types: Type[], flag: TypeFlags) { if (every(types, t => !!(t.flags & TypeFlags.Union) && some((t as UnionType).types, tt => !!(tt.flags & flag)))) { for (let i = 0; i < types.length; i++) { @@ -13270,6 +13423,9 @@ namespace ts { includes & TypeFlags.VoidLike && includes & (TypeFlags.DisjointDomains & ~TypeFlags.VoidLike)) { return neverType; } + if (includes & TypeFlags.TemplateLiteral && includes & TypeFlags.StringLiteral && extractRedundantTemplateLiterals(typeSet)) { + return neverType; + } if (includes & TypeFlags.Any) { return includes & TypeFlags.IncludesWildcard ? wildcardType : anyType; } @@ -13331,6 +13487,7 @@ namespace ts { function checkCrossProductUnion(types: readonly Type[]) { const size = reduceLeft(types, (n, t) => n * (t.flags & TypeFlags.Union ? (t).types.length : t.flags & TypeFlags.Never ? 0 : 1), 1); if (size >= 100000) { + tracing.instant(tracing.Phase.Check, "checkCrossProductUnion_DepthLimit", { typeIds: types.map(t => t.id), size }); error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent); return false; } @@ -13362,11 +13519,25 @@ namespace ts { function getIndexTypeForMappedType(type: MappedType, noIndexSignatures: boolean | undefined) { const constraint = filterType(getConstraintTypeFromMappedType(type), t => !(noIndexSignatures && t.flags & (TypeFlags.Any | TypeFlags.String))); - return type.declaration.nameType ? - instantiateType(getTypeFromTypeNode(type.declaration.nameType), appendTypeMapping(type.mapper, getTypeParameterFromMappedType(type), constraint)) : + const nameType = type.declaration.nameType && getTypeFromTypeNode(type.declaration.nameType); + return nameType ? + mapType(constraint, t => instantiateType(nameType, appendTypeMapping(type.mapper, getTypeParameterFromMappedType(type), t))) : constraint; } + // Ordinarily we reduce a keyof M where M is a mapped type { [P in K as N

]: X } to simply N. This however presumes + // that N distributes over union types, i.e. that N is equivalent to N | N | N. That presumption is + // generally true, except when N is a non-distributive conditional type or an instantiable type with non-distributive + // conditional type as a constituent. In those cases, we cannot reduce keyof M and need to preserve it as is. + function isNonDistributiveNameType(type: Type | undefined): boolean { + return !!(type && ( + type.flags & TypeFlags.Conditional && !(type).root.isDistributive || + type.flags & (TypeFlags.UnionOrIntersection | TypeFlags.TemplateLiteral) && some((type).types, isNonDistributiveNameType) || + type.flags & (TypeFlags.Index | TypeFlags.StringMapping) && isNonDistributiveNameType((type).type) || + type.flags & TypeFlags.IndexedAccess && isNonDistributiveNameType((type).indexType) || + type.flags & TypeFlags.Substitution && isNonDistributiveNameType((type).substitute))); + } + function getLiteralTypeFromPropertyName(name: PropertyName) { if (isPrivateIdentifier(name)) { return neverType; @@ -13414,7 +13585,7 @@ namespace ts { type = getReducedType(type); return type.flags & TypeFlags.Union ? getIntersectionType(map((type).types, t => getIndexType(t, stringsOnly, noIndexSignatures))) : type.flags & TypeFlags.Intersection ? getUnionType(map((type).types, t => getIndexType(t, stringsOnly, noIndexSignatures))) : - type.flags & TypeFlags.InstantiableNonPrimitive || isGenericTupleType(type) ? getIndexTypeForGenericType(type, stringsOnly) : + type.flags & TypeFlags.InstantiableNonPrimitive || isGenericTupleType(type) || isGenericMappedType(type) && isNonDistributiveNameType(getNameTypeFromMappedType(type)) ? getIndexTypeForGenericType(type, stringsOnly) : getObjectFlags(type) & ObjectFlags.Mapped ? getIndexTypeForMappedType(type, noIndexSignatures) : type === wildcardType ? wildcardType : type.flags & TypeFlags.Unknown ? neverType : @@ -13465,50 +13636,61 @@ namespace ts { if (!links.resolvedType) { links.resolvedType = getTemplateLiteralType( [node.head.text, ...map(node.templateSpans, span => span.literal.text)], - map(node.templateSpans, span => span.casing), map(node.templateSpans, span => getTypeFromTypeNode(span.type))); } return links.resolvedType; } - function getTemplateLiteralType(texts: readonly string[], casings: readonly TemplateCasing[], types: readonly Type[]): Type { + function getTemplateLiteralType(texts: readonly string[], types: readonly Type[]): Type { const unionIndex = findIndex(types, t => !!(t.flags & (TypeFlags.Never | TypeFlags.Union))); if (unionIndex >= 0) { return checkCrossProductUnion(types) ? - mapType(types[unionIndex], t => getTemplateLiteralType(texts, casings, replaceElement(types, unionIndex, t))) : + mapType(types[unionIndex], t => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType; } - const newTypes = []; - const newCasings = []; - const newTexts = []; + if (contains(types, wildcardType)) { + return wildcardType; + } + const newTypes: Type[] = []; + const newTexts: string[] = []; let text = texts[0]; - for (let i = 0; i < types.length; i++) { - const t = types[i]; - if (t.flags & TypeFlags.Literal) { - const s = applyTemplateCasing(getTemplateStringForType(t) || "", casings[i]); - text += s; - text += texts[i + 1]; - } - else if (isGenericIndexType(t)) { - newTypes.push(t); - newCasings.push(casings[i]); - newTexts.push(text); - text = texts[i + 1]; - } - else { - return stringType; - } + if (!addSpans(texts, types)) { + return stringType; } if (newTypes.length === 0) { return getLiteralType(text); } newTexts.push(text); - const id = `${getTypeListId(newTypes)}|${newCasings.join(",")}|${map(newTexts, t => t.length).join(",")}|${newTexts.join("")}`; + const id = `${getTypeListId(newTypes)}|${map(newTexts, t => t.length).join(",")}|${newTexts.join("")}`; let type = templateLiteralTypes.get(id); if (!type) { - templateLiteralTypes.set(id, type = createTemplateLiteralType(newTexts, newCasings, newTypes)); + templateLiteralTypes.set(id, type = createTemplateLiteralType(newTexts, newTypes)); } return type; + + function addSpans(texts: readonly string[], types: readonly Type[]): boolean { + for (let i = 0; i < types.length; i++) { + const t = types[i]; + if (t.flags & (TypeFlags.Literal | TypeFlags.Null | TypeFlags.Undefined)) { + text += getTemplateStringForType(t) || ""; + text += texts[i + 1]; + } + else if (t.flags & TypeFlags.TemplateLiteral) { + text += (t).texts[0]; + if (!addSpans((t).texts, (t).types)) return false; + text += texts[i + 1]; + } + else if (isGenericIndexType(t) || isPatternLiteralPlaceholderType(t)) { + newTypes.push(t); + newTexts.push(text); + text = texts[i + 1]; + } + else { + return false; + } + } + return true; + } } function getTemplateStringForType(type: Type) { @@ -13516,33 +13698,58 @@ namespace ts { type.flags & TypeFlags.NumberLiteral ? "" + (type).value : type.flags & TypeFlags.BigIntLiteral ? pseudoBigIntToString((type).value) : type.flags & TypeFlags.BooleanLiteral ? (type).intrinsicName : + type.flags & TypeFlags.Null ? "null" : + type.flags & TypeFlags.Undefined ? "undefined" : undefined; } - function applyTemplateCasing(str: string, casing: TemplateCasing) { - switch (casing) { - case TemplateCasing.Uppercase: return str.toUpperCase(); - case TemplateCasing.Lowercase: return str.toLowerCase(); - case TemplateCasing.Capitalize: return str.charAt(0).toUpperCase() + str.slice(1); - case TemplateCasing.Uncapitalize: return str.charAt(0).toLowerCase() + str.slice(1); - } - return str; - } - - function createTemplateLiteralType(texts: readonly string[], casings: readonly TemplateCasing[], types: readonly Type[]) { + function createTemplateLiteralType(texts: readonly string[], types: readonly Type[]) { const type = createType(TypeFlags.TemplateLiteral); type.texts = texts; - type.casings = casings; type.types = types; return type; } - function createIndexedAccessType(objectType: Type, indexType: Type, aliasSymbol: Symbol | undefined, aliasTypeArguments: readonly Type[] | undefined) { + function getStringMappingType(symbol: Symbol, type: Type): Type { + return type.flags & (TypeFlags.Union | TypeFlags.Never) ? mapType(type, t => getStringMappingType(symbol, t)) : + isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : + type.flags & TypeFlags.StringLiteral ? getLiteralType(applyStringMapping(symbol, (type).value)) : + type; + } + + function applyStringMapping(symbol: Symbol, str: string) { + switch (intrinsicTypeKinds.get(symbol.escapedName as string)) { + case IntrinsicTypeKind.Uppercase: return str.toUpperCase(); + case IntrinsicTypeKind.Lowercase: return str.toLowerCase(); + case IntrinsicTypeKind.Capitalize: return str.charAt(0).toUpperCase() + str.slice(1); + case IntrinsicTypeKind.Uncapitalize: return str.charAt(0).toLowerCase() + str.slice(1); + } + return str; + } + + function getStringMappingTypeForGenericType(symbol: Symbol, type: Type): Type { + const id = `${getSymbolId(symbol)},${getTypeId(type)}`; + let result = stringMappingTypes.get(id); + if (!result) { + stringMappingTypes.set(id, result = createStringMappingType(symbol, type)); + } + return result; + } + + function createStringMappingType(symbol: Symbol, type: Type) { + const result = createType(TypeFlags.StringMapping); + result.symbol = symbol; + result.type = type; + return result; + } + + function createIndexedAccessType(objectType: Type, indexType: Type, aliasSymbol: Symbol | undefined, aliasTypeArguments: readonly Type[] | undefined, shouldIncludeUndefined: boolean) { const type = createType(TypeFlags.IndexedAccess); type.objectType = objectType; type.indexType = indexType; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; + type.noUncheckedIndexedAccessCandidate = shouldIncludeUndefined; return type; } @@ -13592,13 +13799,14 @@ namespace ts { && every(symbol.declarations, d => !isFunctionLike(d) || !!(getCombinedNodeFlags(d) & NodeFlags.Deprecated)); } - function getPropertyTypeForIndexType(originalObjectType: Type, objectType: Type, indexType: Type, fullIndexType: Type, suppressNoImplicitAnyError: boolean, accessNode: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression | undefined, accessFlags: AccessFlags, reportDeprecated?: boolean) { + function getPropertyTypeForIndexType(originalObjectType: Type, objectType: Type, indexType: Type, fullIndexType: Type, suppressNoImplicitAnyError: boolean, accessNode: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression | undefined, accessFlags: AccessFlags, noUncheckedIndexedAccessCandidate?: boolean, reportDeprecated?: boolean) { const accessExpression = accessNode && accessNode.kind === SyntaxKind.ElementAccessExpression ? accessNode : undefined; const propName = accessNode && isPrivateIdentifier(accessNode) ? undefined : getPropertyNameFromIndex(indexType, accessNode); + if (propName !== undefined) { const prop = getPropertyOfType(objectType, propName); if (prop) { - if (reportDeprecated && accessNode && prop.valueDeclaration?.flags & NodeFlags.Deprecated && isUncalledFunctionReference(accessNode, prop)) { + if (reportDeprecated && accessNode && getDeclarationNodeFlagsFromSymbol(prop) & NodeFlags.Deprecated && isUncalledFunctionReference(accessNode, prop)) { const deprecatedNode = accessExpression?.argumentExpression ?? (isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode); errorOrSuggestion(/* isError */ false, deprecatedNode, Diagnostics._0_is_deprecated, propName as string); } @@ -13632,7 +13840,10 @@ namespace ts { } } errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, IndexKind.Number)); - return mapType(objectType, t => getRestTypeOfTupleType(t) || undefinedType); + return mapType(objectType, t => { + const restType = getRestTypeOfTupleType(t) || undefinedType; + return noUncheckedIndexedAccessCandidate ? getUnionType([restType, undefinedType]) : restType; + }); } } if (!(indexType.flags & TypeFlags.Nullable) && isTypeAssignableToKind(indexType, TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbolLike)) { @@ -13648,16 +13859,13 @@ namespace ts { } return undefined; } - const shouldIncludeUndefined = - compilerOptions.noUncheckedIndexedAccess && - (accessFlags & (AccessFlags.Writing | AccessFlags.ExpressionPosition)) === AccessFlags.ExpressionPosition; if (accessNode && !isTypeAssignableToKind(indexType, TypeFlags.String | TypeFlags.Number)) { const indexNode = getIndexNodeForAccessExpression(accessNode); error(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); - return shouldIncludeUndefined ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; + return noUncheckedIndexedAccessCandidate ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; } errorIfWritingToReadonlyIndex(indexInfo); - return shouldIncludeUndefined ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; + return noUncheckedIndexedAccessCandidate ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; } if (indexType.flags & TypeFlags.Never) { return neverType; @@ -13753,6 +13961,14 @@ namespace ts { accessNode; } + function isPatternLiteralPlaceholderType(type: Type) { + return templateConstraintType.types.indexOf(type) !== -1 || !!(type.flags & TypeFlags.Any); + } + + function isPatternLiteralType(type: Type) { + return !!(type.flags & TypeFlags.TemplateLiteral) && every((type as TemplateLiteralType).types, isPatternLiteralPlaceholderType); + } + function isGenericObjectType(type: Type): boolean { if (type.flags & TypeFlags.UnionOrIntersection) { if (!((type).objectFlags & ObjectFlags.IsGenericObjectTypeComputed)) { @@ -13772,7 +13988,7 @@ namespace ts { } return !!((type).objectFlags & ObjectFlags.IsGenericIndexType); } - return !!(type.flags & (TypeFlags.InstantiableNonPrimitive | TypeFlags.Index | TypeFlags.TemplateLiteral)); + return !!(type.flags & (TypeFlags.InstantiableNonPrimitive | TypeFlags.Index | TypeFlags.TemplateLiteral | TypeFlags.StringMapping)) && !isPatternLiteralType(type); } function isThisTypeParameter(type: Type): boolean { @@ -13899,8 +14115,8 @@ namespace ts { return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper); } - function getIndexedAccessType(objectType: Type, indexType: Type, accessNode?: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[], accessFlags = AccessFlags.None): Type { - return getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, accessFlags, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType); + function getIndexedAccessType(objectType: Type, indexType: Type, noUncheckedIndexedAccessCandidate?: boolean, accessNode?: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[], accessFlags = AccessFlags.None): Type { + return getIndexedAccessTypeOrUndefined(objectType, indexType, noUncheckedIndexedAccessCandidate, accessNode, accessFlags, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType); } function indexTypeLessThan(indexType: Type, limit: number) { @@ -13916,14 +14132,14 @@ namespace ts { }); } - function getIndexedAccessTypeOrUndefined(objectType: Type, indexType: Type, accessNode?: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression, accessFlags = AccessFlags.None, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type | undefined { + function getIndexedAccessTypeOrUndefined(objectType: Type, indexType: Type, noUncheckedIndexedAccessCandidate?: boolean, accessNode?: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression, accessFlags = AccessFlags.None, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type | undefined { if (objectType === wildcardType || indexType === wildcardType) { return wildcardType; } - const shouldIncludeUndefined = - compilerOptions.noUncheckedIndexedAccess && - (accessFlags & (AccessFlags.Writing | AccessFlags.ExpressionPosition)) === AccessFlags.ExpressionPosition; + const shouldIncludeUndefined = noUncheckedIndexedAccessCandidate || + (!!compilerOptions.noUncheckedIndexedAccess && + (accessFlags & (AccessFlags.Writing | AccessFlags.ExpressionPosition)) === AccessFlags.ExpressionPosition); // If the object type has a string index signature and no other members we know that the result will // always be the type of that index signature and we can simplify accordingly. @@ -13943,13 +14159,13 @@ namespace ts { return objectType; } // Defer the operation by creating an indexed access type. - const id = objectType.id + "," + indexType.id; + const id = objectType.id + "," + indexType.id + (shouldIncludeUndefined ? "?" : ""); let type = indexedAccessTypes.get(id); if (!type) { - indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType, aliasSymbol, aliasTypeArguments)); + indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType, aliasSymbol, aliasTypeArguments, shouldIncludeUndefined)); } - return shouldIncludeUndefined ? getUnionType([type, undefinedType]) : type; + return type; } // In the following we resolve T[K] to the type of the property in T selected by K. // We treat boolean as different from other unions to improve errors; @@ -13959,7 +14175,7 @@ namespace ts { const propTypes: Type[] = []; let wasMissingProp = false; for (const t of (indexType).types) { - const propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, wasMissingProp, accessNode, accessFlags); + const propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, wasMissingProp, accessNode, accessFlags, shouldIncludeUndefined); if (propType) { propTypes.push(propType); } @@ -13979,7 +14195,7 @@ namespace ts { ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, UnionReduction.Literal, aliasSymbol, aliasTypeArguments); } - return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, /* supressNoImplicitAnyError */ false, accessNode, accessFlags | AccessFlags.CacheSymbol, /* reportDeprecated */ true); + return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, /* supressNoImplicitAnyError */ false, accessNode, accessFlags | AccessFlags.CacheSymbol, shouldIncludeUndefined, /* reportDeprecated */ true); } function getTypeFromIndexedAccessTypeNode(node: IndexedAccessTypeNode) { @@ -13988,7 +14204,7 @@ namespace ts { const objectType = getTypeFromTypeNode(node.objectType); const indexType = getTypeFromTypeNode(node.indexType); const potentialAlias = getAliasSymbolForTypeNode(node); - const resolved = getIndexedAccessType(objectType, indexType, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); + const resolved = getIndexedAccessType(objectType, indexType, /*noUncheckedIndexedAccessCandidate*/ undefined, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); links.resolvedType = resolved.flags & TypeFlags.IndexedAccess && (resolved).objectType === objectType && (resolved).indexType === indexType ? @@ -14199,7 +14415,13 @@ namespace ts { let current: Identifier | undefined; while (current = nameStack.shift()) { const meaning = nameStack.length ? SymbolFlags.Namespace : targetMeaning; - const next = getSymbol(getExportsOfSymbol(getMergedSymbol(resolveSymbol(currentNamespace))), current.escapedText, meaning); + // typeof a.b.c is normally resolved using `checkExpression` which in turn defers to `checkQualifiedName` + // That, in turn, ultimately uses `getPropertyOfType` on the type of the symbol, which differs slightly from + // the `exports` lookup process that only looks up namespace members which is used for most type references + const mergedResolvedSymbol = getMergedSymbol(resolveSymbol(currentNamespace)); + const next = node.isTypeOf + ? getPropertyOfType(getTypeOfSymbol(mergedResolvedSymbol), current.escapedText) + : getSymbol(getExportsOfSymbol(mergedResolvedSymbol), current.escapedText, meaning); if (!next) { error(current, Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), declarationNameToString(current)); return links.resolvedType = errorType; @@ -14263,7 +14485,7 @@ namespace ts { function getAliasSymbolForTypeNode(node: Node) { let host = node.parent; - while (isParenthesizedTypeNode(host) || isTypeOperatorNode(host) && host.operator === SyntaxKind.ReadonlyKeyword) { + while (isParenthesizedTypeNode(host) || isJSDocTypeExpression(host) || isTypeOperatorNode(host) && host.operator === SyntaxKind.ReadonlyKeyword) { host = host.parent; } return isTypeAlias(host) ? getSymbolOfNode(host) : undefined; @@ -14278,13 +14500,7 @@ namespace ts { } function isEmptyObjectTypeOrSpreadsIntoEmptyObject(type: Type) { - return isEmptyObjectType(type) || !!(type.flags & (TypeFlags.Null | TypeFlags.Undefined | TypeFlags.BooleanLike | TypeFlags.NumberLike | TypeFlags.BigIntLike | TypeFlags.StringLike | TypeFlags.EnumLike | TypeFlags.NonPrimitive | TypeFlags.Index | TypeFlags.TemplateLiteral)); - } - - function isSinglePropertyAnonymousObjectType(type: Type) { - return !!(type.flags & TypeFlags.Object) && - !!(getObjectFlags(type) & ObjectFlags.Anonymous) && - (length(getPropertiesOfType(type)) === 1 || every(getPropertiesOfType(type), p => !!(p.flags & SymbolFlags.Optional))); + return isEmptyObjectType(type) || !!(type.flags & (TypeFlags.Null | TypeFlags.Undefined | TypeFlags.BooleanLike | TypeFlags.NumberLike | TypeFlags.BigIntLike | TypeFlags.StringLike | TypeFlags.EnumLike | TypeFlags.NonPrimitive | TypeFlags.Index)); } function tryMergeUnionOfObjectTypeAndEmptyObject(type: UnionType, readonly: boolean): Type | undefined { @@ -14294,10 +14510,10 @@ namespace ts { if (every(type.types, isEmptyObjectTypeOrSpreadsIntoEmptyObject)) { return isEmptyObjectType(firstType) ? firstType : isEmptyObjectType(secondType) ? secondType : emptyObjectType; } - if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(firstType) && isSinglePropertyAnonymousObjectType(secondType)) { + if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(firstType)) { return getAnonymousPartialType(secondType); } - if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(secondType) && isSinglePropertyAnonymousObjectType(firstType)) { + if (isEmptyObjectTypeOrSpreadsIntoEmptyObject(secondType)) { return getAnonymousPartialType(firstType); } } @@ -14355,16 +14571,20 @@ namespace ts { if (merged) { return getSpreadType(merged, right, symbol, objectFlags, readonly); } - return mapType(left, t => getSpreadType(t, right, symbol, objectFlags, readonly)); + return checkCrossProductUnion([left, right]) + ? mapType(left, t => getSpreadType(t, right, symbol, objectFlags, readonly)) + : errorType; } if (right.flags & TypeFlags.Union) { const merged = tryMergeUnionOfObjectTypeAndEmptyObject(right as UnionType, readonly); if (merged) { return getSpreadType(left, merged, symbol, objectFlags, readonly); } - return mapType(right, t => getSpreadType(left, t, symbol, objectFlags, readonly)); + return checkCrossProductUnion([left, right]) + ? mapType(right, t => getSpreadType(left, t, symbol, objectFlags, readonly)) + : errorType; } - if (right.flags & (TypeFlags.BooleanLike | TypeFlags.NumberLike | TypeFlags.BigIntLike | TypeFlags.StringLike | TypeFlags.EnumLike | TypeFlags.NonPrimitive | TypeFlags.Index | TypeFlags.TemplateLiteral)) { + if (right.flags & (TypeFlags.BooleanLike | TypeFlags.NumberLike | TypeFlags.BigIntLike | TypeFlags.StringLike | TypeFlags.EnumLike | TypeFlags.NonPrimitive | TypeFlags.Index)) { return left; } @@ -14498,6 +14718,8 @@ namespace ts { return !!(type.flags & TypeFlags.Literal) && (type).freshType === type; } + function getLiteralType(value: string): StringLiteralType; + function getLiteralType(value: string | number | PseudoBigInt, enumId?: number, symbol?: Symbol): LiteralType; function getLiteralType(value: string | number | PseudoBigInt, enumId?: number, symbol?: Symbol) { // We store all literal types in a single map with keys of the form '#NNN' and '@SSS', // where NNN is the text representation of a numeric literal and SSS are the characters @@ -14642,6 +14864,8 @@ namespace ts { return neverType; case SyntaxKind.ObjectKeyword: return node.flags & NodeFlags.JavaScriptFile && !noImplicitAny ? anyType : nonPrimitiveType; + case SyntaxKind.IntrinsicKeyword: + return intrinsicMarkerType; case SyntaxKind.ThisType: case SyntaxKind.ThisKeyword as TypeNodeSyntaxKind: // TODO(rbuckton): `ThisKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service and because of `isPartOfTypeNode`. @@ -14889,9 +15113,10 @@ namespace ts { } function getObjectTypeInstantiation(type: AnonymousType | DeferredTypeReference, mapper: TypeMapper) { - const target = type.objectFlags & ObjectFlags.Instantiated ? type.target! : type; const declaration = type.objectFlags & ObjectFlags.Reference ? (type).node! : type.symbol.declarations[0]; const links = getNodeLinks(declaration); + const target = type.objectFlags & ObjectFlags.Reference ? links.resolvedType! : + type.objectFlags & ObjectFlags.Instantiated ? type.target! : type; let typeParameters = links.outerTypeParameters; if (!typeParameters) { // The first time an anonymous type is instantiated we compute and store a list of the type @@ -14908,10 +15133,6 @@ namespace ts { filter(typeParameters, tp => isTypeParameterPossiblyReferenced(tp, declaration)) : typeParameters; links.outerTypeParameters = typeParameters; - if (typeParameters.length) { - links.instantiations = new Map(); - links.instantiations.set(getTypeListId(typeParameters), target); - } } if (typeParameters.length) { // We are instantiating an anonymous type that has one or more type parameters in scope. Apply the @@ -14920,13 +15141,17 @@ namespace ts { const combinedMapper = combineTypeMappers(type.mapper, mapper); const typeArguments = map(typeParameters, t => getMappedType(t, combinedMapper)); const id = getTypeListId(typeArguments); - let result = links.instantiations!.get(id); + if (!target.instantiations) { + target.instantiations = new Map(); + target.instantiations.set(getTypeListId(typeParameters), target); + } + let result = target.instantiations.get(id); if (!result) { const newMapper = createTypeMapper(typeParameters, typeArguments); result = target.objectFlags & ObjectFlags.Reference ? createDeferredTypeReference((type).target, (type).node, newMapper) : target.objectFlags & ObjectFlags.Mapped ? instantiateMappedType(target, newMapper) : instantiateAnonymousType(target, newMapper); - links.instantiations!.set(id, result); + target.instantiations.set(id, result); } return result; } @@ -15166,10 +15391,13 @@ namespace ts { return getIndexType(instantiateType((type).type, mapper)); } if (flags & TypeFlags.TemplateLiteral) { - return getTemplateLiteralType((type).texts, (type).casings, instantiateTypes((type).types, mapper)); + return getTemplateLiteralType((type).texts, instantiateTypes((type).types, mapper)); + } + if (flags & TypeFlags.StringMapping) { + return getStringMappingType((type).symbol, instantiateType((type).type, mapper)); } if (flags & TypeFlags.IndexedAccess) { - return getIndexedAccessType(instantiateType((type).objectType, mapper), instantiateType((type).indexType, mapper), /*accessNode*/ undefined, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)); + return getIndexedAccessType(instantiateType((type).objectType, mapper), instantiateType((type).indexType, mapper), (type).noUncheckedIndexedAccessCandidate, /*accessNode*/ undefined, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)); } if (flags & TypeFlags.Conditional) { return getConditionalTypeInstantiation(type, combineTypeMappers((type).mapper, mapper)); @@ -15349,7 +15577,7 @@ namespace ts { source.flags & TypeFlags.InstantiableNonPrimitive ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : target === globalObjectType ? !!(source.flags & (TypeFlags.Object | TypeFlags.NonPrimitive)) : target === globalFunctionType ? !!(source.flags & TypeFlags.Object) && isFunctionObjectType(source as ObjectType) : - hasBaseType(source, getTargetType(target)); + hasBaseType(source, getTargetType(target)) || (isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType)); } /** @@ -15666,10 +15894,6 @@ namespace ts { } } - function getSemanticJsxChildren(children: NodeArray) { - return filter(children, i => !isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces); - } - function elaborateJsxComponents( node: JsxAttributes, source: Type, @@ -15931,36 +16155,38 @@ namespace ts { const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1; for (let i = 0; i < paramCount; i++) { - const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : getTypeAtPosition(source, i); - const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : getTypeAtPosition(target, i); - // In order to ensure that any generic type Foo is at least co-variant with respect to T no matter - // how Foo uses T, we need to relate parameters bi-variantly (given that parameters are input positions, - // they naturally relate only contra-variantly). However, if the source and target parameters both have - // function types with a single call signature, we know we are relating two callback parameters. In - // that case it is sufficient to only relate the parameters of the signatures co-variantly because, - // similar to return values, callback parameters are output positions. This means that a Promise, - // where T is used only in callback parameter positions, will be co-variant (as opposed to bi-variant) - // with respect to T. - const sourceSig = checkMode & SignatureCheckMode.Callback ? undefined : getSingleCallSignature(getNonNullableType(sourceType)); - const targetSig = checkMode & SignatureCheckMode.Callback ? undefined : getSingleCallSignature(getNonNullableType(targetType)); - const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && - (getFalsyFlags(sourceType) & TypeFlags.Nullable) === (getFalsyFlags(targetType) & TypeFlags.Nullable); - let related = callbacks ? - compareSignaturesRelated(targetSig!, sourceSig!, (checkMode & SignatureCheckMode.StrictArity) | (strictVariance ? SignatureCheckMode.StrictCallback : SignatureCheckMode.BivariantCallback), reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : - !(checkMode & SignatureCheckMode.Callback) && !strictVariance && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors); - // With strict arity, (x: number | undefined) => void is a subtype of (x?: number | undefined) => void - if (related && checkMode & SignatureCheckMode.StrictArity && i >= getMinArgumentCount(source) && i < getMinArgumentCount(target) && compareTypes(sourceType, targetType, /*reportErrors*/ false)) { - related = Ternary.False; - } - if (!related) { - if (reportErrors) { - errorReporter!(Diagnostics.Types_of_parameters_0_and_1_are_incompatible, - unescapeLeadingUnderscores(getParameterNameAtPosition(source, i)), - unescapeLeadingUnderscores(getParameterNameAtPosition(target, i))); + const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i); + const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i); + if (sourceType && targetType) { + // In order to ensure that any generic type Foo is at least co-variant with respect to T no matter + // how Foo uses T, we need to relate parameters bi-variantly (given that parameters are input positions, + // they naturally relate only contra-variantly). However, if the source and target parameters both have + // function types with a single call signature, we know we are relating two callback parameters. In + // that case it is sufficient to only relate the parameters of the signatures co-variantly because, + // similar to return values, callback parameters are output positions. This means that a Promise, + // where T is used only in callback parameter positions, will be co-variant (as opposed to bi-variant) + // with respect to T. + const sourceSig = checkMode & SignatureCheckMode.Callback ? undefined : getSingleCallSignature(getNonNullableType(sourceType)); + const targetSig = checkMode & SignatureCheckMode.Callback ? undefined : getSingleCallSignature(getNonNullableType(targetType)); + const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && + (getFalsyFlags(sourceType) & TypeFlags.Nullable) === (getFalsyFlags(targetType) & TypeFlags.Nullable); + let related = callbacks ? + compareSignaturesRelated(targetSig!, sourceSig!, (checkMode & SignatureCheckMode.StrictArity) | (strictVariance ? SignatureCheckMode.StrictCallback : SignatureCheckMode.BivariantCallback), reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : + !(checkMode & SignatureCheckMode.Callback) && !strictVariance && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors); + // With strict arity, (x: number | undefined) => void is a subtype of (x?: number | undefined) => void + if (related && checkMode & SignatureCheckMode.StrictArity && i >= getMinArgumentCount(source) && i < getMinArgumentCount(target) && compareTypes(sourceType, targetType, /*reportErrors*/ false)) { + related = Ternary.False; } - return Ternary.False; + if (!related) { + if (reportErrors) { + errorReporter!(Diagnostics.Types_of_parameters_0_and_1_are_incompatible, + unescapeLeadingUnderscores(getParameterNameAtPosition(source, i)), + unescapeLeadingUnderscores(getParameterNameAtPosition(target, i))); + } + return Ternary.False; + } + result &= related; } - result &= related; } if (!(checkMode & SignatureCheckMode.IgnoreReturnTypes)) { @@ -17087,9 +17313,12 @@ namespace ts { depth--; if (result) { if (result === Ternary.True || depth === 0) { - // If result is definitely true, record all maybe keys as having succeeded - for (let i = maybeStart; i < maybeCount; i++) { - relation.set(maybeKeys[i], RelationComparisonResult.Succeeded | propagatingVarianceFlags); + if (result === Ternary.True || result === Ternary.Maybe) { + // If result is definitely true, record all maybe keys as having succeeded. Also, record Ternary.Maybe + // results as having succeeded once we reach depth 0, but never record Ternary.Unknown results. + for (let i = maybeStart; i < maybeCount; i++) { + relation.set(maybeKeys[i], RelationComparisonResult.Succeeded | propagatingVarianceFlags); + } } maybeCount = maybeStart; } @@ -17104,9 +17333,9 @@ namespace ts { } function structuredTypeRelatedTo(source: Type, target: Type, reportErrors: boolean, intersectionState: IntersectionState): Ternary { - tracing.begin(tracing.Phase.Check, "structuredTypeRelatedTo", { sourceId: source.id, targetId: target.id }); + tracing.push(tracing.Phase.Check, "structuredTypeRelatedTo", { sourceId: source.id, targetId: target.id }); const result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState); - tracing.end(); + tracing.pop(); return result; } @@ -17159,7 +17388,7 @@ namespace ts { !(source.aliasTypeArgumentsContainsMarker || target.aliasTypeArgumentsContainsMarker)) { const variances = getAliasVariances(source.aliasSymbol); if (variances === emptyArray) { - return Ternary.Maybe; + return Ternary.Unknown; } const varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances, intersectionState); if (varianceResult !== undefined) { @@ -17227,7 +17456,7 @@ namespace ts { const baseIndexType = getBaseConstraintOfType(indexType) || indexType; if (!isGenericObjectType(baseObjectType) && !isGenericIndexType(baseIndexType)) { const accessFlags = AccessFlags.Writing | (baseObjectType !== objectType ? AccessFlags.NoIndexSignatures : 0); - const constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, /*accessNode*/ undefined, accessFlags); + const constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, (target).noUncheckedIndexedAccessCandidate, /*accessNode*/ undefined, accessFlags); if (constraint && (result = isRelatedTo(source, constraint, reportErrors))) { return result; } @@ -17277,6 +17506,15 @@ namespace ts { } } } + else if (target.flags & TypeFlags.TemplateLiteral && source.flags & TypeFlags.StringLiteral) { + if (isPatternLiteralType(target)) { + // match all non-`string` segments + const result = inferLiteralsFromTemplateLiteralType(source as StringLiteralType, target as TemplateLiteralType); + if (result && every(result, (r, i) => isStringLiteralTypeValueParsableAsType(r, (target as TemplateLiteralType).types[i]))) { + return Ternary.True; + } + } + } if (source.flags & TypeFlags.TypeVariable) { if (source.flags & TypeFlags.IndexedAccess && target.flags & TypeFlags.IndexedAccess) { @@ -17317,12 +17555,34 @@ namespace ts { } } else if (source.flags & TypeFlags.TemplateLiteral) { + if (target.flags & TypeFlags.TemplateLiteral && + (source as TemplateLiteralType).texts.length === (target as TemplateLiteralType).texts.length && + (source as TemplateLiteralType).types.length === (target as TemplateLiteralType).types.length && + every((source as TemplateLiteralType).texts, (t, i) => t === (target as TemplateLiteralType).texts[i]) && + every((instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers)) as TemplateLiteralType).types, (t, i) => !!((target as TemplateLiteralType).types[i].flags & (TypeFlags.Any | TypeFlags.String)) || !!isRelatedTo(t, (target as TemplateLiteralType).types[i], /*reportErrors*/ false))) { + return Ternary.True; + } const constraint = getBaseConstraintOfType(source); - if (constraint && (result = isRelatedTo(constraint, target, reportErrors))) { + if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, reportErrors))) { resetErrorInfo(saveErrorInfo); return result; } } + else if (source.flags & TypeFlags.StringMapping) { + if (target.flags & TypeFlags.StringMapping && (source).symbol === (target).symbol) { + if (result = isRelatedTo((source).type, (target).type, reportErrors)) { + resetErrorInfo(saveErrorInfo); + return result; + } + } + else { + const constraint = getBaseConstraintOfType(source); + if (constraint && (result = isRelatedTo(constraint, target, reportErrors))) { + resetErrorInfo(saveErrorInfo); + return result; + } + } + } else if (source.flags & TypeFlags.Conditional) { if (target.flags & TypeFlags.Conditional) { // Two conditional types 'T1 extends U1 ? X1 : Y1' and 'T2 extends U2 ? X2 : Y2' are related if @@ -17401,7 +17661,7 @@ namespace ts { // effectively means we measure variance only from type parameter occurrences that aren't nested in // recursive instantiations of the generic type. if (variances === emptyArray) { - return Ternary.Maybe; + return Ternary.Unknown; } const varianceResult = relateVariances(getTypeArguments(source), getTypeArguments(target), variances, intersectionState); if (varianceResult !== undefined) { @@ -18224,12 +18484,12 @@ namespace ts { if (type.flags & TypeFlags.Instantiable) { const constraint = getConstraintOfType(type); - if (constraint) { + if (constraint && constraint !== type) { return typeCouldHaveTopLevelSingletonTypes(constraint); } } - return isUnitType(type); + return isUnitType(type) || !!(type.flags & TypeFlags.TemplateLiteral); } function getBestMatchingType(source: Type, target: UnionOrIntersectionType, isRelatedTo = compareTypesAssignable) { @@ -18264,8 +18524,18 @@ namespace ts { } } const match = discriminable.indexOf(/*searchElement*/ true); + if (match === -1) { + return defaultValue; + } // make sure exactly 1 matches before returning it - return match === -1 || discriminable.indexOf(/*searchElement*/ true, match + 1) !== -1 ? defaultValue : target.types[match]; + let nextMatch = discriminable.indexOf(/*searchElement*/ true, match + 1); + while (nextMatch !== -1) { + if (!isTypeIdenticalTo(target.types[match], target.types[nextMatch])) { + return defaultValue; + } + nextMatch = discriminable.indexOf(/*searchElement*/ true, nextMatch + 1); + } + return target.types[match]; } /** @@ -18320,7 +18590,7 @@ namespace ts { function getVariancesWorker(typeParameters: readonly TypeParameter[] = emptyArray, cache: TCache, createMarkerType: (input: TCache, param: TypeParameter, marker: Type) => Type): VarianceFlags[] { let variances = cache.variances; if (!variances) { - tracing.begin(tracing.Phase.Check, "getVariancesWorker", { arity: typeParameters.length, id: (cache as any).id ?? (cache as any).declaredType?.id ?? -1 }); + tracing.push(tracing.Phase.Check, "getVariancesWorker", { arity: typeParameters.length, id: (cache as any).id ?? (cache as any).declaredType?.id ?? -1 }); // The emptyArray singleton is used to signal a recursive invocation. cache.variances = emptyArray; variances = []; @@ -18355,7 +18625,7 @@ namespace ts { variances.push(variance); } cache.variances = variances; - tracing.end(); + tracing.pop(); } return variances; } @@ -19500,7 +19770,8 @@ namespace ts { // arrow function, but is considered partially inferable because property 'a' has an inferable type. function isPartiallyInferableType(type: Type): boolean { return !(getObjectFlags(type) & ObjectFlags.NonInferrableType) || - isObjectLiteralType(type) && some(getPropertiesOfType(type), prop => isPartiallyInferableType(getTypeOfSymbol(prop))); + isObjectLiteralType(type) && some(getPropertiesOfType(type), prop => isPartiallyInferableType(getTypeOfSymbol(prop))) || + isTupleType(type) && some(getTypeArguments(type), isPartiallyInferableType); } function createReverseMappedType(source: Type, target: MappedType, constraint: IndexType) { @@ -19599,6 +19870,63 @@ namespace ts { return !!(type.symbol && some(type.symbol.declarations, hasSkipDirectInferenceFlag)); } + function isValidBigIntString(s: string): boolean { + const scanner = createScanner(ScriptTarget.ESNext, /*skipTrivia*/ false); + let success = true; + scanner.setOnError(() => success = false); + scanner.setText(s + "n"); + let result = scanner.scan(); + if (result === SyntaxKind.MinusToken) { + result = scanner.scan(); + } + const flags = scanner.getTokenFlags(); + // validate that + // * scanning proceeded without error + // * a bigint can be scanned, and that when it is scanned, it is + // * the full length of the input string (so the scanner is one character beyond the augmented input length) + // * it does not contain a numeric seperator (the `BigInt` constructor does not accept a numeric seperator in its input) + return success && result === SyntaxKind.BigIntLiteral && scanner.getTextPos() === (s.length + 1) && !(flags & TokenFlags.ContainsSeparator); + } + + function isStringLiteralTypeValueParsableAsType(s: StringLiteralType, target: Type): boolean { + if (target.flags & TypeFlags.Union) { + return !!forEachType(target, t => isStringLiteralTypeValueParsableAsType(s, t)); + } + switch (target) { + case stringType: return true; + case numberType: return s.value !== "" && isFinite(+(s.value)); + case bigintType: return s.value !== "" && isValidBigIntString(s.value); + // the next 4 should be handled in `getTemplateLiteralType`, as they are all exactly one value, but are here for completeness, just in case + // this function is ever used on types which don't come from template literal holes + case trueType: return s.value === "true"; + case falseType: return s.value === "false"; + case undefinedType: return s.value === "undefined"; + case nullType: return s.value === "null"; + default: return !!(target.flags & TypeFlags.Any); + } + } + + function inferLiteralsFromTemplateLiteralType(source: StringLiteralType, target: TemplateLiteralType): StringLiteralType[] | undefined { + const value = source.value; + const texts = target.texts; + const lastIndex = texts.length - 1; + const startText = texts[0]; + const endText = texts[lastIndex]; + if (!(value.startsWith(startText) && value.slice(startText.length).endsWith(endText))) return undefined; + const matches = []; + const str = value.slice(startText.length, value.length - endText.length); + let pos = 0; + for (let i = 1; i < lastIndex; i++) { + const delim = texts[i]; + const delimPos = delim.length > 0 ? str.indexOf(delim, pos) : pos < str.length ? pos + 1 : -1; + if (delimPos < 0) return undefined; + matches.push(getLiteralType(str.slice(pos, delimPos))); + pos = delimPos + delim.length; + } + matches.push(getLiteralType(str.slice(pos))); + return matches; + } + function inferTypes(inferences: InferenceInfo[], originalSource: Type, originalTarget: Type, priority: InferencePriority = 0, contravariant = false) { let bivariant = false; let propagationType: Type; @@ -19767,6 +20095,11 @@ namespace ts { inferFromTypes((source).objectType, (target).objectType); inferFromTypes((source).indexType, (target).indexType); } + else if (source.flags & TypeFlags.StringMapping && target.flags & TypeFlags.StringMapping) { + if ((source).symbol === (target).symbol) { + inferFromTypes((source).type, (target).type); + } + } else if (target.flags & TypeFlags.Conditional) { invokeOnce(source, target, inferToConditionalType); } @@ -20063,7 +20396,7 @@ namespace ts { function inferToTemplateLiteralType(source: Type, target: TemplateLiteralType) { const matches = source.flags & TypeFlags.StringLiteral ? inferLiteralsFromTemplateLiteralType(source, target) : - source.flags & TypeFlags.TemplateLiteral && arraysEqual((source).texts, target.texts) && arraysEqual((source).casings, target.casings)? (source).types : + source.flags & TypeFlags.TemplateLiteral && arraysEqual((source).texts, target.texts) ? (source).types : undefined; const types = target.types; for (let i = 0; i < types.length; i++) { @@ -20071,27 +20404,6 @@ namespace ts { } } - function inferLiteralsFromTemplateLiteralType(source: StringLiteralType, target: TemplateLiteralType): Type[] | undefined { - const value = source.value; - const texts = target.texts; - const lastIndex = texts.length - 1; - const startText = texts[0]; - const endText = texts[lastIndex]; - if (!(value.startsWith(startText) && value.endsWith(endText))) return undefined; - const matches = []; - const str = value.slice(startText.length, value.length - endText.length); - let pos = 0; - for (let i = 1; i < lastIndex; i++) { - const delim = texts[i]; - const delimPos = delim.length > 0 ? str.indexOf(delim, pos) : pos < str.length ? pos + 1 : -1; - if (delimPos < 0) return undefined; - matches.push(getLiteralType(str.slice(pos, delimPos))); - pos = delimPos + delim.length; - } - matches.push(getLiteralType(str.slice(pos))); - return matches; - } - function inferFromObjectTypes(source: Type, target: Type) { if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && ( (source).target === (target).target || isArrayType(source) && isArrayType(target))) { @@ -20257,7 +20569,7 @@ namespace ts { function hasPrimitiveConstraint(type: TypeParameter): boolean { const constraint = getConstraintOfTypeParameter(type); - return !!constraint && maybeTypeOfKind(constraint.flags & TypeFlags.Conditional ? getDefaultConstraintOfConditionalType(constraint as ConditionalType) : constraint, TypeFlags.Primitive | TypeFlags.Index | TypeFlags.TemplateLiteral); + return !!constraint && maybeTypeOfKind(constraint.flags & TypeFlags.Conditional ? getDefaultConstraintOfConditionalType(constraint as ConditionalType) : constraint, TypeFlags.Primitive | TypeFlags.Index | TypeFlags.TemplateLiteral | TypeFlags.StringMapping); } function isObjectLiteralType(type: Type) { @@ -20379,22 +20691,22 @@ namespace ts { return Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom; case "$": return compilerOptions.types - ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig - : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery; + ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig + : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery; case "describe": case "suite": case "it": case "test": return compilerOptions.types - ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashjest_or_npm_i_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig - : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashjest_or_npm_i_types_Slashmocha; + ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig + : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha; case "process": case "require": case "Buffer": case "module": return compilerOptions.types - ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig - : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode; + ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig + : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode; case "Map": case "Set": case "Promise": @@ -20403,7 +20715,17 @@ namespace ts { case "WeakSet": case "Iterator": case "AsyncIterator": - return Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later; + case "SharedArrayBuffer": + case "Atomics": + case "AsyncIterable": + case "AsyncIterableIterator": + case "AsyncGenerator": + case "AsyncGeneratorFunction": + case "BigInt": + case "Reflect": + case "BigInt64Array": + case "BigUint64Array": + return Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later; default: if (node.parent.kind === SyntaxKind.ShorthandPropertyAssignment) { return Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; @@ -20473,7 +20795,8 @@ namespace ts { case SyntaxKind.NonNullExpression: return isMatchingReference(source, (target as NonNullExpression | ParenthesizedExpression).expression); case SyntaxKind.BinaryExpression: - return isAssignmentExpression(target) && isMatchingReference(source, target.left); + return (isAssignmentExpression(target) && isMatchingReference(source, target.left)) || + (isBinaryExpression(target) && target.operatorToken.kind === SyntaxKind.CommaToken && isMatchingReference(source, target.right)); } switch (source.kind) { case SyntaxKind.Identifier: @@ -21103,6 +21426,12 @@ namespace ts { return getTypeOfSymbol(symbol); } if (symbol.flags & (SymbolFlags.Variable | SymbolFlags.Property)) { + if (getCheckFlags(symbol) & CheckFlags.Mapped) { + const origin = (symbol).syntheticOrigin; + if (origin && getExplicitTypeOfSymbol(origin)) { + return getTypeOfSymbol(symbol); + } + } const declaration = symbol.valueDeclaration; if (declaration) { if (isDeclarationWithExplicitTypeAnnotation(declaration)) { @@ -22290,7 +22619,8 @@ namespace ts { case SyntaxKind.CallExpression: return narrowTypeByCallExpression(type, expr, assumeTrue); case SyntaxKind.ParenthesizedExpression: - return narrowType(type, (expr).expression, assumeTrue); + case SyntaxKind.NonNullExpression: + return narrowType(type, (expr).expression, assumeTrue); case SyntaxKind.BinaryExpression: return narrowTypeByBinaryExpression(type, expr, assumeTrue); case SyntaxKind.PrefixUnaryExpression: @@ -22474,11 +22804,12 @@ namespace ts { } const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); - let declaration: Declaration | undefined = localOrExportSymbol.valueDeclaration; - - if (declaration && getCombinedNodeFlags(declaration) & NodeFlags.Deprecated && isUncalledFunctionReference(node.parent, localOrExportSymbol)) { - errorOrSuggestion(/* isError */ false, node, Diagnostics._0_is_deprecated, node.escapedText as string);; + const sourceSymbol = localOrExportSymbol.flags & SymbolFlags.Alias ? resolveAlias(localOrExportSymbol) : localOrExportSymbol; + if (getDeclarationNodeFlagsFromSymbol(sourceSymbol) & NodeFlags.Deprecated && isUncalledFunctionReference(node.parent, sourceSymbol)) { + errorOrSuggestion(/* isError */ false, node, Diagnostics._0_is_deprecated, node.escapedText as string); } + + let declaration: Declaration | undefined = localOrExportSymbol.valueDeclaration; if (localOrExportSymbol.flags & SymbolFlags.Class) { // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind @@ -23651,7 +23982,10 @@ namespace ts { function getContextualTypeForElementExpression(arrayContextualType: Type | undefined, index: number): Type | undefined { return arrayContextualType && ( getTypeOfPropertyOfContextualType(arrayContextualType, "" + index as __String) - || getIteratedTypeOrElementType(IterationUse.Element, arrayContextualType, undefinedType, /*errorNode*/ undefined, /*checkAssignability*/ false)); + || mapType( + arrayContextualType, + t => getIteratedTypeOrElementType(IterationUse.Element, t, undefinedType, /*errorNode*/ undefined, /*checkAssignability*/ false), + /*noReductions*/ true)); } // In a contextually typed conditional expression, the true/false expressions are contextually typed by the same type. @@ -24618,7 +24952,7 @@ namespace ts { const exprType = checkJsxAttribute(attributeDecl, checkMode); objectFlags |= getObjectFlags(exprType) & ObjectFlags.PropagatingFlags; - const attributeSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.escapedName); + const attributeSymbol = createSymbol(SymbolFlags.Property | member.flags, member.escapedName); attributeSymbol.declarations = member.declarations; attributeSymbol.parent = member.parent; if (member.valueDeclaration) { @@ -24677,7 +25011,7 @@ namespace ts { const contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes); const childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName); // If there are children in the body of JSX element, create dummy attribute "children" with the union of children types so that it will pass the attribute checking process - const childrenPropSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, jsxChildrenPropertyName); + const childrenPropSymbol = createSymbol(SymbolFlags.Property, jsxChildrenPropertyName); childrenPropSymbol.type = childrenTypes.length === 1 ? childrenTypes[0] : childrenContextualType && forEachType(childrenContextualType, isTupleLikeType) ? createTupleType(childrenTypes) : createArrayType(getUnionType(childrenTypes)); @@ -24724,6 +25058,9 @@ namespace ts { childrenTypes.push(stringType); } } + else if (child.kind === SyntaxKind.JsxExpression && !child.expression) { + continue; // empty jsx expressions don't *really* count as present children + } else { childrenTypes.push(checkExpressionForMutableLocation(child, checkMode)); } @@ -24798,6 +25135,31 @@ namespace ts { return links.resolvedSymbol; } + function getJsxNamespaceContainerForImplicitImport(location: Node | undefined): Symbol | undefined { + const file = location && getSourceFileOfNode(location); + const links = file && getNodeLinks(file); + if (links && links.jsxImplicitImportContainer === false) { + return undefined; + } + if (links && links.jsxImplicitImportContainer) { + return links.jsxImplicitImportContainer; + } + const runtimeImportSpecifier = getJSXRuntimeImport(getJSXImplicitImportBase(compilerOptions, file), compilerOptions); + if (!runtimeImportSpecifier) { + return undefined; + } + const isClassic = getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Classic; + const errorMessage = isClassic + ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_the_paths_option + : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations; + const mod = resolveExternalModule(location!, runtimeImportSpecifier, errorMessage, location!); + const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : undefined; + if (links) { + links.jsxImplicitImportContainer = result || false; + } + return result; + } + function getJsxNamespaceAt(location: Node | undefined): Symbol { const links = location && getNodeLinks(location); if (links && links.jsxNamespace) { @@ -24805,22 +25167,29 @@ namespace ts { } if (!links || links.jsxNamespace !== false) { const namespaceName = getJsxNamespace(location); - const resolvedNamespace = resolveName(location, namespaceName, SymbolFlags.Namespace, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false); + let resolvedNamespace = resolveName(location, namespaceName, SymbolFlags.Namespace, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false); + if (!resolvedNamespace || resolvedNamespace === unknownSymbol) { + resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location); + } if (resolvedNamespace) { const candidate = resolveSymbol(getSymbol(getExportsOfSymbol(resolveSymbol(resolvedNamespace)), JsxNames.JSX, SymbolFlags.Namespace)); - if (candidate) { + if (candidate && candidate !== unknownSymbol) { if (links) { links.jsxNamespace = candidate; } return candidate; } - if (links) { - links.jsxNamespace = false; - } + } + if (links) { + links.jsxNamespace = false; } } // JSX global fallback - return getGlobalSymbol(JsxNames.JSX, SymbolFlags.Namespace, /*diagnosticMessage*/ undefined)!; // TODO: GH#18217 + const s = resolveSymbol(getGlobalSymbol(JsxNames.JSX, SymbolFlags.Namespace, /*diagnosticMessage*/ undefined)); + if (s === unknownSymbol) { + return undefined!; // TODO: GH#18217 + } + return s!; // TODO: GH#18217 } /** @@ -25481,10 +25850,9 @@ namespace ts { propType = (compilerOptions.noUncheckedIndexedAccess && !isAssignmentTarget(node)) ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; } else { - if (prop.valueDeclaration?.flags & NodeFlags.Deprecated && isUncalledFunctionReference(node, prop)) { + if (getDeclarationNodeFlagsFromSymbol(prop) & NodeFlags.Deprecated && isUncalledFunctionReference(node, prop)) { errorOrSuggestion(/* isError */ false, right, Diagnostics._0_is_deprecated, right.escapedText as string); } - checkPropertyNotUsedBeforeDeclaration(prop, node, right); markPropertyAsReferenced(prop, node, left.kind === SyntaxKind.ThisKeyword); getNodeLinks(node).resolvedSymbol = prop; @@ -25644,14 +26012,22 @@ namespace ts { relatedInfo = createDiagnosticForNode(propNode, Diagnostics.Did_you_forget_to_use_await); } else { - const suggestion = getSuggestedSymbolForNonexistentProperty(propNode, containingType); - if (suggestion !== undefined) { - const suggestedName = symbolName(suggestion); - errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, declarationNameToString(propNode), typeToString(containingType), suggestedName); - relatedInfo = suggestion.valueDeclaration && createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestedName); + const missingProperty = declarationNameToString(propNode); + const container = typeToString(containingType); + const libSuggestion = getSuggestedLibForNonExistentProperty(missingProperty, containingType); + if (libSuggestion !== undefined) { + errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2_or_later, missingProperty, container, libSuggestion); } else { - errorInfo = chainDiagnosticMessages(elaborateNeverIntersection(errorInfo, containingType), Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(containingType)); + const suggestion = getSuggestedSymbolForNonexistentProperty(propNode, containingType); + if (suggestion !== undefined) { + const suggestedName = symbolName(suggestion); + errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, missingProperty, container, suggestedName); + relatedInfo = suggestion.valueDeclaration && createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestedName); + } + else { + errorInfo = chainDiagnosticMessages(elaborateNeverIntersection(errorInfo, containingType), Diagnostics.Property_0_does_not_exist_on_type_1, missingProperty, container); + } } } } @@ -25667,6 +26043,34 @@ namespace ts { return prop !== undefined && prop.valueDeclaration && hasSyntacticModifier(prop.valueDeclaration, ModifierFlags.Static); } + function getSuggestedLibForNonExistentName(name: __String | Identifier) { + const missingName = diagnosticName(name); + const allFeatures = getScriptTargetFeatures(); + const libTargets = getOwnKeys(allFeatures); + for (const libTarget of libTargets) { + const containingTypes = getOwnKeys(allFeatures[libTarget]); + if (containingTypes !== undefined && contains(containingTypes, missingName)) { + return libTarget; + } + } + } + + function getSuggestedLibForNonExistentProperty(missingProperty: string, containingType: Type) { + const container = getApparentType(containingType).symbol; + if (!container) { + return undefined; + } + const allFeatures = getScriptTargetFeatures(); + const libTargets = getOwnKeys(allFeatures); + for (const libTarget of libTargets) { + const featuresOfLib = allFeatures[libTarget]; + const featuresOfContainingType = featuresOfLib[symbolName(container)]; + if (featuresOfContainingType !== undefined && contains(featuresOfContainingType, missingProperty)) { + return libTarget; + } + } + } + function getSuggestedSymbolForNonexistentProperty(name: Identifier | PrivateIdentifier | string, containingType: Type): Symbol | undefined { return getSpellingSuggestionForName(isString(name) ? name : idText(name), getPropertiesOfType(containingType), SymbolFlags.Value); } @@ -25756,6 +26160,7 @@ namespace ts { */ function getSpellingSuggestionForName(name: string, symbols: Symbol[], meaning: SymbolFlags): Symbol | undefined { return getSpellingSuggestion(name, symbols, getCandidateName); + function getCandidateName(candidate: Symbol) { const candidateName = symbolName(candidate); if (startsWith(candidateName, "\"")) { @@ -25918,7 +26323,7 @@ namespace ts { const accessFlags = isAssignmentTarget(node) ? AccessFlags.Writing | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? AccessFlags.NoIndexSignatures : 0) : AccessFlags.None; - const indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, node, accessFlags | AccessFlags.ExpressionPosition) || errorType; + const indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, /*noUncheckedIndexedAccessCandidate*/ undefined, node, accessFlags | AccessFlags.ExpressionPosition) || errorType; return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, indexedAccessType.symbol, indexedAccessType, indexExpression), node); } @@ -26310,7 +26715,7 @@ namespace ts { else { const contextualType = getIndexedAccessType(restType, getLiteralType(i - index)); const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode); - const hasPrimitiveContextualType = maybeTypeOfKind(contextualType, TypeFlags.Primitive | TypeFlags.Index | TypeFlags.TemplateLiteral); + const hasPrimitiveContextualType = maybeTypeOfKind(contextualType, TypeFlags.Primitive | TypeFlags.Index | TypeFlags.TemplateLiteral | TypeFlags.StringMapping); types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(ElementFlags.Required); } @@ -26924,10 +27329,10 @@ namespace ts { // is just important for choosing the best signature. So in the case where there is only one // signature, the subtype pass is useless. So skipping it is an optimization. if (candidates.length > 1) { - result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma); + result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma); } if (!result) { - result = chooseOverload(candidates, assignableRelation, signatureHelpTrailingComma); + result = chooseOverload(candidates, assignableRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma); } if (result) { return result; @@ -26952,6 +27357,7 @@ namespace ts { if (last.declaration && candidatesForArgumentError.length > 3) { addRelatedInfo(d, createDiagnosticForNode(last.declaration, Diagnostics.The_last_overload_is_declared_here)); } + addImplementationSuccessElaboration(last, d); diagnostics.add(d); } } @@ -26987,14 +27393,19 @@ namespace ts { const chain = chainDiagnosticMessages( map(diags, d => typeof d.messageText === "string" ? (d as DiagnosticMessageChain) : d.messageText), Diagnostics.No_overload_matches_this_call); - const related = flatMap(diags, d => (d as Diagnostic).relatedInformation) as DiagnosticRelatedInformation[]; + // The below is a spread to guarantee we get a new (mutable) array - our `flatMap` helper tries to do "smart" optimizations where it reuses input + // arrays and the emptyArray singleton where possible, which is decidedly not what we want while we're still constructing this diagnostic + const related = [...flatMap(diags, d => (d as Diagnostic).relatedInformation) as DiagnosticRelatedInformation[]]; + let diag: Diagnostic; if (every(diags, d => d.start === diags[0].start && d.length === diags[0].length && d.file === diags[0].file)) { const { file, start, length } = diags[0]; - diagnostics.add({ file, start, length, code: chain.code, category: chain.category, messageText: chain, relatedInformation: related }); + diag = { file, start, length, code: chain.code, category: chain.category, messageText: chain, relatedInformation: related }; } else { - diagnostics.add(createDiagnosticForNodeFromMessageChain(node, chain, related)); + diag = createDiagnosticForNodeFromMessageChain(node, chain, related); } + addImplementationSuccessElaboration(candidatesForArgumentError[0], diag); + diagnostics.add(diag); } } else if (candidateForArgumentArityError) { @@ -27019,7 +27430,28 @@ namespace ts { return getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray); - function chooseOverload(candidates: Signature[], relation: ESMap, signatureHelpTrailingComma = false) { + function addImplementationSuccessElaboration(failed: Signature, diagnostic: Diagnostic) { + const oldCandidatesForArgumentError = candidatesForArgumentError; + const oldCandidateForArgumentArityError = candidateForArgumentArityError; + const oldCandidateForTypeArgumentError = candidateForTypeArgumentError; + + const declCount = length(failed.declaration?.symbol.declarations); + const isOverload = declCount > 1; + const implDecl = isOverload ? find(failed.declaration?.symbol.declarations || emptyArray, d => isFunctionLikeDeclaration(d) && nodeIsPresent(d.body)) : undefined; + if (implDecl) { + const candidate = getSignatureFromDeclaration(implDecl as FunctionLikeDeclaration); + const isSingleNonGenericCandidate = !candidate.typeParameters; + if (chooseOverload([candidate], assignableRelation, isSingleNonGenericCandidate)) { + addRelatedInfo(diagnostic, createDiagnosticForNode(implDecl, Diagnostics.The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_are_not_externally_visible)); + } + } + + candidatesForArgumentError = oldCandidatesForArgumentError; + candidateForArgumentArityError = oldCandidateForArgumentArityError; + candidateForTypeArgumentError = oldCandidateForTypeArgumentError; + } + + function chooseOverload(candidates: Signature[], relation: ESMap, isSingleNonGenericCandidate: boolean, signatureHelpTrailingComma = false) { candidatesForArgumentError = undefined; candidateForArgumentArityError = undefined; candidateForTypeArgumentError = undefined; @@ -27637,6 +28069,12 @@ namespace ts { } if (!callSignatures.length) { + if (isArrayLiteralExpression(node.parent)) { + const diagnostic = createDiagnosticForNode(node.tag, Diagnostics.It_is_likely_that_you_are_missing_a_comma_to_separate_these_two_template_expressions_They_form_a_tagged_template_expression_which_cannot_be_invoked); + diagnostics.add(diagnostic); + return resolveErrorCall(node); + } + invocationError(node.tag, apparentType, SignatureKind.Call); return resolveErrorCall(node); } @@ -27866,15 +28304,59 @@ namespace ts { } function getAssignedClassSymbol(decl: Declaration): Symbol | undefined { - const assignmentSymbol = decl && decl.parent && - (isFunctionDeclaration(decl) && getSymbolOfNode(decl) || - isBinaryExpression(decl.parent) && getSymbolOfNode(decl.parent.left) || - isVariableDeclaration(decl.parent) && getSymbolOfNode(decl.parent)); - const prototype = assignmentSymbol && assignmentSymbol.exports && assignmentSymbol.exports.get("prototype" as __String); - const init = prototype && prototype.valueDeclaration && getAssignedJSPrototype(prototype.valueDeclaration); + const assignmentSymbol = decl && getSymbolOfExpando(decl, /*allowDeclaration*/ true); + const prototype = assignmentSymbol?.exports?.get("prototype" as __String); + const init = prototype?.valueDeclaration && getAssignedJSPrototype(prototype.valueDeclaration); return init ? getSymbolOfNode(init) : undefined; } + function getSymbolOfExpando(node: Node, allowDeclaration: boolean): Symbol | undefined { + if (!node.parent) { + return undefined; + } + let name: Expression | BindingName | undefined; + let decl: Node | undefined; + if (isVariableDeclaration(node.parent) && node.parent.initializer === node) { + if (!isInJSFile(node) && !(isVarConst(node.parent) && isFunctionLikeDeclaration(node))) { + return undefined; + } + name = node.parent.name; + decl = node.parent; + } + else if (isBinaryExpression(node.parent)) { + const parentNode = node.parent; + const parentNodeOperator = node.parent.operatorToken.kind; + if (parentNodeOperator === SyntaxKind.EqualsToken && (allowDeclaration || parentNode.right === node)) { + name = parentNode.left; + decl = name; + } + else if (parentNodeOperator === SyntaxKind.BarBarToken || parentNodeOperator === SyntaxKind.QuestionQuestionToken) { + if (isVariableDeclaration(parentNode.parent) && parentNode.parent.initializer === parentNode) { + name = parentNode.parent.name; + decl = parentNode.parent; + } + else if (isBinaryExpression(parentNode.parent) && parentNode.parent.operatorToken.kind === SyntaxKind.EqualsToken && (allowDeclaration || parentNode.parent.right === parentNode)) { + name = parentNode.parent.left; + decl = name; + } + + if (!name || !isBindableStaticNameExpression(name) || !isSameEntityName(name, parentNode.left)) { + return undefined; + } + } + } + else if (allowDeclaration && isFunctionDeclaration(node)) { + name = node.name; + decl = node; + } + + if (!decl || !name || (!allowDeclaration && !getExpandoInitializer(node, isPrototypeAccess(name)))) { + return undefined; + } + return getSymbolOfNode(decl); + } + + function getAssignedJSPrototype(node: Node) { if (!node.parent) { return false; @@ -27951,14 +28433,11 @@ namespace ts { } if (isInJSFile(node)) { - const decl = getDeclarationOfExpando(node); - if (decl) { - const jsSymbol = getSymbolOfNode(decl); - if (jsSymbol?.exports?.size) { - const jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, undefined, undefined); - jsAssignmentType.objectFlags |= ObjectFlags.JSLiteral; - return getIntersectionType([returnType, jsAssignmentType]); - } + const jsSymbol = getSymbolOfExpando(node, /*allowDeclaration*/ false); + if (jsSymbol?.exports?.size) { + const jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, undefined, undefined); + jsAssignmentType.objectFlags |= ObjectFlags.JSLiteral; + return getIntersectionType([returnType, jsAssignmentType]); } } @@ -28053,6 +28532,7 @@ namespace ts { if (hasSyntheticDefault) { const memberTable = createSymbolTable(); const newSymbol = createSymbol(SymbolFlags.Alias, InternalSymbolName.Default); + newSymbol.parent = originalSymbol; newSymbol.nameType = getLiteralType("default"); newSymbol.target = resolveSymbol(symbol); memberTable.set(InternalSymbolName.Default, newSymbol); @@ -28123,6 +28603,7 @@ namespace ts { case SyntaxKind.FalseKeyword: case SyntaxKind.ArrayLiteralExpression: case SyntaxKind.ObjectLiteralExpression: + case SyntaxKind.TemplateExpression: return true; case SyntaxKind.ParenthesizedExpression: return isValidConstAssertionArgument((node).expression); @@ -28208,8 +28689,8 @@ namespace ts { } function checkImportMetaProperty(node: MetaProperty) { - if (moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.System) { - error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_esnext_or_system); + if (moduleKind !== ModuleKind.ES2020 && moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.System) { + error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_or_system); } const file = getSourceFileOfNode(node); Debug.assert(!!(file.flags & NodeFlags.PossiblyContainsImportMeta), "Containing file is missing import meta node flag."); @@ -29371,7 +29852,7 @@ namespace ts { // and the right operand to be of type Any, an object type, or a type parameter type. // The result is always of the Boolean primitive type. if (!(allTypesAssignableToKind(leftType, TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbolLike) || - isTypeAssignableToKind(leftType, TypeFlags.Index | TypeFlags.TemplateLiteral | TypeFlags.TypeParameter))) { + isTypeAssignableToKind(leftType, TypeFlags.Index | TypeFlags.TemplateLiteral | TypeFlags.StringMapping | TypeFlags.TypeParameter))) { error(left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } if (!allTypesAssignableToKind(rightType, TypeFlags.NonPrimitive | TypeFlags.InstantiableNonPrimitive)) { @@ -29406,7 +29887,7 @@ namespace ts { checkPropertyAccessibility(property, /*isSuper*/ false, objectLiteralType, prop); } } - const elementType = getIndexedAccessType(objectLiteralType, exprType, name, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, AccessFlags.ExpressionPosition); + const elementType = getIndexedAccessType(objectLiteralType, exprType, /*noUncheckedIndexedAccessCandidate*/ undefined, name, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, AccessFlags.ExpressionPosition); const type = getFlowTypeOfDestructuring(property, elementType); return checkDestructuringAssignment(property.kind === SyntaxKind.ShorthandPropertyAssignment ? property : property.initializer, type); } @@ -29467,7 +29948,7 @@ namespace ts { // We create a synthetic expression so that getIndexedAccessType doesn't get confused // when the element is a SyntaxKind.ElementAccessExpression. const accessFlags = AccessFlags.ExpressionPosition | (hasDefaultValue(element) ? AccessFlags.NoTupleBoundsCheck : 0); - const elementType = getIndexedAccessTypeOrUndefined(sourceType, indexType, createSyntheticExpression(element, indexType), accessFlags) || errorType; + const elementType = getIndexedAccessTypeOrUndefined(sourceType, indexType, /*noUncheckedIndexedAccessCandidate*/ undefined, createSyntheticExpression(element, indexType), accessFlags) || errorType; const assignedType = hasDefaultValue(element) ? getTypeWithFacts(elementType, TypeFacts.NEUndefined) : elementType; const type = getFlowTypeOfDestructuring(element, assignedType); return checkDestructuringAssignment(element, type, checkMode); @@ -30195,18 +30676,17 @@ namespace ts { } function checkTemplateExpression(node: TemplateExpression): Type { - // We just want to check each expressions, but we are unconcerned with - // the type of each expression, as any value may be coerced into a string. - // It is worth asking whether this is what we really want though. - // A place where we actually *are* concerned with the expressions' types are - // in tagged templates. - forEach(node.templateSpans, templateSpan => { - if (maybeTypeOfKind(checkExpression(templateSpan.expression), TypeFlags.ESSymbolLike)) { - error(templateSpan.expression, Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String); + const texts = [node.head.text]; + const types = []; + for (const span of node.templateSpans) { + const type = checkExpression(span.expression); + if (maybeTypeOfKind(type, TypeFlags.ESSymbolLike)) { + error(span.expression, Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String); } - }); - - return stringType; + texts.push(span.literal.text); + types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType); + } + return isConstContext(node) ? getTemplateLiteralType(texts, types) : stringType; } function getContextNode(node: Expression): Node { @@ -30325,7 +30805,7 @@ namespace ts { } // If the contextual type is a literal of a particular primitive type, we consider this a // literal context for all literals of that primitive type. - return !!(contextualType.flags & (TypeFlags.StringLiteral | TypeFlags.Index | TypeFlags.TemplateLiteral) && maybeTypeOfKind(candidateType, TypeFlags.StringLiteral) || + return !!(contextualType.flags & (TypeFlags.StringLiteral | TypeFlags.Index | TypeFlags.TemplateLiteral | TypeFlags.StringMapping) && maybeTypeOfKind(candidateType, TypeFlags.StringLiteral) || contextualType.flags & TypeFlags.NumberLiteral && maybeTypeOfKind(candidateType, TypeFlags.NumberLiteral) || contextualType.flags & TypeFlags.BigIntLiteral && maybeTypeOfKind(candidateType, TypeFlags.BigIntLiteral) || contextualType.flags & TypeFlags.BooleanLiteral && maybeTypeOfKind(candidateType, TypeFlags.BooleanLiteral) || @@ -30338,7 +30818,7 @@ namespace ts { const parent = node.parent; return isAssertionExpression(parent) && isConstTypeReference(parent.type) || (isParenthesizedExpression(parent) || isArrayLiteralExpression(parent) || isSpreadElement(parent)) && isConstContext(parent) || - (isPropertyAssignment(parent) || isShorthandPropertyAssignment(parent)) && isConstContext(parent.parent); + (isPropertyAssignment(parent) || isShorthandPropertyAssignment(parent) || isTemplateSpan(parent)) && isConstContext(parent.parent); } function checkExpressionForMutableLocation(node: Expression, checkMode: CheckMode | undefined, contextualType?: Type, forceTuple?: boolean): Type { @@ -30596,7 +31076,7 @@ namespace ts { } function checkExpression(node: Expression | QualifiedName, checkMode?: CheckMode, forceTuple?: boolean): Type { - tracing.begin(tracing.Phase.Check, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end }); + tracing.push(tracing.Phase.Check, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end }); const saveCurrentNode = currentNode; currentNode = node; instantiationCount = 0; @@ -30606,7 +31086,7 @@ namespace ts { checkConstEnumAccess(node, type); } currentNode = saveCurrentNode; - tracing.end(); + tracing.pop(); return type; } @@ -31580,9 +32060,6 @@ namespace ts { checkSourceElement(span.type); const type = getTypeFromTypeNode(span.type); checkTypeAssignableTo(type, templateConstraintType, span.type); - if (!everyType(type, t => !!(t.flags & TypeFlags.Literal) || isGenericIndexType(t))) { - error(span.type, Diagnostics.Template_literal_type_argument_0_is_not_literal_type_or_a_generic_type, typeToString(type)); - } } getTypeFromTypeNode(node); } @@ -31766,7 +32243,7 @@ namespace ts { for (const current of declarations) { const node = current; const inAmbientContext = node.flags & NodeFlags.Ambient; - const inAmbientContextOrInterface = node.parent.kind === SyntaxKind.InterfaceDeclaration || node.parent.kind === SyntaxKind.TypeLiteral || inAmbientContext; + const inAmbientContextOrInterface = node.parent && (node.parent.kind === SyntaxKind.InterfaceDeclaration || node.parent.kind === SyntaxKind.TypeLiteral) || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -33400,10 +33877,10 @@ namespace ts { } function checkVariableDeclaration(node: VariableDeclaration) { - tracing.begin(tracing.Phase.Check, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end }); + tracing.push(tracing.Phase.Check, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end }); checkGrammarVariableDeclaration(node); checkVariableLikeDeclaration(node); - tracing.end(); + tracing.pop(); } function checkBindingElement(node: BindingElement) { @@ -35307,12 +35784,18 @@ namespace ts { function checkTypeAliasDeclaration(node: TypeAliasDeclaration) { // Grammar checking checkGrammarDecoratorsAndModifiers(node); - checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); - checkSourceElement(node.type); - registerForUnusedIdentifiersCheck(node); + if (node.type.kind === SyntaxKind.IntrinsicKeyword) { + if (!intrinsicTypeKinds.has(node.name.escapedText as string) || length(node.typeParameters) !== 1) { + error(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); + } + } + else { + checkSourceElement(node.type); + registerForUnusedIdentifiersCheck(node); + } } function computeEnumMemberValues(node: EnumDeclaration) { @@ -36468,12 +36951,13 @@ namespace ts { } function checkSourceFile(node: SourceFile) { - tracing.begin(tracing.Phase.Check, "checkSourceFile", { path: node.path }); + const tracingData: tracing.EventData = [tracing.Phase.Check, "checkSourceFile", { path: node.path }]; + tracing.begin(...tracingData); performance.mark("beforeCheck"); checkSourceFileWorker(node); performance.mark("afterCheck"); performance.measure("Check", "beforeCheck", "afterCheck"); - tracing.end(); + tracing.end(...tracingData); } function unusedIsError(kind: UnusedKind, isAmbient: boolean): boolean { @@ -38407,7 +38891,7 @@ namespace ts { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (isClassLike(node.parent)) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); } else if (node.kind === SyntaxKind.Parameter) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); @@ -38430,7 +38914,7 @@ namespace ts { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (isClassLike(node.parent) && !isPropertyDeclaration(node)) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } else if (node.kind === SyntaxKind.Parameter) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); @@ -39390,11 +39874,13 @@ namespace ts { } if (node.exclamationToken && (node.parent.parent.kind !== SyntaxKind.VariableStatement || !node.type || node.initializer || node.flags & NodeFlags.Ambient)) { - return grammarErrorOnNode(node.exclamationToken, Diagnostics.Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation); + const message = node.initializer + ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions + : Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations; + return grammarErrorOnNode(node.exclamationToken, message); } const moduleKind = getEmitModuleKind(compilerOptions); - if (moduleKind < ModuleKind.ES2015 && moduleKind !== ModuleKind.System && !(node.parent.parent.flags & NodeFlags.Ambient) && hasSyntacticModifier(node.parent.parent, ModifierFlags.Export)) { checkESModuleMarker(node.name); @@ -39594,7 +40080,12 @@ namespace ts { if (isPropertyDeclaration(node) && node.exclamationToken && (!isClassLike(node.parent) || !node.type || node.initializer || node.flags & NodeFlags.Ambient || hasSyntacticModifier(node, ModifierFlags.Static | ModifierFlags.Abstract))) { - return grammarErrorOnNode(node.exclamationToken, Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); + const message = node.initializer + ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions + : !node.type + ? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations + : Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context; + return grammarErrorOnNode(node.exclamationToken, message); } } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index beb601b0b8f..2c41ba05ffd 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -73,7 +73,8 @@ namespace ts { ["esnext.intl", "lib.esnext.intl.d.ts"], ["esnext.bigint", "lib.es2020.bigint.d.ts"], ["esnext.string", "lib.esnext.string.d.ts"], - ["esnext.promise", "lib.esnext.promise.d.ts"] + ["esnext.promise", "lib.esnext.promise.d.ts"], + ["esnext.weakref", "lib.esnext.weakref.d.ts"] ]; /** @@ -380,6 +381,8 @@ namespace ts { name: "jsx", type: jsxOptionMap, affectsSourceFile: true, + affectsEmit: true, + affectsModuleResolution: true, paramType: Diagnostics.KIND, showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, @@ -800,6 +803,9 @@ namespace ts { { name: "jsxImportSource", type: "string", + affectsSemanticDiagnostics: true, + affectsEmit: true, + affectsModuleResolution: true, category: Diagnostics.Advanced_Options, description: Diagnostics.Specify_the_module_specifier_to_be_used_to_import_the_jsx_and_jsxs_factory_functions_from_eg_react }, @@ -1132,7 +1138,11 @@ namespace ts { name: "exclude", type: "string" } - } + }, + { + name: "disableFilenameBasedTypeAcquisition", + type: "boolean", + }, ]; /* @internal */ @@ -1572,7 +1582,7 @@ namespace ts { */ export function readJsonConfigFile(fileName: string, readFile: (path: string) => string | undefined): TsConfigSourceFile { const textOrDiagnostic = tryReadFile(fileName, readFile); - return isString(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { parseDiagnostics: [textOrDiagnostic] }; + return isString(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] }; } /*@internal*/ diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 13a661d423f..34873caccb7 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1195,7 +1195,7 @@ namespace ts { * @param keyComparer A callback used to compare two keys in a sorted array. * @param offset An offset into `array` at which to start the search. */ - export function binarySearchKey(array: readonly T[], key: U, keySelector: (v: T) => U, keyComparer: Comparer, offset?: number): number { + export function binarySearchKey(array: readonly T[], key: U, keySelector: (v: T, i: number) => U, keyComparer: Comparer, offset?: number): number { if (!some(array)) { return -1; } @@ -1204,7 +1204,7 @@ namespace ts { let high = array.length - 1; while (low <= high) { const middle = low + ((high - low) >> 1); - const midKey = keySelector(array[middle]); + const midKey = keySelector(array[middle], middle); switch (keyComparer(midKey, key)) { case Comparison.LessThan: low = middle + 1; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index a46ddd430f9..95d40754f37 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -99,7 +99,7 @@ "category": "Error", "code": 1030 }, - "'{0}' modifier cannot appear on a class element.": { + "'{0}' modifier cannot appear on class elements of this kind.": { "category": "Error", "code": 1031 }, @@ -851,10 +851,6 @@ "category": "Error", "code": 1257 }, - "Definite assignment assertions can only be used along with a type annotation.": { - "category": "Error", - "code": 1258 - }, "Module '{0}' can only be default-imported using the '{1}' flag": { "category": "Error", "code": 1259 @@ -871,6 +867,14 @@ "category": "Error", "code": 1262 }, + "Declarations with initializers cannot also have definite assignment assertions.": { + "category": "Error", + "code": 1263 + }, + "Declarations with definite assignment assertions must also have type annotations.": { + "category": "Error", + "code": 1264 + }, "'with' statements are not allowed in an async function block.": { "category": "Error", @@ -1000,7 +1004,7 @@ "category": "Error", "code": 1342 }, - "The 'import.meta' meta-property is only allowed when the '--module' option is 'esnext' or 'system'.": { + "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.": { "category": "Error", "code": 1343 }, @@ -2193,6 +2197,10 @@ "category": "Error", "code": 2549 }, + "Property '{0}' does not exist on type '{1}'. Do you need to change your target library? Try changing the `lib` compiler option to '{2}' or later.": { + "category": "Error", + "code": 2550 + }, "Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?": { "category": "Error", "code": 2551 @@ -2297,19 +2305,19 @@ "category": "Error", "code": 2578 }, - "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i @types/node`.": { + "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.": { "category": "Error", "code": 2580 }, - "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i @types/jquery`.": { + "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.": { "category": "Error", "code": 2581 }, - "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`.": { + "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`.": { "category": "Error", "code": 2582 }, - "Cannot find name '{0}'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.": { + "Cannot find name '{0}'. Do you need to change your target library? Try changing the `lib` compiler option to '{1}' or later.": { "category": "Error", "code": 2583 }, @@ -2341,15 +2349,15 @@ "category": "Error", "code": 2590 }, - "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig.": { + "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add `node` to the types field in your tsconfig.": { "category": "Error", "code": 2591 }, - "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i @types/jquery` and then add `jquery` to the types field in your tsconfig.": { + "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery` and then add `jquery` to the types field in your tsconfig.": { "category": "Error", "code": 2592 }, - "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig.": { + "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig.": { "category": "Error", "code": 2593 }, @@ -3035,7 +3043,7 @@ "category": "Error", "code": 2792 }, - "Template literal type argument '{0}' is not literal type or a generic type.": { + "The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible.": { "category": "Error", "code": 2793 }, @@ -3043,6 +3051,14 @@ "category": "Error", "code": 2794 }, + "The 'intrinsic' keyword can only be used to declare compiler provided intrinsic types.": { + "category": "Error", + "code": 2795 + }, + "It is likely that you are missing a comma to separate these two template expressions. They form a tagged template expression which cannot be invoked.": { + "category": "Error", + "code": 2796 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", @@ -4703,6 +4719,10 @@ "code": 6385, "reportsDeprecated": true }, + "Performance timings for '--diagnostics' or '--extendedDiagnostics' are not available in this session. A native implementation of the Web Performance API could not be found.": { + "category": "Message", + "code": 6386 + }, "The expected type comes from property '{0}' which is declared here on type '{1}'": { "category": "Message", @@ -4840,7 +4860,7 @@ "category": "Error", "code": 7034 }, - "Try `npm install @types/{1}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`": { + "Try `npm i --save-dev @types/{1}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`": { "category": "Error", "code": 7035 }, diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 5d4811f08ef..c136359ccea 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -300,17 +300,17 @@ namespace ts { sourceFiles: sourceFileOrBundle.sourceFiles.map(file => relativeToBuildInfo(getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()))) }; } - tracing.begin(tracing.Phase.Emit, "emitJsFileOrBundle", { jsFilePath }); + tracing.push(tracing.Phase.Emit, "emitJsFileOrBundle", { jsFilePath }); emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo); - tracing.end(); + tracing.pop(); - tracing.begin(tracing.Phase.Emit, "emitDeclarationFileOrBundle", { declarationFilePath }); + tracing.push(tracing.Phase.Emit, "emitDeclarationFileOrBundle", { declarationFilePath }); emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo); - tracing.end(); + tracing.pop(); - tracing.begin(tracing.Phase.Emit, "emitBuildInfo", { buildInfoPath }); + tracing.push(tracing.Phase.Emit, "emitBuildInfo", { buildInfoPath }); emitBuildInfo(bundleBuildInfo, buildInfoPath); - tracing.end(); + tracing.pop(); if (!emitSkipped && emittedFilesList) { if (!emitOnlyDtsFiles) { @@ -606,18 +606,19 @@ namespace ts { if (getRootLength(sourceMapDir) === 0) { // The relative paths are relative to the common directory sourceMapDir = combinePaths(host.getCommonSourceDirectory(), sourceMapDir); - return getRelativePathToDirectoryOrUrl( - getDirectoryPath(normalizePath(filePath)), // get the relative sourceMapDir path based on jsFilePath - combinePaths(sourceMapDir, sourceMapFile), // this is where user expects to see sourceMap - host.getCurrentDirectory(), - host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ true); + return encodeURI( + getRelativePathToDirectoryOrUrl( + getDirectoryPath(normalizePath(filePath)), // get the relative sourceMapDir path based on jsFilePath + combinePaths(sourceMapDir, sourceMapFile), // this is where user expects to see sourceMap + host.getCurrentDirectory(), + host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ true)); } else { - return combinePaths(sourceMapDir, sourceMapFile); + return encodeURI(combinePaths(sourceMapDir, sourceMapFile)); } } - return sourceMapFile; + return encodeURI(sourceMapFile); } } @@ -2023,15 +2024,6 @@ namespace ts { } function emitTemplateTypeSpan(node: TemplateLiteralTypeSpan) { - const keyword = node.casing === TemplateCasing.Uppercase ? "uppercase" : - node.casing === TemplateCasing.Lowercase ? "lowercase" : - node.casing === TemplateCasing.Capitalize ? "capitalize" : - node.casing === TemplateCasing.Uncapitalize ? "uncapitalize" : - undefined; - if (keyword) { - writeKeyword(keyword); - writeSpace(); - } emit(node.type); emit(node.literal); } @@ -5144,7 +5136,12 @@ namespace ts { hasWrittenComment = false; if (isEmittedNode) { - forEachLeadingCommentToEmit(pos, emitLeadingComment); + if (pos === 0 && currentSourceFile?.isDeclarationFile) { + forEachLeadingCommentToEmit(pos, emitNonTripleSlashLeadingComment); + } + else { + forEachLeadingCommentToEmit(pos, emitLeadingComment); + } } else if (pos === 0) { // If the node will not be emitted in JS, remove all the comments(normal, pinned and ///) associated with the node, @@ -5165,6 +5162,12 @@ namespace ts { } } + function emitNonTripleSlashLeadingComment(commentPos: number, commentEnd: number, kind: SyntaxKind, hasTrailingNewLine: boolean, rangePos: number) { + if (!isTripleSlashComment(commentPos, commentEnd)) { + emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos); + } + } + function shouldWriteComment(text: string, pos: number) { if (printerOptions.onlyPrintJsDocStyle) { return (isJSDocLikeText(text, pos) || isPinnedComment(text, pos)); diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 0e2cf25d281..aadd082a466 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -1605,9 +1605,8 @@ namespace ts { } // @api - function createTemplateLiteralTypeSpan(casing: TemplateCasing, type: TypeNode, literal: TemplateMiddle | TemplateTail) { + function createTemplateLiteralTypeSpan(type: TypeNode, literal: TemplateMiddle | TemplateTail) { const node = createBaseNode(SyntaxKind.TemplateLiteralTypeSpan); - node.casing = casing; node.type = type; node.literal = literal; node.transformFlags = TransformFlags.ContainsTypeScript; @@ -1615,11 +1614,10 @@ namespace ts { } // @api - function updateTemplateLiteralTypeSpan(casing: TemplateCasing, node: TemplateLiteralTypeSpan, type: TypeNode, literal: TemplateMiddle | TemplateTail) { - return node.casing !== casing - || node.type !== type + function updateTemplateLiteralTypeSpan(node: TemplateLiteralTypeSpan, type: TypeNode, literal: TemplateMiddle | TemplateTail) { + return node.type !== type || node.literal !== literal - ? update(createTemplateLiteralTypeSpan(casing, type, literal), node) + ? update(createTemplateLiteralTypeSpan(type, literal), node) : node; } @@ -2665,12 +2663,14 @@ namespace ts { node.transformFlags |= TransformFlags.ContainsES2015 | TransformFlags.ContainsES2018 | - TransformFlags.ContainsDestructuringAssignment; + TransformFlags.ContainsDestructuringAssignment | + propagateAssignmentPatternFlags(node.left); } else if (isArrayLiteralExpression(node.left)) { node.transformFlags |= TransformFlags.ContainsES2015 | - TransformFlags.ContainsDestructuringAssignment; + TransformFlags.ContainsDestructuringAssignment | + propagateAssignmentPatternFlags(node.left); } } else if (operatorKind === SyntaxKind.AsteriskAsteriskToken || operatorKind === SyntaxKind.AsteriskAsteriskEqualsToken) { @@ -2682,6 +2682,27 @@ namespace ts { return node; } + function propagateAssignmentPatternFlags(node: AssignmentPattern): TransformFlags { + if (node.transformFlags & TransformFlags.ContainsObjectRestOrSpread) return TransformFlags.ContainsObjectRestOrSpread; + if (node.transformFlags & TransformFlags.ContainsES2018) { + // check for nested spread assignments, otherwise '{ x: { a, ...b } = foo } = c' + // will not be correctly interpreted by the ES2018 transformer + for (const element of getElementsOfBindingOrAssignmentPattern(node)) { + const target = getTargetOfBindingOrAssignmentElement(element); + if (target && isAssignmentPattern(target)) { + if (target.transformFlags & TransformFlags.ContainsObjectRestOrSpread) { + return TransformFlags.ContainsObjectRestOrSpread; + } + if (target.transformFlags & TransformFlags.ContainsES2018) { + const flags = propagateAssignmentPatternFlags(target); + if (flags) return flags; + } + } + } + } + return TransformFlags.None; + } + // @api function updateBinaryExpression(node: BinaryExpression, left: Expression, operator: BinaryOperatorToken, right: Expression) { return node.left !== left diff --git a/src/compiler/factory/nodeTests.ts b/src/compiler/factory/nodeTests.ts index b7da2127f2a..3f334edc0d6 100644 --- a/src/compiler/factory/nodeTests.ts +++ b/src/compiler/factory/nodeTests.ts @@ -233,6 +233,14 @@ namespace ts { return node.kind === SyntaxKind.ImportType; } + export function isTemplateLiteralTypeSpan(node: Node): node is TemplateLiteralTypeSpan { + return node.kind === SyntaxKind.TemplateLiteralTypeSpan; + } + + export function isTemplateLiteralTypeNode(node: Node): node is TemplateLiteralTypeNode { + return node.kind === SyntaxKind.TemplateLiteralType; + } + // Binding patterns export function isObjectBindingPattern(node: Node): node is ObjectBindingPattern { diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index 770600d94b7..0960509ae4d 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -46,7 +46,7 @@ namespace ts { } } - function createJsxFactoryExpression(factory: NodeFactory, jsxFactoryEntity: EntityName | undefined, reactNamespace: string, parent: JsxOpeningLikeElement | JsxOpeningFragment): Expression { + export function createJsxFactoryExpression(factory: NodeFactory, jsxFactoryEntity: EntityName | undefined, reactNamespace: string, parent: JsxOpeningLikeElement | JsxOpeningFragment): Expression { return jsxFactoryEntity ? createJsxFactoryExpressionFromEntityName(factory, jsxFactoryEntity, parent) : factory.createPropertyAccessExpression( @@ -64,7 +64,7 @@ namespace ts { ); } - export function createExpressionForJsxElement(factory: NodeFactory, jsxFactoryEntity: EntityName | undefined, reactNamespace: string, tagName: Expression, props: Expression | undefined, children: readonly Expression[] | undefined, parentElement: JsxOpeningLikeElement, location: TextRange): LeftHandSideExpression { + export function createExpressionForJsxElement(factory: NodeFactory, callee: Expression, tagName: Expression, props: Expression | undefined, children: readonly Expression[] | undefined, location: TextRange): LeftHandSideExpression { const argumentsList = [tagName]; if (props) { argumentsList.push(props); @@ -88,7 +88,7 @@ namespace ts { return setTextRange( factory.createCallExpression( - createJsxFactoryExpression(factory, jsxFactoryEntity, reactNamespace, parentElement), + callee, /*typeArguments*/ undefined, argumentsList ), diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index 0848679ba9a..8b87c5cd102 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -174,7 +174,10 @@ namespace ts.moduleSpecifiers { const bundledPkgReference = bundledPackageName ? combinePaths(bundledPackageName, relativeToBaseUrl) : relativeToBaseUrl; const importRelativeToBaseUrl = removeExtensionAndIndexPostFix(bundledPkgReference, ending, compilerOptions); const fromPaths = paths && tryGetModuleNameFromPaths(removeFileExtension(bundledPkgReference), importRelativeToBaseUrl, paths); - const nonRelative = fromPaths === undefined ? importRelativeToBaseUrl : fromPaths; + const nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths; + if (!nonRelative) { + return relativePath; + } if (relativePreference === RelativePreference.NonRelative) { return nonRelative; @@ -232,7 +235,7 @@ namespace ts.moduleSpecifiers { : discoverProbableSymlinks(host.getSourceFiles(), getCanonicalFileName, cwd); const symlinkedDirectories = links.getSymlinkedDirectories(); - const compareStrings = (!host.useCaseSensitiveFileNames || host.useCaseSensitiveFileNames()) ? compareStringsCaseSensitive : compareStringsCaseInsensitive; + const useCaseSensitiveFileNames = !host.useCaseSensitiveFileNames || host.useCaseSensitiveFileNames(); const result = symlinkedDirectories && forEachEntry(symlinkedDirectories, (resolved, path) => { if (resolved === false) return undefined; if (startsWithDirectory(importingFileName, resolved.realPath, getCanonicalFileName)) { @@ -240,7 +243,7 @@ namespace ts.moduleSpecifiers { } return forEach(targets, target => { - if (compareStrings(target.slice(0, resolved.real.length), resolved.real) !== Comparison.EqualTo) { + if (!containsPath(resolved.real, target, !useCaseSensitiveFileNames)) { return; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index af797435c9d..722604bb3e2 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -614,7 +614,8 @@ namespace ts { } export function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false, scriptKind?: ScriptKind): SourceFile { - tracing.begin(tracing.Phase.Parse, "createSourceFile", { path: fileName }); + const tracingData: tracing.EventData = [tracing.Phase.Parse, "createSourceFile", { path: fileName }]; + tracing.begin(...tracingData); performance.mark("beforeParse"); let result: SourceFile; @@ -629,7 +630,7 @@ namespace ts { performance.mark("afterParse"); performance.measure("Parse", "beforeParse", "afterParse"); - tracing.end(); + tracing.end(...tracingData); return result; } @@ -2618,7 +2619,6 @@ namespace ts { const pos = getNodePos(); return finishNode( factory.createTemplateLiteralTypeSpan( - parseTemplateCasing(), parseType(), parseLiteralOfTemplateSpan(/*isTaggedTemplate*/ false) ), @@ -2626,14 +2626,6 @@ namespace ts { ); } - function parseTemplateCasing(): TemplateCasing { - return parseOptional(SyntaxKind.UppercaseKeyword) ? TemplateCasing.Uppercase : - parseOptional(SyntaxKind.LowercaseKeyword) ? TemplateCasing.Lowercase : - parseOptional(SyntaxKind.CapitalizeKeyword) ? TemplateCasing.Capitalize : - parseOptional(SyntaxKind.UncapitalizeKeyword) ? TemplateCasing.Uncapitalize : - TemplateCasing.None; - } - function parseLiteralOfTemplateSpan(isTaggedTemplate: boolean) { if (token() === SyntaxKind.CloseBraceToken) { reScanTemplateToken(isTaggedTemplate); @@ -6751,7 +6743,7 @@ namespace ts { const name = parseIdentifier(); const typeParameters = parseTypeParameters(); parseExpected(SyntaxKind.EqualsToken); - const type = parseType(); + const type = token() === SyntaxKind.IntrinsicKeyword && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); const node = factory.createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); diff --git a/src/compiler/performance.ts b/src/compiler/performance.ts index dcee41c2d2c..e1e26831cb1 100644 --- a/src/compiler/performance.ts +++ b/src/compiler/performance.ts @@ -1,16 +1,11 @@ /*@internal*/ /** Performance measurements for the compiler. */ namespace ts.performance { - declare const onProfilerEvent: { (markName: string): void; profiler: boolean; }; - - // NOTE: cannot use ts.noop as core.ts loads after this - const profilerEvent: (markName: string) => void = typeof onProfilerEvent === "function" && onProfilerEvent.profiler === true ? onProfilerEvent : () => { /*empty*/ }; - - let enabled = false; - let profilerStart = 0; - let counts: ESMap; - let marks: ESMap; - let measures: ESMap; + let perfHooks: PerformanceHooks | undefined; + let perfObserver: PerformanceObserver | undefined; + // when set, indicates the implementation of `Performance` to use for user timing. + // when unset, indicates user timing is unavailable or disabled. + let performanceImpl: Performance | undefined; export interface Timer { enter(): void; @@ -46,6 +41,8 @@ namespace ts.performance { } export const nullTimer: Timer = { enter: noop, exit: noop }; + const counts = new Map(); + const durations = new Map(); /** * Marks a performance event. @@ -53,11 +50,7 @@ namespace ts.performance { * @param markName The name of the mark. */ export function mark(markName: string) { - if (enabled) { - marks.set(markName, timestamp()); - counts.set(markName, (counts.get(markName) || 0) + 1); - profilerEvent(markName); - } + performanceImpl?.mark(markName); } /** @@ -70,11 +63,7 @@ namespace ts.performance { * used. */ export function measure(measureName: string, startMarkName?: string, endMarkName?: string) { - if (enabled) { - const end = endMarkName && marks.get(endMarkName) || timestamp(); - const start = startMarkName && marks.get(startMarkName) || profilerStart; - measures.set(measureName, (measures.get(measureName) || 0) + (end - start)); - } + performanceImpl?.measure(measureName, startMarkName, endMarkName); } /** @@ -83,7 +72,7 @@ namespace ts.performance { * @param markName The name of the mark. */ export function getCount(markName: string) { - return counts && counts.get(markName) || 0; + return counts.get(markName) || 0; } /** @@ -92,7 +81,7 @@ namespace ts.performance { * @param measureName The name of the measure whose durations should be accumulated. */ export function getDuration(measureName: string) { - return measures && measures.get(measureName) || 0; + return durations.get(measureName) || 0; } /** @@ -101,22 +90,42 @@ namespace ts.performance { * @param cb The action to perform for each measure */ export function forEachMeasure(cb: (measureName: string, duration: number) => void) { - measures.forEach((measure, key) => { - cb(key, measure); - }); + durations.forEach((duration, measureName) => cb(measureName, duration)); + } + + /** + * Indicates whether the performance API is enabled. + */ + export function isEnabled() { + return !!performanceImpl; } /** Enables (and resets) performance measurements for the compiler. */ export function enable() { - counts = new Map(); - marks = new Map(); - measures = new Map(); - enabled = true; - profilerStart = timestamp(); + if (!performanceImpl) { + perfHooks ||= tryGetNativePerformanceHooks(); + if (!perfHooks) return false; + perfObserver ||= new perfHooks.PerformanceObserver(updateStatisticsFromList); + perfObserver.observe({ entryTypes: ["mark", "measure"] }); + performanceImpl = perfHooks.performance; + } + return true; } /** Disables performance measurements for the compiler. */ export function disable() { - enabled = false; + perfObserver?.disconnect(); + performanceImpl = undefined; + counts.clear(); + durations.clear(); + } + + function updateStatisticsFromList(list: PerformanceObserverEntryList) { + for (const mark of list.getEntriesByType("mark")) { + counts.set(mark.name, (counts.get(mark.name) || 0) + 1); + } + for (const measure of list.getEntriesByType("measure")) { + durations.set(measure.name, (durations.get(measure.name) || 0) + measure.duration); + } } } diff --git a/src/compiler/performanceCore.ts b/src/compiler/performanceCore.ts new file mode 100644 index 00000000000..acec7f4ce57 --- /dev/null +++ b/src/compiler/performanceCore.ts @@ -0,0 +1,121 @@ +/*@internal*/ +namespace ts { + // The following definitions provide the minimum compatible support for the Web Performance User Timings API + // between browsers and NodeJS: + + export interface PerformanceHooks { + performance: Performance; + PerformanceObserver: PerformanceObserverConstructor; + } + + export interface Performance { + mark(name: string): void; + measure(name: string, startMark?: string, endMark?: string): void; + now(): number; + timeOrigin: number; + } + + export interface PerformanceEntry { + name: string; + entryType: string; + startTime: number; + duration: number; + } + + export interface PerformanceObserverEntryList { + getEntries(): PerformanceEntryList; + getEntriesByName(name: string, type?: string): PerformanceEntryList; + getEntriesByType(type: string): PerformanceEntryList; + } + + export interface PerformanceObserver { + disconnect(): void; + observe(options: { entryTypes: readonly string[] }): void; + } + + export type PerformanceObserverConstructor = new (callback: (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void) => PerformanceObserver; + export type PerformanceEntryList = PerformanceEntry[]; + + // Browser globals for the Web Performance User Timings API + declare const performance: Performance | undefined; + declare const PerformanceObserver: PerformanceObserverConstructor | undefined; + + // eslint-disable-next-line @typescript-eslint/naming-convention + function hasRequiredAPI(performance: Performance | undefined, PerformanceObserver: PerformanceObserverConstructor | undefined) { + return typeof performance === "object" && + typeof performance.timeOrigin === "number" && + typeof performance.mark === "function" && + typeof performance.measure === "function" && + typeof performance.now === "function" && + typeof PerformanceObserver === "function"; + } + + function tryGetWebPerformanceHooks(): PerformanceHooks | undefined { + if (typeof performance === "object" && + typeof PerformanceObserver === "function" && + hasRequiredAPI(performance, PerformanceObserver)) { + return { + performance, + PerformanceObserver + }; + } + } + + function tryGetNodePerformanceHooks(): PerformanceHooks | undefined { + if (typeof module === "object" && typeof require === "function") { + try { + const { performance, PerformanceObserver } = require("perf_hooks") as typeof import("perf_hooks"); + if (hasRequiredAPI(performance, PerformanceObserver)) { + // There is a bug in Node's performance.measure prior to 12.16.3/13.13.0 that does not + // match the Web Performance API specification. Node's implementation did not allow + // optional `start` and `end` arguments for `performance.measure`. + // See https://github.com/nodejs/node/pull/32651 for more information. + const version = new Version(process.versions.node); + const range = new VersionRange("<12.16.3 || 13 <13.13"); + if (range.test(version)) { + return { + performance: { + get timeOrigin() { return performance.timeOrigin; }, + now() { return performance.now(); }, + mark(name) { return performance.mark(name); }, + measure(name, start = "nodeStart", end?) { + if (end === undefined) { + end = "__performance.measure-fix__"; + performance.mark(end); + } + performance.measure(name, start, end); + if (end === "__performance.measure-fix__") { + performance.clearMarks("__performance.measure-fix__"); + } + } + }, + PerformanceObserver + }; + } + return { + performance, + PerformanceObserver + }; + } + } + catch { + // ignore errors + } + } + } + + // Unlike with the native Map/Set 'tryGet' functions in corePublic.ts, we eagerly evaluate these + // since we will need them for `timestamp`, below. + const nativePerformanceHooks = tryGetWebPerformanceHooks() || tryGetNodePerformanceHooks(); + const nativePerformance = nativePerformanceHooks?.performance; + + export function tryGetNativePerformanceHooks() { + return nativePerformanceHooks; + } + + /** Gets a timestamp with (at least) ms resolution */ + export const timestamp = + nativePerformance ? () => nativePerformance.now() : + Date.now ? Date.now : + () => +(new Date()); +} \ No newline at end of file diff --git a/src/compiler/performanceTimestamp.ts b/src/compiler/performanceTimestamp.ts deleted file mode 100644 index 044e7a65c09..00000000000 --- a/src/compiler/performanceTimestamp.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*@internal*/ -namespace ts { - declare const performance: { now?(): number } | undefined; - /** Gets a timestamp with (at least) ms resolution */ - export const timestamp = typeof performance !== "undefined" && performance.now ? () => performance.now!() : Date.now ? Date.now : () => +(new Date()); -} \ No newline at end of file diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 76fa4b62aab..16d6a6bd367 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -73,6 +73,7 @@ namespace ts { export function createCompilerHostWorker(options: CompilerOptions, setParentNodes?: boolean, system = sys): CompilerHost { const existingDirectories = new Map(); const getCanonicalFileName = createGetCanonicalFileName(system.useCaseSensitiveFileNames); + const computeHash = maybeBind(system, system.createHash) || generateDjb2Hash; function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile | undefined { let text: string | undefined; try { @@ -128,7 +129,7 @@ namespace ts { let outputFingerprints: ESMap; function writeFileWorker(fileName: string, data: string, writeByteOrderMark: boolean) { - if (!isWatchSet(options) || !system.createHash || !system.getModifiedTime) { + if (!isWatchSet(options) || !system.getModifiedTime) { system.writeFile(fileName, data, writeByteOrderMark); return; } @@ -137,7 +138,7 @@ namespace ts { outputFingerprints = new Map(); } - const hash = system.createHash(data); + const hash = computeHash(data); const mtimeBefore = system.getModifiedTime(fileName); if (mtimeBefore) { @@ -529,6 +530,51 @@ namespace ts { return resolutions; } + /* @internal */ + export function forEachResolvedProjectReference( + resolvedProjectReferences: readonly (ResolvedProjectReference | undefined)[] | undefined, + cb: (resolvedProjectReference: ResolvedProjectReference, parent: ResolvedProjectReference | undefined) => T | undefined + ): T | undefined { + return forEachProjectReference(/*projectReferences*/ undefined, resolvedProjectReferences, (resolvedRef, parent) => resolvedRef && cb(resolvedRef, parent)); + } + + function forEachProjectReference( + projectReferences: readonly ProjectReference[] | undefined, + resolvedProjectReferences: readonly (ResolvedProjectReference | undefined)[] | undefined, + cbResolvedRef: (resolvedRef: ResolvedProjectReference | undefined, parent: ResolvedProjectReference | undefined, index: number) => T | undefined, + cbRef?: (projectReferences: readonly ProjectReference[] | undefined, parent: ResolvedProjectReference | undefined) => T | undefined + ): T | undefined { + let seenResolvedRefs: Set | undefined; + + return worker(projectReferences, resolvedProjectReferences, /*parent*/ undefined); + + function worker( + projectReferences: readonly ProjectReference[] | undefined, + resolvedProjectReferences: readonly (ResolvedProjectReference | undefined)[] | undefined, + parent: ResolvedProjectReference | undefined, + ): T | undefined { + + // Visit project references first + if (cbRef) { + const result = cbRef(projectReferences, parent); + if (result) { return result; } + } + + return forEach(resolvedProjectReferences, (resolvedRef, index) => { + if (resolvedRef && seenResolvedRefs?.has(resolvedRef.sourceFile.path)) { + // ignore recursives + return undefined; + } + + const result = cbResolvedRef(resolvedRef, parent, index); + if (result || !resolvedRef) return result; + + (seenResolvedRefs ||= new Set()).add(resolvedRef.sourceFile.path); + return worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef); + }); + } + } + /* @internal */ export const inferredTypesContainingFile = "__inferred type names__.ts"; @@ -734,7 +780,8 @@ namespace ts { // Track source files that are source files found by searching under node_modules, as these shouldn't be compiled. const sourceFilesFoundSearchingNodeModules = new Map(); - tracing.begin(tracing.Phase.Program, "createProgram", {}); + const tracingData: tracing.EventData = [tracing.Phase.Program, "createProgram"]; + tracing.begin(...tracingData); performance.mark("beforeProgram"); const host = createProgramOptions.host || createCompilerHost(options); @@ -820,12 +867,16 @@ namespace ts { forEachResolvedProjectReference }); + tracing.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram }); const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options); + tracing.pop(); // We set `structuralIsReused` to `undefined` because `tryReuseStructureFromOldProgram` calls `tryReuseStructureFromOldProgram` which checks // `structuralIsReused`, which would be a TDZ violation if it was not set in advance to `undefined`. - let structuralIsReused: StructureIsReused | undefined; - structuralIsReused = tryReuseStructureFromOldProgram(); // eslint-disable-line prefer-const - if (structuralIsReused !== StructureIsReused.Completely) { + let structureIsReused: StructureIsReused; + tracing.push(tracing.Phase.Program, "tryReuseStructureFromOldProgram", {}); + structureIsReused = tryReuseStructureFromOldProgram(); // eslint-disable-line prefer-const + tracing.pop(); + if (structureIsReused !== StructureIsReused.Completely) { processingDefaultLibFiles = []; processingOtherFiles = []; @@ -860,12 +911,15 @@ namespace ts { } } + tracing.push(tracing.Phase.Program, "processRootFiles", { count: rootNames.length }); forEach(rootNames, name => processRootFile(name, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false)); + tracing.pop(); // load type declarations specified via 'types' argument or implicitly from types/ and node_modules/@types folders const typeReferences: string[] = rootNames.length ? getAutomaticTypeDirectiveNames(options, host) : emptyArray; if (typeReferences.length) { + tracing.push(tracing.Phase.Program, "processTypeReferences", { count: typeReferences.length }); // This containingFilename needs to match with the one used in managed-side const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(); const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile); @@ -873,6 +927,7 @@ namespace ts { for (let i = 0; i < typeReferences.length; i++) { processTypeReferenceDirective(typeReferences[i], resolutions[i]); } + tracing.pop(); } // Do not process the default library if: @@ -913,8 +968,8 @@ namespace ts { host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path)); } } - oldProgram.forEachResolvedProjectReference((resolvedProjectReference, resolvedProjectReferencePath) => { - if (resolvedProjectReference && !getResolvedProjectReferenceByPath(resolvedProjectReferencePath)) { + oldProgram.forEachResolvedProjectReference(resolvedProjectReference => { + if (!getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) { host.onReleaseOldSourceFile!(resolvedProjectReference.sourceFile, oldProgram!.getCompilerOptions(), /*hasSourceFileByPath*/ false); } }); @@ -936,6 +991,7 @@ namespace ts { getOptionsDiagnostics, getGlobalDiagnostics, getSemanticDiagnostics, + getCachedSemanticDiagnostics, getSuggestionDiagnostics, getDeclarationDiagnostics, getBindAndCheckDiagnostics, @@ -978,32 +1034,74 @@ namespace ts { getSymlinkCache, realpath: host.realpath?.bind(host), useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(), + structureIsReused, }; onProgramCreateComplete(); verifyCompilerOptions(); performance.mark("afterProgram"); performance.measure("Program", "beforeProgram", "afterProgram"); - tracing.end(); + tracing.end(...tracingData); return program; - function resolveModuleNamesWorker(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference) { + function resolveModuleNamesWorker(moduleNames: string[], containingFile: SourceFile, reusedNames: string[] | undefined): readonly ResolvedModuleFull[] { + if (!moduleNames.length) return emptyArray; + const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory); + const redirectedReference = getRedirectReferenceForResolution(containingFile); + tracing.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName }); performance.mark("beforeResolveModule"); - const result = actualResolveModuleNamesWorker(moduleNames, containingFile, reusedNames, redirectedReference); + const result = actualResolveModuleNamesWorker(moduleNames, containingFileName, reusedNames, redirectedReference); performance.mark("afterResolveModule"); performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule"); + tracing.pop(); return result; } - function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference) { + function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames: string[], containingFile: string | SourceFile): readonly (ResolvedTypeReferenceDirective | undefined)[] { + if (!typeDirectiveNames.length) return []; + const containingFileName = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile; + const redirectedReference = !isString(containingFile) ? getRedirectReferenceForResolution(containingFile) : undefined; + tracing.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName }); performance.mark("beforeResolveTypeReference"); - const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, redirectedReference); + const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference); performance.mark("afterResolveTypeReference"); performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference"); + tracing.pop(); return result; } + function getRedirectReferenceForResolution(file: SourceFile) { + const redirect = getResolvedProjectReferenceToRedirect(file.originalFileName); + if (redirect || !fileExtensionIs(file.originalFileName, Extension.Dts)) return redirect; + + // The originalFileName could not be actual source file name if file found was d.ts from referecned project + // So in this case try to look up if this is output from referenced project, if it is use the redirected project in that case + const resultFromDts = getRedirectReferenceForResolutionFromSourceOfProject(file.originalFileName, file.path); + if (resultFromDts) return resultFromDts; + + // If preserveSymlinks is true, module resolution wont jump the symlink + // but the resolved real path may be the .d.ts from project reference + // Note:: Currently we try the real path only if the + // file is from node_modules to avoid having to run real path on all file paths + if (!host.realpath || !options.preserveSymlinks || !stringContains(file.originalFileName, nodeModulesPathPart)) return undefined; + const realDeclarationFileName = host.realpath(file.originalFileName); + const realDeclarationPath = toPath(realDeclarationFileName); + return realDeclarationPath === file.path ? undefined : getRedirectReferenceForResolutionFromSourceOfProject(realDeclarationFileName, realDeclarationPath); + } + + function getRedirectReferenceForResolutionFromSourceOfProject(fileName: string, filePath: Path) { + const source = getSourceOfProjectReferenceRedirect(fileName); + if (isString(source)) return getResolvedProjectReferenceToRedirect(source); + if (!source) return undefined; + // Output of .d.ts file so return resolved ref that matches the out file name + return forEachResolvedProjectReference(resolvedRef => { + const out = outFile(resolvedRef.commandLine.options); + if (!out) return undefined; + return toPath(out) === filePath ? resolvedRef : undefined; + }); + } + function compareDefaultLibFiles(a: SourceFile, b: SourceFile) { return compareValues(getDefaultLibFilePriority(a), getDefaultLibFilePriority(b)); } @@ -1067,14 +1165,14 @@ namespace ts { return classifiableNames; } - function resolveModuleNamesReusingOldState(moduleNames: string[], containingFile: string, file: SourceFile) { - if (structuralIsReused === StructureIsReused.Not && !file.ambientModuleNames.length) { + function resolveModuleNamesReusingOldState(moduleNames: string[], file: SourceFile): readonly ResolvedModuleFull[] { + if (structureIsReused === StructureIsReused.Not && !file.ambientModuleNames.length) { // If the old program state does not permit reusing resolutions and `file` does not contain locally defined ambient modules, // the best we can do is fallback to the default logic. - return resolveModuleNamesWorker(moduleNames, containingFile, /*reusedNames*/ undefined, getResolvedProjectReferenceToRedirect(file.originalFileName)); + return resolveModuleNamesWorker(moduleNames, file, /*reusedNames*/ undefined); } - const oldSourceFile = oldProgram && oldProgram.getSourceFile(containingFile); + const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName); if (oldSourceFile !== file && file.resolvedModules) { // `file` was created for the new program. // @@ -1119,7 +1217,7 @@ namespace ts { const oldResolvedModule = getResolvedModule(oldSourceFile, moduleName); if (oldResolvedModule) { if (isTraceEnabled(options, host)) { - trace(host, Diagnostics.Reusing_resolution_of_module_0_to_file_1_from_old_program, moduleName, containingFile); + trace(host, Diagnostics.Reusing_resolution_of_module_0_to_file_1_from_old_program, moduleName, getNormalizedAbsolutePath(file.originalFileName, currentDirectory)); } (result || (result = new Array(moduleNames.length)))[i] = oldResolvedModule; (reusedNames || (reusedNames = [])).push(moduleName); @@ -1134,7 +1232,7 @@ namespace ts { if (contains(file.ambientModuleNames, moduleName)) { resolvesToAmbientModuleInNonModifiedFile = true; if (isTraceEnabled(options, host)) { - trace(host, Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName, containingFile); + trace(host, Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName, getNormalizedAbsolutePath(file.originalFileName, currentDirectory)); } } else { @@ -1151,7 +1249,7 @@ namespace ts { } const resolutions = unknownModuleNames && unknownModuleNames.length - ? resolveModuleNamesWorker(unknownModuleNames, containingFile, reusedNames, getResolvedProjectReferenceToRedirect(file.originalFileName)) + ? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames) : emptyArray; // Combine results of resolutions and predicted results @@ -1210,7 +1308,7 @@ namespace ts { return !forEachProjectReference( oldProgram!.getProjectReferences(), oldProgram!.getResolvedProjectReferences(), - (oldResolvedRef, index, parent) => { + (oldResolvedRef, parent, index) => { const newRef = (parent ? parent.commandLine.projectReferences : projectReferences)![index]; const newResolvedRef = parseProjectReferenceConfigFile(newRef); if (oldResolvedRef) { @@ -1239,22 +1337,22 @@ namespace ts { // if any of these properties has changed - structure cannot be reused const oldOptions = oldProgram.getCompilerOptions(); if (changesAffectModuleResolution(oldOptions, options)) { - return oldProgram.structureIsReused = StructureIsReused.Not; + return StructureIsReused.Not; } // there is an old program, check if we can reuse its structure const oldRootNames = oldProgram.getRootFileNames(); if (!arrayIsEqualTo(oldRootNames, rootNames)) { - return oldProgram.structureIsReused = StructureIsReused.Not; + return StructureIsReused.Not; } if (!arrayIsEqualTo(options.types, oldOptions.types)) { - return oldProgram.structureIsReused = StructureIsReused.Not; + return StructureIsReused.Not; } // Check if any referenced project tsconfig files are different if (!canReuseProjectReferences()) { - return oldProgram.structureIsReused = StructureIsReused.Not; + return StructureIsReused.Not; } if (projectReferences) { resolvedProjectReferences = projectReferences.map(parseProjectReferenceConfigFile); @@ -1263,13 +1361,13 @@ namespace ts { // check if program source files has changed in the way that can affect structure of the program const newSourceFiles: SourceFile[] = []; const modifiedSourceFiles: { oldFile: SourceFile, newFile: SourceFile }[] = []; - oldProgram.structureIsReused = StructureIsReused.Completely; + structureIsReused = StructureIsReused.Completely; // If the missing file paths are now present, it can change the progam structure, // and hence cant reuse the structure. // This is same as how we dont reuse the structure if one of the file from old program is now missing if (oldProgram.getMissingFilePaths().some(missingFilePath => host.fileExists(missingFilePath))) { - return oldProgram.structureIsReused = StructureIsReused.Not; + return StructureIsReused.Not; } const oldSourceFiles = oldProgram.getSourceFiles(); @@ -1282,7 +1380,7 @@ namespace ts { : host.getSourceFile(oldSourceFile.fileName, options.target!, /*onError*/ undefined, shouldCreateNewSourceFile); // TODO: GH#18217 if (!newSourceFile) { - return oldProgram.structureIsReused = StructureIsReused.Not; + return StructureIsReused.Not; } Debug.assert(!newSourceFile.redirectInfo, "Host should not return a redirect source file from `getSourceFile`"); @@ -1293,7 +1391,7 @@ namespace ts { // This lets us know if the unredirected file has changed. If it has we should break the redirect. if (newSourceFile !== oldSourceFile.redirectInfo.unredirected) { // Underlying file has changed. Might not redirect anymore. Must rebuild program. - return oldProgram.structureIsReused = StructureIsReused.Not; + return StructureIsReused.Not; } fileChanged = false; newSourceFile = oldSourceFile; // Use the redirect. @@ -1301,7 +1399,7 @@ namespace ts { else if (oldProgram.redirectTargetsMap.has(oldSourceFile.path)) { // If a redirected-to source file changes, the redirect may be broken. if (newSourceFile !== oldSourceFile) { - return oldProgram.structureIsReused = StructureIsReused.Not; + return StructureIsReused.Not; } fileChanged = false; } @@ -1322,7 +1420,7 @@ namespace ts { const prevKind = seenPackageNames.get(packageName); const newKind = fileChanged ? SeenPackageName.Modified : SeenPackageName.Exists; if ((prevKind !== undefined && newKind === SeenPackageName.Modified) || prevKind === SeenPackageName.Modified) { - return oldProgram.structureIsReused = StructureIsReused.Not; + return StructureIsReused.Not; } seenPackageNames.set(packageName, newKind); } @@ -1332,39 +1430,39 @@ namespace ts { if (!arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) { // 'lib' references has changed. Matches behavior in changesAffectModuleResolution - return oldProgram.structureIsReused = StructureIsReused.Not; + return StructureIsReused.Not; } if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { // value of no-default-lib has changed // this will affect if default library is injected into the list of files - oldProgram.structureIsReused = StructureIsReused.SafeModules; + structureIsReused = StructureIsReused.SafeModules; } // check tripleslash references if (!arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) { // tripleslash references has changed - oldProgram.structureIsReused = StructureIsReused.SafeModules; + structureIsReused = StructureIsReused.SafeModules; } // check imports and module augmentations collectExternalModuleReferences(newSourceFile); if (!arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) { // imports has changed - oldProgram.structureIsReused = StructureIsReused.SafeModules; + structureIsReused = StructureIsReused.SafeModules; } if (!arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) { // moduleAugmentations has changed - oldProgram.structureIsReused = StructureIsReused.SafeModules; + structureIsReused = StructureIsReused.SafeModules; } if ((oldSourceFile.flags & NodeFlags.PermanentlySetIncrementalFlags) !== (newSourceFile.flags & NodeFlags.PermanentlySetIncrementalFlags)) { // dynamicImport has changed - oldProgram.structureIsReused = StructureIsReused.SafeModules; + structureIsReused = StructureIsReused.SafeModules; } if (!arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) { // 'types' references has changed - oldProgram.structureIsReused = StructureIsReused.SafeModules; + structureIsReused = StructureIsReused.SafeModules; } // tentatively approve the file @@ -1372,7 +1470,7 @@ namespace ts { } else if (hasInvalidatedResolution(oldSourceFile.path)) { // 'module/types' references could have changed - oldProgram.structureIsReused = StructureIsReused.SafeModules; + structureIsReused = StructureIsReused.SafeModules; // add file to the modified list so that we will resolve it later modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); @@ -1382,8 +1480,8 @@ namespace ts { newSourceFiles.push(newSourceFile); } - if (oldProgram.structureIsReused !== StructureIsReused.Completely) { - return oldProgram.structureIsReused; + if (structureIsReused !== StructureIsReused.Completely) { + return structureIsReused; } const modifiedFiles = modifiedSourceFiles.map(f => f.oldFile); @@ -1396,40 +1494,37 @@ namespace ts { } // try to verify results of module resolution for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) { - const newSourceFilePath = getNormalizedAbsolutePath(newSourceFile.originalFileName, currentDirectory); const moduleNames = getModuleNames(newSourceFile); - const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFilePath, newSourceFile); + const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile); // ensure that module resolution results are still correct const resolutionsChanged = hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo); if (resolutionsChanged) { - oldProgram.structureIsReused = StructureIsReused.SafeModules; + structureIsReused = StructureIsReused.SafeModules; newSourceFile.resolvedModules = zipToMap(moduleNames, resolutions); } else { newSourceFile.resolvedModules = oldSourceFile.resolvedModules; } - if (resolveTypeReferenceDirectiveNamesWorker) { - // We lower-case all type references because npm automatically lowercases all packages. See GH#9824. - const typesReferenceDirectives = map(newSourceFile.typeReferenceDirectives, ref => toFileNameLowerCase(ref.fileName)); - const resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath, getResolvedProjectReferenceToRedirect(newSourceFile.originalFileName)); - // ensure that types resolutions are still correct - const resolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, typeDirectiveIsEqualTo); - if (resolutionsChanged) { - oldProgram.structureIsReused = StructureIsReused.SafeModules; - newSourceFile.resolvedTypeReferenceDirectiveNames = zipToMap(typesReferenceDirectives, resolutions); - } - else { - newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; - } + // We lower-case all type references because npm automatically lowercases all packages. See GH#9824. + const typesReferenceDirectives = map(newSourceFile.typeReferenceDirectives, ref => toFileNameLowerCase(ref.fileName)); + const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile); + // ensure that types resolutions are still correct + const typeReferenceEesolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, typeDirectiveIsEqualTo); + if (typeReferenceEesolutionsChanged) { + structureIsReused = StructureIsReused.SafeModules; + newSourceFile.resolvedTypeReferenceDirectiveNames = zipToMap(typesReferenceDirectives, typeReferenceResolutions); + } + else { + newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; } } - if (oldProgram.structureIsReused !== StructureIsReused.Completely) { - return oldProgram.structureIsReused; + if (structureIsReused !== StructureIsReused.Completely) { + return structureIsReused; } if (host.hasChangedAutomaticTypeDirectiveNames?.()) { - return oldProgram.structureIsReused = StructureIsReused.SafeModules; + return StructureIsReused.SafeModules; } missingFilePaths = oldProgram.getMissingFilePaths(); @@ -1467,7 +1562,7 @@ namespace ts { sourceFileToPackageName = oldProgram.sourceFileToPackageName; redirectTargetsMap = oldProgram.redirectTargetsMap; - return oldProgram.structureIsReused = StructureIsReused.Completely; + return StructureIsReused.Completely; } function getEmitHost(writeFileCallback?: WriteFileCallback): EmitHost { @@ -1508,7 +1603,8 @@ namespace ts { function emitBuildInfo(writeFileCallback?: WriteFileCallback): EmitResult { Debug.assert(!outFile(options)); - tracing.begin(tracing.Phase.Emit, "emitBuildInfo", {}); + const tracingData: tracing.EventData = [tracing.Phase.Emit, "emitBuildInfo"]; + tracing.begin(...tracingData); performance.mark("beforeEmit"); const emitResult = emitFiles( notImplementedResolver, @@ -1521,7 +1617,7 @@ namespace ts { performance.mark("afterEmit"); performance.measure("Emit", "beforeEmit", "afterEmit"); - tracing.end(); + tracing.end(...tracingData); return emitResult; } @@ -1582,9 +1678,10 @@ namespace ts { } function emit(sourceFile?: SourceFile, writeFileCallback?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, transformers?: CustomTransformers, forceDtsEmit?: boolean): EmitResult { - tracing.begin(tracing.Phase.Emit, "emit", { path: sourceFile?.path }); + const tracingData: tracing.EventData = [tracing.Phase.Emit, "emit", { path: sourceFile?.path }]; + tracing.begin(...tracingData); const result = runWithCancellationToken(() => emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers, forceDtsEmit)); - tracing.end(); + tracing.end(...tracingData); return result; } @@ -1656,6 +1753,12 @@ namespace ts { return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); } + function getCachedSemanticDiagnostics(sourceFile?: SourceFile): readonly Diagnostic[] | undefined { + return sourceFile + ? cachedBindAndCheckDiagnosticsForFile.perFile?.get(sourceFile.path) + : cachedBindAndCheckDiagnosticsForFile.allDiagnostics; + } + function getBindAndCheckDiagnostics(sourceFile: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[] { return getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken); } @@ -2071,9 +2174,7 @@ namespace ts { if (!options.configFile) { return emptyArray; } let diagnostics = programDiagnostics.getDiagnostics(options.configFile.fileName); forEachResolvedProjectReference(resolvedRef => { - if (resolvedRef) { - diagnostics = concatenate(diagnostics, programDiagnostics.getDiagnostics(resolvedRef.sourceFile.fileName)); - } + diagnostics = concatenate(diagnostics, programDiagnostics.getDiagnostics(resolvedRef.sourceFile.fileName)); }); return diagnostics; } @@ -2100,6 +2201,19 @@ namespace ts { : b.kind === SyntaxKind.StringLiteral && a.text === b.text; } + function createSyntheticImport(text: string, file: SourceFile) { + const externalHelpersModuleReference = factory.createStringLiteral(text); + const importDecl = factory.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, /*importClause*/ undefined, externalHelpersModuleReference); + addEmitFlags(importDecl, EmitFlags.NeverApplyImportHelper); + setParent(externalHelpersModuleReference, importDecl); + setParent(importDecl, file); + // explicitly unset the synthesized flag on these declarations so the checker API will answer questions about them + // (which is required to build the dependency graph for incremental emit) + (externalHelpersModuleReference as Mutable).flags &= ~NodeFlags.Synthesized; + (importDecl as Mutable).flags &= ~NodeFlags.Synthesized; + return externalHelpersModuleReference; + } + function collectExternalModuleReferences(file: SourceFile): void { if (file.imports) { return; @@ -2115,16 +2229,17 @@ namespace ts { // If we are importing helpers, we need to add a synthetic reference to resolve the // helpers library. - if (options.importHelpers - && (options.isolatedModules || isExternalModuleFile) + if ((options.isolatedModules || isExternalModuleFile) && !file.isDeclarationFile) { - // synthesize 'import "tslib"' declaration - const externalHelpersModuleReference = factory.createStringLiteral(externalHelpersModuleNameText); - const importDecl = factory.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, /*importClause*/ undefined, externalHelpersModuleReference); - addEmitFlags(importDecl, EmitFlags.NeverApplyImportHelper); - setParent(externalHelpersModuleReference, importDecl); - setParent(importDecl, file); - imports = [externalHelpersModuleReference]; + if (options.importHelpers) { + // synthesize 'import "tslib"' declaration + imports = [createSyntheticImport(externalHelpersModuleNameText, file)]; + } + const jsxImport = getJSXRuntimeImport(getJSXImplicitImportBase(options, file), options); + if (jsxImport) { + // synthesize `import "base/jsx-runtime"` declaration + (imports ||= []).push(createSyntheticImport(jsxImport, file)); + } } for (const node of file.statements) { @@ -2337,6 +2452,17 @@ namespace ts { // Get source file from normalized fileName function findSourceFile(fileName: string, path: Path, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, refFile: RefFile | undefined, packageId: PackageId | undefined): SourceFile | undefined { + tracing.push(tracing.Phase.Program, "findSourceFile", { + fileName, + isDefaultLib: isDefaultLib || undefined, + refKind: refFile ? (RefFileKind as any)[refFile.kind] : undefined, + }); + const result = findSourceFileWorker(fileName, path, isDefaultLib, ignoreNoDefaultLib, refFile, packageId); + tracing.pop(); + return result; + } + + function findSourceFileWorker(fileName: string, path: Path, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, refFile: RefFile | undefined, packageId: PackageId | undefined): SourceFile | undefined { if (useSourceOfProjectReferenceRedirect) { let source = getSourceOfProjectReferenceRedirect(fileName); // If preserveSymlinks is true, module resolution wont jump the symlink @@ -2553,12 +2679,11 @@ namespace ts { function getResolvedProjectReferenceToRedirect(fileName: string) { if (mapFromFileToProjectReferenceRedirects === undefined) { mapFromFileToProjectReferenceRedirects = new Map(); - forEachResolvedProjectReference((referencedProject, referenceProjectPath) => { + forEachResolvedProjectReference(referencedProject => { // not input file from the referenced project, ignore - if (referencedProject && - toPath(options.configFilePath!) !== referenceProjectPath) { + if (toPath(options.configFilePath!) !== referencedProject.sourceFile.path) { referencedProject.commandLine.fileNames.forEach(f => - mapFromFileToProjectReferenceRedirects!.set(toPath(f), referenceProjectPath)); + mapFromFileToProjectReferenceRedirects!.set(toPath(f), referencedProject.sourceFile.path)); } }); } @@ -2568,13 +2693,9 @@ namespace ts { } function forEachResolvedProjectReference( - cb: (resolvedProjectReference: ResolvedProjectReference | undefined, resolvedProjectReferencePath: Path) => T | undefined + cb: (resolvedProjectReference: ResolvedProjectReference) => T | undefined ): T | undefined { - return forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, index, parent) => { - const ref = (parent ? parent.commandLine.projectReferences : projectReferences)![index]; - const resolvedRefPath = toPath(resolveProjectReferencePath(ref)); - return cb(resolvedRef, resolvedRefPath); - }); + return ts.forEachResolvedProjectReference(resolvedProjectReferences, cb); } function getSourceOfProjectReferenceRedirect(file: string) { @@ -2582,21 +2703,19 @@ namespace ts { if (mapFromToProjectReferenceRedirectSource === undefined) { mapFromToProjectReferenceRedirectSource = new Map(); forEachResolvedProjectReference(resolvedRef => { - if (resolvedRef) { - const out = outFile(resolvedRef.commandLine.options); - if (out) { - // Dont know which source file it means so return true? - const outputDts = changeExtension(out, Extension.Dts); - mapFromToProjectReferenceRedirectSource!.set(toPath(outputDts), true); - } - else { - forEach(resolvedRef.commandLine.fileNames, fileName => { - if (!fileExtensionIs(fileName, Extension.Dts) && !fileExtensionIs(fileName, Extension.Json)) { - const outputDts = getOutputDeclarationFileName(fileName, resolvedRef.commandLine, host.useCaseSensitiveFileNames()); - mapFromToProjectReferenceRedirectSource!.set(toPath(outputDts), fileName); - } - }); - } + const out = outFile(resolvedRef.commandLine.options); + if (out) { + // Dont know which source file it means so return true? + const outputDts = changeExtension(out, Extension.Dts); + mapFromToProjectReferenceRedirectSource!.set(toPath(outputDts), true); + } + else { + forEach(resolvedRef.commandLine.fileNames, fileName => { + if (!fileExtensionIs(fileName, Extension.Dts) && !fileExtensionIs(fileName, Extension.Json)) { + const outputDts = getOutputDeclarationFileName(fileName, resolvedRef.commandLine, host.useCaseSensitiveFileNames()); + mapFromToProjectReferenceRedirectSource!.set(toPath(outputDts), fileName); + } + }); } }); } @@ -2607,49 +2726,6 @@ namespace ts { return useSourceOfProjectReferenceRedirect && !!getResolvedProjectReferenceToRedirect(fileName); } - function forEachProjectReference( - projectReferences: readonly ProjectReference[] | undefined, - resolvedProjectReferences: readonly (ResolvedProjectReference | undefined)[] | undefined, - cbResolvedRef: (resolvedRef: ResolvedProjectReference | undefined, index: number, parent: ResolvedProjectReference | undefined) => T | undefined, - cbRef?: (projectReferences: readonly ProjectReference[] | undefined, parent: ResolvedProjectReference | undefined) => T | undefined - ): T | undefined { - let seenResolvedRefs: ResolvedProjectReference[] | undefined; - - return worker(projectReferences, resolvedProjectReferences, /*parent*/ undefined, cbResolvedRef, cbRef); - - function worker( - projectReferences: readonly ProjectReference[] | undefined, - resolvedProjectReferences: readonly (ResolvedProjectReference | undefined)[] | undefined, - parent: ResolvedProjectReference | undefined, - cbResolvedRef: (resolvedRef: ResolvedProjectReference | undefined, index: number, parent: ResolvedProjectReference | undefined) => T | undefined, - cbRef?: (projectReferences: readonly ProjectReference[] | undefined, parent: ResolvedProjectReference | undefined) => T | undefined, - ): T | undefined { - - // Visit project references first - if (cbRef) { - const result = cbRef(projectReferences, parent); - if (result) { return result; } - } - - return forEach(resolvedProjectReferences, (resolvedRef, index) => { - if (contains(seenResolvedRefs, resolvedRef)) { - // ignore recursives - return undefined; - } - - const result = cbResolvedRef(resolvedRef, index, parent); - if (result) { - return result; - } - - if (!resolvedRef) return undefined; - - (seenResolvedRefs || (seenResolvedRefs = [])).push(resolvedRef); - return worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef, cbResolvedRef, cbRef); - }); - } - } - function getResolvedProjectReferenceByPath(projectReferencePath: Path): ResolvedProjectReference | undefined { if (!projectReferenceRedirects) { return undefined; @@ -2684,7 +2760,7 @@ namespace ts { return; } - const resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.originalFileName, getResolvedProjectReferenceToRedirect(file.originalFileName)); + const resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file); for (let i = 0; i < typeDirectives.length; i++) { const ref = file.typeReferenceDirectives[i]; @@ -2711,6 +2787,16 @@ namespace ts { resolvedTypeReferenceDirective?: ResolvedTypeReferenceDirective, refFile?: RefFile ): void { + tracing.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolveModuleNamesReusingOldState, refKind: refFile?.kind, refPath: refFile?.file.path }); + processTypeReferenceDirectiveWorker(typeReferenceDirective, resolvedTypeReferenceDirective, refFile); + tracing.pop(); + } + + function processTypeReferenceDirectiveWorker( + typeReferenceDirective: string, + resolvedTypeReferenceDirective?: ResolvedTypeReferenceDirective, + refFile?: RefFile + ): void { // If we already found this library as a primary reference - nothing to do const previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective); @@ -2822,7 +2908,7 @@ namespace ts { if (file.imports.length || file.moduleAugmentations.length) { // Because global augmentation doesn't have string literal name, we can check for global augmentation as such. const moduleNames = getModuleNames(file); - const resolutions = resolveModuleNamesReusingOldState(moduleNames, getNormalizedAbsolutePath(file.originalFileName, currentDirectory), file); + const resolutions = resolveModuleNamesReusingOldState(moduleNames, file); Debug.assert(resolutions.length === moduleNames.length); for (let i = 0; i < moduleNames.length; i++) { const resolution = resolutions[i]; @@ -3304,7 +3390,7 @@ namespace ts { function verifyProjectReferences() { const buildInfoPath = !options.suppressOutputPathCheck ? getTsBuildInfoEmitOutputFilePath(options) : undefined; - forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, index, parent) => { + forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, parent, index) => { const ref = (parent ? parent.commandLine.projectReferences : projectReferences)![index]; const parentFile = parent && parent.sourceFile as JsonSourceFile; if (!resolvedRef) { @@ -3502,7 +3588,7 @@ namespace ts { toPath(fileName: string): Path; getResolvedProjectReferences(): readonly (ResolvedProjectReference | undefined)[] | undefined; getSourceOfProjectReferenceRedirect(fileName: string): SourceOfProjectReferenceRedirect | undefined; - forEachResolvedProjectReference(cb: (resolvedProjectReference: ResolvedProjectReference | undefined, resolvedProjectReferencePath: Path) => T | undefined): T | undefined; + forEachResolvedProjectReference(cb: (resolvedProjectReference: ResolvedProjectReference) => T | undefined): T | undefined; } function updateHostForUseSourceOfProjectReferenceRedirect(host: HostForUseSourceOfProjectReferenceRedirect) { @@ -3532,7 +3618,6 @@ namespace ts { if (!setOfDeclarationDirectories) { setOfDeclarationDirectories = new Set(); host.forEachResolvedProjectReference(ref => { - if (!ref) return; const out = outFile(ref.commandLine.options); if (out) { setOfDeclarationDirectories!.add(getDirectoryPath(host.toPath(out))); diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 5f5248e1073..35388e38b04 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -111,6 +111,7 @@ namespace ts { infer: SyntaxKind.InferKeyword, instanceof: SyntaxKind.InstanceOfKeyword, interface: SyntaxKind.InterfaceKeyword, + intrinsic: SyntaxKind.IntrinsicKeyword, is: SyntaxKind.IsKeyword, keyof: SyntaxKind.KeyOfKeyword, let: SyntaxKind.LetKeyword, @@ -151,10 +152,6 @@ namespace ts { yield: SyntaxKind.YieldKeyword, async: SyntaxKind.AsyncKeyword, await: SyntaxKind.AwaitKeyword, - uppercase: SyntaxKind.UppercaseKeyword, - lowercase: SyntaxKind.LowercaseKeyword, - capitalize: SyntaxKind.CapitalizeKeyword, - uncapitalize: SyntaxKind.UncapitalizeKeyword, of: SyntaxKind.OfKeyword, }; diff --git a/src/compiler/tracing.ts b/src/compiler/tracing.ts index 30b90a2b0d1..f00207ae198 100644 --- a/src/compiler/tracing.ts +++ b/src/compiler/tracing.ts @@ -46,7 +46,15 @@ namespace ts.tracing { }); traceFd = fs.openSync(tracePath, "w"); - fs.writeSync(traceFd, `[\n`); + + // Start with a prefix that contains some metadata that the devtools profiler expects (also avoids a warning on import) + const meta = { cat: "__metadata", ph: "M", ts: 1000 * timestamp(), pid: 1, tid: 1 }; + fs.writeSync(traceFd, + "[\n" + + [{ name: "process_name", args: { name: "tsc" }, ...meta }, + { name: "thread_name", args: { name: "Main" }, ...meta }, + { name: "TracingStartedInBrowser", ...meta, cat: "disabled-by-default-devtools.timeline" }] + .map(v => JSON.stringify(v)).join(",\n")); } /** Stops tracing for the in-progress project and dumps the type catalog (unless the `fs` module is unavailable). */ @@ -58,11 +66,7 @@ namespace ts.tracing { Debug.assert(fs); - // This both indicates that the trace is untruncated and conveniently - // ensures that the last array element won't have a trailing comma. - fs.writeSync(traceFd, `{"pid":1,"tid":1,"ph":"i","ts":${1000 * timestamp()},"name":"done","s":"g"}\n`); - fs.writeSync(traceFd, `]\n`); - + fs.writeSync(traceFd, `\n]\n`); fs.closeSync(traceFd); traceFd = undefined; @@ -88,38 +92,51 @@ namespace ts.tracing { Emit = "emit", } - export function begin(phase: Phase, name: string, args: object) { - if (!traceFd) { - return; - } - Debug.assert(fs); + export type EventData = [phase: Phase, name: string, args?: object]; - performance.mark("beginTracing"); - fs.writeSync(traceFd, `{"pid":1,"tid":1,"ph":"B","cat":"${phase}","ts":${1000 * timestamp()},"name":"${name}","args":{ "ts": ${JSON.stringify(args)} }},\n`); - performance.mark("endTracing"); - performance.measure("Tracing", "beginTracing", "endTracing"); + /** Note: `push`/`pop` should be used by default. + * `begin`/`end` are for special cases where we need the data point even if the event never + * terminates (typically for reducing a scenario too big to trace to one that can be completed). + * In the future we might implement an exit handler to dump unfinished events which would + * deprecate these operations. + */ + export function begin(phase: Phase, name: string, args?: object) { + if (!traceFd) return; + writeEvent("B", phase, name, args); + } + export function end(phase: Phase, name: string, args?: object) { + if (!traceFd) return; + writeEvent("E", phase, name, args); } - export function end() { - if (!traceFd) { - return; - } - Debug.assert(fs); - - performance.mark("beginTracing"); - fs.writeSync(traceFd, `{"pid":1,"tid":1,"ph":"E","ts":${1000 * timestamp()}},\n`); - performance.mark("endTracing"); - performance.measure("Tracing", "beginTracing", "endTracing"); + export function instant(phase: Phase, name: string, args?: object) { + if (!traceFd) return; + writeEvent("I", phase, name, args, `"s":"g"`); } - export function instant(phase: Phase, name: string, args: object) { - if (!traceFd) { - return; - } - Debug.assert(fs); + // Used for "Complete" (ph:"X") events + const completeEvents: { phase: Phase, name: string, args?: object, time: number }[] = []; + export function push(phase: Phase, name: string, args?: object) { + if (!traceFd) return; + completeEvents.push({ phase, name, args, time: 1000 * timestamp() }); + } + export function pop() { + if (!traceFd) return; + Debug.assert(completeEvents.length > 0); + const { phase, name, args, time } = completeEvents.pop()!; + const dur = 1000 * timestamp() - time; + writeEvent("X", phase, name, args, `"dur":${dur}`, time); + } + function writeEvent(eventType: string, phase: Phase, name: string, args: object | undefined, extras?: string, + time: number = 1000 * timestamp()) { + Debug.assert(traceFd); + Debug.assert(fs); performance.mark("beginTracing"); - fs.writeSync(traceFd, `{"pid":1,"tid":1,"ph":"i","cat":"${phase}","ts":${1000 * timestamp()},"name":"${name}","s":"g","args":{ "ts": ${JSON.stringify(args)} }},\n`); + fs.writeSync(traceFd, `,\n{"pid":1,"tid":1,"ph":"${eventType}","cat":"${phase}","ts":${time},"name":"${name}"`); + if (extras) fs.writeSync(traceFd, `,${extras}`); + if (args) fs.writeSync(traceFd, `,"args":${JSON.stringify(args)}`); + fs.writeSync(traceFd, `}`); performance.mark("endTracing"); performance.measure("Tracing", "beginTracing", "endTracing"); } diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index f76652df95e..efca6f7f187 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -223,9 +223,9 @@ namespace ts { // Transform each node. const transformed: T[] = []; for (const node of nodes) { - tracing.begin(tracing.Phase.Emit, "transformNodes", node.kind === SyntaxKind.SourceFile ? { path: (node as any as SourceFile).path } : { kind: node.kind, pos: node.pos, end: node.end }); + tracing.push(tracing.Phase.Emit, "transformNodes", node.kind === SyntaxKind.SourceFile ? { path: (node as any as SourceFile).path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); - tracing.end(); + tracing.pop(); } // prevent modification of the lexical environment. diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index af12fbe1925..43539cb06ad 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -14,8 +14,8 @@ namespace ts { export function isInternalDeclaration(node: Node, currentSourceFile: SourceFile) { const parseTreeNode = getParseTreeNode(node); if (parseTreeNode && parseTreeNode.kind === SyntaxKind.Parameter) { - const paramIdx = (parseTreeNode.parent as FunctionLike).parameters.indexOf(parseTreeNode as ParameterDeclaration); - const previousSibling = paramIdx > 0 ? (parseTreeNode.parent as FunctionLike).parameters[paramIdx - 1] : undefined; + const paramIdx = (parseTreeNode.parent as SignatureDeclaration).parameters.indexOf(parseTreeNode as ParameterDeclaration); + const previousSibling = paramIdx > 0 ? (parseTreeNode.parent as SignatureDeclaration).parameters[paramIdx - 1] : undefined; const text = currentSourceFile.text; const commentRanges = previousSibling ? concatenate( diff --git a/src/compiler/transformers/destructuring.ts b/src/compiler/transformers/destructuring.ts index 1dcbc081475..484cee5e497 100644 --- a/src/compiler/transformers/destructuring.ts +++ b/src/compiler/transformers/destructuring.ts @@ -5,6 +5,7 @@ namespace ts { level: FlattenLevel; downlevelIteration: boolean; hoistTempVariables: boolean; + hasTransformedPriorElement?: boolean; // indicates whether we've transformed a prior declaration emitExpression: (value: Expression) => void; emitBindingOrAssignment: (target: BindingOrAssignmentElementTarget, value: Expression, location: TextRange, original: Node | undefined) => void; createArrayBindingOrAssignmentPattern: (elements: BindingOrAssignmentElement[]) => ArrayBindingOrAssignmentPattern; @@ -265,18 +266,27 @@ namespace ts { value: Expression | undefined, location: TextRange, skipInitializer?: boolean) { + const bindingTarget = getTargetOfBindingOrAssignmentElement(element)!; // TODO: GH#18217 if (!skipInitializer) { const initializer = visitNode(getInitializerOfBindingOrAssignmentElement(element), flattenContext.visitor, isExpression); if (initializer) { // Combine value and initializer - value = value ? createDefaultValueCheck(flattenContext, value, initializer, location) : initializer; + if (value) { + value = createDefaultValueCheck(flattenContext, value, initializer, location); + // If 'value' is not a simple expression, it could contain side-effecting code that should evaluate before an object or array binding pattern. + if (!isSimpleInlineableExpression(initializer) && isBindingOrAssignmentPattern(bindingTarget)) { + value = ensureIdentifier(flattenContext, value, /*reuseIdentifierExpressions*/ true, location); + } + } + else { + value = initializer; + } } else if (!value) { // Use 'void 0' in absence of value and initializer value = flattenContext.context.factory.createVoidZero(); } } - const bindingTarget = getTargetOfBindingOrAssignmentElement(element)!; // TODO: GH#18217 if (isObjectBindingOrAssignmentPattern(bindingTarget)) { flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value!, location); } @@ -393,7 +403,8 @@ namespace ts { if (flattenContext.level >= FlattenLevel.ObjectRest) { // If an array pattern contains an ObjectRest, we must cache the result so that we // can perform the ObjectRest destructuring in a different declaration - if (element.transformFlags & TransformFlags.ContainsObjectRestOrSpread) { + if (element.transformFlags & TransformFlags.ContainsObjectRestOrSpread || flattenContext.hasTransformedPriorElement && !isSimpleBindingOrAssignmentElement(element)) { + flattenContext.hasTransformedPriorElement = true; const temp = flattenContext.context.factory.createTempVariable(/*recordTempVariable*/ undefined); if (flattenContext.hoistTempVariables) { flattenContext.context.hoistVariableDeclaration(temp); @@ -428,6 +439,17 @@ namespace ts { } } + function isSimpleBindingOrAssignmentElement(element: BindingOrAssignmentElement): boolean { + const target = getTargetOfBindingOrAssignmentElement(element); + if (!target || isOmittedExpression(target)) return true; + const propertyName = tryGetPropertyNameOfBindingOrAssignmentElement(element); + if (propertyName && !isPropertyNameLiteral(propertyName)) return false; + const initializer = getInitializerOfBindingOrAssignmentElement(element); + if (initializer && !isSimpleInlineableExpression(initializer)) return false; + if (isBindingOrAssignmentPattern(target)) return every(getElementsOfBindingOrAssignmentPattern(target), isSimpleBindingOrAssignmentElement); + return isIdentifier(target); + } + /** * Creates an expression used to provide a default value if a value is `undefined` at runtime. * diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 813ce25672b..f7c20e74d67 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -355,12 +355,11 @@ namespace ts { } function visitor(node: Node): VisitResult { - if (shouldVisitNode(node)) { - return visitJavaScript(node); - } - else { - return node; - } + return shouldVisitNode(node) ? visitorWorker(node, /*expressionResultIsUnused*/ false) : node; + } + + function visitorWithUnusedExpressionResult(node: Node): VisitResult { + return shouldVisitNode(node) ? visitorWorker(node, /*expressionResultIsUnused*/ true) : node; } function callExpressionVisitor(node: Node): VisitResult { @@ -370,7 +369,7 @@ namespace ts { return visitor(node); } - function visitJavaScript(node: Node): VisitResult { + function visitorWorker(node: Node, expressionResultIsUnused: boolean): VisitResult { switch (node.kind) { case SyntaxKind.StaticKeyword: return undefined; // elide static keyword @@ -456,10 +455,13 @@ namespace ts { return visitNewExpression(node); case SyntaxKind.ParenthesizedExpression: - return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true); + return visitParenthesizedExpression(node, expressionResultIsUnused); case SyntaxKind.BinaryExpression: - return visitBinaryExpression(node, /*needsDestructuringValue*/ true); + return visitBinaryExpression(node, expressionResultIsUnused); + + case SyntaxKind.CommaListExpression: + return visitCommaListExpression(node, expressionResultIsUnused); case SyntaxKind.NoSubstitutionTemplateLiteral: case SyntaxKind.TemplateHead: @@ -507,6 +509,9 @@ namespace ts { case SyntaxKind.ReturnStatement: return visitReturnStatement(node); + case SyntaxKind.VoidExpression: + return visitVoidExpression(node as VoidExpression); + default: return visitEachChild(node, visitor, context); } @@ -596,6 +601,10 @@ namespace ts { return node; } + function visitVoidExpression(node: VoidExpression): Expression { + return visitEachChild(node, visitorWithUnusedExpressionResult, context); + } + function visitIdentifier(node: Identifier): Identifier { if (!convertedLoopState) { return node; @@ -1975,47 +1984,28 @@ namespace ts { * @param node An ExpressionStatement node. */ function visitExpressionStatement(node: ExpressionStatement): Statement { - // If we are here it is most likely because our expression is a destructuring assignment. - switch (node.expression.kind) { - case SyntaxKind.ParenthesizedExpression: - return factory.updateExpressionStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case SyntaxKind.BinaryExpression: - return factory.updateExpressionStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); - } - return visitEachChild(node, visitor, context); + return visitEachChild(node, visitorWithUnusedExpressionResult, context); } /** * Visits a ParenthesizedExpression that may contain a destructuring assignment. * * @param node A ParenthesizedExpression node. - * @param needsDestructuringValue A value indicating whether we need to hold onto the rhs - * of a destructuring assignment. + * @param expressionResultIsUnused Indicates the result of an expression is unused by the parent node (i.e., the left side of a comma or the + * expression of an `ExpressionStatement`). */ - function visitParenthesizedExpression(node: ParenthesizedExpression, needsDestructuringValue: boolean): ParenthesizedExpression { - // If we are here it is most likely because our expression is a destructuring assignment. - if (!needsDestructuringValue) { - // By default we always emit the RHS at the end of a flattened destructuring - // expression. If we are in a state where we do not need the destructuring value, - // we pass that information along to the children that care about it. - switch (node.expression.kind) { - case SyntaxKind.ParenthesizedExpression: - return factory.updateParenthesizedExpression(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case SyntaxKind.BinaryExpression: - return factory.updateParenthesizedExpression(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); - } - } - return visitEachChild(node, visitor, context); + function visitParenthesizedExpression(node: ParenthesizedExpression, expressionResultIsUnused: boolean): ParenthesizedExpression { + return visitEachChild(node, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, context); } /** * Visits a BinaryExpression that contains a destructuring assignment. * * @param node A BinaryExpression node. - * @param needsDestructuringValue A value indicating whether we need to hold onto the rhs - * of a destructuring assignment. + * @param expressionResultIsUnused Indicates the result of an expression is unused by the parent node (i.e., the left side of a comma or the + * expression of an `ExpressionStatement`). */ - function visitBinaryExpression(node: BinaryExpression, needsDestructuringValue: boolean): Expression { + function visitBinaryExpression(node: BinaryExpression, expressionResultIsUnused: boolean): Expression { // If we are here it is because this is a destructuring assignment. if (isDestructuringAssignment(node)) { return flattenDestructuringAssignment( @@ -2023,11 +2013,40 @@ namespace ts { visitor, context, FlattenLevel.All, - needsDestructuringValue); + !expressionResultIsUnused); + } + if (node.operatorToken.kind === SyntaxKind.CommaToken) { + return factory.updateBinaryExpression( + node, + visitNode(node.left, visitorWithUnusedExpressionResult, isExpression), + node.operatorToken, + visitNode(node.right, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, isExpression) + ); } return visitEachChild(node, visitor, context); } + /** + * @param expressionResultIsUnused Indicates the result of an expression is unused by the parent node (i.e., the left side of a comma or the + * expression of an `ExpressionStatement`). + */ + function visitCommaListExpression(node: CommaListExpression, expressionResultIsUnused: boolean): Expression { + if (expressionResultIsUnused) { + return visitEachChild(node, visitorWithUnusedExpressionResult, context); + } + let result: Expression[] | undefined; + for (let i = 0; i < node.elements.length; i++) { + const element = node.elements[i]; + const visited = visitNode(element, i < node.elements.length - 1 ? visitorWithUnusedExpressionResult : visitor, isExpression); + if (result || visited !== element) { + result ||= node.elements.slice(0, i); + result.push(visited); + } + } + const elements = result ? setTextRange(factory.createNodeArray(result), node.elements) : node.elements; + return factory.updateCommaListExpression(node, elements); + } + function isVariableStatementOfTypeScriptClassWrapper(node: VariableStatement) { return node.declarationList.declarations.length === 1 && !!node.declarationList.declarations[0].initializer @@ -2288,6 +2307,16 @@ namespace ts { outermostLabeledStatement); } + function visitEachChildOfForStatement(node: ForStatement) { + return factory.updateForStatement( + node, + visitNode(node.initializer, visitorWithUnusedExpressionResult, isForInitializer), + visitNode(node.condition, visitor, isExpression), + visitNode(node.incrementor, visitorWithUnusedExpressionResult, isExpression), + visitNode(node.statement, visitor, isStatement, factory.liftToBlock) + ); + } + function visitForInStatement(node: ForInStatement, outermostLabeledStatement: LabeledStatement | undefined) { return visitIterationStatementWithFacts( HierarchyFacts.ForInOrForOfStatementExcludes, @@ -2371,7 +2400,7 @@ namespace ts { // evaluated on every iteration. const assignment = factory.createAssignment(initializer, boundValue); if (isDestructuringAssignment(assignment)) { - statements.push(factory.createExpressionStatement(visitBinaryExpression(assignment, /*needsDestructuringValue*/ false))); + statements.push(factory.createExpressionStatement(visitBinaryExpression(assignment, /*expressionResultIsUnused*/ true))); } else { setTextRangeEnd(assignment, initializer.end); @@ -2714,7 +2743,10 @@ namespace ts { const result = convert ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined, ancestorFacts) - : factory.restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); + : factory.restoreEnclosingLabel( + isForStatement(node) ? visitEachChildOfForStatement(node) : visitEachChild(node, visitor, context), + outermostLabeledStatement, + convertedLoopState && resetLabel); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; @@ -2777,9 +2809,9 @@ namespace ts { const shouldConvertIncrementor = shouldConvertCondition || node.incrementor && shouldConvertPartOfIterationStatement(node.incrementor); return factory.updateForStatement( node, - visitNode(initializerFunction ? initializerFunction.part : node.initializer, visitor, isForInitializer), + visitNode(initializerFunction ? initializerFunction.part : node.initializer, visitorWithUnusedExpressionResult, isForInitializer), visitNode(shouldConvertCondition ? undefined : node.condition, visitor, isExpression), - visitNode(shouldConvertIncrementor ? undefined : node.incrementor, visitor, isExpression), + visitNode(shouldConvertIncrementor ? undefined : node.incrementor, visitorWithUnusedExpressionResult, isExpression), convertedLoopBody ); } diff --git a/src/compiler/transformers/es2018.ts b/src/compiler/transformers/es2018.ts index f6c3ae66354..41fcc6c25d9 100644 --- a/src/compiler/transformers/es2018.ts +++ b/src/compiler/transformers/es2018.ts @@ -119,11 +119,11 @@ namespace ts { } function visitor(node: Node): VisitResult { - return visitorWorker(node, /*noDestructuringValue*/ false); + return visitorWorker(node, /*expressionResultIsUnused*/ false); } - function visitorNoDestructuringValue(node: Node): VisitResult { - return visitorWorker(node, /*noDestructuringValue*/ true); + function visitorWithUnusedExpressionResult(node: Node): VisitResult { + return visitorWorker(node, /*expressionResultIsUnused*/ true); } function visitorNoAsyncModifier(node: Node): VisitResult { @@ -147,7 +147,11 @@ namespace ts { return visitEachChild(node, visitor, context); } - function visitorWorker(node: Node, noDestructuringValue: boolean): VisitResult { + /** + * @param expressionResultIsUnused Indicates the result of an expression is unused by the parent node (i.e., the left side of a comma or the + * expression of an `ExpressionStatement`). + */ + function visitorWorker(node: Node, expressionResultIsUnused: boolean): VisitResult { if ((node.transformFlags & TransformFlags.ContainsES2018) === 0) { return node; } @@ -163,7 +167,9 @@ namespace ts { case SyntaxKind.ObjectLiteralExpression: return visitObjectLiteralExpression(node as ObjectLiteralExpression); case SyntaxKind.BinaryExpression: - return visitBinaryExpression(node as BinaryExpression, noDestructuringValue); + return visitBinaryExpression(node as BinaryExpression, expressionResultIsUnused); + case SyntaxKind.CommaListExpression: + return visitCommaListExpression(node as CommaListExpression, expressionResultIsUnused); case SyntaxKind.CatchClause: return visitCatchClause(node as CatchClause); case SyntaxKind.VariableStatement: @@ -235,7 +241,7 @@ namespace ts { case SyntaxKind.ExpressionStatement: return visitExpressionStatement(node as ExpressionStatement); case SyntaxKind.ParenthesizedExpression: - return visitParenthesizedExpression(node as ParenthesizedExpression, noDestructuringValue); + return visitParenthesizedExpression(node as ParenthesizedExpression, expressionResultIsUnused); case SyntaxKind.TaggedTemplateExpression: return visitTaggedTemplateExpression(node as TaggedTemplateExpression); case SyntaxKind.PropertyAccessExpression: @@ -411,11 +417,15 @@ namespace ts { } function visitExpressionStatement(node: ExpressionStatement): ExpressionStatement { - return visitEachChild(node, visitorNoDestructuringValue, context); + return visitEachChild(node, visitorWithUnusedExpressionResult, context); } - function visitParenthesizedExpression(node: ParenthesizedExpression, noDestructuringValue: boolean): ParenthesizedExpression { - return visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context); + /** + * @param expressionResultIsUnused Indicates the result of an expression is unused by the parent node (i.e., the left side of a comma or the + * expression of an `ExpressionStatement`). + */ + function visitParenthesizedExpression(node: ParenthesizedExpression, expressionResultIsUnused: boolean): ParenthesizedExpression { + return visitEachChild(node, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, context); } function visitSourceFile(node: SourceFile): SourceFile { @@ -450,28 +460,51 @@ namespace ts { * Visits a BinaryExpression that contains a destructuring assignment. * * @param node A BinaryExpression node. + * @param expressionResultIsUnused Indicates the result of an expression is unused by the parent node (i.e., the left side of a comma or the + * expression of an `ExpressionStatement`). */ - function visitBinaryExpression(node: BinaryExpression, noDestructuringValue: boolean): Expression { + function visitBinaryExpression(node: BinaryExpression, expressionResultIsUnused: boolean): Expression { if (isDestructuringAssignment(node) && node.left.transformFlags & TransformFlags.ContainsObjectRestOrSpread) { return flattenDestructuringAssignment( node, visitor, context, FlattenLevel.ObjectRest, - !noDestructuringValue + !expressionResultIsUnused ); } - else if (node.operatorToken.kind === SyntaxKind.CommaToken) { + if (node.operatorToken.kind === SyntaxKind.CommaToken) { return factory.updateBinaryExpression( node, - visitNode(node.left, visitorNoDestructuringValue, isExpression), + visitNode(node.left, visitorWithUnusedExpressionResult, isExpression), node.operatorToken, - visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, isExpression) + visitNode(node.right, expressionResultIsUnused ? visitorWithUnusedExpressionResult : visitor, isExpression) ); } return visitEachChild(node, visitor, context); } + /** + * @param expressionResultIsUnused Indicates the result of an expression is unused by the parent node (i.e., the left side of a comma or the + * expression of an `ExpressionStatement`). + */ + function visitCommaListExpression(node: CommaListExpression, expressionResultIsUnused: boolean): Expression { + if (expressionResultIsUnused) { + return visitEachChild(node, visitorWithUnusedExpressionResult, context); + } + let result: Expression[] | undefined; + for (let i = 0; i < node.elements.length; i++) { + const element = node.elements[i]; + const visited = visitNode(element, i < node.elements.length - 1 ? visitorWithUnusedExpressionResult : visitor, isExpression); + if (result || visited !== element) { + result ||= node.elements.slice(0, i); + result.push(visited); + } + } + const elements = result ? setTextRange(factory.createNodeArray(result), node.elements) : node.elements; + return factory.updateCommaListExpression(node, elements); + } + function visitCatchClause(node: CatchClause) { if (node.variableDeclaration && isBindingPattern(node.variableDeclaration.name) && @@ -539,15 +572,15 @@ namespace ts { function visitForStatement(node: ForStatement): VisitResult { return factory.updateForStatement( node, - visitNode(node.initializer, visitorNoDestructuringValue, isForInitializer), + visitNode(node.initializer, visitorWithUnusedExpressionResult, isForInitializer), visitNode(node.condition, visitor, isExpression), - visitNode(node.incrementor, visitor, isExpression), + visitNode(node.incrementor, visitorWithUnusedExpressionResult, isExpression), visitNode(node.statement, visitor, isStatement) ); } function visitVoidExpression(node: VoidExpression) { - return visitEachChild(node, visitorNoDestructuringValue, context); + return visitEachChild(node, visitorWithUnusedExpressionResult, context); } /** diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index e988100903b..6ae08275e3a 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -397,6 +397,8 @@ namespace ts { switch (node.kind) { case SyntaxKind.BinaryExpression: return visitBinaryExpression(node); + case SyntaxKind.CommaListExpression: + return visitCommaListExpression(node); case SyntaxKind.ConditionalExpression: return visitConditionalExpression(node); case SyntaxKind.YieldExpression: @@ -772,6 +774,65 @@ namespace ts { return visitEachChild(node, visitor, context); } + /** + * Visits a comma expression containing `yield`. + * + * @param node The node to visit. + */ + function visitCommaExpression(node: BinaryExpression) { + // [source] + // x = a(), yield, b(); + // + // [intermediate] + // a(); + // .yield resumeLabel + // .mark resumeLabel + // x = %sent%, b(); + + let pendingExpressions: Expression[] = []; + visit(node.left); + visit(node.right); + return factory.inlineExpressions(pendingExpressions); + + function visit(node: Expression) { + if (isBinaryExpression(node) && node.operatorToken.kind === SyntaxKind.CommaToken) { + visit(node.left); + visit(node.right); + } + else { + if (containsYield(node) && pendingExpressions.length > 0) { + emitWorker(OpCode.Statement, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + + pendingExpressions.push(visitNode(node, visitor, isExpression)); + } + } + } + + /** + * Visits a comma-list expression. + * + * @param node The node to visit. + */ + function visitCommaListExpression(node: CommaListExpression) { + // flattened version of `visitCommaExpression` + let pendingExpressions: Expression[] = []; + for (const elem of node.elements) { + if (isBinaryExpression(elem) && elem.operatorToken.kind === SyntaxKind.CommaToken) { + pendingExpressions.push(visitCommaExpression(elem)); + } + else { + if (containsYield(elem) && pendingExpressions.length > 0) { + emitWorker(OpCode.Statement, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(visitNode(elem, visitor, isExpression)); + } + } + return factory.inlineExpressions(pendingExpressions); + } + /** * Visits a logical binary expression containing `yield`. * @@ -825,42 +886,6 @@ namespace ts { return resultLocal; } - /** - * Visits a comma expression containing `yield`. - * - * @param node The node to visit. - */ - function visitCommaExpression(node: BinaryExpression) { - // [source] - // x = a(), yield, b(); - // - // [intermediate] - // a(); - // .yield resumeLabel - // .mark resumeLabel - // x = %sent%, b(); - - let pendingExpressions: Expression[] = []; - visit(node.left); - visit(node.right); - return factory.inlineExpressions(pendingExpressions); - - function visit(node: Expression) { - if (isBinaryExpression(node) && node.operatorToken.kind === SyntaxKind.CommaToken) { - visit(node.left); - visit(node.right); - } - else { - if (containsYield(node) && pendingExpressions.length > 0) { - emitWorker(OpCode.Statement, [factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))]); - pendingExpressions = []; - } - - pendingExpressions.push(visitNode(node, visitor, isExpression)); - } - } - } - /** * Visits a conditional expression containing `yield`. * diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index 0766cfbbfcf..9814f29b2a2 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -4,7 +4,7 @@ namespace ts { interface PerFileState { importSpecifier?: string; filenameDeclaration?: VariableDeclaration & { name: Identifier; }; - utilizedImplicitRuntimeImports?: Map; + utilizedImplicitRuntimeImports?: Map>; } const { @@ -26,12 +26,12 @@ namespace ts { return currentFileState.filenameDeclaration.name; } - function getJsxFactoryCalleePrimitive(children: readonly JsxChild[] | undefined): "jsx" | "jsxs" | "jsxDEV" { - return compilerOptions.jsx === JsxEmit.ReactJSXDev ? "jsxDEV" : children && children.length > 1 ? "jsxs" : "jsx"; + function getJsxFactoryCalleePrimitive(childrenLength: number): "jsx" | "jsxs" | "jsxDEV" { + return compilerOptions.jsx === JsxEmit.ReactJSXDev ? "jsxDEV" : childrenLength > 1 ? "jsxs" : "jsx"; } - function getJsxFactoryCallee(children: readonly JsxChild[] | undefined) { - const type = getJsxFactoryCalleePrimitive(children); + function getJsxFactoryCallee(childrenLength: number) { + const type = getJsxFactoryCalleePrimitive(childrenLength); return getImplicitImportForName(type); } @@ -40,17 +40,25 @@ namespace ts { } function getImplicitImportForName(name: string) { - const existing = currentFileState.utilizedImplicitRuntimeImports?.get(name); + const importSource = name === "createElement" + ? currentFileState.importSpecifier! + : getJSXRuntimeImport(currentFileState.importSpecifier, compilerOptions)!; + const existing = currentFileState.utilizedImplicitRuntimeImports?.get(importSource)?.get(name); if (existing) { return existing.name; } if (!currentFileState.utilizedImplicitRuntimeImports) { currentFileState.utilizedImplicitRuntimeImports = createMap(); } + let specifierSourceImports = currentFileState.utilizedImplicitRuntimeImports.get(importSource); + if (!specifierSourceImports) { + specifierSourceImports = createMap(); + currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports); + } const generatedName = factory.createUniqueName(`_${name}`, GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel | GeneratedIdentifierFlags.AllowNameSubstitution); const specifier = factory.createImportSpecifier(factory.createIdentifier(name), generatedName); generatedName.generatedImportReference = specifier; - currentFileState.utilizedImplicitRuntimeImports.set(name, specifier); + specifierSourceImports.set(name, specifier); return generatedName; } @@ -73,29 +81,30 @@ namespace ts { if (currentFileState.filenameDeclaration) { statements = insertStatementAfterCustomPrologue(statements.slice(), factory.createVariableStatement(/*modifiers*/ undefined, factory.createVariableDeclarationList([currentFileState.filenameDeclaration], NodeFlags.Const))); } - if (currentFileState.utilizedImplicitRuntimeImports && currentFileState.utilizedImplicitRuntimeImports.size && currentFileState.importSpecifier !== undefined) { - const specifier = `${currentFileState.importSpecifier}/${compilerOptions.jsx === JsxEmit.ReactJSXDev ? "jsx-dev-runtime" : "jsx-runtime"}`; - if (isExternalModule(node)) { - // Add `import` statement - const importStatement = factory.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, factory.createImportClause(/*typeOnly*/ false, /*name*/ undefined, factory.createNamedImports(arrayFrom(currentFileState.utilizedImplicitRuntimeImports.values()))), factory.createStringLiteral(specifier)); - setParentRecursive(importStatement, /*incremental*/ false); - statements = insertStatementAfterCustomPrologue(statements.slice(), importStatement); - } - else if (isExternalOrCommonJsModule(node)) { - // Add `require` statement - const requireStatement = factory.createVariableStatement(/*modifiers*/ undefined, factory.createVariableDeclarationList([ - factory.createVariableDeclaration( - factory.createObjectBindingPattern(map(arrayFrom(currentFileState.utilizedImplicitRuntimeImports.values()), s => factory.createBindingElement(/*dotdotdot*/ undefined, s.propertyName, s.name))), - /*exclaimationToken*/ undefined, - /*type*/ undefined, - factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, [factory.createStringLiteral(specifier)]) - ) - ], NodeFlags.Const)); - setParentRecursive(requireStatement, /*incremental*/ false); - statements = insertStatementAfterCustomPrologue(statements.slice(), requireStatement); - } - else { - // Do nothing (script file) - consider an error in the checker? + if (currentFileState.utilizedImplicitRuntimeImports) { + for (const [importSource, importSpecifiersMap] of arrayFrom(currentFileState.utilizedImplicitRuntimeImports.entries())) { + if (isExternalModule(node)) { + // Add `import` statement + const importStatement = factory.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, factory.createImportClause(/*typeOnly*/ false, /*name*/ undefined, factory.createNamedImports(arrayFrom(importSpecifiersMap.values()))), factory.createStringLiteral(importSource)); + setParentRecursive(importStatement, /*incremental*/ false); + statements = insertStatementAfterCustomPrologue(statements.slice(), importStatement); + } + else if (isExternalOrCommonJsModule(node)) { + // Add `require` statement + const requireStatement = factory.createVariableStatement(/*modifiers*/ undefined, factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + factory.createObjectBindingPattern(map(arrayFrom(importSpecifiersMap.values()), s => factory.createBindingElement(/*dotdotdot*/ undefined, s.propertyName, s.name))), + /*exclaimationToken*/ undefined, + /*type*/ undefined, + factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, [factory.createStringLiteral(importSource)]) + ) + ], NodeFlags.Const)); + setParentRecursive(requireStatement, /*incremental*/ false); + statements = insertStatementAfterCustomPrologue(statements.slice(), requireStatement); + } + else { + // Do nothing (script file) - consider an error in the checker? + } } } if (statements !== visited.statements) { @@ -191,8 +200,9 @@ namespace ts { } function convertJsxChildrenToChildrenPropObject(children: readonly JsxChild[]) { - if (children.length === 1) { - const result = transformJsxChildToExpression(children[0]); + const nonWhitespaceChildren = getSemanticJsxChildren(children); + if (length(nonWhitespaceChildren) === 1) { + const result = transformJsxChildToExpression(nonWhitespaceChildren[0]); return result && factory.createObjectLiteralExpression([ factory.createPropertyAssignment("children", result) ]); @@ -208,48 +218,51 @@ namespace ts { let objectProperties: Expression; const keyAttr = find(node.attributes.properties, p => !!p.name && isIdentifier(p.name) && p.name.escapedText === "key") as JsxAttribute | undefined; const attrs = keyAttr ? filter(node.attributes.properties, p => p !== keyAttr) : node.attributes.properties; - if (attrs.length === 0) { - objectProperties = factory.createObjectLiteralExpression([]); - // When there are no attributes, React wants {} - } - else { + + let segments: Expression[] = []; + if (attrs.length) { // Map spans of JsxAttribute nodes into object literals and spans // of JsxSpreadAttribute nodes into expressions. - const segments = flatten( + segments = flatten( spanMap(attrs, isJsxSpreadAttribute, (attrs, isSpread) => isSpread ? map(attrs, transformJsxSpreadAttributeToExpression) : factory.createObjectLiteralExpression(map(attrs, transformJsxAttributeToObjectLiteralElement)) ) ); - if (children && children.length) { - const result = convertJsxChildrenToChildrenPropObject(children); - if (result) { - segments.push(result); - } - } - if (isJsxSpreadAttribute(attrs[0])) { // We must always emit at least one object literal before a spread // argument.factory.createObjectLiteral segments.unshift(factory.createObjectLiteralExpression()); } + } + if (children && children.length) { + const result = convertJsxChildrenToChildrenPropObject(children); + if (result) { + segments.push(result); + } + } + if (segments.length === 0) { + objectProperties = factory.createObjectLiteralExpression([]); + // When there are no attributes, React wants {} + } + else { // Either emit one big object literal (no spread attribs), or // a call to the __assign helper. objectProperties = singleOrUndefined(segments) || emitHelpers().createAssignHelper(segments); } - return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children, isChild, location); + return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, length(getSemanticJsxChildren(children || emptyArray)), isChild, location); } - function visitJsxOpeningLikeElementOrFragmentJSX(tagName: Expression, objectProperties: Expression, keyAttr: JsxAttribute | undefined, children: readonly JsxChild[] | undefined, isChild: boolean, location: TextRange) { + function visitJsxOpeningLikeElementOrFragmentJSX(tagName: Expression, objectProperties: Expression, keyAttr: JsxAttribute | undefined, childrenLength: number, isChild: boolean, location: TextRange) { const args: Expression[] = [tagName, objectProperties, !keyAttr ? factory.createVoidZero() : transformJsxAttributeInitializer(keyAttr.initializer)]; if (compilerOptions.jsx === JsxEmit.ReactJSXDev) { const originalFile = getOriginalNode(currentSourceFile); if (originalFile && isSourceFile(originalFile)) { // isStaticChildren development flag - args.push(children && children.length > 1 ? factory.createTrue() : factory.createFalse()); + args.push(childrenLength > 1 ? factory.createTrue() : factory.createFalse()); // __source development flag const lineCol = getLineAndCharacterOfPosition(originalFile, location.pos); args.push(factory.createObjectLiteralExpression([ @@ -261,7 +274,7 @@ namespace ts { args.push(factory.createThis()); } } - const element = setTextRange(factory.createCallExpression(getJsxFactoryCallee(children), /*typeArguments*/ undefined, args), location); + const element = setTextRange(factory.createCallExpression(getJsxFactoryCallee(childrenLength), /*typeArguments*/ undefined, args), location); if (isChild) { startOnNewLine(element); @@ -302,14 +315,21 @@ namespace ts { } } + const callee = currentFileState.importSpecifier === undefined + ? createJsxFactoryExpression( + factory, + context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), + compilerOptions.reactNamespace!, // TODO: GH#18217 + node + ) + : getImplicitImportForName("createElement"); + const element = createExpressionForJsxElement( factory, - context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), - compilerOptions.reactNamespace!, // TODO: GH#18217 + callee, tagName, objectProperties, mapDefined(children, transformJsxChildToExpression), - node, location ); @@ -332,7 +352,7 @@ namespace ts { getImplicitJsxFragmentReference(), childrenProps || factory.createObjectLiteralExpression([]), /*keyAttr*/ undefined, - children, + length(getSemanticJsxChildren(children)), isChild, location ); diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json index 1edb2bbd63d..ed64c2c26d5 100644 --- a/src/compiler/tsconfig.json +++ b/src/compiler/tsconfig.json @@ -13,10 +13,10 @@ "corePublic.ts", "core.ts", "debug.ts", - "performanceTimestamp.ts", + "semver.ts", + "performanceCore.ts", "performance.ts", "perfLogger.ts", - "semver.ts", "tracing.ts", "types.ts", diff --git a/src/compiler/types.ts b/src/compiler/types.ts index eec63bd9054..a234916d5c1 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -167,6 +167,7 @@ namespace ts { DeclareKeyword, GetKeyword, InferKeyword, + IntrinsicKeyword, IsKeyword, KeyOfKeyword, ModuleKeyword, @@ -186,10 +187,6 @@ namespace ts { FromKeyword, GlobalKeyword, BigIntKeyword, - UppercaseKeyword, - LowercaseKeyword, - CapitalizeKeyword, - UncapitalizeKeyword, OfKeyword, // LastKeyword and LastToken and LastContextualKeyword // Parse tree nodes @@ -544,7 +541,6 @@ namespace ts { | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword - | SyntaxKind.CapitalizeKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword @@ -574,10 +570,10 @@ namespace ts { | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword + | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword - | SyntaxKind.LowercaseKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword @@ -605,11 +601,9 @@ namespace ts { | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword - | SyntaxKind.UncapitalizeKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword - | SyntaxKind.UppercaseKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword @@ -635,6 +629,7 @@ namespace ts { | SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword + | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword @@ -1665,19 +1660,10 @@ namespace ts { export interface TemplateLiteralTypeSpan extends TypeNode { readonly kind: SyntaxKind.TemplateLiteralTypeSpan, readonly parent: TemplateLiteralTypeNode; - readonly casing: TemplateCasing; readonly type: TypeNode; readonly literal: TemplateMiddle | TemplateTail; } - export const enum TemplateCasing { - None, - Uppercase, - Lowercase, - Capitalize, - Uncapitalize, - } - // Note: 'brands' in our syntax nodes serve to give us a small amount of nominal typing. // Consider 'Expression'. Without the brand, 'Expression' is actually no different // (structurally) than 'Node'. Because of this you can pass any Node to a function that @@ -3776,6 +3762,8 @@ namespace ts { /* @internal */ getDiagnosticsProducingTypeChecker(): TypeChecker; /* @internal */ dropDiagnosticsProducingTypeChecker(): void; + /* @internal */ getCachedSemanticDiagnostics(sourceFile?: SourceFile): readonly Diagnostic[] | undefined; + /* @internal */ getClassifiableNames(): Set<__String>; getTypeCatalog(): readonly Type[]; @@ -3793,7 +3781,8 @@ namespace ts { isSourceFileDefaultLibrary(file: SourceFile): boolean; // For testing purposes only. - /* @internal */ structureIsReused?: StructureIsReused; + // This is set on created program to let us know how the program was created using old program + /* @internal */ readonly structureIsReused: StructureIsReused; /* @internal */ getSourceFileFromReference(referencingFile: SourceFile | UnparsedSource, ref: FileReference): SourceFile | undefined; /* @internal */ getLibFileFromReference(ref: FileReference): SourceFile | undefined; @@ -3811,7 +3800,7 @@ namespace ts { getResolvedProjectReferences(): readonly (ResolvedProjectReference | undefined)[] | undefined; /*@internal*/ getProjectReferenceRedirect(fileName: string): string | undefined; /*@internal*/ getResolvedProjectReferenceToRedirect(fileName: string): ResolvedProjectReference | undefined; - /*@internal*/ forEachResolvedProjectReference(cb: (resolvedProjectReference: ResolvedProjectReference | undefined, resolvedProjectReferencePath: Path) => T | undefined): T | undefined; + /*@internal*/ forEachResolvedProjectReference(cb: (resolvedProjectReference: ResolvedProjectReference) => T | undefined): T | undefined; /*@internal*/ getResolvedProjectReferenceByPath(projectReferencePath: Path): ResolvedProjectReference | undefined; /*@internal*/ isSourceOfProjectReferenceRedirect(fileName: string): boolean; /*@internal*/ getProgramBuildInfo?(): ProgramBuildInfo | undefined; @@ -4018,6 +4007,7 @@ namespace ts { getAugmentedPropertiesOfType(type: Type): Symbol[]; getRootSymbols(symbol: Symbol): readonly Symbol[]; + getSymbolOfExpando(node: Node, allowDeclaration: boolean): Symbol | undefined; getContextualType(node: Expression): Type | undefined; /* @internal */ getContextualType(node: Expression, contextFlags?: ContextFlags): Type | undefined; // eslint-disable-line @typescript-eslint/unified-signatures /* @internal */ getContextualTypeForObjectLiteralElement(element: ObjectLiteralElementLike): Type | undefined; @@ -4184,7 +4174,7 @@ namespace ts { export const enum UnionReduction { None = 0, Literal, - Subtype + Subtype, } /* @internal */ @@ -4521,7 +4511,7 @@ namespace ts { isDeclarationVisible(node: Declaration | AnyImportSyntax): boolean; isLateBound(node: Declaration): node is LateBoundDeclaration; collectLinkedAliases(node: Identifier, setVisibility?: boolean): Node[] | undefined; - isImplementationOfOverload(node: FunctionLike): boolean | undefined; + isImplementationOfOverload(node: SignatureDeclaration): boolean | undefined; isRequiredInitializedParameter(node: ParameterDeclaration): boolean; isOptionalUninitializedParameterProperty(node: ParameterDeclaration): boolean; isExpandoFunctionDeclaration(node: FunctionDeclaration): boolean; @@ -4853,11 +4843,11 @@ namespace ts { resolvedJSDocType?: Type; // Resolved type of a JSDoc type reference switchTypes?: Type[]; // Cached array of switch case expression types jsxNamespace?: Symbol | false; // Resolved jsx namespace symbol for this node + jsxImplicitImportContainer?: Symbol | false; // Resolved module symbol the implicit jsx import of this file should refer to contextFreeType?: Type; // Cached context-free type used by the first pass of inference; used when a function's return is partially contextually sensitive deferredNodes?: ESMap; // Set of nodes whose checking has been deferred capturedBlockScopeBindings?: Symbol[]; // Block-scoped bindings captured beneath this part of an IterationStatement outerTypeParameters?: TypeParameter[]; // Outer type parameters of anonymous object type - instantiations?: ESMap; // Instantiations of generic type alias (undefined if non-generic) isExhaustive?: boolean; // Is node an exhaustive switch statement skipDirectInference?: true; // Flag set by the API `getContextualType` call on a node when `Completions` is passed to force the checker to skip making inferences to a node's type declarationRequiresScopeChange?: boolean; // Set by `useOuterVariableScopeInParameter` in checker when downlevel emit would change the name resolution scope inside of a parameter. @@ -4892,6 +4882,7 @@ namespace ts { Substitution = 1 << 25, // Type parameter substitution NonPrimitive = 1 << 26, // intrinsic object type TemplateLiteral = 1 << 27, // Template literal type + StringMapping = 1 << 28, // Uppercase/Lowercase type /* @internal */ AnyOrUnknown = Any | Unknown, @@ -4909,7 +4900,7 @@ namespace ts { Intrinsic = Any | Unknown | String | Number | BigInt | Boolean | BooleanLiteral | ESSymbol | Void | Undefined | Null | Never | NonPrimitive, /* @internal */ Primitive = String | Number | BigInt | Boolean | Enum | EnumLiteral | ESSymbol | Void | Undefined | Null | Literal | UniqueESSymbol, - StringLike = String | StringLiteral | TemplateLiteral, + StringLike = String | StringLiteral | TemplateLiteral | StringMapping, NumberLike = Number | NumberLiteral | Enum, BigIntLike = BigInt | BigIntLiteral, BooleanLike = Boolean | BooleanLiteral, @@ -4922,7 +4913,7 @@ namespace ts { StructuredType = Object | Union | Intersection, TypeVariable = TypeParameter | IndexedAccess, InstantiableNonPrimitive = TypeVariable | Conditional | Substitution, - InstantiablePrimitive = Index | TemplateLiteral, + InstantiablePrimitive = Index | TemplateLiteral | StringMapping, Instantiable = InstantiableNonPrimitive | InstantiablePrimitive, StructuredOrInstantiable = StructuredType | Instantiable, /* @internal */ @@ -4930,7 +4921,7 @@ namespace ts { /* @internal */ Simplifiable = IndexedAccess | Conditional, /* @internal */ - Substructure = Object | Union | Intersection | Index | IndexedAccess | Conditional | Substitution | TemplateLiteral, + Substructure = Object | Union | Intersection | Index | IndexedAccess | Conditional | Substitution | TemplateLiteral | StringMapping, // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never Narrowable = Any | Unknown | StructuredOrInstantiable | StringLike | NumberLike | BigIntLike | BooleanLike | ESSymbol | UniqueESSymbol | NonPrimitive, @@ -4938,7 +4929,7 @@ namespace ts { NotPrimitiveUnion = Any | Unknown | Enum | Void | Never | StructuredOrInstantiable, // The following flags are aggregated during union and intersection type construction /* @internal */ - IncludesMask = Any | Unknown | Primitive | Never | Object | Union | Intersection | NonPrimitive, + IncludesMask = Any | Unknown | Primitive | Never | Object | Union | Intersection | NonPrimitive | TemplateLiteral, // The following flags are used for different purposes during union and intersection type construction /* @internal */ IncludesStructuredOrInstantiable = TypeParameter, @@ -5150,6 +5141,8 @@ namespace ts { node: TypeReferenceNode | ArrayTypeNode | TupleTypeNode; /* @internal */ mapper?: TypeMapper; + /* @internal */ + instantiations?: ESMap; // Instantiations of generic type alias (undefined if non-generic) } /* @internal */ @@ -5230,6 +5223,7 @@ namespace ts { export interface AnonymousType extends ObjectType { target?: AnonymousType; // Instantiation target mapper?: TypeMapper; // Instantiation mapper + instantiations?: ESMap; // Instantiations of generic type alias (undefined if non-generic) } /* @internal */ @@ -5335,6 +5329,12 @@ namespace ts { export interface IndexedAccessType extends InstantiableType { objectType: Type; indexType: Type; + /** + * @internal + * Indicates that --noUncheckedIndexedAccess may introduce 'undefined' into + * the resulting type, depending on how type variable constraints are resolved. + */ + noUncheckedIndexedAccessCandidate: boolean; constraint?: Type; simplifiedForReading?: Type; simplifiedForWriting?: Type; @@ -5379,11 +5379,15 @@ namespace ts { } export interface TemplateLiteralType extends InstantiableType { - texts: readonly string[]; // Always one element longer than casings/types - casings: readonly TemplateCasing[]; // Always at least one element + texts: readonly string[]; // Always one element longer than types types: readonly Type[]; // Always at least one element } + export interface StringMappingType extends InstantiableType { + symbol: Symbol; + type: Type; + } + // Type parameter substitution (TypeFlags.Substitution) // Substitution types are created for type parameters or indexed access types that occur in the // true branch of a conditional type. For example, in 'T extends string ? Foo : Bar', the @@ -5528,17 +5532,17 @@ namespace ts { /** * Ternary values are defined such that - * x & y is False if either x or y is False. - * x & y is Maybe if either x or y is Maybe, but neither x or y is False. - * x & y is True if both x and y are True. - * x | y is False if both x and y are False. - * x | y is Maybe if either x or y is Maybe, but neither x or y is True. - * x | y is True if either x or y is True. + * x & y picks the lesser in the order False < Unknown < Maybe < True, and + * x | y picks the greater in the order False < Unknown < Maybe < True. + * Generally, Ternary.Maybe is used as the result of a relation that depends on itself, and + * Ternary.Unknown is used as the result of a variance check that depends on itself. We make + * a distinction because we don't want to cache circular variance check results. */ /* @internal */ export const enum Ternary { False = 0, - Maybe = 1, + Unknown = 1, + Maybe = 3, True = -1 } @@ -5852,7 +5856,8 @@ namespace ts { enable?: boolean; include?: string[]; exclude?: string[]; - [option: string]: string[] | boolean | undefined; + disableFilenameBasedTypeAcquisition?: boolean; + [option: string]: CompilerOptionsValue | undefined; } export enum ModuleKind { @@ -6329,7 +6334,7 @@ namespace ts { /*@internal*/ export interface ResolvedProjectReferenceCallbacks { getSourceOfProjectReferenceRedirect(fileName: string): SourceOfProjectReferenceRedirect | undefined; - forEachResolvedProjectReference(cb: (resolvedProjectReference: ResolvedProjectReference | undefined, resolvedProjectReferencePath: Path) => T | undefined): T | undefined; + forEachResolvedProjectReference(cb: (resolvedProjectReference: ResolvedProjectReference) => T | undefined): T | undefined; } /* @internal */ @@ -6774,8 +6779,8 @@ namespace ts { createIndexSignature(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; /* @internal */ createIndexSignature(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): IndexSignatureDeclaration; // eslint-disable-line @typescript-eslint/unified-signatures updateIndexSignature(node: IndexSignatureDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; - createTemplateLiteralTypeSpan(casing: TemplateCasing, type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; - updateTemplateLiteralTypeSpan(casing: TemplateCasing, node: TemplateLiteralTypeSpan, type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; + createTemplateLiteralTypeSpan(type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; + updateTemplateLiteralTypeSpan(node: TemplateLiteralTypeSpan, type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; // // Types diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 973528096a1..2dc1fb0475d 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -100,28 +100,6 @@ namespace ts { !isJsonEqual(getCompilerOptionValue(oldOptions, o), getCompilerOptionValue(newOptions, o))); } - /** - * Iterates through the parent chain of a node and performs the callback on each parent until the callback - * returns a truthy value, then returns that value. - * If no such value is found, it applies the callback until the parent pointer is undefined or the callback returns "quit" - * At that point findAncestor returns undefined. - */ - export function findAncestor(node: Node | undefined, callback: (element: Node) => element is T): T | undefined; - export function findAncestor(node: Node | undefined, callback: (element: Node) => boolean | "quit"): Node | undefined; - export function findAncestor(node: Node, callback: (element: Node) => boolean | "quit"): Node | undefined { - while (node) { - const result = callback(node); - if (result === "quit") { - return undefined; - } - else if (result) { - return node; - } - node = node.parent; - } - return undefined; - } - export function forEachAncestor(node: Node, callback: (n: Node) => T | undefined | "quit"): T | undefined { while (true) { const res = callback(node); @@ -562,6 +540,77 @@ namespace ts { return emitNode && emitNode.flags || 0; } + interface ScriptTargetFeatures { + [key: string]: { [key: string]: string[] | undefined }; + }; + + export function getScriptTargetFeatures(): ScriptTargetFeatures { + return { + es2015: { + Array: ["find", "findIndex", "fill", "copyWithin", "entries", "keys", "values"], + RegExp: ["flags", "sticky", "unicode"], + Reflect: ["apply", "construct", "defineProperty", "deleteProperty", "get"," getOwnPropertyDescriptor", "getPrototypeOf", "has", "isExtensible", "ownKeys", "preventExtensions", "set", "setPrototypeOf"], + ArrayConstructor: ["from", "of"], + ObjectConstructor: ["assign", "getOwnPropertySymbols", "keys", "is", "setPrototypeOf"], + NumberConstructor: ["isFinite", "isInteger", "isNaN", "isSafeInteger", "parseFloat", "parseInt"], + Math: ["clz32", "imul", "sign", "log10", "log2", "log1p", "expm1", "cosh", "sinh", "tanh", "acosh", "asinh", "atanh", "hypot", "trunc", "fround", "cbrt"], + Map: ["entries", "keys", "values"], + Set: ["entries", "keys", "values"], + Promise: emptyArray, + PromiseConstructor: ["all", "race", "reject", "resolve"], + Symbol: ["for", "keyFor"], + WeakMap: ["entries", "keys", "values"], + WeakSet: ["entries", "keys", "values"], + Iterator: emptyArray, + AsyncIterator: emptyArray, + String: ["codePointAt", "includes", "endsWith", "normalize", "repeat", "startsWith", "anchor", "big", "blink", "bold", "fixed", "fontcolor", "fontsize", "italics", "link", "small", "strike", "sub", "sup"], + StringConstructor: ["fromCodePoint", "raw"] + }, + es2016: { + Array: ["includes"] + }, + es2017: { + Atomics: emptyArray, + SharedArrayBuffer: emptyArray, + String: ["padStart", "padEnd"], + ObjectConstructor: ["values", "entries", "getOwnPropertyDescriptors"], + DateTimeFormat: ["formatToParts"] + }, + es2018: { + Promise: ["finally"], + RegExpMatchArray: ["groups"], + RegExpExecArray: ["groups"], + RegExp: ["dotAll"], + Intl: ["PluralRules"], + AsyncIterable: emptyArray, + AsyncIterableIterator: emptyArray, + AsyncGenerator: emptyArray, + AsyncGeneratorFunction: emptyArray, + }, + es2019: { + Array: ["flat", "flatMap"], + ObjectConstructor: ["fromEntries"], + String: ["trimStart", "trimEnd", "trimLeft", "trimRight"], + Symbol: ["description"] + }, + es2020: { + BigInt: emptyArray, + BigInt64Array: emptyArray, + BigUint64Array: emptyArray, + PromiseConstructor: ["allSettled"], + SymbolConstructor: ["matchAll"], + String: ["matchAll"], + DataView: ["setBigInt64", "setBigUint64", "getBigInt64", "getBigUint64"], + RelativeTimeFormat: ["format", "formatToParts", "resolvedOptions"] + }, + esnext: { + PromiseConstructor: ["any"], + String: ["replaceAll"], + NumberFormat: ["formatToParts"] + } + }; + } + export const enum GetLiteralTextFlags { None = 0, NeverAsciiEscape = 1 << 0, @@ -1959,48 +2008,6 @@ namespace ts { return getSourceTextOfNodeFromSourceFile(sourceFile, str).charCodeAt(0) === CharacterCodes.doubleQuote; } - export function getDeclarationOfExpando(node: Node): Node | undefined { - if (!node.parent) { - return undefined; - } - let name: Expression | BindingName | undefined; - let decl: Node | undefined; - if (isVariableDeclaration(node.parent) && node.parent.initializer === node) { - if (!isInJSFile(node) && !isVarConst(node.parent)) { - return undefined; - } - name = node.parent.name; - decl = node.parent; - } - else if (isBinaryExpression(node.parent)) { - const parentNode = node.parent; - const parentNodeOperator = node.parent.operatorToken.kind; - if (parentNodeOperator === SyntaxKind.EqualsToken && parentNode.right === node) { - name = parentNode.left; - decl = name; - } - else if (parentNodeOperator === SyntaxKind.BarBarToken || parentNodeOperator === SyntaxKind.QuestionQuestionToken) { - if (isVariableDeclaration(parentNode.parent) && parentNode.parent.initializer === parentNode) { - name = parentNode.parent.name; - decl = parentNode.parent; - } - else if (isBinaryExpression(parentNode.parent) && parentNode.parent.operatorToken.kind === SyntaxKind.EqualsToken && parentNode.parent.right === parentNode) { - name = parentNode.parent.left; - decl = name; - } - - if (!name || !isBindableStaticNameExpression(name) || !isSameEntityName(name, parentNode.left)) { - return undefined; - } - } - } - - if (!name || !getExpandoInitializer(node, isPrototypeAccess(name))) { - return undefined; - } - return decl; - } - export function isAssignmentDeclaration(decl: Declaration) { return isBinaryExpression(decl) || isAccessExpression(decl) || isIdentifier(decl) || isCallExpression(decl); } @@ -2120,7 +2127,7 @@ namespace ts { * var min = window.min || {} * my.app = self.my.app || class { } */ - function isSameEntityName(name: Expression, initializer: Expression): boolean { + export function isSameEntityName(name: Expression, initializer: Expression): boolean { if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer)) { return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer); } @@ -2730,6 +2737,20 @@ namespace ts { return walkUp(node, SyntaxKind.ParenthesizedExpression); } + /** + * Walks up parenthesized types. + * It returns both the outermost parenthesized type and its parent. + * If given node is not a parenthesiezd type, undefined is return as the former. + */ + export function walkUpParenthesizedTypesAndGetParentAndChild(node: Node): [ParenthesizedTypeNode | undefined, Node] { + let child: ParenthesizedTypeNode | undefined; + while (node && node.kind === SyntaxKind.ParenthesizedType) { + child = node; + node = node.parent; + } + return [child, node]; + } + export function skipParentheses(node: Expression): Expression; export function skipParentheses(node: Node): Node; export function skipParentheses(node: Node): Node { @@ -3600,6 +3621,19 @@ namespace ts { return -1; } + export function getSemanticJsxChildren(children: readonly JsxChild[]) { + return filter(children, i => { + switch (i.kind) { + case SyntaxKind.JsxExpression: + return !!i.expression; + case SyntaxKind.JsxText: + return !i.containsOnlyTriviaWhiteSpaces; + default: + return true; + } + }); + } + export function createDiagnosticCollection(): DiagnosticCollection { let nonFileDiagnostics = [] as Diagnostic[] as SortedArray; // See GH#19873 const filesWithDiagnostics = [] as string[] as SortedArray; @@ -3815,8 +3849,10 @@ namespace ts { const indentStrings: string[] = ["", " "]; export function getIndentString(level: number) { - if (indentStrings[level] === undefined) { - indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; + // prepopulate cache + const singleLevel = indentStrings[1]; + for (let current = indentStrings.length; current <= level; current++) { + indentStrings.push(indentStrings[current - 1] + singleLevel); } return indentStrings[level]; } @@ -5783,7 +5819,6 @@ namespace ts { if (arguments.length > 2) { text = formatStringFromArgs(text, arguments, 2); } - return { messageText: text, category: message.category, @@ -5974,8 +6009,8 @@ namespace ts { return jsx === JsxEmit.React || jsx === JsxEmit.ReactJSX || jsx === JsxEmit.ReactJSXDev; } - export function getJSXImplicitImportBase(compilerOptions: CompilerOptions, file: SourceFile): string | undefined { - const jsxImportSourcePragmas = file.pragmas.get("jsximportsource"); + export function getJSXImplicitImportBase(compilerOptions: CompilerOptions, file?: SourceFile): string | undefined { + const jsxImportSourcePragmas = file?.pragmas.get("jsximportsource"); const jsxImportSourcePragma = isArray(jsxImportSourcePragmas) ? jsxImportSourcePragmas[0] : jsxImportSourcePragmas; return compilerOptions.jsx === JsxEmit.ReactJSX || compilerOptions.jsx === JsxEmit.ReactJSXDev || @@ -5985,6 +6020,10 @@ namespace ts { undefined; } + export function getJSXRuntimeImport(base: string | undefined, options: CompilerOptions) { + return base ? `${base}/${options.jsx === JsxEmit.ReactJSXDev ? "jsx-dev-runtime" : "jsx-runtime"}` : undefined; + } + export function hasZeroOrOneAsteriskCharacter(str: string): boolean { let seenAsterisk = false; for (let i = 0; i < str.length; i++) { @@ -6633,6 +6672,7 @@ namespace ts { if (!diagnostic.relatedInformation) { diagnostic.relatedInformation = []; } + Debug.assert(diagnostic.relatedInformation !== emptyArray, "Diagnostic had empty array singleton for related info, but is still being constructed!"); diagnostic.relatedInformation.push(...relatedInformation); return diagnostic; } diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index e9d28e8fab5..0f702eba480 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -403,6 +403,28 @@ namespace ts { return !nodeTest || nodeTest(node) ? node : undefined; } + /** + * Iterates through the parent chain of a node and performs the callback on each parent until the callback + * returns a truthy value, then returns that value. + * If no such value is found, it applies the callback until the parent pointer is undefined or the callback returns "quit" + * At that point findAncestor returns undefined. + */ + export function findAncestor(node: Node | undefined, callback: (element: Node) => element is T): T | undefined; + export function findAncestor(node: Node | undefined, callback: (element: Node) => boolean | "quit"): Node | undefined; + export function findAncestor(node: Node, callback: (element: Node) => boolean | "quit"): Node | undefined { + while (node) { + const result = callback(node); + if (result === "quit") { + return undefined; + } + else if (result) { + return node; + } + node = node.parent; + } + return undefined; + } + /** * Gets a value indicating whether a node originated in the parse tree. * diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index 899936e5962..8a06e110552 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -573,6 +573,16 @@ namespace ts { return factory.updateLiteralTypeNode(node, nodeVisitor((node).literal, visitor, isExpression)); + case SyntaxKind.TemplateLiteralType: + return factory.updateTemplateLiteralType(node, + nodeVisitor((node).head, visitor, isTemplateHead), + nodesVisitor((node).templateSpans, visitor, isTemplateLiteralTypeSpan)); + + case SyntaxKind.TemplateLiteralTypeSpan: + return factory.updateTemplateLiteralTypeSpan(node, + nodeVisitor((node).type, visitor, isTypeNode), + nodeVisitor((node).literal, visitor, isTemplateMiddleOrTemplateTail)); + // Binding patterns case SyntaxKind.ObjectBindingPattern: return factory.updateObjectBindingPattern(node, diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 724d57f48b2..422dc13ab22 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -345,11 +345,11 @@ namespace ts { export function setGetSourceFileAsHashVersioned(compilerHost: CompilerHost, host: { createHash?(data: string): string; }) { const originalGetSourceFile = compilerHost.getSourceFile; - const computeHash = host.createHash || generateDjb2Hash; + const computeHash = maybeBind(host, host.createHash) || generateDjb2Hash; compilerHost.getSourceFile = (...args) => { const result = originalGetSourceFile.call(compilerHost, ...args); if (result) { - result.version = computeHash.call(host, result.text); + result.version = computeHash(result.text); } return result; }; diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts index 2673b116810..e56fea37199 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -635,7 +635,7 @@ namespace ts { function reloadFileNamesFromConfigFile() { writeLog("Reloading new file names and options"); - const result = getFileNamesFromConfigSpecs(configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost); + const result = getFileNamesFromConfigSpecs(configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions); if (updateErrorForNoInputFiles(result, getNormalizedAbsolutePath(configFileName, currentDirectory), configFileSpecs, configFileParsingDiagnostics!, canConfigFileJsonReportNoInputFiles)) { hasChangedConfigFileParsingErrors = true; } @@ -748,6 +748,7 @@ namespace ts { fileOrDirectoryPath, configFileName, configFileSpecs, + extraFileExtensions, options: compilerOptions, program: getCurrentBuilderProgram(), currentDirectory, diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index ce469755daf..54ed94e375b 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -648,19 +648,22 @@ namespace ts { reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K"); } - const programTime = performance.getDuration("Program"); - const bindTime = performance.getDuration("Bind"); - const checkTime = performance.getDuration("Check"); - const emitTime = performance.getDuration("Emit"); + const isPerformanceEnabled = performance.isEnabled(); + const programTime = isPerformanceEnabled ? performance.getDuration("Program") : 0; + const bindTime = isPerformanceEnabled ? performance.getDuration("Bind") : 0; + const checkTime = isPerformanceEnabled ? performance.getDuration("Check") : 0; + const emitTime = isPerformanceEnabled ? performance.getDuration("Emit") : 0; if (compilerOptions.extendedDiagnostics) { const caches = program.getRelationCacheSizes(); reportCountStatistic("Assignability cache size", caches.assignable); reportCountStatistic("Identity cache size", caches.identity); reportCountStatistic("Subtype cache size", caches.subtype); reportCountStatistic("Strict subtype cache size", caches.strictSubtype); - performance.forEachMeasure((name, duration) => reportTimeStatistic(`${name} time`, duration)); + if (isPerformanceEnabled) { + performance.forEachMeasure((name, duration) => reportTimeStatistic(`${name} time`, duration)); + } } - else { + else if (isPerformanceEnabled) { // Individual component times. // Note: To match the behavior of previous versions of the compiler, the reported parse time includes // I/O read time and processing time for triple-slash references and module imports, and the reported @@ -672,10 +675,16 @@ namespace ts { reportTimeStatistic("Check time", checkTime); reportTimeStatistic("Emit time", emitTime); } - reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime); + if (isPerformanceEnabled) { + reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime); + } reportStatistics(); - - performance.disable(); + if (!isPerformanceEnabled) { + sys.write(Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n"); + } + else { + performance.disable(); + } } function reportStatistics() { diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index 299403d8974..41048899e0f 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -759,7 +759,18 @@ namespace FourSlash { ts.zipWith(endMarkers, definitions, (endMarker, definition, i) => { const marker = this.getMarkerByName(endMarker); if (ts.comparePaths(marker.fileName, definition.fileName, /*ignoreCase*/ true) !== ts.Comparison.EqualTo || marker.position !== definition.textSpan.start) { - this.raiseError(`${testName} failed for definition ${endMarker} (${i}): expected ${marker.fileName} at ${marker.position}, got ${definition.fileName} at ${definition.textSpan.start}`); + const filesToDisplay = ts.deduplicate([marker.fileName, definition.fileName], ts.equateValues); + const markers = [{ text: "EXPECTED", fileName: marker.fileName, position: marker.position }, { text: "ACTUAL", fileName: definition.fileName, position: definition.textSpan.start }]; + const text = filesToDisplay.map(fileName => { + const markersToRender = markers.filter(m => m.fileName === fileName).sort((a, b) => b.position - a.position); + let fileContent = this.getFileContent(fileName); + for (const marker of markersToRender) { + fileContent = fileContent.slice(0, marker.position) + `\x1b[1;4m/*${marker.text}*/\x1b[0;31m` + fileContent.slice(marker.position); + } + return `// @Filename: ${fileName}\n${fileContent}`; + }).join("\n\n"); + + this.raiseError(`${testName} failed for definition ${endMarker} (${i}): expected ${marker.fileName} at ${marker.position}, got ${definition.fileName} at ${definition.textSpan.start}\n\n${text}\n`); } }); } @@ -777,7 +788,7 @@ namespace FourSlash { const fileContent = this.getFileContent(startFile); const spanContent = fileContent.slice(defs.textSpan.start, ts.textSpanEnd(defs.textSpan)); const spanContentWithMarker = spanContent.slice(0, marker.position - defs.textSpan.start) + `/*${startMarkerName}*/` + spanContent.slice(marker.position - defs.textSpan.start); - const suggestedFileContent = (fileContent.slice(0, defs.textSpan.start) + `\x1b[1;4m[|${spanContentWithMarker}|]\x1b[31m` + fileContent.slice(ts.textSpanEnd(defs.textSpan))) + const suggestedFileContent = (fileContent.slice(0, defs.textSpan.start) + `\x1b[1;4m[|${spanContentWithMarker}|]\x1b[0;31m` + fileContent.slice(ts.textSpanEnd(defs.textSpan))) .split(/\r?\n/).map(line => " ".repeat(6) + line).join(ts.sys.newLine); this.raiseError(`goToDefinitionsAndBoundSpan failed. Found a starting TextSpan around '${spanContent}' in '${startFile}' (at position ${defs.textSpan.start}). ` + `If this is the correct input span, put a fourslash range around it: \n\n${suggestedFileContent}\n`); @@ -2461,8 +2472,7 @@ namespace FourSlash { const { fileName } = this.activeFile; const before = this.getFileContent(fileName); this.formatDocument(); - const after = this.getFileContent(fileName); - this.assertObjectsEqual(after, before); + this.verifyFileContent(fileName, before); } public verifyTextAtCaretIs(text: string) { diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index 096b1ea8e8d..f946e2d8bc3 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -1065,6 +1065,10 @@ namespace FourSlashInterface { typeEntry("ConstructorParameters"), typeEntry("ReturnType"), typeEntry("InstanceType"), + typeEntry("Uppercase"), + typeEntry("Lowercase"), + typeEntry("Capitalize"), + typeEntry("Uncapitalize"), interfaceEntry("ThisType"), varEntry("ArrayBuffer"), interfaceEntry("ArrayBufferTypes"), @@ -1370,6 +1374,7 @@ namespace FourSlashInterface { "let", "package", "yield", + "as", "async", "await", ].map(keywordEntry); @@ -1510,6 +1515,7 @@ namespace FourSlashInterface { "let", "package", "yield", + "as", "async", "await", ].map(keywordEntry); diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index c0e66430e9a..e02d01a7528 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -1203,9 +1203,11 @@ interface Array { length: number; [n: number]: T; }` } function baselineOutputs(baseline: string[], output: readonly string[], start: number, end = output.length) { + let baselinedOutput: string[] | undefined; for (let i = start; i < end; i++) { - baseline.push(output[i].replace(/Elapsed::\s[0-9]+ms/g, "Elapsed:: *ms")); + (baselinedOutput ||= []).push(output[i].replace(/Elapsed::\s[0-9]+(?:\.\d+)?ms/g, "Elapsed:: *ms")); } + if (baselinedOutput) baseline.push(baselinedOutput.join("")); } export type TestServerHostTrackingWrittenFiles = TestServerHost & { writtenFiles: ESMap; }; diff --git a/src/jsTyping/jsTyping.ts b/src/jsTyping/jsTyping.ts index ca765bd776f..10ef0cf957a 100644 --- a/src/jsTyping/jsTyping.ts +++ b/src/jsTyping/jsTyping.ts @@ -149,8 +149,9 @@ namespace ts.JsTyping { const nodeModulesPath = combinePaths(searchDir, "node_modules"); getTypingNamesFromPackagesFolder(nodeModulesPath, filesToWatch); }); - getTypingNamesFromSourceFileNames(fileNames); - + if(!typeAcquisition.disableFilenameBasedTypeAcquisition) { + getTypingNamesFromSourceFileNames(fileNames); + } // add typings for unresolved imports if (unresolvedImports) { const module = deduplicate( diff --git a/src/lib/es2017.sharedmemory.d.ts b/src/lib/es2017.sharedmemory.d.ts index 441e1ab55e2..0d93ba914e0 100644 --- a/src/lib/es2017.sharedmemory.d.ts +++ b/src/lib/es2017.sharedmemory.d.ts @@ -7,10 +7,6 @@ interface SharedArrayBuffer { */ readonly byteLength: number; - /* - * The SharedArrayBuffer constructor's length property whose value is 1. - */ - length: number; /** * Returns a section of an SharedArrayBuffer. */ diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index d40318a5e8e..4c3c558916f 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1047,7 +1047,7 @@ interface JSON { /** * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. + * @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; @@ -1508,6 +1508,26 @@ type ReturnType any> = T extends (...args: any) => i */ type InstanceType any> = T extends new (...args: any) => infer R ? R : any; +/** + * Convert string literal type to uppercase + */ +type Uppercase = intrinsic; + +/** + * Convert string literal type to lowercase + */ +type Lowercase = intrinsic; + +/** + * Convert first character of string literal type to uppercase + */ +type Capitalize = intrinsic; + +/** + * Convert first character of string literal type to lowercase + */ +type Uncapitalize = intrinsic; + /** * Marker for contextual 'this' type */ @@ -4264,6 +4284,7 @@ declare namespace Intl { style?: string; currency?: string; currencyDisplay?: string; + currencySign?: string; useGrouping?: boolean; minimumIntegerDigits?: number; minimumFractionDigits?: number; diff --git a/src/lib/esnext.d.ts b/src/lib/esnext.d.ts index 36c759ff912..d42e73cad9f 100644 --- a/src/lib/esnext.d.ts +++ b/src/lib/esnext.d.ts @@ -2,3 +2,4 @@ /// /// /// +/// diff --git a/src/lib/esnext.weakref.d.ts b/src/lib/esnext.weakref.d.ts new file mode 100644 index 00000000000..337aa11f3e3 --- /dev/null +++ b/src/lib/esnext.weakref.d.ts @@ -0,0 +1,55 @@ +interface WeakRef { + readonly [Symbol.toStringTag]: "WeakRef"; + + /** + * Returns the WeakRef instance's target object, or undefined if the target object has been + * reclaimed. + */ + deref(): T | undefined; +} + +interface WeakRefConstructor { + readonly prototype: WeakRef; + + /** + * Creates a WeakRef instance for the given target object. + * @param target The target object for the WeakRef instance. + */ + new(target?: T): WeakRef; +} + +declare var WeakRef: WeakRefConstructor; + +interface FinalizationRegistry { + readonly [Symbol.toStringTag]: "FinalizationRegistry"; + + /** + * Registers an object with the registry. + * @param target The target object to register. + * @param heldValue The value to pass to the finalizer for this object. This cannot be the + * target object. + * @param unregisterToken The token to pass to the unregister method to unregister the target + * object. If provided (and not undefined), this must be an object. If not provided, the target + * cannot be unregistered. + */ + register(target: object, heldValue: any, unregisterToken?: object): void; + + /** + * Unregisters an object from the registry. + * @param unregisterToken The token that was used as the unregisterToken argument when calling + * register to register the target object. + */ + unregister(unregisterToken: object): void; +} + +interface FinalizationRegistryConstructor { + readonly prototype: FinalizationRegistry; + + /** + * Creates a finalization registry with an associated cleanup callback + * @param cleanupCallback The callback to call after an object in the registry has been reclaimed. + */ + new(cleanupCallback: (heldValue: any) => void): FinalizationRegistry; +} + +declare var FinalizationRegistry: FinalizationRegistryConstructor; diff --git a/src/lib/libs.json b/src/lib/libs.json index 574c8b27c37..0de9568bd4a 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -50,6 +50,7 @@ "esnext.intl", "esnext.string", "esnext.promise", + "esnext.weakref", // Default libraries "es5.full", "es2015.full", diff --git a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl index b3a8a3f17ad..27708371712 100644 --- a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1416,6 +1416,24 @@ + + + + + + + + + + + + + + + + + + @@ -2678,10 +2696,13 @@ - + - + + + + @@ -2694,56 +2715,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -3939,6 +3960,24 @@ + + + + + + + + + + + + + + + + + + @@ -4041,15 +4080,6 @@ - - - - - - - - - @@ -4881,6 +4911,15 @@ + + + + + + + + + @@ -6378,6 +6417,15 @@ + + + + + + + + + @@ -8178,6 +8226,15 @@ + + + + + + + + + @@ -8463,6 +8520,15 @@ + + + + + + + + + @@ -10257,15 +10323,6 @@ - - - - - - - - - @@ -10356,6 +10413,15 @@ + + + + + + + + + @@ -10521,6 +10587,15 @@ + + + + + + + + + @@ -10539,6 +10614,15 @@ + + + + + + + + + @@ -11238,11 +11322,11 @@ - + - + - + @@ -12825,15 +12909,6 @@ - - - - - - - - - @@ -12888,6 +12963,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl index ed19a1ed2bf..6f31e22224a 100644 --- a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1416,6 +1416,24 @@ + + + + + + + + + + + + + + + + + + @@ -2678,10 +2696,13 @@ - + - + + + + @@ -2694,56 +2715,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -3454,7 +3475,7 @@ - + @@ -3939,6 +3960,24 @@ + + + + + + + + + + + + + + + + + + @@ -4041,15 +4080,6 @@ - - - - - - - - - @@ -4881,6 +4911,15 @@ + + + + + + + + + @@ -6378,6 +6417,15 @@ + + + + + + + + + @@ -8178,6 +8226,15 @@ + + + + + + + + + @@ -8463,6 +8520,15 @@ + + + + + + + + + @@ -10189,7 +10255,7 @@ - + @@ -10257,15 +10323,6 @@ - - - - - - - - - @@ -10356,6 +10413,15 @@ + + + + + + + + + @@ -10521,6 +10587,15 @@ + + + + + + + + + @@ -10539,6 +10614,15 @@ + + + + + + + + + @@ -11238,11 +11322,11 @@ - + - + - + @@ -12825,15 +12909,6 @@ - - - - - - - - - @@ -12888,6 +12963,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl index 3cc7f81d585..509b81b012e 100644 --- a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1425,6 +1425,24 @@ + + + + + + + + + + + + + + + + + + @@ -2687,10 +2705,13 @@ - + - + + + + @@ -2703,56 +2724,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -3948,6 +3969,24 @@ + + + + + + + + + + + + + + + + + + @@ -4050,15 +4089,6 @@ - - - - - - - - - @@ -4890,6 +4920,15 @@ + + + + + + + + + @@ -6387,6 +6426,15 @@ + + + + + + + + + @@ -8187,6 +8235,15 @@ + + + + + + + + + @@ -8472,6 +8529,15 @@ + + + + + + + + + @@ -10266,15 +10332,6 @@ - - - - - - - - - @@ -10365,6 +10422,15 @@ + + + + + + + + + @@ -10530,6 +10596,15 @@ + + + + + + + + + @@ -10548,6 +10623,15 @@ + + + + + + + + + @@ -11247,11 +11331,11 @@ - + - + - + @@ -12834,15 +12918,6 @@ - - - - - - - - - @@ -12897,6 +12972,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl index eb5a25d972f..8f6e20ea35e 100644 --- a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1413,6 +1413,24 @@ + + + + + + + + + + + + + + + + + + @@ -2675,10 +2693,13 @@ - + - + + + + @@ -2691,56 +2712,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -3936,6 +3957,24 @@ + + + + + + + + + + + + + + + + + + @@ -4038,15 +4077,6 @@ - - - - - - - - - @@ -4878,6 +4908,15 @@ + + + + + + + + + @@ -6375,6 +6414,15 @@ + + + + + + + + + @@ -8172,6 +8220,15 @@ + + + + + + + + + @@ -8457,6 +8514,15 @@ + + + + + + + + + @@ -10251,15 +10317,6 @@ - - - - - - - - - @@ -10350,6 +10407,15 @@ + + + + + + + + + @@ -10515,6 +10581,15 @@ + + + + + + + + + @@ -10533,6 +10608,15 @@ + + + + + + + + + @@ -11232,11 +11316,11 @@ - + - + - + @@ -12819,15 +12903,6 @@ - - - - - - - - - @@ -12882,6 +12957,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl index dd48aeb050b..5d2ac83c8f1 100644 --- a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1428,6 +1428,24 @@ + + + + + + + + + + + + + + + + + + @@ -2690,10 +2708,13 @@ - + - + + + + @@ -2706,56 +2727,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -3466,7 +3487,7 @@ - + @@ -3951,6 +3972,24 @@ + + + + + + + + + + + + + + + + + + @@ -4053,15 +4092,6 @@ - - - - - - - - - @@ -4893,6 +4923,15 @@ + + + + + + + + + @@ -6390,6 +6429,15 @@ + + + + + + + + + @@ -8190,6 +8238,15 @@ + + + + + + + + + @@ -8475,6 +8532,15 @@ + + + + + + + + + @@ -9115,7 +9181,7 @@ - + @@ -9124,7 +9190,7 @@ - + @@ -10201,7 +10267,7 @@ - + @@ -10269,15 +10335,6 @@ - - - - - - - - - @@ -10368,6 +10425,15 @@ + + + + + + + + + @@ -10533,6 +10599,15 @@ + + + + + + + + + @@ -10551,6 +10626,15 @@ + + + + + + + + + @@ -11250,11 +11334,11 @@ - + - + - + @@ -12837,15 +12921,6 @@ - - - - - - - - - @@ -12900,6 +12975,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl index 2ca8f7ee2fb..c2a4f43bd00 100644 --- a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1428,6 +1428,24 @@ + + + + + + + + + + + + + + + + + + @@ -2690,10 +2708,13 @@ - + - + + + + @@ -2706,56 +2727,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -3951,6 +3972,24 @@ + + + + + + + + + + + + + + + + + + @@ -4053,15 +4092,6 @@ - - - - - - - - - @@ -4893,6 +4923,15 @@ + + + + + + + + + @@ -6390,6 +6429,15 @@ + + + + + + + + + @@ -8190,6 +8238,15 @@ + + + + + + + + + @@ -8475,6 +8532,15 @@ + + + + + + + + + @@ -9115,7 +9181,7 @@ - + @@ -10269,15 +10335,6 @@ - - - - - - - - - @@ -10368,6 +10425,15 @@ + + + + + + + + + @@ -10497,11 +10563,11 @@ - + - + - + @@ -10533,6 +10599,15 @@ + + + + + + + + + @@ -10551,6 +10626,15 @@ + + + + + + + + + @@ -11250,11 +11334,11 @@ - + - + - + @@ -12837,15 +12921,6 @@ - - - - - - - - - @@ -12900,6 +12975,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl index cacc7e13f4d..c897411c189 100644 --- a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1416,6 +1416,24 @@ + + + + + + + + + + + + + + + + + + @@ -2678,10 +2696,13 @@ - + - + + + + @@ -2694,56 +2715,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -3939,6 +3960,24 @@ + + + + + + + + + + + + + + + + + + @@ -4041,15 +4080,6 @@ - - - - - - - - - @@ -4881,6 +4911,15 @@ + + + + + + + + + @@ -6378,6 +6417,15 @@ + + + + + + + + + @@ -8178,6 +8226,15 @@ + + + + + + + + + @@ -8463,6 +8520,15 @@ + + + + + + + + + @@ -10257,15 +10323,6 @@ - - - - - - - - - @@ -10356,6 +10413,15 @@ + + + + + + + + + @@ -10521,6 +10587,15 @@ + + + + + + + + + @@ -10539,6 +10614,15 @@ + + + + + + + + + @@ -11238,11 +11322,11 @@ - + - + - + @@ -12825,15 +12909,6 @@ - - - - - - - - - @@ -12888,6 +12963,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl index 177c5c45894..fdc84a50c13 100644 --- a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1416,6 +1416,24 @@ + + + + + + + + + + + + + + + + + + @@ -2678,10 +2696,13 @@ - + - + + + + @@ -2694,56 +2715,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -3454,7 +3475,7 @@ - + @@ -3939,6 +3960,24 @@ + + + + + + + + + + + + + + + + + + @@ -4041,15 +4080,6 @@ - - - - - - - - - @@ -4881,6 +4911,15 @@ + + + + + + + + + @@ -6378,6 +6417,15 @@ + + + + + + + + + @@ -8178,6 +8226,15 @@ + + + + + + + + + @@ -8463,6 +8520,15 @@ + + + + + + + + + @@ -9103,7 +9169,7 @@ - + @@ -9112,7 +9178,7 @@ - + @@ -10189,7 +10255,7 @@ - + @@ -10257,15 +10323,6 @@ - - - - - - - - - @@ -10356,6 +10413,15 @@ + + + + + + + + + @@ -10521,6 +10587,15 @@ + + + + + + + + + @@ -10539,6 +10614,15 @@ + + + + + + + + + @@ -11238,11 +11322,11 @@ - + - + - + @@ -12825,15 +12909,6 @@ - - - - - - - - - @@ -12888,6 +12963,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl index 5f7f91e078c..fdfc78ccf26 100644 --- a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1416,6 +1416,24 @@ + + + + + + + + + + + + + + + + + + @@ -2678,10 +2696,13 @@ - + - + + + + @@ -2694,56 +2715,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -3939,6 +3960,24 @@ + + + + + + + + + + + + + + + + + + @@ -4041,15 +4080,6 @@ - - - - - - - - - @@ -4881,6 +4911,15 @@ + + + + + + + + + @@ -6378,6 +6417,15 @@ + + + + + + + + + @@ -8178,6 +8226,15 @@ + + + + + + + + + @@ -8463,6 +8520,15 @@ + + + + + + + + + @@ -10257,15 +10323,6 @@ - - - - - - - - - @@ -10356,6 +10413,15 @@ + + + + + + + + + @@ -10521,6 +10587,15 @@ + + + + + + + + + @@ -10539,6 +10614,15 @@ + + + + + + + + + @@ -11238,11 +11322,11 @@ - + - + - + @@ -12825,15 +12909,6 @@ - - - - - - - - - @@ -12888,6 +12963,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl index f69faf3087d..9cb4dcc9414 100644 --- a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1406,6 +1406,24 @@ + + + + + + + + + + + + + + + + + + @@ -2668,10 +2686,13 @@ - + - + + + + @@ -2684,56 +2705,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -3929,6 +3950,24 @@ + + + + + + + + + + + + + + + + + + @@ -4031,15 +4070,6 @@ - - - - - - - - - @@ -4871,6 +4901,15 @@ + + + + + + + + + @@ -6368,6 +6407,15 @@ + + + + + + + + + @@ -8165,6 +8213,15 @@ + + + + + + + + + @@ -8450,6 +8507,15 @@ + + + + + + + + + @@ -10244,15 +10310,6 @@ - - - - - - - - - @@ -10343,6 +10400,15 @@ + + + + + + + + + @@ -10508,6 +10574,15 @@ + + + + + + + + + @@ -10526,6 +10601,15 @@ + + + + + + + + + @@ -11225,11 +11309,11 @@ - + - + - + @@ -12812,15 +12896,6 @@ - - - - - - - - - @@ -12875,6 +12950,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl index 8430b58693b..50c9e218757 100644 --- a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1409,6 +1409,24 @@ + + + + + + + + + + + + + + + + + + @@ -2671,10 +2689,13 @@ - + - + + + + @@ -2687,56 +2708,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -3932,6 +3953,24 @@ + + + + + + + + + + + + + + + + + + @@ -4034,15 +4073,6 @@ - - - - - - - - - @@ -4874,6 +4904,15 @@ + + + + + + + + + @@ -6371,6 +6410,15 @@ + + + + + + + + + @@ -8168,6 +8216,15 @@ + + + + + + + + + @@ -8453,6 +8510,15 @@ + + + + + + + + + @@ -10247,15 +10313,6 @@ - - - - - - - - - @@ -10346,6 +10403,15 @@ + + + + + + + + + @@ -10511,6 +10577,15 @@ + + + + + + + + + @@ -10529,6 +10604,15 @@ + + + + + + + + + @@ -11228,11 +11312,11 @@ - + - + - + @@ -12815,15 +12899,6 @@ - - - - - - - - - @@ -12878,6 +12953,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl index efcc301de9f..bb1f256902f 100644 --- a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1415,6 +1415,24 @@ + + + + + + + + + + + + + + + + + + @@ -2677,10 +2695,13 @@ - + - + + + + @@ -2693,56 +2714,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -3938,6 +3959,24 @@ + + + + + + + + + + + + + + + + + + @@ -4040,15 +4079,6 @@ - - - - - - - - - @@ -4880,6 +4910,15 @@ + + + + + + + + + @@ -6377,6 +6416,15 @@ + + + + + + + + + @@ -8177,6 +8225,15 @@ + + + + + + + + + @@ -8462,6 +8519,15 @@ + + + + + + + + + @@ -9102,7 +9168,7 @@ - + @@ -9111,7 +9177,7 @@ - + @@ -10188,7 +10254,7 @@ - + @@ -10256,15 +10322,6 @@ - - - - - - - - - @@ -10355,6 +10412,15 @@ + + + + + + + + + @@ -10520,6 +10586,15 @@ + + + + + + + + + @@ -10538,6 +10613,15 @@ + + + + + + + + + @@ -11237,11 +11321,11 @@ - + - + - + @@ -12824,15 +12908,6 @@ - - - - - - - - - @@ -12887,6 +12962,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl index 93b275ea1dc..a01c37bbaa2 100644 --- a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1409,6 +1409,24 @@ + + + + + + + + + + + + + + + + + + @@ -2671,10 +2689,13 @@ - + - + + + + @@ -2687,56 +2708,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -3932,6 +3953,24 @@ + + + + + + + + + + + + + + + + + + @@ -4034,15 +4073,6 @@ - - - - - - - - - @@ -4874,6 +4904,15 @@ + + + + + + + + + @@ -6371,6 +6410,15 @@ + + + + + + + + + @@ -8171,6 +8219,15 @@ + + + + + + + + + @@ -8456,6 +8513,15 @@ + + + + + + + + + @@ -10250,15 +10316,6 @@ - - - - - - - - - @@ -10349,6 +10406,15 @@ + + + + + + + + + @@ -10514,6 +10580,15 @@ + + + + + + + + + @@ -10532,6 +10607,15 @@ + + + + + + + + + @@ -11231,11 +11315,11 @@ - + - + - + @@ -12818,15 +12902,6 @@ - - - - - - - - - @@ -12881,6 +12956,15 @@ + + + + + + + + + diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index d0b4891c963..2747a6f03f6 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -263,6 +263,16 @@ namespace ts.server { return result; } + export function convertTypeAcquisition(protocolOptions: protocol.InferredProjectCompilerOptions): TypeAcquisition | undefined { + let result: TypeAcquisition | undefined; + typeAcquisitionDeclarations.forEach((option) => { + const propertyValue = protocolOptions[option.name]; + if (propertyValue === undefined) return; + (result || (result = {}))[option.name] = propertyValue; + }); + return result; + } + export function tryConvertScriptKindName(scriptKindName: protocol.ScriptKindName | ScriptKind): ScriptKind { return isString(scriptKindName) ? convertScriptKindName(scriptKindName) : scriptKindName; } @@ -434,64 +444,105 @@ namespace ts.server { /*@internal*/ export function forEachResolvedProjectReferenceProject( project: ConfiguredProject, + fileName: string | undefined, cb: (child: ConfiguredProject) => T | undefined, projectReferenceProjectLoadKind: ProjectReferenceProjectLoadKind.Find | ProjectReferenceProjectLoadKind.FindCreate, ): T | undefined; /*@internal*/ export function forEachResolvedProjectReferenceProject( project: ConfiguredProject, + fileName: string | undefined, cb: (child: ConfiguredProject) => T | undefined, projectReferenceProjectLoadKind: ProjectReferenceProjectLoadKind, reason: string ): T | undefined; export function forEachResolvedProjectReferenceProject( project: ConfiguredProject, + fileName: string | undefined, cb: (child: ConfiguredProject) => T | undefined, projectReferenceProjectLoadKind: ProjectReferenceProjectLoadKind, reason?: string ): T | undefined { + const resolvedRefs = project.getCurrentProgram()?.getResolvedProjectReferences(); + if (!resolvedRefs) return undefined; let seenResolvedRefs: ESMap | undefined; - return worker(project.getCurrentProgram()?.getResolvedProjectReferences(), project.getCompilerOptions()); - - function worker(resolvedProjectReferences: readonly (ResolvedProjectReference | undefined)[] | undefined, parentOptions: CompilerOptions): T | undefined { - const loadKind = parentOptions.disableReferencedProjectLoad ? ProjectReferenceProjectLoadKind.Find : projectReferenceProjectLoadKind; - return forEach(resolvedProjectReferences, ref => { - if (!ref) return undefined; - - const configFileName = toNormalizedPath(ref.sourceFile.fileName); - const canonicalPath = project.projectService.toCanonicalFileName(configFileName); - const seenValue = seenResolvedRefs?.get(canonicalPath); - if (seenValue !== undefined && seenValue >= loadKind) { - return undefined; - } - const child = project.projectService.findConfiguredProjectByProjectName(configFileName) || ( - loadKind === ProjectReferenceProjectLoadKind.Find ? - undefined : - loadKind === ProjectReferenceProjectLoadKind.FindCreate ? - project.projectService.createConfiguredProject(configFileName) : - loadKind === ProjectReferenceProjectLoadKind.FindCreateLoad ? - project.projectService.createAndLoadConfiguredProject(configFileName, reason!) : - Debug.assertNever(loadKind) + const possibleDefaultRef = fileName ? project.getResolvedProjectReferenceToRedirect(fileName) : undefined; + if (possibleDefaultRef) { + // Try to find the name of the file directly through resolved project references + const configFileName = toNormalizedPath(possibleDefaultRef.sourceFile.fileName); + const child = project.projectService.findConfiguredProjectByProjectName(configFileName); + if (child) { + const result = cb(child); + if (result) return result; + } + else if (projectReferenceProjectLoadKind !== ProjectReferenceProjectLoadKind.Find) { + seenResolvedRefs = new Map(); + // Try to see if this project can be loaded + const result = forEachResolvedProjectReferenceProjectWorker( + resolvedRefs, + project.getCompilerOptions(), + (ref, loadKind) => possibleDefaultRef === ref ? callback(ref, loadKind) : undefined, + projectReferenceProjectLoadKind, + project.projectService, + seenResolvedRefs ); + if (result) return result; + // Cleanup seenResolvedRefs + seenResolvedRefs.clear(); + } + } - const result = child && cb(child); - if (result) { - return result; - } + return forEachResolvedProjectReferenceProjectWorker( + resolvedRefs, + project.getCompilerOptions(), + (ref, loadKind) => possibleDefaultRef !== ref ? callback(ref, loadKind) : undefined, + projectReferenceProjectLoadKind, + project.projectService, + seenResolvedRefs + ); - (seenResolvedRefs || (seenResolvedRefs = new Map())).set(canonicalPath, loadKind); - return worker(ref.references, ref.commandLine.options); - }); + function callback(ref: ResolvedProjectReference, loadKind: ProjectReferenceProjectLoadKind) { + const configFileName = toNormalizedPath(ref.sourceFile.fileName); + const child = project.projectService.findConfiguredProjectByProjectName(configFileName) || ( + loadKind === ProjectReferenceProjectLoadKind.Find ? + undefined : + loadKind === ProjectReferenceProjectLoadKind.FindCreate ? + project.projectService.createConfiguredProject(configFileName) : + loadKind === ProjectReferenceProjectLoadKind.FindCreateLoad ? + project.projectService.createAndLoadConfiguredProject(configFileName, reason!) : + Debug.assertNever(loadKind) + ); + + return child && cb(child); } } - /*@internal*/ - export function forEachResolvedProjectReference( - project: ConfiguredProject, - cb: (resolvedProjectReference: ResolvedProjectReference | undefined, resolvedProjectReferencePath: Path) => T | undefined + function forEachResolvedProjectReferenceProjectWorker( + resolvedProjectReferences: readonly (ResolvedProjectReference | undefined)[], + parentOptions: CompilerOptions, + cb: (resolvedRef: ResolvedProjectReference, loadKind: ProjectReferenceProjectLoadKind) => T | undefined, + projectReferenceProjectLoadKind: ProjectReferenceProjectLoadKind, + projectService: ProjectService, + seenResolvedRefs: ESMap | undefined, ): T | undefined { - const program = project.getCurrentProgram(); - return program && program.forEachResolvedProjectReference(cb); + const loadKind = parentOptions.disableReferencedProjectLoad ? ProjectReferenceProjectLoadKind.Find : projectReferenceProjectLoadKind; + return forEach(resolvedProjectReferences, ref => { + if (!ref) return undefined; + + const configFileName = toNormalizedPath(ref.sourceFile.fileName); + const canonicalPath = projectService.toCanonicalFileName(configFileName); + const seenValue = seenResolvedRefs?.get(canonicalPath); + if (seenValue !== undefined && seenValue >= loadKind) { + return undefined; + } + const result = cb(ref, loadKind); + if (result) { + return result; + } + + (seenResolvedRefs || (seenResolvedRefs = new Map())).set(canonicalPath, loadKind); + return ref.references && forEachResolvedProjectReferenceProjectWorker(ref.references, ref.commandLine.options, cb, loadKind, projectService, seenResolvedRefs); + }); } function forEachPotentialProjectReference( @@ -504,12 +555,12 @@ namespace ts.server { function forEachAnyProjectReferenceKind( project: ConfiguredProject, - cb: (resolvedProjectReference: ResolvedProjectReference | undefined, resolvedProjectReferencePath: Path) => T | undefined, + cb: (resolvedProjectReference: ResolvedProjectReference) => T | undefined, cbProjectRef: (projectReference: ProjectReference) => T | undefined, cbPotentialProjectRef: (potentialProjectReference: Path) => T | undefined ): T | undefined { return project.getCurrentProgram() ? - forEachResolvedProjectReference(project, cb) : + project.forEachResolvedProjectReference(cb) : project.isInitialLoadPending() ? forEachPotentialProjectReference(project, cbPotentialProjectRef) : forEach(project.getProjectReferences(), cbProjectRef); @@ -530,8 +581,8 @@ namespace ts.server { ): T | undefined { return forEachAnyProjectReferenceKind( project, - resolvedRef => callbackRefProject(project, cb, resolvedRef && resolvedRef.sourceFile.path), - projectRef => callbackRefProject(project, cb, project.toPath(projectRef.path)), + resolvedRef => callbackRefProject(project, cb, resolvedRef.sourceFile.path), + projectRef => callbackRefProject(project, cb, project.toPath(resolveProjectReferencePath(projectRef))), potentialProjectRef => callbackRefProject(project, cb, potentialProjectRef) ); } @@ -642,6 +693,8 @@ namespace ts.server { private compilerOptionsForInferredProjectsPerProjectRoot = new Map(); private watchOptionsForInferredProjects: WatchOptions | undefined; private watchOptionsForInferredProjectsPerProjectRoot = new Map(); + private typeAcquisitionForInferredProjects: TypeAcquisition | undefined; + private typeAcquisitionForInferredProjectsPerProjectRoot = new Map(); /** * Project size for configured or external projects */ @@ -730,7 +783,6 @@ namespace ts.server { this.syntaxOnly = false; } - Debug.assert(!!this.host.createHash, "'ServerHost.createHash' is required for ProjectService"); if (this.host.realpath) { this.realpathToScriptInfos = createMultiMap(); } @@ -983,11 +1035,12 @@ namespace ts.server { } } - setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.ExternalProjectCompilerOptions, projectRootPath?: string): void { + setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.InferredProjectCompilerOptions, projectRootPath?: string): void { Debug.assert(projectRootPath === undefined || this.useInferredProjectPerProjectRoot, "Setting compiler options per project root path is only supported when useInferredProjectPerProjectRoot is enabled"); const compilerOptions = convertCompilerOptions(projectCompilerOptions); const watchOptions = convertWatchOptions(projectCompilerOptions); + const typeAcquisition = convertTypeAcquisition(projectCompilerOptions); // always set 'allowNonTsExtensions' for inferred projects since user cannot configure it from the outside // previously we did not expose a way for user to change these settings and this option was enabled by default @@ -996,10 +1049,12 @@ namespace ts.server { if (canonicalProjectRootPath) { this.compilerOptionsForInferredProjectsPerProjectRoot.set(canonicalProjectRootPath, compilerOptions); this.watchOptionsForInferredProjectsPerProjectRoot.set(canonicalProjectRootPath, watchOptions || false); + this.typeAcquisitionForInferredProjectsPerProjectRoot.set(canonicalProjectRootPath, typeAcquisition); } else { this.compilerOptionsForInferredProjects = compilerOptions; this.watchOptionsForInferredProjects = watchOptions; + this.typeAcquisitionForInferredProjects = typeAcquisition; } for (const project of this.inferredProjects) { @@ -1016,6 +1071,7 @@ namespace ts.server { !project.projectRootPath || !this.compilerOptionsForInferredProjectsPerProjectRoot.has(project.projectRootPath)) { project.setCompilerOptions(compilerOptions); project.setWatchOptions(watchOptions); + project.setTypeAcquisition(typeAcquisition); project.compileOnSaveEnabled = compilerOptions.compileOnSave!; project.markAsDirty(); this.delayUpdateProjectGraph(project); @@ -2299,13 +2355,18 @@ namespace ts.server { private createInferredProject(currentDirectory: string | undefined, isSingleInferredProject?: boolean, projectRootPath?: NormalizedPath): InferredProject { const compilerOptions = projectRootPath && this.compilerOptionsForInferredProjectsPerProjectRoot.get(projectRootPath) || this.compilerOptionsForInferredProjects!; // TODO: GH#18217 let watchOptions: WatchOptions | false | undefined; + let typeAcquisition: TypeAcquisition | undefined; if (projectRootPath) { watchOptions = this.watchOptionsForInferredProjectsPerProjectRoot.get(projectRootPath); + typeAcquisition = this.typeAcquisitionForInferredProjectsPerProjectRoot.get(projectRootPath); } if (watchOptions === undefined) { watchOptions = this.watchOptionsForInferredProjects; } - const project = new InferredProject(this, this.documentRegistry, compilerOptions, watchOptions || undefined, projectRootPath, currentDirectory, this.currentPluginConfigOverrides); + if (typeAcquisition === undefined) { + typeAcquisition = this.typeAcquisitionForInferredProjects; + } + const project = new InferredProject(this, this.documentRegistry, compilerOptions, watchOptions || undefined, projectRootPath, currentDirectory, this.currentPluginConfigOverrides, typeAcquisition); if (isSingleInferredProject) { this.inferredProjects.unshift(project); } @@ -2855,6 +2916,7 @@ namespace ts.server { if (!projectContainsInfoDirectly(project, info)) { const referencedProject = forEachResolvedProjectReferenceProject( project, + info.path, child => { reloadChildProject(child); return projectContainsInfoDirectly(child, info); @@ -2865,6 +2927,7 @@ namespace ts.server { // Reload the project's tree that is already present forEachResolvedProjectReferenceProject( project, + /*fileName*/ undefined, reloadChildProject, ProjectReferenceProjectLoadKind.Find ); @@ -2970,11 +3033,12 @@ namespace ts.server { // Find the project that is referenced from this solution that contains the script info directly configuredProject = forEachResolvedProjectReferenceProject( configuredProject, + fileName, child => { updateProjectIfDirty(child); return projectContainsOriginalInfo(child) ? child : undefined; }, - configuredProject.getCompilerOptions().disableReferencedProjectLoad ? ProjectReferenceProjectLoadKind.Find : ProjectReferenceProjectLoadKind.FindCreateLoad, + ProjectReferenceProjectLoadKind.FindCreateLoad, `Creating project referenced in solution ${configuredProject.projectName} to find possible configured project for original file: ${originalFileInfo.fileName}${location !== originalLocation ? " for location: " + location.fileName : ""}` ); if (!configuredProject) return undefined; @@ -3050,6 +3114,7 @@ namespace ts.server { if (!projectContainsInfoDirectly(project, info)) { forEachResolvedProjectReferenceProject( project, + info.path, child => { updateProjectIfDirty(child); // Retain these projects @@ -3164,32 +3229,37 @@ namespace ts.server { // Work on array copy as we could add more projects as part of callback for (const project of arrayFrom(this.configuredProjects.values())) { // If this project has potential project reference for any of the project we are loading ancestor tree for - // we need to load this project tree - if (forEachPotentialProjectReference( - project, - potentialRefPath => forProjects!.has(potentialRefPath) - ) || forEachResolvedProjectReference( - project, - (_ref, resolvedPath) => forProjects!.has(resolvedPath) - )) { - // Load children - this.ensureProjectChildren(project, seenProjects); + // load this project first + if (forEachPotentialProjectReference(project, potentialRefPath => forProjects!.has(potentialRefPath))) { + updateProjectIfDirty(project); } + this.ensureProjectChildren(project, forProjects, seenProjects); } } - private ensureProjectChildren(project: ConfiguredProject, seenProjects: Set) { + private ensureProjectChildren(project: ConfiguredProject, forProjects: ReadonlyCollection, seenProjects: Set) { if (!tryAddToSet(seenProjects, project.canonicalConfigFilePath)) return; - // Update the project - updateProjectIfDirty(project); - // Create tree because project is uptodate we only care of resolved references - forEachResolvedProjectReferenceProject( - project, - child => this.ensureProjectChildren(child, seenProjects), - ProjectReferenceProjectLoadKind.FindCreateLoad, - `Creating project for reference of project: ${project.projectName}` - ); + // If this project disables child load ignore it + if (project.getCompilerOptions().disableReferencedProjectLoad) return; + + const children = project.getCurrentProgram()?.getResolvedProjectReferences(); + if (!children) return; + + for (const child of children) { + if (!child) continue; + const referencedProject = forEachResolvedProjectReference(child.references, ref => forProjects.has(ref.sourceFile.path) ? ref : undefined); + if (!referencedProject) continue; + + // Load this project, + const configFileName = toNormalizedPath(child.sourceFile.fileName); + const childProject = project.projectService.findConfiguredProjectByProjectName(configFileName) || + project.projectService.createAndLoadConfiguredProject(configFileName, `Creating project referenced by : ${project.projectName} as it references project ${referencedProject.sourceFile.fileName}`); + updateProjectIfDirty(childProject); + + // Ensure children for this project + this.ensureProjectChildren(childProject, forProjects, seenProjects); + } } private cleanupAfterOpeningFile(toRetainConfigProjects: readonly ConfiguredProject[] | ConfiguredProject | undefined) { @@ -3514,8 +3584,8 @@ namespace ts.server { const { rootFiles } = proj; const typeAcquisition = proj.typeAcquisition!; Debug.assert(!!typeAcquisition, "proj.typeAcquisition should be set by now"); - // If type acquisition has been explicitly disabled, do not exclude anything from the project - if (typeAcquisition.enable === false) { + + if (typeAcquisition.enable === false || typeAcquisition.disableFilenameBasedTypeAcquisition) { return []; } diff --git a/src/server/project.ts b/src/server/project.ts index 510f1291d43..1b18be8db98 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -249,6 +249,8 @@ namespace ts.server { private symlinks: SymlinkCache | undefined; /*@internal*/ autoImportProviderHost: AutoImportProviderProject | false | undefined; + /*@internal*/ + protected typeAcquisition: TypeAcquisition | undefined; /*@internal*/ constructor( @@ -631,8 +633,16 @@ namespace ts.server { } updateProjectIfDirty(this); this.builderState = BuilderState.create(this.program!, this.projectService.toCanonicalFileName, this.builderState); - return mapDefined(BuilderState.getFilesAffectedBy(this.builderState, this.program!, scriptInfo.path, this.cancellationToken, data => this.projectService.host.createHash!(data)), // TODO: GH#18217 - sourceFile => this.shouldEmitFile(this.projectService.getScriptInfoForPath(sourceFile.path)) ? sourceFile.fileName : undefined); + return mapDefined( + BuilderState.getFilesAffectedBy( + this.builderState, + this.program!, + scriptInfo.path, + this.cancellationToken, + maybeBind(this.projectService.host, this.projectService.host.createHash) + ), + sourceFile => this.shouldEmitFile(this.projectService.getScriptInfoForPath(sourceFile.path)) ? sourceFile.fileName : undefined + ); } /** @@ -654,7 +664,10 @@ namespace ts.server { const dtsFiles = outputFiles.filter(f => fileExtensionIs(f.name, Extension.Dts)); if (dtsFiles.length === 1) { const sourceFile = this.program!.getSourceFile(scriptInfo.fileName)!; - BuilderState.updateSignatureOfFile(this.builderState, this.projectService.host.createHash!(dtsFiles[0].text), sourceFile.resolvedPath); + const signature = this.projectService.host.createHash ? + this.projectService.host.createHash(dtsFiles[0].text) : + generateDjb2Hash(dtsFiles[0].text); + BuilderState.updateSignatureOfFile(this.builderState, signature, sourceFile.resolvedPath); } } } @@ -692,7 +705,6 @@ namespace ts.server { getProjectName() { return this.projectName; } - abstract getTypeAcquisition(): TypeAcquisition; protected removeLocalTypingsFromTypeAcquisition(newTypeAcquisition: TypeAcquisition): TypeAcquisition { if (!newTypeAcquisition || !newTypeAcquisition.include) { @@ -738,11 +750,8 @@ namespace ts.server { for (const f of this.program.getSourceFiles()) { this.detachScriptInfoIfNotRoot(f.fileName); } - this.program.forEachResolvedProjectReference(ref => { - if (ref) { - this.detachScriptInfoFromProject(ref.sourceFile.fileName); - } - }); + this.program.forEachResolvedProjectReference(ref => + this.detachScriptInfoFromProject(ref.sourceFile.fileName)); } // Release external files @@ -1075,7 +1084,7 @@ namespace ts.server { // bump up the version if // - oldProgram is not set - this is a first time updateGraph is called // - newProgram is different from the old program and structure of the old program was not reused. - const hasNewProgram = this.program && (!oldProgram || (this.program !== oldProgram && !(oldProgram.structureIsReused! & StructureIsReused.Completely))); + const hasNewProgram = this.program && (!oldProgram || (this.program !== oldProgram && !(this.program.structureIsReused & StructureIsReused.Completely))); if (hasNewProgram) { if (oldProgram) { for (const f of oldProgram.getSourceFiles()) { @@ -1087,8 +1096,8 @@ namespace ts.server { } } - oldProgram.forEachResolvedProjectReference((resolvedProjectReference, resolvedProjectReferencePath) => { - if (resolvedProjectReference && !this.program!.getResolvedProjectReferenceByPath(resolvedProjectReferencePath)) { + oldProgram.forEachResolvedProjectReference(resolvedProjectReference => { + if (!this.program!.getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) { this.detachScriptInfoFromProject(resolvedProjectReference.sourceFile.fileName); } }); @@ -1142,7 +1151,7 @@ namespace ts.server { } if (!this.importSuggestionsCache.isEmpty()) { - if (this.hasAddedorRemovedFiles || oldProgram && !oldProgram.structureIsReused) { + if (this.hasAddedorRemovedFiles || oldProgram && !this.program.structureIsReused) { this.importSuggestionsCache.clear(); } else if (this.dirtyFilesForSuggestions && oldProgram && this.program) { @@ -1183,7 +1192,7 @@ namespace ts.server { this.print(/*writeProjectFileNames*/ true); } else if (this.program !== oldProgram) { - this.writeLog(`Different program with same set of files:: oldProgram.structureIsReused:: ${oldProgram && oldProgram.structureIsReused}`); + this.writeLog(`Different program with same set of files:: structureIsReused:: ${this.program.structureIsReused}`); } return hasNewProgram; } @@ -1400,6 +1409,16 @@ namespace ts.server { return this.watchOptions; } + setTypeAcquisition(newTypeAcquisition: TypeAcquisition | undefined): void { + if (newTypeAcquisition) { + this.typeAcquisition = this.removeLocalTypingsFromTypeAcquisition(newTypeAcquisition); + } + } + + getTypeAcquisition() { + return this.typeAcquisition || {}; + } + /* @internal */ getChangesSinceVersion(lastKnownVersion?: number, includeProjectReferenceRedirectInfo?: boolean): ProjectFilesWithTSDiagnostics { const includeProjectReferenceRedirectInfoIfRequested = @@ -1622,6 +1641,7 @@ namespace ts.server { /*@internal*/ getPackageJsonsVisibleToFile(fileName: string, rootDir?: string): readonly PackageJsonInfo[] { + if (this.projectService.serverMode !== LanguageServiceMode.Semantic) return emptyArray; return this.projectService.getPackageJsonsVisibleToFile(fileName, rootDir); } @@ -1669,9 +1689,13 @@ namespace ts.server { if (this.autoImportProviderHost === false) { return undefined; } + if (this.projectService.serverMode !== LanguageServiceMode.Semantic) { + this.autoImportProviderHost = false; + return undefined; + } if (this.autoImportProviderHost) { updateProjectIfDirty(this.autoImportProviderHost); - if (!this.autoImportProviderHost.hasRoots()) { + if (this.autoImportProviderHost.isEmpty()) { this.autoImportProviderHost.close(); this.autoImportProviderHost = undefined; return undefined; @@ -1681,9 +1705,11 @@ namespace ts.server { const dependencySelection = this.includePackageJsonAutoImports(); if (dependencySelection) { + const start = timestamp(); this.autoImportProviderHost = AutoImportProviderProject.create(dependencySelection, this, this.getModuleResolutionHostForAutoImportProvider(), this.documentRegistry); if (this.autoImportProviderHost) { updateProjectIfDirty(this.autoImportProviderHost); + this.sendPerformanceEvent("CreatePackageJsonAutoImportProvider", timestamp() - start); return this.autoImportProviderHost.getCurrentProgram(); } } @@ -1770,7 +1796,8 @@ namespace ts.server { watchOptions: WatchOptions | undefined, projectRootPath: NormalizedPath | undefined, currentDirectory: string | undefined, - pluginConfigOverrides: ESMap | undefined) { + pluginConfigOverrides: ESMap | undefined, + typeAcquisition: TypeAcquisition | undefined) { super(InferredProject.newName(), ProjectKind.Inferred, projectService, @@ -1783,6 +1810,7 @@ namespace ts.server { watchOptions, projectService.host, currentDirectory); + this.typeAcquisition = typeAcquisition; this.projectRootPath = projectRootPath && projectService.toCanonicalFileName(projectRootPath); if (!projectRootPath && !projectService.useSingleInferredProject) { this.canonicalCurrentDirectory = projectService.toCanonicalFileName(this.currentDirectory); @@ -1828,7 +1856,7 @@ namespace ts.server { } getTypeAcquisition(): TypeAcquisition { - return { + return this.typeAcquisition || { enable: allRootFilesAreJsOrDts(this), include: ts.emptyArray, exclude: ts.emptyArray @@ -1935,6 +1963,11 @@ namespace ts.server { this.rootFileNames = initialRootNames; } + /*@internal*/ + isEmpty() { + return !some(this.rootFileNames); + } + isOrphan() { return true; } @@ -2005,7 +2038,6 @@ namespace ts.server { * Otherwise it will create an InferredProject. */ export class ConfiguredProject extends Project { - private typeAcquisition: TypeAcquisition | undefined; /* @internal */ configFileWatcher: FileWatcher | undefined; private directoriesWatchedForWildcards: ESMap | undefined; @@ -2170,6 +2202,13 @@ namespace ts.server { return program && program.getResolvedProjectReferenceToRedirect(fileName); } + /*@internal*/ + forEachResolvedProjectReference( + cb: (resolvedProjectReference: ResolvedProjectReference) => T | undefined + ): T | undefined { + return this.getCurrentProgram()?.forEachResolvedProjectReference(cb); + } + /*@internal*/ enablePluginsWithOptions(options: CompilerOptions, pluginConfigOverrides: ESMap | undefined) { const host = this.projectService.host; @@ -2217,14 +2256,6 @@ namespace ts.server { this.projectErrors = projectErrors; } - setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void { - this.typeAcquisition = this.removeLocalTypingsFromTypeAcquisition(newTypeAcquisition); - } - - getTypeAcquisition() { - return this.typeAcquisition || {}; - } - /*@internal*/ watchWildcards(wildcardDirectories: ESMap) { updateWatchingWildcardDirectories( @@ -2278,6 +2309,7 @@ namespace ts.server { getDefaultChildProjectFromProjectWithReferences(info: ScriptInfo) { return forEachResolvedProjectReferenceProject( this, + info.path, child => projectContainsInfoDirectly(child, info) ? child : undefined, @@ -2315,6 +2347,7 @@ namespace ts.server { return this.containsScriptInfo(info) || !!forEachResolvedProjectReferenceProject( this, + info.path, child => child.containsScriptInfo(info), ProjectReferenceProjectLoadKind.Find ); @@ -2343,7 +2376,6 @@ namespace ts.server { */ export class ExternalProject extends Project { excludedFiles: readonly NormalizedPath[] = []; - private typeAcquisition: TypeAcquisition | undefined; /*@internal*/ constructor(public externalProjectName: string, projectService: ProjectService, @@ -2377,18 +2409,6 @@ namespace ts.server { getExcludedFiles() { return this.excludedFiles; } - - getTypeAcquisition() { - return this.typeAcquisition || {}; - } - - setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void { - Debug.assert(!!newTypeAcquisition, "newTypeAcquisition may not be null/undefined"); - Debug.assert(!!newTypeAcquisition.include, "newTypeAcquisition.include may not be null/undefined"); - Debug.assert(!!newTypeAcquisition.exclude, "newTypeAcquisition.exclude may not be null/undefined"); - Debug.assert(typeof newTypeAcquisition.enable === "boolean", "newTypeAcquisition.enable may not be null/undefined"); - this.typeAcquisition = this.removeLocalTypingsFromTypeAcquisition(newTypeAcquisition); - } } /* @internal */ diff --git a/src/server/protocol.ts b/src/server/protocol.ts index f9f3b1910cd..0bc9f3ac0c4 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -617,6 +617,12 @@ namespace ts.server.protocol { * so this description should make sense by itself if the parent is inlineable=true */ description: string; + + /** + * A message to show to the user if the refactoring cannot be applied in + * the current context. + */ + notApplicableReason?: string; } export interface GetEditsForRefactorRequest extends Request { @@ -1756,6 +1762,11 @@ namespace ts.server.protocol { closedFiles?: string[]; } + /** + * External projects have a typeAcquisition option so they need to be added separately to compiler options for inferred projects. + */ + export type InferredProjectCompilerOptions = ExternalProjectCompilerOptions & TypeAcquisition; + /** * Request to set compiler options for inferred projects. * External projects are opened / closed explicitly. @@ -1777,7 +1788,7 @@ namespace ts.server.protocol { /** * Compiler options to be used with inferred projects. */ - options: ExternalProjectCompilerOptions; + options: InferredProjectCompilerOptions; /** * Specifies the project root path used to scope compiler options. @@ -3185,6 +3196,7 @@ namespace ts.server.protocol { insertSpaceAfterConstructor?: boolean; insertSpaceAfterKeywordsInControlFlowStatements?: boolean; insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; + insertSpaceAfterOpeningAndBeforeClosingEmptyBraces?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean; @@ -3223,6 +3235,7 @@ namespace ts.server.protocol { readonly allowTextChangesInNewFiles?: boolean; readonly lazyConfiguredProjectsFromExternalProject?: boolean; readonly providePrefixAndSuffixTextForRename?: boolean; + readonly provideRefactorNotApplicableReason?: boolean; readonly allowRenameOfImportPath?: boolean; readonly includePackageJsonAutoImports?: "auto" | "on" | "off"; } diff --git a/src/services/codefixes/convertToAsyncFunction.ts b/src/services/codefixes/convertToAsyncFunction.ts index 6474c84df9b..2b582c03035 100644 --- a/src/services/codefixes/convertToAsyncFunction.ts +++ b/src/services/codefixes/convertToAsyncFunction.ts @@ -199,7 +199,26 @@ namespace ts.codefix { } }); - return getSynthesizedDeepCloneWithRenames(nodeToRename, /*includeTrivia*/ true, identsToRenameMap, checker); + return getSynthesizedDeepCloneWithReplacements(nodeToRename, /*includeTrivia*/ true, original => { + if (isBindingElement(original) && isIdentifier(original.name) && isObjectBindingPattern(original.parent)) { + const symbol = checker.getSymbolAtLocation(original.name); + const renameInfo = symbol && identsToRenameMap.get(String(getSymbolId(symbol))); + if (renameInfo && renameInfo.text !== (original.name || original.propertyName).getText()) { + return factory.createBindingElement( + original.dotDotDotToken, + original.propertyName || original.name, + renameInfo, + original.initializer); + } + } + else if (isIdentifier(original)) { + const symbol = checker.getSymbolAtLocation(original); + const renameInfo = symbol && identsToRenameMap.get(String(getSymbolId(symbol))); + if (renameInfo) { + return factory.createIdentifier(renameInfo.text); + } + } + }); } function getNewNameIfConflict(name: Identifier, originalNames: ReadonlyESMap): SynthIdentifier { @@ -289,7 +308,7 @@ namespace ts.codefix { const tryStatement = factory.createTryStatement(tryBlock, catchClause, /*finallyBlock*/ undefined); const destructuredResult = prevArgName && varDeclIdentifier && isSynthBindingPattern(prevArgName) - && factory.createVariableStatement(/*modifiers*/ undefined, factory.createVariableDeclarationList([factory.createVariableDeclaration(getSynthesizedDeepCloneWithRenames(prevArgName.bindingPattern), /*exclamationToken*/ undefined, /*type*/ undefined, varDeclIdentifier)], NodeFlags.Const)); + && factory.createVariableStatement(/*modifiers*/ undefined, factory.createVariableDeclarationList([factory.createVariableDeclaration(getSynthesizedDeepClone(prevArgName.bindingPattern), /*exclamationToken*/ undefined, /*type*/ undefined, varDeclIdentifier)], NodeFlags.Const)); return compact([varDeclList, tryStatement, destructuredResult]); } @@ -302,7 +321,6 @@ namespace ts.codefix { const [onFulfilled, onRejected] = node.arguments; const onFulfilledArgumentName = getArgBindingName(onFulfilled, transformer); const transformationBody = getTransformationBody(onFulfilled, prevArgName, onFulfilledArgumentName, node, transformer); - if (onRejected) { const onRejectedArgumentName = getArgBindingName(onRejected, transformer); const tryBlock = factory.createBlock(transformExpression(node.expression, transformer, onFulfilledArgumentName).concat(transformationBody)); @@ -310,10 +328,8 @@ namespace ts.codefix { const catchArg = onRejectedArgumentName ? isSynthIdentifier(onRejectedArgumentName) ? onRejectedArgumentName.identifier.text : onRejectedArgumentName.bindingPattern : "e"; const catchVariableDeclaration = factory.createVariableDeclaration(catchArg); const catchClause = factory.createCatchClause(catchVariableDeclaration, factory.createBlock(transformationBody2)); - return [factory.createTryStatement(tryBlock, catchClause, /* finallyBlock */ undefined)]; } - return transformExpression(node.expression, transformer, onFulfilledArgumentName).concat(transformationBody); } @@ -395,11 +411,12 @@ namespace ts.codefix { case SyntaxKind.FunctionExpression: case SyntaxKind.ArrowFunction: { const funcBody = (func as FunctionExpression | ArrowFunction).body; + const returnType = getLastCallSignature(transformer.checker.getTypeAtLocation(func), transformer.checker)?.getReturnType(); + // Arrow functions with block bodies { } will enter this control flow if (isBlock(funcBody)) { let refactoredStmts: Statement[] = []; let seenReturnStatement = false; - for (const statement of funcBody.statements) { if (isReturnStatement(statement)) { seenReturnStatement = true; @@ -407,7 +424,8 @@ namespace ts.codefix { refactoredStmts = refactoredStmts.concat(getInnerTransformationBody(transformer, [statement], prevArgName)); } else { - refactoredStmts.push(...maybeAnnotateAndReturn(statement.expression, parent.typeArguments?.[0])); + const possiblyAwaitedRightHandSide = returnType && statement.expression ? getPossiblyAwaitedRightHandSide(transformer.checker, returnType, statement.expression) : statement.expression; + refactoredStmts.push(...maybeAnnotateAndReturn(possiblyAwaitedRightHandSide, parent.typeArguments?.[0])); } } else { @@ -431,19 +449,21 @@ namespace ts.codefix { return innerCbBody; } - const type = transformer.checker.getTypeAtLocation(func); - const returnType = getLastCallSignature(type, transformer.checker)!.getReturnType(); - const rightHandSide = getSynthesizedDeepClone(funcBody); - const possiblyAwaitedRightHandSide = !!transformer.checker.getPromisedTypeOfPromise(returnType) ? factory.createAwaitExpression(rightHandSide) : rightHandSide; - if (!shouldReturn(parent, transformer)) { - const transformedStatement = createVariableOrAssignmentOrExpressionStatement(prevArgName, possiblyAwaitedRightHandSide, /*typeAnnotation*/ undefined); - if (prevArgName) { - prevArgName.types.push(returnType); + if (returnType) { + const possiblyAwaitedRightHandSide = getPossiblyAwaitedRightHandSide(transformer.checker, returnType, funcBody); + if (!shouldReturn(parent, transformer)) { + const transformedStatement = createVariableOrAssignmentOrExpressionStatement(prevArgName, possiblyAwaitedRightHandSide, /*typeAnnotation*/ undefined); + if (prevArgName) { + prevArgName.types.push(returnType); + } + return transformedStatement; + } + else { + return maybeAnnotateAndReturn(possiblyAwaitedRightHandSide, parent.typeArguments?.[0]); } - return transformedStatement; } else { - return maybeAnnotateAndReturn(possiblyAwaitedRightHandSide, parent.typeArguments?.[0]); + return silentFail(); } } } @@ -454,12 +474,16 @@ namespace ts.codefix { return emptyArray; } + function getPossiblyAwaitedRightHandSide(checker: TypeChecker, type: Type, expr: Expression): AwaitExpression | Expression { + const rightHandSide = getSynthesizedDeepClone(expr); + return !!checker.getPromisedTypeOfPromise(type) ? factory.createAwaitExpression(rightHandSide) : rightHandSide; + } + function getLastCallSignature(type: Type, checker: TypeChecker): Signature | undefined { const callSignatures = checker.getSignaturesOfType(type, SignatureKind.Call); return lastOrUndefined(callSignatures); } - function removeReturns(stmts: readonly Statement[], prevArgName: SynthBindingName | undefined, transformer: Transformer, seenReturnStatement: boolean): readonly Statement[] { const ret: Statement[] = []; for (const stmt of stmts) { diff --git a/src/services/codefixes/convertToEs6Module.ts b/src/services/codefixes/convertToEs6Module.ts index 34522f127d2..963f8923ee6 100644 --- a/src/services/codefixes/convertToEs6Module.ts +++ b/src/services/codefixes/convertToEs6Module.ts @@ -44,10 +44,24 @@ namespace ts.codefix { const exports = collectExportRenames(sourceFile, checker, identifiers); convertExportsAccesses(sourceFile, exports, changes); let moduleExportsChangedToDefault = false; - for (const statement of sourceFile.statements) { - const moduleExportsChanged = convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, quotePreference); + let useSitesToUnqualify: ESMap | undefined; + // Process variable statements first to collect use sites that need to be updated inside other transformations + for (const statement of filter(sourceFile.statements, isVariableStatement)) { + const newUseSites = convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); + if (newUseSites) { + copyEntries(newUseSites, useSitesToUnqualify ??= new Map()); + } + } + // `convertStatement` will delete entries from `useSitesToUnqualify` when containing statements are replaced + for (const statement of filter(sourceFile.statements, s => !isVariableStatement(s))) { + const moduleExportsChanged = convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, useSitesToUnqualify, quotePreference); moduleExportsChangedToDefault = moduleExportsChangedToDefault || moduleExportsChanged; } + // Remaining use sites can be changed directly + useSitesToUnqualify?.forEach((replacement, original) => { + changes.replaceNode(sourceFile, original, replacement); + }); + return moduleExportsChangedToDefault; } @@ -98,7 +112,17 @@ namespace ts.codefix { /** Whether `module.exports =` was changed to `export default` */ type ModuleExportsChanged = boolean; - function convertStatement(sourceFile: SourceFile, statement: Statement, checker: TypeChecker, changes: textChanges.ChangeTracker, identifiers: Identifiers, target: ScriptTarget, exports: ExportRenames, quotePreference: QuotePreference): ModuleExportsChanged { + function convertStatement( + sourceFile: SourceFile, + statement: Statement, + checker: TypeChecker, + changes: textChanges.ChangeTracker, + identifiers: Identifiers, + target: ScriptTarget, + exports: ExportRenames, + useSitesToUnqualify: ESMap | undefined, + quotePreference: QuotePreference + ): ModuleExportsChanged { switch (statement.kind) { case SyntaxKind.VariableStatement: convertVariableStatement(sourceFile, statement as VariableStatement, changes, checker, identifiers, target, quotePreference); @@ -115,7 +139,7 @@ namespace ts.codefix { } case SyntaxKind.BinaryExpression: { const { operatorToken } = expression as BinaryExpression; - return operatorToken.kind === SyntaxKind.EqualsToken && convertAssignment(sourceFile, checker, expression as BinaryExpression, changes, exports); + return operatorToken.kind === SyntaxKind.EqualsToken && convertAssignment(sourceFile, checker, expression as BinaryExpression, changes, exports, useSitesToUnqualify); } } } @@ -133,20 +157,20 @@ namespace ts.codefix { identifiers: Identifiers, target: ScriptTarget, quotePreference: QuotePreference, - ): void { + ): ESMap | undefined { const { declarationList } = statement; let foundImport = false; - const newNodes = flatMap(declarationList.declarations, decl => { + const converted = map(declarationList.declarations, decl => { const { name, initializer } = decl; if (initializer) { if (isExportsOrModuleExportsOrAlias(sourceFile, initializer)) { // `const alias = module.exports;` can be removed. foundImport = true; - return []; + return convertedImports([]); } else if (isRequireCall(initializer, /*checkArgumentIsStringLiteralLike*/ true)) { foundImport = true; - return convertSingleImport(sourceFile, name, initializer.arguments[0], changes, checker, identifiers, target, quotePreference); + return convertSingleImport(name, initializer.arguments[0], checker, identifiers, target, quotePreference); } else if (isPropertyAccessExpression(initializer) && isRequireCall(initializer.expression, /*checkArgumentIsStringLiteralLike*/ true)) { foundImport = true; @@ -154,29 +178,37 @@ namespace ts.codefix { } } // Move it out to its own variable statement. (This will not be used if `!foundImport`) - return factory.createVariableStatement(/*modifiers*/ undefined, factory.createVariableDeclarationList([decl], declarationList.flags)); + return convertedImports([factory.createVariableStatement(/*modifiers*/ undefined, factory.createVariableDeclarationList([decl], declarationList.flags))]); }); if (foundImport) { // useNonAdjustedEndPosition to ensure we don't eat the newline after the statement. - changes.replaceNodeWithNodes(sourceFile, statement, newNodes); + changes.replaceNodeWithNodes(sourceFile, statement, flatMap(converted, c => c.newImports)); + let combinedUseSites: ESMap | undefined; + forEach(converted, c => { + if (c.useSitesToUnqualify) { + copyEntries(c.useSitesToUnqualify, combinedUseSites ??= new Map()); + } + }); + + return combinedUseSites; } } /** Converts `const name = require("moduleSpecifier").propertyName` */ - function convertPropertyAccessImport(name: BindingName, propertyName: string, moduleSpecifier: StringLiteralLike, identifiers: Identifiers, quotePreference: QuotePreference): readonly Node[] { + function convertPropertyAccessImport(name: BindingName, propertyName: string, moduleSpecifier: StringLiteralLike, identifiers: Identifiers, quotePreference: QuotePreference): ConvertedImports { switch (name.kind) { case SyntaxKind.ObjectBindingPattern: case SyntaxKind.ArrayBindingPattern: { // `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;` const tmp = makeUniqueName(propertyName, identifiers); - return [ + return convertedImports([ makeSingleImport(tmp, propertyName, moduleSpecifier, quotePreference), makeConst(/*modifiers*/ undefined, name, factory.createIdentifier(tmp)), - ]; + ]); } case SyntaxKind.Identifier: // `const a = require("b").c` --> `import { c as a } from "./b"; - return [makeSingleImport(name.text, propertyName, moduleSpecifier, quotePreference)]; + return convertedImports([makeSingleImport(name.text, propertyName, moduleSpecifier, quotePreference)]); default: return Debug.assertNever(name, `Convert to ES6 module got invalid syntax form ${(name as BindingName).kind}`); } @@ -188,6 +220,7 @@ namespace ts.codefix { assignment: BinaryExpression, changes: textChanges.ChangeTracker, exports: ExportRenames, + useSitesToUnqualify: ESMap | undefined, ): ModuleExportsChanged { const { left, right } = assignment; if (!isPropertyAccessExpression(left)) { @@ -200,7 +233,7 @@ namespace ts.codefix { changes.delete(sourceFile, assignment.parent); } else { - const replacement = isObjectLiteralExpression(right) ? tryChangeModuleExportsObject(right) + const replacement = isObjectLiteralExpression(right) ? tryChangeModuleExportsObject(right, useSitesToUnqualify) : isRequireCall(right, /*checkArgumentIsStringLiteralLike*/ true) ? convertReExportAll(right.arguments[0], checker) : undefined; if (replacement) { @@ -224,7 +257,7 @@ namespace ts.codefix { * Convert `module.exports = { ... }` to individual exports.. * We can't always do this if the module has interesting members -- then it will be a default export instead. */ - function tryChangeModuleExportsObject(object: ObjectLiteralExpression): [readonly Statement[], ModuleExportsChanged] | undefined { + function tryChangeModuleExportsObject(object: ObjectLiteralExpression, useSitesToUnqualify: ESMap | undefined): [readonly Statement[], ModuleExportsChanged] | undefined { const statements = mapAllOrFail(object.properties, prop => { switch (prop.kind) { case SyntaxKind.GetAccessor: @@ -235,9 +268,9 @@ namespace ts.codefix { case SyntaxKind.SpreadAssignment: return undefined; case SyntaxKind.PropertyAssignment: - return !isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer); + return !isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); case SyntaxKind.MethodDeclaration: - return !isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [factory.createToken(SyntaxKind.ExportKeyword)], prop); + return !isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [factory.createToken(SyntaxKind.ExportKeyword)], prop, useSitesToUnqualify); default: Debug.assertNever(prop, `Convert to ES6 got invalid prop kind ${(prop as ObjectLiteralElementLike).kind}`); } @@ -307,7 +340,7 @@ namespace ts.codefix { } // TODO: GH#22492 this will cause an error if a change has been made inside the body of the node. - function convertExportsDotXEquals_replaceNode(name: string | undefined, exported: Expression): Statement { + function convertExportsDotXEquals_replaceNode(name: string | undefined, exported: Expression, useSitesToUnqualify: ESMap | undefined): Statement { const modifiers = [factory.createToken(SyntaxKind.ExportKeyword)]; switch (exported.kind) { case SyntaxKind.FunctionExpression: { @@ -321,17 +354,39 @@ namespace ts.codefix { // falls through case SyntaxKind.ArrowFunction: // `exports.f = function() {}` --> `export function f() {}` - return functionExpressionToDeclaration(name, modifiers, exported as FunctionExpression | ArrowFunction); + return functionExpressionToDeclaration(name, modifiers, exported as FunctionExpression | ArrowFunction, useSitesToUnqualify); case SyntaxKind.ClassExpression: // `exports.C = class {}` --> `export class C {}` - return classExpressionToDeclaration(name, modifiers, exported as ClassExpression); + return classExpressionToDeclaration(name, modifiers, exported as ClassExpression, useSitesToUnqualify); default: return exportConst(); } function exportConst() { // `exports.x = 0;` --> `export const x = 0;` - return makeConst(modifiers, factory.createIdentifier(name!), exported); // TODO: GH#18217 + return makeConst(modifiers, factory.createIdentifier(name!), replaceImportUseSites(exported, useSitesToUnqualify)); // TODO: GH#18217 + } + } + + function replaceImportUseSites(node: T, useSitesToUnqualify: ESMap | undefined): T; + function replaceImportUseSites(nodes: NodeArray, useSitesToUnqualify: ESMap | undefined): NodeArray; + function replaceImportUseSites(nodeOrNodes: T | NodeArray, useSitesToUnqualify: ESMap | undefined) { + if (!useSitesToUnqualify || !some(arrayFrom(useSitesToUnqualify.keys()), original => rangeContainsRange(nodeOrNodes, original))) { + return nodeOrNodes; + } + + return isArray(nodeOrNodes) + ? getSynthesizedDeepClonesWithReplacements(nodeOrNodes, /*includeTrivia*/ true, replaceNode) + : getSynthesizedDeepCloneWithReplacements(nodeOrNodes, /*includeTrivia*/ true, replaceNode); + + function replaceNode(original: Node) { + // We are replacing `mod.SomeExport` wih `SomeExport`, so we only need to look at PropertyAccessExpressions + if (original.kind === SyntaxKind.PropertyAccessExpression) { + const replacement = useSitesToUnqualify!.get(original); + // Remove entry from `useSitesToUnqualify` so the refactor knows it's taken care of by the parent statement we're replacing + useSitesToUnqualify!.delete(original); + return replacement; + } } } @@ -341,15 +396,13 @@ namespace ts.codefix { * May also make use `changes` to remove qualifiers at the use sites of imports, to change `mod.x` to `x`. */ function convertSingleImport( - file: SourceFile, name: BindingName, moduleSpecifier: StringLiteralLike, - changes: textChanges.ChangeTracker, checker: TypeChecker, identifiers: Identifiers, target: ScriptTarget, quotePreference: QuotePreference, - ): readonly Node[] { + ): ConvertedImports { switch (name.kind) { case SyntaxKind.ObjectBindingPattern: { const importSpecifiers = mapAllOrFail(name.elements, e => @@ -359,7 +412,7 @@ namespace ts.codefix { // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion : makeImportSpecifier(e.propertyName && (e.propertyName as Identifier).text, e.name.text)); if (importSpecifiers) { - return [makeImport(/*name*/ undefined, importSpecifiers, moduleSpecifier, quotePreference)]; + return convertedImports([makeImport(/*name*/ undefined, importSpecifiers, moduleSpecifier, quotePreference)]); } } // falls through -- object destructuring has an interesting pattern and must be a variable declaration @@ -369,13 +422,13 @@ namespace ts.codefix { const [a, b, c] = x; */ const tmp = makeUniqueName(moduleSpecifierToValidIdentifier(moduleSpecifier.text, target), identifiers); - return [ + return convertedImports([ makeImport(factory.createIdentifier(tmp), /*namedImports*/ undefined, moduleSpecifier, quotePreference), makeConst(/*modifiers*/ undefined, getSynthesizedDeepClone(name), factory.createIdentifier(tmp)), - ]; + ]); } case SyntaxKind.Identifier: - return convertSingleIdentifierImport(file, name, moduleSpecifier, changes, checker, identifiers, quotePreference); + return convertSingleIdentifierImport(name, moduleSpecifier, checker, identifiers, quotePreference); default: return Debug.assertNever(name, `Convert to ES6 module got invalid name kind ${(name as BindingName).kind}`); } @@ -385,12 +438,13 @@ namespace ts.codefix { * Convert `import x = require("x").` * Also converts uses like `x.y()` to `y()` and uses a named import. */ - function convertSingleIdentifierImport(file: SourceFile, name: Identifier, moduleSpecifier: StringLiteralLike, changes: textChanges.ChangeTracker, checker: TypeChecker, identifiers: Identifiers, quotePreference: QuotePreference): readonly Node[] { + function convertSingleIdentifierImport(name: Identifier, moduleSpecifier: StringLiteralLike, checker: TypeChecker, identifiers: Identifiers, quotePreference: QuotePreference): ConvertedImports { const nameSymbol = checker.getSymbolAtLocation(name); // Maps from module property name to name actually used. (The same if there isn't shadowing.) const namedBindingsNames = new Map(); // True if there is some non-property use like `x()` or `f(x)`. let needDefaultImport = false; + let useSitesToUnqualify: ESMap | undefined; for (const use of identifiers.original.get(name.text)!) { if (checker.getSymbolAtLocation(use) !== nameSymbol || use === name) { @@ -407,7 +461,8 @@ namespace ts.codefix { idName = makeUniqueName(propertyName, identifiers); namedBindingsNames.set(propertyName, idName); } - changes.replaceNode(file, parent, factory.createIdentifier(idName)); + + (useSitesToUnqualify ??= new Map()).set(parent, factory.createIdentifier(idName)); } else { needDefaultImport = true; @@ -420,7 +475,10 @@ namespace ts.codefix { // If it was unused, ensure that we at least import *something*. needDefaultImport = true; } - return [makeImport(needDefaultImport ? getSynthesizedDeepClone(name) : undefined, namedBindings, moduleSpecifier, quotePreference)]; + return convertedImports( + [makeImport(needDefaultImport ? getSynthesizedDeepClone(name) : undefined, namedBindings, moduleSpecifier, quotePreference)], + useSitesToUnqualify + ); } // Identifiers helpers @@ -476,7 +534,7 @@ namespace ts.codefix { // Node helpers - function functionExpressionToDeclaration(name: string | undefined, additionalModifiers: readonly Modifier[], fn: FunctionExpression | ArrowFunction | MethodDeclaration): FunctionDeclaration { + function functionExpressionToDeclaration(name: string | undefined, additionalModifiers: readonly Modifier[], fn: FunctionExpression | ArrowFunction | MethodDeclaration, useSitesToUnqualify: ESMap | undefined): FunctionDeclaration { return factory.createFunctionDeclaration( getSynthesizedDeepClones(fn.decorators), // TODO: GH#19915 Don't think this is even legal. concatenate(additionalModifiers, getSynthesizedDeepClones(fn.modifiers)), @@ -485,17 +543,17 @@ namespace ts.codefix { getSynthesizedDeepClones(fn.typeParameters), getSynthesizedDeepClones(fn.parameters), getSynthesizedDeepClone(fn.type), - factory.converters.convertToFunctionBlock(getSynthesizedDeepClone(fn.body!))); + factory.converters.convertToFunctionBlock(replaceImportUseSites(fn.body!, useSitesToUnqualify))); } - function classExpressionToDeclaration(name: string | undefined, additionalModifiers: readonly Modifier[], cls: ClassExpression): ClassDeclaration { + function classExpressionToDeclaration(name: string | undefined, additionalModifiers: readonly Modifier[], cls: ClassExpression, useSitesToUnqualify: ESMap | undefined): ClassDeclaration { return factory.createClassDeclaration( getSynthesizedDeepClones(cls.decorators), // TODO: GH#19915 Don't think this is even legal. concatenate(additionalModifiers, getSynthesizedDeepClones(cls.modifiers)), name, getSynthesizedDeepClones(cls.typeParameters), getSynthesizedDeepClones(cls.heritageClauses), - getSynthesizedDeepClones(cls.members)); + replaceImportUseSites(cls.members, useSitesToUnqualify)); } function makeSingleImport(localName: string, propertyName: string, moduleSpecifier: StringLiteralLike, quotePreference: QuotePreference): ImportDeclaration { @@ -524,4 +582,16 @@ namespace ts.codefix { exportSpecifiers && factory.createNamedExports(exportSpecifiers), moduleSpecifier === undefined ? undefined : factory.createStringLiteral(moduleSpecifier)); } + + interface ConvertedImports { + newImports: readonly Node[]; + useSitesToUnqualify?: ESMap; + } + + function convertedImports(newImports: readonly Node[], useSitesToUnqualify?: ESMap): ConvertedImports { + return { + newImports, + useSitesToUnqualify + }; + } } diff --git a/src/services/codefixes/convertToTypeOnlyExport.ts b/src/services/codefixes/convertToTypeOnlyExport.ts index cc36a7e7a86..117aca7b983 100644 --- a/src/services/codefixes/convertToTypeOnlyExport.ts +++ b/src/services/codefixes/convertToTypeOnlyExport.ts @@ -15,7 +15,7 @@ namespace ts.codefix { const fixedExportDeclarations = new Map(); return codeFixAll(context, errorCodes, (changes, diag) => { const exportSpecifier = getExportSpecifierForDiagnosticSpan(diag, context.sourceFile); - if (exportSpecifier && !addToSeen(fixedExportDeclarations, getNodeId(exportSpecifier.parent.parent))) { + if (exportSpecifier && addToSeen(fixedExportDeclarations, getNodeId(exportSpecifier.parent.parent))) { fixSingleExportDeclaration(changes, exportSpecifier, context); } }); @@ -35,16 +35,7 @@ namespace ts.codefix { const exportDeclaration = exportClause.parent; const typeExportSpecifiers = getTypeExportSpecifiers(exportSpecifier, context); if (typeExportSpecifiers.length === exportClause.elements.length) { - changes.replaceNode( - context.sourceFile, - exportDeclaration, - factory.updateExportDeclaration( - exportDeclaration, - exportDeclaration.decorators, - exportDeclaration.modifiers, - /*isTypeOnly*/ true, - exportClause, - exportDeclaration.moduleSpecifier)); + changes.insertModifierBefore(context.sourceFile, SyntaxKind.TypeKeyword, exportClause); } else { const valueExportDeclaration = factory.updateExportDeclaration( @@ -61,7 +52,10 @@ namespace ts.codefix { factory.createNamedExports(typeExportSpecifiers), exportDeclaration.moduleSpecifier); - changes.replaceNode(context.sourceFile, exportDeclaration, valueExportDeclaration); + changes.replaceNode(context.sourceFile, exportDeclaration, valueExportDeclaration, { + leadingTriviaOption: textChanges.LeadingTriviaOption.IncludeAll, + trailingTriviaOption: textChanges.TrailingTriviaOption.Exclude + }); changes.insertNodeAfter(context.sourceFile, exportDeclaration, typeExportDeclaration); } } diff --git a/src/services/codefixes/fixInvalidJsxCharacters.ts b/src/services/codefixes/fixInvalidJsxCharacters.ts index 67ce26efd65..06c91c34953 100644 --- a/src/services/codefixes/fixInvalidJsxCharacters.ts +++ b/src/services/codefixes/fixInvalidJsxCharacters.ts @@ -42,7 +42,7 @@ namespace ts.codefix { return; } - const replacement = useHtmlEntity ? htmlEntity[character] : `{${quote(character, preferences)}}`; + const replacement = useHtmlEntity ? htmlEntity[character] : `{${quote(sourceFile, preferences, character)}}`; changes.replaceRangeWithText(sourceFile, { pos: start, end: start + 1 }, replacement); } } diff --git a/src/services/codefixes/fixPropertyOverrideAccessor.ts b/src/services/codefixes/fixPropertyOverrideAccessor.ts index 1941b5ccd58..7879860cbad 100644 --- a/src/services/codefixes/fixPropertyOverrideAccessor.ts +++ b/src/services/codefixes/fixPropertyOverrideAccessor.ts @@ -52,6 +52,6 @@ namespace ts.codefix { else { Debug.fail("fixPropertyOverrideAccessor codefix got unexpected error code " + code); } - return generateAccessorFromProperty(file, startPosition, endPosition, context, Diagnostics.Generate_get_and_set_accessors.message); + return generateAccessorFromProperty(file, context.program, startPosition, endPosition, context, Diagnostics.Generate_get_and_set_accessors.message); } } diff --git a/src/services/codefixes/generateAccessors.ts b/src/services/codefixes/generateAccessors.ts index 518278d041c..f2b397cca3e 100644 --- a/src/services/codefixes/generateAccessors.ts +++ b/src/services/codefixes/generateAccessors.ts @@ -24,8 +24,8 @@ namespace ts.codefix { error: string }; - export function generateAccessorFromProperty(file: SourceFile, start: number, end: number, context: textChanges.TextChangesContext, _actionName: string): FileTextChanges[] | undefined { - const fieldInfo = getAccessorConvertiblePropertyAtPosition(file, start, end); + export function generateAccessorFromProperty(file: SourceFile, program: Program, start: number, end: number, context: textChanges.TextChangesContext, _actionName: string): FileTextChanges[] | undefined { + const fieldInfo = getAccessorConvertiblePropertyAtPosition(file, program, start, end); if (!fieldInfo || !fieldInfo.info) return undefined; const changeTracker = textChanges.ChangeTracker.fromContext(context); @@ -51,7 +51,7 @@ namespace ts.codefix { } } - updateFieldDeclaration(changeTracker, file, declaration, fieldName, fieldModifiers); + updateFieldDeclaration(changeTracker, file, declaration, type, fieldName, fieldModifiers); const getAccessor = generateGetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container); suppressLeadingAndTrailingTrivia(getAccessor); @@ -112,7 +112,7 @@ namespace ts.codefix { return modifierFlags; } - export function getAccessorConvertiblePropertyAtPosition(file: SourceFile, start: number, end: number, considerEmptySpans = true): InfoOrError | undefined { + export function getAccessorConvertiblePropertyAtPosition(file: SourceFile, program: Program, start: number, end: number, considerEmptySpans = true): InfoOrError | undefined { const node = getTokenAtPosition(file, start); const cursorRequest = start === end && considerEmptySpans; const declaration = findAncestor(node.parent, isAcceptedDeclaration); @@ -145,7 +145,7 @@ namespace ts.codefix { info: { isStatic: hasStaticModifier(declaration), isReadonly: hasEffectiveReadonlyModifier(declaration), - type: getTypeAnnotationNode(declaration), + type: getDeclarationType(declaration, program), container: declaration.kind === SyntaxKind.Parameter ? declaration.parent.parent : declaration.parent, originalName: (declaration.name).text, declaration, @@ -195,14 +195,14 @@ namespace ts.codefix { ); } - function updatePropertyDeclaration(changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: PropertyDeclaration, fieldName: AcceptedNameType, modifiers: ModifiersArray | undefined) { + function updatePropertyDeclaration(changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: PropertyDeclaration, type: TypeNode | undefined, fieldName: AcceptedNameType, modifiers: ModifiersArray | undefined) { const property = factory.updatePropertyDeclaration( declaration, declaration.decorators, modifiers, fieldName, declaration.questionToken || declaration.exclamationToken, - declaration.type, + type, declaration.initializer ); changeTracker.replaceNode(file, declaration, property); @@ -213,9 +213,9 @@ namespace ts.codefix { changeTracker.replacePropertyAssignment(file, declaration, assignment); } - function updateFieldDeclaration(changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: AcceptedDeclaration, fieldName: AcceptedNameType, modifiers: ModifiersArray | undefined) { + function updateFieldDeclaration(changeTracker: textChanges.ChangeTracker, file: SourceFile, declaration: AcceptedDeclaration, type: TypeNode | undefined, fieldName: AcceptedNameType, modifiers: ModifiersArray | undefined) { if (isPropertyDeclaration(declaration)) { - updatePropertyDeclaration(changeTracker, file, declaration, fieldName, modifiers); + updatePropertyDeclaration(changeTracker, file, declaration, type, fieldName, modifiers); } else if (isPropertyAssignment(declaration)) { updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName); @@ -251,6 +251,19 @@ namespace ts.codefix { }); } + function getDeclarationType(declaration: AcceptedDeclaration, program: Program): TypeNode | undefined { + const typeNode = getTypeAnnotationNode(declaration); + if (isPropertyDeclaration(declaration) && typeNode && declaration.questionToken) { + const typeChecker = program.getTypeChecker(); + const type = typeChecker.getTypeFromTypeNode(typeNode); + if (!typeChecker.isTypeAssignableTo(typeChecker.getUndefinedType(), type)) { + const types = isUnionTypeNode(typeNode) ? typeNode.types : [typeNode]; + return factory.createUnionTypeNode([...types, factory.createKeywordTypeNode(SyntaxKind.UndefinedKeyword)]); + } + } + return typeNode; + } + export function getAllSupers(decl: ClassOrInterface | undefined, checker: TypeChecker): readonly ClassOrInterface[] { const res: ClassLikeDeclaration[] = []; while (decl) { diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 291dbdf5514..407903390ef 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -64,7 +64,7 @@ namespace ts.codefix { const symbol = checker.getMergedSymbol(skipAlias(exportedSymbol, checker)); const exportInfos = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, host, program, useAutoImportProvider); const preferTypeOnlyImport = !!usageIsTypeOnly && compilerOptions.importsNotUsedAsValues === ImportsNotUsedAsValues.Error; - const useRequire = shouldUseRequire(sourceFile, compilerOptions); + const useRequire = shouldUseRequire(sourceFile, program); const fix = getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, /*position*/ undefined, preferTypeOnlyImport, useRequire, host, preferences); addImport({ fixes: [fix], symbolName }); } @@ -211,7 +211,7 @@ namespace ts.codefix { ): { readonly moduleSpecifier: string, readonly codeAction: CodeAction } { const compilerOptions = program.getCompilerOptions(); const exportInfos = getAllReExportingModules(sourceFile, exportedSymbol, moduleSymbol, symbolName, host, program, /*useAutoImportProvider*/ true); - const useRequire = shouldUseRequire(sourceFile, compilerOptions); + const useRequire = shouldUseRequire(sourceFile, program); const preferTypeOnlyImport = compilerOptions.importsNotUsedAsValues === ImportsNotUsedAsValues.Error && !isSourceFileJS(sourceFile) && isValidTypeOnlyAliasUseSite(getTokenAtPosition(sourceFile, position)); const moduleSpecifier = first(getNewImportInfos(program, sourceFile, position, preferTypeOnlyImport, useRequire, exportInfos, host, preferences)).moduleSpecifier; const fix = getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, preferTypeOnlyImport, useRequire, host, preferences); @@ -239,7 +239,7 @@ namespace ts.codefix { } const defaultInfo = getDefaultLikeExportInfo(importingFile, moduleSymbol, checker, compilerOptions); - if (defaultInfo && defaultInfo.name === symbolName && skipAlias(defaultInfo.symbol, checker) === exportedSymbol) { + if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) === symbolName) && skipAlias(defaultInfo.symbol, checker) === exportedSymbol) { result.push({ moduleSymbol, importKind: defaultInfo.kind, exportedSymbolIsTypeOnly: isTypeOnlySymbol(defaultInfo.symbol, checker) }); } @@ -362,10 +362,31 @@ namespace ts.codefix { }); } - function shouldUseRequire(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean { - return isSourceFileJS(sourceFile) - && !sourceFile.externalModuleIndicator - && (!!sourceFile.commonJsModuleIndicator || getEmitModuleKind(compilerOptions) < ModuleKind.ES2015); + function shouldUseRequire(sourceFile: SourceFile, program: Program): boolean { + // 1. TypeScript files don't use require variable declarations + if (!isSourceFileJS(sourceFile)) { + return false; + } + + // 2. If the current source file is unambiguously CJS or ESM, go with that + if (sourceFile.commonJsModuleIndicator && !sourceFile.externalModuleIndicator) return true; + if (sourceFile.externalModuleIndicator && !sourceFile.commonJsModuleIndicator) return false; + + // 3. If there's a tsconfig/jsconfig, use its module setting + const compilerOptions = program.getCompilerOptions(); + if (compilerOptions.configFile) { + return getEmitModuleKind(compilerOptions) < ModuleKind.ES2015; + } + + // 4. Match the first other JS file in the program that's unambiguously CJS or ESM + for (const otherFile of program.getSourceFiles()) { + if (otherFile === sourceFile || !isSourceFileJS(otherFile) || program.isSourceFileFromExternalLibrary(otherFile)) continue; + if (otherFile.commonJsModuleIndicator && !otherFile.externalModuleIndicator) return true; + if (otherFile.externalModuleIndicator && !otherFile.commonJsModuleIndicator) return false; + } + + // 5. Literally nothing to go on + return true; } function getNewImportInfos( @@ -445,7 +466,7 @@ namespace ts.codefix { const symbol = checker.getAliasedSymbol(umdSymbol); const symbolName = umdSymbol.name; const exportInfos: readonly SymbolExportInfo[] = [{ moduleSymbol: symbol, importKind: getUmdImportKind(sourceFile, program.getCompilerOptions()), exportedSymbolIsTypeOnly: false }]; - const useRequire = shouldUseRequire(sourceFile, program.getCompilerOptions()); + const useRequire = shouldUseRequire(sourceFile, program); const fixes = getFixForImport(exportInfos, symbolName, isIdentifier(token) ? token.getStart(sourceFile) : undefined, /*preferTypeOnlyImport*/ false, useRequire, program, sourceFile, host, preferences); return { fixes, symbolName }; } @@ -497,8 +518,8 @@ namespace ts.codefix { const compilerOptions = program.getCompilerOptions(); const preferTypeOnlyImport = compilerOptions.importsNotUsedAsValues === ImportsNotUsedAsValues.Error && isValidTypeOnlyAliasUseSite(symbolToken); - const useRequire = shouldUseRequire(sourceFile, compilerOptions); - const exportInfos = getExportInfos(symbolName, getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, checker, program, useAutoImportProvider, host); + const useRequire = shouldUseRequire(sourceFile, program); + const exportInfos = getExportInfos(symbolName, getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host); const fixes = arrayFrom(flatMapIterator(exportInfos.entries(), ([_, exportInfos]) => getFixForImport(exportInfos, symbolName, symbolToken.getStart(sourceFile), preferTypeOnlyImport, useRequire, program, sourceFile, host, preferences))); return { fixes, symbolName }; @@ -521,7 +542,6 @@ namespace ts.codefix { currentTokenMeaning: SemanticMeaning, cancellationToken: CancellationToken, sourceFile: SourceFile, - checker: TypeChecker, program: Program, useAutoImportProvider: boolean, host: LanguageServiceHost @@ -529,21 +549,23 @@ namespace ts.codefix { // For each original symbol, keep all re-exports of that symbol together so we can call `getCodeActionsForImport` on the whole group at once. // Maps symbol id to info for modules providing that symbol (original export + re-exports). const originalSymbolToExportInfos = createMultiMap(); - function addSymbol(moduleSymbol: Symbol, exportedSymbol: Symbol, importKind: ImportKind): void { + function addSymbol(moduleSymbol: Symbol, exportedSymbol: Symbol, importKind: ImportKind, checker: TypeChecker): void { originalSymbolToExportInfos.add(getUniqueSymbolId(exportedSymbol, checker).toString(), { moduleSymbol, importKind, exportedSymbolIsTypeOnly: isTypeOnlySymbol(exportedSymbol, checker) }); } - forEachExternalModuleToImportFrom(program, host, sourceFile, /*filterByPackageJson*/ true, useAutoImportProvider, moduleSymbol => { + forEachExternalModuleToImportFrom(program, host, sourceFile, /*filterByPackageJson*/ true, useAutoImportProvider, (moduleSymbol, _, program) => { + const checker = program.getTypeChecker(); cancellationToken.throwIfCancellationRequested(); - const defaultInfo = getDefaultLikeExportInfo(sourceFile, moduleSymbol, checker, program.getCompilerOptions()); - if (defaultInfo && defaultInfo.name === symbolName && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) { - addSymbol(moduleSymbol, defaultInfo.symbol, defaultInfo.kind); + const compilerOptions = program.getCompilerOptions(); + const defaultInfo = getDefaultLikeExportInfo(sourceFile, moduleSymbol, checker, compilerOptions); + if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) === symbolName) && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) { + addSymbol(moduleSymbol, defaultInfo.symbol, defaultInfo.kind, checker); } // check exports with the same name const exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExportsAndProperties(symbolName, moduleSymbol); if (exportSymbolWithIdenticalName && symbolHasMeaning(exportSymbolWithIdenticalName, currentTokenMeaning)) { - addSymbol(moduleSymbol, exportSymbolWithIdenticalName, ImportKind.Named); + addSymbol(moduleSymbol, exportSymbolWithIdenticalName, ImportKind.Named, checker); } }); return originalSymbolToExportInfos; @@ -600,14 +622,20 @@ namespace ts.codefix { if (defaultExport.flags & SymbolFlags.Alias) { const aliased = checker.getImmediateAliasedSymbol(defaultExport); - return aliased && getDefaultExportInfoWorker(aliased, Debug.checkDefined(aliased.parent, "Alias targets of default exports must have a parent"), checker, compilerOptions); + if (aliased && aliased.parent) { + // - `aliased` will be undefined if the module is exporting an unresolvable name, + // but we can still offer completions for it. + // - `aliased.parent` will be undefined if the module is exporting `globalThis.something`, + // or another expression that resolves to a global. + return getDefaultExportInfoWorker(aliased, aliased.parent, checker, compilerOptions); + } } if (defaultExport.escapedName !== InternalSymbolName.Default && defaultExport.escapedName !== InternalSymbolName.ExportEquals) { return { symbolForMeaning: defaultExport, name: defaultExport.getName() }; } - return { symbolForMeaning: defaultExport, name: moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target!) }; + return { symbolForMeaning: defaultExport, name: moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) }; } function getNameForExportDefault(symbol: Symbol): string | undefined { @@ -916,11 +944,11 @@ namespace ts.codefix { || (!!globalCachePath && startsWith(getCanonicalFileName(globalCachePath), toNodeModulesParent)); } - export function moduleSymbolToValidIdentifier(moduleSymbol: Symbol, target: ScriptTarget): string { + export function moduleSymbolToValidIdentifier(moduleSymbol: Symbol, target: ScriptTarget | undefined): string { return moduleSpecifierToValidIdentifier(removeFileExtension(stripQuotes(moduleSymbol.name)), target); } - export function moduleSpecifierToValidIdentifier(moduleSpecifier: string, target: ScriptTarget): string { + export function moduleSpecifierToValidIdentifier(moduleSpecifier: string, target: ScriptTarget | undefined): string { const baseName = getBaseFileName(removeSuffix(moduleSpecifier, "/index")); let res = ""; let lastCharWasValid = true; diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index a07153378f5..efad417248a 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -222,7 +222,7 @@ namespace ts.codefix { importAdder: ImportAdder, sourceFile: SourceFile, parameterDeclaration: ParameterDeclaration, - containingFunction: FunctionLike, + containingFunction: SignatureDeclaration, program: Program, host: LanguageServiceHost, cancellationToken: CancellationToken, @@ -268,7 +268,7 @@ namespace ts.codefix { } } - function annotateJSDocThis(changes: textChanges.ChangeTracker, sourceFile: SourceFile, containingFunction: FunctionLike, typeNode: TypeNode) { + function annotateJSDocThis(changes: textChanges.ChangeTracker, sourceFile: SourceFile, containingFunction: SignatureDeclaration, typeNode: TypeNode) { addJSDocTags(changes, sourceFile, containingFunction, [ factory.createJSDocThisTag(/*tagName*/ undefined, factory.createJSDocTypeExpression(typeNode)), ]); @@ -409,7 +409,7 @@ namespace ts.codefix { })); } - function getFunctionReferences(containingFunction: FunctionLike, sourceFile: SourceFile, program: Program, cancellationToken: CancellationToken): readonly Identifier[] | undefined { + function getFunctionReferences(containingFunction: SignatureDeclaration, sourceFile: SourceFile, program: Program, cancellationToken: CancellationToken): readonly Identifier[] | undefined { let searchToken; switch (containingFunction.kind) { case SyntaxKind.Constructor: @@ -534,7 +534,7 @@ namespace ts.codefix { return combineTypes(inferTypesFromReferencesSingle(references)); } - function parameters(declaration: FunctionLike): ParameterInference[] | undefined { + function parameters(declaration: SignatureDeclaration): ParameterInference[] | undefined { if (references.length === 0 || !declaration.parameters) { return undefined; } diff --git a/src/services/completions.ts b/src/services/completions.ts index 1c9b10096a6..40f3cac68c9 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -308,7 +308,7 @@ namespace ts.Completions { } for (const literal of literals) { - entries.push(createCompletionEntryForLiteral(literal, preferences)); + entries.push(createCompletionEntryForLiteral(sourceFile, preferences, literal)); } return { @@ -360,13 +360,13 @@ namespace ts.Completions { }); } - function completionNameForLiteral(literal: string | number | PseudoBigInt, preferences: UserPreferences): string { + function completionNameForLiteral(sourceFile: SourceFile, preferences: UserPreferences, literal: string | number | PseudoBigInt): string { return typeof literal === "object" ? pseudoBigIntToString(literal) + "n" : - isString(literal) ? quote(literal, preferences) : JSON.stringify(literal); + isString(literal) ? quote(sourceFile, preferences, literal) : JSON.stringify(literal); } - function createCompletionEntryForLiteral(literal: string | number | PseudoBigInt, preferences: UserPreferences): CompletionEntry { - return { name: completionNameForLiteral(literal, preferences), kind: ScriptElementKind.string, kindModifiers: ScriptElementKindModifier.none, sortText: SortText.LocationPriority }; + function createCompletionEntryForLiteral(sourceFile: SourceFile, preferences: UserPreferences, literal: string | number | PseudoBigInt): CompletionEntry { + return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: ScriptElementKind.string, kindModifiers: ScriptElementKindModifier.none, sortText: SortText.LocationPriority }; } function createCompletionEntry( @@ -391,13 +391,13 @@ namespace ts.Completions { const useBraces = origin && originIsSymbolMember(origin) || needsConvertPropertyAccess; if (origin && originIsThisType(origin)) { insertText = needsConvertPropertyAccess - ? `this${insertQuestionDot ? "?." : ""}[${quotePropertyName(name, preferences)}]` + ? `this${insertQuestionDot ? "?." : ""}[${quotePropertyName(sourceFile, preferences, name)}]` : `this${insertQuestionDot ? "?." : "."}${name}`; } // We should only have needsConvertPropertyAccess if there's a property access to convert. But see #21790. // Somehow there was a global with a non-identifier name. Hopefully someone will complain about getting a "foo bar" global completion and provide a repro. else if ((useBraces || insertQuestionDot) && propertyAccessToConvert) { - insertText = useBraces ? needsConvertPropertyAccess ? `[${quotePropertyName(name, preferences)}]` : `[${name}]` : name; + insertText = useBraces ? needsConvertPropertyAccess ? `[${quotePropertyName(sourceFile, preferences, name)}]` : `[${name}]` : name; if (insertQuestionDot || propertyAccessToConvert.questionDotToken) { insertText = `?.${insertText}`; } @@ -458,12 +458,12 @@ namespace ts.Completions { }; } - function quotePropertyName(name: string, preferences: UserPreferences): string { + function quotePropertyName(sourceFile: SourceFile, preferences: UserPreferences, name: string,): string { if (/^\d+$/.test(name)) { return name; } - return quote(name, preferences); + return quote(sourceFile, preferences, name); } function isRecommendedCompletionMatch(localSymbol: Symbol, recommendedCompletion: Symbol | undefined, checker: TypeChecker): boolean { @@ -614,7 +614,7 @@ namespace ts.Completions { const { symbols, literals, location, completionKind, symbolToOriginInfoMap, previousToken, isJsxInitializer, isTypeOnlyLocation } = completionData; - const literal = find(literals, l => completionNameForLiteral(l, preferences) === entryId.name); + const literal = find(literals, l => completionNameForLiteral(sourceFile, preferences, l) === entryId.name); if (literal !== undefined) return { type: "literal", literal }; // Find the symbol with the matching entry name. @@ -678,7 +678,7 @@ namespace ts.Completions { } case "literal": { const { literal } = symbolCompletion; - return createSimpleDetails(completionNameForLiteral(literal, preferences), ScriptElementKind.string, typeof literal === "string" ? SymbolDisplayPartKind.stringLiteral : SymbolDisplayPartKind.numericLiteral); + return createSimpleDetails(completionNameForLiteral(sourceFile, preferences, literal), ScriptElementKind.string, typeof literal === "string" ? SymbolDisplayPartKind.stringLiteral : SymbolDisplayPartKind.numericLiteral); } case "none": // Didn't find a symbol with this name. See if we can find a keyword instead. @@ -1891,10 +1891,12 @@ namespace ts.Completions { let existingMembers: readonly Declaration[] | undefined; if (objectLikeContainer.kind === SyntaxKind.ObjectLiteralExpression) { - const instantiatedType = typeChecker.getContextualType(objectLikeContainer); - const completionsType = instantiatedType && typeChecker.getContextualType(objectLikeContainer, ContextFlags.Completions); - if (!instantiatedType || !completionsType) return GlobalsSearch.Fail; - isNewIdentifierLocation = hasIndexSignature(instantiatedType || completionsType); + const instantiatedType = tryGetObjectLiteralContextualType(objectLikeContainer, typeChecker); + if (instantiatedType === undefined) { + return GlobalsSearch.Fail; + } + const completionsType = typeChecker.getContextualType(objectLikeContainer, ContextFlags.Completions); + isNewIdentifierLocation = hasIndexSignature(completionsType || instantiatedType); typeMembers = getPropertiesForObjectExpression(instantiatedType, completionsType, objectLikeContainer, typeChecker); existingMembers = objectLikeContainer.properties; } @@ -2585,7 +2587,6 @@ namespace ts.Completions { || kind === SyntaxKind.ModuleKeyword || kind === SyntaxKind.TypeKeyword || kind === SyntaxKind.NamespaceKeyword - || kind === SyntaxKind.AsKeyword || isTypeKeyword(kind) && kind !== SyntaxKind.UndefinedKeyword; case KeywordCompletionFilters.FunctionLikeBodyKeywords: return isFunctionLikeBodyKeyword(kind); @@ -2660,6 +2661,7 @@ namespace ts.Completions { function isFunctionLikeBodyKeyword(kind: SyntaxKind) { return kind === SyntaxKind.AsyncKeyword || kind === SyntaxKind.AwaitKeyword + || kind === SyntaxKind.AsKeyword || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } @@ -2830,4 +2832,15 @@ namespace ts.Completions { function isStaticProperty(symbol: Symbol) { return !!(symbol.valueDeclaration && getEffectiveModifierFlags(symbol.valueDeclaration) & ModifierFlags.Static && isClassLike(symbol.valueDeclaration.parent)); } + + function tryGetObjectLiteralContextualType(node: ObjectLiteralExpression, typeChecker: TypeChecker) { + const type = typeChecker.getContextualType(node); + if (type) { + return type; + } + if (isBinaryExpression(node.parent) && node.parent.operatorToken.kind === SyntaxKind.EqualsToken) { + return typeChecker.getTypeAtLocation(node.parent); + } + return undefined; + } } diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 23011643811..b8af97350f7 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -558,11 +558,15 @@ namespace ts.formatting { case SyntaxKind.FunctionDeclaration: case SyntaxKind.FunctionExpression: case SyntaxKind.MethodDeclaration: - case SyntaxKind.ArrowFunction: case SyntaxKind.Constructor: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: return childKind !== SyntaxKind.Block; + case SyntaxKind.ArrowFunction: + if (sourceFile && childKind === SyntaxKind.ParenthesizedExpression) { + return rangeIsOnOneLine(sourceFile, child!); + } + return childKind !== SyntaxKind.Block; case SyntaxKind.ExportDeclaration: return childKind !== SyntaxKind.NamedExports; case SyntaxKind.ImportDeclaration: diff --git a/src/services/goToDefinition.ts b/src/services/goToDefinition.ts index f0ec33c8884..de473a79c97 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -92,9 +92,16 @@ namespace ts.GoToDefinition { getDefinitionFromSymbol(typeChecker, propertySymbol, node)); } } + return getDefinitionFromSymbol(typeChecker, symbol, node); } + function isShorthandPropertyAssignmentOfModuleExports(symbol: Symbol): boolean { + const shorthandProperty = tryCast(symbol.valueDeclaration, isShorthandPropertyAssignment); + const binaryExpression = tryCast(shorthandProperty?.parent.parent, isAssignmentExpression); + return !!binaryExpression && getAssignmentDeclarationKind(binaryExpression) === AssignmentDeclarationKind.ModuleExports; + } + /** * True if we should not add definitions for both the signature symbol and the definition symbol. * True for `const |f = |() => 0`, false for `function |f() {} const |g = f;`. @@ -197,15 +204,29 @@ namespace ts.GoToDefinition { } function getSymbol(node: Node, checker: TypeChecker): Symbol | undefined { - const symbol = checker.getSymbolAtLocation(node); + let symbol = checker.getSymbolAtLocation(node); // If this is an alias, and the request came at the declaration location // get the aliased symbol instead. This allows for goto def on an import e.g. // import {A, B} from "mod"; // to jump to the implementation directly. - if (symbol && symbol.flags & SymbolFlags.Alias && shouldSkipAlias(node, symbol.declarations[0])) { - const aliased = checker.getAliasedSymbol(symbol); - if (aliased.declarations) { - return aliased; + while (symbol) { + if (symbol.flags & SymbolFlags.Alias && shouldSkipAlias(node, symbol.declarations[0])) { + const aliased = checker.getAliasedSymbol(symbol); + if (!aliased.declarations) { + break; + } + symbol = aliased; + } + else if (isShorthandPropertyAssignmentOfModuleExports(symbol)) { + // Skip past `module.exports = { Foo }` even though 'Foo' is not a real alias + const shorthandTarget = checker.resolveName(symbol.name, symbol.valueDeclaration, SymbolFlags.Value, /*excludeGlobals*/ false); + if (!some(shorthandTarget?.declarations)) { + break; + } + symbol = shorthandTarget; + } + else { + break; } } return symbol; diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 11b876a6841..8b45c762da1 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -329,6 +329,7 @@ namespace ts.JsDoc { case SyntaxKind.MethodDeclaration: case SyntaxKind.Constructor: case SyntaxKind.MethodSignature: + case SyntaxKind.ArrowFunction: const { parameters } = commentOwner as FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | MethodSignature; return { commentOwner, parameters }; diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 4f757be676c..4704e86846b 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -310,7 +310,7 @@ namespace ts.NavigationBar { case SyntaxKind.ExportAssignment: { const expression = (node).expression; - const child = isObjectLiteralExpression(expression) ? expression : + const child = isObjectLiteralExpression(expression) || isCallExpression(expression) ? expression : isArrowFunction(expression) || isFunctionExpression(expression) ? expression.body : undefined; if (child) { startNode(node); @@ -843,16 +843,11 @@ namespace ts.NavigationBar { } // Otherwise, we need to aggregate each identifier to build up the qualified name. - const result: string[] = []; - - result.push(getTextOfIdentifierOrLiteral(moduleDeclaration.name)); - + const result = [getTextOfIdentifierOrLiteral(moduleDeclaration.name)]; while (moduleDeclaration.body && moduleDeclaration.body.kind === SyntaxKind.ModuleDeclaration) { moduleDeclaration = moduleDeclaration.body; - result.push(getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } - return result.join("."); } diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 0baacad43bf..4f755aebca6 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -288,7 +288,7 @@ namespace ts.OutliningElementsCollector { } } - function functionSpan(node: FunctionLike, body: Block, sourceFile: SourceFile): OutliningSpan | undefined { + function functionSpan(node: SignatureDeclaration, body: Block, sourceFile: SourceFile): OutliningSpan | undefined { const openToken = tryGetFunctionOpenToken(node, body, sourceFile); const closeToken = findChildOfKind(body, SyntaxKind.CloseBraceToken, sourceFile); return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== SyntaxKind.ArrowFunction); @@ -303,7 +303,7 @@ namespace ts.OutliningElementsCollector { return { textSpan, kind, hintSpan, bannerText, autoCollapse }; } - function tryGetFunctionOpenToken(node: FunctionLike, body: Block, sourceFile: SourceFile): Node | undefined { + function tryGetFunctionOpenToken(node: SignatureDeclaration, body: Block, sourceFile: SourceFile): Node | undefined { if (isNodeArrayMultiLine(node.parameters, sourceFile)) { const openParenToken = findChildOfKind(node, SyntaxKind.OpenParenToken, sourceFile); if (openParenToken) { diff --git a/src/services/refactors/convertStringOrTemplateLiteral.ts b/src/services/refactors/convertStringOrTemplateLiteral.ts index ebcd13229ef..70965a16ed0 100644 --- a/src/services/refactors/convertStringOrTemplateLiteral.ts +++ b/src/services/refactors/convertStringOrTemplateLiteral.ts @@ -73,10 +73,19 @@ namespace ts.refactor.convertStringOrTemplateLiteral { } function getParentBinaryExpression(expr: Node) { - while (isBinaryExpression(expr.parent) && isNotEqualsOperator(expr.parent)) { - expr = expr.parent; - } - return expr; + const container = findAncestor(expr.parent, n => { + switch (n.kind) { + case SyntaxKind.PropertyAccessExpression: + case SyntaxKind.ElementAccessExpression: + return false; + case SyntaxKind.BinaryExpression: + return !(isBinaryExpression(n.parent) && isNotEqualsOperator(n.parent)); + default: + return "quit"; + } + }); + + return container || expr; } function isStringConcatenationValid(node: Node): boolean { diff --git a/src/services/refactors/convertToOptionalChainExpression.ts b/src/services/refactors/convertToOptionalChainExpression.ts index 0333506b1e3..52365fc0ba5 100644 --- a/src/services/refactors/convertToOptionalChainExpression.ts +++ b/src/services/refactors/convertToOptionalChainExpression.ts @@ -51,9 +51,11 @@ namespace ts.refactor.convertToOptionalChainExpression { error: string; }; + type Occurrence = PropertyAccessExpression | ElementAccessExpression | Identifier; + interface Info { - finalExpression: PropertyAccessExpression | CallExpression, - occurrences: (PropertyAccessExpression | Identifier)[], + finalExpression: PropertyAccessExpression | ElementAccessExpression | CallExpression, + occurrences: Occurrence[], expression: ValidExpression, }; @@ -107,7 +109,7 @@ namespace ts.refactor.convertToOptionalChainExpression { if (!finalExpression || checker.isNullableType(checker.getTypeAtLocation(finalExpression))) { return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_convertible_access_expression) }; - }; + } if ((isPropertyAccessExpression(condition) || isIdentifier(condition)) && getMatchingStart(condition, finalExpression.expression)) { @@ -136,8 +138,8 @@ namespace ts.refactor.convertToOptionalChainExpression { /** * Gets a list of property accesses that appear in matchTo and occur in sequence in expression. */ - function getOccurrencesInExpression(matchTo: Expression, expression: Expression): (PropertyAccessExpression | Identifier)[] | undefined { - const occurrences: (PropertyAccessExpression | Identifier)[] = []; + function getOccurrencesInExpression(matchTo: Expression, expression: Expression): Occurrence[] | undefined { + const occurrences: Occurrence[] = []; while (isBinaryExpression(expression) && expression.operatorToken.kind === SyntaxKind.AmpersandAmpersandToken) { const match = getMatchingStart(skipParentheses(matchTo), skipParentheses(expression.right)); if (!match) { @@ -157,9 +159,11 @@ namespace ts.refactor.convertToOptionalChainExpression { /** * Returns subchain if chain begins with subchain syntactically. */ - function getMatchingStart(chain: Expression, subchain: Expression): PropertyAccessExpression | Identifier | undefined { - return (isIdentifier(subchain) || isPropertyAccessExpression(subchain)) && - chainStartsWith(chain, subchain) ? subchain : undefined; + function getMatchingStart(chain: Expression, subchain: Expression): PropertyAccessExpression | ElementAccessExpression | Identifier | undefined { + if (!isIdentifier(subchain) && !isPropertyAccessExpression(subchain) && !isElementAccessExpression(subchain)) { + return undefined; + } + return chainStartsWith(chain, subchain) ? subchain : undefined; } /** @@ -167,14 +171,14 @@ namespace ts.refactor.convertToOptionalChainExpression { */ function chainStartsWith(chain: Node, subchain: Node): boolean { // skip until we find a matching identifier. - while (isCallExpression(chain) || isPropertyAccessExpression(chain)) { - const subchainName = isPropertyAccessExpression(subchain) ? subchain.name.getText() : subchain.getText(); - if (isPropertyAccessExpression(chain) && chain.name.getText() === subchainName) break; + while (isCallExpression(chain) || isPropertyAccessExpression(chain) || isElementAccessExpression(chain)) { + if (getTextOfChainNode(chain) === getTextOfChainNode(subchain)) break; chain = chain.expression; } - // check that the chains match at each access. Call chains in subchain are not valid. - while (isPropertyAccessExpression(chain) && isPropertyAccessExpression(subchain)) { - if (chain.name.getText() !== subchain.name.getText()) return false; + // check that the chains match at each access. Call chains in subchain are not valid. + while ((isPropertyAccessExpression(chain) && isPropertyAccessExpression(subchain)) || + (isElementAccessExpression(chain) && isElementAccessExpression(subchain))) { + if (getTextOfChainNode(chain) !== getTextOfChainNode(subchain)) return false; chain = chain.expression; subchain = subchain.expression; } @@ -182,6 +186,19 @@ namespace ts.refactor.convertToOptionalChainExpression { return isIdentifier(chain) && isIdentifier(subchain) && chain.getText() === subchain.getText(); } + function getTextOfChainNode(node: Node): string | undefined { + if (isIdentifier(node) || isStringOrNumericLiteralLike(node)) { + return node.getText(); + } + if (isPropertyAccessExpression(node)) { + return getTextOfChainNode(node.name); + } + if (isElementAccessExpression(node)) { + return getTextOfChainNode(node.argumentExpression); + } + return undefined; + } + /** * Find the least ancestor of the input node that is a valid type for extraction and contains the input span. */ @@ -229,7 +246,7 @@ namespace ts.refactor.convertToOptionalChainExpression { * it is followed by a different binary operator. * @param node the right child of a binary expression or a call expression. */ - function getFinalExpressionInChain(node: Expression): CallExpression | PropertyAccessExpression | undefined { + function getFinalExpressionInChain(node: Expression): CallExpression | PropertyAccessExpression | ElementAccessExpression | undefined { // foo && |foo.bar === 1|; - here the right child of the && binary expression is another binary expression. // the rightmost member of the && chain should be the leftmost child of that expression. node = skipParentheses(node); @@ -237,7 +254,7 @@ namespace ts.refactor.convertToOptionalChainExpression { return getFinalExpressionInChain(node.left); } // foo && |foo.bar()()| - nested calls are treated like further accesses. - else if ((isPropertyAccessExpression(node) || isCallExpression(node)) && !isOptionalChain(node)) { + else if ((isPropertyAccessExpression(node) || isElementAccessExpression(node) || isCallExpression(node)) && !isOptionalChain(node)) { return node; } return undefined; @@ -246,8 +263,8 @@ namespace ts.refactor.convertToOptionalChainExpression { /** * Creates an access chain from toConvert with '?.' accesses at expressions appearing in occurrences. */ - function convertOccurrences(checker: TypeChecker, toConvert: Expression, occurrences: (PropertyAccessExpression | Identifier)[]): Expression { - if (isPropertyAccessExpression(toConvert) || isCallExpression(toConvert)) { + function convertOccurrences(checker: TypeChecker, toConvert: Expression, occurrences: Occurrence[]): Expression { + if (isPropertyAccessExpression(toConvert) || isElementAccessExpression(toConvert) || isCallExpression(toConvert)) { const chain = convertOccurrences(checker, toConvert.expression, occurrences); const lastOccurrence = occurrences.length > 0 ? occurrences[occurrences.length - 1] : undefined; const isOccurrence = lastOccurrence?.getText() === toConvert.expression.getText(); @@ -262,6 +279,11 @@ namespace ts.refactor.convertToOptionalChainExpression { factory.createPropertyAccessChain(chain, factory.createToken(SyntaxKind.QuestionDotToken), toConvert.name) : factory.createPropertyAccessChain(chain, toConvert.questionDotToken, toConvert.name); } + else if (isElementAccessExpression(toConvert)) { + return isOccurrence ? + factory.createElementAccessChain(chain, factory.createToken(SyntaxKind.QuestionDotToken), toConvert.argumentExpression) : + factory.createElementAccessChain(chain, toConvert.questionDotToken, toConvert.argumentExpression); + } } return toConvert; } @@ -270,7 +292,7 @@ namespace ts.refactor.convertToOptionalChainExpression { const { finalExpression, occurrences, expression } = info; const firstOccurrence = occurrences[occurrences.length - 1]; const convertedChain = convertOccurrences(checker, finalExpression, occurrences); - if (convertedChain && (isPropertyAccessExpression(convertedChain) || isCallExpression(convertedChain))) { + if (convertedChain && (isPropertyAccessExpression(convertedChain) || isElementAccessExpression(convertedChain) || isCallExpression(convertedChain))) { if (isBinaryExpression(expression)) { changes.replaceNodeRange(sourceFile, firstOccurrence, finalExpression, convertedChain); } diff --git a/src/services/refactors/extractType.ts b/src/services/refactors/extractType.ts index bf893941187..7f528ae245d 100644 --- a/src/services/refactors/extractType.ts +++ b/src/services/refactors/extractType.ts @@ -140,7 +140,7 @@ namespace ts.refactor { if (symbol) { const declaration = cast(first(symbol.declarations), isTypeParameterDeclaration); if (rangeContainsSkipTrivia(statement, declaration, file) && !rangeContainsSkipTrivia(selection, declaration, file)) { - result.push(declaration); + pushIfUnique(result, declaration); } } } diff --git a/src/services/refactors/generateGetAccessorAndSetAccessor.ts b/src/services/refactors/generateGetAccessorAndSetAccessor.ts index 7ac211ed765..160f4f1b5ae 100644 --- a/src/services/refactors/generateGetAccessorAndSetAccessor.ts +++ b/src/services/refactors/generateGetAccessorAndSetAccessor.ts @@ -5,9 +5,9 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { registerRefactor(actionName, { getEditsForAction(context, actionName) { if (!context.endPosition) return undefined; - const info = codefix.getAccessorConvertiblePropertyAtPosition(context.file, context.startPosition, context.endPosition); + const info = codefix.getAccessorConvertiblePropertyAtPosition(context.file, context.program, context.startPosition, context.endPosition); if (!info || !info.info) return undefined; - const edits = codefix.generateAccessorFromProperty(context.file, context.startPosition, context.endPosition, context, actionName); + const edits = codefix.generateAccessorFromProperty(context.file, context.program, context.startPosition, context.endPosition, context, actionName); if (!edits) return undefined; const renameFilename = context.file.fileName; @@ -19,7 +19,7 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { }, getAvailableActions(context: RefactorContext): readonly ApplicableRefactorInfo[] { if (!context.endPosition) return emptyArray; - const info = codefix.getAccessorConvertiblePropertyAtPosition(context.file, context.startPosition, context.endPosition, context.triggerReason === "invoked"); + const info = codefix.getAccessorConvertiblePropertyAtPosition(context.file, context.program, context.startPosition, context.endPosition, context.triggerReason === "invoked"); if (!info) return emptyArray; if (!info.error) { diff --git a/src/services/services.ts b/src/services/services.ts index c0e951ae7c1..89292f09cf5 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2077,6 +2077,11 @@ namespace ts { // Push all text changes. for (let i = firstLine; i <= lastLine; i++) { + // If the range is multiline and ends on a beginning of a line, don't comment/uncomment. + if (firstLine !== lastLine && lineStarts[i] === textRange.end) { + continue; + } + const lineTextStart = lineTextStarts.get(i.toString()); // If the line is not an empty line; otherwise no-op. diff --git a/src/services/smartSelection.ts b/src/services/smartSelection.ts index 3263e7ed4fd..3fcab166959 100644 --- a/src/services/smartSelection.ts +++ b/src/services/smartSelection.ts @@ -13,7 +13,7 @@ namespace ts.SmartSelectionRange { const prevNode: Node | undefined = children[i - 1]; const node: Node = children[i]; const nextNode: Node | undefined = children[i + 1]; - if (node.getStart(sourceFile) > pos) { + if (getTokenPosOfNode(node, sourceFile, /*includeJsDoc*/ true) > pos) { break outer; } @@ -23,14 +23,14 @@ namespace ts.SmartSelectionRange { // of things that should be considered independently. // 3. A VariableStatement’s children are just a VaraiableDeclarationList and a semicolon. // 4. A lone VariableDeclaration in a VaraibleDeclaration feels redundant with the VariableStatement. - // // Dive in without pushing a selection range. if (isBlock(node) || isTemplateSpan(node) || isTemplateHead(node) || isTemplateTail(node) || prevNode && isTemplateHead(prevNode) || isVariableDeclarationList(node) && isVariableStatement(parentNode) || isSyntaxList(node) && isVariableDeclarationList(parentNode) - || isVariableDeclaration(node) && isSyntaxList(parentNode) && children.length === 1) { + || isVariableDeclaration(node) && isSyntaxList(parentNode) && children.length === 1 + || isJSDocTypeExpression(node) || isJSDocSignature(node) || isJSDocTypeLiteral(node)) { parentNode = node; break; } @@ -44,16 +44,15 @@ namespace ts.SmartSelectionRange { // Blocks with braces, brackets, parens, or JSX tags on separate lines should be // selected from open to close, including whitespace but not including the braces/etc. themselves. - const isBetweenMultiLineBookends = isSyntaxList(node) - && isListOpener(prevNode) - && isListCloser(nextNode) + const isBetweenMultiLineBookends = isSyntaxList(node) && isListOpener(prevNode) && isListCloser(nextNode) && !positionsAreOnSameLine(prevNode.getStart(), nextNode.getStart(), sourceFile); - const jsDocCommentStart = hasJSDocNodes(node) && node.jsDoc![0].getStart(); const start = isBetweenMultiLineBookends ? prevNode.getEnd() : node.getStart(); - const end = isBetweenMultiLineBookends ? nextNode.getStart() : node.getEnd(); - if (isNumber(jsDocCommentStart)) { - pushSelectionRange(jsDocCommentStart, end); + const end = isBetweenMultiLineBookends ? nextNode.getStart() : getEndPos(sourceFile, node); + + if (hasJSDocNodes(node) && node.jsDoc?.length) { + pushSelectionRange(first(node.jsDoc).getStart(), end); } + pushSelectionRange(start, end); // String literals should have a stop both inside and outside their quotes. @@ -270,4 +269,17 @@ namespace ts.SmartSelectionRange { || kind === SyntaxKind.CloseParenToken || kind === SyntaxKind.JsxClosingElement; } + + function getEndPos(sourceFile: SourceFile, node: Node): number { + switch (node.kind) { + case SyntaxKind.JSDocParameterTag: + case SyntaxKind.JSDocCallbackTag: + case SyntaxKind.JSDocPropertyTag: + case SyntaxKind.JSDocTypedefTag: + case SyntaxKind.JSDocThisTag: + return sourceFile.getLineEndOfPosition(node.getStart()); + default: + return node.getEnd(); + } + } } diff --git a/src/services/suggestionDiagnostics.ts b/src/services/suggestionDiagnostics.ts index a8c50322522..8d557d4edcb 100644 --- a/src/services/suggestionDiagnostics.ts +++ b/src/services/suggestionDiagnostics.ts @@ -37,7 +37,7 @@ namespace ts { function check(node: Node) { if (isJsFile) { - if (canBeConvertedToClass(node)) { + if (canBeConvertedToClass(node, checker)) { diags.push(createDiagnosticForNode(isVariableDeclaration(node.parent) ? node.parent.name : node, Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration)); } } @@ -190,14 +190,13 @@ namespace ts { return `${exp.pos.toString()}:${exp.end.toString()}`; } - function canBeConvertedToClass(node: Node): boolean { + function canBeConvertedToClass(node: Node, checker: TypeChecker): boolean { if (node.kind === SyntaxKind.FunctionExpression) { if (isVariableDeclaration(node.parent) && node.symbol.members?.size) { return true; } - const decl = getDeclarationOfExpando(node); - const symbol = decl?.symbol; + const symbol = checker.getSymbolOfExpando(node, /*allowDeclaration*/ false); return !!(symbol && (symbol.exports?.size || symbol.members?.size)); } diff --git a/src/services/symbolDisplay.ts b/src/services/symbolDisplay.ts index d62be264903..65543399c30 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -236,7 +236,7 @@ namespace ts.SymbolDisplay { else if ((isNameOfFunctionDeclaration(location) && !(symbolFlags & SymbolFlags.Accessor)) || // name of function declaration (location.kind === SyntaxKind.ConstructorKeyword && location.parent.kind === SyntaxKind.Constructor)) { // At constructor keyword of constructor declaration // get the signature from the declaration and write it - const functionDeclaration = location.parent; + const functionDeclaration = location.parent; // Use function declaration to write the signatures only if the symbol corresponding to this declaration const locationIsSymbolDeclaration = symbol.declarations && find(symbol.declarations, declaration => declaration === (location.kind === SyntaxKind.ConstructorKeyword ? functionDeclaration.parent : functionDeclaration)); diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index c1ef8e82b08..17f5ee4adf6 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -254,7 +254,7 @@ namespace ts.textChanges { export type ThisTypeAnnotatable = FunctionDeclaration | FunctionExpression; - export function isThisTypeAnnotatable(containingFunction: FunctionLike): containingFunction is ThisTypeAnnotatable { + export function isThisTypeAnnotatable(containingFunction: SignatureDeclaration): containingFunction is ThisTypeAnnotatable { return isFunctionExpression(containingFunction) || isFunctionDeclaration(containingFunction); } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 0a2572f4d79..d63e21d476f 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1173,7 +1173,21 @@ namespace ts { } const children = n.getChildren(sourceFile); - for (let i = 0; i < children.length; i++) { + const i = binarySearchKey(children, position, (_, i) => i, (middle, _) => { + // This last callback is more of a selector than a comparator - + // `EqualTo` causes the `middle` result to be returned + // `GreaterThan` causes recursion on the left of the middle + // `LessThan` causes recursion on the right of the middle + if (position < children[middle].end) { + // first element whose end position is greater than the input position + if (!children[middle - 1] || position >= children[middle - 1].end) { + return Comparison.EqualTo; + } + return Comparison.GreaterThan; + } + return Comparison.LessThan; + }); + if (i >= 0 && children[i]) { const child = children[i]; // Note that the span of a node's tokens is [node.getStart(...), node.end). // Given that `position < child.end` and child has constituent tokens, we distinguish these cases: @@ -1813,7 +1827,9 @@ namespace ts { return preferences.quotePreference === "single" ? QuotePreference.Single : QuotePreference.Double; } else { - const firstModuleSpecifier = sourceFile.imports && find(sourceFile.imports, isStringLiteral); + // ignore synthetic import added when importHelpers: true + const firstModuleSpecifier = sourceFile.imports && + find(sourceFile.imports, n => isStringLiteral(n) && !nodeIsSynthesized(n.parent)) as StringLiteral; return firstModuleSpecifier ? quotePreferenceFromString(firstModuleSpecifier, sourceFile) : QuotePreference.Double; } } @@ -2247,45 +2263,26 @@ namespace ts { return clone; } - export function getSynthesizedDeepCloneWithRenames(node: T, includeTrivia = true, renameMap?: ESMap, checker?: TypeChecker, callback?: (originalNode: Node, clone: Node) => any): T { - let clone; - if (renameMap && checker && isBindingElement(node) && isIdentifier(node.name) && isObjectBindingPattern(node.parent)) { - const symbol = checker.getSymbolAtLocation(node.name); - const renameInfo = symbol && renameMap.get(String(getSymbolId(symbol))); - - if (renameInfo && renameInfo.text !== (node.name || node.propertyName).getText()) { - clone = setOriginalNode( - factory.createBindingElement( - node.dotDotDotToken, - node.propertyName || node.name, - renameInfo, - node.initializer), - node); - } + export function getSynthesizedDeepCloneWithReplacements( + node: T, + includeTrivia: boolean, + replaceNode: (node: Node) => Node | undefined + ): T { + let clone = replaceNode(node); + if (clone) { + setOriginalNode(clone, node); } - else if (renameMap && checker && isIdentifier(node)) { - const symbol = checker.getSymbolAtLocation(node); - const renameInfo = symbol && renameMap.get(String(getSymbolId(symbol))); - - if (renameInfo) { - clone = setOriginalNode(factory.createIdentifier(renameInfo.text), node); - } - } - - if (!clone) { - clone = getSynthesizedDeepCloneWorker(node as NonNullable, renameMap, checker, callback); + else { + clone = getSynthesizedDeepCloneWorker(node as NonNullable, replaceNode); } if (clone && !includeTrivia) suppressLeadingAndTrailingTrivia(clone); - if (callback && clone) callback(node, clone); - return clone as T; } - - function getSynthesizedDeepCloneWorker(node: T, renameMap?: ESMap, checker?: TypeChecker, callback?: (originalNode: Node, clone: Node) => any): T { - const visited = (renameMap || checker || callback) ? - visitEachChild(node, wrapper, nullTransformationContext) : + function getSynthesizedDeepCloneWorker(node: T, replaceNode?: (node: Node) => Node | undefined): T { + const visited = replaceNode ? + visitEachChild(node, n => getSynthesizedDeepCloneWithReplacements(n, /*includeTrivia*/ true, replaceNode), nullTransformationContext) : visitEachChild(node, getSynthesizedDeepClone, nullTransformationContext); if (visited === node) { @@ -2302,10 +2299,6 @@ namespace ts { // would have made. (visited as Mutable).parent = undefined!; return visited; - - function wrapper(node: T) { - return getSynthesizedDeepCloneWithRenames(node, /*includeTrivia*/ true, renameMap, checker, callback); - } } export function getSynthesizedDeepClones(nodes: NodeArray, includeTrivia?: boolean): NodeArray; @@ -2314,6 +2307,14 @@ namespace ts { return nodes && factory.createNodeArray(nodes.map(n => getSynthesizedDeepClone(n, includeTrivia)), nodes.hasTrailingComma); } + export function getSynthesizedDeepClonesWithReplacements( + nodes: NodeArray, + includeTrivia: boolean, + replaceNode: (node: Node) => Node | undefined + ): NodeArray { + return factory.createNodeArray(nodes.map(n => getSynthesizedDeepCloneWithReplacements(n, includeTrivia, replaceNode)), nodes.hasTrailingComma); + } + /** * Sets EmitFlags to suppress leading and trailing trivia on the node. */ @@ -2474,20 +2475,11 @@ namespace ts { } } - export function quote(text: string, preferences: UserPreferences): string { + export function quote(sourceFile: SourceFile, preferences: UserPreferences, text: string): string { // Editors can pass in undefined or empty string - we want to infer the preference in those cases. - const quotePreference = preferences.quotePreference || "auto"; + const quotePreference = getQuotePreference(sourceFile, preferences); const quoted = JSON.stringify(text); - switch (quotePreference) { - // TODO use getQuotePreference to infer the actual quote style. - case "auto": - case "double": - return quoted; - case "single": - return `'${stripQuotes(quoted).replace("'", "\\'").replace('\\"', '"')}'`; - default: - return Debug.assertNever(quotePreference); - } + return quotePreference === QuotePreference.Single ? `'${stripQuotes(quoted).replace("'", "\\'").replace('\\"', '"')}'` : quoted; } export function isEqualityOperatorKind(kind: SyntaxKind): kind is EqualityOperator { @@ -2528,7 +2520,7 @@ namespace ts { const checker = program.getTypeChecker(); let typeIsAccessible = true; const notAccessible = () => { typeIsAccessible = false; }; - const res = checker.typeToTypeNode(type, enclosingScope, /*flags*/ undefined, { + const res = checker.typeToTypeNode(type, enclosingScope, NodeBuilderFlags.NoTruncation, { trackSymbol: (symbol, declaration, meaning) => { typeIsAccessible = typeIsAccessible && checker.isSymbolAccessible(symbol, declaration, meaning, /*shouldComputeAliasToMarkVisible*/ false).accessibility === SymbolAccessibility.Accessible; }, diff --git a/src/shims/tsconfig.json b/src/shims/tsconfig.json index 572ac1538a9..ebea929016a 100644 --- a/src/shims/tsconfig.json +++ b/src/shims/tsconfig.json @@ -4,6 +4,6 @@ "outFile": "../../built/local/shims.js" }, "files": [ - "collectionShims.ts" + "collectionShims.ts", ] } diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index 7ed0718f67f..7d924bb8de7 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -89,6 +89,7 @@ "unittests/evaluation/asyncArrow.ts", "unittests/evaluation/asyncGenerator.ts", "unittests/evaluation/awaiter.ts", + "unittests/evaluation/destructuring.ts", "unittests/evaluation/forAwaitOf.ts", "unittests/evaluation/forOf.ts", "unittests/evaluation/optionalCall.ts", @@ -120,6 +121,7 @@ "unittests/tsbuild/inferredTypeFromTransitiveModule.ts", "unittests/tsbuild/javascriptProjectEmit.ts", "unittests/tsbuild/lateBoundSymbol.ts", + "unittests/tsbuild/moduleResolution.ts", "unittests/tsbuild/moduleSpecifiers.ts", "unittests/tsbuild/noEmitOnError.ts", "unittests/tsbuild/outFile.ts", diff --git a/src/testRunner/unittests/evaluation/destructuring.ts b/src/testRunner/unittests/evaluation/destructuring.ts new file mode 100644 index 00000000000..dcff12970b6 --- /dev/null +++ b/src/testRunner/unittests/evaluation/destructuring.ts @@ -0,0 +1,65 @@ +describe("unittests:: evaluation:: destructuring", () => { + // https://github.com/microsoft/TypeScript/issues/39205 + describe("correct order for array destructuring evaluation and initializers", () => { + it("when element is undefined", () => { + const result = evaluator.evaluateTypeScript(` + export const output: any[] = []; + const order = (n: any): any => output.push(n); + let [{ [order(1)]: x } = order(0)] = []; + `, { target: ts.ScriptTarget.ES5 }); + assert.deepEqual(result.output, [0, 1]); + }); + it("when element is defined", async () => { + const result = evaluator.evaluateTypeScript(` + export const output: any[] = []; + const order = (n: any): any => output.push(n); + let [{ [order(1)]: x } = order(0)] = [{}]; + `, { target: ts.ScriptTarget.ES5 }); + assert.deepEqual(result.output, [1]); + }); + }); + describe("correct order for array destructuring evaluation and initializers with spread", () => { + it("ES5", () => { + const result = evaluator.evaluateTypeScript(` + export const output: any[] = []; + const order = (n: any): any => output.push(n); + let { [order(0)]: { [order(2)]: z } = order(1), ...w } = {} as any; + `, { target: ts.ScriptTarget.ES5 }); + assert.deepEqual(result.output, [0, 1, 2]); + }); + it("ES2015", () => { + const result = evaluator.evaluateTypeScript(` + export const output: any[] = []; + const order = (n: any): any => output.push(n); + let { [order(0)]: { [order(2)]: z } = order(1), ...w } = {} as any; + `, { target: ts.ScriptTarget.ES2015 }); + assert.deepEqual(result.output, [0, 1, 2]); + }); + }); + describe("correct evaluation for nested rest assignment in destructured object", () => { + it("ES5", () => { + const result = evaluator.evaluateTypeScript(` + let a: any, b: any, c: any = { x: { a: 1, y: 2 } }, d: any; + ({ x: { a, ...b } = d } = c); + export const output = { a, b }; + `, { target: ts.ScriptTarget.ES5 }); + assert.deepEqual(result.output, { a: 1, b: { y: 2 } }); + }); + it("ES2015", () => { + const result = evaluator.evaluateTypeScript(` + let a: any, b: any, c: any = { x: { a: 1, y: 2 } }, d: any; + ({ x: { a, ...b } = d } = c); + export const output = { a, b }; + `, { target: ts.ScriptTarget.ES2015 }); + assert.deepEqual(result.output, { a: 1, b: { y: 2 } }); + }); + it("ES2018", () => { + const result = evaluator.evaluateTypeScript(` + let a: any, b: any, c: any = { x: { a: 1, y: 2 } }, d: any; + ({ x: { a, ...b } = d } = c); + export const output = { a, b }; + `, { target: ts.ScriptTarget.ES2018 }); + assert.deepEqual(result.output, { a: 1, b: { y: 2 } }); + }); + }); +}); diff --git a/src/testRunner/unittests/moduleResolution.ts b/src/testRunner/unittests/moduleResolution.ts index 477952cc400..746074b3ec9 100644 --- a/src/testRunner/unittests/moduleResolution.ts +++ b/src/testRunner/unittests/moduleResolution.ts @@ -1387,8 +1387,8 @@ import b = require("./moduleB"); const diagnostics1 = program1.getFileProcessingDiagnostics().getDiagnostics(); assert.equal(diagnostics1.length, 1, "expected one diagnostic"); - createProgram(names, {}, compilerHost, program1); - assert.isTrue(program1.structureIsReused === StructureIsReused.Completely); + const program2 = createProgram(names, {}, compilerHost, program1); + assert.isTrue(program2.structureIsReused === StructureIsReused.Completely); const diagnostics2 = program1.getFileProcessingDiagnostics().getDiagnostics(); assert.equal(diagnostics2.length, 1, "expected one diagnostic"); assert.equal(diagnostics1[0].messageText, diagnostics2[0].messageText, "expected one diagnostic"); diff --git a/src/testRunner/unittests/printer.ts b/src/testRunner/unittests/printer.ts index 59ffa8f0ed2..50c776c0f9f 100644 --- a/src/testRunner/unittests/printer.ts +++ b/src/testRunner/unittests/printer.ts @@ -93,6 +93,33 @@ namespace ts { }); }); + describe("No duplicate ref directives when emiting .d.ts->.d.ts", () => { + it("without statements", () => { + const host = new fakes.CompilerHost(new vfs.FileSystem(true, { + files: { + "/test.d.ts": `/// \n/// { + const host = new fakes.CompilerHost(new vfs.FileSystem(true, { + files: { + "/test.d.ts": `/// \n/// { const printsCorrectly = makePrintsCorrectly("printsBundleCorrectly"); let bundle: Bundle; diff --git a/src/testRunner/unittests/reuseProgramStructure.ts b/src/testRunner/unittests/reuseProgramStructure.ts index 8c3f9d6a94f..3c21ed2a035 100644 --- a/src/testRunner/unittests/reuseProgramStructure.ts +++ b/src/testRunner/unittests/reuseProgramStructure.ts @@ -231,7 +231,7 @@ namespace ts { const program2 = updateProgram(program1, ["a.ts"], { target }, files => { files[0].text = files[0].text.updateProgram("var x = 100"); }); - assert.equal(program1.structureIsReused, StructureIsReused.Completely); + assert.equal(program2.structureIsReused, StructureIsReused.Completely); const program1Diagnostics = program1.getSemanticDiagnostics(program1.getSourceFile("a.ts")); const program2Diagnostics = program2.getSemanticDiagnostics(program1.getSourceFile("a.ts")); assert.equal(program1Diagnostics.length, program2Diagnostics.length); @@ -242,7 +242,7 @@ namespace ts { const program2 = updateProgram(program1, ["a.ts"], { target }, files => { files[0].text = files[0].text.updateProgram("var x = 100"); }); - assert.equal(program1.structureIsReused, StructureIsReused.Completely); + assert.equal(program2.structureIsReused, StructureIsReused.Completely); const program1Diagnostics = program1.getSemanticDiagnostics(program1.getSourceFile("a.ts")); const program2Diagnostics = program2.getSemanticDiagnostics(program1.getSourceFile("a.ts")); assert.equal(program1Diagnostics.length, program2Diagnostics.length); @@ -250,63 +250,63 @@ namespace ts { it("fails if change affects tripleslash references", () => { const program1 = newProgram(files, ["a.ts"], { target }); - updateProgram(program1, ["a.ts"], { target }, files => { + const program2 = updateProgram(program1, ["a.ts"], { target }, files => { const newReferences = `/// /// `; files[0].text = files[0].text.updateReferences(newReferences); }); - assert.equal(program1.structureIsReused, StructureIsReused.SafeModules); + assert.equal(program2.structureIsReused, StructureIsReused.SafeModules); }); it("fails if change affects type references", () => { const program1 = newProgram(files, ["a.ts"], { types: ["a"] }); - updateProgram(program1, ["a.ts"], { types: ["b"] }, noop); - assert.equal(program1.structureIsReused, StructureIsReused.Not); + const program2 = updateProgram(program1, ["a.ts"], { types: ["b"] }, noop); + assert.equal(program2.structureIsReused, StructureIsReused.Not); }); it("succeeds if change doesn't affect type references", () => { const program1 = newProgram(files, ["a.ts"], { types: ["a"] }); - updateProgram(program1, ["a.ts"], { types: ["a"] }, noop); - assert.equal(program1.structureIsReused, StructureIsReused.Completely); + const program2 = updateProgram(program1, ["a.ts"], { types: ["a"] }, noop); + assert.equal(program2.structureIsReused, StructureIsReused.Completely); }); it("fails if change affects imports", () => { const program1 = newProgram(files, ["a.ts"], { target }); - updateProgram(program1, ["a.ts"], { target }, files => { + const program2 = updateProgram(program1, ["a.ts"], { target }, files => { files[2].text = files[2].text.updateImportsAndExports("import x from 'b'"); }); - assert.equal(program1.structureIsReused, StructureIsReused.SafeModules); + assert.equal(program2.structureIsReused, StructureIsReused.SafeModules); }); it("fails if change affects type directives", () => { const program1 = newProgram(files, ["a.ts"], { target }); - updateProgram(program1, ["a.ts"], { target }, files => { + const program2 = updateProgram(program1, ["a.ts"], { target }, files => { const newReferences = ` /// /// /// `; files[0].text = files[0].text.updateReferences(newReferences); }); - assert.equal(program1.structureIsReused, StructureIsReused.SafeModules); + assert.equal(program2.structureIsReused, StructureIsReused.SafeModules); }); it("fails if module kind changes", () => { const program1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS }); - updateProgram(program1, ["a.ts"], { target, module: ModuleKind.AMD }, noop); - assert.equal(program1.structureIsReused, StructureIsReused.Not); + const program2 = updateProgram(program1, ["a.ts"], { target, module: ModuleKind.AMD }, noop); + assert.equal(program2.structureIsReused, StructureIsReused.Not); }); it("succeeds if rootdir changes", () => { const program1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/b" }); - updateProgram(program1, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/c" }, noop); - assert.equal(program1.structureIsReused, StructureIsReused.Completely); + const program2 = updateProgram(program1, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/c" }, noop); + assert.equal(program2.structureIsReused, StructureIsReused.Completely); }); it("fails if config path changes", () => { const program1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/b/tsconfig.json" }); - updateProgram(program1, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/c/tsconfig.json" }, noop); - assert.equal(program1.structureIsReused, StructureIsReused.Not); + const program2 = updateProgram(program1, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/c/tsconfig.json" }, noop); + assert.equal(program2.structureIsReused, StructureIsReused.Not); }); it("succeeds if missing files remain missing", () => { @@ -318,7 +318,7 @@ namespace ts { const program2 = updateProgram(program1, ["a.ts"], options, noop); assert.deepEqual(program1.getMissingFilePaths(), program2.getMissingFilePaths()); - assert.equal(StructureIsReused.Completely, program1.structureIsReused); + assert.equal(program2.structureIsReused, StructureIsReused.Completely,); }); it("fails if missing file is created", () => { @@ -331,7 +331,7 @@ namespace ts { const program2 = updateProgram(program1, ["a.ts"], options, noop, newTexts); assert.lengthOf(program2.getMissingFilePaths(), 0); - assert.equal(StructureIsReused.Not, program1.structureIsReused); + assert.equal(program2.structureIsReused, StructureIsReused.Not); }); it("resolution cache follows imports", () => { @@ -350,7 +350,7 @@ namespace ts { const program2 = updateProgram(program1, ["a.ts"], options, files => { files[0].text = files[0].text.updateProgram("var x = 2"); }); - assert.equal(program1.structureIsReused, StructureIsReused.Completely); + assert.equal(program2.structureIsReused, StructureIsReused.Completely); // content of resolution cache should not change checkResolvedModulesCache(program1, "a.ts", new Map(getEntries({ b: createResolvedModule("b.ts") }))); @@ -360,7 +360,7 @@ namespace ts { const program3 = updateProgram(program2, ["a.ts"], options, files => { files[0].text = files[0].text.updateImportsAndExports(""); }); - assert.equal(program2.structureIsReused, StructureIsReused.SafeModules); + assert.equal(program3.structureIsReused, StructureIsReused.SafeModules); checkResolvedModulesCache(program3, "a.ts", /*expectedContent*/ undefined); const program4 = updateProgram(program3, ["a.ts"], options, files => { @@ -369,7 +369,7 @@ namespace ts { `; files[0].text = files[0].text.updateImportsAndExports(newImports); }); - assert.equal(program3.structureIsReused, StructureIsReused.SafeModules); + assert.equal(program4.structureIsReused, StructureIsReused.SafeModules); checkResolvedModulesCache(program4, "a.ts", new Map(getEntries({ b: createResolvedModule("b.ts"), c: undefined }))); }); @@ -424,7 +424,7 @@ namespace ts { const program2 = updateProgram(program1, ["/a.ts"], options, files => { files[0].text = files[0].text.updateProgram("var x = 2"); }); - assert.equal(program1.structureIsReused, StructureIsReused.Completely); + assert.equal(program2.structureIsReused, StructureIsReused.Completely); // content of resolution cache should not change checkResolvedTypeDirectivesCache(program1, "/a.ts", new Map(getEntries({ typedefs: { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } }))); @@ -435,16 +435,16 @@ namespace ts { files[0].text = files[0].text.updateReferences(""); }); - assert.equal(program2.structureIsReused, StructureIsReused.SafeModules); + assert.equal(program3.structureIsReused, StructureIsReused.SafeModules); checkResolvedTypeDirectivesCache(program3, "/a.ts", /*expectedContent*/ undefined); - updateProgram(program3, ["/a.ts"], options, files => { + const program4 = updateProgram(program3, ["/a.ts"], options, files => { const newReferences = `/// /// `; files[0].text = files[0].text.updateReferences(newReferences); }); - assert.equal(program3.structureIsReused, StructureIsReused.SafeModules); + assert.equal(program4.structureIsReused, StructureIsReused.SafeModules); checkResolvedTypeDirectivesCache(program1, "/a.ts", new Map(getEntries({ typedefs: { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } }))); }); @@ -847,7 +847,7 @@ namespace ts { const program2 = updateRedirectProgram(program1, files => { updateProgramText(files, root, "const x = 1;"); }, useGetSourceFileByPath); - assert.equal(program1.structureIsReused, StructureIsReused.Completely); + assert.equal(program2.structureIsReused, StructureIsReused.Completely); assert.lengthOf(program2.getSemanticDiagnostics(), 0); }); @@ -859,7 +859,7 @@ namespace ts { updateProgramText(files, axIndex, "export default class X { private x: number; private y: number; }"); updateProgramText(files, axPackage, JSON.stringify('{ name: "x", version: "1.2.4" }')); }, useGetSourceFileByPath); - assert.equal(program1.structureIsReused, StructureIsReused.Not); + assert.equal(program2.structureIsReused, StructureIsReused.Not); assert.lengthOf(program2.getSemanticDiagnostics(), 1); }); @@ -870,7 +870,7 @@ namespace ts { updateProgramText(files, bxIndex, "export default class X { private x: number; private y: number; }"); updateProgramText(files, bxPackage, JSON.stringify({ name: "x", version: "1.2.4" })); }, useGetSourceFileByPath); - assert.equal(program1.structureIsReused, StructureIsReused.Not); + assert.equal(program2.structureIsReused, StructureIsReused.Not); assert.lengthOf(program2.getSemanticDiagnostics(), 1); }); @@ -881,7 +881,7 @@ namespace ts { updateProgramText(files, bxIndex, "export default class X { private x: number; }"); updateProgramText(files, bxPackage, JSON.stringify({ name: "x", version: "1.2.3" })); }, useGetSourceFileByPath); - assert.equal(program1.structureIsReused, StructureIsReused.Not); + assert.equal(program2.structureIsReused, StructureIsReused.Not); assert.deepEqual(program2.getSemanticDiagnostics(), []); }); } diff --git a/src/testRunner/unittests/services/convertToAsyncFunction.ts b/src/testRunner/unittests/services/convertToAsyncFunction.ts index 952f6bf4d68..183f7bccb42 100644 --- a/src/testRunner/unittests/services/convertToAsyncFunction.ts +++ b/src/testRunner/unittests/services/convertToAsyncFunction.ts @@ -902,7 +902,7 @@ function [#|f|](): Promise { } ` ); - _testConvertToAsyncFunction("convertToAsyncFunction_PromiseAllAndThen", ` + _testConvertToAsyncFunction("convertToAsyncFunction_PromiseAllAndThen1", ` function [#|f|]() { return Promise.resolve().then(function () { return Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function () { @@ -921,6 +921,26 @@ function [#|f|]() { })]).then(res => res.toString()); }); } +` + ); + + _testConvertToAsyncFunction("convertToAsyncFunction_PromiseAllAndThen3", ` +function [#|f|]() { + return Promise.resolve().then(() => + Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function () { + return fetch("https://github.com"); + }).then(res => res.toString())])); +} +` + ); + + _testConvertToAsyncFunction("convertToAsyncFunction_PromiseAllAndThen4", ` +function [#|f|]() { + return Promise.resolve().then(() => + Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function () { + return fetch("https://github.com"); + })]).then(res => res.toString())); +} ` ); _testConvertToAsyncFunction("convertToAsyncFunction_Scope1", ` @@ -1124,6 +1144,27 @@ function [#|bar|](x: T): Promise { ` ); + _testConvertToAsyncFunction("convertToAsyncFunction_Return1", ` +function [#|f|](p: Promise) { + return p.catch((error: Error) => { + return Promise.reject(error); + }); +}` + ); + + _testConvertToAsyncFunction("convertToAsyncFunction_Return2", ` +function [#|f|](p: Promise) { + return p.catch((error: Error) => Promise.reject(error)); +}` + ); + + _testConvertToAsyncFunction("convertToAsyncFunction_Return3", ` +function [#|f|](p: Promise) { + return p.catch(function (error: Error) { + return Promise.reject(error); + }); +}` + ); _testConvertToAsyncFunction("convertToAsyncFunction_LocalReturn", ` function [#|f|]() { @@ -1352,7 +1393,7 @@ function [#|f|]() { } `); - _testConvertToAsyncFunction("convertToAsyncFunction_noArgs", ` + _testConvertToAsyncFunction("convertToAsyncFunction_noArgs1", ` function delay(millis: number): Promise { throw "no" } @@ -1364,7 +1405,21 @@ function [#|main2|]() { .then(() => { console.log("."); return delay(500); }) .then(() => { console.log("."); return delay(500); }) } -`); + `); + + _testConvertToAsyncFunction("convertToAsyncFunction_noArgs2", ` +function delay(millis: number): Promise { + throw "no" +} + +function [#|main2|]() { + console.log("Please wait. Loading."); + return delay(500) + .then(() => delay(500)) + .then(() => delay(500)) + .then(() => delay(500)) +} + `); _testConvertToAsyncFunction("convertToAsyncFunction_exportModifier", ` export function [#|foo|]() { diff --git a/src/testRunner/unittests/tsbuild/moduleResolution.ts b/src/testRunner/unittests/tsbuild/moduleResolution.ts new file mode 100644 index 00000000000..11403bdc18f --- /dev/null +++ b/src/testRunner/unittests/tsbuild/moduleResolution.ts @@ -0,0 +1,69 @@ +namespace ts.tscWatch { + describe("unittests:: tsbuild:: moduleResolution:: handles the modules and options from referenced project correctly", () => { + function sys(optionsToExtend?: CompilerOptions) { + return createWatchedSystem([ + { + path: `${projectRoot}/packages/pkg1/index.ts`, + content: Utils.dedent` + import type { TheNum } from 'pkg2' + export const theNum: TheNum = 42;` + }, + { + path: `${projectRoot}/packages/pkg1/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { outDir: "build", ...optionsToExtend }, + references: [{ path: "../pkg2" }] + }) + }, + { + path: `${projectRoot}/packages/pkg2/const.ts`, + content: `export type TheNum = 42;` + }, + { + path: `${projectRoot}/packages/pkg2/index.ts`, + content: `export type { TheNum } from 'const';` + }, + { + path: `${projectRoot}/packages/pkg2/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { + composite: true, + outDir: "build", + baseUrl: ".", + ...optionsToExtend + } + }) + }, + { + path: `${projectRoot}/packages/pkg2/package.json`, + content: JSON.stringify({ + name: "pkg2", + version: "1.0.0", + main: "build/index.js", + }) + }, + { + path: `${projectRoot}/node_modules/pkg2`, + symLink: `${projectRoot}/packages/pkg2`, + }, + libFile + ], { currentDirectory: projectRoot }); + } + + verifyTscWatch({ + scenario: "moduleResolution", + subScenario: `resolves specifier in output declaration file from referenced project correctly`, + sys, + commandLineArgs: ["-b", "packages/pkg1", "--verbose", "--traceResolution"], + changes: emptyArray + }); + + verifyTscWatch({ + scenario: "moduleResolution", + subScenario: `resolves specifier in output declaration file from referenced project correctly with preserveSymlinks`, + sys: () => sys({ preserveSymlinks: true }), + commandLineArgs: ["-b", "packages/pkg1", "--verbose", "--traceResolution"], + changes: emptyArray + }); + }); +} diff --git a/src/testRunner/unittests/tscWatch/helpers.ts b/src/testRunner/unittests/tscWatch/helpers.ts index ad0ea2a95e9..5201cda4f37 100644 --- a/src/testRunner/unittests/tscWatch/helpers.ts +++ b/src/testRunner/unittests/tscWatch/helpers.ts @@ -43,7 +43,7 @@ namespace ts.tscWatch { return createWatchProgram(compilerHost); } - const elapsedRegex = /^Elapsed:: [0-9]+ms/; + const elapsedRegex = /^Elapsed:: \d+(?:\.\d+)?ms/; const buildVerboseLogRegEx = /^.+ \- /; export enum HostOutputKind { Log, @@ -441,6 +441,7 @@ namespace ts.tscWatch { const options = program.getCompilerOptions(); baseline.push(`Program root files: ${JSON.stringify(program.getRootFileNames())}`); baseline.push(`Program options: ${JSON.stringify(options)}`); + baseline.push(`Program structureReused: ${(ts).StructureIsReused[program.structureIsReused]}`); baseline.push("Program files::"); for (const file of program.getSourceFiles()) { baseline.push(file.fileName); diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts index f4b7fa13ed4..d9b7d0585d5 100644 --- a/src/testRunner/unittests/tscWatch/incremental.ts +++ b/src/testRunner/unittests/tscWatch/incremental.ts @@ -276,5 +276,79 @@ export interface A { ], modifyFs: host => host.deleteFile(`${project}/globals.d.ts`) }); + + const jsxImportSourceOptions = { module: "commonjs", jsx: "react-jsx", incremental: true, jsxImportSource: "react" }; + const jsxLibraryContent = `export namespace JSX { + interface Element {} + interface IntrinsicElements { + div: { + propA?: boolean; + }; + } +} +export function jsx(...args: any[]): void; +export function jsxs(...args: any[]): void; +export const Fragment: unique symbol; +`; + + verifyIncrementalWatchEmit({ + subScenario: "jsxImportSource option changed", + files: () => [ + { path: libFile.path, content: libContent }, + { path: `${project}/node_modules/react/jsx-runtime/index.d.ts`, content: jsxLibraryContent }, + { path: `${project}/node_modules/react/package.json`, content: JSON.stringify({ name: "react", version: "0.0.1" }) }, + { path: `${project}/node_modules/preact/jsx-runtime/index.d.ts`, content: jsxLibraryContent.replace("propA", "propB") }, + { path: `${project}/node_modules/preact/package.json`, content: JSON.stringify({ name: "preact", version: "0.0.1" }) }, + { path: `${project}/index.tsx`, content: `export const App = () =>

;` }, + { path: configFile.path, content: JSON.stringify({ compilerOptions: jsxImportSourceOptions }) } + ], + modifyFs: host => host.writeFile(configFile.path, JSON.stringify({ compilerOptions: { ...jsxImportSourceOptions, jsxImportSource: "preact" } })) + }); + + verifyIncrementalWatchEmit({ + subScenario: "jsxImportSource backing types added", + files: () => [ + { path: libFile.path, content: libContent }, + { path: `${project}/index.tsx`, content: `export const App = () =>
;` }, + { path: configFile.path, content: JSON.stringify({ compilerOptions: jsxImportSourceOptions }) } + ], + modifyFs: host => { + host.createDirectory(`${project}/node_modules`); + host.createDirectory(`${project}/node_modules/react`); + host.createDirectory(`${project}/node_modules/react/jsx-runtime`); + host.writeFile(`${project}/node_modules/react/jsx-runtime/index.d.ts`, jsxLibraryContent); + host.writeFile(`${project}/node_modules/react/package.json`, JSON.stringify({ name: "react", version: "0.0.1" })); + } + }); + + verifyIncrementalWatchEmit({ + subScenario: "jsxImportSource backing types removed", + files: () => [ + { path: libFile.path, content: libContent }, + { path: `${project}/node_modules/react/jsx-runtime/index.d.ts`, content: jsxLibraryContent }, + { path: `${project}/node_modules/react/package.json`, content: JSON.stringify({ name: "react", version: "0.0.1" }) }, + { path: `${project}/index.tsx`, content: `export const App = () =>
;` }, + { path: configFile.path, content: JSON.stringify({ compilerOptions: jsxImportSourceOptions }) } + ], + modifyFs: host => { + host.deleteFile(`${project}/node_modules/react/jsx-runtime/index.d.ts`); + host.deleteFile(`${project}/node_modules/react/package.json`); + } + }); + + verifyIncrementalWatchEmit({ + subScenario: "importHelpers backing types removed", + files: () => [ + { path: libFile.path, content: libContent }, + { path: `${project}/node_modules/tslib/index.d.ts`, content: "export function __assign(...args: any[]): any;" }, + { path: `${project}/node_modules/tslib/package.json`, content: JSON.stringify({ name: "tslib", version: "0.0.1" }) }, + { path: `${project}/index.tsx`, content: `export const x = {...{}};` }, + { path: configFile.path, content: JSON.stringify({ compilerOptions: { importHelpers: true } }) } + ], + modifyFs: host => { + host.deleteFile(`${project}/node_modules/tslib/index.d.ts`); + host.deleteFile(`${project}/node_modules/tslib/package.json`); + } + }); }); } diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts index 3faa145fe2c..805f9f955b4 100644 --- a/src/testRunner/unittests/tscWatch/programUpdates.ts +++ b/src/testRunner/unittests/tscWatch/programUpdates.ts @@ -1598,5 +1598,33 @@ import { x } from "../b";`), }, ] }); + + verifyTscWatch({ + scenario, + subScenario: "updates emit on jsx option change", + commandLineArgs: ["-w"], + sys: () => { + const index: File = { + path: `${projectRoot}/index.tsx`, + content: `declare var React: any;\nconst d =
;` + }; + const configFile: File = { + path: `${projectRoot}/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { + jsx: "preserve" + } + }) + }; + return createWatchedSystem([index, configFile, libFile], { currentDirectory: projectRoot }); + }, + changes: [ + { + caption: "Update 'jsx' to 'react'", + change: sys => sys.writeFile(`${projectRoot}/tsconfig.json`, '{ "compilerOptions": { "jsx": "react" } }'), + timeouts: runQueuedTimeoutCallbacks, + }, + ] + }); }); } diff --git a/src/testRunner/unittests/tscWatch/watchApi.ts b/src/testRunner/unittests/tscWatch/watchApi.ts index 6dcf1b30f7b..5e32bb8c161 100644 --- a/src/testRunner/unittests/tscWatch/watchApi.ts +++ b/src/testRunner/unittests/tscWatch/watchApi.ts @@ -121,6 +121,126 @@ namespace ts.tscWatch { ); const watch = createWatchProgram(watchCompilerHost); checkProgramActualFiles(watch.getProgram().getProgram(), [mainFile.path, otherFile.path, libFile.path]); + + const other2 = `${projectRoot}/other2.vue`; + sys.writeFile(other2, otherFile.content); + checkSingleTimeoutQueueLengthAndRun(sys); + checkProgramActualFiles(watch.getProgram().getProgram(), [mainFile.path, otherFile.path, libFile.path, other2]); + }); + }); + + describe("unittests:: tsc-watch:: watchAPI:: when watchHost uses createSemanticDiagnosticsBuilderProgram", () => { + function getWatch(config: File, optionsToExtend: CompilerOptions | undefined, sys: System, createProgram: CreateProgram) { + const watchCompilerHost = createWatchCompilerHost(config.path, optionsToExtend, sys, createProgram); + return createWatchProgram(watchCompilerHost); + } + + function setup(createProgram: CreateProgram, configText: string) { + const config: File = { + path: `${projectRoot}/tsconfig.json`, + content: configText + }; + const mainFile: File = { + path: `${projectRoot}/main.ts`, + content: "export const x = 10;" + }; + const otherFile: File = { + path: `${projectRoot}/other.ts`, + content: "export const y = 10;" + }; + const sys = createWatchedSystem([config, mainFile, otherFile, libFile]); + const watch = getWatch(config, { noEmit: true }, sys, createProgram); + return { sys, watch, mainFile, otherFile, config }; + } + + function verifyOutputs(sys: System, emitSys: System) { + for (const output of [`${projectRoot}/main.js`, `${projectRoot}/main.d.ts`, `${projectRoot}/other.js`, `${projectRoot}/other.d.ts`, `${projectRoot}/tsconfig.tsbuildinfo`]) { + assert.strictEqual(sys.readFile(output), emitSys.readFile(output), `Output file text for ${output}`); + } + } + + function verifyBuilder(config: File, sys: System, emitSys: System, createProgram: CreateProgram, createEmitProgram: CreateProgram, optionsToExtend?: CompilerOptions) { + const watch = getWatch(config, /*optionsToExtend*/ optionsToExtend, sys, createProgram); + const emitWatch = getWatch(config, /*optionsToExtend*/ optionsToExtend, emitSys, createEmitProgram); + verifyOutputs(sys, emitSys); + watch.close(); + emitWatch.close(); + } + + it("verifies that noEmit is handled on createSemanticDiagnosticsBuilderProgram and typechecking happens only on affected files", () => { + const { sys, watch, mainFile, otherFile } = setup(createSemanticDiagnosticsBuilderProgram, "{}"); + checkProgramActualFiles(watch.getProgram().getProgram(), [mainFile.path, otherFile.path, libFile.path]); + sys.appendFile(mainFile.path, "\n// SomeComment"); + sys.runQueuedTimeoutCallbacks(); + const program = watch.getProgram().getProgram(); + assert.deepEqual(program.getCachedSemanticDiagnostics(program.getSourceFile(mainFile.path)), []); + // Should not retrieve diagnostics for other file thats not changed + assert.deepEqual(program.getCachedSemanticDiagnostics(program.getSourceFile(otherFile.path)), /*expected*/ undefined); + }); + + it("noEmit with composite writes the tsbuildinfo with pending affected files correctly", () => { + const configText = JSON.stringify({ compilerOptions: { composite: true } }); + const { sys, watch, config, mainFile } = setup(createSemanticDiagnosticsBuilderProgram, configText); + const { sys: emitSys, watch: emitWatch } = setup(createEmitAndSemanticDiagnosticsBuilderProgram, configText); + verifyOutputs(sys, emitSys); + + watch.close(); + emitWatch.close(); + + // Emit on both sys should result in same output + verifyBuilder(config, sys, emitSys, createEmitAndSemanticDiagnosticsBuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram); + + // Change file + sys.appendFile(mainFile.path, "\n// SomeComment"); + emitSys.appendFile(mainFile.path, "\n// SomeComment"); + + // Verify noEmit results in same output + verifyBuilder(config, sys, emitSys, createSemanticDiagnosticsBuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram, { noEmit: true }); + + // Emit on both sys should result in same output + verifyBuilder(config, sys, emitSys, createEmitAndSemanticDiagnosticsBuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram); + + // Change file + sys.appendFile(mainFile.path, "\n// SomeComment"); + emitSys.appendFile(mainFile.path, "\n// SomeComment"); + + // Emit on both the builders should result in same files + verifyBuilder(config, sys, emitSys, createSemanticDiagnosticsBuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram); + }); + + it("noEmitOnError with composite writes the tsbuildinfo with pending affected files correctly", () => { + const config: File = { + path: `${projectRoot}/tsconfig.json`, + content: JSON.stringify({ compilerOptions: { composite: true } }) + }; + const mainFile: File = { + path: `${projectRoot}/main.ts`, + content: "export const x: string = 10;" + }; + const otherFile: File = { + path: `${projectRoot}/other.ts`, + content: "export const y = 10;" + }; + const sys = createWatchedSystem([config, mainFile, otherFile, libFile]); + const emitSys = createWatchedSystem([config, mainFile, otherFile, libFile]); + + // Verify noEmit results in same output + verifyBuilder(config, sys, emitSys, createSemanticDiagnosticsBuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram, { noEmitOnError: true }); + + // Change file + sys.appendFile(mainFile.path, "\n// SomeComment"); + emitSys.appendFile(mainFile.path, "\n// SomeComment"); + + // Verify noEmit results in same output + verifyBuilder(config, sys, emitSys, createSemanticDiagnosticsBuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram, { noEmitOnError: true }); + + // Fix error + const fixed = "export const x = 10;"; + sys.appendFile(mainFile.path, fixed); + emitSys.appendFile(mainFile.path, fixed); + + // Emit on both the builders should result in same files + verifyBuilder(config, sys, emitSys, createSemanticDiagnosticsBuilderProgram, createEmitAndSemanticDiagnosticsBuilderProgram, { noEmitOnError: true }); }); }); } diff --git a/src/testRunner/unittests/tsserver/autoImportProvider.ts b/src/testRunner/unittests/tsserver/autoImportProvider.ts index 3325f88e958..36d17d59d06 100644 --- a/src/testRunner/unittests/tsserver/autoImportProvider.ts +++ b/src/testRunner/unittests/tsserver/autoImportProvider.ts @@ -283,6 +283,25 @@ namespace ts.projectSystem { // Project for A is created - ensure it doesn't have an autoImportProvider assert.isUndefined(projectService.configuredProjects.get("/packages/a/tsconfig.json")!.getLanguageService().getAutoImportProvider()); }); + + it("Does not close when root files are redirects that don't actually exist", () => { + const files = [ + // packages/a + { path: "/packages/a/package.json", content: `{ "dependencies": { "b": "*" } }` }, + { path: "/packages/a/tsconfig.json", content: `{ "compilerOptions": { "composite": true }, "references": [{ "path": "./node_modules/b" }] }` }, + { path: "/packages/a/index.ts", content: "" }, + + // packages/b + { path: "/packages/a/node_modules/b/package.json", content: `{ "types": "dist/index.d.ts" }` }, + { path: "/packages/a/node_modules/b/tsconfig.json", content: `{ "compilerOptions": { "composite": true, "outDir": "dist" } }` }, + { path: "/packages/a/node_modules/b/index.ts", content: `export class B {}` } + ]; + + const { projectService, session } = setup(files); + openFilesForSession([files[2]], session); + assert.isDefined(projectService.configuredProjects.get("/packages/a/tsconfig.json")!.getPackageJsonAutoImportProvider()); + assert.isDefined(projectService.configuredProjects.get("/packages/a/tsconfig.json")!.getPackageJsonAutoImportProvider()); + }); }); function setup(files: File[]) { diff --git a/src/testRunner/unittests/tsserver/inferredProjects.ts b/src/testRunner/unittests/tsserver/inferredProjects.ts index 216273976e2..5bb545af0b5 100644 --- a/src/testRunner/unittests/tsserver/inferredProjects.ts +++ b/src/testRunner/unittests/tsserver/inferredProjects.ts @@ -429,5 +429,26 @@ namespace ts.projectSystem { configuredRemoved.clear(); } }); + + it("regression test - should infer typeAcquisition for inferred projects when set undefined", () => { + const file1 = { path: "/a/file1.js", content: "" }; + const host = createServerHost([file1]); + + const projectService = createProjectService(host); + + projectService.openClientFile(file1.path); + + checkNumberOfProjects(projectService, { inferredProjects: 1 }); + const inferredProject = projectService.inferredProjects[0]; + checkProjectActualFiles(inferredProject, [file1.path]); + inferredProject.setTypeAcquisition(undefined); + + const expected = { + enable: true, + include: [], + exclude: [] + }; + assert.deepEqual(inferredProject.getTypeAcquisition(), expected, "typeAcquisition should be inferred for inferred projects"); + }); }); } diff --git a/src/testRunner/unittests/tsserver/partialSemanticServer.ts b/src/testRunner/unittests/tsserver/partialSemanticServer.ts index d821ccc1a36..2c8b8ed14b0 100644 --- a/src/testRunner/unittests/tsserver/partialSemanticServer.ts +++ b/src/testRunner/unittests/tsserver/partialSemanticServer.ts @@ -172,5 +172,36 @@ function fooB() { }` openFilesForSession([file2], session); checkProjectActualFiles(project, [libFile.path, file2.path, file3.path]); }); + + it("should not create autoImportProvider or handle package jsons", () => { + const angularFormsDts: File = { + path: "/node_modules/@angular/forms/forms.d.ts", + content: "export declare class PatternValidator {}", + }; + const angularFormsPackageJson: File = { + path: "/node_modules/@angular/forms/package.json", + content: `{ "name": "@angular/forms", "typings": "./forms.d.ts" }`, + }; + const tsconfig: File = { + path: "/tsconfig.json", + content: `{ "compilerOptions": { "module": "commonjs" } }`, + }; + const packageJson: File = { + path: "/package.json", + content: `{ "dependencies": { "@angular/forms": "*", "@angular/core": "*" } }` + }; + const indexTs: File = { + path: "/index.ts", + content: "" + }; + const host = createServerHost([angularFormsDts, angularFormsPackageJson, tsconfig, packageJson, indexTs, libFile]); + const session = createSession(host, { serverMode: LanguageServiceMode.PartialSemantic, useSingleInferredProject: true }); + const service = session.getProjectService(); + openFilesForSession([indexTs], session); + const project = service.inferredProjects[0]; + assert.isFalse(project.autoImportProviderHost); + assert.isUndefined(project.getPackageJsonAutoImportProvider()); + assert.deepEqual(project.getPackageJsonsForAutoImport(), emptyArray); + }); }); } diff --git a/src/testRunner/unittests/tsserver/projectReferences.ts b/src/testRunner/unittests/tsserver/projectReferences.ts index 44ba7911a97..103143390fc 100644 --- a/src/testRunner/unittests/tsserver/projectReferences.ts +++ b/src/testRunner/unittests/tsserver/projectReferences.ts @@ -2189,19 +2189,14 @@ export function bar() {}` verifySolutionScenario({ configRefs: ["./tsconfig-indirect1.json", "./tsconfig-indirect2.json"], additionalFiles: [tsconfigIndirect, indirect, tsconfigIndirect2, indirect2], - additionalProjects: [{ - projectName: tsconfigIndirect.path, - files: [tsconfigIndirect.path, main.path, helper.path, indirect.path, libFile.path] - }], + additionalProjects: emptyArray, expectedOpenEvents: [ ...expectedSolutionLoadAndTelemetry(), - ...expectedProjectReferenceLoadAndTelemetry(tsconfigIndirect.path), ...expectedProjectReferenceLoadAndTelemetry(tsconfigSrcPath), configFileDiagEvent(main.path, tsconfigSrcPath, []) ], expectedReloadEvents: [ ...expectedReloadEvent(tsconfigPath), - ...expectedReloadEvent(tsconfigIndirect.path), ...expectedReloadEvent(tsconfigSrcPath), ], expectedReferences: { @@ -2217,8 +2212,8 @@ export function bar() {}` refs: [ ...expectedIndirectRefs(fileResolvingToMainDts), ...refs, - ...expectedIndirectRefs(indirect2), ...expectedIndirectRefs(indirect), + ...expectedIndirectRefs(indirect2), ], symbolDisplayString: "(alias) const foo: 1\nimport foo", } @@ -2296,8 +2291,6 @@ export function bar() {}` const expectedProjectsOnOpen: VerifyProjects = { configuredProjects: [ { projectName: tsconfigPath, files: [tsconfigPath] }, - { projectName: tsconfigIndirect.path, files: [tsconfigIndirect.path, main.path, helper.path, indirect.path, libFile.path] }, - { projectName: tsconfigIndirect2.path, files: [tsconfigIndirect2.path, main.path, helper.path, indirect2.path, libFile.path] }, { projectName: tsconfigSrcPath, files: [tsconfigSrcPath, main.path, helper.path, libFile.path] }, ], inferredProjects: emptyArray @@ -2307,8 +2300,6 @@ export function bar() {}` additionalFiles: [tsconfigIndirect, indirect, tsconfigIndirect2, indirect2], expectedOpenEvents: [ ...expectedSolutionLoadAndTelemetry(), - ...expectedProjectReferenceLoadAndTelemetry(tsconfigIndirect.path), - ...expectedProjectReferenceLoadAndTelemetry(tsconfigIndirect2.path), ...expectedProjectReferenceLoadAndTelemetry(tsconfigSrcPath), configFileDiagEvent(main.path, tsconfigSrcPath, []) ], @@ -2317,9 +2308,7 @@ export function bar() {}` expectedProjectsOnOpen, expectedReloadEvents: [ ...expectedReloadEvent(tsconfigPath), - ...expectedReloadEvent(tsconfigIndirect.path), ...expectedReloadEvent(tsconfigSrcPath), - ...expectedReloadEvent(tsconfigIndirect2.path), ] }); }); @@ -2387,19 +2376,14 @@ bar;` solutionProject: [tsconfigPath, indirect.path, ownMain.path, main.path, libFile.path, helper.path], configRefs: ["./tsconfig-indirect1.json", "./tsconfig-indirect2.json"], additionalFiles: [tsconfigIndirect, indirect, tsconfigIndirect2, indirect2, ownMain], - additionalProjects: [{ - projectName: tsconfigIndirect.path, - files: [tsconfigIndirect.path, main.path, helper.path, indirect.path, libFile.path] - }], + additionalProjects: emptyArray, expectedOpenEvents: [ ...expectedSolutionLoadAndTelemetry(), - ...expectedProjectReferenceLoadAndTelemetry(tsconfigIndirect.path), ...expectedProjectReferenceLoadAndTelemetry(tsconfigSrcPath), configFileDiagEvent(main.path, tsconfigSrcPath, []) ], expectedReloadEvents: [ ...expectedReloadEvent(tsconfigPath), - ...expectedReloadEvent(tsconfigIndirect.path), ...expectedReloadEvent(tsconfigSrcPath), ], expectedReferences: { @@ -2415,8 +2399,8 @@ bar;` refs: [ ...expectedIndirectRefs(fileResolvingToMainDts), ...refs, - ...expectedIndirectRefs(indirect2), ...expectedIndirectRefs(indirect), + ...expectedIndirectRefs(indirect2), ], symbolDisplayString: "(alias) const foo: 1\nimport foo", } @@ -2502,8 +2486,6 @@ bar;` const expectedProjectsOnOpen: VerifyProjects = { configuredProjects: [ { projectName: tsconfigPath, files: [tsconfigPath, indirect.path, ownMain.path, main.path, libFile.path, helper.path] }, - { projectName: tsconfigIndirect.path, files: [tsconfigIndirect.path, main.path, helper.path, indirect.path, libFile.path] }, - { projectName: tsconfigIndirect2.path, files: [tsconfigIndirect2.path, main.path, helper.path, indirect2.path, libFile.path] }, { projectName: tsconfigSrcPath, files: [tsconfigSrcPath, main.path, helper.path, libFile.path] }, ], inferredProjects: emptyArray @@ -2518,8 +2500,6 @@ bar;` additionalFiles: [tsconfigIndirect, indirect, tsconfigIndirect2, indirect2, ownMain], expectedOpenEvents: [ ...expectedSolutionLoadAndTelemetry(), - ...expectedProjectReferenceLoadAndTelemetry(tsconfigIndirect.path), - ...expectedProjectReferenceLoadAndTelemetry(tsconfigIndirect2.path), ...expectedProjectReferenceLoadAndTelemetry(tsconfigSrcPath), configFileDiagEvent(main.path, tsconfigSrcPath, []) ], @@ -2528,9 +2508,7 @@ bar;` expectedProjectsOnOpen, expectedReloadEvents: [ ...expectedReloadEvent(tsconfigPath), - ...expectedReloadEvent(tsconfigIndirect.path), ...expectedReloadEvent(tsconfigSrcPath), - ...expectedReloadEvent(tsconfigIndirect2.path), ] }); }); @@ -2645,5 +2623,75 @@ bar;` verifyAutoImport(/*built*/ true, /*disableSourceOfProjectReferenceRedirect*/ true); }); }); + + it("when files from two projects are open and one project references", () => { + function getPackageAndFile(packageName: string, references?: string[], optionsToExtend?: CompilerOptions): [file: File, config: File] { + const file: File = { + path: `${tscWatch.projectRoot}/${packageName}/src/file1.ts`, + content: `export const ${packageName}Const = 10;` + }; + const config: File = { + path: `${tscWatch.projectRoot}/${packageName}/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { composite: true, ...optionsToExtend || {} }, + references: references?.map(path => ({ path: `../${path}` })) + }) + }; + return [file, config]; + } + const [mainFile, mainConfig] = getPackageAndFile("main", ["core", "indirect", "noCoreRef1", "indirectDisabledChildLoad1", "indirectDisabledChildLoad2", "refToCoreRef3", "indirectNoCoreRef"]); + const [coreFile, coreConfig] = getPackageAndFile("core"); + const [noCoreRef1File, noCoreRef1Config] = getPackageAndFile("noCoreRef1"); + const [indirectFile, indirectConfig] = getPackageAndFile("indirect", ["coreRef1"]); + const [coreRef1File, coreRef1Config] = getPackageAndFile("coreRef1", ["core"]); + const [indirectDisabledChildLoad1File, indirectDisabledChildLoad1Config] = getPackageAndFile("indirectDisabledChildLoad1", ["coreRef2"], { disableReferencedProjectLoad: true }); + const [coreRef2File, coreRef2Config] = getPackageAndFile("coreRef2", ["core"]); + const [indirectDisabledChildLoad2File, indirectDisabledChildLoad2Config] = getPackageAndFile("indirectDisabledChildLoad2", ["coreRef3"], { disableReferencedProjectLoad: true }); + const [coreRef3File, coreRef3Config] = getPackageAndFile("coreRef3", ["core"]); + const [refToCoreRef3File, refToCoreRef3Config] = getPackageAndFile("refToCoreRef3", ["coreRef3"]); + const [indirectNoCoreRefFile, indirectNoCoreRefConfig] = getPackageAndFile("indirectNoCoreRef", ["noCoreRef2"]); + const [noCoreRef2File, noCoreRef2Config] = getPackageAndFile("noCoreRef2"); + + const host = createServerHost([ + libFile, mainFile, mainConfig, coreFile, coreConfig, noCoreRef1File, noCoreRef1Config, + indirectFile, indirectConfig, coreRef1File, coreRef1Config, + indirectDisabledChildLoad1File, indirectDisabledChildLoad1Config, coreRef2File, coreRef2Config, + indirectDisabledChildLoad2File, indirectDisabledChildLoad2Config, coreRef3File, coreRef3Config, + refToCoreRef3File, refToCoreRef3Config, + indirectNoCoreRefFile, indirectNoCoreRefConfig, noCoreRef2File, noCoreRef2Config + ], { useCaseSensitiveFileNames: true }); + const session = createSession(host); + const service = session.getProjectService(); + openFilesForSession([mainFile, coreFile], session); + + verifyProject(mainConfig); + verifyProject(coreConfig); + + // Find all refs in coreFile + session.executeCommandSeq({ + command: protocol.CommandTypes.References, + arguments: protocolFileLocationFromSubstring(coreFile, `coreConst`) + }); + verifyProject(mainConfig); + verifyProject(coreConfig); + verifyNoProject(noCoreRef1Config); // Should not be loaded + verifyProject(indirectConfig); + verifyProject(coreRef1Config); + verifyProject(indirectDisabledChildLoad1Config); + verifyNoProject(coreRef2Config); // Should not be loaded + verifyProject(indirectDisabledChildLoad2Config); + verifyProject(coreRef3Config); + verifyProject(refToCoreRef3Config); + verifyNoProject(indirectNoCoreRefConfig); // Should not be loaded + verifyNoProject(noCoreRef2Config); // Should not be loaded + + function verifyProject(config: File) { + assert.isDefined(service.configuredProjects.get(config.path), `Expected to find ${config.path}`); + } + + function verifyNoProject(config: File) { + assert.isUndefined(service.configuredProjects.get(config.path), `Expected to not find ${config.path}`); + } + }); }); } diff --git a/src/testRunner/unittests/tsserver/projects.ts b/src/testRunner/unittests/tsserver/projects.ts index 2de2da67af3..0afe37c4639 100644 --- a/src/testRunner/unittests/tsserver/projects.ts +++ b/src/testRunner/unittests/tsserver/projects.ts @@ -1481,6 +1481,48 @@ namespace ts.projectSystem { ]); }); + it("synchronizeProjectList returns correct information when base configuration file cannot be resolved", () => { + const file: File = { + path: `${tscWatch.projectRoot}/index.ts`, + content: "export const foo = 5;" + }; + const config: File = { + path: `${tscWatch.projectRoot}/tsconfig.json`, + content: JSON.stringify({ extends: "./tsconfig_base.json" }) + }; + const host = createServerHost([file, config, libFile]); + const projectService = createProjectService(host); + projectService.openClientFile(file.path); + const knownProjects = projectService.synchronizeProjectList([], /*includeProjectReferenceRedirectInfo*/ false); + assert.deepEqual(knownProjects[0].files, [ + libFile.path, + file.path, + config.path, + `${tscWatch.projectRoot}/tsconfig_base.json`, + ]); + }); + + it("synchronizeProjectList returns correct information when base configuration file cannot be resolved and redirect info is requested", () => { + const file: File = { + path: `${tscWatch.projectRoot}/index.ts`, + content: "export const foo = 5;" + }; + const config: File = { + path: `${tscWatch.projectRoot}/tsconfig.json`, + content: JSON.stringify({ extends: "./tsconfig_base.json" }) + }; + const host = createServerHost([file, config, libFile]); + const projectService = createProjectService(host); + projectService.openClientFile(file.path); + const knownProjects = projectService.synchronizeProjectList([], /*includeProjectReferenceRedirectInfo*/ true); + assert.deepEqual(knownProjects[0].files, [ + { fileName: libFile.path, isSourceOfProjectReferenceRedirect: false }, + { fileName: file.path, isSourceOfProjectReferenceRedirect: false }, + { fileName: config.path, isSourceOfProjectReferenceRedirect: false }, + { fileName: `${tscWatch.projectRoot}/tsconfig_base.json`, isSourceOfProjectReferenceRedirect: false }, + ]); + }); + it("handles delayed directory watch invoke on file creation", () => { const projectRootPath = "/users/username/projects/project"; const fileB: File = { diff --git a/src/testRunner/unittests/tsserver/typingsInstaller.ts b/src/testRunner/unittests/tsserver/typingsInstaller.ts index e9c77566b70..26ce8eca6dd 100644 --- a/src/testRunner/unittests/tsserver/typingsInstaller.ts +++ b/src/testRunner/unittests/tsserver/typingsInstaller.ts @@ -207,6 +207,50 @@ namespace ts.projectSystem { checkProjectActualFiles(p, [file1.path, jquery.path]); }); + it("inferred project - type acquisition with disableFilenameBasedTypeAcquisition:true", () => { + // Tests: + // Exclude file with disableFilenameBasedTypeAcquisition:true + const jqueryJs = { + path: "/a/b/jquery.js", + content: "" + }; + + const messages: string[] = []; + const host = createServerHost([jqueryJs]); + const installer = new (class extends Installer { + constructor() { + super(host, { typesRegistry: createTypesRegistry("jquery") }, { isEnabled: () => true, writeLine: msg => messages.push(msg) }); + } + enqueueInstallTypingsRequest(project: server.Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray) { + super.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports); + } + installWorker(_requestId: number, _args: string[], _cwd: string, cb: TI.RequestCompletedAction): void { + const installedTypings: string[] = []; + const typingFiles: File[] = []; + executeCommand(this, host, installedTypings, typingFiles, cb); + } + })(); + + const projectService = createProjectService(host, { typingsInstaller: installer }); + projectService.setCompilerOptionsForInferredProjects({ + allowJs: true, + enable: true, + disableFilenameBasedTypeAcquisition: true + }); + projectService.openClientFile(jqueryJs.path); + + checkNumberOfProjects(projectService, { inferredProjects: 1 }); + const p = projectService.inferredProjects[0]; + checkProjectActualFiles(p, [jqueryJs.path]); + + installer.installAll(/*expectedCount*/ 0); + host.checkTimeoutQueueLengthAndRun(2); + checkNumberOfProjects(projectService, { inferredProjects: 1 }); + // files should not be removed from project if ATA is skipped + checkProjectActualFiles(p, [jqueryJs.path]); + assert.isTrue(messages.indexOf("No new typings were requested as a result of typings discovery") > 0, "Should not request filename-based typings"); + }); + it("external project - no type acquisition, no .d.ts/js files", () => { const file1 = { path: "/a/b/app.ts", @@ -434,6 +478,51 @@ namespace ts.projectSystem { installer.checkPendingCommands(/*expectedCount*/ 0); }); + + it("external project - type acquisition with disableFilenameBasedTypeAcquisition:true", () => { + // Tests: + // Exclude file with disableFilenameBasedTypeAcquisition:true + const jqueryJs = { + path: "/a/b/jquery.js", + content: "" + }; + + const messages: string[] = []; + const host = createServerHost([jqueryJs]); + const installer = new (class extends Installer { + constructor() { + super(host, { typesRegistry: createTypesRegistry("jquery") }, { isEnabled: () => true, writeLine: msg => messages.push(msg) }); + } + enqueueInstallTypingsRequest(project: server.Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray) { + super.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports); + } + installWorker(_requestId: number, _args: string[], _cwd: string, cb: TI.RequestCompletedAction): void { + const installedTypings: string[] = []; + const typingFiles: File[] = []; + executeCommand(this, host, installedTypings, typingFiles, cb); + } + })(); + + const projectFileName = "/a/app/test.csproj"; + const projectService = createProjectService(host, { typingsInstaller: installer }); + projectService.openExternalProject({ + projectFileName, + options: { allowJS: true, moduleResolution: ModuleResolutionKind.NodeJs }, + rootFiles: [toExternalFile(jqueryJs.path)], + typeAcquisition: { enable: true, disableFilenameBasedTypeAcquisition: true } + }); + + const p = projectService.externalProjects[0]; + projectService.checkNumberOfProjects({ externalProjects: 1 }); + checkProjectActualFiles(p, [jqueryJs.path]); + + installer.installAll(/*expectedCount*/ 0); + projectService.checkNumberOfProjects({ externalProjects: 1 }); + // files should not be removed from project if ATA is skipped + checkProjectActualFiles(p, [jqueryJs.path]); + assert.isTrue(messages.indexOf("No new typings were requested as a result of typings discovery") > 0, "Should not request filename-based typings"); + }); + it("external project - no type acquisition, with js & ts files", () => { // Tests: // 1. No typings are included for JS projects when the project contains ts files diff --git a/src/tsserver/server.ts b/src/tsserver/server.ts index 3f6ba6b2a17..306cbd7bba3 100644 --- a/src/tsserver/server.ts +++ b/src/tsserver/server.ts @@ -323,7 +323,11 @@ namespace ts.server { this.installer = childProcess.fork(combinePaths(__dirname, "typingsInstaller.js"), args, { execArgv }); this.installer.on("message", m => this.handleMessage(m)); - this.event({ pid: this.installer.pid }, "typingsInstallerPid"); + // We have to schedule this event to the next tick + // cause this fn will be called during + // new IOSession => super(which is Session) => new ProjectService => NodeTypingsInstaller.attach + // and if "event" is referencing "this" before super class is initialized, it will be a ReferenceError in ES6 class. + this.host.setImmediate(() => this.event({ pid: this.installer.pid }, "typingsInstallerPid")); process.on("exit", () => { this.installer.kill(); @@ -481,21 +485,12 @@ namespace ts.server { private eventPort: number | undefined; private eventSocket: NodeSocket | undefined; private socketEventQueue: { body: any, eventName: string }[] | undefined; + /** No longer needed if syntax target is es6 or above. Any access to "this" before initialized will be a runtime error. */ private constructed: boolean | undefined; constructor() { - const event: Event | undefined = (body: object, eventName: string) => { - if (this.constructed) { - this.event(body, eventName); - } - else { - // It is unsafe to dereference `this` before initialization completes, - // so we defer until the next tick. - // - // Construction should finish before the next tick fires, so we do not need to do this recursively. - // eslint-disable-next-line no-restricted-globals - setImmediate(() => this.event(body, eventName)); - } + const event = (body: object, eventName: string) => { + this.event(body, eventName); }; const host = sys; diff --git a/tests/baselines/reference/ambientConstLiterals.types b/tests/baselines/reference/ambientConstLiterals.types index a40532f8017..664e730dd63 100644 --- a/tests/baselines/reference/ambientConstLiterals.types +++ b/tests/baselines/reference/ambientConstLiterals.types @@ -12,7 +12,7 @@ enum E { A, B, C, "non identifier" } >A : E.A >B : E.B >C : E.C ->"non identifier" : E.non identifier +>"non identifier" : typeof E["non identifier"] const c1 = "abc"; >c1 : "abc" @@ -54,8 +54,8 @@ const c8 = E.A; >A : E.A const c8b = E["non identifier"]; ->c8b : E.non identifier ->E["non identifier"] : E.non identifier +>c8b : typeof E["non identifier"] +>E["non identifier"] : typeof E["non identifier"] >E : typeof E >"non identifier" : "non identifier" diff --git a/tests/baselines/reference/anonymousModules.errors.txt b/tests/baselines/reference/anonymousModules.errors.txt index b81513cfbbd..b14520a8c1c 100644 --- a/tests/baselines/reference/anonymousModules.errors.txt +++ b/tests/baselines/reference/anonymousModules.errors.txt @@ -1,22 +1,22 @@ -tests/cases/compiler/anonymousModules.ts(1,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node`. +tests/cases/compiler/anonymousModules.ts(1,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. tests/cases/compiler/anonymousModules.ts(1,8): error TS1005: ';' expected. -tests/cases/compiler/anonymousModules.ts(4,2): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node`. +tests/cases/compiler/anonymousModules.ts(4,2): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. tests/cases/compiler/anonymousModules.ts(4,9): error TS1005: ';' expected. -tests/cases/compiler/anonymousModules.ts(10,2): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node`. +tests/cases/compiler/anonymousModules.ts(10,2): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. tests/cases/compiler/anonymousModules.ts(10,9): error TS1005: ';' expected. ==== tests/cases/compiler/anonymousModules.ts (6 errors) ==== module { ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node`. +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ~ !!! error TS1005: ';' expected. export var foo = 1; module { ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node`. +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ~ !!! error TS1005: ';' expected. export var bar = 1; @@ -26,7 +26,7 @@ tests/cases/compiler/anonymousModules.ts(10,9): error TS1005: ';' expected. module { ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node`. +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ~ !!! error TS1005: ';' expected. var x = bar; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 58167e3f7b9..95963d1ef5d 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -240,215 +240,212 @@ declare namespace ts { DeclareKeyword = 133, GetKeyword = 134, InferKeyword = 135, - IsKeyword = 136, - KeyOfKeyword = 137, - ModuleKeyword = 138, - NamespaceKeyword = 139, - NeverKeyword = 140, - ReadonlyKeyword = 141, - RequireKeyword = 142, - NumberKeyword = 143, - ObjectKeyword = 144, - SetKeyword = 145, - StringKeyword = 146, - SymbolKeyword = 147, - TypeKeyword = 148, - UndefinedKeyword = 149, - UniqueKeyword = 150, - UnknownKeyword = 151, - FromKeyword = 152, - GlobalKeyword = 153, - BigIntKeyword = 154, - UppercaseKeyword = 155, - LowercaseKeyword = 156, - CapitalizeKeyword = 157, - UncapitalizeKeyword = 158, - OfKeyword = 159, - QualifiedName = 160, - ComputedPropertyName = 161, - TypeParameter = 162, - Parameter = 163, - Decorator = 164, - PropertySignature = 165, - PropertyDeclaration = 166, - MethodSignature = 167, - MethodDeclaration = 168, - Constructor = 169, - GetAccessor = 170, - SetAccessor = 171, - CallSignature = 172, - ConstructSignature = 173, - IndexSignature = 174, - TypePredicate = 175, - TypeReference = 176, - FunctionType = 177, - ConstructorType = 178, - TypeQuery = 179, - TypeLiteral = 180, - ArrayType = 181, - TupleType = 182, - OptionalType = 183, - RestType = 184, - UnionType = 185, - IntersectionType = 186, - ConditionalType = 187, - InferType = 188, - ParenthesizedType = 189, - ThisType = 190, - TypeOperator = 191, - IndexedAccessType = 192, - MappedType = 193, - LiteralType = 194, - NamedTupleMember = 195, - TemplateLiteralType = 196, - TemplateLiteralTypeSpan = 197, - ImportType = 198, - ObjectBindingPattern = 199, - ArrayBindingPattern = 200, - BindingElement = 201, - ArrayLiteralExpression = 202, - ObjectLiteralExpression = 203, - PropertyAccessExpression = 204, - ElementAccessExpression = 205, - CallExpression = 206, - NewExpression = 207, - TaggedTemplateExpression = 208, - TypeAssertionExpression = 209, - ParenthesizedExpression = 210, - FunctionExpression = 211, - ArrowFunction = 212, - DeleteExpression = 213, - TypeOfExpression = 214, - VoidExpression = 215, - AwaitExpression = 216, - PrefixUnaryExpression = 217, - PostfixUnaryExpression = 218, - BinaryExpression = 219, - ConditionalExpression = 220, - TemplateExpression = 221, - YieldExpression = 222, - SpreadElement = 223, - ClassExpression = 224, - OmittedExpression = 225, - ExpressionWithTypeArguments = 226, - AsExpression = 227, - NonNullExpression = 228, - MetaProperty = 229, - SyntheticExpression = 230, - TemplateSpan = 231, - SemicolonClassElement = 232, - Block = 233, - EmptyStatement = 234, - VariableStatement = 235, - ExpressionStatement = 236, - IfStatement = 237, - DoStatement = 238, - WhileStatement = 239, - ForStatement = 240, - ForInStatement = 241, - ForOfStatement = 242, - ContinueStatement = 243, - BreakStatement = 244, - ReturnStatement = 245, - WithStatement = 246, - SwitchStatement = 247, - LabeledStatement = 248, - ThrowStatement = 249, - TryStatement = 250, - DebuggerStatement = 251, - VariableDeclaration = 252, - VariableDeclarationList = 253, - FunctionDeclaration = 254, - ClassDeclaration = 255, - InterfaceDeclaration = 256, - TypeAliasDeclaration = 257, - EnumDeclaration = 258, - ModuleDeclaration = 259, - ModuleBlock = 260, - CaseBlock = 261, - NamespaceExportDeclaration = 262, - ImportEqualsDeclaration = 263, - ImportDeclaration = 264, - ImportClause = 265, - NamespaceImport = 266, - NamedImports = 267, - ImportSpecifier = 268, - ExportAssignment = 269, - ExportDeclaration = 270, - NamedExports = 271, - NamespaceExport = 272, - ExportSpecifier = 273, - MissingDeclaration = 274, - ExternalModuleReference = 275, - JsxElement = 276, - JsxSelfClosingElement = 277, - JsxOpeningElement = 278, - JsxClosingElement = 279, - JsxFragment = 280, - JsxOpeningFragment = 281, - JsxClosingFragment = 282, - JsxAttribute = 283, - JsxAttributes = 284, - JsxSpreadAttribute = 285, - JsxExpression = 286, - CaseClause = 287, - DefaultClause = 288, - HeritageClause = 289, - CatchClause = 290, - PropertyAssignment = 291, - ShorthandPropertyAssignment = 292, - SpreadAssignment = 293, - EnumMember = 294, - UnparsedPrologue = 295, - UnparsedPrepend = 296, - UnparsedText = 297, - UnparsedInternalText = 298, - UnparsedSyntheticReference = 299, - SourceFile = 300, - Bundle = 301, - UnparsedSource = 302, - InputFiles = 303, - JSDocTypeExpression = 304, - JSDocNameReference = 305, - JSDocAllType = 306, - JSDocUnknownType = 307, - JSDocNullableType = 308, - JSDocNonNullableType = 309, - JSDocOptionalType = 310, - JSDocFunctionType = 311, - JSDocVariadicType = 312, - JSDocNamepathType = 313, - JSDocComment = 314, - JSDocTypeLiteral = 315, - JSDocSignature = 316, - JSDocTag = 317, - JSDocAugmentsTag = 318, - JSDocImplementsTag = 319, - JSDocAuthorTag = 320, - JSDocDeprecatedTag = 321, - JSDocClassTag = 322, - JSDocPublicTag = 323, - JSDocPrivateTag = 324, - JSDocProtectedTag = 325, - JSDocReadonlyTag = 326, - JSDocCallbackTag = 327, - JSDocEnumTag = 328, - JSDocParameterTag = 329, - JSDocReturnTag = 330, - JSDocThisTag = 331, - JSDocTypeTag = 332, - JSDocTemplateTag = 333, - JSDocTypedefTag = 334, - JSDocSeeTag = 335, - JSDocPropertyTag = 336, - SyntaxList = 337, - NotEmittedStatement = 338, - PartiallyEmittedExpression = 339, - CommaListExpression = 340, - MergeDeclarationMarker = 341, - EndOfDeclarationMarker = 342, - SyntheticReferenceExpression = 343, - Count = 344, + IntrinsicKeyword = 136, + IsKeyword = 137, + KeyOfKeyword = 138, + ModuleKeyword = 139, + NamespaceKeyword = 140, + NeverKeyword = 141, + ReadonlyKeyword = 142, + RequireKeyword = 143, + NumberKeyword = 144, + ObjectKeyword = 145, + SetKeyword = 146, + StringKeyword = 147, + SymbolKeyword = 148, + TypeKeyword = 149, + UndefinedKeyword = 150, + UniqueKeyword = 151, + UnknownKeyword = 152, + FromKeyword = 153, + GlobalKeyword = 154, + BigIntKeyword = 155, + OfKeyword = 156, + QualifiedName = 157, + ComputedPropertyName = 158, + TypeParameter = 159, + Parameter = 160, + Decorator = 161, + PropertySignature = 162, + PropertyDeclaration = 163, + MethodSignature = 164, + MethodDeclaration = 165, + Constructor = 166, + GetAccessor = 167, + SetAccessor = 168, + CallSignature = 169, + ConstructSignature = 170, + IndexSignature = 171, + TypePredicate = 172, + TypeReference = 173, + FunctionType = 174, + ConstructorType = 175, + TypeQuery = 176, + TypeLiteral = 177, + ArrayType = 178, + TupleType = 179, + OptionalType = 180, + RestType = 181, + UnionType = 182, + IntersectionType = 183, + ConditionalType = 184, + InferType = 185, + ParenthesizedType = 186, + ThisType = 187, + TypeOperator = 188, + IndexedAccessType = 189, + MappedType = 190, + LiteralType = 191, + NamedTupleMember = 192, + TemplateLiteralType = 193, + TemplateLiteralTypeSpan = 194, + ImportType = 195, + ObjectBindingPattern = 196, + ArrayBindingPattern = 197, + BindingElement = 198, + ArrayLiteralExpression = 199, + ObjectLiteralExpression = 200, + PropertyAccessExpression = 201, + ElementAccessExpression = 202, + CallExpression = 203, + NewExpression = 204, + TaggedTemplateExpression = 205, + TypeAssertionExpression = 206, + ParenthesizedExpression = 207, + FunctionExpression = 208, + ArrowFunction = 209, + DeleteExpression = 210, + TypeOfExpression = 211, + VoidExpression = 212, + AwaitExpression = 213, + PrefixUnaryExpression = 214, + PostfixUnaryExpression = 215, + BinaryExpression = 216, + ConditionalExpression = 217, + TemplateExpression = 218, + YieldExpression = 219, + SpreadElement = 220, + ClassExpression = 221, + OmittedExpression = 222, + ExpressionWithTypeArguments = 223, + AsExpression = 224, + NonNullExpression = 225, + MetaProperty = 226, + SyntheticExpression = 227, + TemplateSpan = 228, + SemicolonClassElement = 229, + Block = 230, + EmptyStatement = 231, + VariableStatement = 232, + ExpressionStatement = 233, + IfStatement = 234, + DoStatement = 235, + WhileStatement = 236, + ForStatement = 237, + ForInStatement = 238, + ForOfStatement = 239, + ContinueStatement = 240, + BreakStatement = 241, + ReturnStatement = 242, + WithStatement = 243, + SwitchStatement = 244, + LabeledStatement = 245, + ThrowStatement = 246, + TryStatement = 247, + DebuggerStatement = 248, + VariableDeclaration = 249, + VariableDeclarationList = 250, + FunctionDeclaration = 251, + ClassDeclaration = 252, + InterfaceDeclaration = 253, + TypeAliasDeclaration = 254, + EnumDeclaration = 255, + ModuleDeclaration = 256, + ModuleBlock = 257, + CaseBlock = 258, + NamespaceExportDeclaration = 259, + ImportEqualsDeclaration = 260, + ImportDeclaration = 261, + ImportClause = 262, + NamespaceImport = 263, + NamedImports = 264, + ImportSpecifier = 265, + ExportAssignment = 266, + ExportDeclaration = 267, + NamedExports = 268, + NamespaceExport = 269, + ExportSpecifier = 270, + MissingDeclaration = 271, + ExternalModuleReference = 272, + JsxElement = 273, + JsxSelfClosingElement = 274, + JsxOpeningElement = 275, + JsxClosingElement = 276, + JsxFragment = 277, + JsxOpeningFragment = 278, + JsxClosingFragment = 279, + JsxAttribute = 280, + JsxAttributes = 281, + JsxSpreadAttribute = 282, + JsxExpression = 283, + CaseClause = 284, + DefaultClause = 285, + HeritageClause = 286, + CatchClause = 287, + PropertyAssignment = 288, + ShorthandPropertyAssignment = 289, + SpreadAssignment = 290, + EnumMember = 291, + UnparsedPrologue = 292, + UnparsedPrepend = 293, + UnparsedText = 294, + UnparsedInternalText = 295, + UnparsedSyntheticReference = 296, + SourceFile = 297, + Bundle = 298, + UnparsedSource = 299, + InputFiles = 300, + JSDocTypeExpression = 301, + JSDocNameReference = 302, + JSDocAllType = 303, + JSDocUnknownType = 304, + JSDocNullableType = 305, + JSDocNonNullableType = 306, + JSDocOptionalType = 307, + JSDocFunctionType = 308, + JSDocVariadicType = 309, + JSDocNamepathType = 310, + JSDocComment = 311, + JSDocTypeLiteral = 312, + JSDocSignature = 313, + JSDocTag = 314, + JSDocAugmentsTag = 315, + JSDocImplementsTag = 316, + JSDocAuthorTag = 317, + JSDocDeprecatedTag = 318, + JSDocClassTag = 319, + JSDocPublicTag = 320, + JSDocPrivateTag = 321, + JSDocProtectedTag = 322, + JSDocReadonlyTag = 323, + JSDocCallbackTag = 324, + JSDocEnumTag = 325, + JSDocParameterTag = 326, + JSDocReturnTag = 327, + JSDocThisTag = 328, + JSDocTypeTag = 329, + JSDocTemplateTag = 330, + JSDocTypedefTag = 331, + JSDocSeeTag = 332, + JSDocPropertyTag = 333, + SyntaxList = 334, + NotEmittedStatement = 335, + PartiallyEmittedExpression = 336, + CommaListExpression = 337, + MergeDeclarationMarker = 338, + EndOfDeclarationMarker = 339, + SyntheticReferenceExpression = 340, + Count = 341, FirstAssignment = 62, LastAssignment = 77, FirstCompoundAssignment = 63, @@ -456,15 +453,15 @@ declare namespace ts { FirstReservedWord = 80, LastReservedWord = 115, FirstKeyword = 80, - LastKeyword = 159, + LastKeyword = 156, FirstFutureReservedWord = 116, LastFutureReservedWord = 124, - FirstTypeNode = 175, - LastTypeNode = 198, + FirstTypeNode = 172, + LastTypeNode = 195, FirstPunctuation = 18, LastPunctuation = 77, FirstToken = 0, - LastToken = 159, + LastToken = 156, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -473,21 +470,21 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 77, - FirstStatement = 235, - LastStatement = 251, - FirstNode = 160, - FirstJSDocNode = 304, - LastJSDocNode = 336, - FirstJSDocTagNode = 317, - LastJSDocTagNode = 336, + FirstStatement = 232, + LastStatement = 248, + FirstNode = 157, + FirstJSDocNode = 301, + LastJSDocNode = 333, + FirstJSDocTagNode = 314, + LastJSDocTagNode = 333, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CapitalizeKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.LowercaseKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UncapitalizeKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.UppercaseKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.StaticKeyword; - export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; + export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; export type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.GreaterThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.Unknown | KeywordSyntaxKind; @@ -972,17 +969,9 @@ declare namespace ts { export interface TemplateLiteralTypeSpan extends TypeNode { readonly kind: SyntaxKind.TemplateLiteralTypeSpan; readonly parent: TemplateLiteralTypeNode; - readonly casing: TemplateCasing; readonly type: TypeNode; readonly literal: TemplateMiddle | TemplateTail; } - export enum TemplateCasing { - None = 0, - Uppercase = 1, - Lowercase = 2, - Capitalize = 3, - Uncapitalize = 4 - } export interface Expression extends Node { _expressionBrand: any; } @@ -2218,6 +2207,7 @@ declare namespace ts { getFullyQualifiedName(symbol: Symbol): string; getAugmentedPropertiesOfType(type: Type): Symbol[]; getRootSymbols(symbol: Symbol): readonly Symbol[]; + getSymbolOfExpando(node: Node, allowDeclaration: boolean): Symbol | undefined; getContextualType(node: Expression): Type | undefined; /** * returns unknownSignature in the case of an error. @@ -2489,11 +2479,12 @@ declare namespace ts { Substitution = 33554432, NonPrimitive = 67108864, TemplateLiteral = 134217728, + StringMapping = 268435456, Literal = 2944, Unit = 109440, StringOrNumberLiteral = 384, PossiblyFalsy = 117724, - StringLike = 134217860, + StringLike = 402653316, NumberLike = 296, BigIntLike = 2112, BooleanLike = 528, @@ -2504,10 +2495,10 @@ declare namespace ts { StructuredType = 3670016, TypeVariable = 8650752, InstantiableNonPrimitive = 58982400, - InstantiablePrimitive = 138412032, - Instantiable = 197394432, - StructuredOrInstantiable = 201064448, - Narrowable = 268188671, + InstantiablePrimitive = 406847488, + Instantiable = 465829888, + StructuredOrInstantiable = 469499904, + Narrowable = 536624127, } export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; export interface Type { @@ -2660,9 +2651,12 @@ declare namespace ts { } export interface TemplateLiteralType extends InstantiableType { texts: readonly string[]; - casings: readonly TemplateCasing[]; types: readonly Type[]; } + export interface StringMappingType extends InstantiableType { + symbol: Symbol; + type: Type; + } export interface SubstitutionType extends InstantiableType { baseType: Type; substitute: Type; @@ -2897,7 +2891,8 @@ declare namespace ts { enable?: boolean; include?: string[]; exclude?: string[]; - [option: string]: string[] | boolean | undefined; + disableFilenameBasedTypeAcquisition?: boolean; + [option: string]: CompilerOptionsValue | undefined; } export enum ModuleKind { None = 0, @@ -3225,8 +3220,8 @@ declare namespace ts { updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructSignatureDeclaration; createIndexSignature(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; updateIndexSignature(node: IndexSignatureDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; - createTemplateLiteralTypeSpan(casing: TemplateCasing, type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; - updateTemplateLiteralTypeSpan(casing: TemplateCasing, node: TemplateLiteralTypeSpan, type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; + createTemplateLiteralTypeSpan(type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; + updateTemplateLiteralTypeSpan(node: TemplateLiteralTypeSpan, type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; createKeywordTypeNode(kind: TKind): KeywordTypeNode; createTypePredicateNode(assertsModifier: AssertsKeyword | undefined, parameterName: Identifier | ThisTypeNode | string, type: TypeNode | undefined): TypePredicateNode; updateTypePredicateNode(node: TypePredicateNode, assertsModifier: AssertsKeyword | undefined, parameterName: Identifier | ThisTypeNode, type: TypeNode | undefined): TypePredicateNode; @@ -4057,6 +4052,14 @@ declare namespace ts { function getOriginalNode(node: Node, nodeTest: (node: Node) => node is T): T; function getOriginalNode(node: Node | undefined): Node | undefined; function getOriginalNode(node: Node | undefined, nodeTest: (node: Node | undefined) => node is T): T | undefined; + /** + * Iterates through the parent chain of a node and performs the callback on each parent until the callback + * returns a truthy value, then returns that value. + * If no such value is found, it applies the callback until the parent pointer is undefined or the callback returns "quit" + * At that point findAncestor returns undefined. + */ + function findAncestor(node: Node | undefined, callback: (element: Node) => element is T): T | undefined; + function findAncestor(node: Node | undefined, callback: (element: Node) => boolean | "quit"): Node | undefined; /** * Gets a value indicating whether a node originated in the parse tree. * @@ -4375,6 +4378,8 @@ declare namespace ts { function isMappedTypeNode(node: Node): node is MappedTypeNode; function isLiteralTypeNode(node: Node): node is LiteralTypeNode; function isImportTypeNode(node: Node): node is ImportTypeNode; + function isTemplateLiteralTypeSpan(node: Node): node is TemplateLiteralTypeSpan; + function isTemplateLiteralTypeNode(node: Node): node is TemplateLiteralTypeNode; function isObjectBindingPattern(node: Node): node is ObjectBindingPattern; function isArrayBindingPattern(node: Node): node is ArrayBindingPattern; function isBindingElement(node: Node): node is BindingElement; @@ -6963,6 +6968,11 @@ declare namespace ts.server.protocol { * so this description should make sense by itself if the parent is inlineable=true */ description: string; + /** + * A message to show to the user if the refactoring cannot be applied in + * the current context. + */ + notApplicableReason?: string; } interface GetEditsForRefactorRequest extends Request { command: CommandTypes.GetEditsForRefactor; @@ -7746,6 +7756,10 @@ declare namespace ts.server.protocol { */ closedFiles?: string[]; } + /** + * External projects have a typeAcquisition option so they need to be added separately to compiler options for inferred projects. + */ + type InferredProjectCompilerOptions = ExternalProjectCompilerOptions & TypeAcquisition; /** * Request to set compiler options for inferred projects. * External projects are opened / closed explicitly. @@ -7766,7 +7780,7 @@ declare namespace ts.server.protocol { /** * Compiler options to be used with inferred projects. */ - options: ExternalProjectCompilerOptions; + options: InferredProjectCompilerOptions; /** * Specifies the project root path used to scope compiler options. * It is an error to provide this property if the server has not been started with @@ -8953,6 +8967,7 @@ declare namespace ts.server.protocol { insertSpaceAfterConstructor?: boolean; insertSpaceAfterKeywordsInControlFlowStatements?: boolean; insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; + insertSpaceAfterOpeningAndBeforeClosingEmptyBraces?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean; @@ -8990,6 +9005,7 @@ declare namespace ts.server.protocol { readonly allowTextChangesInNewFiles?: boolean; readonly lazyConfiguredProjectsFromExternalProject?: boolean; readonly providePrefixAndSuffixTextForRename?: boolean; + readonly provideRefactorNotApplicableReason?: boolean; readonly allowRenameOfImportPath?: boolean; readonly includePackageJsonAutoImports?: "auto" | "on" | "off"; } @@ -9291,7 +9307,6 @@ declare namespace ts.server { enableLanguageService(): void; disableLanguageService(lastFileExceededProgramSize?: string): void; getProjectName(): string; - abstract getTypeAcquisition(): TypeAcquisition; protected removeLocalTypingsFromTypeAcquisition(newTypeAcquisition: TypeAcquisition): TypeAcquisition; getExternalFiles(): SortedReadonlyArray; getSourceFile(path: Path): SourceFile | undefined; @@ -9330,6 +9345,8 @@ declare namespace ts.server { getScriptInfo(uncheckedFileName: string): ScriptInfo | undefined; filesToString(writeProjectFileNames: boolean): string; setCompilerOptions(compilerOptions: CompilerOptions): void; + setTypeAcquisition(newTypeAcquisition: TypeAcquisition | undefined): void; + getTypeAcquisition(): TypeAcquisition; protected removeRoot(info: ScriptInfo): void; protected enableGlobalPlugins(options: CompilerOptions, pluginConfigOverrides: Map | undefined): void; protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[], pluginConfigOverrides: Map | undefined): void; @@ -9375,7 +9392,6 @@ declare namespace ts.server { * Otherwise it will create an InferredProject. */ class ConfiguredProject extends Project { - private typeAcquisition; private directoriesWatchedForWildcards; readonly canonicalConfigFilePath: NormalizedPath; /** Ref count to the project when opened from external project */ @@ -9399,8 +9415,6 @@ declare namespace ts.server { */ getAllProjectErrors(): readonly Diagnostic[]; setProjectErrors(projectErrors: Diagnostic[]): void; - setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void; - getTypeAcquisition(): TypeAcquisition; close(): void; getEffectiveTypeRoots(): string[]; } @@ -9412,11 +9426,8 @@ declare namespace ts.server { externalProjectName: string; compileOnSaveEnabled: boolean; excludedFiles: readonly NormalizedPath[]; - private typeAcquisition; updateGraph(): boolean; getExcludedFiles(): readonly NormalizedPath[]; - getTypeAcquisition(): TypeAcquisition; - setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void; } } declare namespace ts.server { @@ -9550,6 +9561,7 @@ declare namespace ts.server { export function convertFormatOptions(protocolOptions: protocol.FormatCodeSettings): FormatCodeSettings; export function convertCompilerOptions(protocolOptions: protocol.ExternalProjectCompilerOptions): CompilerOptions & protocol.CompileOnSaveMixin; export function convertWatchOptions(protocolOptions: protocol.ExternalProjectCompilerOptions): WatchOptions | undefined; + export function convertTypeAcquisition(protocolOptions: protocol.InferredProjectCompilerOptions): TypeAcquisition | undefined; export function tryConvertScriptKindName(scriptKindName: protocol.ScriptKindName | ScriptKind): ScriptKind; export function convertScriptKindName(scriptKindName: protocol.ScriptKindName): ScriptKind.Unknown | ScriptKind.JS | ScriptKind.JSX | ScriptKind.TS | ScriptKind.TSX; export interface HostConfiguration { @@ -9618,6 +9630,8 @@ declare namespace ts.server { private compilerOptionsForInferredProjectsPerProjectRoot; private watchOptionsForInferredProjects; private watchOptionsForInferredProjectsPerProjectRoot; + private typeAcquisitionForInferredProjects; + private typeAcquisitionForInferredProjectsPerProjectRoot; /** * Project size for configured or external projects */ @@ -9663,7 +9677,7 @@ declare namespace ts.server { updateTypingsForProject(response: SetTypings | InvalidateCachedTypings | PackageInstalledResponse): void; private delayUpdateProjectGraph; private delayUpdateProjectGraphs; - setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.ExternalProjectCompilerOptions, projectRootPath?: string): void; + setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.InferredProjectCompilerOptions, projectRootPath?: string): void; findProject(projectName: string): Project | undefined; getDefaultProjectForFile(fileName: NormalizedPath, ensureProject: boolean): Project | undefined; private doEnsureDefaultProjectForFile; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 3a4fc7ae36e..2b6547e3c85 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -240,215 +240,212 @@ declare namespace ts { DeclareKeyword = 133, GetKeyword = 134, InferKeyword = 135, - IsKeyword = 136, - KeyOfKeyword = 137, - ModuleKeyword = 138, - NamespaceKeyword = 139, - NeverKeyword = 140, - ReadonlyKeyword = 141, - RequireKeyword = 142, - NumberKeyword = 143, - ObjectKeyword = 144, - SetKeyword = 145, - StringKeyword = 146, - SymbolKeyword = 147, - TypeKeyword = 148, - UndefinedKeyword = 149, - UniqueKeyword = 150, - UnknownKeyword = 151, - FromKeyword = 152, - GlobalKeyword = 153, - BigIntKeyword = 154, - UppercaseKeyword = 155, - LowercaseKeyword = 156, - CapitalizeKeyword = 157, - UncapitalizeKeyword = 158, - OfKeyword = 159, - QualifiedName = 160, - ComputedPropertyName = 161, - TypeParameter = 162, - Parameter = 163, - Decorator = 164, - PropertySignature = 165, - PropertyDeclaration = 166, - MethodSignature = 167, - MethodDeclaration = 168, - Constructor = 169, - GetAccessor = 170, - SetAccessor = 171, - CallSignature = 172, - ConstructSignature = 173, - IndexSignature = 174, - TypePredicate = 175, - TypeReference = 176, - FunctionType = 177, - ConstructorType = 178, - TypeQuery = 179, - TypeLiteral = 180, - ArrayType = 181, - TupleType = 182, - OptionalType = 183, - RestType = 184, - UnionType = 185, - IntersectionType = 186, - ConditionalType = 187, - InferType = 188, - ParenthesizedType = 189, - ThisType = 190, - TypeOperator = 191, - IndexedAccessType = 192, - MappedType = 193, - LiteralType = 194, - NamedTupleMember = 195, - TemplateLiteralType = 196, - TemplateLiteralTypeSpan = 197, - ImportType = 198, - ObjectBindingPattern = 199, - ArrayBindingPattern = 200, - BindingElement = 201, - ArrayLiteralExpression = 202, - ObjectLiteralExpression = 203, - PropertyAccessExpression = 204, - ElementAccessExpression = 205, - CallExpression = 206, - NewExpression = 207, - TaggedTemplateExpression = 208, - TypeAssertionExpression = 209, - ParenthesizedExpression = 210, - FunctionExpression = 211, - ArrowFunction = 212, - DeleteExpression = 213, - TypeOfExpression = 214, - VoidExpression = 215, - AwaitExpression = 216, - PrefixUnaryExpression = 217, - PostfixUnaryExpression = 218, - BinaryExpression = 219, - ConditionalExpression = 220, - TemplateExpression = 221, - YieldExpression = 222, - SpreadElement = 223, - ClassExpression = 224, - OmittedExpression = 225, - ExpressionWithTypeArguments = 226, - AsExpression = 227, - NonNullExpression = 228, - MetaProperty = 229, - SyntheticExpression = 230, - TemplateSpan = 231, - SemicolonClassElement = 232, - Block = 233, - EmptyStatement = 234, - VariableStatement = 235, - ExpressionStatement = 236, - IfStatement = 237, - DoStatement = 238, - WhileStatement = 239, - ForStatement = 240, - ForInStatement = 241, - ForOfStatement = 242, - ContinueStatement = 243, - BreakStatement = 244, - ReturnStatement = 245, - WithStatement = 246, - SwitchStatement = 247, - LabeledStatement = 248, - ThrowStatement = 249, - TryStatement = 250, - DebuggerStatement = 251, - VariableDeclaration = 252, - VariableDeclarationList = 253, - FunctionDeclaration = 254, - ClassDeclaration = 255, - InterfaceDeclaration = 256, - TypeAliasDeclaration = 257, - EnumDeclaration = 258, - ModuleDeclaration = 259, - ModuleBlock = 260, - CaseBlock = 261, - NamespaceExportDeclaration = 262, - ImportEqualsDeclaration = 263, - ImportDeclaration = 264, - ImportClause = 265, - NamespaceImport = 266, - NamedImports = 267, - ImportSpecifier = 268, - ExportAssignment = 269, - ExportDeclaration = 270, - NamedExports = 271, - NamespaceExport = 272, - ExportSpecifier = 273, - MissingDeclaration = 274, - ExternalModuleReference = 275, - JsxElement = 276, - JsxSelfClosingElement = 277, - JsxOpeningElement = 278, - JsxClosingElement = 279, - JsxFragment = 280, - JsxOpeningFragment = 281, - JsxClosingFragment = 282, - JsxAttribute = 283, - JsxAttributes = 284, - JsxSpreadAttribute = 285, - JsxExpression = 286, - CaseClause = 287, - DefaultClause = 288, - HeritageClause = 289, - CatchClause = 290, - PropertyAssignment = 291, - ShorthandPropertyAssignment = 292, - SpreadAssignment = 293, - EnumMember = 294, - UnparsedPrologue = 295, - UnparsedPrepend = 296, - UnparsedText = 297, - UnparsedInternalText = 298, - UnparsedSyntheticReference = 299, - SourceFile = 300, - Bundle = 301, - UnparsedSource = 302, - InputFiles = 303, - JSDocTypeExpression = 304, - JSDocNameReference = 305, - JSDocAllType = 306, - JSDocUnknownType = 307, - JSDocNullableType = 308, - JSDocNonNullableType = 309, - JSDocOptionalType = 310, - JSDocFunctionType = 311, - JSDocVariadicType = 312, - JSDocNamepathType = 313, - JSDocComment = 314, - JSDocTypeLiteral = 315, - JSDocSignature = 316, - JSDocTag = 317, - JSDocAugmentsTag = 318, - JSDocImplementsTag = 319, - JSDocAuthorTag = 320, - JSDocDeprecatedTag = 321, - JSDocClassTag = 322, - JSDocPublicTag = 323, - JSDocPrivateTag = 324, - JSDocProtectedTag = 325, - JSDocReadonlyTag = 326, - JSDocCallbackTag = 327, - JSDocEnumTag = 328, - JSDocParameterTag = 329, - JSDocReturnTag = 330, - JSDocThisTag = 331, - JSDocTypeTag = 332, - JSDocTemplateTag = 333, - JSDocTypedefTag = 334, - JSDocSeeTag = 335, - JSDocPropertyTag = 336, - SyntaxList = 337, - NotEmittedStatement = 338, - PartiallyEmittedExpression = 339, - CommaListExpression = 340, - MergeDeclarationMarker = 341, - EndOfDeclarationMarker = 342, - SyntheticReferenceExpression = 343, - Count = 344, + IntrinsicKeyword = 136, + IsKeyword = 137, + KeyOfKeyword = 138, + ModuleKeyword = 139, + NamespaceKeyword = 140, + NeverKeyword = 141, + ReadonlyKeyword = 142, + RequireKeyword = 143, + NumberKeyword = 144, + ObjectKeyword = 145, + SetKeyword = 146, + StringKeyword = 147, + SymbolKeyword = 148, + TypeKeyword = 149, + UndefinedKeyword = 150, + UniqueKeyword = 151, + UnknownKeyword = 152, + FromKeyword = 153, + GlobalKeyword = 154, + BigIntKeyword = 155, + OfKeyword = 156, + QualifiedName = 157, + ComputedPropertyName = 158, + TypeParameter = 159, + Parameter = 160, + Decorator = 161, + PropertySignature = 162, + PropertyDeclaration = 163, + MethodSignature = 164, + MethodDeclaration = 165, + Constructor = 166, + GetAccessor = 167, + SetAccessor = 168, + CallSignature = 169, + ConstructSignature = 170, + IndexSignature = 171, + TypePredicate = 172, + TypeReference = 173, + FunctionType = 174, + ConstructorType = 175, + TypeQuery = 176, + TypeLiteral = 177, + ArrayType = 178, + TupleType = 179, + OptionalType = 180, + RestType = 181, + UnionType = 182, + IntersectionType = 183, + ConditionalType = 184, + InferType = 185, + ParenthesizedType = 186, + ThisType = 187, + TypeOperator = 188, + IndexedAccessType = 189, + MappedType = 190, + LiteralType = 191, + NamedTupleMember = 192, + TemplateLiteralType = 193, + TemplateLiteralTypeSpan = 194, + ImportType = 195, + ObjectBindingPattern = 196, + ArrayBindingPattern = 197, + BindingElement = 198, + ArrayLiteralExpression = 199, + ObjectLiteralExpression = 200, + PropertyAccessExpression = 201, + ElementAccessExpression = 202, + CallExpression = 203, + NewExpression = 204, + TaggedTemplateExpression = 205, + TypeAssertionExpression = 206, + ParenthesizedExpression = 207, + FunctionExpression = 208, + ArrowFunction = 209, + DeleteExpression = 210, + TypeOfExpression = 211, + VoidExpression = 212, + AwaitExpression = 213, + PrefixUnaryExpression = 214, + PostfixUnaryExpression = 215, + BinaryExpression = 216, + ConditionalExpression = 217, + TemplateExpression = 218, + YieldExpression = 219, + SpreadElement = 220, + ClassExpression = 221, + OmittedExpression = 222, + ExpressionWithTypeArguments = 223, + AsExpression = 224, + NonNullExpression = 225, + MetaProperty = 226, + SyntheticExpression = 227, + TemplateSpan = 228, + SemicolonClassElement = 229, + Block = 230, + EmptyStatement = 231, + VariableStatement = 232, + ExpressionStatement = 233, + IfStatement = 234, + DoStatement = 235, + WhileStatement = 236, + ForStatement = 237, + ForInStatement = 238, + ForOfStatement = 239, + ContinueStatement = 240, + BreakStatement = 241, + ReturnStatement = 242, + WithStatement = 243, + SwitchStatement = 244, + LabeledStatement = 245, + ThrowStatement = 246, + TryStatement = 247, + DebuggerStatement = 248, + VariableDeclaration = 249, + VariableDeclarationList = 250, + FunctionDeclaration = 251, + ClassDeclaration = 252, + InterfaceDeclaration = 253, + TypeAliasDeclaration = 254, + EnumDeclaration = 255, + ModuleDeclaration = 256, + ModuleBlock = 257, + CaseBlock = 258, + NamespaceExportDeclaration = 259, + ImportEqualsDeclaration = 260, + ImportDeclaration = 261, + ImportClause = 262, + NamespaceImport = 263, + NamedImports = 264, + ImportSpecifier = 265, + ExportAssignment = 266, + ExportDeclaration = 267, + NamedExports = 268, + NamespaceExport = 269, + ExportSpecifier = 270, + MissingDeclaration = 271, + ExternalModuleReference = 272, + JsxElement = 273, + JsxSelfClosingElement = 274, + JsxOpeningElement = 275, + JsxClosingElement = 276, + JsxFragment = 277, + JsxOpeningFragment = 278, + JsxClosingFragment = 279, + JsxAttribute = 280, + JsxAttributes = 281, + JsxSpreadAttribute = 282, + JsxExpression = 283, + CaseClause = 284, + DefaultClause = 285, + HeritageClause = 286, + CatchClause = 287, + PropertyAssignment = 288, + ShorthandPropertyAssignment = 289, + SpreadAssignment = 290, + EnumMember = 291, + UnparsedPrologue = 292, + UnparsedPrepend = 293, + UnparsedText = 294, + UnparsedInternalText = 295, + UnparsedSyntheticReference = 296, + SourceFile = 297, + Bundle = 298, + UnparsedSource = 299, + InputFiles = 300, + JSDocTypeExpression = 301, + JSDocNameReference = 302, + JSDocAllType = 303, + JSDocUnknownType = 304, + JSDocNullableType = 305, + JSDocNonNullableType = 306, + JSDocOptionalType = 307, + JSDocFunctionType = 308, + JSDocVariadicType = 309, + JSDocNamepathType = 310, + JSDocComment = 311, + JSDocTypeLiteral = 312, + JSDocSignature = 313, + JSDocTag = 314, + JSDocAugmentsTag = 315, + JSDocImplementsTag = 316, + JSDocAuthorTag = 317, + JSDocDeprecatedTag = 318, + JSDocClassTag = 319, + JSDocPublicTag = 320, + JSDocPrivateTag = 321, + JSDocProtectedTag = 322, + JSDocReadonlyTag = 323, + JSDocCallbackTag = 324, + JSDocEnumTag = 325, + JSDocParameterTag = 326, + JSDocReturnTag = 327, + JSDocThisTag = 328, + JSDocTypeTag = 329, + JSDocTemplateTag = 330, + JSDocTypedefTag = 331, + JSDocSeeTag = 332, + JSDocPropertyTag = 333, + SyntaxList = 334, + NotEmittedStatement = 335, + PartiallyEmittedExpression = 336, + CommaListExpression = 337, + MergeDeclarationMarker = 338, + EndOfDeclarationMarker = 339, + SyntheticReferenceExpression = 340, + Count = 341, FirstAssignment = 62, LastAssignment = 77, FirstCompoundAssignment = 63, @@ -456,15 +453,15 @@ declare namespace ts { FirstReservedWord = 80, LastReservedWord = 115, FirstKeyword = 80, - LastKeyword = 159, + LastKeyword = 156, FirstFutureReservedWord = 116, LastFutureReservedWord = 124, - FirstTypeNode = 175, - LastTypeNode = 198, + FirstTypeNode = 172, + LastTypeNode = 195, FirstPunctuation = 18, LastPunctuation = 77, FirstToken = 0, - LastToken = 159, + LastToken = 156, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -473,21 +470,21 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 77, - FirstStatement = 235, - LastStatement = 251, - FirstNode = 160, - FirstJSDocNode = 304, - LastJSDocNode = 336, - FirstJSDocTagNode = 317, - LastJSDocTagNode = 336, + FirstStatement = 232, + LastStatement = 248, + FirstNode = 157, + FirstJSDocNode = 301, + LastJSDocNode = 333, + FirstJSDocTagNode = 314, + LastJSDocTagNode = 333, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CapitalizeKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.LowercaseKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UncapitalizeKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.UppercaseKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.StaticKeyword; - export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; + export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; export type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.GreaterThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.Unknown | KeywordSyntaxKind; @@ -972,17 +969,9 @@ declare namespace ts { export interface TemplateLiteralTypeSpan extends TypeNode { readonly kind: SyntaxKind.TemplateLiteralTypeSpan; readonly parent: TemplateLiteralTypeNode; - readonly casing: TemplateCasing; readonly type: TypeNode; readonly literal: TemplateMiddle | TemplateTail; } - export enum TemplateCasing { - None = 0, - Uppercase = 1, - Lowercase = 2, - Capitalize = 3, - Uncapitalize = 4 - } export interface Expression extends Node { _expressionBrand: any; } @@ -2218,6 +2207,7 @@ declare namespace ts { getFullyQualifiedName(symbol: Symbol): string; getAugmentedPropertiesOfType(type: Type): Symbol[]; getRootSymbols(symbol: Symbol): readonly Symbol[]; + getSymbolOfExpando(node: Node, allowDeclaration: boolean): Symbol | undefined; getContextualType(node: Expression): Type | undefined; /** * returns unknownSignature in the case of an error. @@ -2489,11 +2479,12 @@ declare namespace ts { Substitution = 33554432, NonPrimitive = 67108864, TemplateLiteral = 134217728, + StringMapping = 268435456, Literal = 2944, Unit = 109440, StringOrNumberLiteral = 384, PossiblyFalsy = 117724, - StringLike = 134217860, + StringLike = 402653316, NumberLike = 296, BigIntLike = 2112, BooleanLike = 528, @@ -2504,10 +2495,10 @@ declare namespace ts { StructuredType = 3670016, TypeVariable = 8650752, InstantiableNonPrimitive = 58982400, - InstantiablePrimitive = 138412032, - Instantiable = 197394432, - StructuredOrInstantiable = 201064448, - Narrowable = 268188671, + InstantiablePrimitive = 406847488, + Instantiable = 465829888, + StructuredOrInstantiable = 469499904, + Narrowable = 536624127, } export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; export interface Type { @@ -2660,9 +2651,12 @@ declare namespace ts { } export interface TemplateLiteralType extends InstantiableType { texts: readonly string[]; - casings: readonly TemplateCasing[]; types: readonly Type[]; } + export interface StringMappingType extends InstantiableType { + symbol: Symbol; + type: Type; + } export interface SubstitutionType extends InstantiableType { baseType: Type; substitute: Type; @@ -2897,7 +2891,8 @@ declare namespace ts { enable?: boolean; include?: string[]; exclude?: string[]; - [option: string]: string[] | boolean | undefined; + disableFilenameBasedTypeAcquisition?: boolean; + [option: string]: CompilerOptionsValue | undefined; } export enum ModuleKind { None = 0, @@ -3225,8 +3220,8 @@ declare namespace ts { updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructSignatureDeclaration; createIndexSignature(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; updateIndexSignature(node: IndexSignatureDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; - createTemplateLiteralTypeSpan(casing: TemplateCasing, type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; - updateTemplateLiteralTypeSpan(casing: TemplateCasing, node: TemplateLiteralTypeSpan, type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; + createTemplateLiteralTypeSpan(type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; + updateTemplateLiteralTypeSpan(node: TemplateLiteralTypeSpan, type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; createKeywordTypeNode(kind: TKind): KeywordTypeNode; createTypePredicateNode(assertsModifier: AssertsKeyword | undefined, parameterName: Identifier | ThisTypeNode | string, type: TypeNode | undefined): TypePredicateNode; updateTypePredicateNode(node: TypePredicateNode, assertsModifier: AssertsKeyword | undefined, parameterName: Identifier | ThisTypeNode, type: TypeNode | undefined): TypePredicateNode; @@ -4057,6 +4052,14 @@ declare namespace ts { function getOriginalNode(node: Node, nodeTest: (node: Node) => node is T): T; function getOriginalNode(node: Node | undefined): Node | undefined; function getOriginalNode(node: Node | undefined, nodeTest: (node: Node | undefined) => node is T): T | undefined; + /** + * Iterates through the parent chain of a node and performs the callback on each parent until the callback + * returns a truthy value, then returns that value. + * If no such value is found, it applies the callback until the parent pointer is undefined or the callback returns "quit" + * At that point findAncestor returns undefined. + */ + function findAncestor(node: Node | undefined, callback: (element: Node) => element is T): T | undefined; + function findAncestor(node: Node | undefined, callback: (element: Node) => boolean | "quit"): Node | undefined; /** * Gets a value indicating whether a node originated in the parse tree. * @@ -4375,6 +4378,8 @@ declare namespace ts { function isMappedTypeNode(node: Node): node is MappedTypeNode; function isLiteralTypeNode(node: Node): node is LiteralTypeNode; function isImportTypeNode(node: Node): node is ImportTypeNode; + function isTemplateLiteralTypeSpan(node: Node): node is TemplateLiteralTypeSpan; + function isTemplateLiteralTypeNode(node: Node): node is TemplateLiteralTypeNode; function isObjectBindingPattern(node: Node): node is ObjectBindingPattern; function isArrayBindingPattern(node: Node): node is ArrayBindingPattern; function isBindingElement(node: Node): node is BindingElement; diff --git a/tests/baselines/reference/arrowFunctionExpressions.js b/tests/baselines/reference/arrowFunctionExpressions.js index 19b7651b1e7..4872c904f01 100644 --- a/tests/baselines/reference/arrowFunctionExpressions.js +++ b/tests/baselines/reference/arrowFunctionExpressions.js @@ -137,7 +137,7 @@ var p8 = function (_a) { var _b = _a.a, a = _b === void 0 ? 1 : _b; }; var p9 = function (_a) { - var _b = _a.a, _c = (_b === void 0 ? { b: 1 } : _b).b, b = _c === void 0 ? 1 : _c; + var _b = _a.a, _c = _b === void 0 ? { b: 1 } : _b, _d = _c.b, b = _d === void 0 ? 1 : _d; }; var p10 = function (_a) { var _b = _a[0], value = _b.value, done = _b.done; diff --git a/tests/baselines/reference/assertionsAndNonReturningFunctions.types b/tests/baselines/reference/assertionsAndNonReturningFunctions.types index 32100b6c3d2..2f947691d54 100644 --- a/tests/baselines/reference/assertionsAndNonReturningFunctions.types +++ b/tests/baselines/reference/assertionsAndNonReturningFunctions.types @@ -3,7 +3,7 @@ /** @type {AssertFunc} */ const assert = check => { ->assert : (check: boolean) => asserts check +>assert : AssertFunc >check => { if (!check) throw new Error();} : (check: boolean) => asserts check >check : boolean @@ -70,7 +70,7 @@ function f1(x) { assert(typeof x === "string"); >assert(typeof x === "string") : void ->assert : (check: boolean) => asserts check +>assert : AssertFunc >typeof x === "string" : boolean >typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" >x : any diff --git a/tests/baselines/reference/bigintWithoutLib.errors.txt b/tests/baselines/reference/bigintWithoutLib.errors.txt index ac4d7a5c2bf..993607265ce 100644 --- a/tests/baselines/reference/bigintWithoutLib.errors.txt +++ b/tests/baselines/reference/bigintWithoutLib.errors.txt @@ -1,16 +1,16 @@ -tests/cases/compiler/bigintWithoutLib.ts(4,25): error TS2304: Cannot find name 'BigInt'. -tests/cases/compiler/bigintWithoutLib.ts(5,13): error TS2304: Cannot find name 'BigInt'. -tests/cases/compiler/bigintWithoutLib.ts(6,5): error TS2304: Cannot find name 'BigInt'. -tests/cases/compiler/bigintWithoutLib.ts(7,13): error TS2304: Cannot find name 'BigInt'. +tests/cases/compiler/bigintWithoutLib.ts(4,25): error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(5,13): error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(6,5): error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(7,13): error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. tests/cases/compiler/bigintWithoutLib.ts(7,30): error TS2737: BigInt literals are not available when targeting lower than ES2020. -tests/cases/compiler/bigintWithoutLib.ts(8,13): error TS2304: Cannot find name 'BigInt'. +tests/cases/compiler/bigintWithoutLib.ts(8,13): error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. tests/cases/compiler/bigintWithoutLib.ts(8,31): error TS2737: BigInt literals are not available when targeting lower than ES2020. tests/cases/compiler/bigintWithoutLib.ts(9,1): error TS2322: Type 'Object' is not assignable to type 'bigint'. tests/cases/compiler/bigintWithoutLib.ts(11,32): error TS2554: Expected 0 arguments, but got 1. tests/cases/compiler/bigintWithoutLib.ts(13,38): error TS2554: Expected 0 arguments, but got 1. tests/cases/compiler/bigintWithoutLib.ts(14,38): error TS2554: Expected 0 arguments, but got 2. tests/cases/compiler/bigintWithoutLib.ts(15,38): error TS2554: Expected 0 arguments, but got 2. -tests/cases/compiler/bigintWithoutLib.ts(18,18): error TS2304: Cannot find name 'BigInt64Array'. +tests/cases/compiler/bigintWithoutLib.ts(18,18): error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. tests/cases/compiler/bigintWithoutLib.ts(18,38): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'? tests/cases/compiler/bigintWithoutLib.ts(19,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'? tests/cases/compiler/bigintWithoutLib.ts(20,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'? @@ -18,34 +18,34 @@ tests/cases/compiler/bigintWithoutLib.ts(20,34): error TS2737: BigInt literals a tests/cases/compiler/bigintWithoutLib.ts(20,38): error TS2737: BigInt literals are not available when targeting lower than ES2020. tests/cases/compiler/bigintWithoutLib.ts(20,42): error TS2737: BigInt literals are not available when targeting lower than ES2020. tests/cases/compiler/bigintWithoutLib.ts(21,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'? -tests/cases/compiler/bigintWithoutLib.ts(22,19): error TS2304: Cannot find name 'BigInt64Array'. -tests/cases/compiler/bigintWithoutLib.ts(23,19): error TS2304: Cannot find name 'BigInt64Array'. -tests/cases/compiler/bigintWithoutLib.ts(24,19): error TS2304: Cannot find name 'BigInt64Array'. -tests/cases/compiler/bigintWithoutLib.ts(30,19): error TS2304: Cannot find name 'BigUint64Array'. -tests/cases/compiler/bigintWithoutLib.ts(30,40): error TS2304: Cannot find name 'BigUint64Array'. -tests/cases/compiler/bigintWithoutLib.ts(31,20): error TS2304: Cannot find name 'BigUint64Array'. -tests/cases/compiler/bigintWithoutLib.ts(32,20): error TS2304: Cannot find name 'BigUint64Array'. +tests/cases/compiler/bigintWithoutLib.ts(22,19): error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(23,19): error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(24,19): error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(30,19): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(30,40): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(31,20): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(32,20): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. tests/cases/compiler/bigintWithoutLib.ts(32,36): error TS2737: BigInt literals are not available when targeting lower than ES2020. tests/cases/compiler/bigintWithoutLib.ts(32,40): error TS2737: BigInt literals are not available when targeting lower than ES2020. tests/cases/compiler/bigintWithoutLib.ts(32,44): error TS2737: BigInt literals are not available when targeting lower than ES2020. -tests/cases/compiler/bigintWithoutLib.ts(33,20): error TS2304: Cannot find name 'BigUint64Array'. -tests/cases/compiler/bigintWithoutLib.ts(34,20): error TS2304: Cannot find name 'BigUint64Array'. -tests/cases/compiler/bigintWithoutLib.ts(35,20): error TS2304: Cannot find name 'BigUint64Array'. -tests/cases/compiler/bigintWithoutLib.ts(36,20): error TS2304: Cannot find name 'BigUint64Array'. -tests/cases/compiler/bigintWithoutLib.ts(43,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'. +tests/cases/compiler/bigintWithoutLib.ts(33,20): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(34,20): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(35,20): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(36,20): error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(43,10): error TS2550: Property 'setBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. tests/cases/compiler/bigintWithoutLib.ts(43,26): error TS2737: BigInt literals are not available when targeting lower than ES2020. -tests/cases/compiler/bigintWithoutLib.ts(44,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'. +tests/cases/compiler/bigintWithoutLib.ts(44,10): error TS2550: Property 'setBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. tests/cases/compiler/bigintWithoutLib.ts(44,26): error TS2737: BigInt literals are not available when targeting lower than ES2020. -tests/cases/compiler/bigintWithoutLib.ts(45,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'. -tests/cases/compiler/bigintWithoutLib.ts(46,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'. +tests/cases/compiler/bigintWithoutLib.ts(45,10): error TS2550: Property 'setBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(46,10): error TS2550: Property 'setBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. tests/cases/compiler/bigintWithoutLib.ts(46,26): error TS2737: BigInt literals are not available when targeting lower than ES2020. -tests/cases/compiler/bigintWithoutLib.ts(47,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'. +tests/cases/compiler/bigintWithoutLib.ts(47,10): error TS2550: Property 'setBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. tests/cases/compiler/bigintWithoutLib.ts(47,26): error TS2737: BigInt literals are not available when targeting lower than ES2020. -tests/cases/compiler/bigintWithoutLib.ts(48,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'. -tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigInt64' does not exist on type 'DataView'. -tests/cases/compiler/bigintWithoutLib.ts(50,22): error TS2339: Property 'getBigInt64' does not exist on type 'DataView'. -tests/cases/compiler/bigintWithoutLib.ts(51,22): error TS2339: Property 'getBigUint64' does not exist on type 'DataView'. -tests/cases/compiler/bigintWithoutLib.ts(52,22): error TS2339: Property 'getBigUint64' does not exist on type 'DataView'. +tests/cases/compiler/bigintWithoutLib.ts(48,10): error TS2550: Property 'setBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2550: Property 'getBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(50,22): error TS2550: Property 'getBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(51,22): error TS2550: Property 'getBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/bigintWithoutLib.ts(52,22): error TS2550: Property 'getBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. tests/cases/compiler/bigintWithoutLib.ts(55,36): error TS2345: Argument of type 'bigint' is not assignable to parameter of type 'number'. tests/cases/compiler/bigintWithoutLib.ts(55,36): error TS2737: BigInt literals are not available when targeting lower than ES2020. tests/cases/compiler/bigintWithoutLib.ts(56,36): error TS2345: Argument of type 'bigint' is not assignable to parameter of type 'number'. @@ -57,21 +57,21 @@ tests/cases/compiler/bigintWithoutLib.ts(56,36): error TS2345: Argument of type // Test BigInt functions let bigintVal: bigint = BigInt(123); ~~~~~~ -!!! error TS2304: Cannot find name 'BigInt'. +!!! error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. bigintVal = BigInt("456"); ~~~~~~ -!!! error TS2304: Cannot find name 'BigInt'. +!!! error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. new BigInt(123); ~~~~~~ -!!! error TS2304: Cannot find name 'BigInt'. +!!! error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. bigintVal = BigInt.asIntN(8, 0xFFFFn); ~~~~~~ -!!! error TS2304: Cannot find name 'BigInt'. +!!! error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. ~~~~~~~ !!! error TS2737: BigInt literals are not available when targeting lower than ES2020. bigintVal = BigInt.asUintN(8, 0xFFFFn); ~~~~~~ -!!! error TS2304: Cannot find name 'BigInt'. +!!! error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. ~~~~~~~ !!! error TS2737: BigInt literals are not available when targeting lower than ES2020. bigintVal = bigintVal.valueOf(); // should error - bigintVal inferred as {} @@ -95,7 +95,7 @@ tests/cases/compiler/bigintWithoutLib.ts(56,36): error TS2345: Argument of type // Test BigInt64Array let bigIntArray: BigInt64Array = new BigInt64Array(); ~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'BigInt64Array'. +!!! error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. ~~~~~~~~~~~~~ !!! error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'? !!! related TS2728 tests/cases/compiler/bigintWithoutLib.ts:18:5: 'bigIntArray' is declared here. @@ -119,13 +119,13 @@ tests/cases/compiler/bigintWithoutLib.ts(56,36): error TS2345: Argument of type !!! related TS2728 tests/cases/compiler/bigintWithoutLib.ts:18:5: 'bigIntArray' is declared here. bigIntArray = new BigInt64Array(new ArrayBuffer(80)); ~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'BigInt64Array'. +!!! error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8); ~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'BigInt64Array'. +!!! error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8, 3); ~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'BigInt64Array'. +!!! error TS2583: Cannot find name 'BigInt64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. let len: number = bigIntArray.length; bigIntArray.length = 10; let arrayBufferLike: ArrayBufferView = bigIntArray; @@ -133,15 +133,15 @@ tests/cases/compiler/bigintWithoutLib.ts(56,36): error TS2345: Argument of type // Test BigUint64Array let bigUintArray: BigUint64Array = new BigUint64Array(); ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'BigUint64Array'. +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'BigUint64Array'. +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. bigUintArray = new BigUint64Array(10); ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'BigUint64Array'. +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. bigUintArray = new BigUint64Array([1n, 2n, 3n]); ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'BigUint64Array'. +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. ~~ !!! error TS2737: BigInt literals are not available when targeting lower than ES2020. ~~ @@ -150,16 +150,16 @@ tests/cases/compiler/bigintWithoutLib.ts(56,36): error TS2345: Argument of type !!! error TS2737: BigInt literals are not available when targeting lower than ES2020. bigUintArray = new BigUint64Array([1, 2, 3]); ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'BigUint64Array'. +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. bigUintArray = new BigUint64Array(new ArrayBuffer(80)); ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'BigUint64Array'. +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8); ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'BigUint64Array'. +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8, 3); ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'BigUint64Array'. +!!! error TS2583: Cannot find name 'BigUint64Array'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. len = bigIntArray.length; bigIntArray.length = 10; arrayBufferLike = bigIntArray; @@ -168,42 +168,42 @@ tests/cases/compiler/bigintWithoutLib.ts(56,36): error TS2345: Argument of type const dataView = new DataView(new ArrayBuffer(80)); dataView.setBigInt64(1, -1n); ~~~~~~~~~~~ -!!! error TS2339: Property 'setBigInt64' does not exist on type 'DataView'. +!!! error TS2550: Property 'setBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. ~~ !!! error TS2737: BigInt literals are not available when targeting lower than ES2020. dataView.setBigInt64(1, -1n, true); ~~~~~~~~~~~ -!!! error TS2339: Property 'setBigInt64' does not exist on type 'DataView'. +!!! error TS2550: Property 'setBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. ~~ !!! error TS2737: BigInt literals are not available when targeting lower than ES2020. dataView.setBigInt64(1, -1); ~~~~~~~~~~~ -!!! error TS2339: Property 'setBigInt64' does not exist on type 'DataView'. +!!! error TS2550: Property 'setBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. dataView.setBigUint64(2, 123n); ~~~~~~~~~~~~ -!!! error TS2339: Property 'setBigUint64' does not exist on type 'DataView'. +!!! error TS2550: Property 'setBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. ~~~~ !!! error TS2737: BigInt literals are not available when targeting lower than ES2020. dataView.setBigUint64(2, 123n, true); ~~~~~~~~~~~~ -!!! error TS2339: Property 'setBigUint64' does not exist on type 'DataView'. +!!! error TS2550: Property 'setBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. ~~~~ !!! error TS2737: BigInt literals are not available when targeting lower than ES2020. dataView.setBigUint64(2, 123); ~~~~~~~~~~~~ -!!! error TS2339: Property 'setBigUint64' does not exist on type 'DataView'. +!!! error TS2550: Property 'setBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. bigintVal = dataView.getBigInt64(1); ~~~~~~~~~~~ -!!! error TS2339: Property 'getBigInt64' does not exist on type 'DataView'. +!!! error TS2550: Property 'getBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. bigintVal = dataView.getBigInt64(1, true); ~~~~~~~~~~~ -!!! error TS2339: Property 'getBigInt64' does not exist on type 'DataView'. +!!! error TS2550: Property 'getBigInt64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. bigintVal = dataView.getBigUint64(2); ~~~~~~~~~~~~ -!!! error TS2339: Property 'getBigUint64' does not exist on type 'DataView'. +!!! error TS2550: Property 'getBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. bigintVal = dataView.getBigUint64(2, true); ~~~~~~~~~~~~ -!!! error TS2339: Property 'getBigUint64' does not exist on type 'DataView'. +!!! error TS2550: Property 'getBigUint64' does not exist on type 'DataView'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. // Test Intl methods with new parameter type new Intl.NumberFormat("fr").format(3000n); diff --git a/tests/baselines/reference/bitwiseNotOperatorWithEnumType.types b/tests/baselines/reference/bitwiseNotOperatorWithEnumType.types index 266c62de93e..8400808656b 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithEnumType.types +++ b/tests/baselines/reference/bitwiseNotOperatorWithEnumType.types @@ -5,7 +5,7 @@ enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 >A : ENUM1.A >B : ENUM1.B ->"" : ENUM1. +>"" : typeof ENUM1[""] // enum type var var ResultIsNumber1 = ~ENUM1; diff --git a/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types b/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types index b2e3b7dc44a..c9ddb407381 100644 --- a/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types +++ b/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types @@ -26,7 +26,7 @@ module.exports = /** @type {FooFun} */(void 0); >module.exports : (foo: typeof import("tests/cases/compiler/file")) => string >module : { "\"tests/cases/compiler/something\"": (foo: typeof import("tests/cases/compiler/file")) => string; } >exports : (foo: typeof import("tests/cases/compiler/file")) => string ->(void 0) : (foo: typeof import("tests/cases/compiler/file")) => string +>(void 0) : FooFun >void 0 : undefined >0 : 0 diff --git a/tests/baselines/reference/checkJsdocTypeTag4.types b/tests/baselines/reference/checkJsdocTypeTag4.types index 75db299718e..1edf72d685b 100644 --- a/tests/baselines/reference/checkJsdocTypeTag4.types +++ b/tests/baselines/reference/checkJsdocTypeTag4.types @@ -14,5 +14,5 @@ var a; /** @type {B} */ var b; ->b : { b: number; } +>b : B diff --git a/tests/baselines/reference/classExpressionAssignment.errors.txt b/tests/baselines/reference/classExpressionAssignment.errors.txt new file mode 100644 index 00000000000..2519e23b441 --- /dev/null +++ b/tests/baselines/reference/classExpressionAssignment.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/classExpressionAssignment.ts(6,7): error TS2322: Type 'typeof A' is not assignable to type 'new () => A'. + Property 'prop' is missing in type 'A' but required in type 'A'. + + +==== tests/cases/compiler/classExpressionAssignment.ts (1 errors) ==== + interface A { + prop: string; + } + + // This is invalid + const A: {new(): A} = class {} + ~ +!!! error TS2322: Type 'typeof A' is not assignable to type 'new () => A'. +!!! error TS2322: Property 'prop' is missing in type 'A' but required in type 'A'. +!!! related TS2728 tests/cases/compiler/classExpressionAssignment.ts:2:3: 'prop' is declared here. + \ No newline at end of file diff --git a/tests/baselines/reference/classExpressionAssignment.js b/tests/baselines/reference/classExpressionAssignment.js new file mode 100644 index 00000000000..8d924cfc44c --- /dev/null +++ b/tests/baselines/reference/classExpressionAssignment.js @@ -0,0 +1,16 @@ +//// [classExpressionAssignment.ts] +interface A { + prop: string; +} + +// This is invalid +const A: {new(): A} = class {} + + +//// [classExpressionAssignment.js] +// This is invalid +var A = /** @class */ (function () { + function A() { + } + return A; +}()); diff --git a/tests/baselines/reference/classExpressionAssignment.symbols b/tests/baselines/reference/classExpressionAssignment.symbols new file mode 100644 index 00000000000..a1d8abd41cf --- /dev/null +++ b/tests/baselines/reference/classExpressionAssignment.symbols @@ -0,0 +1,13 @@ +=== tests/cases/compiler/classExpressionAssignment.ts === +interface A { +>A : Symbol(A, Decl(classExpressionAssignment.ts, 0, 0), Decl(classExpressionAssignment.ts, 5, 5)) + + prop: string; +>prop : Symbol(A.prop, Decl(classExpressionAssignment.ts, 0, 13)) +} + +// This is invalid +const A: {new(): A} = class {} +>A : Symbol(A, Decl(classExpressionAssignment.ts, 0, 0), Decl(classExpressionAssignment.ts, 5, 5)) +>A : Symbol(A, Decl(classExpressionAssignment.ts, 0, 0), Decl(classExpressionAssignment.ts, 5, 5)) + diff --git a/tests/baselines/reference/classExpressionAssignment.types b/tests/baselines/reference/classExpressionAssignment.types new file mode 100644 index 00000000000..cfbf796d76d --- /dev/null +++ b/tests/baselines/reference/classExpressionAssignment.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/classExpressionAssignment.ts === +interface A { + prop: string; +>prop : string +} + +// This is invalid +const A: {new(): A} = class {} +>A : new () => A +>class {} : typeof A + diff --git a/tests/baselines/reference/classExpressionPropertyModifiers.errors.txt b/tests/baselines/reference/classExpressionPropertyModifiers.errors.txt index cb01d656126..c469545c823 100644 --- a/tests/baselines/reference/classExpressionPropertyModifiers.errors.txt +++ b/tests/baselines/reference/classExpressionPropertyModifiers.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/classExpressionPropertyModifiers.ts(2,36): error TS1039: Initializers are not allowed in ambient contexts. -tests/cases/compiler/classExpressionPropertyModifiers.ts(3,5): error TS1031: 'export' modifier cannot appear on a class element. +tests/cases/compiler/classExpressionPropertyModifiers.ts(3,5): error TS1031: 'export' modifier cannot appear on class elements of this kind. ==== tests/cases/compiler/classExpressionPropertyModifiers.ts (2 errors) ==== @@ -9,6 +9,6 @@ tests/cases/compiler/classExpressionPropertyModifiers.ts(3,5): error TS1031: 'ex !!! error TS1039: Initializers are not allowed in ambient contexts. export foo = 1; ~~~~~~ -!!! error TS1031: 'export' modifier cannot appear on a class element. +!!! error TS1031: 'export' modifier cannot appear on class elements of this kind. } \ No newline at end of file diff --git a/tests/baselines/reference/commentWithUnreasonableIndentationLevel01.js b/tests/baselines/reference/commentWithUnreasonableIndentationLevel01.js new file mode 100644 index 00000000000..55b410e34dc --- /dev/null +++ b/tests/baselines/reference/commentWithUnreasonableIndentationLevel01.js @@ -0,0 +1,22 @@ +//// [commentWithUnreasonableIndentationLevel01.ts] +// Repro from #41223 + +/** + * This is a comment with dumb indentation for some auto-generated thing. + */ +export class SomeAutoGeneratedThing {} + +//// [commentWithUnreasonableIndentationLevel01.js] +"use strict"; +// Repro from #41223 +exports.__esModule = true; +exports.SomeAutoGeneratedThing = void 0; +/** + * This is a comment with dumb indentation for some auto-generated thing. + */ +var SomeAutoGeneratedThing = /** @class */ (function () { + function SomeAutoGeneratedThing() { + } + return SomeAutoGeneratedThing; +}()); +exports.SomeAutoGeneratedThing = SomeAutoGeneratedThing; diff --git a/tests/baselines/reference/commentWithUnreasonableIndentationLevel01.symbols b/tests/baselines/reference/commentWithUnreasonableIndentationLevel01.symbols new file mode 100644 index 00000000000..41a9e2db6c2 --- /dev/null +++ b/tests/baselines/reference/commentWithUnreasonableIndentationLevel01.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/commentWithUnreasonableIndentationLevel01.ts === +// Repro from #41223 + +/** + * This is a comment with dumb indentation for some auto-generated thing. + */ +export class SomeAutoGeneratedThing {} +>SomeAutoGeneratedThing : Symbol(SomeAutoGeneratedThing, Decl(commentWithUnreasonableIndentationLevel01.ts, 0, 0)) + diff --git a/tests/baselines/reference/commentWithUnreasonableIndentationLevel01.types b/tests/baselines/reference/commentWithUnreasonableIndentationLevel01.types new file mode 100644 index 00000000000..10de2478a7d --- /dev/null +++ b/tests/baselines/reference/commentWithUnreasonableIndentationLevel01.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/commentWithUnreasonableIndentationLevel01.ts === +// Repro from #41223 + +/** + * This is a comment with dumb indentation for some auto-generated thing. + */ +export class SomeAutoGeneratedThing {} +>SomeAutoGeneratedThing : SomeAutoGeneratedThing + diff --git a/tests/baselines/reference/conflictingCommonJSES2015Exports.errors.txt b/tests/baselines/reference/conflictingCommonJSES2015Exports.errors.txt index 2f47712c9db..30f35bc58ca 100644 --- a/tests/baselines/reference/conflictingCommonJSES2015Exports.errors.txt +++ b/tests/baselines/reference/conflictingCommonJSES2015Exports.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/salsa/bug24934.js(2,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node`. +tests/cases/conformance/salsa/bug24934.js(2,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ==== tests/cases/conformance/salsa/bug24934.js (1 errors) ==== export function abc(a, b, c) { return 5; } module.exports = { abc }; ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node`. +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ==== tests/cases/conformance/salsa/use.js (0 errors) ==== import { abc } from './bug24934'; abc(1, 2, 3); diff --git a/tests/baselines/reference/constAssertions.errors.txt b/tests/baselines/reference/constAssertions.errors.txt index 8ecce1377e3..ef237f5017c 100644 --- a/tests/baselines/reference/constAssertions.errors.txt +++ b/tests/baselines/reference/constAssertions.errors.txt @@ -76,4 +76,48 @@ tests/cases/conformance/expressions/typeAssertions/constAssertions.ts(63,10): er let e3 = id(1) as const; // Error ~~~~~ !!! error TS1355: A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals. - \ No newline at end of file + + let t1 = 'foo' as const; + let t2 = 'bar' as const; + let t3 = `${t1}-${t2}` as const; + let t4 = `${`(${t1})`}-${`(${t2})`}` as const; + + function ff1(x: 'foo' | 'bar', y: 1 | 2) { + return `${x}-${y}` as const; + } + + function ff2(x: T, y: U) { + return `${x}-${y}` as const; + } + + const ts1 = ff2('foo', 'bar'); + const ts2 = ff2('foo', !!true ? '0' : '1'); + const ts3 = ff2(!!true ? 'top' : 'bottom', !!true ? 'left' : 'right'); + + function ff3(x: 'foo' | 'bar', y: object) { + return `${x}${y}` as const; + } + + type Action = "verify" | "write"; + type ContentMatch = "match" | "nonMatch"; + type Outcome = `${Action}_${ContentMatch}`; + + function ff4(verify: boolean, contentMatches: boolean) { + const action : Action = verify ? `verify` : `write`; + const contentMatch: ContentMatch = contentMatches ? `match` : `nonMatch`; + const outcome: Outcome = `${action}_${contentMatch}` as const; + return outcome; + } + + function ff5(verify: boolean, contentMatches: boolean) { + const action = verify ? `verify` : `write`; + const contentMatch = contentMatches ? `match` : `nonMatch`; + const outcome = `${action}_${contentMatch}` as const; + return outcome; + } + + function accessorNames(propName: S) { + return [`get-${propName}`, `set-${propName}`] as const; + } + + const ns1 = accessorNames('foo'); \ No newline at end of file diff --git a/tests/baselines/reference/constAssertions.js b/tests/baselines/reference/constAssertions.js index 1dc997a2c58..5e3b2b8b187 100644 --- a/tests/baselines/reference/constAssertions.js +++ b/tests/baselines/reference/constAssertions.js @@ -62,7 +62,51 @@ declare function id(x: T): T; let e1 = v1 as const; // Error let e2 = (true ? 1 : 0) as const; // Error let e3 = id(1) as const; // Error - + +let t1 = 'foo' as const; +let t2 = 'bar' as const; +let t3 = `${t1}-${t2}` as const; +let t4 = `${`(${t1})`}-${`(${t2})`}` as const; + +function ff1(x: 'foo' | 'bar', y: 1 | 2) { + return `${x}-${y}` as const; +} + +function ff2(x: T, y: U) { + return `${x}-${y}` as const; +} + +const ts1 = ff2('foo', 'bar'); +const ts2 = ff2('foo', !!true ? '0' : '1'); +const ts3 = ff2(!!true ? 'top' : 'bottom', !!true ? 'left' : 'right'); + +function ff3(x: 'foo' | 'bar', y: object) { + return `${x}${y}` as const; +} + +type Action = "verify" | "write"; +type ContentMatch = "match" | "nonMatch"; +type Outcome = `${Action}_${ContentMatch}`; + +function ff4(verify: boolean, contentMatches: boolean) { + const action : Action = verify ? `verify` : `write`; + const contentMatch: ContentMatch = contentMatches ? `match` : `nonMatch`; + const outcome: Outcome = `${action}_${contentMatch}` as const; + return outcome; +} + +function ff5(verify: boolean, contentMatches: boolean) { + const action = verify ? `verify` : `write`; + const contentMatch = contentMatches ? `match` : `nonMatch`; + const outcome = `${action}_${contentMatch}` as const; + return outcome; +} + +function accessorNames(propName: S) { + return [`get-${propName}`, `set-${propName}`] as const; +} + +const ns1 = accessorNames('foo'); //// [constAssertions.js] "use strict"; @@ -117,6 +161,38 @@ let q5 = { x: 10, y: 20 }; let e1 = v1; // Error let e2 = (true ? 1 : 0); // Error let e3 = id(1); // Error +let t1 = 'foo'; +let t2 = 'bar'; +let t3 = `${t1}-${t2}`; +let t4 = `${`(${t1})`}-${`(${t2})`}`; +function ff1(x, y) { + return `${x}-${y}`; +} +function ff2(x, y) { + return `${x}-${y}`; +} +const ts1 = ff2('foo', 'bar'); +const ts2 = ff2('foo', !!true ? '0' : '1'); +const ts3 = ff2(!!true ? 'top' : 'bottom', !!true ? 'left' : 'right'); +function ff3(x, y) { + return `${x}${y}`; +} +function ff4(verify, contentMatches) { + const action = verify ? `verify` : `write`; + const contentMatch = contentMatches ? `match` : `nonMatch`; + const outcome = `${action}_${contentMatch}`; + return outcome; +} +function ff5(verify, contentMatches) { + const action = verify ? `verify` : `write`; + const contentMatch = contentMatches ? `match` : `nonMatch`; + const outcome = `${action}_${contentMatch}`; + return outcome; +} +function accessorNames(propName) { + return [`get-${propName}`, `set-${propName}`]; +} +const ns1 = accessorNames('foo'); //// [constAssertions.d.ts] @@ -218,3 +294,20 @@ declare function id(x: T): T; declare let e1: "abc"; declare let e2: 0 | 1; declare let e3: 1; +declare let t1: "foo"; +declare let t2: "bar"; +declare let t3: "foo-bar"; +declare let t4: "(foo)-(bar)"; +declare function ff1(x: 'foo' | 'bar', y: 1 | 2): "foo-1" | "foo-2" | "bar-1" | "bar-2"; +declare function ff2(x: T, y: U): `${T}-${U}`; +declare const ts1: "foo-bar"; +declare const ts2: "foo-1" | "foo-0"; +declare const ts3: "top-left" | "top-right" | "bottom-left" | "bottom-right"; +declare function ff3(x: 'foo' | 'bar', y: object): `foo${string}` | `bar${string}`; +declare type Action = "verify" | "write"; +declare type ContentMatch = "match" | "nonMatch"; +declare type Outcome = `${Action}_${ContentMatch}`; +declare function ff4(verify: boolean, contentMatches: boolean): "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch"; +declare function ff5(verify: boolean, contentMatches: boolean): "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch"; +declare function accessorNames(propName: S): readonly [`get-${S}`, `set-${S}`]; +declare const ns1: readonly ["get-foo", "set-foo"]; diff --git a/tests/baselines/reference/constAssertions.symbols b/tests/baselines/reference/constAssertions.symbols index 598210f42b3..6e81b68fa87 100644 --- a/tests/baselines/reference/constAssertions.symbols +++ b/tests/baselines/reference/constAssertions.symbols @@ -199,3 +199,138 @@ let e3 = id(1) as const; // Error >e3 : Symbol(e3, Decl(constAssertions.ts, 62, 3)) >id : Symbol(id, Decl(constAssertions.ts, 56, 34)) +let t1 = 'foo' as const; +>t1 : Symbol(t1, Decl(constAssertions.ts, 64, 3)) + +let t2 = 'bar' as const; +>t2 : Symbol(t2, Decl(constAssertions.ts, 65, 3)) + +let t3 = `${t1}-${t2}` as const; +>t3 : Symbol(t3, Decl(constAssertions.ts, 66, 3)) +>t1 : Symbol(t1, Decl(constAssertions.ts, 64, 3)) +>t2 : Symbol(t2, Decl(constAssertions.ts, 65, 3)) + +let t4 = `${`(${t1})`}-${`(${t2})`}` as const; +>t4 : Symbol(t4, Decl(constAssertions.ts, 67, 3)) +>t1 : Symbol(t1, Decl(constAssertions.ts, 64, 3)) +>t2 : Symbol(t2, Decl(constAssertions.ts, 65, 3)) + +function ff1(x: 'foo' | 'bar', y: 1 | 2) { +>ff1 : Symbol(ff1, Decl(constAssertions.ts, 67, 46)) +>x : Symbol(x, Decl(constAssertions.ts, 69, 13)) +>y : Symbol(y, Decl(constAssertions.ts, 69, 30)) + + return `${x}-${y}` as const; +>x : Symbol(x, Decl(constAssertions.ts, 69, 13)) +>y : Symbol(y, Decl(constAssertions.ts, 69, 30)) +} + +function ff2(x: T, y: U) { +>ff2 : Symbol(ff2, Decl(constAssertions.ts, 71, 1)) +>T : Symbol(T, Decl(constAssertions.ts, 73, 13)) +>U : Symbol(U, Decl(constAssertions.ts, 73, 30)) +>x : Symbol(x, Decl(constAssertions.ts, 73, 49)) +>T : Symbol(T, Decl(constAssertions.ts, 73, 13)) +>y : Symbol(y, Decl(constAssertions.ts, 73, 54)) +>U : Symbol(U, Decl(constAssertions.ts, 73, 30)) + + return `${x}-${y}` as const; +>x : Symbol(x, Decl(constAssertions.ts, 73, 49)) +>y : Symbol(y, Decl(constAssertions.ts, 73, 54)) +} + +const ts1 = ff2('foo', 'bar'); +>ts1 : Symbol(ts1, Decl(constAssertions.ts, 77, 5)) +>ff2 : Symbol(ff2, Decl(constAssertions.ts, 71, 1)) + +const ts2 = ff2('foo', !!true ? '0' : '1'); +>ts2 : Symbol(ts2, Decl(constAssertions.ts, 78, 5)) +>ff2 : Symbol(ff2, Decl(constAssertions.ts, 71, 1)) + +const ts3 = ff2(!!true ? 'top' : 'bottom', !!true ? 'left' : 'right'); +>ts3 : Symbol(ts3, Decl(constAssertions.ts, 79, 5)) +>ff2 : Symbol(ff2, Decl(constAssertions.ts, 71, 1)) + +function ff3(x: 'foo' | 'bar', y: object) { +>ff3 : Symbol(ff3, Decl(constAssertions.ts, 79, 70)) +>x : Symbol(x, Decl(constAssertions.ts, 81, 13)) +>y : Symbol(y, Decl(constAssertions.ts, 81, 30)) + + return `${x}${y}` as const; +>x : Symbol(x, Decl(constAssertions.ts, 81, 13)) +>y : Symbol(y, Decl(constAssertions.ts, 81, 30)) +} + +type Action = "verify" | "write"; +>Action : Symbol(Action, Decl(constAssertions.ts, 83, 1)) + +type ContentMatch = "match" | "nonMatch"; +>ContentMatch : Symbol(ContentMatch, Decl(constAssertions.ts, 85, 33)) + +type Outcome = `${Action}_${ContentMatch}`; +>Outcome : Symbol(Outcome, Decl(constAssertions.ts, 86, 41)) +>Action : Symbol(Action, Decl(constAssertions.ts, 83, 1)) +>ContentMatch : Symbol(ContentMatch, Decl(constAssertions.ts, 85, 33)) + +function ff4(verify: boolean, contentMatches: boolean) { +>ff4 : Symbol(ff4, Decl(constAssertions.ts, 87, 43)) +>verify : Symbol(verify, Decl(constAssertions.ts, 89, 13)) +>contentMatches : Symbol(contentMatches, Decl(constAssertions.ts, 89, 29)) + + const action : Action = verify ? `verify` : `write`; +>action : Symbol(action, Decl(constAssertions.ts, 90, 9)) +>Action : Symbol(Action, Decl(constAssertions.ts, 83, 1)) +>verify : Symbol(verify, Decl(constAssertions.ts, 89, 13)) + + const contentMatch: ContentMatch = contentMatches ? `match` : `nonMatch`; +>contentMatch : Symbol(contentMatch, Decl(constAssertions.ts, 91, 9)) +>ContentMatch : Symbol(ContentMatch, Decl(constAssertions.ts, 85, 33)) +>contentMatches : Symbol(contentMatches, Decl(constAssertions.ts, 89, 29)) + + const outcome: Outcome = `${action}_${contentMatch}` as const; +>outcome : Symbol(outcome, Decl(constAssertions.ts, 92, 9)) +>Outcome : Symbol(Outcome, Decl(constAssertions.ts, 86, 41)) +>action : Symbol(action, Decl(constAssertions.ts, 90, 9)) +>contentMatch : Symbol(contentMatch, Decl(constAssertions.ts, 91, 9)) + + return outcome; +>outcome : Symbol(outcome, Decl(constAssertions.ts, 92, 9)) +} + +function ff5(verify: boolean, contentMatches: boolean) { +>ff5 : Symbol(ff5, Decl(constAssertions.ts, 94, 1)) +>verify : Symbol(verify, Decl(constAssertions.ts, 96, 13)) +>contentMatches : Symbol(contentMatches, Decl(constAssertions.ts, 96, 29)) + + const action = verify ? `verify` : `write`; +>action : Symbol(action, Decl(constAssertions.ts, 97, 9)) +>verify : Symbol(verify, Decl(constAssertions.ts, 96, 13)) + + const contentMatch = contentMatches ? `match` : `nonMatch`; +>contentMatch : Symbol(contentMatch, Decl(constAssertions.ts, 98, 9)) +>contentMatches : Symbol(contentMatches, Decl(constAssertions.ts, 96, 29)) + + const outcome = `${action}_${contentMatch}` as const; +>outcome : Symbol(outcome, Decl(constAssertions.ts, 99, 9)) +>action : Symbol(action, Decl(constAssertions.ts, 97, 9)) +>contentMatch : Symbol(contentMatch, Decl(constAssertions.ts, 98, 9)) + + return outcome; +>outcome : Symbol(outcome, Decl(constAssertions.ts, 99, 9)) +} + +function accessorNames(propName: S) { +>accessorNames : Symbol(accessorNames, Decl(constAssertions.ts, 101, 1)) +>S : Symbol(S, Decl(constAssertions.ts, 103, 23)) +>propName : Symbol(propName, Decl(constAssertions.ts, 103, 41)) +>S : Symbol(S, Decl(constAssertions.ts, 103, 23)) + + return [`get-${propName}`, `set-${propName}`] as const; +>propName : Symbol(propName, Decl(constAssertions.ts, 103, 41)) +>propName : Symbol(propName, Decl(constAssertions.ts, 103, 41)) +} + +const ns1 = accessorNames('foo'); +>ns1 : Symbol(ns1, Decl(constAssertions.ts, 107, 5)) +>accessorNames : Symbol(accessorNames, Decl(constAssertions.ts, 101, 1)) + diff --git a/tests/baselines/reference/constAssertions.types b/tests/baselines/reference/constAssertions.types index 68b442e0c44..15206af8c0e 100644 --- a/tests/baselines/reference/constAssertions.types +++ b/tests/baselines/reference/constAssertions.types @@ -354,3 +354,189 @@ let e3 = id(1) as const; // Error >id : (x: T) => T >1 : 1 +let t1 = 'foo' as const; +>t1 : "foo" +>'foo' as const : "foo" +>'foo' : "foo" + +let t2 = 'bar' as const; +>t2 : "bar" +>'bar' as const : "bar" +>'bar' : "bar" + +let t3 = `${t1}-${t2}` as const; +>t3 : "foo-bar" +>`${t1}-${t2}` as const : "foo-bar" +>`${t1}-${t2}` : "foo-bar" +>t1 : "foo" +>t2 : "bar" + +let t4 = `${`(${t1})`}-${`(${t2})`}` as const; +>t4 : "(foo)-(bar)" +>`${`(${t1})`}-${`(${t2})`}` as const : "(foo)-(bar)" +>`${`(${t1})`}-${`(${t2})`}` : "(foo)-(bar)" +>`(${t1})` : "(foo)" +>t1 : "foo" +>`(${t2})` : "(bar)" +>t2 : "bar" + +function ff1(x: 'foo' | 'bar', y: 1 | 2) { +>ff1 : (x: 'foo' | 'bar', y: 1 | 2) => "foo-1" | "foo-2" | "bar-1" | "bar-2" +>x : "foo" | "bar" +>y : 1 | 2 + + return `${x}-${y}` as const; +>`${x}-${y}` as const : "foo-1" | "foo-2" | "bar-1" | "bar-2" +>`${x}-${y}` : "foo-1" | "foo-2" | "bar-1" | "bar-2" +>x : "foo" | "bar" +>y : 1 | 2 +} + +function ff2(x: T, y: U) { +>ff2 : (x: T, y: U) => `${T}-${U}` +>x : T +>y : U + + return `${x}-${y}` as const; +>`${x}-${y}` as const : `${T}-${U}` +>`${x}-${y}` : `${T}-${U}` +>x : T +>y : U +} + +const ts1 = ff2('foo', 'bar'); +>ts1 : "foo-bar" +>ff2('foo', 'bar') : "foo-bar" +>ff2 : (x: T, y: U) => `${T}-${U}` +>'foo' : "foo" +>'bar' : "bar" + +const ts2 = ff2('foo', !!true ? '0' : '1'); +>ts2 : "foo-1" | "foo-0" +>ff2('foo', !!true ? '0' : '1') : "foo-1" | "foo-0" +>ff2 : (x: T, y: U) => `${T}-${U}` +>'foo' : "foo" +>!!true ? '0' : '1' : "0" | "1" +>!!true : true +>!true : false +>true : true +>'0' : "0" +>'1' : "1" + +const ts3 = ff2(!!true ? 'top' : 'bottom', !!true ? 'left' : 'right'); +>ts3 : "top-left" | "top-right" | "bottom-left" | "bottom-right" +>ff2(!!true ? 'top' : 'bottom', !!true ? 'left' : 'right') : "top-left" | "top-right" | "bottom-left" | "bottom-right" +>ff2 : (x: T, y: U) => `${T}-${U}` +>!!true ? 'top' : 'bottom' : "top" | "bottom" +>!!true : true +>!true : false +>true : true +>'top' : "top" +>'bottom' : "bottom" +>!!true ? 'left' : 'right' : "left" | "right" +>!!true : true +>!true : false +>true : true +>'left' : "left" +>'right' : "right" + +function ff3(x: 'foo' | 'bar', y: object) { +>ff3 : (x: 'foo' | 'bar', y: object) => `foo${string}` | `bar${string}` +>x : "foo" | "bar" +>y : object + + return `${x}${y}` as const; +>`${x}${y}` as const : `foo${string}` | `bar${string}` +>`${x}${y}` : `foo${string}` | `bar${string}` +>x : "foo" | "bar" +>y : object +} + +type Action = "verify" | "write"; +>Action : Action + +type ContentMatch = "match" | "nonMatch"; +>ContentMatch : ContentMatch + +type Outcome = `${Action}_${ContentMatch}`; +>Outcome : "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch" + +function ff4(verify: boolean, contentMatches: boolean) { +>ff4 : (verify: boolean, contentMatches: boolean) => "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch" +>verify : boolean +>contentMatches : boolean + + const action : Action = verify ? `verify` : `write`; +>action : Action +>verify ? `verify` : `write` : Action +>verify : boolean +>`verify` : "verify" +>`write` : "write" + + const contentMatch: ContentMatch = contentMatches ? `match` : `nonMatch`; +>contentMatch : ContentMatch +>contentMatches ? `match` : `nonMatch` : ContentMatch +>contentMatches : boolean +>`match` : "match" +>`nonMatch` : "nonMatch" + + const outcome: Outcome = `${action}_${contentMatch}` as const; +>outcome : "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch" +>`${action}_${contentMatch}` as const : "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch" +>`${action}_${contentMatch}` : "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch" +>action : Action +>contentMatch : ContentMatch + + return outcome; +>outcome : "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch" +} + +function ff5(verify: boolean, contentMatches: boolean) { +>ff5 : (verify: boolean, contentMatches: boolean) => "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch" +>verify : boolean +>contentMatches : boolean + + const action = verify ? `verify` : `write`; +>action : "verify" | "write" +>verify ? `verify` : `write` : Action +>verify : boolean +>`verify` : "verify" +>`write` : "write" + + const contentMatch = contentMatches ? `match` : `nonMatch`; +>contentMatch : "match" | "nonMatch" +>contentMatches ? `match` : `nonMatch` : ContentMatch +>contentMatches : boolean +>`match` : "match" +>`nonMatch` : "nonMatch" + + const outcome = `${action}_${contentMatch}` as const; +>outcome : "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch" +>`${action}_${contentMatch}` as const : "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch" +>`${action}_${contentMatch}` : "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch" +>action : Action +>contentMatch : ContentMatch + + return outcome; +>outcome : "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch" +} + +function accessorNames(propName: S) { +>accessorNames : (propName: S) => readonly [`get-${S}`, `set-${S}`] +>propName : S + + return [`get-${propName}`, `set-${propName}`] as const; +>[`get-${propName}`, `set-${propName}`] as const : readonly [`get-${S}`, `set-${S}`] +>[`get-${propName}`, `set-${propName}`] : readonly [`get-${S}`, `set-${S}`] +>`get-${propName}` : `get-${S}` +>propName : S +>`set-${propName}` : `set-${S}` +>propName : S +} + +const ns1 = accessorNames('foo'); +>ns1 : readonly ["get-foo", "set-foo"] +>accessorNames('foo') : readonly ["get-foo", "set-foo"] +>accessorNames : (propName: S) => readonly [`get-${S}`, `set-${S}`] +>'foo' : "foo" + diff --git a/tests/baselines/reference/constructorOverloads1.errors.txt b/tests/baselines/reference/constructorOverloads1.errors.txt index 0692c9ddda5..f801a587f3c 100644 --- a/tests/baselines/reference/constructorOverloads1.errors.txt +++ b/tests/baselines/reference/constructorOverloads1.errors.txt @@ -49,6 +49,7 @@ tests/cases/compiler/constructorOverloads1.ts(17,18): error TS2769: No overload !!! error TS2769: Argument of type 'Foo' is not assignable to parameter of type 'string'. !!! error TS2769: Overload 2 of 2, '(n: number): Foo', gave the following error. !!! error TS2769: Argument of type 'Foo' is not assignable to parameter of type 'number'. +!!! related TS2793 tests/cases/compiler/constructorOverloads1.ts:4:5: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. var f4 = new Foo([f1,f2,f3]); ~~~~~~~~~~ !!! error TS2769: No overload matches this call. @@ -56,6 +57,7 @@ tests/cases/compiler/constructorOverloads1.ts(17,18): error TS2769: No overload !!! error TS2769: Argument of type 'Foo[]' is not assignable to parameter of type 'string'. !!! error TS2769: Overload 2 of 2, '(n: number): Foo', gave the following error. !!! error TS2769: Argument of type 'Foo[]' is not assignable to parameter of type 'number'. +!!! related TS2793 tests/cases/compiler/constructorOverloads1.ts:4:5: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. f1.bar1(); f1.bar2(); diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index 090d249f923..c8af0683007 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,13): error TS2503: Cannot find namespace 'module'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,13): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node`. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,13): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,19): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,35): error TS1005: ')' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,39): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. @@ -105,7 +105,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS ~~~~~~ !!! error TS2503: Cannot find namespace 'module'. ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node`. +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ~ !!! error TS1005: ';' expected. diff --git a/tests/baselines/reference/contextualTypeForInitalizedVariablesFiltersUndefined.js b/tests/baselines/reference/contextualTypeForInitalizedVariablesFiltersUndefined.js index 3003e420e5f..b7264b62e26 100644 --- a/tests/baselines/reference/contextualTypeForInitalizedVariablesFiltersUndefined.js +++ b/tests/baselines/reference/contextualTypeForInitalizedVariablesFiltersUndefined.js @@ -12,15 +12,15 @@ function fst({ s } = t) { } //// [contextualTypeForInitalizedVariablesFiltersUndefined.js] "use strict"; var fInferred = function (_a) { - var _b = (_a === void 0 ? {} : _a).a, a = _b === void 0 ? 0 : _b; + var _b = _a === void 0 ? {} : _a, _c = _b.a, a = _c === void 0 ? 0 : _c; return a; }; // const fInferred: ({ a }?: { a?: number; }) => number var fAnnotated = function (_a) { - var _b = (_a === void 0 ? {} : _a).a, a = _b === void 0 ? 0 : _b; + var _b = _a === void 0 ? {} : _a, _c = _b.a, a = _c === void 0 ? 0 : _c; return a; }; var s = t.s; function fst(_a) { - var s = (_a === void 0 ? t : _a).s; + var _b = _a === void 0 ? t : _a, s = _b.s; } diff --git a/tests/baselines/reference/contextualTypeIterableUnions.js b/tests/baselines/reference/contextualTypeIterableUnions.js new file mode 100644 index 00000000000..d1bb4e9d8a8 --- /dev/null +++ b/tests/baselines/reference/contextualTypeIterableUnions.js @@ -0,0 +1,17 @@ +//// [contextualTypeIterableUnions.ts] +declare class DMap { + constructor(iterable: Iterable<[K, V]> | undefined); +} +new DMap([["1", 2]]); + +const i1: Iterable<{ a: true }> | undefined = [{ a: true }]; +const i2: Iterable<{ a: true }> | Iterable<{ b: false }> = [{ b: false }]; +const i3: Iterable | 1[] = [2]; + + +//// [contextualTypeIterableUnions.js] +"use strict"; +new DMap([["1", 2]]); +const i1 = [{ a: true }]; +const i2 = [{ b: false }]; +const i3 = [2]; diff --git a/tests/baselines/reference/contextualTypeIterableUnions.symbols b/tests/baselines/reference/contextualTypeIterableUnions.symbols new file mode 100644 index 00000000000..0ae7379596e --- /dev/null +++ b/tests/baselines/reference/contextualTypeIterableUnions.symbols @@ -0,0 +1,33 @@ +=== tests/cases/compiler/contextualTypeIterableUnions.ts === +declare class DMap { +>DMap : Symbol(DMap, Decl(contextualTypeIterableUnions.ts, 0, 0)) +>K : Symbol(K, Decl(contextualTypeIterableUnions.ts, 0, 19)) +>V : Symbol(V, Decl(contextualTypeIterableUnions.ts, 0, 21)) + + constructor(iterable: Iterable<[K, V]> | undefined); +>iterable : Symbol(iterable, Decl(contextualTypeIterableUnions.ts, 1, 14)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) +>K : Symbol(K, Decl(contextualTypeIterableUnions.ts, 0, 19)) +>V : Symbol(V, Decl(contextualTypeIterableUnions.ts, 0, 21)) +} +new DMap([["1", 2]]); +>DMap : Symbol(DMap, Decl(contextualTypeIterableUnions.ts, 0, 0)) + +const i1: Iterable<{ a: true }> | undefined = [{ a: true }]; +>i1 : Symbol(i1, Decl(contextualTypeIterableUnions.ts, 5, 5)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) +>a : Symbol(a, Decl(contextualTypeIterableUnions.ts, 5, 20)) +>a : Symbol(a, Decl(contextualTypeIterableUnions.ts, 5, 48)) + +const i2: Iterable<{ a: true }> | Iterable<{ b: false }> = [{ b: false }]; +>i2 : Symbol(i2, Decl(contextualTypeIterableUnions.ts, 6, 5)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) +>a : Symbol(a, Decl(contextualTypeIterableUnions.ts, 6, 20)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) +>b : Symbol(b, Decl(contextualTypeIterableUnions.ts, 6, 44)) +>b : Symbol(b, Decl(contextualTypeIterableUnions.ts, 6, 61)) + +const i3: Iterable | 1[] = [2]; +>i3 : Symbol(i3, Decl(contextualTypeIterableUnions.ts, 7, 5)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) + diff --git a/tests/baselines/reference/contextualTypeIterableUnions.types b/tests/baselines/reference/contextualTypeIterableUnions.types new file mode 100644 index 00000000000..455b4d55733 --- /dev/null +++ b/tests/baselines/reference/contextualTypeIterableUnions.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/contextualTypeIterableUnions.ts === +declare class DMap { +>DMap : DMap + + constructor(iterable: Iterable<[K, V]> | undefined); +>iterable : Iterable<[K, V]> | undefined +} +new DMap([["1", 2]]); +>new DMap([["1", 2]]) : DMap +>DMap : typeof DMap +>[["1", 2]] : [string, number][] +>["1", 2] : [string, number] +>"1" : "1" +>2 : 2 + +const i1: Iterable<{ a: true }> | undefined = [{ a: true }]; +>i1 : Iterable<{ a: true; }> | undefined +>a : true +>true : true +>[{ a: true }] : { a: true; }[] +>{ a: true } : { a: true; } +>a : true +>true : true + +const i2: Iterable<{ a: true }> | Iterable<{ b: false }> = [{ b: false }]; +>i2 : Iterable<{ a: true; }> | Iterable<{ b: false; }> +>a : true +>true : true +>b : false +>false : false +>[{ b: false }] : { b: false; }[] +>{ b: false } : { b: false; } +>b : false +>false : false + +const i3: Iterable | 1[] = [2]; +>i3 : Iterable | 1[] +>[2] : 2[] +>2 : 2 + diff --git a/tests/baselines/reference/contextualTypedSpecialAssignment.types b/tests/baselines/reference/contextualTypedSpecialAssignment.types index c2b7ae83cea..fe6711a3307 100644 --- a/tests/baselines/reference/contextualTypedSpecialAssignment.types +++ b/tests/baselines/reference/contextualTypedSpecialAssignment.types @@ -12,9 +12,9 @@ var ns = {} /** @type {DoneStatus} */ ns.x = { >ns.x = { status: 'done', m(n) { }} : { status: "done"; m(n: number): void; } ->ns.x : { status: "done"; m(n: number): void; } +>ns.x : DoneStatus >ns : typeof ns ->x : { status: "done"; m(n: number): void; } +>x : DoneStatus >{ status: 'done', m(n) { }} : { status: "done"; m(n: number): void; } status: 'done', @@ -28,9 +28,9 @@ ns.x = { ns.x = { >ns.x = { status: 'done', m(n) { }} : { status: "done"; m(n: number): void; } ->ns.x : { status: "done"; m(n: number): void; } +>ns.x : DoneStatus >ns : typeof ns ->x : { status: "done"; m(n: number): void; } +>x : DoneStatus >{ status: 'done', m(n) { }} : { status: "done"; m(n: number): void; } status: 'done', @@ -42,9 +42,9 @@ ns.x = { >n : number } ns.x ->ns.x : { status: "done"; m(n: number): void; } +>ns.x : DoneStatus >ns : typeof ns ->x : { status: "done"; m(n: number): void; } +>x : DoneStatus // this-property assignment @@ -55,9 +55,9 @@ class Thing { /** @type {DoneStatus} */ this.s = { >this.s = { status: 'done', m(n) { } } : { status: "done"; m(n: number): void; } ->this.s : { status: "done"; m(n: number): void; } +>this.s : DoneStatus >this : this ->s : { status: "done"; m(n: number): void; } +>s : DoneStatus >{ status: 'done', m(n) { } } : { status: "done"; m(n: number): void; } status: 'done', @@ -75,9 +75,9 @@ class Thing { this.s = { >this.s = { status: 'done', m(n) { } } : { status: "done"; m(n: number): void; } ->this.s : { status: "done"; m(n: number): void; } +>this.s : DoneStatus >this : this ->s : { status: "done"; m(n: number): void; } +>s : DoneStatus >{ status: 'done', m(n) { } } : { status: "done"; m(n: number): void; } status: 'done', @@ -96,9 +96,9 @@ class Thing { /** @type {DoneStatus} */ exports.x = { >exports.x = { status: "done", m(n) { }} : { status: "done"; m(n: number): void; } ->exports.x : { status: "done"; m(n: number): void; } +>exports.x : DoneStatus >exports : typeof import("tests/cases/conformance/salsa/test") ->x : { status: "done"; m(n: number): void; } +>x : DoneStatus >{ status: "done", m(n) { }} : { status: "done"; m(n: number): void; } status: "done", @@ -110,18 +110,18 @@ exports.x = { >n : number } exports.x ->exports.x : { status: "done"; m(n: number): void; } +>exports.x : DoneStatus >exports : typeof import("tests/cases/conformance/salsa/test") ->x : { status: "done"; m(n: number): void; } +>x : DoneStatus /** @type {DoneStatus} */ module.exports.y = { >module.exports.y = { status: "done", m(n) { }} : { status: "done"; m(n: number): void; } ->module.exports.y : { status: "done"; m(n: number): void; } +>module.exports.y : DoneStatus >module.exports : typeof import("tests/cases/conformance/salsa/test") >module : { "\"tests/cases/conformance/salsa/test\"": typeof import("tests/cases/conformance/salsa/test"); } >exports : typeof import("tests/cases/conformance/salsa/test") ->y : { status: "done"; m(n: number): void; } +>y : DoneStatus >{ status: "done", m(n) { }} : { status: "done"; m(n: number): void; } status: "done", @@ -133,21 +133,21 @@ module.exports.y = { >n : number } module.exports.y ->module.exports.y : { status: "done"; m(n: number): void; } +>module.exports.y : DoneStatus >module.exports : typeof import("tests/cases/conformance/salsa/test") >module : { "\"tests/cases/conformance/salsa/test\"": typeof import("tests/cases/conformance/salsa/test"); } >exports : typeof import("tests/cases/conformance/salsa/test") ->y : { status: "done"; m(n: number): void; } +>y : DoneStatus // prototype-property assignment /** @type {DoneStatus} */ Thing.prototype.x = { >Thing.prototype.x = { status: 'done', m(n) { }} : { status: "done"; m(n: number): void; } ->Thing.prototype.x : { status: "done"; m(n: number): void; } +>Thing.prototype.x : DoneStatus >Thing.prototype : Thing >Thing : typeof Thing >prototype : Thing ->x : { status: "done"; m(n: number): void; } +>x : DoneStatus >{ status: 'done', m(n) { }} : { status: "done"; m(n: number): void; } status: 'done', @@ -159,11 +159,11 @@ Thing.prototype.x = { >n : number } Thing.prototype.x ->Thing.prototype.x : { status: "done"; m(n: number): void; } +>Thing.prototype.x : DoneStatus >Thing.prototype : Thing >Thing : typeof Thing >prototype : Thing ->x : { status: "done"; m(n: number): void; } +>x : DoneStatus // prototype assignment function F() { @@ -172,9 +172,9 @@ function F() { /** @type {DoneStatus} */ F.prototype = { >F.prototype = { status: "done", m(n) { }} : { status: "done"; m(n: number): void; } ->F.prototype : { status: "done"; m(n: number): void; } +>F.prototype : DoneStatus >F : typeof F ->prototype : { status: "done"; m(n: number): void; } +>prototype : DoneStatus >{ status: "done", m(n) { }} : { status: "done"; m(n: number): void; } status: "done", diff --git a/tests/baselines/reference/contextuallyTypedIife.js b/tests/baselines/reference/contextuallyTypedIife.js index 0f3315d66a2..b1d52d72184 100644 --- a/tests/baselines/reference/contextuallyTypedIife.js +++ b/tests/baselines/reference/contextuallyTypedIife.js @@ -95,11 +95,11 @@ let eleven = (o => o.a(11))({ a: function(n) { return n; } }); return p; })({ p: 15 }); (function (_a) { - var _b = (_a === void 0 ? { r: 18 } : _a).r, r = _b === void 0 ? 17 : _b; + var _b = _a === void 0 ? { r: 18 } : _a, _c = _b.r, r = _c === void 0 ? 17 : _c; return r; })({ r: 19 }); (function (_a) { - var _b = (_a === void 0 ? { u: 23 } : _a).u, u = _b === void 0 ? 22 : _b; + var _b = _a === void 0 ? { u: 23 } : _a, _c = _b.u, u = _c === void 0 ? 22 : _c; return u; })(); // contextually typed parameters. diff --git a/tests/baselines/reference/contextuallyTypedIifeStrict.js b/tests/baselines/reference/contextuallyTypedIifeStrict.js index c5455ab84c8..22a66a926dd 100644 --- a/tests/baselines/reference/contextuallyTypedIifeStrict.js +++ b/tests/baselines/reference/contextuallyTypedIifeStrict.js @@ -95,11 +95,11 @@ let eleven = (o => o.a(11))({ a: function(n) { return n; } }); return p; })({ p: 15 }); (function (_a) { - var _b = (_a === void 0 ? { r: 18 } : _a).r, r = _b === void 0 ? 17 : _b; + var _b = _a === void 0 ? { r: 18 } : _a, _c = _b.r, r = _c === void 0 ? 17 : _c; return r; })({ r: 19 }); (function (_a) { - var _b = (_a === void 0 ? { u: 23 } : _a).u, u = _b === void 0 ? 22 : _b; + var _b = _a === void 0 ? { u: 23 } : _a, _c = _b.u, u = _c === void 0 ? 22 : _c; return u; })(); // contextually typed parameters. diff --git a/tests/baselines/reference/controlFlowAssignmentPatternOrder.symbols b/tests/baselines/reference/controlFlowAssignmentPatternOrder.symbols new file mode 100644 index 00000000000..cc3aa5e3509 --- /dev/null +++ b/tests/baselines/reference/controlFlowAssignmentPatternOrder.symbols @@ -0,0 +1,218 @@ +=== tests/cases/conformance/controlFlow/controlFlowAssignmentPatternOrder.ts === +// https://github.com/microsoft/TypeScript/pull/41094#issuecomment-716044363 +declare function f(): void; +>f : Symbol(f, Decl(controlFlowAssignmentPatternOrder.ts, 0, 0)) +{ + let a: 0 | 1 = 0; +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 3, 7)) + + let b: 0 | 1 | 9; +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 4, 7)) + + [{ [(a = 1)]: b } = [9, a] as const] = []; +>[(a = 1)] : Symbol([(a = 1)], Decl(controlFlowAssignmentPatternOrder.ts, 5, 6)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 3, 7)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 4, 7)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 3, 7)) + + const bb: 0 = b; +>bb : Symbol(bb, Decl(controlFlowAssignmentPatternOrder.ts, 6, 9)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 4, 7)) +} +{ + let a: 0 | 1 = 1; +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 9, 7)) + + let b: 0 | 1 | 9; +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 10, 7)) + + [{ [a]: b } = [9, a = 0] as const] = []; +>[a] : Symbol([a], Decl(controlFlowAssignmentPatternOrder.ts, 11, 6)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 9, 7)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 10, 7)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 9, 7)) + + const bb: 9 = b; +>bb : Symbol(bb, Decl(controlFlowAssignmentPatternOrder.ts, 12, 9)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 10, 7)) +} +{ + let a: 0 | 1 = 0; +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 15, 7)) + + let b: 0 | 1 | 8 | 9; +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 16, 7)) + + [{ [(a = 1)]: b } = [9, a] as const] = [[9, 8] as const]; +>[(a = 1)] : Symbol([(a = 1)], Decl(controlFlowAssignmentPatternOrder.ts, 17, 6)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 15, 7)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 16, 7)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 15, 7)) + + const bb: 0 | 8 = b; +>bb : Symbol(bb, Decl(controlFlowAssignmentPatternOrder.ts, 18, 9)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 16, 7)) +} +{ + let a: 0 | 1 = 1; +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 21, 7)) + + let b: 0 | 1 | 8 | 9; +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 22, 7)) + + [{ [a]: b } = [a = 0, 9] as const] = [[8, 9] as const]; +>[a] : Symbol([a], Decl(controlFlowAssignmentPatternOrder.ts, 23, 6)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 21, 7)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 22, 7)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 21, 7)) + + const bb: 0 | 8 = b; +>bb : Symbol(bb, Decl(controlFlowAssignmentPatternOrder.ts, 24, 9)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 22, 7)) +} +// same as above but on left of a binary expression +{ + let a: 0 | 1 = 0; +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 28, 7)) + + let b: 0 | 1 | 9; +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 29, 7)) + + [{ [(a = 1)]: b } = [9, a] as const] = [], f(); +>[(a = 1)] : Symbol([(a = 1)], Decl(controlFlowAssignmentPatternOrder.ts, 30, 6)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 28, 7)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 29, 7)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 28, 7)) +>f : Symbol(f, Decl(controlFlowAssignmentPatternOrder.ts, 0, 0)) + + const bb: 0 = b; +>bb : Symbol(bb, Decl(controlFlowAssignmentPatternOrder.ts, 31, 9)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 29, 7)) +} +{ + let a: 0 | 1 = 1; +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 34, 7)) + + let b: 0 | 1 | 9; +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 35, 7)) + + [{ [a]: b } = [9, a = 0] as const] = [], f(); +>[a] : Symbol([a], Decl(controlFlowAssignmentPatternOrder.ts, 36, 6)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 34, 7)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 35, 7)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 34, 7)) +>f : Symbol(f, Decl(controlFlowAssignmentPatternOrder.ts, 0, 0)) + + const bb: 9 = b; +>bb : Symbol(bb, Decl(controlFlowAssignmentPatternOrder.ts, 37, 9)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 35, 7)) +} +{ + let a: 0 | 1 = 0; +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 40, 7)) + + let b: 0 | 1 | 8 | 9; +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 41, 7)) + + [{ [(a = 1)]: b } = [9, a] as const] = [[9, 8] as const], f(); +>[(a = 1)] : Symbol([(a = 1)], Decl(controlFlowAssignmentPatternOrder.ts, 42, 6)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 40, 7)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 41, 7)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 40, 7)) +>f : Symbol(f, Decl(controlFlowAssignmentPatternOrder.ts, 0, 0)) + + const bb: 0 | 8 = b; +>bb : Symbol(bb, Decl(controlFlowAssignmentPatternOrder.ts, 43, 9)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 41, 7)) +} +{ + let a: 0 | 1 = 1; +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 46, 7)) + + let b: 0 | 1 | 8 | 9; +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 47, 7)) + + [{ [a]: b } = [a = 0, 9] as const] = [[8, 9] as const], f(); +>[a] : Symbol([a], Decl(controlFlowAssignmentPatternOrder.ts, 48, 6)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 46, 7)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 47, 7)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 46, 7)) +>f : Symbol(f, Decl(controlFlowAssignmentPatternOrder.ts, 0, 0)) + + const bb: 0 | 8 = b; +>bb : Symbol(bb, Decl(controlFlowAssignmentPatternOrder.ts, 49, 9)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 47, 7)) +} +// same as above but on right of a binary expression +{ + let a: 0 | 1 = 0; +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 53, 7)) + + let b: 0 | 1 | 9; +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 54, 7)) + + f(), [{ [(a = 1)]: b } = [9, a] as const] = []; +>f : Symbol(f, Decl(controlFlowAssignmentPatternOrder.ts, 0, 0)) +>[(a = 1)] : Symbol([(a = 1)], Decl(controlFlowAssignmentPatternOrder.ts, 55, 11)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 53, 7)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 54, 7)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 53, 7)) + + const bb: 0 = b; +>bb : Symbol(bb, Decl(controlFlowAssignmentPatternOrder.ts, 56, 9)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 54, 7)) +} +{ + let a: 0 | 1 = 1; +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 59, 7)) + + let b: 0 | 1 | 9; +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 60, 7)) + + f(), [{ [a]: b } = [9, a = 0] as const] = []; +>f : Symbol(f, Decl(controlFlowAssignmentPatternOrder.ts, 0, 0)) +>[a] : Symbol([a], Decl(controlFlowAssignmentPatternOrder.ts, 61, 11)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 59, 7)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 60, 7)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 59, 7)) + + const bb: 9 = b; +>bb : Symbol(bb, Decl(controlFlowAssignmentPatternOrder.ts, 62, 9)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 60, 7)) +} +{ + let a: 0 | 1 = 0; +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 65, 7)) + + let b: 0 | 1 | 8 | 9; +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 66, 7)) + + f(), [{ [(a = 1)]: b } = [9, a] as const] = [[9, 8] as const]; +>f : Symbol(f, Decl(controlFlowAssignmentPatternOrder.ts, 0, 0)) +>[(a = 1)] : Symbol([(a = 1)], Decl(controlFlowAssignmentPatternOrder.ts, 67, 11)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 65, 7)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 66, 7)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 65, 7)) + + const bb: 0 | 8 = b; +>bb : Symbol(bb, Decl(controlFlowAssignmentPatternOrder.ts, 68, 9)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 66, 7)) +} +{ + let a: 0 | 1 = 1; +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 71, 7)) + + let b: 0 | 1 | 8 | 9; +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 72, 7)) + + f(), [{ [a]: b } = [a = 0, 9] as const] = [[8, 9] as const]; +>f : Symbol(f, Decl(controlFlowAssignmentPatternOrder.ts, 0, 0)) +>[a] : Symbol([a], Decl(controlFlowAssignmentPatternOrder.ts, 73, 11)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 71, 7)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 72, 7)) +>a : Symbol(a, Decl(controlFlowAssignmentPatternOrder.ts, 71, 7)) + + const bb: 0 | 8 = b; +>bb : Symbol(bb, Decl(controlFlowAssignmentPatternOrder.ts, 74, 9)) +>b : Symbol(b, Decl(controlFlowAssignmentPatternOrder.ts, 72, 7)) +} diff --git a/tests/baselines/reference/controlFlowAssignmentPatternOrder.types b/tests/baselines/reference/controlFlowAssignmentPatternOrder.types new file mode 100644 index 00000000000..d0802ee9228 --- /dev/null +++ b/tests/baselines/reference/controlFlowAssignmentPatternOrder.types @@ -0,0 +1,396 @@ +=== tests/cases/conformance/controlFlow/controlFlowAssignmentPatternOrder.ts === +// https://github.com/microsoft/TypeScript/pull/41094#issuecomment-716044363 +declare function f(): void; +>f : () => void +{ + let a: 0 | 1 = 0; +>a : 0 | 1 +>0 : 0 + + let b: 0 | 1 | 9; +>b : 0 | 1 | 9 + + [{ [(a = 1)]: b } = [9, a] as const] = []; +>[{ [(a = 1)]: b } = [9, a] as const] = [] : [] +>[{ [(a = 1)]: b } = [9, a] as const] : [readonly [9, 0]] +>{ [(a = 1)]: b } = [9, a] as const : readonly [9, 0] +>{ [(a = 1)]: b } : { 1: 0 | 1 | 9; } +>[(a = 1)] : 0 | 1 | 9 +>(a = 1) : 1 +>a = 1 : 1 +>a : 0 | 1 +>1 : 1 +>b : 0 | 1 | 9 +>[9, a] as const : readonly [9, 0] +>[9, a] : readonly [9, 0] +>9 : 9 +>a : 0 +>[] : [] + + const bb: 0 = b; +>bb : 0 +>b : 0 +} +{ + let a: 0 | 1 = 1; +>a : 0 | 1 +>1 : 1 + + let b: 0 | 1 | 9; +>b : 0 | 1 | 9 + + [{ [a]: b } = [9, a = 0] as const] = []; +>[{ [a]: b } = [9, a = 0] as const] = [] : [] +>[{ [a]: b } = [9, a = 0] as const] : [readonly [9, 0]] +>{ [a]: b } = [9, a = 0] as const : readonly [9, 0] +>{ [a]: b } : { 0: 0 | 1 | 9; } +>[a] : 0 | 1 | 9 +>a : 0 +>b : 0 | 1 | 9 +>[9, a = 0] as const : readonly [9, 0] +>[9, a = 0] : readonly [9, 0] +>9 : 9 +>a = 0 : 0 +>a : 0 | 1 +>0 : 0 +>[] : [] + + const bb: 9 = b; +>bb : 9 +>b : 9 +} +{ + let a: 0 | 1 = 0; +>a : 0 | 1 +>0 : 0 + + let b: 0 | 1 | 8 | 9; +>b : 0 | 1 | 9 | 8 + + [{ [(a = 1)]: b } = [9, a] as const] = [[9, 8] as const]; +>[{ [(a = 1)]: b } = [9, a] as const] = [[9, 8] as const] : [readonly [9, 8]] +>[{ [(a = 1)]: b } = [9, a] as const] : [readonly [9, 0]] +>{ [(a = 1)]: b } = [9, a] as const : readonly [9, 0] +>{ [(a = 1)]: b } : { 1: 0 | 1 | 9 | 8; } +>[(a = 1)] : 0 | 1 | 9 | 8 +>(a = 1) : 1 +>a = 1 : 1 +>a : 0 | 1 +>1 : 1 +>b : 0 | 1 | 9 | 8 +>[9, a] as const : readonly [9, 0] +>[9, a] : readonly [9, 0] +>9 : 9 +>a : 0 +>[[9, 8] as const] : [readonly [9, 8]] +>[9, 8] as const : readonly [9, 8] +>[9, 8] : readonly [9, 8] +>9 : 9 +>8 : 8 + + const bb: 0 | 8 = b; +>bb : 0 | 8 +>b : 0 | 8 +} +{ + let a: 0 | 1 = 1; +>a : 0 | 1 +>1 : 1 + + let b: 0 | 1 | 8 | 9; +>b : 0 | 1 | 9 | 8 + + [{ [a]: b } = [a = 0, 9] as const] = [[8, 9] as const]; +>[{ [a]: b } = [a = 0, 9] as const] = [[8, 9] as const] : [readonly [8, 9]] +>[{ [a]: b } = [a = 0, 9] as const] : [readonly [0, 9]] +>{ [a]: b } = [a = 0, 9] as const : readonly [0, 9] +>{ [a]: b } : { 0: 0 | 1 | 9 | 8; } +>[a] : 0 | 1 | 9 | 8 +>a : 0 +>b : 0 | 1 | 9 | 8 +>[a = 0, 9] as const : readonly [0, 9] +>[a = 0, 9] : readonly [0, 9] +>a = 0 : 0 +>a : 0 | 1 +>0 : 0 +>9 : 9 +>[[8, 9] as const] : [readonly [8, 9]] +>[8, 9] as const : readonly [8, 9] +>[8, 9] : readonly [8, 9] +>8 : 8 +>9 : 9 + + const bb: 0 | 8 = b; +>bb : 0 | 8 +>b : 0 | 8 +} +// same as above but on left of a binary expression +{ + let a: 0 | 1 = 0; +>a : 0 | 1 +>0 : 0 + + let b: 0 | 1 | 9; +>b : 0 | 1 | 9 + + [{ [(a = 1)]: b } = [9, a] as const] = [], f(); +>[{ [(a = 1)]: b } = [9, a] as const] = [], f() : void +>[{ [(a = 1)]: b } = [9, a] as const] = [] : [] +>[{ [(a = 1)]: b } = [9, a] as const] : [readonly [9, 0]] +>{ [(a = 1)]: b } = [9, a] as const : readonly [9, 0] +>{ [(a = 1)]: b } : { 1: 0 | 1 | 9; } +>[(a = 1)] : 0 | 1 | 9 +>(a = 1) : 1 +>a = 1 : 1 +>a : 0 | 1 +>1 : 1 +>b : 0 | 1 | 9 +>[9, a] as const : readonly [9, 0] +>[9, a] : readonly [9, 0] +>9 : 9 +>a : 0 +>[] : [] +>f() : void +>f : () => void + + const bb: 0 = b; +>bb : 0 +>b : 0 +} +{ + let a: 0 | 1 = 1; +>a : 0 | 1 +>1 : 1 + + let b: 0 | 1 | 9; +>b : 0 | 1 | 9 + + [{ [a]: b } = [9, a = 0] as const] = [], f(); +>[{ [a]: b } = [9, a = 0] as const] = [], f() : void +>[{ [a]: b } = [9, a = 0] as const] = [] : [] +>[{ [a]: b } = [9, a = 0] as const] : [readonly [9, 0]] +>{ [a]: b } = [9, a = 0] as const : readonly [9, 0] +>{ [a]: b } : { 0: 0 | 1 | 9; } +>[a] : 0 | 1 | 9 +>a : 0 +>b : 0 | 1 | 9 +>[9, a = 0] as const : readonly [9, 0] +>[9, a = 0] : readonly [9, 0] +>9 : 9 +>a = 0 : 0 +>a : 0 | 1 +>0 : 0 +>[] : [] +>f() : void +>f : () => void + + const bb: 9 = b; +>bb : 9 +>b : 9 +} +{ + let a: 0 | 1 = 0; +>a : 0 | 1 +>0 : 0 + + let b: 0 | 1 | 8 | 9; +>b : 0 | 1 | 9 | 8 + + [{ [(a = 1)]: b } = [9, a] as const] = [[9, 8] as const], f(); +>[{ [(a = 1)]: b } = [9, a] as const] = [[9, 8] as const], f() : void +>[{ [(a = 1)]: b } = [9, a] as const] = [[9, 8] as const] : [readonly [9, 8]] +>[{ [(a = 1)]: b } = [9, a] as const] : [readonly [9, 0]] +>{ [(a = 1)]: b } = [9, a] as const : readonly [9, 0] +>{ [(a = 1)]: b } : { 1: 0 | 1 | 9 | 8; } +>[(a = 1)] : 0 | 1 | 9 | 8 +>(a = 1) : 1 +>a = 1 : 1 +>a : 0 | 1 +>1 : 1 +>b : 0 | 1 | 9 | 8 +>[9, a] as const : readonly [9, 0] +>[9, a] : readonly [9, 0] +>9 : 9 +>a : 0 +>[[9, 8] as const] : [readonly [9, 8]] +>[9, 8] as const : readonly [9, 8] +>[9, 8] : readonly [9, 8] +>9 : 9 +>8 : 8 +>f() : void +>f : () => void + + const bb: 0 | 8 = b; +>bb : 0 | 8 +>b : 0 | 8 +} +{ + let a: 0 | 1 = 1; +>a : 0 | 1 +>1 : 1 + + let b: 0 | 1 | 8 | 9; +>b : 0 | 1 | 9 | 8 + + [{ [a]: b } = [a = 0, 9] as const] = [[8, 9] as const], f(); +>[{ [a]: b } = [a = 0, 9] as const] = [[8, 9] as const], f() : void +>[{ [a]: b } = [a = 0, 9] as const] = [[8, 9] as const] : [readonly [8, 9]] +>[{ [a]: b } = [a = 0, 9] as const] : [readonly [0, 9]] +>{ [a]: b } = [a = 0, 9] as const : readonly [0, 9] +>{ [a]: b } : { 0: 0 | 1 | 9 | 8; } +>[a] : 0 | 1 | 9 | 8 +>a : 0 +>b : 0 | 1 | 9 | 8 +>[a = 0, 9] as const : readonly [0, 9] +>[a = 0, 9] : readonly [0, 9] +>a = 0 : 0 +>a : 0 | 1 +>0 : 0 +>9 : 9 +>[[8, 9] as const] : [readonly [8, 9]] +>[8, 9] as const : readonly [8, 9] +>[8, 9] : readonly [8, 9] +>8 : 8 +>9 : 9 +>f() : void +>f : () => void + + const bb: 0 | 8 = b; +>bb : 0 | 8 +>b : 0 | 8 +} +// same as above but on right of a binary expression +{ + let a: 0 | 1 = 0; +>a : 0 | 1 +>0 : 0 + + let b: 0 | 1 | 9; +>b : 0 | 1 | 9 + + f(), [{ [(a = 1)]: b } = [9, a] as const] = []; +>f(), [{ [(a = 1)]: b } = [9, a] as const] = [] : [] +>f() : void +>f : () => void +>[{ [(a = 1)]: b } = [9, a] as const] = [] : [] +>[{ [(a = 1)]: b } = [9, a] as const] : [readonly [9, 0]] +>{ [(a = 1)]: b } = [9, a] as const : readonly [9, 0] +>{ [(a = 1)]: b } : { 1: 0 | 1 | 9; } +>[(a = 1)] : 0 | 1 | 9 +>(a = 1) : 1 +>a = 1 : 1 +>a : 0 | 1 +>1 : 1 +>b : 0 | 1 | 9 +>[9, a] as const : readonly [9, 0] +>[9, a] : readonly [9, 0] +>9 : 9 +>a : 0 +>[] : [] + + const bb: 0 = b; +>bb : 0 +>b : 0 +} +{ + let a: 0 | 1 = 1; +>a : 0 | 1 +>1 : 1 + + let b: 0 | 1 | 9; +>b : 0 | 1 | 9 + + f(), [{ [a]: b } = [9, a = 0] as const] = []; +>f(), [{ [a]: b } = [9, a = 0] as const] = [] : [] +>f() : void +>f : () => void +>[{ [a]: b } = [9, a = 0] as const] = [] : [] +>[{ [a]: b } = [9, a = 0] as const] : [readonly [9, 0]] +>{ [a]: b } = [9, a = 0] as const : readonly [9, 0] +>{ [a]: b } : { 0: 0 | 1 | 9; } +>[a] : 0 | 1 | 9 +>a : 0 +>b : 0 | 1 | 9 +>[9, a = 0] as const : readonly [9, 0] +>[9, a = 0] : readonly [9, 0] +>9 : 9 +>a = 0 : 0 +>a : 0 | 1 +>0 : 0 +>[] : [] + + const bb: 9 = b; +>bb : 9 +>b : 9 +} +{ + let a: 0 | 1 = 0; +>a : 0 | 1 +>0 : 0 + + let b: 0 | 1 | 8 | 9; +>b : 0 | 1 | 9 | 8 + + f(), [{ [(a = 1)]: b } = [9, a] as const] = [[9, 8] as const]; +>f(), [{ [(a = 1)]: b } = [9, a] as const] = [[9, 8] as const] : [readonly [9, 8]] +>f() : void +>f : () => void +>[{ [(a = 1)]: b } = [9, a] as const] = [[9, 8] as const] : [readonly [9, 8]] +>[{ [(a = 1)]: b } = [9, a] as const] : [readonly [9, 0]] +>{ [(a = 1)]: b } = [9, a] as const : readonly [9, 0] +>{ [(a = 1)]: b } : { 1: 0 | 1 | 9 | 8; } +>[(a = 1)] : 0 | 1 | 9 | 8 +>(a = 1) : 1 +>a = 1 : 1 +>a : 0 | 1 +>1 : 1 +>b : 0 | 1 | 9 | 8 +>[9, a] as const : readonly [9, 0] +>[9, a] : readonly [9, 0] +>9 : 9 +>a : 0 +>[[9, 8] as const] : [readonly [9, 8]] +>[9, 8] as const : readonly [9, 8] +>[9, 8] : readonly [9, 8] +>9 : 9 +>8 : 8 + + const bb: 0 | 8 = b; +>bb : 0 | 8 +>b : 0 | 8 +} +{ + let a: 0 | 1 = 1; +>a : 0 | 1 +>1 : 1 + + let b: 0 | 1 | 8 | 9; +>b : 0 | 1 | 9 | 8 + + f(), [{ [a]: b } = [a = 0, 9] as const] = [[8, 9] as const]; +>f(), [{ [a]: b } = [a = 0, 9] as const] = [[8, 9] as const] : [readonly [8, 9]] +>f() : void +>f : () => void +>[{ [a]: b } = [a = 0, 9] as const] = [[8, 9] as const] : [readonly [8, 9]] +>[{ [a]: b } = [a = 0, 9] as const] : [readonly [0, 9]] +>{ [a]: b } = [a = 0, 9] as const : readonly [0, 9] +>{ [a]: b } : { 0: 0 | 1 | 9 | 8; } +>[a] : 0 | 1 | 9 | 8 +>a : 0 +>b : 0 | 1 | 9 | 8 +>[a = 0, 9] as const : readonly [0, 9] +>[a = 0, 9] : readonly [0, 9] +>a = 0 : 0 +>a : 0 | 1 +>0 : 0 +>9 : 9 +>[[8, 9] as const] : [readonly [8, 9]] +>[8, 9] as const : readonly [8, 9] +>[8, 9] : readonly [8, 9] +>8 : 8 +>9 : 9 + + const bb: 0 | 8 = b; +>bb : 0 | 8 +>b : 0 | 8 +} diff --git a/tests/baselines/reference/controlFlowBindingPatternOrder.symbols b/tests/baselines/reference/controlFlowBindingPatternOrder.symbols new file mode 100644 index 00000000000..359b15cd79b --- /dev/null +++ b/tests/baselines/reference/controlFlowBindingPatternOrder.symbols @@ -0,0 +1,54 @@ +=== tests/cases/conformance/controlFlow/controlFlowBindingPatternOrder.ts === +// https://github.com/microsoft/TypeScript/pull/41094#issuecomment-716044363 +{ + let a: 0 | 1 = 0; +>a : Symbol(a, Decl(controlFlowBindingPatternOrder.ts, 2, 7)) + + const [{ [(a = 1)]: b } = [9, a] as const] = []; +>a : Symbol(a, Decl(controlFlowBindingPatternOrder.ts, 2, 7)) +>b : Symbol(b, Decl(controlFlowBindingPatternOrder.ts, 3, 12)) +>a : Symbol(a, Decl(controlFlowBindingPatternOrder.ts, 2, 7)) + + const bb: 0 = b; +>bb : Symbol(bb, Decl(controlFlowBindingPatternOrder.ts, 4, 9)) +>b : Symbol(b, Decl(controlFlowBindingPatternOrder.ts, 3, 12)) +} +{ + let a: 0 | 1 = 1; +>a : Symbol(a, Decl(controlFlowBindingPatternOrder.ts, 7, 7)) + + const [{ [a]: b } = [9, a = 0] as const] = []; +>a : Symbol(a, Decl(controlFlowBindingPatternOrder.ts, 7, 7)) +>b : Symbol(b, Decl(controlFlowBindingPatternOrder.ts, 8, 12)) +>a : Symbol(a, Decl(controlFlowBindingPatternOrder.ts, 7, 7)) + + const bb: 9 = b; +>bb : Symbol(bb, Decl(controlFlowBindingPatternOrder.ts, 9, 9)) +>b : Symbol(b, Decl(controlFlowBindingPatternOrder.ts, 8, 12)) +} +{ + let a: 0 | 1 = 0; +>a : Symbol(a, Decl(controlFlowBindingPatternOrder.ts, 12, 7)) + + const [{ [(a = 1)]: b } = [9, a] as const] = [[9, 8] as const]; +>a : Symbol(a, Decl(controlFlowBindingPatternOrder.ts, 12, 7)) +>b : Symbol(b, Decl(controlFlowBindingPatternOrder.ts, 13, 12)) +>a : Symbol(a, Decl(controlFlowBindingPatternOrder.ts, 12, 7)) + + const bb: 0 | 8 = b; +>bb : Symbol(bb, Decl(controlFlowBindingPatternOrder.ts, 14, 9)) +>b : Symbol(b, Decl(controlFlowBindingPatternOrder.ts, 13, 12)) +} +{ + let a: 0 | 1 = 1; +>a : Symbol(a, Decl(controlFlowBindingPatternOrder.ts, 17, 7)) + + const [{ [a]: b } = [a = 0, 9] as const] = [[8, 9] as const]; +>a : Symbol(a, Decl(controlFlowBindingPatternOrder.ts, 17, 7)) +>b : Symbol(b, Decl(controlFlowBindingPatternOrder.ts, 18, 12)) +>a : Symbol(a, Decl(controlFlowBindingPatternOrder.ts, 17, 7)) + + const bb: 0 | 8 = b; +>bb : Symbol(bb, Decl(controlFlowBindingPatternOrder.ts, 19, 9)) +>b : Symbol(b, Decl(controlFlowBindingPatternOrder.ts, 18, 12)) +} diff --git a/tests/baselines/reference/controlFlowBindingPatternOrder.types b/tests/baselines/reference/controlFlowBindingPatternOrder.types new file mode 100644 index 00000000000..5c9d426c23b --- /dev/null +++ b/tests/baselines/reference/controlFlowBindingPatternOrder.types @@ -0,0 +1,92 @@ +=== tests/cases/conformance/controlFlow/controlFlowBindingPatternOrder.ts === +// https://github.com/microsoft/TypeScript/pull/41094#issuecomment-716044363 +{ + let a: 0 | 1 = 0; +>a : 0 | 1 +>0 : 0 + + const [{ [(a = 1)]: b } = [9, a] as const] = []; +>(a = 1) : 1 +>a = 1 : 1 +>a : 0 | 1 +>1 : 1 +>b : 0 +>[9, a] as const : readonly [9, 0] +>[9, a] : readonly [9, 0] +>9 : 9 +>a : 0 +>[] : [] + + const bb: 0 = b; +>bb : 0 +>b : 0 +} +{ + let a: 0 | 1 = 1; +>a : 0 | 1 +>1 : 1 + + const [{ [a]: b } = [9, a = 0] as const] = []; +>a : 0 +>b : 9 +>[9, a = 0] as const : readonly [9, 0] +>[9, a = 0] : readonly [9, 0] +>9 : 9 +>a = 0 : 0 +>a : 0 | 1 +>0 : 0 +>[] : [] + + const bb: 9 = b; +>bb : 9 +>b : 9 +} +{ + let a: 0 | 1 = 0; +>a : 0 | 1 +>0 : 0 + + const [{ [(a = 1)]: b } = [9, a] as const] = [[9, 8] as const]; +>(a = 1) : 1 +>a = 1 : 1 +>a : 0 | 1 +>1 : 1 +>b : 0 | 8 +>[9, a] as const : readonly [9, 0] +>[9, a] : readonly [9, 0] +>9 : 9 +>a : 0 +>[[9, 8] as const] : [readonly [9, 8]] +>[9, 8] as const : readonly [9, 8] +>[9, 8] : readonly [9, 8] +>9 : 9 +>8 : 8 + + const bb: 0 | 8 = b; +>bb : 0 | 8 +>b : 0 | 8 +} +{ + let a: 0 | 1 = 1; +>a : 0 | 1 +>1 : 1 + + const [{ [a]: b } = [a = 0, 9] as const] = [[8, 9] as const]; +>a : 0 +>b : 0 | 8 +>[a = 0, 9] as const : readonly [0, 9] +>[a = 0, 9] : readonly [0, 9] +>a = 0 : 0 +>a : 0 | 1 +>0 : 0 +>9 : 9 +>[[8, 9] as const] : [readonly [8, 9]] +>[8, 9] as const : readonly [8, 9] +>[8, 9] : readonly [8, 9] +>8 : 8 +>9 : 9 + + const bb: 0 | 8 = b; +>bb : 0 | 8 +>b : 0 | 8 +} diff --git a/tests/baselines/reference/controlFlowCommaExpressionAssertionWithinTernary.js b/tests/baselines/reference/controlFlowCommaExpressionAssertionWithinTernary.js new file mode 100644 index 00000000000..adfe5dbaca3 --- /dev/null +++ b/tests/baselines/reference/controlFlowCommaExpressionAssertionWithinTernary.js @@ -0,0 +1,16 @@ +//// [controlFlowCommaExpressionAssertionWithinTernary.ts] +declare function assert(value: any): asserts value; + +function foo2(param: number | null | undefined): number | null { + const val = param !== undefined; + return val ? (assert(param !== undefined), param) : null; + // ^^^^^ Still typed as number | null | undefined +} + +//// [controlFlowCommaExpressionAssertionWithinTernary.js] +"use strict"; +function foo2(param) { + var val = param !== undefined; + return val ? (assert(param !== undefined), param) : null; + // ^^^^^ Still typed as number | null | undefined +} diff --git a/tests/baselines/reference/controlFlowCommaExpressionAssertionWithinTernary.symbols b/tests/baselines/reference/controlFlowCommaExpressionAssertionWithinTernary.symbols new file mode 100644 index 00000000000..0c4ad6106bc --- /dev/null +++ b/tests/baselines/reference/controlFlowCommaExpressionAssertionWithinTernary.symbols @@ -0,0 +1,24 @@ +=== tests/cases/compiler/controlFlowCommaExpressionAssertionWithinTernary.ts === +declare function assert(value: any): asserts value; +>assert : Symbol(assert, Decl(controlFlowCommaExpressionAssertionWithinTernary.ts, 0, 0)) +>value : Symbol(value, Decl(controlFlowCommaExpressionAssertionWithinTernary.ts, 0, 24)) +>value : Symbol(value, Decl(controlFlowCommaExpressionAssertionWithinTernary.ts, 0, 24)) + +function foo2(param: number | null | undefined): number | null { +>foo2 : Symbol(foo2, Decl(controlFlowCommaExpressionAssertionWithinTernary.ts, 0, 51)) +>param : Symbol(param, Decl(controlFlowCommaExpressionAssertionWithinTernary.ts, 2, 14)) + + const val = param !== undefined; +>val : Symbol(val, Decl(controlFlowCommaExpressionAssertionWithinTernary.ts, 3, 9)) +>param : Symbol(param, Decl(controlFlowCommaExpressionAssertionWithinTernary.ts, 2, 14)) +>undefined : Symbol(undefined) + + return val ? (assert(param !== undefined), param) : null; +>val : Symbol(val, Decl(controlFlowCommaExpressionAssertionWithinTernary.ts, 3, 9)) +>assert : Symbol(assert, Decl(controlFlowCommaExpressionAssertionWithinTernary.ts, 0, 0)) +>param : Symbol(param, Decl(controlFlowCommaExpressionAssertionWithinTernary.ts, 2, 14)) +>undefined : Symbol(undefined) +>param : Symbol(param, Decl(controlFlowCommaExpressionAssertionWithinTernary.ts, 2, 14)) + + // ^^^^^ Still typed as number | null | undefined +} diff --git a/tests/baselines/reference/controlFlowCommaExpressionAssertionWithinTernary.types b/tests/baselines/reference/controlFlowCommaExpressionAssertionWithinTernary.types new file mode 100644 index 00000000000..8ad9e7c81f0 --- /dev/null +++ b/tests/baselines/reference/controlFlowCommaExpressionAssertionWithinTernary.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/controlFlowCommaExpressionAssertionWithinTernary.ts === +declare function assert(value: any): asserts value; +>assert : (value: any) => asserts value +>value : any + +function foo2(param: number | null | undefined): number | null { +>foo2 : (param: number | null | undefined) => number | null +>param : number | null | undefined +>null : null +>null : null + + const val = param !== undefined; +>val : boolean +>param !== undefined : boolean +>param : number | null | undefined +>undefined : undefined + + return val ? (assert(param !== undefined), param) : null; +>val ? (assert(param !== undefined), param) : null : number | null +>val : boolean +>(assert(param !== undefined), param) : number | null +>assert(param !== undefined), param : number | null +>assert(param !== undefined) : void +>assert : (value: any) => asserts value +>param !== undefined : boolean +>param : number | null | undefined +>undefined : undefined +>param : number | null +>null : null + + // ^^^^^ Still typed as number | null | undefined +} diff --git a/tests/baselines/reference/controlFlowCommaExpressionFunctionCall.js b/tests/baselines/reference/controlFlowCommaExpressionFunctionCall.js new file mode 100644 index 00000000000..c27f3ee4723 --- /dev/null +++ b/tests/baselines/reference/controlFlowCommaExpressionFunctionCall.js @@ -0,0 +1,23 @@ +//// [controlFlowCommaExpressionFunctionCall.ts] +const otherValue = () => true; +const value : number | string = null as any; + +function isNumber(obj: any): obj is number { + return true; // method implementation irrelevant +} + +// Bad case - fails +if (isNumber((otherValue(), value))) { + const b = value; // string | number , but should be number +} + +//// [controlFlowCommaExpressionFunctionCall.js] +var otherValue = function () { return true; }; +var value = null; +function isNumber(obj) { + return true; // method implementation irrelevant +} +// Bad case - fails +if (isNumber((otherValue(), value))) { + var b = value; // string | number , but should be number +} diff --git a/tests/baselines/reference/controlFlowCommaExpressionFunctionCall.symbols b/tests/baselines/reference/controlFlowCommaExpressionFunctionCall.symbols new file mode 100644 index 00000000000..4372e3f1ebe --- /dev/null +++ b/tests/baselines/reference/controlFlowCommaExpressionFunctionCall.symbols @@ -0,0 +1,25 @@ +=== tests/cases/compiler/controlFlowCommaExpressionFunctionCall.ts === +const otherValue = () => true; +>otherValue : Symbol(otherValue, Decl(controlFlowCommaExpressionFunctionCall.ts, 0, 5)) + +const value : number | string = null as any; +>value : Symbol(value, Decl(controlFlowCommaExpressionFunctionCall.ts, 1, 5)) + +function isNumber(obj: any): obj is number { +>isNumber : Symbol(isNumber, Decl(controlFlowCommaExpressionFunctionCall.ts, 1, 44)) +>obj : Symbol(obj, Decl(controlFlowCommaExpressionFunctionCall.ts, 3, 18)) +>obj : Symbol(obj, Decl(controlFlowCommaExpressionFunctionCall.ts, 3, 18)) + + return true; // method implementation irrelevant +} + +// Bad case - fails +if (isNumber((otherValue(), value))) { +>isNumber : Symbol(isNumber, Decl(controlFlowCommaExpressionFunctionCall.ts, 1, 44)) +>otherValue : Symbol(otherValue, Decl(controlFlowCommaExpressionFunctionCall.ts, 0, 5)) +>value : Symbol(value, Decl(controlFlowCommaExpressionFunctionCall.ts, 1, 5)) + + const b = value; // string | number , but should be number +>b : Symbol(b, Decl(controlFlowCommaExpressionFunctionCall.ts, 9, 9)) +>value : Symbol(value, Decl(controlFlowCommaExpressionFunctionCall.ts, 1, 5)) +} diff --git a/tests/baselines/reference/controlFlowCommaExpressionFunctionCall.types b/tests/baselines/reference/controlFlowCommaExpressionFunctionCall.types new file mode 100644 index 00000000000..0464f856102 --- /dev/null +++ b/tests/baselines/reference/controlFlowCommaExpressionFunctionCall.types @@ -0,0 +1,33 @@ +=== tests/cases/compiler/controlFlowCommaExpressionFunctionCall.ts === +const otherValue = () => true; +>otherValue : () => boolean +>() => true : () => boolean +>true : true + +const value : number | string = null as any; +>value : string | number +>null as any : any +>null : null + +function isNumber(obj: any): obj is number { +>isNumber : (obj: any) => obj is number +>obj : any + + return true; // method implementation irrelevant +>true : true +} + +// Bad case - fails +if (isNumber((otherValue(), value))) { +>isNumber((otherValue(), value)) : boolean +>isNumber : (obj: any) => obj is number +>(otherValue(), value) : string | number +>otherValue(), value : string | number +>otherValue() : boolean +>otherValue : () => boolean +>value : string | number + + const b = value; // string | number , but should be number +>b : number +>value : number +} diff --git a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen.js b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen1.js similarity index 79% rename from tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen.js rename to tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen1.js index 8b4b5afd88c..3dea02ec3b1 100644 --- a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen.js +++ b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen1.js @@ -12,7 +12,7 @@ function /*[#|*/f/*|]*/() { async function f() { await Promise.resolve(); - return Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function() { + return await Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function() { return fetch("https://github.com"); }).then(res => res.toString())]); } diff --git a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen.ts b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen1.ts similarity index 79% rename from tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen.ts rename to tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen1.ts index 8b4b5afd88c..3dea02ec3b1 100644 --- a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen.ts +++ b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen1.ts @@ -12,7 +12,7 @@ function /*[#|*/f/*|]*/() { async function f() { await Promise.resolve(); - return Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function() { + return await Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function() { return fetch("https://github.com"); }).then(res => res.toString())]); } diff --git a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen3.js b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen3.js new file mode 100644 index 00000000000..5219dc7358c --- /dev/null +++ b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen3.js @@ -0,0 +1,17 @@ +// ==ORIGINAL== + +function /*[#|*/f/*|]*/() { + return Promise.resolve().then(() => + Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function () { + return fetch("https://github.com"); + }).then(res => res.toString())])); +} + +// ==ASYNC FUNCTION::Convert to async function== + +async function f() { + await Promise.resolve(); + return await Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function() { + return fetch("https://github.com"); + }).then(res => res.toString())]); +} diff --git a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen3.ts b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen3.ts new file mode 100644 index 00000000000..5219dc7358c --- /dev/null +++ b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen3.ts @@ -0,0 +1,17 @@ +// ==ORIGINAL== + +function /*[#|*/f/*|]*/() { + return Promise.resolve().then(() => + Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function () { + return fetch("https://github.com"); + }).then(res => res.toString())])); +} + +// ==ASYNC FUNCTION::Convert to async function== + +async function f() { + await Promise.resolve(); + return await Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function() { + return fetch("https://github.com"); + }).then(res => res.toString())]); +} diff --git a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen4.js b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen4.js new file mode 100644 index 00000000000..f3be8d3479c --- /dev/null +++ b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen4.js @@ -0,0 +1,18 @@ +// ==ORIGINAL== + +function /*[#|*/f/*|]*/() { + return Promise.resolve().then(() => + Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function () { + return fetch("https://github.com"); + })]).then(res => res.toString())); +} + +// ==ASYNC FUNCTION::Convert to async function== + +async function f() { + await Promise.resolve(); + const res = await Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function() { + return fetch("https://github.com"); + })]); + return res.toString(); +} diff --git a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen4.ts b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen4.ts new file mode 100644 index 00000000000..f3be8d3479c --- /dev/null +++ b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_PromiseAllAndThen4.ts @@ -0,0 +1,18 @@ +// ==ORIGINAL== + +function /*[#|*/f/*|]*/() { + return Promise.resolve().then(() => + Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function () { + return fetch("https://github.com"); + })]).then(res => res.toString())); +} + +// ==ASYNC FUNCTION::Convert to async function== + +async function f() { + await Promise.resolve(); + const res = await Promise.all([fetch("https://typescriptlang.org"), fetch("https://microsoft.com"), Promise.resolve().then(function() { + return fetch("https://github.com"); + })]); + return res.toString(); +} diff --git a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_Return1.ts b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_Return1.ts new file mode 100644 index 00000000000..75e1d23902e --- /dev/null +++ b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_Return1.ts @@ -0,0 +1,16 @@ +// ==ORIGINAL== + +function /*[#|*/f/*|]*/(p: Promise) { + return p.catch((error: Error) => { + return Promise.reject(error); + }); +} +// ==ASYNC FUNCTION::Convert to async function== + +async function f(p: Promise) { + try { + return p; + } catch (error) { + return await Promise.reject(error); + } +} \ No newline at end of file diff --git a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_Return2.ts b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_Return2.ts new file mode 100644 index 00000000000..01fea0275c6 --- /dev/null +++ b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_Return2.ts @@ -0,0 +1,14 @@ +// ==ORIGINAL== + +function /*[#|*/f/*|]*/(p: Promise) { + return p.catch((error: Error) => Promise.reject(error)); +} +// ==ASYNC FUNCTION::Convert to async function== + +async function f(p: Promise) { + try { + return p; + } catch (error) { + return await Promise.reject(error); + } +} \ No newline at end of file diff --git a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_Return3.ts b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_Return3.ts new file mode 100644 index 00000000000..43cbe7e36b4 --- /dev/null +++ b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_Return3.ts @@ -0,0 +1,16 @@ +// ==ORIGINAL== + +function /*[#|*/f/*|]*/(p: Promise) { + return p.catch(function (error: Error) { + return Promise.reject(error); + }); +} +// ==ASYNC FUNCTION::Convert to async function== + +async function f(p: Promise) { + try { + return p; + } catch (error) { + return await Promise.reject(error); + } +} \ No newline at end of file diff --git a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_noArgs.ts b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_noArgs1.ts similarity index 93% rename from tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_noArgs.ts rename to tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_noArgs1.ts index 088bf9f828e..d5be5a9f054 100644 --- a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_noArgs.ts +++ b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_noArgs1.ts @@ -11,7 +11,7 @@ function /*[#|*/main2/*|]*/() { .then(() => { console.log("."); return delay(500); }) .then(() => { console.log("."); return delay(500); }) } - + // ==ASYNC FUNCTION::Convert to async function== function delay(millis: number): Promise { @@ -26,5 +26,6 @@ async function main2() { console.log("."); await delay(500); console.log("."); - return delay(500); + return await delay(500); } + \ No newline at end of file diff --git a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_noArgs2.ts b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_noArgs2.ts new file mode 100644 index 00000000000..04f75d9d78f --- /dev/null +++ b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_noArgs2.ts @@ -0,0 +1,28 @@ +// ==ORIGINAL== + +function delay(millis: number): Promise { + throw "no" +} + +function /*[#|*/main2/*|]*/() { + console.log("Please wait. Loading."); + return delay(500) + .then(() => delay(500)) + .then(() => delay(500)) + .then(() => delay(500)) +} + +// ==ASYNC FUNCTION::Convert to async function== + +function delay(millis: number): Promise { + throw "no" +} + +async function main2() { + console.log("Please wait. Loading."); + await delay(500); + await delay(500); + await delay(500); + return await delay(500); +} + \ No newline at end of file diff --git a/tests/baselines/reference/crashInGetTextOfComputedPropertyName.js b/tests/baselines/reference/crashInGetTextOfComputedPropertyName.js index 15dd773c58d..619404c8fb4 100644 --- a/tests/baselines/reference/crashInGetTextOfComputedPropertyName.js +++ b/tests/baselines/reference/crashInGetTextOfComputedPropertyName.js @@ -41,7 +41,7 @@ typeof itemOk1; // pass var objWithItems = { items: {} }; var itemOk2 = objWithItems.items[itemId]; typeof itemOk2; // pass -var _c = objWithItems, _d = _c.items /*happens when default value is provided*/, _e = itemId, itemWithTSError = (_d === void 0 ? {} /*happens when default value is provided*/ : _d)[_e]; +var _c = objWithItems, _d = _c.items /*happens when default value is provided*/, _e = _d === void 0 ? {} : _d /*happens when default value is provided*/, _f = itemId, itemWithTSError = _e[_f]; // in order to re-produce the error, uncomment next line: typeof itemWithTSError; // :( // will result in: diff --git a/tests/baselines/reference/declFileEnums.types b/tests/baselines/reference/declFileEnums.types index 21578650934..ef3b86f95c4 100644 --- a/tests/baselines/reference/declFileEnums.types +++ b/tests/baselines/reference/declFileEnums.types @@ -83,7 +83,7 @@ enum e5 { >"Sunday" : e5.Sunday "Weekend days" ->"Weekend days" : e5.Weekend days +>"Weekend days" : typeof e5["Weekend days"] } diff --git a/tests/baselines/reference/declarationEmitBindingPatterns.js b/tests/baselines/reference/declarationEmitBindingPatterns.js index a8550f54738..5581c06ebe6 100644 --- a/tests/baselines/reference/declarationEmitBindingPatterns.js +++ b/tests/baselines/reference/declarationEmitBindingPatterns.js @@ -13,7 +13,7 @@ var a; function f(_a, _b, _c) { _a = a; _b = a; - var _d = (_c === void 0 ? a : _c).p, _e = _d === void 0 ? a : _d; + var _d = _c === void 0 ? a : _c, _e = _d.p, _f = _e === void 0 ? a : _e, _g = _f; } diff --git a/tests/baselines/reference/declarationEmitDestructuring4.js b/tests/baselines/reference/declarationEmitDestructuring4.js index 2639aff0430..f2a82a9c20e 100644 --- a/tests/baselines/reference/declarationEmitDestructuring4.js +++ b/tests/baselines/reference/declarationEmitDestructuring4.js @@ -20,7 +20,7 @@ function baz1(_a) { _a = [1, 2, 3]; } function baz2(_a) { - var _b = (_a === void 0 ? [[1, 2, 3]] : _a)[0]; + var _b = _a === void 0 ? [[1, 2, 3]] : _a, _c = _b[0]; } function baz3(_a) { } function baz4(_a) { diff --git a/tests/baselines/reference/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.errors.txt b/tests/baselines/reference/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.errors.txt new file mode 100644 index 00000000000..43bc069f6de --- /dev/null +++ b/tests/baselines/reference/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/b.ts(2,14): error TS2527: The inferred type of 'A1' references an inaccessible 'unique symbol' type. A type annotation is necessary. + + +==== tests/cases/compiler/a.ts (0 errors) ==== + type AX = { readonly A: unique symbol }; + export const A: AX = 0 as any; +==== tests/cases/compiler/b.ts (1 errors) ==== + import { A } from './a'; + export const A1 = A; + ~~ +!!! error TS2527: The inferred type of 'A1' references an inaccessible 'unique symbol' type. A type annotation is necessary. \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.js b/tests/baselines/reference/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.js new file mode 100644 index 00000000000..b6cf51808c8 --- /dev/null +++ b/tests/baselines/reference/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.js @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.ts] //// + +//// [a.ts] +type AX = { readonly A: unique symbol }; +export const A: AX = 0 as any; +//// [b.ts] +import { A } from './a'; +export const A1 = A; + +//// [a.js] +"use strict"; +exports.__esModule = true; +exports.A = void 0; +exports.A = 0; +//// [b.js] +"use strict"; +exports.__esModule = true; +exports.A1 = void 0; +var a_1 = require("./a"); +exports.A1 = a_1.A; + + +//// [a.d.ts] +declare type AX = { + readonly A: unique symbol; +}; +export declare const A: AX; +export {}; diff --git a/tests/baselines/reference/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.symbols b/tests/baselines/reference/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.symbols new file mode 100644 index 00000000000..3294e8e38c3 --- /dev/null +++ b/tests/baselines/reference/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.symbols @@ -0,0 +1,17 @@ +=== tests/cases/compiler/a.ts === +type AX = { readonly A: unique symbol }; +>AX : Symbol(AX, Decl(a.ts, 0, 0)) +>A : Symbol(A, Decl(a.ts, 0, 11)) + +export const A: AX = 0 as any; +>A : Symbol(A, Decl(a.ts, 1, 12)) +>AX : Symbol(AX, Decl(a.ts, 0, 0)) + +=== tests/cases/compiler/b.ts === +import { A } from './a'; +>A : Symbol(A, Decl(b.ts, 0, 8)) + +export const A1 = A; +>A1 : Symbol(A1, Decl(b.ts, 1, 12)) +>A : Symbol(A, Decl(b.ts, 0, 8)) + diff --git a/tests/baselines/reference/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.types b/tests/baselines/reference/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.types new file mode 100644 index 00000000000..3582fd3db6b --- /dev/null +++ b/tests/baselines/reference/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/a.ts === +type AX = { readonly A: unique symbol }; +>AX : AX +>A : unique symbol + +export const A: AX = 0 as any; +>A : AX +>0 as any : any +>0 : 0 + +=== tests/cases/compiler/b.ts === +import { A } from './a'; +>A : { readonly A: unique symbol; } + +export const A1 = A; +>A1 : { readonly A: unique symbol; } +>A : { readonly A: unique symbol; } + diff --git a/tests/baselines/reference/declarationEmitOutFileBundlePaths.js b/tests/baselines/reference/declarationEmitOutFileBundlePaths.js new file mode 100644 index 00000000000..e3612405d6e --- /dev/null +++ b/tests/baselines/reference/declarationEmitOutFileBundlePaths.js @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/declarationEmitOutFileBundlePaths.ts] //// + +//// [versions.static.js] +export default { + "@a/b": "1.0.0", + "@a/c": "1.2.3" +}; +//// [index.js] +import versions from './versions.static.js'; + +export { + versions +}; + + + +//// [index.d.ts] +declare module "mylib/versions.static" { + var _default: { + "@a/b": string; + "@a/c": string; + }; + export default _default; +} +declare module "mylib" { + export { versions }; + import versions from "mylib/versions.static"; +} diff --git a/tests/baselines/reference/declarationEmitOutFileBundlePaths.symbols b/tests/baselines/reference/declarationEmitOutFileBundlePaths.symbols new file mode 100644 index 00000000000..6bc9c7ac6b0 --- /dev/null +++ b/tests/baselines/reference/declarationEmitOutFileBundlePaths.symbols @@ -0,0 +1,18 @@ +=== tests/cases/compiler/js/versions.static.js === +export default { + "@a/b": "1.0.0", +>"@a/b" : Symbol("@a/b", Decl(versions.static.js, 0, 16)) + + "@a/c": "1.2.3" +>"@a/c" : Symbol("@a/c", Decl(versions.static.js, 1, 20)) + +}; +=== tests/cases/compiler/js/index.js === +import versions from './versions.static.js'; +>versions : Symbol(versions, Decl(index.js, 0, 6)) + +export { + versions +>versions : Symbol(versions, Decl(index.js, 2, 8)) + +}; diff --git a/tests/baselines/reference/declarationEmitOutFileBundlePaths.types b/tests/baselines/reference/declarationEmitOutFileBundlePaths.types new file mode 100644 index 00000000000..91817afedc1 --- /dev/null +++ b/tests/baselines/reference/declarationEmitOutFileBundlePaths.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/js/versions.static.js === +export default { +>{ "@a/b": "1.0.0", "@a/c": "1.2.3"} : { "@a/b": string; "@a/c": string; } + + "@a/b": "1.0.0", +>"@a/b" : string +>"1.0.0" : "1.0.0" + + "@a/c": "1.2.3" +>"@a/c" : string +>"1.2.3" : "1.2.3" + +}; +=== tests/cases/compiler/js/index.js === +import versions from './versions.static.js'; +>versions : { "@a/b": string; "@a/c": string; } + +export { + versions +>versions : { "@a/b": string; "@a/c": string; } + +}; diff --git a/tests/baselines/reference/declarationEmitShadowingInferNotRenamed.js b/tests/baselines/reference/declarationEmitShadowingInferNotRenamed.js new file mode 100644 index 00000000000..d69903c0413 --- /dev/null +++ b/tests/baselines/reference/declarationEmitShadowingInferNotRenamed.js @@ -0,0 +1,40 @@ +//// [declarationEmitShadowingInferNotRenamed.ts] +// Any instance type +type Client = string + +// Modified instance +type UpdatedClient = C & {foo: number} + +export const createClient = < + D extends + | (new (...args: any[]) => Client) // accept class + | Record Client> // or map of classes +>( + clientDef: D +): D extends new (...args: any[]) => infer C + ? UpdatedClient // return instance + : { + [K in keyof D]: D[K] extends new (...args: any[]) => infer C // or map of instances respectively + ? UpdatedClient + : never + } => { + return null as any +} + +//// [declarationEmitShadowingInferNotRenamed.js] +"use strict"; +exports.__esModule = true; +exports.createClient = void 0; +var createClient = function (clientDef) { + return null; +}; +exports.createClient = createClient; + + +//// [declarationEmitShadowingInferNotRenamed.d.ts] +declare type Client = string; +declare type UpdatedClient = C & { + foo: number; +}; +export declare const createClient: Client> | (new (...args: any[]) => Client)>(clientDef: D) => D extends new (...args: any[]) => infer C ? UpdatedClient : { [K in keyof D]: D[K] extends new (...args: any[]) => infer C_1 ? UpdatedClient : never; }; +export {}; diff --git a/tests/baselines/reference/declarationEmitShadowingInferNotRenamed.symbols b/tests/baselines/reference/declarationEmitShadowingInferNotRenamed.symbols new file mode 100644 index 00000000000..923c839a7bc --- /dev/null +++ b/tests/baselines/reference/declarationEmitShadowingInferNotRenamed.symbols @@ -0,0 +1,58 @@ +=== tests/cases/compiler/declarationEmitShadowingInferNotRenamed.ts === +// Any instance type +type Client = string +>Client : Symbol(Client, Decl(declarationEmitShadowingInferNotRenamed.ts, 0, 0)) + +// Modified instance +type UpdatedClient = C & {foo: number} +>UpdatedClient : Symbol(UpdatedClient, Decl(declarationEmitShadowingInferNotRenamed.ts, 1, 20)) +>C : Symbol(C, Decl(declarationEmitShadowingInferNotRenamed.ts, 4, 19)) +>C : Symbol(C, Decl(declarationEmitShadowingInferNotRenamed.ts, 4, 19)) +>foo : Symbol(foo, Decl(declarationEmitShadowingInferNotRenamed.ts, 4, 29)) + +export const createClient = < +>createClient : Symbol(createClient, Decl(declarationEmitShadowingInferNotRenamed.ts, 6, 12)) + + D extends +>D : Symbol(D, Decl(declarationEmitShadowingInferNotRenamed.ts, 6, 29)) + + | (new (...args: any[]) => Client) // accept class +>args : Symbol(args, Decl(declarationEmitShadowingInferNotRenamed.ts, 8, 12)) +>Client : Symbol(Client, Decl(declarationEmitShadowingInferNotRenamed.ts, 0, 0)) + + | Record Client> // or map of classes +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) +>args : Symbol(args, Decl(declarationEmitShadowingInferNotRenamed.ts, 9, 26)) +>Client : Symbol(Client, Decl(declarationEmitShadowingInferNotRenamed.ts, 0, 0)) + +>( + clientDef: D +>clientDef : Symbol(clientDef, Decl(declarationEmitShadowingInferNotRenamed.ts, 10, 2)) +>D : Symbol(D, Decl(declarationEmitShadowingInferNotRenamed.ts, 6, 29)) + +): D extends new (...args: any[]) => infer C +>D : Symbol(D, Decl(declarationEmitShadowingInferNotRenamed.ts, 6, 29)) +>args : Symbol(args, Decl(declarationEmitShadowingInferNotRenamed.ts, 12, 18)) +>C : Symbol(C, Decl(declarationEmitShadowingInferNotRenamed.ts, 12, 42)) + + ? UpdatedClient // return instance +>UpdatedClient : Symbol(UpdatedClient, Decl(declarationEmitShadowingInferNotRenamed.ts, 1, 20)) +>C : Symbol(C, Decl(declarationEmitShadowingInferNotRenamed.ts, 12, 42)) + + : { + [K in keyof D]: D[K] extends new (...args: any[]) => infer C // or map of instances respectively +>K : Symbol(K, Decl(declarationEmitShadowingInferNotRenamed.ts, 15, 7)) +>D : Symbol(D, Decl(declarationEmitShadowingInferNotRenamed.ts, 6, 29)) +>D : Symbol(D, Decl(declarationEmitShadowingInferNotRenamed.ts, 6, 29)) +>K : Symbol(K, Decl(declarationEmitShadowingInferNotRenamed.ts, 15, 7)) +>args : Symbol(args, Decl(declarationEmitShadowingInferNotRenamed.ts, 15, 40)) +>C : Symbol(C, Decl(declarationEmitShadowingInferNotRenamed.ts, 15, 64)) + + ? UpdatedClient +>UpdatedClient : Symbol(UpdatedClient, Decl(declarationEmitShadowingInferNotRenamed.ts, 1, 20)) +>C : Symbol(C, Decl(declarationEmitShadowingInferNotRenamed.ts, 15, 64)) + + : never + } => { + return null as any +} diff --git a/tests/baselines/reference/declarationEmitShadowingInferNotRenamed.types b/tests/baselines/reference/declarationEmitShadowingInferNotRenamed.types new file mode 100644 index 00000000000..850a5565891 --- /dev/null +++ b/tests/baselines/reference/declarationEmitShadowingInferNotRenamed.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/declarationEmitShadowingInferNotRenamed.ts === +// Any instance type +type Client = string +>Client : string + +// Modified instance +type UpdatedClient = C & {foo: number} +>UpdatedClient : UpdatedClient +>foo : number + +export const createClient = < +>createClient : Client> | (new (...args: any[]) => Client)>(clientDef: D) => D extends new (...args: any[]) => infer C ? UpdatedClient : { [K in keyof D]: D[K] extends new (...args: any[]) => infer C ? UpdatedClient : never; } +>< D extends | (new (...args: any[]) => Client) // accept class | Record Client> // or map of classes>( clientDef: D): D extends new (...args: any[]) => infer C ? UpdatedClient // return instance : { [K in keyof D]: D[K] extends new (...args: any[]) => infer C // or map of instances respectively ? UpdatedClient : never } => { return null as any} : Client> | (new (...args: any[]) => Client)>(clientDef: D) => D extends new (...args: any[]) => infer C ? UpdatedClient : { [K in keyof D]: D[K] extends new (...args: any[]) => infer C ? UpdatedClient : never; } + + D extends + | (new (...args: any[]) => Client) // accept class +>args : any[] + + | Record Client> // or map of classes +>args : any[] + +>( + clientDef: D +>clientDef : D + +): D extends new (...args: any[]) => infer C +>args : any[] + + ? UpdatedClient // return instance + : { + [K in keyof D]: D[K] extends new (...args: any[]) => infer C // or map of instances respectively +>args : any[] + + ? UpdatedClient + : never + } => { + return null as any +>null as any : any +>null : null +} diff --git a/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.js b/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.js new file mode 100644 index 00000000000..d24b12c25ff --- /dev/null +++ b/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.js @@ -0,0 +1,53 @@ +//// [declarationEmitSpreadStringlyKeyedEnum.ts] +enum AgeGroups { "0-17" , "18-22" , "23-27" , "28-34" , "35-44" , "45-59" , "60-150" } +export const SpotifyAgeGroupEnum = { ...AgeGroups }; + +//// [declarationEmitSpreadStringlyKeyedEnum.js] +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +exports.__esModule = true; +exports.SpotifyAgeGroupEnum = void 0; +var AgeGroups; +(function (AgeGroups) { + AgeGroups[AgeGroups["0-17"] = 0] = "0-17"; + AgeGroups[AgeGroups["18-22"] = 1] = "18-22"; + AgeGroups[AgeGroups["23-27"] = 2] = "23-27"; + AgeGroups[AgeGroups["28-34"] = 3] = "28-34"; + AgeGroups[AgeGroups["35-44"] = 4] = "35-44"; + AgeGroups[AgeGroups["45-59"] = 5] = "45-59"; + AgeGroups[AgeGroups["60-150"] = 6] = "60-150"; +})(AgeGroups || (AgeGroups = {})); +exports.SpotifyAgeGroupEnum = __assign({}, AgeGroups); + + +//// [declarationEmitSpreadStringlyKeyedEnum.d.ts] +declare enum AgeGroups { + "0-17" = 0, + "18-22" = 1, + "23-27" = 2, + "28-34" = 3, + "35-44" = 4, + "45-59" = 5, + "60-150" = 6 +} +export declare const SpotifyAgeGroupEnum: { + [x: number]: string; + "0-17": typeof AgeGroups["0-17"]; + "18-22": typeof AgeGroups["18-22"]; + "23-27": typeof AgeGroups["23-27"]; + "28-34": typeof AgeGroups["28-34"]; + "35-44": typeof AgeGroups["35-44"]; + "45-59": typeof AgeGroups["45-59"]; + "60-150": typeof AgeGroups["60-150"]; +}; +export {}; diff --git a/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.symbols b/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.symbols new file mode 100644 index 00000000000..6a039889668 --- /dev/null +++ b/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.symbols @@ -0,0 +1,15 @@ +=== tests/cases/compiler/declarationEmitSpreadStringlyKeyedEnum.ts === +enum AgeGroups { "0-17" , "18-22" , "23-27" , "28-34" , "35-44" , "45-59" , "60-150" } +>AgeGroups : Symbol(AgeGroups, Decl(declarationEmitSpreadStringlyKeyedEnum.ts, 0, 0)) +>"0-17" : Symbol(AgeGroups["0-17"], Decl(declarationEmitSpreadStringlyKeyedEnum.ts, 0, 16)) +>"18-22" : Symbol(AgeGroups["18-22"], Decl(declarationEmitSpreadStringlyKeyedEnum.ts, 0, 25)) +>"23-27" : Symbol(AgeGroups["23-27"], Decl(declarationEmitSpreadStringlyKeyedEnum.ts, 0, 35)) +>"28-34" : Symbol(AgeGroups["28-34"], Decl(declarationEmitSpreadStringlyKeyedEnum.ts, 0, 45)) +>"35-44" : Symbol(AgeGroups["35-44"], Decl(declarationEmitSpreadStringlyKeyedEnum.ts, 0, 55)) +>"45-59" : Symbol(AgeGroups["45-59"], Decl(declarationEmitSpreadStringlyKeyedEnum.ts, 0, 65)) +>"60-150" : Symbol(AgeGroups["60-150"], Decl(declarationEmitSpreadStringlyKeyedEnum.ts, 0, 75)) + +export const SpotifyAgeGroupEnum = { ...AgeGroups }; +>SpotifyAgeGroupEnum : Symbol(SpotifyAgeGroupEnum, Decl(declarationEmitSpreadStringlyKeyedEnum.ts, 1, 12)) +>AgeGroups : Symbol(AgeGroups, Decl(declarationEmitSpreadStringlyKeyedEnum.ts, 0, 0)) + diff --git a/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.types b/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.types new file mode 100644 index 00000000000..82c31d18e68 --- /dev/null +++ b/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/declarationEmitSpreadStringlyKeyedEnum.ts === +enum AgeGroups { "0-17" , "18-22" , "23-27" , "28-34" , "35-44" , "45-59" , "60-150" } +>AgeGroups : AgeGroups +>"0-17" : typeof AgeGroups["0-17"] +>"18-22" : typeof AgeGroups["18-22"] +>"23-27" : typeof AgeGroups["23-27"] +>"28-34" : typeof AgeGroups["28-34"] +>"35-44" : typeof AgeGroups["35-44"] +>"45-59" : typeof AgeGroups["45-59"] +>"60-150" : typeof AgeGroups["60-150"] + +export const SpotifyAgeGroupEnum = { ...AgeGroups }; +>SpotifyAgeGroupEnum : { [x: number]: string; "0-17": typeof AgeGroups["0-17"]; "18-22": typeof AgeGroups["18-22"]; "23-27": typeof AgeGroups["23-27"]; "28-34": typeof AgeGroups["28-34"]; "35-44": typeof AgeGroups["35-44"]; "45-59": typeof AgeGroups["45-59"]; "60-150": typeof AgeGroups["60-150"]; } +>{ ...AgeGroups } : { [x: number]: string; "0-17": typeof AgeGroups["0-17"]; "18-22": typeof AgeGroups["18-22"]; "23-27": typeof AgeGroups["23-27"]; "28-34": typeof AgeGroups["28-34"]; "35-44": typeof AgeGroups["35-44"]; "45-59": typeof AgeGroups["45-59"]; "60-150": typeof AgeGroups["60-150"]; } +>AgeGroups : typeof AgeGroups + diff --git a/tests/baselines/reference/declarationEmitSymlinkPaths.js b/tests/baselines/reference/declarationEmitSymlinkPaths.js new file mode 100644 index 00000000000..057ac0331b3 --- /dev/null +++ b/tests/baselines/reference/declarationEmitSymlinkPaths.js @@ -0,0 +1,49 @@ +//// [tests/cases/compiler/declarationEmitSymlinkPaths.ts] //// + +//// [package.json] +{ + "name": "search", + "version": "0.0.1", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "sideEffects": false +} +//// [index.d.ts] +export declare function test (a: () => T): () => T; +//// [NotificationAPIUtils.ts] +export type NotificationRequest = {}; +export type NotificationResponse = {}; +export function getNotification(): NotificationResponse { + return {}; +} +//// [NotificationStore.ts] +import { test } from "search/lib/index"; +import { getNotification } from "../API/NotificationAPIUtils"; + +export const NotificationScenario = test( + getNotification +); + +//// [NotificationAPIUtils.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getNotification = void 0; +function getNotification() { + return {}; +} +exports.getNotification = getNotification; +//// [NotificationStore.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NotificationScenario = void 0; +var index_1 = require("search/lib/index"); +var NotificationAPIUtils_1 = require("../API/NotificationAPIUtils"); +exports.NotificationScenario = index_1.test(NotificationAPIUtils_1.getNotification); + + +//// [NotificationAPIUtils.d.ts] +export declare type NotificationRequest = {}; +export declare type NotificationResponse = {}; +export declare function getNotification(): NotificationResponse; +//// [NotificationStore.d.ts] +export declare const NotificationScenario: () => import("../API/NotificationAPIUtils").NotificationResponse; diff --git a/tests/baselines/reference/declarationEmitSymlinkPaths.symbols b/tests/baselines/reference/declarationEmitSymlinkPaths.symbols new file mode 100644 index 00000000000..d630363a0ee --- /dev/null +++ b/tests/baselines/reference/declarationEmitSymlinkPaths.symbols @@ -0,0 +1,36 @@ +=== /packages/search/lib/index.d.ts === +export declare function test (a: () => T): () => T; +>test : Symbol(test, Decl(index.d.ts, 0, 0)) +>T : Symbol(T, Decl(index.d.ts, 0, 29)) +>a : Symbol(a, Decl(index.d.ts, 0, 33)) +>T : Symbol(T, Decl(index.d.ts, 0, 29)) +>T : Symbol(T, Decl(index.d.ts, 0, 29)) + +=== /packages/search-prefix/src/API/NotificationAPIUtils.ts === +export type NotificationRequest = {}; +>NotificationRequest : Symbol(NotificationRequest, Decl(NotificationAPIUtils.ts, 0, 0)) + +export type NotificationResponse = {}; +>NotificationResponse : Symbol(NotificationResponse, Decl(NotificationAPIUtils.ts, 0, 37)) + +export function getNotification(): NotificationResponse { +>getNotification : Symbol(getNotification, Decl(NotificationAPIUtils.ts, 1, 38)) +>NotificationResponse : Symbol(NotificationResponse, Decl(NotificationAPIUtils.ts, 0, 37)) + + return {}; +} +=== /packages/search-prefix/src/Store/NotificationStore.ts === +import { test } from "search/lib/index"; +>test : Symbol(test, Decl(NotificationStore.ts, 0, 8)) + +import { getNotification } from "../API/NotificationAPIUtils"; +>getNotification : Symbol(getNotification, Decl(NotificationStore.ts, 1, 8)) + +export const NotificationScenario = test( +>NotificationScenario : Symbol(NotificationScenario, Decl(NotificationStore.ts, 3, 12)) +>test : Symbol(test, Decl(NotificationStore.ts, 0, 8)) + + getNotification +>getNotification : Symbol(getNotification, Decl(NotificationStore.ts, 1, 8)) + +); diff --git a/tests/baselines/reference/declarationEmitSymlinkPaths.types b/tests/baselines/reference/declarationEmitSymlinkPaths.types new file mode 100644 index 00000000000..2d79f6b4cc8 --- /dev/null +++ b/tests/baselines/reference/declarationEmitSymlinkPaths.types @@ -0,0 +1,34 @@ +=== /packages/search/lib/index.d.ts === +export declare function test (a: () => T): () => T; +>test : (a: () => T) => () => T +>a : () => T + +=== /packages/search-prefix/src/API/NotificationAPIUtils.ts === +export type NotificationRequest = {}; +>NotificationRequest : NotificationRequest + +export type NotificationResponse = {}; +>NotificationResponse : NotificationResponse + +export function getNotification(): NotificationResponse { +>getNotification : () => NotificationResponse + + return {}; +>{} : {} +} +=== /packages/search-prefix/src/Store/NotificationStore.ts === +import { test } from "search/lib/index"; +>test : (a: () => T) => () => T + +import { getNotification } from "../API/NotificationAPIUtils"; +>getNotification : () => import("/packages/search-prefix/src/API/NotificationAPIUtils").NotificationResponse + +export const NotificationScenario = test( +>NotificationScenario : () => import("/packages/search-prefix/src/API/NotificationAPIUtils").NotificationResponse +>test( getNotification) : () => import("/packages/search-prefix/src/API/NotificationAPIUtils").NotificationResponse +>test : (a: () => T) => () => T + + getNotification +>getNotification : () => import("/packages/search-prefix/src/API/NotificationAPIUtils").NotificationResponse + +); diff --git a/tests/baselines/reference/decoratorMetadataNoLibIsolatedModulesTypes.errors.txt b/tests/baselines/reference/decoratorMetadataNoLibIsolatedModulesTypes.errors.txt index a99536c582b..fa566152a08 100644 --- a/tests/baselines/reference/decoratorMetadataNoLibIsolatedModulesTypes.errors.txt +++ b/tests/baselines/reference/decoratorMetadataNoLibIsolatedModulesTypes.errors.txt @@ -7,7 +7,7 @@ error TS2318: Cannot find global type 'Object'. error TS2318: Cannot find global type 'RegExp'. error TS2318: Cannot find global type 'String'. tests/cases/compiler/decoratorMetadataNoLibIsolatedModulesTypes.ts(2,6): error TS2304: Cannot find name 'Decorate'. -tests/cases/compiler/decoratorMetadataNoLibIsolatedModulesTypes.ts(3,13): error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +tests/cases/compiler/decoratorMetadataNoLibIsolatedModulesTypes.ts(3,13): error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. !!! error TS2318: Cannot find global type 'Array'. @@ -25,6 +25,6 @@ tests/cases/compiler/decoratorMetadataNoLibIsolatedModulesTypes.ts(3,13): error !!! error TS2304: Cannot find name 'Decorate'. member: Map; ~~~ -!!! error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +!!! error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. } \ No newline at end of file diff --git a/tests/baselines/reference/decrementOperatorWithEnumType.types b/tests/baselines/reference/decrementOperatorWithEnumType.types index ba9db0156e3..81f2a638fb4 100644 --- a/tests/baselines/reference/decrementOperatorWithEnumType.types +++ b/tests/baselines/reference/decrementOperatorWithEnumType.types @@ -5,7 +5,7 @@ enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 >A : ENUM1.A >B : ENUM1.B ->"" : ENUM1. +>"" : typeof ENUM1[""] // expression var ResultIsNumber1 = --ENUM1["A"]; diff --git a/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.types b/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.types index 66c71837550..1e469c9312c 100644 --- a/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.types +++ b/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.types @@ -8,7 +8,7 @@ enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 >A : ENUM1.A >B : ENUM1.B ->"" : ENUM1. +>"" : typeof ENUM1[""] // enum type var var ResultIsNumber1 = --ENUM; diff --git a/tests/baselines/reference/defaultPropertyAssignedClassWithPrototype.symbols b/tests/baselines/reference/defaultPropertyAssignedClassWithPrototype.symbols new file mode 100644 index 00000000000..dbe951dcf54 --- /dev/null +++ b/tests/baselines/reference/defaultPropertyAssignedClassWithPrototype.symbols @@ -0,0 +1,33 @@ +=== tests/cases/conformance/salsa/bug39167.js === +var test = {}; +>test : Symbol(test, Decl(bug39167.js, 0, 3), Decl(bug39167.js, 0, 14), Decl(bug39167.js, 2, 18)) + +test.K = test.K || +>test.K : Symbol(test.K, Decl(bug39167.js, 0, 14), Decl(bug39167.js, 4, 5)) +>test : Symbol(test, Decl(bug39167.js, 0, 3), Decl(bug39167.js, 0, 14), Decl(bug39167.js, 2, 18)) +>K : Symbol(test.K, Decl(bug39167.js, 0, 14), Decl(bug39167.js, 4, 5)) +>test.K : Symbol(test.K, Decl(bug39167.js, 0, 14), Decl(bug39167.js, 4, 5)) +>test : Symbol(test, Decl(bug39167.js, 0, 3), Decl(bug39167.js, 0, 14), Decl(bug39167.js, 2, 18)) +>K : Symbol(test.K, Decl(bug39167.js, 0, 14), Decl(bug39167.js, 4, 5)) + + function () {} + +test.K.prototype = { +>test.K.prototype : Symbol(test.K.prototype, Decl(bug39167.js, 2, 18)) +>test.K : Symbol(test.K, Decl(bug39167.js, 0, 14), Decl(bug39167.js, 4, 5)) +>test : Symbol(test, Decl(bug39167.js, 0, 3), Decl(bug39167.js, 0, 14), Decl(bug39167.js, 2, 18)) +>K : Symbol(test.K, Decl(bug39167.js, 0, 14), Decl(bug39167.js, 4, 5)) +>prototype : Symbol(test.K.prototype, Decl(bug39167.js, 2, 18)) + + add() {} +>add : Symbol(add, Decl(bug39167.js, 4, 20)) + +}; + +new test.K().add; +>new test.K().add : Symbol(add, Decl(bug39167.js, 4, 20)) +>test.K : Symbol(test.K, Decl(bug39167.js, 0, 14), Decl(bug39167.js, 4, 5)) +>test : Symbol(test, Decl(bug39167.js, 0, 3), Decl(bug39167.js, 0, 14), Decl(bug39167.js, 2, 18)) +>K : Symbol(test.K, Decl(bug39167.js, 0, 14), Decl(bug39167.js, 4, 5)) +>add : Symbol(add, Decl(bug39167.js, 4, 20)) + diff --git a/tests/baselines/reference/defaultPropertyAssignedClassWithPrototype.types b/tests/baselines/reference/defaultPropertyAssignedClassWithPrototype.types new file mode 100644 index 00000000000..81f4e5bc641 --- /dev/null +++ b/tests/baselines/reference/defaultPropertyAssignedClassWithPrototype.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/salsa/bug39167.js === +var test = {}; +>test : typeof test +>{} : {} + +test.K = test.K || +>test.K = test.K || function () {} : typeof K +>test.K : typeof K +>test : typeof test +>K : typeof K +>test.K || function () {} : typeof K +>test.K : typeof K +>test : typeof test +>K : typeof K + + function () {} +>function () {} : typeof K + +test.K.prototype = { +>test.K.prototype = { add() {}} : { add(): void; } +>test.K.prototype : { add(): void; } +>test.K : typeof K +>test : typeof test +>K : typeof K +>prototype : { add(): void; } +>{ add() {}} : { add(): void; } + + add() {} +>add : () => void + +}; + +new test.K().add; +>new test.K().add : () => void +>new test.K() : K +>test.K : typeof K +>test : typeof test +>K : typeof K +>add : () => void + diff --git a/tests/baselines/reference/definiteAssignmentAssertions.errors.txt b/tests/baselines/reference/definiteAssignmentAssertions.errors.txt index dea5e45aa82..a4f7f80a51b 100644 --- a/tests/baselines/reference/definiteAssignmentAssertions.errors.txt +++ b/tests/baselines/reference/definiteAssignmentAssertions.errors.txt @@ -1,17 +1,19 @@ tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(5,5): error TS2564: Property 'b' has no initializer and is not definitely assigned in the constructor. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(20,6): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(21,6): error TS1255: A definite assignment assertion '!' is not permitted in this context. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(20,6): error TS1263: Declarations with initializers cannot also have definite assignment assertions. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(21,6): error TS1263: Declarations with initializers cannot also have definite assignment assertions. tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(22,13): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(28,6): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(34,15): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(68,10): error TS1258: Definite assignment assertions can only be used along with a type annotation. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(69,10): error TS1258: Definite assignment assertions can only be used along with a type annotation. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(70,10): error TS1258: Definite assignment assertions can only be used along with a type annotation. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(75,15): error TS1258: Definite assignment assertions can only be used along with a type annotation. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(76,15): error TS1258: Definite assignment assertions can only be used along with a type annotation. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(23,5): error TS7008: Member 'd' implicitly has an 'any' type. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(23,6): error TS1264: Declarations with definite assignment assertions must also have type annotations. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(29,6): error TS1255: A definite assignment assertion '!' is not permitted in this context. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(35,15): error TS1255: A definite assignment assertion '!' is not permitted in this context. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(69,10): error TS1264: Declarations with definite assignment assertions must also have type annotations. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(70,10): error TS1263: Declarations with initializers cannot also have definite assignment assertions. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(71,10): error TS1263: Declarations with initializers cannot also have definite assignment assertions. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(76,15): error TS1264: Declarations with definite assignment assertions must also have type annotations. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(77,15): error TS1264: Declarations with definite assignment assertions must also have type annotations. -==== tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts (11 errors) ==== +==== tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts (13 errors) ==== // Suppress strict property initialization check class C1 { @@ -35,13 +37,18 @@ tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(76,15): erro class C3 { a! = 1; ~ -!!! error TS1255: A definite assignment assertion '!' is not permitted in this context. +!!! error TS1263: Declarations with initializers cannot also have definite assignment assertions. b!: number = 1; ~ -!!! error TS1255: A definite assignment assertion '!' is not permitted in this context. +!!! error TS1263: Declarations with initializers cannot also have definite assignment assertions. static c!: number; ~ !!! error TS1255: A definite assignment assertion '!' is not permitted in this context. + d!; + ~ +!!! error TS7008: Member 'd' implicitly has an 'any' type. + ~ +!!! error TS1264: Declarations with definite assignment assertions must also have type annotations. } // Definite assignment assertion not permitted in ambient context @@ -93,21 +100,21 @@ tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(76,15): erro function f4() { let a!; ~ -!!! error TS1258: Definite assignment assertions can only be used along with a type annotation. +!!! error TS1264: Declarations with definite assignment assertions must also have type annotations. let b! = 1; ~ -!!! error TS1258: Definite assignment assertions can only be used along with a type annotation. +!!! error TS1263: Declarations with initializers cannot also have definite assignment assertions. let c!: number = 1; ~ -!!! error TS1258: Definite assignment assertions can only be used along with a type annotation. +!!! error TS1263: Declarations with initializers cannot also have definite assignment assertions. } // Definite assignment assertion not permitted in ambient context declare let v1!: number; ~ -!!! error TS1258: Definite assignment assertions can only be used along with a type annotation. +!!! error TS1264: Declarations with definite assignment assertions must also have type annotations. declare var v2!: number; ~ -!!! error TS1258: Definite assignment assertions can only be used along with a type annotation. +!!! error TS1264: Declarations with definite assignment assertions must also have type annotations. \ No newline at end of file diff --git a/tests/baselines/reference/definiteAssignmentAssertions.js b/tests/baselines/reference/definiteAssignmentAssertions.js index 70bab1b9c23..6ee50717ec6 100644 --- a/tests/baselines/reference/definiteAssignmentAssertions.js +++ b/tests/baselines/reference/definiteAssignmentAssertions.js @@ -21,6 +21,7 @@ class C3 { a! = 1; b!: number = 1; static c!: number; + d!; } // Definite assignment assertion not permitted in ambient context @@ -151,6 +152,7 @@ declare class C3 { a: number; b: number; static c: number; + d: any; } declare class C4 { a: number; diff --git a/tests/baselines/reference/definiteAssignmentAssertions.symbols b/tests/baselines/reference/definiteAssignmentAssertions.symbols index a291172c83b..08cc5862f6b 100644 --- a/tests/baselines/reference/definiteAssignmentAssertions.symbols +++ b/tests/baselines/reference/definiteAssignmentAssertions.symbols @@ -41,106 +41,109 @@ class C3 { static c!: number; >c : Symbol(C3.c, Decl(definiteAssignmentAssertions.ts, 20, 19)) + + d!; +>d : Symbol(C3.d, Decl(definiteAssignmentAssertions.ts, 21, 22)) } // Definite assignment assertion not permitted in ambient context declare class C4 { ->C4 : Symbol(C4, Decl(definiteAssignmentAssertions.ts, 22, 1)) +>C4 : Symbol(C4, Decl(definiteAssignmentAssertions.ts, 23, 1)) a!: number; ->a : Symbol(C4.a, Decl(definiteAssignmentAssertions.ts, 26, 18)) +>a : Symbol(C4.a, Decl(definiteAssignmentAssertions.ts, 27, 18)) } // Definite assignment assertion not permitted on abstract property abstract class C5 { ->C5 : Symbol(C5, Decl(definiteAssignmentAssertions.ts, 28, 1)) +>C5 : Symbol(C5, Decl(definiteAssignmentAssertions.ts, 29, 1)) abstract a!: number; ->a : Symbol(C5.a, Decl(definiteAssignmentAssertions.ts, 32, 19)) +>a : Symbol(C5.a, Decl(definiteAssignmentAssertions.ts, 33, 19)) } // Suppress definite assignment check for variable function f1() { ->f1 : Symbol(f1, Decl(definiteAssignmentAssertions.ts, 34, 1)) +>f1 : Symbol(f1, Decl(definiteAssignmentAssertions.ts, 35, 1)) let x!: number; ->x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 39, 7)) +>x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 40, 7)) let y = x; ->y : Symbol(y, Decl(definiteAssignmentAssertions.ts, 40, 7)) ->x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 39, 7)) +>y : Symbol(y, Decl(definiteAssignmentAssertions.ts, 41, 7)) +>x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 40, 7)) var a!: number; ->a : Symbol(a, Decl(definiteAssignmentAssertions.ts, 41, 7)) +>a : Symbol(a, Decl(definiteAssignmentAssertions.ts, 42, 7)) var b = a; ->b : Symbol(b, Decl(definiteAssignmentAssertions.ts, 42, 7)) ->a : Symbol(a, Decl(definiteAssignmentAssertions.ts, 41, 7)) +>b : Symbol(b, Decl(definiteAssignmentAssertions.ts, 43, 7)) +>a : Symbol(a, Decl(definiteAssignmentAssertions.ts, 42, 7)) } function f2() { ->f2 : Symbol(f2, Decl(definiteAssignmentAssertions.ts, 43, 1)) +>f2 : Symbol(f2, Decl(definiteAssignmentAssertions.ts, 44, 1)) let x!: string | number; ->x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 46, 7)) +>x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 47, 7)) if (typeof x === "string") { ->x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 46, 7)) +>x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 47, 7)) let s: string = x; ->s : Symbol(s, Decl(definiteAssignmentAssertions.ts, 48, 11)) ->x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 46, 7)) +>s : Symbol(s, Decl(definiteAssignmentAssertions.ts, 49, 11)) +>x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 47, 7)) } else { let n: number = x; ->n : Symbol(n, Decl(definiteAssignmentAssertions.ts, 51, 11)) ->x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 46, 7)) +>n : Symbol(n, Decl(definiteAssignmentAssertions.ts, 52, 11)) +>x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 47, 7)) } } function f3() { ->f3 : Symbol(f3, Decl(definiteAssignmentAssertions.ts, 53, 1)) +>f3 : Symbol(f3, Decl(definiteAssignmentAssertions.ts, 54, 1)) let x!: number; ->x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 56, 7)) +>x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 57, 7)) const g = () => { ->g : Symbol(g, Decl(definiteAssignmentAssertions.ts, 57, 9)) +>g : Symbol(g, Decl(definiteAssignmentAssertions.ts, 58, 9)) x = 1; ->x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 56, 7)) +>x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 57, 7)) } g(); ->g : Symbol(g, Decl(definiteAssignmentAssertions.ts, 57, 9)) +>g : Symbol(g, Decl(definiteAssignmentAssertions.ts, 58, 9)) let y = x; ->y : Symbol(y, Decl(definiteAssignmentAssertions.ts, 61, 7)) ->x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 56, 7)) +>y : Symbol(y, Decl(definiteAssignmentAssertions.ts, 62, 7)) +>x : Symbol(x, Decl(definiteAssignmentAssertions.ts, 57, 7)) } // Definite assignment assertion requires type annotation and no initializer function f4() { ->f4 : Symbol(f4, Decl(definiteAssignmentAssertions.ts, 62, 1)) +>f4 : Symbol(f4, Decl(definiteAssignmentAssertions.ts, 63, 1)) let a!; ->a : Symbol(a, Decl(definiteAssignmentAssertions.ts, 67, 7)) +>a : Symbol(a, Decl(definiteAssignmentAssertions.ts, 68, 7)) let b! = 1; ->b : Symbol(b, Decl(definiteAssignmentAssertions.ts, 68, 7)) +>b : Symbol(b, Decl(definiteAssignmentAssertions.ts, 69, 7)) let c!: number = 1; ->c : Symbol(c, Decl(definiteAssignmentAssertions.ts, 69, 7)) +>c : Symbol(c, Decl(definiteAssignmentAssertions.ts, 70, 7)) } // Definite assignment assertion not permitted in ambient context declare let v1!: number; ->v1 : Symbol(v1, Decl(definiteAssignmentAssertions.ts, 74, 11)) +>v1 : Symbol(v1, Decl(definiteAssignmentAssertions.ts, 75, 11)) declare var v2!: number; ->v2 : Symbol(v2, Decl(definiteAssignmentAssertions.ts, 75, 11)) +>v2 : Symbol(v2, Decl(definiteAssignmentAssertions.ts, 76, 11)) diff --git a/tests/baselines/reference/definiteAssignmentAssertions.types b/tests/baselines/reference/definiteAssignmentAssertions.types index 95eaf7853b3..b98839d3383 100644 --- a/tests/baselines/reference/definiteAssignmentAssertions.types +++ b/tests/baselines/reference/definiteAssignmentAssertions.types @@ -43,6 +43,9 @@ class C3 { static c!: number; >c : number + + d!; +>d : any } // Definite assignment assertion not permitted in ambient context diff --git a/tests/baselines/reference/definiteAssignmentWithErrorStillStripped.errors.txt b/tests/baselines/reference/definiteAssignmentWithErrorStillStripped.errors.txt index d6625904b2b..1b2036fced6 100644 --- a/tests/baselines/reference/definiteAssignmentWithErrorStillStripped.errors.txt +++ b/tests/baselines/reference/definiteAssignmentWithErrorStillStripped.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/definiteAssignmentWithErrorStillStripped.ts(2,6): error TS1255: A definite assignment assertion '!' is not permitted in this context. +tests/cases/compiler/definiteAssignmentWithErrorStillStripped.ts(2,6): error TS1264: Declarations with definite assignment assertions must also have type annotations. ==== tests/cases/compiler/definiteAssignmentWithErrorStillStripped.ts (1 errors) ==== class C { p!; ~ -!!! error TS1255: A definite assignment assertion '!' is not permitted in this context. +!!! error TS1264: Declarations with definite assignment assertions must also have type annotations. } \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithEnumType.types b/tests/baselines/reference/deleteOperatorWithEnumType.types index 7a067bc61a0..1ba8b696c5e 100644 --- a/tests/baselines/reference/deleteOperatorWithEnumType.types +++ b/tests/baselines/reference/deleteOperatorWithEnumType.types @@ -8,7 +8,7 @@ enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 >A : ENUM1.A >B : ENUM1.B ->"" : ENUM1. +>"" : typeof ENUM1[""] // enum type var var ResultIsBoolean1 = delete ENUM; diff --git a/tests/baselines/reference/derivedUninitializedPropertyDeclaration.errors.txt b/tests/baselines/reference/derivedUninitializedPropertyDeclaration.errors.txt index b66987ac4fb..6bd95538836 100644 --- a/tests/baselines/reference/derivedUninitializedPropertyDeclaration.errors.txt +++ b/tests/baselines/reference/derivedUninitializedPropertyDeclaration.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(12,21): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(15,5): error TS1031: 'declare' modifier cannot appear on a class element. +tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(15,5): error TS1031: 'declare' modifier cannot appear on class elements of this kind. tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(15,17): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(17,24): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(24,5): error TS2564: Property 'p' has no initializer and is not definitely assigned in the constructor. @@ -25,7 +25,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedP class BOther extends A { declare m() { return 2 } // not allowed on methods ~~~~~~~ -!!! error TS1031: 'declare' modifier cannot appear on a class element. +!!! error TS1031: 'declare' modifier cannot appear on class elements of this kind. ~ !!! error TS1183: An implementation cannot be declared in ambient contexts. declare nonce: any; // ok, even though it's not in the base diff --git a/tests/baselines/reference/destructuringControlFlowNoCrash.errors.txt b/tests/baselines/reference/destructuringControlFlowNoCrash.errors.txt new file mode 100644 index 00000000000..823de2b0abf --- /dev/null +++ b/tests/baselines/reference/destructuringControlFlowNoCrash.errors.txt @@ -0,0 +1,34 @@ +error TS2468: Cannot find global value 'Promise'. +tests/cases/compiler/destructuringControlFlowNoCrash.ts(3,3): error TS2339: Property 'date' does not exist on type '(inspectedElement: any) => number'. +tests/cases/compiler/destructuringControlFlowNoCrash.ts(10,3): error TS2339: Property 'date2' does not exist on type '(inspectedElement: any) => any'. +tests/cases/compiler/destructuringControlFlowNoCrash.ts(11,28): error TS1005: '=>' expected. +tests/cases/compiler/destructuringControlFlowNoCrash.ts(16,25): 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. + + +!!! error TS2468: Cannot find global value 'Promise'. +==== tests/cases/compiler/destructuringControlFlowNoCrash.ts (4 errors) ==== + // legal JS, if nonsensical, which also triggers the issue + const { + date, + ~~~~ +!!! error TS2339: Property 'date' does not exist on type '(inspectedElement: any) => number'. + } = (inspectedElement: any) => 0; + + date.toISOString(); + + // Working flow code + const { + date2, + ~~~~~ +!!! error TS2339: Property 'date2' does not exist on type '(inspectedElement: any) => any'. + } = (inspectedElement: any).props; + ~ +!!! error TS1005: '=>' expected. + + date2.toISOString(); + + // It could also be an async function + const { constructor } = 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. + \ No newline at end of file diff --git a/tests/baselines/reference/destructuringControlFlowNoCrash.js b/tests/baselines/reference/destructuringControlFlowNoCrash.js new file mode 100644 index 00000000000..0b7de9ee8e4 --- /dev/null +++ b/tests/baselines/reference/destructuringControlFlowNoCrash.js @@ -0,0 +1,67 @@ +//// [destructuringControlFlowNoCrash.ts] +// legal JS, if nonsensical, which also triggers the issue +const { + date, +} = (inspectedElement: any) => 0; + +date.toISOString(); + +// Working flow code +const { + date2, +} = (inspectedElement: any).props; + +date2.toISOString(); + +// It could also be an async function +const { constructor } = async () => {}; + + +//// [destructuringControlFlowNoCrash.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + 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) : adopt(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 = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, 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; +// legal JS, if nonsensical, which also triggers the issue +var date = function (inspectedElement) { return 0; }.date; +date.toISOString(); +// Working flow code +var date2 = function (inspectedElement) { return ; }.date2, props; +date2.toISOString(); +// It could also be an async function +var constructor = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; +}); }); }.constructor; diff --git a/tests/baselines/reference/destructuringControlFlowNoCrash.symbols b/tests/baselines/reference/destructuringControlFlowNoCrash.symbols new file mode 100644 index 00000000000..29cc5dfbbf7 --- /dev/null +++ b/tests/baselines/reference/destructuringControlFlowNoCrash.symbols @@ -0,0 +1,28 @@ +=== tests/cases/compiler/destructuringControlFlowNoCrash.ts === +// legal JS, if nonsensical, which also triggers the issue +const { + date, +>date : Symbol(date, Decl(destructuringControlFlowNoCrash.ts, 1, 7)) + +} = (inspectedElement: any) => 0; +>inspectedElement : Symbol(inspectedElement, Decl(destructuringControlFlowNoCrash.ts, 3, 5)) + +date.toISOString(); +>date : Symbol(date, Decl(destructuringControlFlowNoCrash.ts, 1, 7)) + +// Working flow code +const { + date2, +>date2 : Symbol(date2, Decl(destructuringControlFlowNoCrash.ts, 8, 7)) + +} = (inspectedElement: any).props; +>inspectedElement : Symbol(inspectedElement, Decl(destructuringControlFlowNoCrash.ts, 10, 5)) +>props : Symbol(props, Decl(destructuringControlFlowNoCrash.ts, 10, 28)) + +date2.toISOString(); +>date2 : Symbol(date2, Decl(destructuringControlFlowNoCrash.ts, 8, 7)) + +// It could also be an async function +const { constructor } = async () => {}; +>constructor : Symbol(constructor, Decl(destructuringControlFlowNoCrash.ts, 15, 7)) + diff --git a/tests/baselines/reference/destructuringControlFlowNoCrash.types b/tests/baselines/reference/destructuringControlFlowNoCrash.types new file mode 100644 index 00000000000..68cd4d5a295 --- /dev/null +++ b/tests/baselines/reference/destructuringControlFlowNoCrash.types @@ -0,0 +1,39 @@ +=== tests/cases/compiler/destructuringControlFlowNoCrash.ts === +// legal JS, if nonsensical, which also triggers the issue +const { + date, +>date : any + +} = (inspectedElement: any) => 0; +>(inspectedElement: any) => 0 : (inspectedElement: any) => number +>inspectedElement : any +>0 : 0 + +date.toISOString(); +>date.toISOString() : any +>date.toISOString : any +>date : any +>toISOString : any + +// Working flow code +const { + date2, +>date2 : any + +} = (inspectedElement: any).props; +>(inspectedElement: any) : (inspectedElement: any) => any +>inspectedElement : any +> : any +>props : any + +date2.toISOString(); +>date2.toISOString() : any +>date2.toISOString : any +>date2 : any +>toISOString : any + +// It could also be an async function +const { constructor } = async () => {}; +>constructor : Function +>async () => {} : () => Promise + diff --git a/tests/baselines/reference/destructuringEvaluationOrder(target=es2015).js b/tests/baselines/reference/destructuringEvaluationOrder(target=es2015).js new file mode 100644 index 00000000000..09030097703 --- /dev/null +++ b/tests/baselines/reference/destructuringEvaluationOrder(target=es2015).js @@ -0,0 +1,49 @@ +//// [destructuringEvaluationOrder.ts] +// https://github.com/microsoft/TypeScript/issues/39205 +let trace: any[] = []; +let order = (n: any): any => trace.push(n); + +// order(0) should evaluate before order(1) because the first element is undefined +let [{ [order(1)]: x } = order(0)] = []; + +// order(0) should not evaluate because the first element is defined +let [{ [order(1)]: y } = order(0)] = [{}]; + +// order(0) should evaluate first (destructuring of object literal {}) +// order(1) should evaluate next (initializer because property is undefined) +// order(2) should evaluate last (evaluate object binding pattern from initializer) +let { [order(0)]: { [order(2)]: z } = order(1), ...w } = {} as any; + + +// https://github.com/microsoft/TypeScript/issues/39181 + +// b = a must occur *after* 'a' has been assigned +let [{ ...a }, b = a]: any[] = [{ x: 1 }] + + +//// [destructuringEvaluationOrder.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 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +}; +// https://github.com/microsoft/TypeScript/issues/39205 +let trace = []; +let order = (n) => trace.push(n); +// order(0) should evaluate before order(1) because the first element is undefined +let [{ [order(1)]: x } = order(0)] = []; +// order(0) should not evaluate because the first element is defined +let [{ [order(1)]: y } = order(0)] = [{}]; +// order(0) should evaluate first (destructuring of object literal {}) +// order(1) should evaluate next (initializer because property is undefined) +// order(2) should evaluate last (evaluate object binding pattern from initializer) +let _a = {}, _b = order(0), _c = _a[_b], _d = _c === void 0 ? order(1) : _c, _e = order(2), z = _d[_e], w = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]); +// https://github.com/microsoft/TypeScript/issues/39181 +// b = a must occur *after* 'a' has been assigned +let [_f, _g] = [{ x: 1 }], a = __rest(_f, []), b = _g === void 0 ? a : _g; diff --git a/tests/baselines/reference/destructuringEvaluationOrder(target=es5).js b/tests/baselines/reference/destructuringEvaluationOrder(target=es5).js new file mode 100644 index 00000000000..f6628983f07 --- /dev/null +++ b/tests/baselines/reference/destructuringEvaluationOrder(target=es5).js @@ -0,0 +1,49 @@ +//// [destructuringEvaluationOrder.ts] +// https://github.com/microsoft/TypeScript/issues/39205 +let trace: any[] = []; +let order = (n: any): any => trace.push(n); + +// order(0) should evaluate before order(1) because the first element is undefined +let [{ [order(1)]: x } = order(0)] = []; + +// order(0) should not evaluate because the first element is defined +let [{ [order(1)]: y } = order(0)] = [{}]; + +// order(0) should evaluate first (destructuring of object literal {}) +// order(1) should evaluate next (initializer because property is undefined) +// order(2) should evaluate last (evaluate object binding pattern from initializer) +let { [order(0)]: { [order(2)]: z } = order(1), ...w } = {} as any; + + +// https://github.com/microsoft/TypeScript/issues/39181 + +// b = a must occur *after* 'a' has been assigned +let [{ ...a }, b = a]: any[] = [{ x: 1 }] + + +//// [destructuringEvaluationOrder.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 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +}; +// https://github.com/microsoft/TypeScript/issues/39205 +var trace = []; +var order = function (n) { return trace.push(n); }; +// order(0) should evaluate before order(1) because the first element is undefined +var _a = [], _b = _a[0], _c = _b === void 0 ? order(0) : _b, _d = order(1), x = _c[_d]; +// order(0) should not evaluate because the first element is defined +var _e = [{}], _f = _e[0], _g = _f === void 0 ? order(0) : _f, _h = order(1), y = _g[_h]; +// order(0) should evaluate first (destructuring of object literal {}) +// order(1) should evaluate next (initializer because property is undefined) +// order(2) should evaluate last (evaluate object binding pattern from initializer) +var _j = {}, _k = order(0), _l = _j[_k], _m = _l === void 0 ? order(1) : _l, _o = order(2), z = _m[_o], w = __rest(_j, [typeof _k === "symbol" ? _k : _k + ""]); +// https://github.com/microsoft/TypeScript/issues/39181 +// b = a must occur *after* 'a' has been assigned +var _p = [{ x: 1 }], _q = _p[0], _r = _p[1], a = __rest(_q, []), b = _r === void 0 ? a : _r; diff --git a/tests/baselines/reference/destructuringObjectAssignmentPatternWithNestedSpread(target=es2015).js b/tests/baselines/reference/destructuringObjectAssignmentPatternWithNestedSpread(target=es2015).js new file mode 100644 index 00000000000..1296299d47c --- /dev/null +++ b/tests/baselines/reference/destructuringObjectAssignmentPatternWithNestedSpread(target=es2015).js @@ -0,0 +1,20 @@ +//// [destructuringObjectAssignmentPatternWithNestedSpread.ts] +let a: any, b: any, c: any = {x: {a: 1, y: 2}}, d: any; +({x: {a, ...b} = d} = c); + + +//// [destructuringObjectAssignmentPatternWithNestedSpread.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 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +}; +var _a, _b; +let a, b, c = { x: { a: 1, y: 2 } }, d; +(_a = c.x, _b = _a === void 0 ? d : _a, { a } = _b, b = __rest(_b, ["a"])); diff --git a/tests/baselines/reference/destructuringObjectAssignmentPatternWithNestedSpread(target=es2018).js b/tests/baselines/reference/destructuringObjectAssignmentPatternWithNestedSpread(target=es2018).js new file mode 100644 index 00000000000..c3777ada4dd --- /dev/null +++ b/tests/baselines/reference/destructuringObjectAssignmentPatternWithNestedSpread(target=es2018).js @@ -0,0 +1,8 @@ +//// [destructuringObjectAssignmentPatternWithNestedSpread.ts] +let a: any, b: any, c: any = {x: {a: 1, y: 2}}, d: any; +({x: {a, ...b} = d} = c); + + +//// [destructuringObjectAssignmentPatternWithNestedSpread.js] +let a, b, c = { x: { a: 1, y: 2 } }, d; +({ x: { a, ...b } = d } = c); diff --git a/tests/baselines/reference/destructuringObjectAssignmentPatternWithNestedSpread(target=es5).js b/tests/baselines/reference/destructuringObjectAssignmentPatternWithNestedSpread(target=es5).js new file mode 100644 index 00000000000..a2e11f1f7c1 --- /dev/null +++ b/tests/baselines/reference/destructuringObjectAssignmentPatternWithNestedSpread(target=es5).js @@ -0,0 +1,20 @@ +//// [destructuringObjectAssignmentPatternWithNestedSpread.ts] +let a: any, b: any, c: any = {x: {a: 1, y: 2}}, d: any; +({x: {a, ...b} = d} = c); + + +//// [destructuringObjectAssignmentPatternWithNestedSpread.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 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +}; +var _a, _b; +var a, b, c = { x: { a: 1, y: 2 } }, d; +(_a = c.x, _b = _a === void 0 ? d : _a, a = _b.a, b = __rest(_b, ["a"])); diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.js b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.js index f201b17deda..28fa157768c 100644 --- a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.js +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment1ES5.js @@ -65,9 +65,9 @@ var a2 = {}.a2; // S has an apparent property with the property name specified in // P of a type that is assignable to the target given in P, or var b1 = { b1: 1 }.b1; -var _a = { b2: { b21: "world" } }.b2, b21 = (_a === void 0 ? { b21: "string" } : _a).b21; +var _a = { b2: { b21: "world" } }.b2, _b = _a === void 0 ? { b21: "string" } : _a, b21 = _b.b21; var b3 = { 1: "string" }[1]; -var _b = { b4: 100000 }.b4, b4 = _b === void 0 ? 1 : _b; +var _c = { b4: 100000 }.b4, b4 = _c === void 0 ? 1 : _c; var b52 = { b5: { b52: b52 } }.b5.b52; function foo() { return { diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment3.js b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment3.js index 0872a71c73b..d969ad93748 100644 --- a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment3.js +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment3.js @@ -13,6 +13,6 @@ var {"prop"} = { "prop": 1 }; var h = { h: 1 }.h; var i = { i: 2 }.i; var i1 = { i1: 2 }.i1; -var _a = undefined.f2, f21 = (_a === void 0 ? { f212: "string" } : _a).f21; +var _a = undefined.f2, _b = _a === void 0 ? { f212: "string" } : _a, f21 = _b.f21; var = { 1: }[1]; var = { "prop": 1 }["prop"]; diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment5.js b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment5.js index 3ad27f3bcf0..c2f08b83247 100644 --- a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment5.js +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment5.js @@ -22,5 +22,5 @@ function a() { var _a; var x; var y; - (_a = {}, (x = _a.x, _a), y = __rest(_a, ["x"])); + (_a = {}, x = _a.x, y = __rest(_a, ["x"])); } diff --git a/tests/baselines/reference/destructuringParameterDeclaration1ES5.js b/tests/baselines/reference/destructuringParameterDeclaration1ES5.js index 23389455310..1995c7fc67f 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration1ES5.js +++ b/tests/baselines/reference/destructuringParameterDeclaration1ES5.js @@ -127,7 +127,7 @@ function b2(z, o) { if (o === void 0) { o = { x: 0, y: undefined }; } } function b3(_a) { - var _b = (_a === void 0 ? { z: { x: "hi", y: { j: 1 } } } : _a).z, x = _b.x, j = _b.y.j; + var _b = _a === void 0 ? { z: { x: "hi", y: { j: 1 } } } : _a, _c = _b.z, x = _c.x, j = _c.y.j; } function b6(_a) { var _b = _a === void 0 ? [undefined, null, undefined] : _a, a = _b[0], z = _b[1], y = _b[2]; @@ -149,13 +149,13 @@ function c0(_a) { var _b = _a.z, x = _b.x, j = _b.y.j; } function c1(_a) { - var z = (_a === void 0 ? { z: 10 } : _a).z; + var _b = _a === void 0 ? { z: 10 } : _a, z = _b.z; } function c2(_a) { var _b = _a.z, z = _b === void 0 ? 10 : _b; } function c3(_a) { - var b = (_a === void 0 ? { b: "hello" } : _a).b; + var _b = _a === void 0 ? { b: "hello" } : _a, b = _b.b; } function c5(_a) { var a = _a[0], b = _a[1], c = _a[2][0][0]; diff --git a/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.js b/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.js index 5e14800bb56..2c57ada4f68 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.js +++ b/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.js @@ -143,13 +143,13 @@ function b2(z, o) { if (o === void 0) { o = { x: 0, y: undefined }; } } function b3(_a) { - var _b = (_a === void 0 ? { z: { x: "hi", y: { j: 1 } } } : _a).z, x = _b.x, j = _b.y.j; + var _b = _a === void 0 ? { z: { x: "hi", y: { j: 1 } } } : _a, _c = _b.z, x = _c.x, j = _c.y.j; } function b6(_a) { - var _b = __read(_a === void 0 ? [undefined, null, undefined] : _a, 3), a = _b[0], z = _b[1], y = _b[2]; + var _b = _a === void 0 ? [undefined, null, undefined] : _a, _c = __read(_b, 3), a = _c[0], z = _c[1], y = _c[2]; } function b7(_a) { - var _b = __read(_a === void 0 ? [[undefined], undefined, [[undefined, undefined]]] : _a, 3), _c = __read(_b[0], 1), a = _c[0], b = _b[1], _d = __read(_b[2], 1), _e = __read(_d[0], 2), c = _e[0], d = _e[1]; + var _b = _a === void 0 ? [[undefined], undefined, [[undefined, undefined]]] : _a, _c = __read(_b, 3), _d = __read(_c[0], 1), a = _d[0], b = _c[1], _e = __read(_c[2], 1), _f = __read(_e[0], 2), c = _f[0], d = _f[1]; } b1([1, 2, 3]); // z is widen to the type any[] b2("string", { x: 200, y: "string" }); @@ -165,13 +165,13 @@ function c0(_a) { var _b = _a.z, x = _b.x, j = _b.y.j; } function c1(_a) { - var z = (_a === void 0 ? { z: 10 } : _a).z; + var _b = _a === void 0 ? { z: 10 } : _a, z = _b.z; } function c2(_a) { var _b = _a.z, z = _b === void 0 ? 10 : _b; } function c3(_a) { - var b = (_a === void 0 ? { b: "hello" } : _a).b; + var _b = _a === void 0 ? { b: "hello" } : _a, b = _b.b; } function c5(_a) { var _b = __read(_a, 3), a = _b[0], b = _b[1], _c = __read(_b[2], 1), _d = __read(_c[0], 1), c = _d[0]; diff --git a/tests/baselines/reference/destructuringParameterDeclaration2.js b/tests/baselines/reference/destructuringParameterDeclaration2.js index 94435f967c5..a05a59badab 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration2.js +++ b/tests/baselines/reference/destructuringParameterDeclaration2.js @@ -94,13 +94,13 @@ function c0(_a) { var _b = _a.z, x = _b.x, j = _b.y.j; } function c1(_a) { - var z = (_a === void 0 ? { z: 10 } : _a).z; + var _b = _a === void 0 ? { z: 10 } : _a, z = _b.z; } function c2(_a) { var _b = _a.z, z = _b === void 0 ? 10 : _b; } function c3(_a) { - var b = (_a === void 0 ? { b: "hello" } : _a).b; + var _b = _a === void 0 ? { b: "hello" } : _a, b = _b.b; } function c4(_a, z) { var z = _a[0]; diff --git a/tests/baselines/reference/destructuringParameterDeclaration5.js b/tests/baselines/reference/destructuringParameterDeclaration5.js index a9c5597a3e5..cc2da43a81a 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration5.js +++ b/tests/baselines/reference/destructuringParameterDeclaration5.js @@ -90,7 +90,7 @@ var SubD = /** @class */ (function (_super) { return SubD; }(D)); function d0(_a) { - var x = (_a === void 0 ? { x: new Class() } : _a).x; + var _b = _a === void 0 ? { x: new Class() } : _a, x = _b.x; } function d1(_a) { var x = _a.x; @@ -102,7 +102,7 @@ function d3(_a) { var y = _a.y; } function d4(_a) { - var y = (_a === void 0 ? { y: new D() } : _a).y; + var _b = _a === void 0 ? { y: new D() } : _a, y = _b.y; } var obj = new Class(); d0({ x: 1 }); diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES5.js b/tests/baselines/reference/destructuringVariableDeclaration1ES5.js index 6ab85ff6388..117cd448a38 100644 --- a/tests/baselines/reference/destructuringVariableDeclaration1ES5.js +++ b/tests/baselines/reference/destructuringVariableDeclaration1ES5.js @@ -55,10 +55,10 @@ var _a = { a1: 10, a2: "world" }, a1 = _a.a1, a2 = _a.a2; var _b = [1, [["hello"]], true], a3 = _b[0], a4 = _b[1][0][0], a5 = _b[2]; // The type T associated with a destructuring variable declaration is determined as follows: // Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression. -var _c = { b1: { b11: "world" } }.b1, b11 = (_c === void 0 ? { b11: "string" } : _c).b11; +var _c = { b1: { b11: "world" } }.b1, _d = _c === void 0 ? { b11: "string" } : _c, b11 = _d.b11; var temp = { t1: true, t2: "false" }; -var _d = [3, false, { t1: false, t2: "hello" }], _e = _d[0], b2 = _e === void 0 ? 3 : _e, _f = _d[1], b3 = _f === void 0 ? true : _f, _g = _d[2], b4 = _g === void 0 ? temp : _g; -var _h = [undefined, undefined, undefined], _j = _h[0], b5 = _j === void 0 ? 3 : _j, _k = _h[1], b6 = _k === void 0 ? true : _k, _l = _h[2], b7 = _l === void 0 ? temp : _l; +var _e = [3, false, { t1: false, t2: "hello" }], _f = _e[0], b2 = _f === void 0 ? 3 : _f, _g = _e[1], b3 = _g === void 0 ? true : _g, _h = _e[2], b4 = _h === void 0 ? temp : _h; +var _j = [undefined, undefined, undefined], _k = _j[0], b5 = _k === void 0 ? 3 : _k, _l = _j[1], b6 = _l === void 0 ? true : _l, _m = _j[2], b7 = _m === void 0 ? temp : _m; // The type T associated with a binding element is determined as follows: // If the binding element is a rest element, T is an array type with // an element type E, where E is the type of the numeric index signature of S. @@ -68,17 +68,17 @@ var c2 = [1, 2, 3, "string"].slice(0); // Otherwise, if S is a tuple- like type (section 3.3.3): // Let N be the zero-based index of the binding element in the array binding pattern. // If S has a property with the numerical name N, T is the type of that property. -var _m = [1, "string"], d1 = _m[0], d2 = _m[1]; +var _o = [1, "string"], d1 = _o[0], d2 = _o[1]; // The type T associated with a binding element is determined as follows: // Otherwise, if S is a tuple- like type (section 3.3.3): // Otherwise, if S has a numeric index signature, T is the type of the numeric index signature. var temp1 = [true, false, true]; -var _o = __spreadArrays([1, "string"], temp1), d3 = _o[0], d4 = _o[1]; +var _p = __spreadArrays([1, "string"], temp1), d3 = _p[0], d4 = _p[1]; // Combining both forms of destructuring, -var _p = { e: [1, 2, { b1: 4, b4: 0 }] }.e, e1 = _p[0], e2 = _p[1], _q = _p[2], e3 = _q === void 0 ? { b1: 1000, b4: 200 } : _q; -var _r = { f: [1, 2, { f3: 4, f5: 0 }] }.f, f1 = _r[0], f2 = _r[1], _s = _r[2], f4 = _s.f3, f5 = _s.f5; +var _q = { e: [1, 2, { b1: 4, b4: 0 }] }.e, e1 = _q[0], e2 = _q[1], _r = _q[2], e3 = _r === void 0 ? { b1: 1000, b4: 200 } : _r; +var _s = { f: [1, 2, { f3: 4, f5: 0 }] }.f, f1 = _s[0], f2 = _s[1], _t = _s[2], f4 = _t.f3, f5 = _t.f5; // When a destructuring variable declaration, binding property, or binding element specifies // an initializer expression, the type of the initializer expression is required to be assignable // to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element. -var _t = { g: { g1: [1, 2] } }.g.g1, g1 = _t === void 0 ? [undefined, null] : _t; -var _u = { h: { h1: [1, 2] } }.h.h1, h1 = _u === void 0 ? [undefined, null] : _u; +var _u = { g: { g1: [1, 2] } }.g.g1, g1 = _u === void 0 ? [undefined, null] : _u; +var _v = { h: { h1: [1, 2] } }.h.h1, h1 = _v === void 0 ? [undefined, null] : _v; diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.js b/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.js index 83fb3de04fc..6a7052d8956 100644 --- a/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.js +++ b/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.js @@ -68,30 +68,30 @@ var _a = { a1: 10, a2: "world" }, a1 = _a.a1, a2 = _a.a2; var _b = __read([1, [["hello"]], true], 3), a3 = _b[0], _c = __read(_b[1], 1), _d = __read(_c[0], 1), a4 = _d[0], a5 = _b[2]; // The type T associated with a destructuring variable declaration is determined as follows: // Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression. -var _e = { b1: { b11: "world" } }.b1, b11 = (_e === void 0 ? { b11: "string" } : _e).b11; +var _e = { b1: { b11: "world" } }.b1, _f = _e === void 0 ? { b11: "string" } : _e, b11 = _f.b11; var temp = { t1: true, t2: "false" }; -var _f = __read([3, false, { t1: false, t2: "hello" }], 3), _g = _f[0], b2 = _g === void 0 ? 3 : _g, _h = _f[1], b3 = _h === void 0 ? true : _h, _j = _f[2], b4 = _j === void 0 ? temp : _j; -var _k = __read([undefined, undefined, undefined], 3), _l = _k[0], b5 = _l === void 0 ? 3 : _l, _m = _k[1], b6 = _m === void 0 ? true : _m, _o = _k[2], b7 = _o === void 0 ? temp : _o; +var _g = __read([3, false, { t1: false, t2: "hello" }], 3), _h = _g[0], b2 = _h === void 0 ? 3 : _h, _j = _g[1], b3 = _j === void 0 ? true : _j, _k = _g[2], b4 = _k === void 0 ? temp : _k; +var _l = __read([undefined, undefined, undefined], 3), _m = _l[0], b5 = _m === void 0 ? 3 : _m, _o = _l[1], b6 = _o === void 0 ? true : _o, _p = _l[2], b7 = _p === void 0 ? temp : _p; // The type T associated with a binding element is determined as follows: // If the binding element is a rest element, T is an array type with // an element type E, where E is the type of the numeric index signature of S. -var _p = __read([1, 2, 3]), c1 = _p.slice(0); -var _q = __read([1, 2, 3, "string"]), c2 = _q.slice(0); +var _q = __read([1, 2, 3]), c1 = _q.slice(0); +var _r = __read([1, 2, 3, "string"]), c2 = _r.slice(0); // The type T associated with a binding element is determined as follows: // Otherwise, if S is a tuple- like type (section 3.3.3): // Let N be the zero-based index of the binding element in the array binding pattern. // If S has a property with the numerical name N, T is the type of that property. -var _r = __read([1, "string"], 2), d1 = _r[0], d2 = _r[1]; +var _s = __read([1, "string"], 2), d1 = _s[0], d2 = _s[1]; // The type T associated with a binding element is determined as follows: // Otherwise, if S is a tuple- like type (section 3.3.3): // Otherwise, if S has a numeric index signature, T is the type of the numeric index signature. var temp1 = [true, false, true]; -var _s = __read(__spread([1, "string"], temp1), 2), d3 = _s[0], d4 = _s[1]; +var _t = __read(__spread([1, "string"], temp1), 2), d3 = _t[0], d4 = _t[1]; // Combining both forms of destructuring, -var _t = __read({ e: [1, 2, { b1: 4, b4: 0 }] }.e, 3), e1 = _t[0], e2 = _t[1], _u = _t[2], e3 = _u === void 0 ? { b1: 1000, b4: 200 } : _u; -var _v = __read({ f: [1, 2, { f3: 4, f5: 0 }] }.f, 4), f1 = _v[0], f2 = _v[1], _w = _v[2], f4 = _w.f3, f5 = _w.f5; +var _u = __read({ e: [1, 2, { b1: 4, b4: 0 }] }.e, 3), e1 = _u[0], e2 = _u[1], _v = _u[2], e3 = _v === void 0 ? { b1: 1000, b4: 200 } : _v; +var _w = __read({ f: [1, 2, { f3: 4, f5: 0 }] }.f, 4), f1 = _w[0], f2 = _w[1], _x = _w[2], f4 = _x.f3, f5 = _x.f5; // When a destructuring variable declaration, binding property, or binding element specifies // an initializer expression, the type of the initializer expression is required to be assignable // to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element. -var _x = { g: { g1: [1, 2] } }.g.g1, g1 = _x === void 0 ? [undefined, null] : _x; -var _y = { h: { h1: [1, 2] } }.h.h1, h1 = _y === void 0 ? [undefined, null] : _y; +var _y = { g: { g1: [1, 2] } }.g.g1, g1 = _y === void 0 ? [undefined, null] : _y; +var _z = { h: { h1: [1, 2] } }.h.h1, h1 = _z === void 0 ? [undefined, null] : _z; diff --git a/tests/baselines/reference/destructuringWithLiteralInitializers.js b/tests/baselines/reference/destructuringWithLiteralInitializers.js index 740648b04e8..9c1fd3da3ed 100644 --- a/tests/baselines/reference/destructuringWithLiteralInitializers.js +++ b/tests/baselines/reference/destructuringWithLiteralInitializers.js @@ -110,7 +110,7 @@ f6({ y: 1 }); f6({ x: 1, y: 1 }); // (arg?: { a: { x?: number, y?: number } }) => void function f7(_a) { - var _b = (_a === void 0 ? { a: {} } : _a).a, _c = _b.x, x = _c === void 0 ? 0 : _c, _d = _b.y, y = _d === void 0 ? 0 : _d; + var _b = _a === void 0 ? { a: {} } : _a, _c = _b.a, _d = _c.x, x = _d === void 0 ? 0 : _d, _e = _c.y, y = _e === void 0 ? 0 : _e; } f7(); f7({ a: {} }); diff --git a/tests/baselines/reference/didYouMeanSuggestionErrors.errors.txt b/tests/baselines/reference/didYouMeanSuggestionErrors.errors.txt index a41b19ecd9d..a6e238103bf 100644 --- a/tests/baselines/reference/didYouMeanSuggestionErrors.errors.txt +++ b/tests/baselines/reference/didYouMeanSuggestionErrors.errors.txt @@ -1,74 +1,74 @@ -tests/cases/compiler/didYouMeanSuggestionErrors.ts(1,1): error TS2582: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`. -tests/cases/compiler/didYouMeanSuggestionErrors.ts(2,5): error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`. -tests/cases/compiler/didYouMeanSuggestionErrors.ts(3,19): error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i @types/jquery`. -tests/cases/compiler/didYouMeanSuggestionErrors.ts(7,1): error TS2582: Cannot find name 'suite'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`. -tests/cases/compiler/didYouMeanSuggestionErrors.ts(8,5): error TS2582: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`. +tests/cases/compiler/didYouMeanSuggestionErrors.ts(1,1): error TS2582: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`. +tests/cases/compiler/didYouMeanSuggestionErrors.ts(2,5): error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`. +tests/cases/compiler/didYouMeanSuggestionErrors.ts(3,19): error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`. +tests/cases/compiler/didYouMeanSuggestionErrors.ts(7,1): error TS2582: Cannot find name 'suite'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`. +tests/cases/compiler/didYouMeanSuggestionErrors.ts(8,5): error TS2582: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`. tests/cases/compiler/didYouMeanSuggestionErrors.ts(9,9): error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'. -tests/cases/compiler/didYouMeanSuggestionErrors.ts(9,21): error TS2580: Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i @types/node`. +tests/cases/compiler/didYouMeanSuggestionErrors.ts(9,21): error TS2580: Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. tests/cases/compiler/didYouMeanSuggestionErrors.ts(10,9): error TS2584: Cannot find name 'document'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'. -tests/cases/compiler/didYouMeanSuggestionErrors.ts(12,19): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i @types/node`. -tests/cases/compiler/didYouMeanSuggestionErrors.ts(13,19): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. -tests/cases/compiler/didYouMeanSuggestionErrors.ts(14,19): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node`. -tests/cases/compiler/didYouMeanSuggestionErrors.ts(16,23): error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. -tests/cases/compiler/didYouMeanSuggestionErrors.ts(17,23): error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. -tests/cases/compiler/didYouMeanSuggestionErrors.ts(18,23): error TS2583: Cannot find name 'WeakMap'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. -tests/cases/compiler/didYouMeanSuggestionErrors.ts(19,23): error TS2583: Cannot find name 'WeakSet'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +tests/cases/compiler/didYouMeanSuggestionErrors.ts(12,19): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +tests/cases/compiler/didYouMeanSuggestionErrors.ts(13,19): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +tests/cases/compiler/didYouMeanSuggestionErrors.ts(14,19): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +tests/cases/compiler/didYouMeanSuggestionErrors.ts(16,23): error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/didYouMeanSuggestionErrors.ts(17,23): error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/didYouMeanSuggestionErrors.ts(18,23): error TS2583: Cannot find name 'WeakMap'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/didYouMeanSuggestionErrors.ts(19,23): error TS2583: Cannot find name 'WeakSet'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. tests/cases/compiler/didYouMeanSuggestionErrors.ts(20,19): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. tests/cases/compiler/didYouMeanSuggestionErrors.ts(21,19): error TS2585: 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. -tests/cases/compiler/didYouMeanSuggestionErrors.ts(23,18): error TS2583: Cannot find name 'Iterator'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. -tests/cases/compiler/didYouMeanSuggestionErrors.ts(24,18): error TS2583: Cannot find name 'AsyncIterator'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +tests/cases/compiler/didYouMeanSuggestionErrors.ts(23,18): error TS2583: Cannot find name 'Iterator'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/didYouMeanSuggestionErrors.ts(24,18): error TS2583: Cannot find name 'AsyncIterator'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. ==== tests/cases/compiler/didYouMeanSuggestionErrors.ts (19 errors) ==== describe("my test suite", () => { ~~~~~~~~ -!!! error TS2582: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`. +!!! error TS2582: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`. it("should run", () => { ~~ -!!! error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`. +!!! error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`. const a = $(".thing"); ~ -!!! error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i @types/jquery`. +!!! error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`. }); }); suite("another suite", () => { ~~~~~ -!!! error TS2582: Cannot find name 'suite'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`. +!!! error TS2582: Cannot find name 'suite'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`. test("everything else", () => { ~~~~ -!!! error TS2582: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`. +!!! error TS2582: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`. console.log(process.env); ~~~~~~~ !!! error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'. ~~~~~~~ -!!! error TS2580: Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i @types/node`. +!!! error TS2580: Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. document.createElement("div"); ~~~~~~~~ !!! error TS2584: Cannot find name 'document'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'. const x = require("fs"); ~~~~~~~ -!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i @types/node`. +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. const y = Buffer.from([]); ~~~~~~ -!!! error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`. +!!! error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. const z = module.exports; ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node`. +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. const a = new Map(); ~~~ -!!! error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +!!! error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. const b = new Set(); ~~~ -!!! error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +!!! error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. const c = new WeakMap(); ~~~~~~~ -!!! error TS2583: Cannot find name 'WeakMap'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +!!! error TS2583: Cannot find name 'WeakMap'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. const d = new WeakSet(); ~~~~~~~ -!!! error TS2583: Cannot find name 'WeakSet'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +!!! error TS2583: Cannot find name 'WeakSet'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. const e = Symbol(); ~~~~~~ !!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. @@ -78,10 +78,10 @@ tests/cases/compiler/didYouMeanSuggestionErrors.ts(24,18): error TS2583: Cannot const i: Iterator = null as any; ~~~~~~~~ -!!! error TS2583: Cannot find name 'Iterator'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +!!! error TS2583: Cannot find name 'Iterator'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. const j: AsyncIterator = null as any; ~~~~~~~~~~~~~ -!!! error TS2583: Cannot find name 'AsyncIterator'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +!!! error TS2583: Cannot find name 'AsyncIterator'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. const k: Symbol = null as any; const l: Promise = null as any; }); diff --git a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2015.errors.txt b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2015.errors.txt new file mode 100644 index 00000000000..1e98869b1e4 --- /dev/null +++ b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2015.errors.txt @@ -0,0 +1,347 @@ +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(3,26): error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(4,30): error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(5,35): error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(6,35): error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(7,24): error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(8,45): error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(9,35): error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(10,33): error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(11,28): error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(12,38): error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(13,24): error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(14,35): error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(15,28): error TS2550: Property 'find' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(18,33): error TS2550: Property 'findIndex' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(21,28): error TS2550: Property 'fill' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(22,34): error TS2550: Property 'copyWithin' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(23,31): error TS2550: Property 'entries' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(24,28): error TS2550: Property 'keys' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(25,30): error TS2550: Property 'values' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(26,40): error TS2550: Property 'from' does not exist on type 'ArrayConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(27,38): error TS2550: Property 'of' does not exist on type 'ArrayConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(28,44): error TS2550: Property 'assign' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(29,59): error TS2550: Property 'getOwnPropertySymbols' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(31,40): error TS2550: Property 'is' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(32,52): error TS2550: Property 'setPrototypeOf' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(33,46): error TS2550: Property 'isFinite' does not exist on type 'NumberConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(34,47): error TS2550: Property 'isInteger' does not exist on type 'NumberConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(35,43): error TS2550: Property 'isNaN' does not exist on type 'NumberConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(36,51): error TS2550: Property 'isSafeInteger' does not exist on type 'NumberConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(37,48): error TS2550: Property 'parseFloat' does not exist on type 'NumberConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(38,46): error TS2550: Property 'parseInt' does not exist on type 'NumberConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(39,28): error TS2550: Property 'clz32' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(40,27): error TS2550: Property 'imul' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(41,27): error TS2550: Property 'sign' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(42,28): error TS2550: Property 'log10' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(43,27): error TS2550: Property 'log2' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(44,28): error TS2550: Property 'log1p' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(45,28): error TS2550: Property 'expm1' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(46,27): error TS2550: Property 'cosh' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(47,27): error TS2550: Property 'sinh' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(48,27): error TS2550: Property 'tanh' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(49,28): error TS2550: Property 'acosh' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(50,28): error TS2550: Property 'asinh' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(51,28): error TS2550: Property 'atanh' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(52,28): error TS2550: Property 'hypot' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(53,28): error TS2550: Property 'trunc' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(54,29): error TS2550: Property 'fround' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(55,27): error TS2550: Property 'cbrt' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(56,16): error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(57,16): error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(58,24): error TS2585: 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(59,25): error TS2585: 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(60,28): error TS2585: 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(61,27): error TS2585: 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(62,23): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(63,26): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(64,20): error TS2583: Cannot find name 'WeakMap'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(65,20): error TS2583: Cannot find name 'WeakMap'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(66,21): error TS2583: Cannot find name 'Iterator'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(67,26): error TS2583: Cannot find name 'AsyncIterator'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(68,34): error TS2550: Property 'codePointAt' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(69,31): error TS2550: Property 'includes' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(70,31): error TS2550: Property 'endsWith' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(71,32): error TS2550: Property 'normalize' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(72,29): error TS2550: Property 'repeat' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(73,33): error TS2550: Property 'startsWith' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(74,29): error TS2550: Property 'anchor' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(75,26): error TS2550: Property 'big' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(76,28): error TS2550: Property 'blink' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(77,27): error TS2550: Property 'bold' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(78,28): error TS2550: Property 'fixed' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(79,32): error TS2550: Property 'fontcolor' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(80,31): error TS2550: Property 'fontsize' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(81,30): error TS2550: Property 'italics' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(82,27): error TS2550: Property 'link' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(83,28): error TS2550: Property 'small' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(84,29): error TS2550: Property 'strike' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(85,26): error TS2550: Property 'sub' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(86,26): error TS2550: Property 'sup' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(87,51): error TS2550: Property 'fromCodePoint' does not exist on type 'StringConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(88,41): error TS2550: Property 'raw' does not exist on type 'StringConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(89,32): error TS2550: Property 'flags' does not exist on type 'RegExp'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(90,33): error TS2550: Property 'sticky' does not exist on type 'RegExp'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts(91,34): error TS2550: Property 'unicode' does not exist on type 'RegExp'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + + +==== tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts (84 errors) ==== + // es2015 + const noOp = () => {}; + const testReflectApply = Reflect.apply(noOp, this, []); + ~~~~~~~ +!!! error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testReflectConstruct = Reflect.construct(noOp, []); + ~~~~~~~ +!!! error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testReflectDefineProperty = Reflect.defineProperty({}, "", {}); + ~~~~~~~ +!!! error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testReflectDeleteProperty = Reflect.deleteProperty({}, ""); + ~~~~~~~ +!!! error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testReflectGet = Reflect.get({}, ""); + ~~~~~~~ +!!! error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testReflectGetOwnPropertyDescriptor = Reflect.getOwnPropertyDescriptor({}, ""); + ~~~~~~~ +!!! error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testReflectGetPrototypeOf = Reflect.getPrototypeOf({}); + ~~~~~~~ +!!! error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testReflectIsExtensible = Reflect.isExtensible({}); + ~~~~~~~ +!!! error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testReflectOwnKeys = Reflect.ownKeys({}); + ~~~~~~~ +!!! error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testReflectPreventExtensions = Reflect.preventExtensions({}); + ~~~~~~~ +!!! error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testReflectSet = Reflect.set({}, "", 0); + ~~~~~~~ +!!! error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testReflectSetPrototypeOf = Reflect.setPrototypeOf({}, {}); + ~~~~~~~ +!!! error TS2583: Cannot find name 'Reflect'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testArrayFind = [""].find((val, idx, obj) => { + ~~~~ +!!! error TS2550: Property 'find' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + return true; + }); + const testArrayFindIndex = [""].findIndex((val, idx, obj) => { + ~~~~~~~~~ +!!! error TS2550: Property 'findIndex' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + return true; + }); + const testArrayFill = [""].fill("fill"); + ~~~~ +!!! error TS2550: Property 'fill' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testArrayCopyWithin = [""].copyWithin(0, 0); + ~~~~~~~~~~ +!!! error TS2550: Property 'copyWithin' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testArrayEntries = [""].entries(); + ~~~~~~~ +!!! error TS2550: Property 'entries' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testArrayKeys = [""].keys(); + ~~~~ +!!! error TS2550: Property 'keys' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testArrayValues = [""].values(); + ~~~~~~ +!!! error TS2550: Property 'values' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testArrayConstructorFrom = Array.from([]); + ~~~~ +!!! error TS2550: Property 'from' does not exist on type 'ArrayConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testArrayConstructorOf = Array.of([]); + ~~ +!!! error TS2550: Property 'of' does not exist on type 'ArrayConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testObjectConstructorAssign = Object.assign({}, {}); + ~~~~~~ +!!! error TS2550: Property 'assign' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testObjectConstructorGetOwnPropertySymbols = Object.getOwnPropertySymbols({}); + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2550: Property 'getOwnPropertySymbols' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testObjectConstructorKeys = Object.keys({}); + const testObjectConstructorIs = Object.is({}, {}); + ~~ +!!! error TS2550: Property 'is' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testObjectConstructorSetPrototypeOf = Object.setPrototypeOf({}, {}); + ~~~~~~~~~~~~~~ +!!! error TS2550: Property 'setPrototypeOf' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testNumberConstructorIsFinite = Number.isFinite(0); + ~~~~~~~~ +!!! error TS2550: Property 'isFinite' does not exist on type 'NumberConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testNumberConstructorIsInteger = Number.isInteger(0); + ~~~~~~~~~ +!!! error TS2550: Property 'isInteger' does not exist on type 'NumberConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testNumberConstructorIsNan = Number.isNaN(0); + ~~~~~ +!!! error TS2550: Property 'isNaN' does not exist on type 'NumberConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testNumberConstructorIsSafeInteger = Number.isSafeInteger(0); + ~~~~~~~~~~~~~ +!!! error TS2550: Property 'isSafeInteger' does not exist on type 'NumberConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testNumberConstructorParseFloat = Number.parseFloat("0"); + ~~~~~~~~~~ +!!! error TS2550: Property 'parseFloat' does not exist on type 'NumberConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testNumberConstructorParseInt = Number.parseInt("0"); + ~~~~~~~~ +!!! error TS2550: Property 'parseInt' does not exist on type 'NumberConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathClz32 = Math.clz32(0); + ~~~~~ +!!! error TS2550: Property 'clz32' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathImul = Math.imul(0,0); + ~~~~ +!!! error TS2550: Property 'imul' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathSign = Math.sign(0); + ~~~~ +!!! error TS2550: Property 'sign' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathLog10 = Math.log10(0); + ~~~~~ +!!! error TS2550: Property 'log10' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathLog2 = Math.log2(0); + ~~~~ +!!! error TS2550: Property 'log2' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathLog1p = Math.log1p(0); + ~~~~~ +!!! error TS2550: Property 'log1p' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathExpm1 = Math.expm1(0); + ~~~~~ +!!! error TS2550: Property 'expm1' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathCosh = Math.cosh(0); + ~~~~ +!!! error TS2550: Property 'cosh' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathSinh = Math.sinh(0); + ~~~~ +!!! error TS2550: Property 'sinh' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathTanh = Math.tanh(0); + ~~~~ +!!! error TS2550: Property 'tanh' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathAcosh = Math.acosh(0); + ~~~~~ +!!! error TS2550: Property 'acosh' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathAsinh = Math.asinh(0); + ~~~~~ +!!! error TS2550: Property 'asinh' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathAtanh = Math.atanh(0); + ~~~~~ +!!! error TS2550: Property 'atanh' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathHypot = Math.hypot(0,0); + ~~~~~ +!!! error TS2550: Property 'hypot' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathTrunc = Math.trunc(0); + ~~~~~ +!!! error TS2550: Property 'trunc' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathFround = Math.fround(0); + ~~~~~~ +!!! error TS2550: Property 'fround' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMathCbrt = Math.cbrt(0); + ~~~~ +!!! error TS2550: Property 'cbrt' does not exist on type 'Math'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testMap: Map = null as any; + ~~~ +!!! error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testSet: Set = null as any; + ~~~ +!!! error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testPromiseAll = Promise.all([]); + ~~~~~~~ +!!! error TS2585: 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. + const testPromiseRace = Promise.race([]); + ~~~~~~~ +!!! error TS2585: 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. + const testPromiseResolve = Promise.resolve(); + ~~~~~~~ +!!! error TS2585: 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. + const testPromiseReject = Promise.reject(); + ~~~~~~~ +!!! error TS2585: 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. + const testSymbolFor = Symbol.for('a'); + ~~~~~~ +!!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. + const testSymbolKeyFor = Symbol.keyFor(testSymbolFor); + ~~~~~~ +!!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. + const testWeakMap: WeakMap = null as any; + ~~~~~~~ +!!! error TS2583: Cannot find name 'WeakMap'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testWeakSet: WeakMap = null as any; + ~~~~~~~ +!!! error TS2583: Cannot find name 'WeakMap'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testIterator: Iterator = null as any; + ~~~~~~~~ +!!! error TS2583: Cannot find name 'Iterator'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testAsyncIterator: AsyncIterator = null as any; + ~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'AsyncIterator'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringCodePointAt = "".codePointAt(0); + ~~~~~~~~~~~ +!!! error TS2550: Property 'codePointAt' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringIncludes = "".includes(""); + ~~~~~~~~ +!!! error TS2550: Property 'includes' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringEndsWith = "".endsWith(""); + ~~~~~~~~ +!!! error TS2550: Property 'endsWith' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringNormalize = "".normalize(); + ~~~~~~~~~ +!!! error TS2550: Property 'normalize' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringRepeat = "".repeat(0); + ~~~~~~ +!!! error TS2550: Property 'repeat' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringStartsWith = "".startsWith(""); + ~~~~~~~~~~ +!!! error TS2550: Property 'startsWith' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringAnchor = "".anchor(""); + ~~~~~~ +!!! error TS2550: Property 'anchor' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringBig = "".big(); + ~~~ +!!! error TS2550: Property 'big' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringBlink = "".blink(); + ~~~~~ +!!! error TS2550: Property 'blink' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringBold = "".bold(); + ~~~~ +!!! error TS2550: Property 'bold' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringFixed = "".fixed(); + ~~~~~ +!!! error TS2550: Property 'fixed' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringFontColor = "".fontcolor("blue"); + ~~~~~~~~~ +!!! error TS2550: Property 'fontcolor' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringFontSize = "".fontsize(0); + ~~~~~~~~ +!!! error TS2550: Property 'fontsize' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringItalics = "".italics(); + ~~~~~~~ +!!! error TS2550: Property 'italics' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringLink = "".link(""); + ~~~~ +!!! error TS2550: Property 'link' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringSmall = "".small(); + ~~~~~ +!!! error TS2550: Property 'small' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringStrike = "".strike(); + ~~~~~~ +!!! error TS2550: Property 'strike' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringSub = "".sub(); + ~~~ +!!! error TS2550: Property 'sub' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringSup = "".sup(); + ~~~ +!!! error TS2550: Property 'sup' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringConstructorFromCodePoint = String.fromCodePoint(); + ~~~~~~~~~~~~~ +!!! error TS2550: Property 'fromCodePoint' does not exist on type 'StringConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testStringConstructorRaw = String.raw``; + ~~~ +!!! error TS2550: Property 'raw' does not exist on type 'StringConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testRegExpFlags = /abc/g.flags; + ~~~~~ +!!! error TS2550: Property 'flags' does not exist on type 'RegExp'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testRegExpSticky = /abc/g.sticky; + ~~~~~~ +!!! error TS2550: Property 'sticky' does not exist on type 'RegExp'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + const testRegExpUnicode = /abc/g.unicode; + ~~~~~~~ +!!! error TS2550: Property 'unicode' does not exist on type 'RegExp'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later. + \ No newline at end of file diff --git a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2015.js b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2015.js new file mode 100644 index 00000000000..499187956e5 --- /dev/null +++ b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2015.js @@ -0,0 +1,190 @@ +//// [doYouNeedToChangeYourTargetLibraryES2015.ts] +// es2015 +const noOp = () => {}; +const testReflectApply = Reflect.apply(noOp, this, []); +const testReflectConstruct = Reflect.construct(noOp, []); +const testReflectDefineProperty = Reflect.defineProperty({}, "", {}); +const testReflectDeleteProperty = Reflect.deleteProperty({}, ""); +const testReflectGet = Reflect.get({}, ""); +const testReflectGetOwnPropertyDescriptor = Reflect.getOwnPropertyDescriptor({}, ""); +const testReflectGetPrototypeOf = Reflect.getPrototypeOf({}); +const testReflectIsExtensible = Reflect.isExtensible({}); +const testReflectOwnKeys = Reflect.ownKeys({}); +const testReflectPreventExtensions = Reflect.preventExtensions({}); +const testReflectSet = Reflect.set({}, "", 0); +const testReflectSetPrototypeOf = Reflect.setPrototypeOf({}, {}); +const testArrayFind = [""].find((val, idx, obj) => { + return true; +}); +const testArrayFindIndex = [""].findIndex((val, idx, obj) => { + return true; +}); +const testArrayFill = [""].fill("fill"); +const testArrayCopyWithin = [""].copyWithin(0, 0); +const testArrayEntries = [""].entries(); +const testArrayKeys = [""].keys(); +const testArrayValues = [""].values(); +const testArrayConstructorFrom = Array.from([]); +const testArrayConstructorOf = Array.of([]); +const testObjectConstructorAssign = Object.assign({}, {}); +const testObjectConstructorGetOwnPropertySymbols = Object.getOwnPropertySymbols({}); +const testObjectConstructorKeys = Object.keys({}); +const testObjectConstructorIs = Object.is({}, {}); +const testObjectConstructorSetPrototypeOf = Object.setPrototypeOf({}, {}); +const testNumberConstructorIsFinite = Number.isFinite(0); +const testNumberConstructorIsInteger = Number.isInteger(0); +const testNumberConstructorIsNan = Number.isNaN(0); +const testNumberConstructorIsSafeInteger = Number.isSafeInteger(0); +const testNumberConstructorParseFloat = Number.parseFloat("0"); +const testNumberConstructorParseInt = Number.parseInt("0"); +const testMathClz32 = Math.clz32(0); +const testMathImul = Math.imul(0,0); +const testMathSign = Math.sign(0); +const testMathLog10 = Math.log10(0); +const testMathLog2 = Math.log2(0); +const testMathLog1p = Math.log1p(0); +const testMathExpm1 = Math.expm1(0); +const testMathCosh = Math.cosh(0); +const testMathSinh = Math.sinh(0); +const testMathTanh = Math.tanh(0); +const testMathAcosh = Math.acosh(0); +const testMathAsinh = Math.asinh(0); +const testMathAtanh = Math.atanh(0); +const testMathHypot = Math.hypot(0,0); +const testMathTrunc = Math.trunc(0); +const testMathFround = Math.fround(0); +const testMathCbrt = Math.cbrt(0); +const testMap: Map = null as any; +const testSet: Set = null as any; +const testPromiseAll = Promise.all([]); +const testPromiseRace = Promise.race([]); +const testPromiseResolve = Promise.resolve(); +const testPromiseReject = Promise.reject(); +const testSymbolFor = Symbol.for('a'); +const testSymbolKeyFor = Symbol.keyFor(testSymbolFor); +const testWeakMap: WeakMap = null as any; +const testWeakSet: WeakMap = null as any; +const testIterator: Iterator = null as any; +const testAsyncIterator: AsyncIterator = null as any; +const testStringCodePointAt = "".codePointAt(0); +const testStringIncludes = "".includes(""); +const testStringEndsWith = "".endsWith(""); +const testStringNormalize = "".normalize(); +const testStringRepeat = "".repeat(0); +const testStringStartsWith = "".startsWith(""); +const testStringAnchor = "".anchor(""); +const testStringBig = "".big(); +const testStringBlink = "".blink(); +const testStringBold = "".bold(); +const testStringFixed = "".fixed(); +const testStringFontColor = "".fontcolor("blue"); +const testStringFontSize = "".fontsize(0); +const testStringItalics = "".italics(); +const testStringLink = "".link(""); +const testStringSmall = "".small(); +const testStringStrike = "".strike(); +const testStringSub = "".sub(); +const testStringSup = "".sup(); +const testStringConstructorFromCodePoint = String.fromCodePoint(); +const testStringConstructorRaw = String.raw``; +const testRegExpFlags = /abc/g.flags; +const testRegExpSticky = /abc/g.sticky; +const testRegExpUnicode = /abc/g.unicode; + + +//// [doYouNeedToChangeYourTargetLibraryES2015.js] +var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; +// es2015 +var noOp = function () { }; +var testReflectApply = Reflect.apply(noOp, this, []); +var testReflectConstruct = Reflect.construct(noOp, []); +var testReflectDefineProperty = Reflect.defineProperty({}, "", {}); +var testReflectDeleteProperty = Reflect.deleteProperty({}, ""); +var testReflectGet = Reflect.get({}, ""); +var testReflectGetOwnPropertyDescriptor = Reflect.getOwnPropertyDescriptor({}, ""); +var testReflectGetPrototypeOf = Reflect.getPrototypeOf({}); +var testReflectIsExtensible = Reflect.isExtensible({}); +var testReflectOwnKeys = Reflect.ownKeys({}); +var testReflectPreventExtensions = Reflect.preventExtensions({}); +var testReflectSet = Reflect.set({}, "", 0); +var testReflectSetPrototypeOf = Reflect.setPrototypeOf({}, {}); +var testArrayFind = [""].find(function (val, idx, obj) { + return true; +}); +var testArrayFindIndex = [""].findIndex(function (val, idx, obj) { + return true; +}); +var testArrayFill = [""].fill("fill"); +var testArrayCopyWithin = [""].copyWithin(0, 0); +var testArrayEntries = [""].entries(); +var testArrayKeys = [""].keys(); +var testArrayValues = [""].values(); +var testArrayConstructorFrom = Array.from([]); +var testArrayConstructorOf = Array.of([]); +var testObjectConstructorAssign = Object.assign({}, {}); +var testObjectConstructorGetOwnPropertySymbols = Object.getOwnPropertySymbols({}); +var testObjectConstructorKeys = Object.keys({}); +var testObjectConstructorIs = Object.is({}, {}); +var testObjectConstructorSetPrototypeOf = Object.setPrototypeOf({}, {}); +var testNumberConstructorIsFinite = Number.isFinite(0); +var testNumberConstructorIsInteger = Number.isInteger(0); +var testNumberConstructorIsNan = Number.isNaN(0); +var testNumberConstructorIsSafeInteger = Number.isSafeInteger(0); +var testNumberConstructorParseFloat = Number.parseFloat("0"); +var testNumberConstructorParseInt = Number.parseInt("0"); +var testMathClz32 = Math.clz32(0); +var testMathImul = Math.imul(0, 0); +var testMathSign = Math.sign(0); +var testMathLog10 = Math.log10(0); +var testMathLog2 = Math.log2(0); +var testMathLog1p = Math.log1p(0); +var testMathExpm1 = Math.expm1(0); +var testMathCosh = Math.cosh(0); +var testMathSinh = Math.sinh(0); +var testMathTanh = Math.tanh(0); +var testMathAcosh = Math.acosh(0); +var testMathAsinh = Math.asinh(0); +var testMathAtanh = Math.atanh(0); +var testMathHypot = Math.hypot(0, 0); +var testMathTrunc = Math.trunc(0); +var testMathFround = Math.fround(0); +var testMathCbrt = Math.cbrt(0); +var testMap = null; +var testSet = null; +var testPromiseAll = Promise.all([]); +var testPromiseRace = Promise.race([]); +var testPromiseResolve = Promise.resolve(); +var testPromiseReject = Promise.reject(); +var testSymbolFor = Symbol["for"]('a'); +var testSymbolKeyFor = Symbol.keyFor(testSymbolFor); +var testWeakMap = null; +var testWeakSet = null; +var testIterator = null; +var testAsyncIterator = null; +var testStringCodePointAt = "".codePointAt(0); +var testStringIncludes = "".includes(""); +var testStringEndsWith = "".endsWith(""); +var testStringNormalize = "".normalize(); +var testStringRepeat = "".repeat(0); +var testStringStartsWith = "".startsWith(""); +var testStringAnchor = "".anchor(""); +var testStringBig = "".big(); +var testStringBlink = "".blink(); +var testStringBold = "".bold(); +var testStringFixed = "".fixed(); +var testStringFontColor = "".fontcolor("blue"); +var testStringFontSize = "".fontsize(0); +var testStringItalics = "".italics(); +var testStringLink = "".link(""); +var testStringSmall = "".small(); +var testStringStrike = "".strike(); +var testStringSub = "".sub(); +var testStringSup = "".sup(); +var testStringConstructorFromCodePoint = String.fromCodePoint(); +var testStringConstructorRaw = String.raw(__makeTemplateObject([""], [""])); +var testRegExpFlags = /abc/g.flags; +var testRegExpSticky = /abc/g.sticky; +var testRegExpUnicode = /abc/g.unicode; diff --git a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2015.symbols b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2015.symbols new file mode 100644 index 00000000000..7486af3881c --- /dev/null +++ b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2015.symbols @@ -0,0 +1,308 @@ +=== tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts === +// es2015 +const noOp = () => {}; +>noOp : Symbol(noOp, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 1, 5)) + +const testReflectApply = Reflect.apply(noOp, this, []); +>testReflectApply : Symbol(testReflectApply, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 2, 5)) +>noOp : Symbol(noOp, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 1, 5)) +>this : Symbol(globalThis) + +const testReflectConstruct = Reflect.construct(noOp, []); +>testReflectConstruct : Symbol(testReflectConstruct, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 3, 5)) +>noOp : Symbol(noOp, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 1, 5)) + +const testReflectDefineProperty = Reflect.defineProperty({}, "", {}); +>testReflectDefineProperty : Symbol(testReflectDefineProperty, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 4, 5)) + +const testReflectDeleteProperty = Reflect.deleteProperty({}, ""); +>testReflectDeleteProperty : Symbol(testReflectDeleteProperty, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 5, 5)) + +const testReflectGet = Reflect.get({}, ""); +>testReflectGet : Symbol(testReflectGet, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 6, 5)) + +const testReflectGetOwnPropertyDescriptor = Reflect.getOwnPropertyDescriptor({}, ""); +>testReflectGetOwnPropertyDescriptor : Symbol(testReflectGetOwnPropertyDescriptor, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 7, 5)) + +const testReflectGetPrototypeOf = Reflect.getPrototypeOf({}); +>testReflectGetPrototypeOf : Symbol(testReflectGetPrototypeOf, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 8, 5)) + +const testReflectIsExtensible = Reflect.isExtensible({}); +>testReflectIsExtensible : Symbol(testReflectIsExtensible, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 9, 5)) + +const testReflectOwnKeys = Reflect.ownKeys({}); +>testReflectOwnKeys : Symbol(testReflectOwnKeys, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 10, 5)) + +const testReflectPreventExtensions = Reflect.preventExtensions({}); +>testReflectPreventExtensions : Symbol(testReflectPreventExtensions, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 11, 5)) + +const testReflectSet = Reflect.set({}, "", 0); +>testReflectSet : Symbol(testReflectSet, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 12, 5)) + +const testReflectSetPrototypeOf = Reflect.setPrototypeOf({}, {}); +>testReflectSetPrototypeOf : Symbol(testReflectSetPrototypeOf, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 13, 5)) + +const testArrayFind = [""].find((val, idx, obj) => { +>testArrayFind : Symbol(testArrayFind, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 14, 5)) +>val : Symbol(val, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 14, 33)) +>idx : Symbol(idx, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 14, 37)) +>obj : Symbol(obj, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 14, 42)) + + return true; +}); +const testArrayFindIndex = [""].findIndex((val, idx, obj) => { +>testArrayFindIndex : Symbol(testArrayFindIndex, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 17, 5)) +>val : Symbol(val, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 17, 43)) +>idx : Symbol(idx, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 17, 47)) +>obj : Symbol(obj, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 17, 52)) + + return true; +}); +const testArrayFill = [""].fill("fill"); +>testArrayFill : Symbol(testArrayFill, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 20, 5)) + +const testArrayCopyWithin = [""].copyWithin(0, 0); +>testArrayCopyWithin : Symbol(testArrayCopyWithin, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 21, 5)) + +const testArrayEntries = [""].entries(); +>testArrayEntries : Symbol(testArrayEntries, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 22, 5)) + +const testArrayKeys = [""].keys(); +>testArrayKeys : Symbol(testArrayKeys, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 23, 5)) + +const testArrayValues = [""].values(); +>testArrayValues : Symbol(testArrayValues, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 24, 5)) + +const testArrayConstructorFrom = Array.from([]); +>testArrayConstructorFrom : Symbol(testArrayConstructorFrom, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 25, 5)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testArrayConstructorOf = Array.of([]); +>testArrayConstructorOf : Symbol(testArrayConstructorOf, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 26, 5)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testObjectConstructorAssign = Object.assign({}, {}); +>testObjectConstructorAssign : Symbol(testObjectConstructorAssign, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 27, 5)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testObjectConstructorGetOwnPropertySymbols = Object.getOwnPropertySymbols({}); +>testObjectConstructorGetOwnPropertySymbols : Symbol(testObjectConstructorGetOwnPropertySymbols, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 28, 5)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testObjectConstructorKeys = Object.keys({}); +>testObjectConstructorKeys : Symbol(testObjectConstructorKeys, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 29, 5)) +>Object.keys : Symbol(ObjectConstructor.keys, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>keys : Symbol(ObjectConstructor.keys, Decl(lib.es5.d.ts, --, --)) + +const testObjectConstructorIs = Object.is({}, {}); +>testObjectConstructorIs : Symbol(testObjectConstructorIs, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 30, 5)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testObjectConstructorSetPrototypeOf = Object.setPrototypeOf({}, {}); +>testObjectConstructorSetPrototypeOf : Symbol(testObjectConstructorSetPrototypeOf, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 31, 5)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testNumberConstructorIsFinite = Number.isFinite(0); +>testNumberConstructorIsFinite : Symbol(testNumberConstructorIsFinite, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 32, 5)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testNumberConstructorIsInteger = Number.isInteger(0); +>testNumberConstructorIsInteger : Symbol(testNumberConstructorIsInteger, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 33, 5)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testNumberConstructorIsNan = Number.isNaN(0); +>testNumberConstructorIsNan : Symbol(testNumberConstructorIsNan, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 34, 5)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testNumberConstructorIsSafeInteger = Number.isSafeInteger(0); +>testNumberConstructorIsSafeInteger : Symbol(testNumberConstructorIsSafeInteger, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 35, 5)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testNumberConstructorParseFloat = Number.parseFloat("0"); +>testNumberConstructorParseFloat : Symbol(testNumberConstructorParseFloat, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 36, 5)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testNumberConstructorParseInt = Number.parseInt("0"); +>testNumberConstructorParseInt : Symbol(testNumberConstructorParseInt, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 37, 5)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathClz32 = Math.clz32(0); +>testMathClz32 : Symbol(testMathClz32, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 38, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathImul = Math.imul(0,0); +>testMathImul : Symbol(testMathImul, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 39, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathSign = Math.sign(0); +>testMathSign : Symbol(testMathSign, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 40, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathLog10 = Math.log10(0); +>testMathLog10 : Symbol(testMathLog10, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 41, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathLog2 = Math.log2(0); +>testMathLog2 : Symbol(testMathLog2, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 42, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathLog1p = Math.log1p(0); +>testMathLog1p : Symbol(testMathLog1p, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 43, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathExpm1 = Math.expm1(0); +>testMathExpm1 : Symbol(testMathExpm1, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 44, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathCosh = Math.cosh(0); +>testMathCosh : Symbol(testMathCosh, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 45, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathSinh = Math.sinh(0); +>testMathSinh : Symbol(testMathSinh, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 46, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathTanh = Math.tanh(0); +>testMathTanh : Symbol(testMathTanh, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 47, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathAcosh = Math.acosh(0); +>testMathAcosh : Symbol(testMathAcosh, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 48, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathAsinh = Math.asinh(0); +>testMathAsinh : Symbol(testMathAsinh, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 49, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathAtanh = Math.atanh(0); +>testMathAtanh : Symbol(testMathAtanh, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 50, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathHypot = Math.hypot(0,0); +>testMathHypot : Symbol(testMathHypot, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 51, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathTrunc = Math.trunc(0); +>testMathTrunc : Symbol(testMathTrunc, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 52, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathFround = Math.fround(0); +>testMathFround : Symbol(testMathFround, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 53, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMathCbrt = Math.cbrt(0); +>testMathCbrt : Symbol(testMathCbrt, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 54, 5)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testMap: Map = null as any; +>testMap : Symbol(testMap, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 55, 5)) + +const testSet: Set = null as any; +>testSet : Symbol(testSet, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 56, 5)) + +const testPromiseAll = Promise.all([]); +>testPromiseAll : Symbol(testPromiseAll, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 57, 5)) + +const testPromiseRace = Promise.race([]); +>testPromiseRace : Symbol(testPromiseRace, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 58, 5)) + +const testPromiseResolve = Promise.resolve(); +>testPromiseResolve : Symbol(testPromiseResolve, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 59, 5)) + +const testPromiseReject = Promise.reject(); +>testPromiseReject : Symbol(testPromiseReject, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 60, 5)) + +const testSymbolFor = Symbol.for('a'); +>testSymbolFor : Symbol(testSymbolFor, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 61, 5)) + +const testSymbolKeyFor = Symbol.keyFor(testSymbolFor); +>testSymbolKeyFor : Symbol(testSymbolKeyFor, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 62, 5)) +>testSymbolFor : Symbol(testSymbolFor, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 61, 5)) + +const testWeakMap: WeakMap = null as any; +>testWeakMap : Symbol(testWeakMap, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 63, 5)) + +const testWeakSet: WeakMap = null as any; +>testWeakSet : Symbol(testWeakSet, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 64, 5)) + +const testIterator: Iterator = null as any; +>testIterator : Symbol(testIterator, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 65, 5)) + +const testAsyncIterator: AsyncIterator = null as any; +>testAsyncIterator : Symbol(testAsyncIterator, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 66, 5)) + +const testStringCodePointAt = "".codePointAt(0); +>testStringCodePointAt : Symbol(testStringCodePointAt, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 67, 5)) + +const testStringIncludes = "".includes(""); +>testStringIncludes : Symbol(testStringIncludes, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 68, 5)) + +const testStringEndsWith = "".endsWith(""); +>testStringEndsWith : Symbol(testStringEndsWith, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 69, 5)) + +const testStringNormalize = "".normalize(); +>testStringNormalize : Symbol(testStringNormalize, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 70, 5)) + +const testStringRepeat = "".repeat(0); +>testStringRepeat : Symbol(testStringRepeat, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 71, 5)) + +const testStringStartsWith = "".startsWith(""); +>testStringStartsWith : Symbol(testStringStartsWith, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 72, 5)) + +const testStringAnchor = "".anchor(""); +>testStringAnchor : Symbol(testStringAnchor, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 73, 5)) + +const testStringBig = "".big(); +>testStringBig : Symbol(testStringBig, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 74, 5)) + +const testStringBlink = "".blink(); +>testStringBlink : Symbol(testStringBlink, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 75, 5)) + +const testStringBold = "".bold(); +>testStringBold : Symbol(testStringBold, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 76, 5)) + +const testStringFixed = "".fixed(); +>testStringFixed : Symbol(testStringFixed, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 77, 5)) + +const testStringFontColor = "".fontcolor("blue"); +>testStringFontColor : Symbol(testStringFontColor, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 78, 5)) + +const testStringFontSize = "".fontsize(0); +>testStringFontSize : Symbol(testStringFontSize, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 79, 5)) + +const testStringItalics = "".italics(); +>testStringItalics : Symbol(testStringItalics, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 80, 5)) + +const testStringLink = "".link(""); +>testStringLink : Symbol(testStringLink, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 81, 5)) + +const testStringSmall = "".small(); +>testStringSmall : Symbol(testStringSmall, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 82, 5)) + +const testStringStrike = "".strike(); +>testStringStrike : Symbol(testStringStrike, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 83, 5)) + +const testStringSub = "".sub(); +>testStringSub : Symbol(testStringSub, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 84, 5)) + +const testStringSup = "".sup(); +>testStringSup : Symbol(testStringSup, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 85, 5)) + +const testStringConstructorFromCodePoint = String.fromCodePoint(); +>testStringConstructorFromCodePoint : Symbol(testStringConstructorFromCodePoint, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 86, 5)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testStringConstructorRaw = String.raw``; +>testStringConstructorRaw : Symbol(testStringConstructorRaw, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 87, 5)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testRegExpFlags = /abc/g.flags; +>testRegExpFlags : Symbol(testRegExpFlags, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 88, 5)) + +const testRegExpSticky = /abc/g.sticky; +>testRegExpSticky : Symbol(testRegExpSticky, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 89, 5)) + +const testRegExpUnicode = /abc/g.unicode; +>testRegExpUnicode : Symbol(testRegExpUnicode, Decl(doYouNeedToChangeYourTargetLibraryES2015.ts, 90, 5)) + diff --git a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2015.types b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2015.types new file mode 100644 index 00000000000..301e0497298 --- /dev/null +++ b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2015.types @@ -0,0 +1,684 @@ +=== tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2015.ts === +// es2015 +const noOp = () => {}; +>noOp : () => void +>() => {} : () => void + +const testReflectApply = Reflect.apply(noOp, this, []); +>testReflectApply : any +>Reflect.apply(noOp, this, []) : any +>Reflect.apply : any +>Reflect : any +>apply : any +>noOp : () => void +>this : typeof globalThis +>[] : undefined[] + +const testReflectConstruct = Reflect.construct(noOp, []); +>testReflectConstruct : any +>Reflect.construct(noOp, []) : any +>Reflect.construct : any +>Reflect : any +>construct : any +>noOp : () => void +>[] : undefined[] + +const testReflectDefineProperty = Reflect.defineProperty({}, "", {}); +>testReflectDefineProperty : any +>Reflect.defineProperty({}, "", {}) : any +>Reflect.defineProperty : any +>Reflect : any +>defineProperty : any +>{} : {} +>"" : "" +>{} : {} + +const testReflectDeleteProperty = Reflect.deleteProperty({}, ""); +>testReflectDeleteProperty : any +>Reflect.deleteProperty({}, "") : any +>Reflect.deleteProperty : any +>Reflect : any +>deleteProperty : any +>{} : {} +>"" : "" + +const testReflectGet = Reflect.get({}, ""); +>testReflectGet : any +>Reflect.get({}, "") : any +>Reflect.get : any +>Reflect : any +>get : any +>{} : {} +>"" : "" + +const testReflectGetOwnPropertyDescriptor = Reflect.getOwnPropertyDescriptor({}, ""); +>testReflectGetOwnPropertyDescriptor : any +>Reflect.getOwnPropertyDescriptor({}, "") : any +>Reflect.getOwnPropertyDescriptor : any +>Reflect : any +>getOwnPropertyDescriptor : any +>{} : {} +>"" : "" + +const testReflectGetPrototypeOf = Reflect.getPrototypeOf({}); +>testReflectGetPrototypeOf : any +>Reflect.getPrototypeOf({}) : any +>Reflect.getPrototypeOf : any +>Reflect : any +>getPrototypeOf : any +>{} : {} + +const testReflectIsExtensible = Reflect.isExtensible({}); +>testReflectIsExtensible : any +>Reflect.isExtensible({}) : any +>Reflect.isExtensible : any +>Reflect : any +>isExtensible : any +>{} : {} + +const testReflectOwnKeys = Reflect.ownKeys({}); +>testReflectOwnKeys : any +>Reflect.ownKeys({}) : any +>Reflect.ownKeys : any +>Reflect : any +>ownKeys : any +>{} : {} + +const testReflectPreventExtensions = Reflect.preventExtensions({}); +>testReflectPreventExtensions : any +>Reflect.preventExtensions({}) : any +>Reflect.preventExtensions : any +>Reflect : any +>preventExtensions : any +>{} : {} + +const testReflectSet = Reflect.set({}, "", 0); +>testReflectSet : any +>Reflect.set({}, "", 0) : any +>Reflect.set : any +>Reflect : any +>set : any +>{} : {} +>"" : "" +>0 : 0 + +const testReflectSetPrototypeOf = Reflect.setPrototypeOf({}, {}); +>testReflectSetPrototypeOf : any +>Reflect.setPrototypeOf({}, {}) : any +>Reflect.setPrototypeOf : any +>Reflect : any +>setPrototypeOf : any +>{} : {} +>{} : {} + +const testArrayFind = [""].find((val, idx, obj) => { +>testArrayFind : any +>[""].find((val, idx, obj) => { return true;}) : any +>[""].find : any +>[""] : string[] +>"" : "" +>find : any +>(val, idx, obj) => { return true;} : (val: any, idx: any, obj: any) => boolean +>val : any +>idx : any +>obj : any + + return true; +>true : true + +}); +const testArrayFindIndex = [""].findIndex((val, idx, obj) => { +>testArrayFindIndex : any +>[""].findIndex((val, idx, obj) => { return true;}) : any +>[""].findIndex : any +>[""] : string[] +>"" : "" +>findIndex : any +>(val, idx, obj) => { return true;} : (val: any, idx: any, obj: any) => boolean +>val : any +>idx : any +>obj : any + + return true; +>true : true + +}); +const testArrayFill = [""].fill("fill"); +>testArrayFill : any +>[""].fill("fill") : any +>[""].fill : any +>[""] : string[] +>"" : "" +>fill : any +>"fill" : "fill" + +const testArrayCopyWithin = [""].copyWithin(0, 0); +>testArrayCopyWithin : any +>[""].copyWithin(0, 0) : any +>[""].copyWithin : any +>[""] : string[] +>"" : "" +>copyWithin : any +>0 : 0 +>0 : 0 + +const testArrayEntries = [""].entries(); +>testArrayEntries : any +>[""].entries() : any +>[""].entries : any +>[""] : string[] +>"" : "" +>entries : any + +const testArrayKeys = [""].keys(); +>testArrayKeys : any +>[""].keys() : any +>[""].keys : any +>[""] : string[] +>"" : "" +>keys : any + +const testArrayValues = [""].values(); +>testArrayValues : any +>[""].values() : any +>[""].values : any +>[""] : string[] +>"" : "" +>values : any + +const testArrayConstructorFrom = Array.from([]); +>testArrayConstructorFrom : any +>Array.from([]) : any +>Array.from : any +>Array : ArrayConstructor +>from : any +>[] : undefined[] + +const testArrayConstructorOf = Array.of([]); +>testArrayConstructorOf : any +>Array.of([]) : any +>Array.of : any +>Array : ArrayConstructor +>of : any +>[] : undefined[] + +const testObjectConstructorAssign = Object.assign({}, {}); +>testObjectConstructorAssign : any +>Object.assign({}, {}) : any +>Object.assign : any +>Object : ObjectConstructor +>assign : any +>{} : {} +>{} : {} + +const testObjectConstructorGetOwnPropertySymbols = Object.getOwnPropertySymbols({}); +>testObjectConstructorGetOwnPropertySymbols : any +>Object.getOwnPropertySymbols({}) : any +>Object.getOwnPropertySymbols : any +>Object : ObjectConstructor +>getOwnPropertySymbols : any +>{} : {} + +const testObjectConstructorKeys = Object.keys({}); +>testObjectConstructorKeys : string[] +>Object.keys({}) : string[] +>Object.keys : (o: object) => string[] +>Object : ObjectConstructor +>keys : (o: object) => string[] +>{} : {} + +const testObjectConstructorIs = Object.is({}, {}); +>testObjectConstructorIs : any +>Object.is({}, {}) : any +>Object.is : any +>Object : ObjectConstructor +>is : any +>{} : {} +>{} : {} + +const testObjectConstructorSetPrototypeOf = Object.setPrototypeOf({}, {}); +>testObjectConstructorSetPrototypeOf : any +>Object.setPrototypeOf({}, {}) : any +>Object.setPrototypeOf : any +>Object : ObjectConstructor +>setPrototypeOf : any +>{} : {} +>{} : {} + +const testNumberConstructorIsFinite = Number.isFinite(0); +>testNumberConstructorIsFinite : any +>Number.isFinite(0) : any +>Number.isFinite : any +>Number : NumberConstructor +>isFinite : any +>0 : 0 + +const testNumberConstructorIsInteger = Number.isInteger(0); +>testNumberConstructorIsInteger : any +>Number.isInteger(0) : any +>Number.isInteger : any +>Number : NumberConstructor +>isInteger : any +>0 : 0 + +const testNumberConstructorIsNan = Number.isNaN(0); +>testNumberConstructorIsNan : any +>Number.isNaN(0) : any +>Number.isNaN : any +>Number : NumberConstructor +>isNaN : any +>0 : 0 + +const testNumberConstructorIsSafeInteger = Number.isSafeInteger(0); +>testNumberConstructorIsSafeInteger : any +>Number.isSafeInteger(0) : any +>Number.isSafeInteger : any +>Number : NumberConstructor +>isSafeInteger : any +>0 : 0 + +const testNumberConstructorParseFloat = Number.parseFloat("0"); +>testNumberConstructorParseFloat : any +>Number.parseFloat("0") : any +>Number.parseFloat : any +>Number : NumberConstructor +>parseFloat : any +>"0" : "0" + +const testNumberConstructorParseInt = Number.parseInt("0"); +>testNumberConstructorParseInt : any +>Number.parseInt("0") : any +>Number.parseInt : any +>Number : NumberConstructor +>parseInt : any +>"0" : "0" + +const testMathClz32 = Math.clz32(0); +>testMathClz32 : any +>Math.clz32(0) : any +>Math.clz32 : any +>Math : Math +>clz32 : any +>0 : 0 + +const testMathImul = Math.imul(0,0); +>testMathImul : any +>Math.imul(0,0) : any +>Math.imul : any +>Math : Math +>imul : any +>0 : 0 +>0 : 0 + +const testMathSign = Math.sign(0); +>testMathSign : any +>Math.sign(0) : any +>Math.sign : any +>Math : Math +>sign : any +>0 : 0 + +const testMathLog10 = Math.log10(0); +>testMathLog10 : any +>Math.log10(0) : any +>Math.log10 : any +>Math : Math +>log10 : any +>0 : 0 + +const testMathLog2 = Math.log2(0); +>testMathLog2 : any +>Math.log2(0) : any +>Math.log2 : any +>Math : Math +>log2 : any +>0 : 0 + +const testMathLog1p = Math.log1p(0); +>testMathLog1p : any +>Math.log1p(0) : any +>Math.log1p : any +>Math : Math +>log1p : any +>0 : 0 + +const testMathExpm1 = Math.expm1(0); +>testMathExpm1 : any +>Math.expm1(0) : any +>Math.expm1 : any +>Math : Math +>expm1 : any +>0 : 0 + +const testMathCosh = Math.cosh(0); +>testMathCosh : any +>Math.cosh(0) : any +>Math.cosh : any +>Math : Math +>cosh : any +>0 : 0 + +const testMathSinh = Math.sinh(0); +>testMathSinh : any +>Math.sinh(0) : any +>Math.sinh : any +>Math : Math +>sinh : any +>0 : 0 + +const testMathTanh = Math.tanh(0); +>testMathTanh : any +>Math.tanh(0) : any +>Math.tanh : any +>Math : Math +>tanh : any +>0 : 0 + +const testMathAcosh = Math.acosh(0); +>testMathAcosh : any +>Math.acosh(0) : any +>Math.acosh : any +>Math : Math +>acosh : any +>0 : 0 + +const testMathAsinh = Math.asinh(0); +>testMathAsinh : any +>Math.asinh(0) : any +>Math.asinh : any +>Math : Math +>asinh : any +>0 : 0 + +const testMathAtanh = Math.atanh(0); +>testMathAtanh : any +>Math.atanh(0) : any +>Math.atanh : any +>Math : Math +>atanh : any +>0 : 0 + +const testMathHypot = Math.hypot(0,0); +>testMathHypot : any +>Math.hypot(0,0) : any +>Math.hypot : any +>Math : Math +>hypot : any +>0 : 0 +>0 : 0 + +const testMathTrunc = Math.trunc(0); +>testMathTrunc : any +>Math.trunc(0) : any +>Math.trunc : any +>Math : Math +>trunc : any +>0 : 0 + +const testMathFround = Math.fround(0); +>testMathFround : any +>Math.fround(0) : any +>Math.fround : any +>Math : Math +>fround : any +>0 : 0 + +const testMathCbrt = Math.cbrt(0); +>testMathCbrt : any +>Math.cbrt(0) : any +>Math.cbrt : any +>Math : Math +>cbrt : any +>0 : 0 + +const testMap: Map = null as any; +>testMap : any +>null as any : any +>null : null + +const testSet: Set = null as any; +>testSet : any +>null as any : any +>null : null + +const testPromiseAll = Promise.all([]); +>testPromiseAll : any +>Promise.all([]) : any +>Promise.all : any +>Promise : any +>all : any +>[] : undefined[] + +const testPromiseRace = Promise.race([]); +>testPromiseRace : any +>Promise.race([]) : any +>Promise.race : any +>Promise : any +>race : any +>[] : undefined[] + +const testPromiseResolve = Promise.resolve(); +>testPromiseResolve : any +>Promise.resolve() : any +>Promise.resolve : any +>Promise : any +>resolve : any + +const testPromiseReject = Promise.reject(); +>testPromiseReject : any +>Promise.reject() : any +>Promise.reject : any +>Promise : any +>reject : any + +const testSymbolFor = Symbol.for('a'); +>testSymbolFor : any +>Symbol.for('a') : any +>Symbol.for : any +>Symbol : any +>for : any +>'a' : "a" + +const testSymbolKeyFor = Symbol.keyFor(testSymbolFor); +>testSymbolKeyFor : any +>Symbol.keyFor(testSymbolFor) : any +>Symbol.keyFor : any +>Symbol : any +>keyFor : any +>testSymbolFor : any + +const testWeakMap: WeakMap = null as any; +>testWeakMap : any +>null as any : any +>null : null + +const testWeakSet: WeakMap = null as any; +>testWeakSet : any +>null as any : any +>null : null + +const testIterator: Iterator = null as any; +>testIterator : any +>null as any : any +>null : null + +const testAsyncIterator: AsyncIterator = null as any; +>testAsyncIterator : any +>null as any : any +>null : null + +const testStringCodePointAt = "".codePointAt(0); +>testStringCodePointAt : any +>"".codePointAt(0) : any +>"".codePointAt : any +>"" : "" +>codePointAt : any +>0 : 0 + +const testStringIncludes = "".includes(""); +>testStringIncludes : any +>"".includes("") : any +>"".includes : any +>"" : "" +>includes : any +>"" : "" + +const testStringEndsWith = "".endsWith(""); +>testStringEndsWith : any +>"".endsWith("") : any +>"".endsWith : any +>"" : "" +>endsWith : any +>"" : "" + +const testStringNormalize = "".normalize(); +>testStringNormalize : any +>"".normalize() : any +>"".normalize : any +>"" : "" +>normalize : any + +const testStringRepeat = "".repeat(0); +>testStringRepeat : any +>"".repeat(0) : any +>"".repeat : any +>"" : "" +>repeat : any +>0 : 0 + +const testStringStartsWith = "".startsWith(""); +>testStringStartsWith : any +>"".startsWith("") : any +>"".startsWith : any +>"" : "" +>startsWith : any +>"" : "" + +const testStringAnchor = "".anchor(""); +>testStringAnchor : any +>"".anchor("") : any +>"".anchor : any +>"" : "" +>anchor : any +>"" : "" + +const testStringBig = "".big(); +>testStringBig : any +>"".big() : any +>"".big : any +>"" : "" +>big : any + +const testStringBlink = "".blink(); +>testStringBlink : any +>"".blink() : any +>"".blink : any +>"" : "" +>blink : any + +const testStringBold = "".bold(); +>testStringBold : any +>"".bold() : any +>"".bold : any +>"" : "" +>bold : any + +const testStringFixed = "".fixed(); +>testStringFixed : any +>"".fixed() : any +>"".fixed : any +>"" : "" +>fixed : any + +const testStringFontColor = "".fontcolor("blue"); +>testStringFontColor : any +>"".fontcolor("blue") : any +>"".fontcolor : any +>"" : "" +>fontcolor : any +>"blue" : "blue" + +const testStringFontSize = "".fontsize(0); +>testStringFontSize : any +>"".fontsize(0) : any +>"".fontsize : any +>"" : "" +>fontsize : any +>0 : 0 + +const testStringItalics = "".italics(); +>testStringItalics : any +>"".italics() : any +>"".italics : any +>"" : "" +>italics : any + +const testStringLink = "".link(""); +>testStringLink : any +>"".link("") : any +>"".link : any +>"" : "" +>link : any +>"" : "" + +const testStringSmall = "".small(); +>testStringSmall : any +>"".small() : any +>"".small : any +>"" : "" +>small : any + +const testStringStrike = "".strike(); +>testStringStrike : any +>"".strike() : any +>"".strike : any +>"" : "" +>strike : any + +const testStringSub = "".sub(); +>testStringSub : any +>"".sub() : any +>"".sub : any +>"" : "" +>sub : any + +const testStringSup = "".sup(); +>testStringSup : any +>"".sup() : any +>"".sup : any +>"" : "" +>sup : any + +const testStringConstructorFromCodePoint = String.fromCodePoint(); +>testStringConstructorFromCodePoint : any +>String.fromCodePoint() : any +>String.fromCodePoint : any +>String : StringConstructor +>fromCodePoint : any + +const testStringConstructorRaw = String.raw``; +>testStringConstructorRaw : any +>String.raw`` : any +>String.raw : any +>String : StringConstructor +>raw : any +>`` : "" + +const testRegExpFlags = /abc/g.flags; +>testRegExpFlags : any +>/abc/g.flags : any +>/abc/g : RegExp +>flags : any + +const testRegExpSticky = /abc/g.sticky; +>testRegExpSticky : any +>/abc/g.sticky : any +>/abc/g : RegExp +>sticky : any + +const testRegExpUnicode = /abc/g.unicode; +>testRegExpUnicode : any +>/abc/g.unicode : any +>/abc/g : RegExp +>unicode : any + diff --git a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt new file mode 100644 index 00000000000..f557dfe6d9c --- /dev/null +++ b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt @@ -0,0 +1,146 @@ +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(2,32): error TS2550: Property 'includes' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2016' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(5,31): error TS2550: Property 'padStart' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(6,29): error TS2550: Property 'padEnd' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(7,44): error TS2550: Property 'values' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(8,45): error TS2550: Property 'entries' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(9,63): error TS2550: Property 'getOwnPropertyDescriptors' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(10,64): error TS2550: Property 'formatToParts' does not exist on type 'DateTimeFormat'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(11,21): error TS2583: Cannot find name 'Atomics'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(12,35): error TS2583: Cannot find name 'SharedArrayBuffer'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(15,50): error TS2550: Property 'finally' does not exist on type 'Promise'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(16,113): error TS2550: Property 'groups' does not exist on type 'RegExpMatchArray'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(17,111): error TS2550: Property 'groups' does not exist on type 'RegExpExecArray'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(18,33): error TS2550: Property 'dotAll' does not exist on type 'RegExp'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(19,38): error TS2550: Property 'PluralRules' does not exist on type 'typeof Intl'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(20,27): error TS2583: Cannot find name 'AsyncGenerator'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(21,35): error TS2583: Cannot find name 'AsyncGeneratorFunction'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(22,26): error TS2583: Cannot find name 'AsyncIterable'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(23,34): error TS2583: Cannot find name 'AsyncIterableIterator'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(26,26): error TS2550: Property 'flat' does not exist on type 'undefined[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(27,29): error TS2550: Property 'flatMap' does not exist on type 'undefined[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(28,49): error TS2550: Property 'fromEntries' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(29,32): error TS2550: Property 'trimStart' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(30,30): error TS2550: Property 'trimEnd' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(31,31): error TS2550: Property 'trimLeft' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(32,32): error TS2550: Property 'trimRight' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(33,45): error TS2550: Property 'description' does not exist on type 'symbol'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(36,39): error TS2550: Property 'allSettled' does not exist on type 'PromiseConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(37,31): error TS2550: Property 'matchAll' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(38,47): error TS2550: Property 'matchAll' does not exist on type 'SymbolConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(39,20): error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(42,32): error TS2550: Property 'any' does not exist on type 'PromiseConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'esnext' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(43,33): error TS2550: Property 'replaceAll' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'esnext' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(44,70): error TS2550: Property 'formatToParts' does not exist on type 'NumberFormat'. Do you need to change your target library? Try changing the `lib` compiler option to 'esnext' or later. + + +==== tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts (33 errors) ==== + // es2016 + const testIncludes = ["hello"].includes("world"); + ~~~~~~~~ +!!! error TS2550: Property 'includes' does not exist on type 'string[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2016' or later. + + // es2017 + const testStringPadStart = "".padStart(2); + ~~~~~~~~ +!!! error TS2550: Property 'padStart' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. + const testStringPadEnd = "".padEnd(2); + ~~~~~~ +!!! error TS2550: Property 'padEnd' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. + const testObjectConstructorValues = Object.values({}); + ~~~~~~ +!!! error TS2550: Property 'values' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. + const testObjectConstructorEntries = Object.entries({}); + ~~~~~~~ +!!! error TS2550: Property 'entries' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. + const testObjectConstructorGetOwnPropertyDescriptors = Object.getOwnPropertyDescriptors({}); + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2550: Property 'getOwnPropertyDescriptors' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. + const testIntlFormatToParts = new Intl.DateTimeFormat("en-US").formatToParts(); + ~~~~~~~~~~~~~ +!!! error TS2550: Property 'formatToParts' does not exist on type 'DateTimeFormat'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. + const testAtomics = Atomics.add(new Uint8Array(0), 0, 0); + ~~~~~~~ +!!! error TS2583: Cannot find name 'Atomics'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. + const testSharedArrayBuffer = new SharedArrayBuffer(5); + ~~~~~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'SharedArrayBuffer'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2017' or later. + + // es2018 + const testPromiseFinally = new Promise(() => {}).finally(); + ~~~~~~~ +!!! error TS2550: Property 'finally' does not exist on type 'Promise'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. + const testRegExpMatchArrayGroups = "2019-04-30".match(/(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g).groups; + ~~~~~~ +!!! error TS2550: Property 'groups' does not exist on type 'RegExpMatchArray'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. + const testRegExpExecArrayGroups = /(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g.exec("2019-04-30").groups; + ~~~~~~ +!!! error TS2550: Property 'groups' does not exist on type 'RegExpExecArray'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. + const testRegExpDotAll = /foo/g.dotAll; + ~~~~~~ +!!! error TS2550: Property 'dotAll' does not exist on type 'RegExp'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. + const testIntlPluralRules = new Intl.PluralRules("ar-EG").select(0); + ~~~~~~~~~~~ +!!! error TS2550: Property 'PluralRules' does not exist on type 'typeof Intl'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. + const testAsyncGenerator: AsyncGenerator = null as any; + ~~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'AsyncGenerator'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. + const testAsyncGeneratorFunction: AsyncGeneratorFunction = null as any; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'AsyncGeneratorFunction'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. + const testAsyncIterable: AsyncIterable = null as any; + ~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'AsyncIterable'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. + const testAsyncIterableIterator: AsyncIterableIterator = null as any; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2583: Cannot find name 'AsyncIterableIterator'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2018' or later. + + // es2019 + const testArrayFlat = [].flat(); + ~~~~ +!!! error TS2550: Property 'flat' does not exist on type 'undefined[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. + const testArrayFlatMap = [].flatMap(); + ~~~~~~~ +!!! error TS2550: Property 'flatMap' does not exist on type 'undefined[]'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. + const testObjectConstructorFromEntries = Object.fromEntries({}); + ~~~~~~~~~~~ +!!! error TS2550: Property 'fromEntries' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. + const testStringTrimStart = "".trimStart(); + ~~~~~~~~~ +!!! error TS2550: Property 'trimStart' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. + const testStringTrimEnd = "".trimEnd(); + ~~~~~~~ +!!! error TS2550: Property 'trimEnd' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. + const testStringTrimLeft = "".trimLeft(); + ~~~~~~~~ +!!! error TS2550: Property 'trimLeft' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. + const testStringTrimRight = "".trimRight(); + ~~~~~~~~~ +!!! error TS2550: Property 'trimRight' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. + const testSymbolDescription = Symbol("foo").description; + ~~~~~~~~~~~ +!!! error TS2550: Property 'description' does not exist on type 'symbol'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2019' or later. + + // es2020 + const testPromiseAllSettled = Promise.allSettled([]); + ~~~~~~~~~~ +!!! error TS2550: Property 'allSettled' does not exist on type 'PromiseConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. + const testStringMatchAll = "".matchAll(); + ~~~~~~~~ +!!! error TS2550: Property 'matchAll' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. + const testRegExpMatchAll = /matchAll/g[Symbol.matchAll]("matchAll"); + ~~~~~~~~ +!!! error TS2550: Property 'matchAll' does not exist on type 'SymbolConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. + const testBigInt = BigInt(123); + ~~~~~~ +!!! error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later. + + // esnext + const testPromiseAny = Promise.any([]); + ~~~ +!!! error TS2550: Property 'any' does not exist on type 'PromiseConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'esnext' or later. + const testStringReplaceAll = "".replaceAll(); + ~~~~~~~~~~ +!!! error TS2550: Property 'replaceAll' does not exist on type '""'. Do you need to change your target library? Try changing the `lib` compiler option to 'esnext' or later. + const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); + ~~~~~~~~~~~~~ +!!! error TS2550: Property 'formatToParts' does not exist on type 'NumberFormat'. Do you need to change your target library? Try changing the `lib` compiler option to 'esnext' or later. \ No newline at end of file diff --git a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.js b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.js new file mode 100644 index 00000000000..3acfb2e08f4 --- /dev/null +++ b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.js @@ -0,0 +1,86 @@ +//// [doYouNeedToChangeYourTargetLibraryES2016Plus.ts] +// es2016 +const testIncludes = ["hello"].includes("world"); + +// es2017 +const testStringPadStart = "".padStart(2); +const testStringPadEnd = "".padEnd(2); +const testObjectConstructorValues = Object.values({}); +const testObjectConstructorEntries = Object.entries({}); +const testObjectConstructorGetOwnPropertyDescriptors = Object.getOwnPropertyDescriptors({}); +const testIntlFormatToParts = new Intl.DateTimeFormat("en-US").formatToParts(); +const testAtomics = Atomics.add(new Uint8Array(0), 0, 0); +const testSharedArrayBuffer = new SharedArrayBuffer(5); + +// es2018 +const testPromiseFinally = new Promise(() => {}).finally(); +const testRegExpMatchArrayGroups = "2019-04-30".match(/(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g).groups; +const testRegExpExecArrayGroups = /(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g.exec("2019-04-30").groups; +const testRegExpDotAll = /foo/g.dotAll; +const testIntlPluralRules = new Intl.PluralRules("ar-EG").select(0); +const testAsyncGenerator: AsyncGenerator = null as any; +const testAsyncGeneratorFunction: AsyncGeneratorFunction = null as any; +const testAsyncIterable: AsyncIterable = null as any; +const testAsyncIterableIterator: AsyncIterableIterator = null as any; + +// es2019 +const testArrayFlat = [].flat(); +const testArrayFlatMap = [].flatMap(); +const testObjectConstructorFromEntries = Object.fromEntries({}); +const testStringTrimStart = "".trimStart(); +const testStringTrimEnd = "".trimEnd(); +const testStringTrimLeft = "".trimLeft(); +const testStringTrimRight = "".trimRight(); +const testSymbolDescription = Symbol("foo").description; + +// es2020 +const testPromiseAllSettled = Promise.allSettled([]); +const testStringMatchAll = "".matchAll(); +const testRegExpMatchAll = /matchAll/g[Symbol.matchAll]("matchAll"); +const testBigInt = BigInt(123); + +// esnext +const testPromiseAny = Promise.any([]); +const testStringReplaceAll = "".replaceAll(); +const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); + +//// [doYouNeedToChangeYourTargetLibraryES2016Plus.js] +// es2016 +var testIncludes = ["hello"].includes("world"); +// es2017 +var testStringPadStart = "".padStart(2); +var testStringPadEnd = "".padEnd(2); +var testObjectConstructorValues = Object.values({}); +var testObjectConstructorEntries = Object.entries({}); +var testObjectConstructorGetOwnPropertyDescriptors = Object.getOwnPropertyDescriptors({}); +var testIntlFormatToParts = new Intl.DateTimeFormat("en-US").formatToParts(); +var testAtomics = Atomics.add(new Uint8Array(0), 0, 0); +var testSharedArrayBuffer = new SharedArrayBuffer(5); +// es2018 +var testPromiseFinally = new Promise(function () { })["finally"](); +var testRegExpMatchArrayGroups = "2019-04-30".match(/(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g).groups; +var testRegExpExecArrayGroups = /(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g.exec("2019-04-30").groups; +var testRegExpDotAll = /foo/g.dotAll; +var testIntlPluralRules = new Intl.PluralRules("ar-EG").select(0); +var testAsyncGenerator = null; +var testAsyncGeneratorFunction = null; +var testAsyncIterable = null; +var testAsyncIterableIterator = null; +// es2019 +var testArrayFlat = [].flat(); +var testArrayFlatMap = [].flatMap(); +var testObjectConstructorFromEntries = Object.fromEntries({}); +var testStringTrimStart = "".trimStart(); +var testStringTrimEnd = "".trimEnd(); +var testStringTrimLeft = "".trimLeft(); +var testStringTrimRight = "".trimRight(); +var testSymbolDescription = Symbol("foo").description; +// es2020 +var testPromiseAllSettled = Promise.allSettled([]); +var testStringMatchAll = "".matchAll(); +var testRegExpMatchAll = /matchAll/g[Symbol.matchAll]("matchAll"); +var testBigInt = BigInt(123); +// esnext +var testPromiseAny = Promise.any([]); +var testStringReplaceAll = "".replaceAll(); +var testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); diff --git a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.symbols b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.symbols new file mode 100644 index 00000000000..228d943e224 --- /dev/null +++ b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.symbols @@ -0,0 +1,127 @@ +=== tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts === +// es2016 +const testIncludes = ["hello"].includes("world"); +>testIncludes : Symbol(testIncludes, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 1, 5)) + +// es2017 +const testStringPadStart = "".padStart(2); +>testStringPadStart : Symbol(testStringPadStart, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 4, 5)) + +const testStringPadEnd = "".padEnd(2); +>testStringPadEnd : Symbol(testStringPadEnd, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 5, 5)) + +const testObjectConstructorValues = Object.values({}); +>testObjectConstructorValues : Symbol(testObjectConstructorValues, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 6, 5)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testObjectConstructorEntries = Object.entries({}); +>testObjectConstructorEntries : Symbol(testObjectConstructorEntries, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 7, 5)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testObjectConstructorGetOwnPropertyDescriptors = Object.getOwnPropertyDescriptors({}); +>testObjectConstructorGetOwnPropertyDescriptors : Symbol(testObjectConstructorGetOwnPropertyDescriptors, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 8, 5)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testIntlFormatToParts = new Intl.DateTimeFormat("en-US").formatToParts(); +>testIntlFormatToParts : Symbol(testIntlFormatToParts, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 9, 5)) +>Intl.DateTimeFormat : Symbol(Intl.DateTimeFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --)) +>DateTimeFormat : Symbol(Intl.DateTimeFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testAtomics = Atomics.add(new Uint8Array(0), 0, 0); +>testAtomics : Symbol(testAtomics, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 10, 5)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const testSharedArrayBuffer = new SharedArrayBuffer(5); +>testSharedArrayBuffer : Symbol(testSharedArrayBuffer, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 11, 5)) + +// es2018 +const testPromiseFinally = new Promise(() => {}).finally(); +>testPromiseFinally : Symbol(testPromiseFinally, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 14, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const testRegExpMatchArrayGroups = "2019-04-30".match(/(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g).groups; +>testRegExpMatchArrayGroups : Symbol(testRegExpMatchArrayGroups, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 15, 5)) +>"2019-04-30".match : Symbol(String.match, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>match : Symbol(String.match, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const testRegExpExecArrayGroups = /(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g.exec("2019-04-30").groups; +>testRegExpExecArrayGroups : Symbol(testRegExpExecArrayGroups, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 16, 5)) +>/(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g.exec : Symbol(RegExp.exec, Decl(lib.es5.d.ts, --, --)) +>exec : Symbol(RegExp.exec, Decl(lib.es5.d.ts, --, --)) + +const testRegExpDotAll = /foo/g.dotAll; +>testRegExpDotAll : Symbol(testRegExpDotAll, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 17, 5)) + +const testIntlPluralRules = new Intl.PluralRules("ar-EG").select(0); +>testIntlPluralRules : Symbol(testIntlPluralRules, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 18, 5)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --)) + +const testAsyncGenerator: AsyncGenerator = null as any; +>testAsyncGenerator : Symbol(testAsyncGenerator, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 19, 5)) + +const testAsyncGeneratorFunction: AsyncGeneratorFunction = null as any; +>testAsyncGeneratorFunction : Symbol(testAsyncGeneratorFunction, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 20, 5)) + +const testAsyncIterable: AsyncIterable = null as any; +>testAsyncIterable : Symbol(testAsyncIterable, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 21, 5)) + +const testAsyncIterableIterator: AsyncIterableIterator = null as any; +>testAsyncIterableIterator : Symbol(testAsyncIterableIterator, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 22, 5)) + +// es2019 +const testArrayFlat = [].flat(); +>testArrayFlat : Symbol(testArrayFlat, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 25, 5)) + +const testArrayFlatMap = [].flatMap(); +>testArrayFlatMap : Symbol(testArrayFlatMap, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 26, 5)) + +const testObjectConstructorFromEntries = Object.fromEntries({}); +>testObjectConstructorFromEntries : Symbol(testObjectConstructorFromEntries, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 27, 5)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +const testStringTrimStart = "".trimStart(); +>testStringTrimStart : Symbol(testStringTrimStart, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 28, 5)) + +const testStringTrimEnd = "".trimEnd(); +>testStringTrimEnd : Symbol(testStringTrimEnd, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 29, 5)) + +const testStringTrimLeft = "".trimLeft(); +>testStringTrimLeft : Symbol(testStringTrimLeft, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 30, 5)) + +const testStringTrimRight = "".trimRight(); +>testStringTrimRight : Symbol(testStringTrimRight, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 31, 5)) + +const testSymbolDescription = Symbol("foo").description; +>testSymbolDescription : Symbol(testSymbolDescription, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 32, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +// es2020 +const testPromiseAllSettled = Promise.allSettled([]); +>testPromiseAllSettled : Symbol(testPromiseAllSettled, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 35, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const testStringMatchAll = "".matchAll(); +>testStringMatchAll : Symbol(testStringMatchAll, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 36, 5)) + +const testRegExpMatchAll = /matchAll/g[Symbol.matchAll]("matchAll"); +>testRegExpMatchAll : Symbol(testRegExpMatchAll, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 37, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const testBigInt = BigInt(123); +>testBigInt : Symbol(testBigInt, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 38, 5)) + +// esnext +const testPromiseAny = Promise.any([]); +>testPromiseAny : Symbol(testPromiseAny, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 41, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const testStringReplaceAll = "".replaceAll(); +>testStringReplaceAll : Symbol(testStringReplaceAll, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 42, 5)) + +const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); +>testNumberFormatFormatToParts : Symbol(testNumberFormatFormatToParts, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 43, 5)) +>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --)) +>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + diff --git a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.types b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.types new file mode 100644 index 00000000000..fb0578caf23 --- /dev/null +++ b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.types @@ -0,0 +1,267 @@ +=== tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts === +// es2016 +const testIncludes = ["hello"].includes("world"); +>testIncludes : any +>["hello"].includes("world") : any +>["hello"].includes : any +>["hello"] : string[] +>"hello" : "hello" +>includes : any +>"world" : "world" + +// es2017 +const testStringPadStart = "".padStart(2); +>testStringPadStart : any +>"".padStart(2) : any +>"".padStart : any +>"" : "" +>padStart : any +>2 : 2 + +const testStringPadEnd = "".padEnd(2); +>testStringPadEnd : any +>"".padEnd(2) : any +>"".padEnd : any +>"" : "" +>padEnd : any +>2 : 2 + +const testObjectConstructorValues = Object.values({}); +>testObjectConstructorValues : any +>Object.values({}) : any +>Object.values : any +>Object : ObjectConstructor +>values : any +>{} : {} + +const testObjectConstructorEntries = Object.entries({}); +>testObjectConstructorEntries : any +>Object.entries({}) : any +>Object.entries : any +>Object : ObjectConstructor +>entries : any +>{} : {} + +const testObjectConstructorGetOwnPropertyDescriptors = Object.getOwnPropertyDescriptors({}); +>testObjectConstructorGetOwnPropertyDescriptors : any +>Object.getOwnPropertyDescriptors({}) : any +>Object.getOwnPropertyDescriptors : any +>Object : ObjectConstructor +>getOwnPropertyDescriptors : any +>{} : {} + +const testIntlFormatToParts = new Intl.DateTimeFormat("en-US").formatToParts(); +>testIntlFormatToParts : any +>new Intl.DateTimeFormat("en-US").formatToParts() : any +>new Intl.DateTimeFormat("en-US").formatToParts : any +>new Intl.DateTimeFormat("en-US") : Intl.DateTimeFormat +>Intl.DateTimeFormat : { (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; new (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; supportedLocalesOf(locales: string | string[], options?: Intl.DateTimeFormatOptions): string[]; } +>Intl : typeof Intl +>DateTimeFormat : { (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; new (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; supportedLocalesOf(locales: string | string[], options?: Intl.DateTimeFormatOptions): string[]; } +>"en-US" : "en-US" +>formatToParts : any + +const testAtomics = Atomics.add(new Uint8Array(0), 0, 0); +>testAtomics : any +>Atomics.add(new Uint8Array(0), 0, 0) : any +>Atomics.add : any +>Atomics : any +>add : any +>new Uint8Array(0) : Uint8Array +>Uint8Array : Uint8ArrayConstructor +>0 : 0 +>0 : 0 +>0 : 0 + +const testSharedArrayBuffer = new SharedArrayBuffer(5); +>testSharedArrayBuffer : any +>new SharedArrayBuffer(5) : any +>SharedArrayBuffer : any +>5 : 5 + +// es2018 +const testPromiseFinally = new Promise(() => {}).finally(); +>testPromiseFinally : any +>new Promise(() => {}).finally() : any +>new Promise(() => {}).finally : any +>new Promise(() => {}) : Promise +>Promise : PromiseConstructor +>() => {} : () => void +>finally : any + +const testRegExpMatchArrayGroups = "2019-04-30".match(/(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g).groups; +>testRegExpMatchArrayGroups : any +>"2019-04-30".match(/(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g).groups : any +>"2019-04-30".match(/(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g) : RegExpMatchArray +>"2019-04-30".match : { (regexp: string | RegExp): RegExpMatchArray; (matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; } +>"2019-04-30" : "2019-04-30" +>match : { (regexp: string | RegExp): RegExpMatchArray; (matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; } +>/(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g : RegExp +>groups : any + +const testRegExpExecArrayGroups = /(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g.exec("2019-04-30").groups; +>testRegExpExecArrayGroups : any +>/(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g.exec("2019-04-30").groups : any +>/(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g.exec("2019-04-30") : RegExpExecArray +>/(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g.exec : (string: string) => RegExpExecArray +>/(?[0-9]{4})-(?[0-9]{2})-(?[0-9]{2})/g : RegExp +>exec : (string: string) => RegExpExecArray +>"2019-04-30" : "2019-04-30" +>groups : any + +const testRegExpDotAll = /foo/g.dotAll; +>testRegExpDotAll : any +>/foo/g.dotAll : any +>/foo/g : RegExp +>dotAll : any + +const testIntlPluralRules = new Intl.PluralRules("ar-EG").select(0); +>testIntlPluralRules : any +>new Intl.PluralRules("ar-EG").select(0) : any +>new Intl.PluralRules("ar-EG").select : any +>new Intl.PluralRules("ar-EG") : any +>Intl.PluralRules : any +>Intl : typeof Intl +>PluralRules : any +>"ar-EG" : "ar-EG" +>select : any +>0 : 0 + +const testAsyncGenerator: AsyncGenerator = null as any; +>testAsyncGenerator : any +>null as any : any +>null : null + +const testAsyncGeneratorFunction: AsyncGeneratorFunction = null as any; +>testAsyncGeneratorFunction : any +>null as any : any +>null : null + +const testAsyncIterable: AsyncIterable = null as any; +>testAsyncIterable : any +>null as any : any +>null : null + +const testAsyncIterableIterator: AsyncIterableIterator = null as any; +>testAsyncIterableIterator : any +>null as any : any +>null : null + +// es2019 +const testArrayFlat = [].flat(); +>testArrayFlat : any +>[].flat() : any +>[].flat : any +>[] : undefined[] +>flat : any + +const testArrayFlatMap = [].flatMap(); +>testArrayFlatMap : any +>[].flatMap() : any +>[].flatMap : any +>[] : undefined[] +>flatMap : any + +const testObjectConstructorFromEntries = Object.fromEntries({}); +>testObjectConstructorFromEntries : any +>Object.fromEntries({}) : any +>Object.fromEntries : any +>Object : ObjectConstructor +>fromEntries : any +>{} : {} + +const testStringTrimStart = "".trimStart(); +>testStringTrimStart : any +>"".trimStart() : any +>"".trimStart : any +>"" : "" +>trimStart : any + +const testStringTrimEnd = "".trimEnd(); +>testStringTrimEnd : any +>"".trimEnd() : any +>"".trimEnd : any +>"" : "" +>trimEnd : any + +const testStringTrimLeft = "".trimLeft(); +>testStringTrimLeft : any +>"".trimLeft() : any +>"".trimLeft : any +>"" : "" +>trimLeft : any + +const testStringTrimRight = "".trimRight(); +>testStringTrimRight : any +>"".trimRight() : any +>"".trimRight : any +>"" : "" +>trimRight : any + +const testSymbolDescription = Symbol("foo").description; +>testSymbolDescription : any +>Symbol("foo").description : any +>Symbol("foo") : symbol +>Symbol : SymbolConstructor +>"foo" : "foo" +>description : any + +// es2020 +const testPromiseAllSettled = Promise.allSettled([]); +>testPromiseAllSettled : any +>Promise.allSettled([]) : any +>Promise.allSettled : any +>Promise : PromiseConstructor +>allSettled : any +>[] : undefined[] + +const testStringMatchAll = "".matchAll(); +>testStringMatchAll : any +>"".matchAll() : any +>"".matchAll : any +>"" : "" +>matchAll : any + +const testRegExpMatchAll = /matchAll/g[Symbol.matchAll]("matchAll"); +>testRegExpMatchAll : any +>/matchAll/g[Symbol.matchAll]("matchAll") : any +>/matchAll/g[Symbol.matchAll] : any +>/matchAll/g : RegExp +>Symbol.matchAll : any +>Symbol : SymbolConstructor +>matchAll : any +>"matchAll" : "matchAll" + +const testBigInt = BigInt(123); +>testBigInt : any +>BigInt(123) : any +>BigInt : any +>123 : 123 + +// esnext +const testPromiseAny = Promise.any([]); +>testPromiseAny : any +>Promise.any([]) : any +>Promise.any : any +>Promise : PromiseConstructor +>any : any +>[] : undefined[] + +const testStringReplaceAll = "".replaceAll(); +>testStringReplaceAll : any +>"".replaceAll() : any +>"".replaceAll : any +>"" : "" +>replaceAll : any + +const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); +>testNumberFormatFormatToParts : any +>new Intl.NumberFormat("en-US").formatToParts() : any +>new Intl.NumberFormat("en-US").formatToParts : any +>new Intl.NumberFormat("en-US") : Intl.NumberFormat +>Intl.NumberFormat : { (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; new (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions): string[]; } +>Intl : typeof Intl +>NumberFormat : { (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; new (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions): string[]; } +>"en-US" : "en-US" +>formatToParts : any + diff --git a/tests/baselines/reference/docker/azure-sdk.log b/tests/baselines/reference/docker/azure-sdk.log index 545849521bc..5c216875e44 100644 --- a/tests/baselines/reference/docker/azure-sdk.log +++ b/tests/baselines/reference/docker/azure-sdk.log @@ -2,49 +2,52 @@ Exit Code: 1 Standard output: Rush Multi-Project Build Tool 5.X.X - https://rushjs.io -Node.js version is 14.8.0 (pre-LTS) +Node.js version is 14.14.0 (pre-LTS) Starting "rush rebuild" Executing a maximum of ?simultaneous processes... -XX of XX: [@azure/abort-controller] completed successfully in ? seconds -XX of XX: [@azure/logger] completed successfully in ? seconds -XX of XX: [@azure/core-asynciterator-polyfill] completed successfully in ? seconds -XX of XX: [@azure/core-paging] completed successfully in ? seconds -SUCCESS (4) -================================ -@azure/abort-controller (? seconds) -@azure/logger (? seconds) -@azure/core-asynciterator-polyfill (? seconds) -@azure/core-paging (? seconds) -================================ -BLOCKED (38) +BLOCKED (51) ================================ +@azure/abort-controller @azure/core-auth +@azure/logger +@azure/core-asynciterator-polyfill @azure/core-http -@azure/core-lro -@azure/dev-tool -@azure/identity -@azure/test-utils-recorder +@azure/communication-common @azure/core-amqp +@azure/core-lro +@azure/core-paging +@azure/dev-tool +@azure/test-utils-recorder +@azure/communication-administration @azure/core-https @azure/core-xml +@azure/event-hubs @azure/event-processor-host @azure/keyvault-secrets +@azure/schema-registry @azure/storage-blob +@azure/ai-anomaly-detector @azure/ai-form-recognizer +@azure/ai-metrics-advisor @azure/ai-text-analytics @azure/app-configuration +@azure/communication-chat +@azure/communication-sms @azure/core-arm @azure/core-client @azure/core-tracing @azure/cosmos -@azure/event-hubs +@azure/data-tables +@azure/digital-twins +@azure/eventgrid @azure/eventhubs-checkpointstore-blob +@azure/identity @azure/keyvault-admin @azure/keyvault-certificates @azure/keyvault-common @azure/keyvault-keys @azure/monitor-opentelemetry-exporter -@azure/schema-registry +@azure/schema-registry-avro @azure/search-documents @azure/service-bus @azure/storage-blob-changefeed @@ -52,7 +55,6 @@ BLOCKED (38) @azure/storage-file-share @azure/storage-internal-avro @azure/storage-queue -@azure/tables @azure/template @azure/test-utils-perfstress testhub @@ -84,42 +86,55 @@ rush rebuild - Errors! (? seconds) Standard error: XX of XX: [@azure/eslint-plugin-azure-sdk] failed! -XX of XX: [@azure/ai-form-recognizer] blocked by [@azure/eslint-plugin-azure-sdk]! -XX of XX: [@azure/ai-text-analytics] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/abort-controller] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/communication-chat] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/communication-common] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/communication-administration] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/communication-sms] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/core-amqp] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/event-hubs] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/eventhubs-checkpointstore-blob] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/service-bus] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/core-auth] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/ai-anomaly-detector] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/ai-form-recognizer] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/ai-metrics-advisor] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/ai-text-analytics] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/core-client] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/core-http] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/app-configuration] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/core-arm] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/core-lro] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/keyvault-admin] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/keyvault-certificates] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/keyvault-keys] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/keyvault-secrets] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/storage-blob] blocked by [@azure/eslint-plugin-azure-sdk]! -XX of XX: [@azure/eventhubs-checkpointstore-blob] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/storage-blob-changefeed] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/storage-file-datalake] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/data-tables] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/digital-twins] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/eventgrid] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/identity] blocked by [@azure/eslint-plugin-azure-sdk]! -XX of XX: [@azure/storage-internal-avro] blocked by [@azure/eslint-plugin-azure-sdk]! -XX of XX: [@azure/storage-queue] blocked by [@azure/eslint-plugin-azure-sdk]! -XX of XX: [@azure/keyvault-admin] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/keyvault-common] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/monitor-opentelemetry-exporter] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/schema-registry] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/schema-registry-avro] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/search-documents] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/storage-file-share] blocked by [@azure/eslint-plugin-azure-sdk]! -XX of XX: [@azure/tables] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/storage-queue] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/template] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/test-utils-perfstress] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/test-utils-recorder] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/storage-internal-avro] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/core-https] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/core-asynciterator-polyfill] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/core-paging] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/core-tracing] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/core-xml] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/cosmos] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/dev-tool] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [@azure/event-processor-host] blocked by [@azure/eslint-plugin-azure-sdk]! XX of XX: [testhub] blocked by [@azure/eslint-plugin-azure-sdk]! +XX of XX: [@azure/logger] blocked by [@azure/eslint-plugin-azure-sdk]! [@azure/eslint-plugin-azure-sdk] Returned error code: 2 diff --git a/tests/baselines/reference/docker/office-ui-fabric.log b/tests/baselines/reference/docker/office-ui-fabric.log index c9edaacb33d..eb03c4af1d5 100644 --- a/tests/baselines/reference/docker/office-ui-fabric.log +++ b/tests/baselines/reference/docker/office-ui-fabric.log @@ -1,57 +1,2156 @@ Exit Code: 1 Standard output: +@fluentui/eslint-plugin: yarn run vX.X.X +@fluentui/eslint-plugin: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/eslint-plugin: Done in ?s. +@fluentui/noop: yarn run vX.X.X +@fluentui/noop: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/noop: Done in ?s. +@fluentui/ie11-polyfills: yarn run vX.X.X +@fluentui/ie11-polyfills: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/ie11-polyfills: Done in ?s. @fluentui/web-components: yarn run vX.X.X -@fluentui/web-components: $ tsc -p ./tsconfig.json && rollup -c && npm run doc -@fluentui/web-components: ┌─────────────────────────────────────────┐ -@fluentui/web-components: │ │ -@fluentui/web-components: │ Destination: dist/web-components.js │ -@fluentui/web-components: │ Bundle Size: 504.97 KB │ -@fluentui/web-components: │ Gzipped Size: 52.01 KB │ -@fluentui/web-components: │ Brotli size: 77.25 KB │ -@fluentui/web-components: │ │ -@fluentui/web-components: └─────────────────────────────────────────┘ -@fluentui/web-components: ┌─────────────────────────────────────────────┐ -@fluentui/web-components: │ │ -@fluentui/web-components: │ Destination: dist/web-components.min.js │ -@fluentui/web-components: │ Bundle Size: 205.52 KB │ -@fluentui/web-components: │ Gzipped Size: 47.86 KB │ -@fluentui/web-components: │ Brotli size: 40.53 KB │ -@fluentui/web-components: │ │ -@fluentui/web-components: └─────────────────────────────────────────────┘ -@fluentui/web-components: > @fluentui/web-components@X.X.X doc /office-ui-fabric-react/packages/web-components -@fluentui/web-components: > api-extractor run --local -@fluentui/web-components: api-extractor 7.7.1 - https://api-extractor.com/ -@fluentui/web-components: Using configuration from /office-ui-fabric-react/packages/web-components/api-extractor.json -@fluentui/web-components: API Extractor completed successfully +@fluentui/web-components: $ /office-ui-fabric-react/node_modules/.bin/just ts @fluentui/web-components: Done in ?s. @fluentui/ability-attributes: yarn run vX.X.X -@fluentui/ability-attributes: $ npm run schema && gulp bundle:package:no-umd -@fluentui/ability-attributes: > @fluentui/ability-attributes@X.X.X schema /office-ui-fabric-react/packages/fluentui/ability-attributes -@fluentui/ability-attributes: > allyschema -c "process.env.NODE_ENV !== 'production'" schema.json > ./src/schema.ts -@fluentui/ability-attributes: [XX:XX:XX] Requiring external module @uifabric/build/babel/register -@fluentui/ability-attributes: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/ability-attributes: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/ability-attributes: Done in ?s. +@fluentui/digest: yarn run vX.X.X +@fluentui/digest: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/digest: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/fluentui/digest/tsconfig.json +@fluentui/digest: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --module esnext --outDir lib --project "/office-ui-fabric-react/packages/fluentui/digest/tsconfig.json" +@fluentui/digest: Done in ?s. +@uifabric/build: yarn run vX.X.X +@uifabric/build: $ /office-ui-fabric-react/node_modules/.bin/just ts +@uifabric/build: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/scripts/tsconfig.json +@uifabric/build: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/scripts/tsconfig.json" +@uifabric/build: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/scripts/tsconfig.json +@uifabric/build: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/scripts/tsconfig.json" +@uifabric/build: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@uifabric/pr-deploy-site: yarn run vX.X.X +@uifabric/pr-deploy-site: $ just-scripts ts +@uifabric/pr-deploy-site: Done in ?s. +@fluentui/a11y-testing: yarn run vX.X.X +@fluentui/a11y-testing: $ just-scripts ts +@fluentui/a11y-testing: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/a11y-testing/tsconfig.json +@fluentui/a11y-testing: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/a11y-testing/tsconfig.json" +@fluentui/a11y-testing: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/a11y-testing/tsconfig.json +@fluentui/a11y-testing: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/a11y-testing/tsconfig.json" +@fluentui/a11y-testing: Done in ?s. +@fluentui/codemods: yarn run vX.X.X +@fluentui/codemods: $ just-scripts ts +@fluentui/codemods: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/codemods/tsconfig.json +@fluentui/codemods: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/codemods/tsconfig.json" +@fluentui/codemods: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/codemods/tsconfig.json +@fluentui/codemods: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/codemods/tsconfig.json" +@fluentui/codemods: Done in ?s. +@fluentui/example-data: yarn run vX.X.X +@fluentui/example-data: $ just-scripts ts +@fluentui/example-data: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/example-data/tsconfig.json +@fluentui/example-data: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/example-data/tsconfig.json" +@fluentui/example-data: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/example-data/tsconfig.json +@fluentui/example-data: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/example-data/tsconfig.json" +@fluentui/example-data: Done in ?s. +@fluentui/keyboard-key: yarn run vX.X.X +@fluentui/keyboard-key: $ just-scripts ts +@fluentui/keyboard-key: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/keyboard-key/tsconfig.json +@fluentui/keyboard-key: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/keyboard-key/tsconfig.json" +@fluentui/keyboard-key: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/keyboard-key/tsconfig.json +@fluentui/keyboard-key: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/keyboard-key/tsconfig.json" +@fluentui/keyboard-key: Done in ?s. +@fluentui/monaco-editor: yarn run vX.X.X +@fluentui/monaco-editor: $ just-scripts ts +@fluentui/monaco-editor: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/monaco-editor/tsconfig.json +@fluentui/monaco-editor: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/monaco-editor/tsconfig.json" +@fluentui/monaco-editor: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/monaco-editor/tsconfig.json +@fluentui/monaco-editor: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/monaco-editor/tsconfig.json" +@fluentui/monaco-editor: Done in ?s. +@fluentui/react-conformance: yarn run vX.X.X +@fluentui/react-conformance: $ just-scripts ts +@fluentui/react-conformance: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-conformance/tsconfig.json +@fluentui/react-conformance: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-conformance/tsconfig.json" +@fluentui/react-conformance: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-conformance/tsconfig.json +@fluentui/react-conformance: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-conformance/tsconfig.json" +@fluentui/react-conformance: Done in ?s. +@fluentui/set-version: yarn run vX.X.X +@fluentui/set-version: $ just-scripts ts +@fluentui/set-version: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/set-version/tsconfig.json +@fluentui/set-version: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/set-version/tsconfig.json" +@fluentui/set-version: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/set-version/tsconfig.json +@fluentui/set-version: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/set-version/tsconfig.json" +@fluentui/set-version: Done in ?s. +@uifabric/webpack-utils: yarn run vX.X.X +@uifabric/webpack-utils: $ just-scripts ts +@uifabric/webpack-utils: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/webpack-utils/tsconfig.json +@uifabric/webpack-utils: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/webpack-utils/tsconfig.json" +@uifabric/webpack-utils: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/webpack-utils/tsconfig.json +@uifabric/webpack-utils: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/webpack-utils/tsconfig.json" +@uifabric/webpack-utils: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/docs-components: yarn run vX.X.X +@fluentui/docs-components: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/docs-components: Done in ?s. +@fluentui/react-component-event-listener: yarn run vX.X.X +@fluentui/react-component-event-listener: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/react-component-event-listener: Done in ?s. +@fluentui/react-component-nesting-registry: yarn run vX.X.X +@fluentui/react-component-nesting-registry: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/react-component-nesting-registry: Done in ?s. +@fluentui/react-component-ref: yarn run vX.X.X +@fluentui/react-component-ref: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/react-component-ref: Done in ?s. +@fluentui/react-context-selector: yarn run vX.X.X +@fluentui/react-context-selector: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/react-context-selector: Done in ?s. +@fluentui/react-proptypes: yarn run vX.X.X +@fluentui/react-proptypes: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/react-proptypes: Done in ?s. +@fluentui/state: yarn run vX.X.X +@fluentui/state: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/state: Done in ?s. +@fluentui/styles: yarn run vX.X.X +@fluentui/styles: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/styles: Done in ?s. +@fluentui/accessibility: yarn run vX.X.X +@fluentui/accessibility: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/accessibility: Done in ?s. +@fluentui/date-time-utilities: yarn run vX.X.X +@fluentui/date-time-utilities: $ just-scripts ts +@fluentui/date-time-utilities: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/date-time-utilities/tsconfig.json +@fluentui/date-time-utilities: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/date-time-utilities/tsconfig.json" +@fluentui/date-time-utilities: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/date-time-utilities/tsconfig.json +@fluentui/date-time-utilities: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/date-time-utilities/tsconfig.json" +@fluentui/date-time-utilities: Done in ?s. +@fluentui/dom-utilities: yarn run vX.X.X +@fluentui/dom-utilities: $ just-scripts ts +@fluentui/dom-utilities: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/dom-utilities/tsconfig.json +@fluentui/dom-utilities: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/dom-utilities/tsconfig.json" +@fluentui/dom-utilities: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/dom-utilities/tsconfig.json +@fluentui/dom-utilities: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/dom-utilities/tsconfig.json" +@fluentui/dom-utilities: Done in ?s. +@fluentui/merge-styles: yarn run vX.X.X +@fluentui/merge-styles: $ just-scripts ts +@fluentui/merge-styles: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/merge-styles/tsconfig.json +@fluentui/merge-styles: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/merge-styles/tsconfig.json" +@fluentui/merge-styles: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/merge-styles/tsconfig.json +@fluentui/merge-styles: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/merge-styles/tsconfig.json" +@fluentui/merge-styles: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/react-northstar-styles-renderer: yarn run vX.X.X +@fluentui/react-northstar-styles-renderer: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/react-northstar-styles-renderer: Done in ?s. +@uifabric/jest-serializer-merge-styles: yarn run vX.X.X +@uifabric/jest-serializer-merge-styles: $ just-scripts ts +@uifabric/jest-serializer-merge-styles: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/jest-serializer-merge-styles/tsconfig.json +@uifabric/jest-serializer-merge-styles: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/jest-serializer-merge-styles/tsconfig.json" +@uifabric/jest-serializer-merge-styles: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/jest-serializer-merge-styles/tsconfig.json +@uifabric/jest-serializer-merge-styles: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/jest-serializer-merge-styles/tsconfig.json" +@uifabric/jest-serializer-merge-styles: Done in ?s. +@fluentui/react-northstar-emotion-renderer: yarn run vX.X.X +@fluentui/react-northstar-emotion-renderer: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/react-northstar-emotion-renderer: Done in ?s. +@fluentui/react-northstar-fela-renderer: yarn run vX.X.X +@fluentui/react-northstar-fela-renderer: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/react-northstar-fela-renderer: Done in ?s. +@fluentui/react-stylesheets: yarn run vX.X.X +@fluentui/react-stylesheets: $ just-scripts ts +@fluentui/react-stylesheets: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-stylesheets/tsconfig.json +@fluentui/react-stylesheets: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-stylesheets/tsconfig.json" +@fluentui/react-stylesheets: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-stylesheets/tsconfig.json +@fluentui/react-stylesheets: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-stylesheets/tsconfig.json" +@fluentui/react-stylesheets: Done in ?s. +@fluentui/react-utilities: yarn run vX.X.X +@fluentui/react-utilities: $ just-scripts ts +@fluentui/react-utilities: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-utilities/tsconfig.json +@fluentui/react-utilities: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-utilities/tsconfig.json" +@fluentui/react-utilities: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-utilities/tsconfig.json +@fluentui/react-utilities: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-utilities/tsconfig.json" +@fluentui/react-utilities: Done in ?s. +@uifabric/test-utilities: yarn run vX.X.X +@uifabric/test-utilities: $ just-scripts ts +@uifabric/test-utilities: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/test-utilities/tsconfig.json +@uifabric/test-utilities: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/test-utilities/tsconfig.json" +@uifabric/test-utilities: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/test-utilities/tsconfig.json +@uifabric/test-utilities: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/test-utilities/tsconfig.json" +@uifabric/test-utilities: Done in ?s. +@fluentui/react-window-provider: yarn run vX.X.X +@fluentui/react-window-provider: $ just-scripts ts +@fluentui/react-window-provider: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-window-provider/tsconfig.json +@fluentui/react-window-provider: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-window-provider/tsconfig.json" +@fluentui/react-window-provider: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-window-provider/tsconfig.json +@fluentui/react-window-provider: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-window-provider/tsconfig.json" +@fluentui/react-window-provider: Done in ?s. +@uifabric/utilities: yarn run vX.X.X +@uifabric/utilities: $ just-scripts ts +@uifabric/utilities: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/utilities/tsconfig.json +@uifabric/utilities: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/utilities/tsconfig.json" +@uifabric/utilities: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/utilities/tsconfig.json +@uifabric/utilities: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/utilities/tsconfig.json" +@uifabric/utilities: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/react-compose: yarn run vX.X.X +@fluentui/react-compose: $ just-scripts ts +@fluentui/react-compose: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-compose/tsconfig.json +@fluentui/react-compose: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-compose/tsconfig.json" +@fluentui/react-compose: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-compose/tsconfig.json +@fluentui/react-compose: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-compose/tsconfig.json" +@fluentui/react-compose: Done in ?s. +@fluentui/react-focus: yarn run vX.X.X +@fluentui/react-focus: $ just-scripts ts +@fluentui/react-focus: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-focus/tsconfig.json +@fluentui/react-focus: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-focus/tsconfig.json" +@fluentui/react-focus: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-focus/tsconfig.json +@fluentui/react-focus: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-focus/tsconfig.json" +@fluentui/react-focus: Done in ?s. +@uifabric/react-hooks: yarn run vX.X.X +@uifabric/react-hooks: $ just-scripts ts +@uifabric/react-hooks: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-hooks/tsconfig.json +@uifabric/react-hooks: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-hooks/tsconfig.json" +@uifabric/react-hooks: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-hooks/tsconfig.json +@uifabric/react-hooks: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-hooks/tsconfig.json" +@uifabric/react-hooks: Done in ?s. +@fluentui/react-icons-mdl2: yarn run vX.X.X +@fluentui/react-icons-mdl2: $ just-scripts ts +@fluentui/react-icons-mdl2: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-icons-mdl2/tsconfig.json +@fluentui/react-icons-mdl2: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-icons-mdl2/tsconfig.json" +@fluentui/react-icons-mdl2: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-icons-mdl2/tsconfig.json +@fluentui/react-icons-mdl2: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-icons-mdl2/tsconfig.json" +@fluentui/react-icons-mdl2: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/theme: yarn run vX.X.X +@fluentui/theme: $ just-scripts ts +@fluentui/theme: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/theme/tsconfig.json +@fluentui/theme: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/theme/tsconfig.json" +@fluentui/theme: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/theme/tsconfig.json +@fluentui/theme: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/theme/tsconfig.json" +@fluentui/theme: Done in ?s. +@fluentui/react-bindings: yarn run vX.X.X +@fluentui/react-bindings: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/react-bindings: Done in ?s. +@fluentui/scheme-utilities: yarn run vX.X.X +@fluentui/scheme-utilities: $ just-scripts ts +@fluentui/scheme-utilities: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/scheme-utilities/tsconfig.json +@fluentui/scheme-utilities: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/scheme-utilities/tsconfig.json" +@fluentui/scheme-utilities: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/scheme-utilities/tsconfig.json +@fluentui/scheme-utilities: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/scheme-utilities/tsconfig.json" +@fluentui/scheme-utilities: Done in ?s. +@fluentui/style-utilities: yarn run vX.X.X +@fluentui/style-utilities: $ just-scripts ts +@fluentui/style-utilities: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/style-utilities/tsconfig.json +@fluentui/style-utilities: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/style-utilities/tsconfig.json" +@fluentui/style-utilities: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/style-utilities/tsconfig.json +@fluentui/style-utilities: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/style-utilities/tsconfig.json" +@fluentui/style-utilities: Done in ?s. +@fluentui/react-icons-northstar: yarn run vX.X.X +@fluentui/react-icons-northstar: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/react-icons-northstar: Done in ?s. +@fluentui/react-telemetry: yarn run vX.X.X +@fluentui/react-telemetry: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/react-telemetry: Done in ?s. +@fluentui/common-styles: yarn run vX.X.X +@fluentui/common-styles: $ just-scripts ts +@fluentui/common-styles: Done in ?s. +@fluentui/file-type-icons: yarn run vX.X.X +@fluentui/file-type-icons: $ just-scripts ts +@fluentui/file-type-icons: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/file-type-icons/tsconfig.json +@fluentui/file-type-icons: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/file-type-icons/tsconfig.json" +@fluentui/file-type-icons: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/file-type-icons/tsconfig.json +@fluentui/file-type-icons: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/file-type-icons/tsconfig.json" +@fluentui/file-type-icons: Done in ?s. +@fluentui/font-icons-mdl2: yarn run vX.X.X +@fluentui/font-icons-mdl2: $ just-scripts ts +@fluentui/font-icons-mdl2: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/font-icons-mdl2/tsconfig.json +@fluentui/font-icons-mdl2: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/font-icons-mdl2/tsconfig.json" +@fluentui/font-icons-mdl2: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/font-icons-mdl2/tsconfig.json +@fluentui/font-icons-mdl2: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/font-icons-mdl2/tsconfig.json" +@fluentui/font-icons-mdl2: Done in ?s. +@fluentui/foundation-legacy: yarn run vX.X.X +@fluentui/foundation-legacy: $ just-scripts ts +@fluentui/foundation-legacy: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/foundation-legacy/tsconfig.json +@fluentui/foundation-legacy: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/foundation-legacy/tsconfig.json" +@fluentui/foundation-legacy: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/foundation-legacy/tsconfig.json +@fluentui/foundation-legacy: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/foundation-legacy/tsconfig.json" +@fluentui/foundation-legacy: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/react-theme-provider: yarn run vX.X.X +@fluentui/react-theme-provider: $ just-scripts ts +@fluentui/react-theme-provider: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-theme-provider/tsconfig.json +@fluentui/react-theme-provider: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-theme-provider/tsconfig.json" +@fluentui/react-theme-provider: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-theme-provider/tsconfig.json +@fluentui/react-theme-provider: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-theme-provider/tsconfig.json" +@fluentui/react-theme-provider: Done in ?s. +@fluentui/react-northstar: yarn run vX.X.X +@fluentui/react-northstar: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/react-northstar: Done in ?s. +@fluentui/react-avatar: yarn run vX.X.X +@fluentui/react-avatar: $ just-scripts ts +@fluentui/react-avatar: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-avatar/tsconfig.json +@fluentui/react-avatar: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-avatar/tsconfig.json" +@fluentui/react-avatar: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-avatar/tsconfig.json +@fluentui/react-avatar: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-avatar/tsconfig.json" +@fluentui/react-avatar: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/react-button: yarn run vX.X.X +@fluentui/react-button: $ just-scripts ts +@fluentui/react-button: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-button/tsconfig.json +@fluentui/react-button: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-button/tsconfig.json" +@fluentui/react-button: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-button/tsconfig.json +@fluentui/react-button: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-button/tsconfig.json" +@fluentui/react-button: Done in ?s. +@fluentui/react-flex: yarn run vX.X.X +@fluentui/react-flex: $ just-scripts ts +@fluentui/react-flex: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-flex/tsconfig.json +@fluentui/react-flex: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-flex/tsconfig.json" +@fluentui/react-flex: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-flex/tsconfig.json +@fluentui/react-flex: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-flex/tsconfig.json" +@fluentui/react-flex: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/react-image: yarn run vX.X.X +@fluentui/react-image: $ just-scripts ts +@fluentui/react-image: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-image/tsconfig.json +@fluentui/react-image: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-image/tsconfig.json" +@fluentui/react-image: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-image/tsconfig.json +@fluentui/react-image: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-image/tsconfig.json" +@fluentui/react-image: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/react-internal: yarn run vX.X.X +@fluentui/react-internal: $ just-scripts ts +@fluentui/react-internal: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-internal/tsconfig.json +@fluentui/react-internal: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-internal/tsconfig.json" +@fluentui/react-internal: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-internal/tsconfig.json +@fluentui/react-internal: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-internal/tsconfig.json" +@fluentui/react-internal: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/react-text: yarn run vX.X.X +@fluentui/react-text: $ just-scripts ts +@fluentui/react-text: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-text/tsconfig.json +@fluentui/react-text: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-text/tsconfig.json" +@fluentui/react-text: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-text/tsconfig.json +@fluentui/react-text: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-text/tsconfig.json" +@fluentui/react-text: Done in ?s. +@fluentui/circulars-test: yarn run vX.X.X +@fluentui/circulars-test: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/circulars-test: Done in ?s. +@fluentui/code-sandbox: yarn run vX.X.X +@fluentui/code-sandbox: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/code-sandbox: Done in ?s. +@fluentui/local-sandbox: yarn run vX.X.X +@fluentui/local-sandbox: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/local-sandbox: Done in ?s. +@fluentui/projects-test: yarn run vX.X.X +@fluentui/projects-test: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/projects-test: Done in ?s. +@uifabric/date-time: yarn run vX.X.X +@uifabric/date-time: $ just-scripts ts +@uifabric/date-time: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/date-time/tsconfig.json +@uifabric/date-time: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/date-time/tsconfig.json" +@uifabric/date-time: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/date-time/tsconfig.json +@uifabric/date-time: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/date-time/tsconfig.json" +@uifabric/date-time: Done in ?s. +@fluentui/react-checkbox: yarn run vX.X.X +@fluentui/react-checkbox: $ just-scripts ts +@fluentui/react-checkbox: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-checkbox/tsconfig.json +@fluentui/react-checkbox: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-checkbox/tsconfig.json" +@fluentui/react-checkbox: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-checkbox/tsconfig.json +@fluentui/react-checkbox: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-checkbox/tsconfig.json" +@fluentui/react-checkbox: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/react-link: yarn run vX.X.X +@fluentui/react-link: $ just-scripts ts +@fluentui/react-link: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-link/tsconfig.json +@fluentui/react-link: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-link/tsconfig.json" +@fluentui/react-link: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-link/tsconfig.json +@fluentui/react-link: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-link/tsconfig.json" +@fluentui/react-link: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/react-slider: yarn run vX.X.X +@fluentui/react-slider: $ just-scripts ts +@fluentui/react-slider: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-slider/tsconfig.json +@fluentui/react-slider: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-slider/tsconfig.json" +@fluentui/react-slider: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-slider/tsconfig.json +@fluentui/react-slider: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-slider/tsconfig.json" +@fluentui/react-slider: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/react-tabs: yarn run vX.X.X +@fluentui/react-tabs: $ just-scripts ts +@fluentui/react-tabs: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-tabs/tsconfig.json +@fluentui/react-tabs: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-tabs/tsconfig.json" +@fluentui/react-tabs: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-tabs/tsconfig.json +@fluentui/react-tabs: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-tabs/tsconfig.json" +@fluentui/react-tabs: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/react-toggle: yarn run vX.X.X +@fluentui/react-toggle: $ just-scripts ts +@fluentui/react-toggle: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-toggle/tsconfig.json +@fluentui/react-toggle: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-toggle/tsconfig.json" +@fluentui/react-toggle: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-toggle/tsconfig.json +@fluentui/react-toggle: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-toggle/tsconfig.json" +@fluentui/react-toggle: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +codesandbox-react-northstar-template: yarn run vX.X.X +codesandbox-react-northstar-template: $ just-scripts ts +codesandbox-react-northstar-template: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/codesandbox-react-northstar-template/tsconfig.json +codesandbox-react-northstar-template: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/apps/codesandbox-react-northstar-template/tsconfig.json" +codesandbox-react-northstar-template: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/codesandbox-react-northstar-template/tsconfig.json +codesandbox-react-northstar-template: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/apps/codesandbox-react-northstar-template/tsconfig.json" +codesandbox-react-northstar-template: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/react-builder: yarn run vX.X.X +@fluentui/react-builder: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/react-builder: Done in ?s. +@fluentui/react: yarn run vX.X.X +@fluentui/react: $ just-scripts ts +@fluentui/react: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react/tsconfig.json +@fluentui/react: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react/tsconfig.json" +@fluentui/react: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react/tsconfig.json +@fluentui/react: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react/tsconfig.json" +@fluentui/react: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/docs: yarn run vX.X.X +@fluentui/docs: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/docs: Done in ?s. +a11y-tests: yarn run vX.X.X +a11y-tests: $ just-scripts ts +a11y-tests: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/a11y-tests/tsconfig.json +a11y-tests: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/apps/a11y-tests/tsconfig.json" +a11y-tests: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/a11y-tests/tsconfig.json +a11y-tests: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/apps/a11y-tests/tsconfig.json" +a11y-tests: Done in ?s. +codesandbox-react-template: yarn run vX.X.X +codesandbox-react-template: $ just-scripts ts +codesandbox-react-template: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/codesandbox-react-template/tsconfig.json +codesandbox-react-template: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/apps/codesandbox-react-template/tsconfig.json" +codesandbox-react-template: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/codesandbox-react-template/tsconfig.json +codesandbox-react-template: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/apps/codesandbox-react-template/tsconfig.json" +codesandbox-react-template: Done in ?s. +perf-test: yarn run vX.X.X +perf-test: $ just-scripts ts +perf-test: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/perf-test/tsconfig.json +perf-test: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/apps/perf-test/tsconfig.json" +perf-test: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/perf-test/tsconfig.json +perf-test: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/apps/perf-test/tsconfig.json" +perf-test: Done in ?s. +server-rendered-app: yarn run vX.X.X +server-rendered-app: $ just-scripts ts +server-rendered-app: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/server-rendered-app/tsconfig.json +server-rendered-app: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/apps/server-rendered-app/tsconfig.json" +server-rendered-app: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/server-rendered-app/tsconfig.json +server-rendered-app: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/apps/server-rendered-app/tsconfig.json" +server-rendered-app: Done in ?s. +test-bundles: yarn run vX.X.X +test-bundles: $ just-scripts ts +test-bundles: Done in ?s. +todo-app: yarn run vX.X.X +todo-app: $ just-scripts ts +todo-app: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/todo-app/tsconfig.json +todo-app: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/apps/todo-app/tsconfig.json" +todo-app: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/todo-app/tsconfig.json +todo-app: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/apps/todo-app/tsconfig.json" +todo-app: Done in ?s. +@fluentui/azure-themes: yarn run vX.X.X +@fluentui/azure-themes: $ just-scripts ts +@fluentui/azure-themes: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/azure-themes/tsconfig.json +@fluentui/azure-themes: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/azure-themes/tsconfig.json" +@fluentui/azure-themes: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/azure-themes/tsconfig.json +@fluentui/azure-themes: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/azure-themes/tsconfig.json" +@fluentui/azure-themes: Done in ?s. +@fluentui/react-cards: yarn run vX.X.X +@fluentui/react-cards: $ just-scripts ts +@fluentui/react-cards: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-cards/tsconfig.json +@fluentui/react-cards: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-cards/tsconfig.json" +@fluentui/react-cards: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-cards/tsconfig.json +@fluentui/react-cards: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-cards/tsconfig.json" +@fluentui/react-cards: Done in ?s. +@fluentui/react-charting: yarn run vX.X.X +@fluentui/react-charting: $ just-scripts ts +@fluentui/react-charting: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-charting/tsconfig.json +@fluentui/react-charting: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-charting/tsconfig.json" +@fluentui/react-charting: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-charting/tsconfig.json +@fluentui/react-charting: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-charting/tsconfig.json" +@fluentui/react-charting: Done in ?s. +@fluentui/react-experiments: yarn run vX.X.X +@fluentui/react-experiments: $ just-scripts ts +@fluentui/react-experiments: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-experiments/tsconfig.json +@fluentui/react-experiments: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-experiments/tsconfig.json" +@fluentui/react-experiments: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-experiments/tsconfig.json +@fluentui/react-experiments: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-experiments/tsconfig.json" +@fluentui/react-experiments: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/react-monaco-editor: yarn run vX.X.X +@fluentui/react-monaco-editor: $ just-scripts ts +@fluentui/react-monaco-editor: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-monaco-editor/tsconfig.json +@fluentui/react-monaco-editor: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-monaco-editor/tsconfig.json" +@fluentui/react-monaco-editor: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-monaco-editor/tsconfig.json +@fluentui/react-monaco-editor: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-monaco-editor/tsconfig.json" +@fluentui/react-monaco-editor: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/react-next: yarn run vX.X.X +@fluentui/react-next: $ just-scripts ts +@fluentui/react-next: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-next/tsconfig.json +@fluentui/react-next: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-next/tsconfig.json" +@fluentui/react-next: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-next/tsconfig.json +@fluentui/react-next: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-next/tsconfig.json" +@fluentui/react-next: Done in ?s. +@fluentui/theme-samples: yarn run vX.X.X +@fluentui/theme-samples: $ just-scripts ts +@fluentui/theme-samples: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/theme-samples/tsconfig.json +@fluentui/theme-samples: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/theme-samples/tsconfig.json" +@fluentui/theme-samples: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/theme-samples/tsconfig.json +@fluentui/theme-samples: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/theme-samples/tsconfig.json" +@fluentui/theme-samples: Done in ?s. +@fluentui/e2e: yarn run vX.X.X +@fluentui/e2e: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/e2e: Done in ?s. +@fluentui/perf-test: yarn run vX.X.X +@fluentui/perf-test: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/perf-test: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/fluentui/perf-test/tsconfig.json +@fluentui/perf-test: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/fluentui/perf-test/tsconfig.json" +@fluentui/perf-test: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/fluentui/perf-test/tsconfig.json +@fluentui/perf-test: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/fluentui/perf-test/tsconfig.json" +@fluentui/perf-test: Done in ?s. +@fluentui/perf: yarn run vX.X.X +@fluentui/perf: $ /office-ui-fabric-react/node_modules/.bin/just ts +@fluentui/perf: Done in ?s. +@fluentui/api-docs: yarn run vX.X.X +@fluentui/api-docs: $ just-scripts ts +@fluentui/api-docs: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/api-docs/tsconfig.json +@fluentui/api-docs: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/api-docs/tsconfig.json" +@fluentui/api-docs: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/api-docs/tsconfig.json +@fluentui/api-docs: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/api-docs/tsconfig.json" +@fluentui/api-docs: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/react-docsite-components: yarn run vX.X.X +@fluentui/react-docsite-components: $ just-scripts ts +@fluentui/react-docsite-components: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-docsite-components/tsconfig.json +@fluentui/react-docsite-components: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-docsite-components/tsconfig.json" +@fluentui/react-docsite-components: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-docsite-components/tsconfig.json +@fluentui/react-docsite-components: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-docsite-components/tsconfig.json" +@fluentui/react-docsite-components: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +codesandbox-react-next-template: yarn run vX.X.X +codesandbox-react-next-template: $ just-scripts ts +codesandbox-react-next-template: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/codesandbox-react-next-template/tsconfig.json +codesandbox-react-next-template: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/apps/codesandbox-react-next-template/tsconfig.json" +codesandbox-react-next-template: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/codesandbox-react-next-template/tsconfig.json +codesandbox-react-next-template: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/apps/codesandbox-react-next-template/tsconfig.json" +codesandbox-react-next-template: Done in ?s. +@fluentui/storybook: yarn run vX.X.X +@fluentui/storybook: $ just-scripts ts +@fluentui/storybook: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/storybook/tsconfig.json +@fluentui/storybook: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/storybook/tsconfig.json" +@fluentui/storybook: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/storybook/tsconfig.json +@fluentui/storybook: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/storybook/tsconfig.json" +@fluentui/storybook: Done in ?s. +dom-tests: yarn run vX.X.X +dom-tests: $ just-scripts ts +dom-tests: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/dom-tests/tsconfig.json +dom-tests: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/apps/dom-tests/tsconfig.json" +dom-tests: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/dom-tests/tsconfig.json +dom-tests: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/apps/dom-tests/tsconfig.json" +dom-tests: Done in ?s. +theming-designer: yarn run vX.X.X +theming-designer: $ just-scripts ts +theming-designer: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/theming-designer/tsconfig.json +theming-designer: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/apps/theming-designer/tsconfig.json" +theming-designer: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/theming-designer/tsconfig.json +theming-designer: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/apps/theming-designer/tsconfig.json" +theming-designer: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +vr-tests: yarn run vX.X.X +vr-tests: $ just-scripts ts +vr-tests: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/vr-tests/tsconfig.json +vr-tests: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/apps/vr-tests/tsconfig.json" +vr-tests: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/vr-tests/tsconfig.json +vr-tests: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/apps/vr-tests/tsconfig.json" +vr-tests: Done in ?s. +@fluentui/react-examples: yarn run vX.X.X +@fluentui/react-examples: $ just-scripts ts +@fluentui/react-examples: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-examples/tsconfig.json +@fluentui/react-examples: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-examples/tsconfig.json" +@fluentui/react-examples: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/packages/react-examples/tsconfig.json +@fluentui/react-examples: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-examples/tsconfig.json" +@fluentui/react-examples: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +@fluentui/public-docsite-resources: yarn run vX.X.X +@fluentui/public-docsite-resources: $ just-scripts ts +@fluentui/public-docsite-resources: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/public-docsite-resources/tsconfig.json +@fluentui/public-docsite-resources: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/apps/public-docsite-resources/tsconfig.json" +@fluentui/public-docsite-resources: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/public-docsite-resources/tsconfig.json +@fluentui/public-docsite-resources: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/apps/public-docsite-resources/tsconfig.json" +@fluentui/public-docsite-resources: Done in ?s. +@fluentui/public-docsite: yarn run vX.X.X +@fluentui/public-docsite: $ just-scripts ts +@fluentui/public-docsite: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/public-docsite/tsconfig.json +@fluentui/public-docsite: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/apps/public-docsite/tsconfig.json" +@fluentui/public-docsite: [XX:XX:XX XM] ■ Running /office-ui-fabric-react/node_modules/typescript/lib/tsc.js with /office-ui-fabric-react/apps/public-docsite/tsconfig.json +@fluentui/public-docsite: [XX:XX:XX XM] ■ Executing: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/apps/public-docsite/tsconfig.json" +@fluentui/public-docsite: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. +ssr-tests: yarn run vX.X.X +ssr-tests: $ just-scripts ts +ssr-tests: Done in ?s. Standard error: -info cli using local version of lerna -@fluentui/web-components: src/index-rollup.ts → dist/web-components.js, dist/web-components.min.js... -@fluentui/web-components: created dist/web-components.js, dist/web-components.min.js in ?s -@fluentui/web-components: npm WARN lifecycle The node binary used for scripts is but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. -@fluentui/ability-attributes: npm WARN lifecycle The node binary used for scripts is but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. -@fluentui/ability-attributes: /office-ui-fabric-react/node_modules/electron/index.js:14 -@fluentui/ability-attributes: throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again') -@fluentui/ability-attributes: ^ -@fluentui/ability-attributes: Error: Electron failed to install correctly, please delete node_modules/electron and try installing again -@fluentui/ability-attributes: at getElectronPath (/office-ui-fabric-react/node_modules/electron/index.js:14:11) -@fluentui/ability-attributes: at Object. (/office-ui-fabric-react/node_modules/electron/index.js:18:18) -@fluentui/ability-attributes: at Module._compile (internal/modules/cjs/loader.js:1251:30) -@fluentui/ability-attributes: at Module._compile (/office-ui-fabric-react/node_modules/pirates/lib/index.js:99:24) -@fluentui/ability-attributes: at Module._extensions..js (internal/modules/cjs/loader.js:1272:10) -@fluentui/ability-attributes: at Object.newLoader [as .js] (/office-ui-fabric-react/node_modules/pirates/lib/index.js:104:7) -@fluentui/ability-attributes: at Module.load (internal/modules/cjs/loader.js:1100:32) -@fluentui/ability-attributes: at Function.Module._load (internal/modules/cjs/loader.js:962:14) -@fluentui/ability-attributes: at Module.require (internal/modules/cjs/loader.js:1140:19) -@fluentui/ability-attributes: at require (internal/modules/cjs/helpers.js:75:18) -@fluentui/ability-attributes: error Command failed with exit code 1. -lerna ERR! yarn run build exited 1 in '@fluentui/ability-attributes' +@fluentui/eslint-plugin: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/eslint-plugin: [XX:XX:XX XM] x Command not defined: ts +@fluentui/noop: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/noop: [XX:XX:XX XM] x Command not defined: ts +@fluentui/ie11-polyfills: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/ie11-polyfills: [XX:XX:XX XM] x Command not defined: ts +@fluentui/web-components: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/web-components: [XX:XX:XX XM] x Command not defined: ts +@fluentui/ability-attributes: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/ability-attributes: [XX:XX:XX XM] x Command not defined: ts +@uifabric/build: [XX:XX:XX XM] x Error detected while running 'ts:esm' +@uifabric/build: [XX:XX:XX XM] x ------------------------------------ +@uifabric/build: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/scripts/tsconfig.json" +@uifabric/build: at ChildProcess.exithandler (child_process.js:308:12) +@uifabric/build: at ChildProcess.emit (events.js:314:20) +@uifabric/build: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@uifabric/build: at maybeClose (internal/child_process.js:1021:16) +@uifabric/build: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@uifabric/build: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@uifabric/build: [XX:XX:XX XM] x stdout: +@uifabric/build: [XX:XX:XX XM] x create-package/plop-templates-node/just.config.ts:1:9 - error TS2451: Cannot redeclare block-scoped variable 'preset'. +@uifabric/build: 1 const { preset, just } = require('@uifabric/build'); +@uifabric/build: ~~~~~~ +@uifabric/build: create-package/plop-templates-react/just.config.ts:1:9 +@uifabric/build: 1 const { preset } = require('@uifabric/build'); +@uifabric/build: ~~~~~~ +@uifabric/build: 'preset' was also declared here. +@uifabric/build: tasks/preset.ts:1:7 +@uifabric/build: 1 const preset = require('../just.config'); +@uifabric/build: ~~~~~~ +@uifabric/build: and here. +@uifabric/build: create-package/plop-templates-react/just.config.ts:1:9 - error TS2451: Cannot redeclare block-scoped variable 'preset'. +@uifabric/build: 1 const { preset } = require('@uifabric/build'); +@uifabric/build: ~~~~~~ +@uifabric/build: create-package/plop-templates-node/just.config.ts:1:9 +@uifabric/build: 1 const { preset, just } = require('@uifabric/build'); +@uifabric/build: ~~~~~~ +@uifabric/build: 'preset' was also declared here. +@uifabric/build: create-package/plop-templates-react/src/version.ts:3:28 - error TS2307: Cannot find module '@fluentui/set-version' or its corresponding type declarations. +@uifabric/build: 3 import { setVersion } from '@fluentui/set-version'; +@uifabric/build: ~~~~~~~~~~~~~~~~~~~~~~~ +@uifabric/build: create-package/plopfile.ts:23:5 - error TS2322: Type 'Question>[]' is not assignable to type 'Question[]'. +@uifabric/build: Type 'Question>' is not assignable to type 'Question'. +@uifabric/build: Types of property 'message' are incompatible. +@uifabric/build: Type 'DynamicQuestionProperty, Partial>' is not assignable to type 'string | ((answers: Answers) => string)'. +@uifabric/build: Type 'Promise' is not assignable to type 'string | ((answers: Answers) => string)'. +@uifabric/build: Type 'Promise' is not assignable to type '(answers: Answers) => string'. +@uifabric/build: Type 'Promise' provides no match for the signature '(answers: Answers): string'. +@uifabric/build: 23 prompts: [ +@uifabric/build: ~~~~~~~ +@uifabric/build: ../node_modules/node-plop/index.d.ts:126:3 +@uifabric/build: 126 prompts: inquirer.Question[]; +@uifabric/build: ~~~~~~~ +@uifabric/build: The expected type comes from property 'prompts' which is declared here on type 'PlopGenerator' +@uifabric/build: gulp/plugins/gulp-component-menu-behaviors.ts:1:38 - error TS2307: Cannot find module '@fluentui/a11y-testing' or its corresponding type declarations. +@uifabric/build: 1 import * as behaviorDefinitions from '@fluentui/a11y-testing'; +@uifabric/build: ~~~~~~~~~~~~~~~~~~~~~~~~ +@uifabric/build: gulp/plugins/util/getComponentInfo.ts:145:9 - error TS2322: Type 'Tag[]' is not assignable to type '{ title: string; description: string; type: null; name: string; }[]'. +@uifabric/build: Type 'Tag' is not assignable to type '{ title: string; description: string; type: null; name: string; }'. +@uifabric/build: Types of property 'type' are incompatible. +@uifabric/build: Type 'Type' is not assignable to type 'null'. +@uifabric/build: Type 'AllLiteral' is not assignable to type 'null'. +@uifabric/build: 145 tags, +@uifabric/build: ~~~~ +@uifabric/build: gulp/plugins/util/docs-types.ts:49:3 +@uifabric/build: 49 tags: { +@uifabric/build: ~~~~ +@uifabric/build: The expected type comes from property 'tags' which is declared here on type 'ComponentProp' +@uifabric/build: gulp/plugins/util/tsLanguageService.ts:25:18 - error TS2569: Type 'IterableIterator' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators. +@uifabric/build: 25 return [...files.keys()]; +@uifabric/build: ~~~~~~~~~~~~ +@uifabric/build: gulp/tasks/browserAdapters.ts:58:7 - error TS2794: Expected 1 arguments, but got 0. Did you forget to include 'void' in your type argument to 'Promise'? +@uifabric/build: 58 resolve(); +@uifabric/build: ~~~~~~~~~ +@uifabric/build: ../node_modules/typescript/lib/lib.es2015.promise.d.ts:33:34 +@uifabric/build: 33 new (executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; +@uifabric/build: ~~~~~~~~~~~~~~~~~~~~~~~~~ +@uifabric/build: An argument for 'value' was not provided. +@uifabric/build: index.js:1:1 - error TS9006: Declaration emit for this file requires using private name 'CssLoaderOptions' from module '"/office-ui-fabric-react/node_modules/just-scripts/lib/webpack/overlays/stylesOverlay"'. An explicit type annotation may unblock declaration emit. +@uifabric/build: 1 const just = require('just-scripts'); +@uifabric/build: ~~~~~ +@uifabric/build: index.js:1:1 - error TS9006: Declaration emit for this file requires using private name 'PrettierTaskOptions' from module '"/office-ui-fabric-react/node_modules/just-scripts/lib/tasks/prettierTask"'. An explicit type annotation may unblock declaration emit. +@uifabric/build: 1 const just = require('just-scripts'); +@uifabric/build: ~~~~~ +@uifabric/build: just.config.ts:141:1 - error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. +@uifabric/build: 141 export = preset; +@uifabric/build: ~~~~~~~~~~~~~~~~ +@uifabric/build: monorepo/findRepoDeps.js:52:18 - error TS2569: Type 'Set' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators. +@uifabric/build: 52 repoDeps = [...result].map(dep => packageInfo[dep]); +@uifabric/build: ~~~~~~ +@uifabric/build: publish-beta.js:18:12 - error TS1212: Identifier expected. 'package' is a reserved word in strict mode. +@uifabric/build: 18 for (const package of packages) { +@uifabric/build: ~~~~~~~ +@uifabric/build: publish-beta.js:19:53 - error TS1212: Identifier expected. 'package' is a reserved word in strict mode. +@uifabric/build: 19 const packagePath = path.resolve(__dirname, '..', package.packagePath); +@uifabric/build: ~~~~~~~ +@uifabric/build: publish-beta.js:21:43 - error TS1212: Identifier expected. 'package' is a reserved word in strict mode. +@uifabric/build: 21 console.log(`Publishing ${chalk.magenta(package.packageName)} in ${packagePath}`); +@uifabric/build: ~~~~~~~ +@uifabric/build: tasks/preset.ts:1:7 - error TS2451: Cannot redeclare block-scoped variable 'preset'. +@uifabric/build: 1 const preset = require('../just.config'); +@uifabric/build: ~~~~~~ +@uifabric/build: create-package/plop-templates-node/just.config.ts:1:9 +@uifabric/build: 1 const { preset, just } = require('@uifabric/build'); +@uifabric/build: ~~~~~~ +@uifabric/build: 'preset' was also declared here. +@uifabric/build: update-package-versions.js:11:7 - error TS6133: 'path' is declared but its value is never read. +@uifabric/build: 11 const path = require('path'); +@uifabric/build: ~~~~ +@uifabric/build: update-package-versions.js:47:12 - error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. +@uifabric/build: 47 function updateDependencies(deps) { +@uifabric/build: ~~~~~~~~~~~~~~~~~~ +@uifabric/build: Found 18 errors. +@uifabric/build: [XX:XX:XX XM] x ------------------------------------ +@uifabric/build: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@uifabric/build: [XX:XX:XX XM] x Other tasks that did not complete: [ts:commonjs] +@uifabric/build: error Command failed with exit code 1. +@uifabric/webpack-utils: [XX:XX:XX XM] x Error detected while running 'ts:esm' +@uifabric/webpack-utils: [XX:XX:XX XM] x ------------------------------------ +@uifabric/webpack-utils: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/webpack-utils/tsconfig.json" +@uifabric/webpack-utils: at ChildProcess.exithandler (child_process.js:308:12) +@uifabric/webpack-utils: at ChildProcess.emit (events.js:314:20) +@uifabric/webpack-utils: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@uifabric/webpack-utils: at maybeClose (internal/child_process.js:1021:16) +@uifabric/webpack-utils: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@uifabric/webpack-utils: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@uifabric/webpack-utils: [XX:XX:XX XM] x stdout: +@uifabric/webpack-utils: [XX:XX:XX XM] x src/fabricAsyncLoaderInclude.ts:7:1 - error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. +@uifabric/webpack-utils: 7 export = (input: string) => +@uifabric/webpack-utils: ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@uifabric/webpack-utils: 8 input.match(/@fluentui[\\/]react-internal[\\/]lib[\\/]components[\\/]ContextualMenu[\\/]ContextualMenu.js/) || +@uifabric/webpack-utils: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@uifabric/webpack-utils: 9 input.match(/@fluentui[\\/]react-internal[\\/]lib[\\/]components[\\/]Callout[\\/]Callout.js/); +@uifabric/webpack-utils: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@uifabric/webpack-utils: Found 1 error. +@uifabric/webpack-utils: [XX:XX:XX XM] x ------------------------------------ +@uifabric/webpack-utils: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@uifabric/webpack-utils: [XX:XX:XX XM] x Other tasks that did not complete: [ts:commonjs] +@uifabric/webpack-utils: error Command failed with exit code 1. +@fluentui/docs-components: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/docs-components: [XX:XX:XX XM] x Command not defined: ts +@fluentui/react-component-event-listener: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/react-component-event-listener: [XX:XX:XX XM] x Command not defined: ts +@fluentui/react-component-nesting-registry: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/react-component-nesting-registry: [XX:XX:XX XM] x Command not defined: ts +@fluentui/react-component-ref: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/react-component-ref: [XX:XX:XX XM] x Command not defined: ts +@fluentui/react-context-selector: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/react-context-selector: [XX:XX:XX XM] x Command not defined: ts +@fluentui/react-proptypes: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/react-proptypes: [XX:XX:XX XM] x Command not defined: ts +@fluentui/state: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/state: [XX:XX:XX XM] x Command not defined: ts +@fluentui/styles: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/styles: [XX:XX:XX XM] x Command not defined: ts +@fluentui/accessibility: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/accessibility: [XX:XX:XX XM] x Command not defined: ts +@fluentui/merge-styles: [XX:XX:XX XM] x Error detected while running '_wrapFunction' +@fluentui/merge-styles: [XX:XX:XX XM] x ------------------------------------ +@fluentui/merge-styles: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/merge-styles/tsconfig.json" +@fluentui/merge-styles: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/merge-styles: at ChildProcess.emit (events.js:314:20) +@fluentui/merge-styles: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/merge-styles: at maybeClose (internal/child_process.js:1021:16) +@fluentui/merge-styles: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/merge-styles: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/merge-styles: [XX:XX:XX XM] x stdout: +@fluentui/merge-styles: [XX:XX:XX XM] x src/mergeStyleSets.test.ts:168:15 - error TS2310: Type 'ISubComponentStyles' recursively references itself as a base type. +@fluentui/merge-styles: 168 interface ISubComponentStyles extends IStyleSet { +@fluentui/merge-styles: ~~~~~~~~~~~~~~~~~~~ +@fluentui/merge-styles: src/mergeStyleSets.test.ts:176:15 - error TS2310: Type 'IStyles' recursively references itself as a base type. +@fluentui/merge-styles: 176 interface IStyles extends IStyleSet { +@fluentui/merge-styles: ~~~~~~~ +@fluentui/merge-styles: Found 2 errors. +@fluentui/merge-styles: [XX:XX:XX XM] x ------------------------------------ +@fluentui/merge-styles: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/merge-styles: [XX:XX:XX XM] x Other tasks that did not complete: [ts:esm] +@fluentui/merge-styles: error Command failed with exit code 1. +@fluentui/react-northstar-styles-renderer: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/react-northstar-styles-renderer: [XX:XX:XX XM] x Command not defined: ts +@fluentui/react-northstar-emotion-renderer: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/react-northstar-emotion-renderer: [XX:XX:XX XM] x Command not defined: ts +@fluentui/react-northstar-fela-renderer: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/react-northstar-fela-renderer: [XX:XX:XX XM] x Command not defined: ts +@uifabric/utilities: [XX:XX:XX XM] x Error detected while running '_wrapFunction' +@uifabric/utilities: [XX:XX:XX XM] x ------------------------------------ +@uifabric/utilities: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/utilities/tsconfig.json" +@uifabric/utilities: at ChildProcess.exithandler (child_process.js:308:12) +@uifabric/utilities: at ChildProcess.emit (events.js:314:20) +@uifabric/utilities: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@uifabric/utilities: at maybeClose (internal/child_process.js:1021:16) +@uifabric/utilities: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@uifabric/utilities: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@uifabric/utilities: [XX:XX:XX XM] x stdout: +@uifabric/utilities: [XX:XX:XX XM] x src/AutoScroll.ts:143:14 - error TS2790: The operand of a 'delete' operator must be optional. +@uifabric/utilities: 143 delete this._timeoutId; +@uifabric/utilities: ~~~~~~~~~~~~~~~ +@uifabric/utilities: src/dom/getRect.ts:19:16 - error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead? +@uifabric/utilities: 19 } else if ((element as HTMLElement).getBoundingClientRect) { +@uifabric/utilities: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@uifabric/utilities: src/object.ts:9:11 - error TS2339: Property 'hasOwnProperty' does not exist on type 'TA'. +@uifabric/utilities: 9 if (a.hasOwnProperty(propName)) { +@uifabric/utilities: ~~~~~~~~~~~~~~ +@uifabric/utilities: src/object.ts:10:14 - error TS2339: Property 'hasOwnProperty' does not exist on type 'TB'. +@uifabric/utilities: 10 if (!b.hasOwnProperty(propName) || b[propName] !== a[propName]) { +@uifabric/utilities: ~~~~~~~~~~~~~~ +@uifabric/utilities: src/object.ts:10:42 - error TS2536: Type 'Extract' cannot be used to index type 'TB'. +@uifabric/utilities: 10 if (!b.hasOwnProperty(propName) || b[propName] !== a[propName]) { +@uifabric/utilities: ~~~~~~~~~~~ +@uifabric/utilities: src/object.ts:16:11 - error TS2339: Property 'hasOwnProperty' does not exist on type 'TB'. +@uifabric/utilities: 16 if (b.hasOwnProperty(propName)) { +@uifabric/utilities: ~~~~~~~~~~~~~~ +@uifabric/utilities: src/object.ts:17:14 - error TS2339: Property 'hasOwnProperty' does not exist on type 'TA'. +@uifabric/utilities: 17 if (!a.hasOwnProperty(propName)) { +@uifabric/utilities: ~~~~~~~~~~~~~~ +@uifabric/utilities: Found 7 errors. +@uifabric/utilities: [XX:XX:XX XM] x ------------------------------------ +@uifabric/utilities: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@uifabric/utilities: [XX:XX:XX XM] x Other tasks that did not complete: [ts:esm] +@uifabric/utilities: error Command failed with exit code 1. +@fluentui/react-icons-mdl2: [XX:XX:XX XM] x Error detected while running 'ts:esm' +@fluentui/react-icons-mdl2: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-icons-mdl2: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-icons-mdl2/tsconfig.json" +@fluentui/react-icons-mdl2: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/react-icons-mdl2: at ChildProcess.emit (events.js:314:20) +@fluentui/react-icons-mdl2: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/react-icons-mdl2: at maybeClose (internal/child_process.js:1021:16) +@fluentui/react-icons-mdl2: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/react-icons-mdl2: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/react-icons-mdl2: [XX:XX:XX XM] x stdout: +@fluentui/react-icons-mdl2: [XX:XX:XX XM] x src/utils/createSvgIcon.ts:3:26 - error TS2307: Cannot find module './SvgIcon.scss' or its corresponding type declarations. +@fluentui/react-icons-mdl2: 3 import * as classes from './SvgIcon.scss'; +@fluentui/react-icons-mdl2: ~~~~~~~~~~~~~~~~ +@fluentui/react-icons-mdl2: Found 1 error. +@fluentui/react-icons-mdl2: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-icons-mdl2: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/react-icons-mdl2: [XX:XX:XX XM] x Other tasks that did not complete: [ts:commonjs] +@fluentui/react-icons-mdl2: error Command failed with exit code 1. +@fluentui/react-bindings: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/react-bindings: [XX:XX:XX XM] x Command not defined: ts +@fluentui/react-icons-northstar: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/react-icons-northstar: [XX:XX:XX XM] x Command not defined: ts +@fluentui/react-telemetry: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/react-telemetry: [XX:XX:XX XM] x Command not defined: ts +@fluentui/foundation-legacy: [XX:XX:XX XM] x Error detected while running '_wrapFunction' +@fluentui/foundation-legacy: [XX:XX:XX XM] x ------------------------------------ +@fluentui/foundation-legacy: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/foundation-legacy/tsconfig.json" +@fluentui/foundation-legacy: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/foundation-legacy: at ChildProcess.emit (events.js:314:20) +@fluentui/foundation-legacy: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/foundation-legacy: at maybeClose (internal/child_process.js:1021:16) +@fluentui/foundation-legacy: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/foundation-legacy: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/foundation-legacy: [XX:XX:XX XM] x stdout: +@fluentui/foundation-legacy: [XX:XX:XX XM] x src/createComponent.tsx:81:23 - error TS2352: Conversion of type 'TComponentProps & { styles: IConcatenatedStyleSet; tokens: TTokens; _defaultStyles: IConcatenatedStyleSet; theme: ITheme; className?: string | undefined; }' to type 'TViewProps & IDefaultSlotProps' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. +@fluentui/foundation-legacy: Type 'TComponentProps & { styles: IConcatenatedStyleSet; tokens: TTokens; _defaultStyles: IConcatenatedStyleSet; theme: ITheme; className?: string | undefined; }' is not comparable to type 'TViewProps'. +@fluentui/foundation-legacy: 'TComponentProps & { styles: IConcatenatedStyleSet; tokens: TTokens; _defaultStyles: IConcatenatedStyleSet; theme: ITheme; className?: string | undefined; }' is assignable to the constraint of type 'TViewProps', but 'TViewProps' could be instantiated with a different subtype of constraint 'object'. +@fluentui/foundation-legacy: 81 const viewProps = { +@fluentui/foundation-legacy: ~ +@fluentui/foundation-legacy: 82 ...componentProps, +@fluentui/foundation-legacy: ~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/foundation-legacy: ... +@fluentui/foundation-legacy: 86 theme, +@fluentui/foundation-legacy: ~~~~~~~~~~~~ +@fluentui/foundation-legacy: 87 } as TViewProps & IDefaultSlotProps; +@fluentui/foundation-legacy: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/foundation-legacy: Found 1 error. +@fluentui/foundation-legacy: [XX:XX:XX XM] x ------------------------------------ +@fluentui/foundation-legacy: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/foundation-legacy: [XX:XX:XX XM] x Other tasks that did not complete: [ts:esm] +@fluentui/foundation-legacy: error Command failed with exit code 1. +@fluentui/react-northstar: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/react-northstar: [XX:XX:XX XM] x Command not defined: ts +@fluentui/react-avatar: [XX:XX:XX XM] x Error detected while running '_wrapFunction' +@fluentui/react-avatar: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-avatar: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-avatar/tsconfig.json" +@fluentui/react-avatar: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/react-avatar: at ChildProcess.emit (events.js:314:20) +@fluentui/react-avatar: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/react-avatar: at maybeClose (internal/child_process.js:1021:16) +@fluentui/react-avatar: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/react-avatar: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/react-avatar: [XX:XX:XX XM] x stdout: +@fluentui/react-avatar: [XX:XX:XX XM] x src/components/Avatar/Avatar.tsx:10:38 - error TS2345: Argument of type 'typeof import("*.scss")' is not assignable to parameter of type 'Record'. +@fluentui/react-avatar: 10 const useAvatarClasses = makeClasses(classes); +@fluentui/react-avatar: ~~~~~~~ +@fluentui/react-avatar: src/components/Badge/Badge.tsx:9:44 - error TS2345: Argument of type 'typeof import("*.scss")' is not assignable to parameter of type 'Record'. +@fluentui/react-avatar: Property 'styles' is incompatible with index signature. +@fluentui/react-avatar: Type '{ [className: string]: string; }' is not assignable to type 'string'. +@fluentui/react-avatar: 9 export const useBadgeClasses = makeClasses(classes); +@fluentui/react-avatar: ~~~~~~~ +@fluentui/react-avatar: Found 2 errors. +@fluentui/react-avatar: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-avatar: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/react-avatar: [XX:XX:XX XM] x Other tasks that did not complete: [ts:esm] +@fluentui/react-avatar: error Command failed with exit code 1. +@fluentui/react-flex: [XX:XX:XX XM] x Error detected while running 'ts:esm' +@fluentui/react-flex: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-flex: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-flex/tsconfig.json" +@fluentui/react-flex: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/react-flex: at ChildProcess.emit (events.js:314:20) +@fluentui/react-flex: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/react-flex: at maybeClose (internal/child_process.js:1021:16) +@fluentui/react-flex: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/react-flex: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/react-flex: [XX:XX:XX XM] x stdout: +@fluentui/react-flex: [XX:XX:XX XM] x src/components/Flex/Flex.tsx:22:34 - error TS2345: Argument of type 'typeof import("*.scss")' is not assignable to parameter of type 'Record'. +@fluentui/react-flex: Property 'styles' is incompatible with index signature. +@fluentui/react-flex: Type '{ [className: string]: string; }' is not assignable to type 'string'. +@fluentui/react-flex: 22 classes: createClassResolver(classes), +@fluentui/react-flex: ~~~~~~~ +@fluentui/react-flex: src/components/FlexItem/FlexItem.tsx:20:34 - error TS2345: Argument of type 'typeof import("*.scss")' is not assignable to parameter of type 'Record'. +@fluentui/react-flex: 20 classes: createClassResolver(classes), +@fluentui/react-flex: ~~~~~~~ +@fluentui/react-flex: Found 2 errors. +@fluentui/react-flex: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-flex: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/react-flex: [XX:XX:XX XM] x Other tasks that did not complete: [ts:commonjs] +@fluentui/react-flex: error Command failed with exit code 1. +@fluentui/react-image: [XX:XX:XX XM] x Error detected while running 'ts:esm' +@fluentui/react-image: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-image: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-image/tsconfig.json" +@fluentui/react-image: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/react-image: at ChildProcess.emit (events.js:314:20) +@fluentui/react-image: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/react-image: at maybeClose (internal/child_process.js:1021:16) +@fluentui/react-image: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/react-image: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/react-image: [XX:XX:XX XM] x stdout: +@fluentui/react-image: [XX:XX:XX XM] x src/components/Image/Image.tsx:9:44 - error TS2345: Argument of type 'typeof import("*.scss")' is not assignable to parameter of type 'Record'. +@fluentui/react-image: Property 'styles' is incompatible with index signature. +@fluentui/react-image: Type '{ [className: string]: string; }' is not assignable to type 'string'. +@fluentui/react-image: 9 export const useImageClasses = makeClasses(classes); +@fluentui/react-image: ~~~~~~~ +@fluentui/react-image: Found 1 error. +@fluentui/react-image: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-image: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/react-image: [XX:XX:XX XM] x Other tasks that did not complete: [ts:commonjs] +@fluentui/react-image: error Command failed with exit code 1. +@fluentui/react-internal: [XX:XX:XX XM] x Error detected while running 'ts:esm' +@fluentui/react-internal: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-internal: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-internal/tsconfig.json" +@fluentui/react-internal: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/react-internal: at ChildProcess.emit (events.js:314:20) +@fluentui/react-internal: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/react-internal: at maybeClose (internal/child_process.js:1021:16) +@fluentui/react-internal: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/react-internal: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/react-internal: [XX:XX:XX XM] x stdout: +@fluentui/react-internal: [XX:XX:XX XM] x src/components/FloatingPicker/PeoplePicker/PeoplePickerItems/SuggestionItemDefault.tsx:12:72 - error TS2339: Property 'peoplePickerPersonaContent' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-internal: 12
+@fluentui/react-internal: ~~~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-internal: src/components/FloatingPicker/PeoplePicker/PeoplePickerItems/SuggestionItemDefault.tsx:16:64 - error TS2339: Property 'peoplePickerPersona' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-internal: 16 className={css('ms-PeoplePicker-Persona', stylesImport.peoplePickerPersona)} +@fluentui/react-internal: ~~~~~~~~~~~~~~~~~~~ +@fluentui/react-internal: src/components/List/List.tsx:384:12 - error TS2790: The operand of a 'delete' operator must be optional. +@fluentui/react-internal: 384 delete this._scrollElement; +@fluentui/react-internal: ~~~~~~~~~~~~~~~~~~~ +@fluentui/react-internal: src/components/MarqueeSelection/MarqueeSelection.base.tsx:88:12 - error TS2790: The operand of a 'delete' operator must be optional. +@fluentui/react-internal: 88 delete this._scrollableParent; +@fluentui/react-internal: ~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-internal: src/components/MarqueeSelection/MarqueeSelection.base.tsx:89:12 - error TS2790: The operand of a 'delete' operator must be optional. +@fluentui/react-internal: 89 delete this._scrollableSurface; +@fluentui/react-internal: ~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-internal: src/components/Persona/Persona.test.tsx:194:13 - error TS2322: Type 'ReactWrapper>' is not assignable to type 'ReactWrapper, unknown, Component<{}, {}, any>>'. +@fluentui/react-internal: Type 'HTMLAttributes' is not assignable to type 'ImgHTMLAttributes'. +@fluentui/react-internal: Types of property 'crossOrigin' are incompatible. +@fluentui/react-internal: Type 'string | undefined' is not assignable to type '"" | "anonymous" | "use-credentials" | undefined'. +@fluentui/react-internal: Type 'string' is not assignable to type '"" | "anonymous" | "use-credentials" | undefined'. +@fluentui/react-internal: 194 const image: ReactWrapper, unknown> = wrapper.find('ImageBase'); +@fluentui/react-internal: ~~~~~ +@fluentui/react-internal: src/components/Persona/Persona.test.tsx:201:13 - error TS2322: Type 'ReactWrapper>' is not assignable to type 'ReactWrapper, unknown, Component<{}, {}, any>>'. +@fluentui/react-internal: 201 const image: ReactWrapper, unknown> = wrapper.find('ImageBase'); +@fluentui/react-internal: ~~~~~ +@fluentui/react-internal: Found 7 errors. +@fluentui/react-internal: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-internal: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/react-internal: [XX:XX:XX XM] x Other tasks that did not complete: [ts:commonjs] +@fluentui/react-internal: error Command failed with exit code 1. +@fluentui/circulars-test: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/circulars-test: [XX:XX:XX XM] x Command not defined: ts +@fluentui/code-sandbox: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/code-sandbox: [XX:XX:XX XM] x Command not defined: ts +@fluentui/local-sandbox: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/local-sandbox: [XX:XX:XX XM] x Command not defined: ts +@fluentui/projects-test: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/projects-test: [XX:XX:XX XM] x Command not defined: ts +@fluentui/react-checkbox: [XX:XX:XX XM] x Error detected while running 'ts:esm' +@fluentui/react-checkbox: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-checkbox: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-checkbox/tsconfig.json" +@fluentui/react-checkbox: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/react-checkbox: at ChildProcess.emit (events.js:314:20) +@fluentui/react-checkbox: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/react-checkbox: at maybeClose (internal/child_process.js:1021:16) +@fluentui/react-checkbox: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/react-checkbox: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/react-checkbox: [XX:XX:XX XM] x stdout: +@fluentui/react-checkbox: [XX:XX:XX XM] x src/next/useCheckboxClasses.tsx:14:50 - error TS2345: Argument of type 'typeof import("*.scss")' is not assignable to parameter of type 'Record'. +@fluentui/react-checkbox: Property 'styles' is incompatible with index signature. +@fluentui/react-checkbox: Type '{ [className: string]: string; }' is not assignable to type 'string'. +@fluentui/react-checkbox: 14 const defaultClassResolver = createClassResolver(classes); +@fluentui/react-checkbox: ~~~~~~~ +@fluentui/react-checkbox: Found 1 error. +@fluentui/react-checkbox: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-checkbox: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/react-checkbox: [XX:XX:XX XM] x Other tasks that did not complete: [ts:commonjs] +@fluentui/react-checkbox: error Command failed with exit code 1. +@fluentui/react-link: [XX:XX:XX XM] x Error detected while running 'ts:esm' +@fluentui/react-link: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-link: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-link/tsconfig.json" +@fluentui/react-link: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/react-link: at ChildProcess.emit (events.js:314:20) +@fluentui/react-link: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/react-link: at maybeClose (internal/child_process.js:1021:16) +@fluentui/react-link: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/react-link: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/react-link: [XX:XX:XX XM] x stdout: +@fluentui/react-link: [XX:XX:XX XM] x src/next/Link.tsx:16:56 - error TS2339: Property 'button' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-link: 16 const propControlledClasses = [isButton && classes.button, isDisabled && classes.disabled]; +@fluentui/react-link: ~~~~~~ +@fluentui/react-link: src/next/Link.tsx:16:86 - error TS2339: Property 'disabled' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-link: 16 const propControlledClasses = [isButton && classes.button, isDisabled && classes.disabled]; +@fluentui/react-link: ~~~~~~~~ +@fluentui/react-link: src/next/Link.tsx:21:36 - error TS2339: Property 'root' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-link: 21 root: css(className, classes.root, globalClassNames.root, ...rootStaticClasses, ...propControlledClasses), +@fluentui/react-link: ~~~~ +@fluentui/react-link: Found 3 errors. +@fluentui/react-link: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-link: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/react-link: [XX:XX:XX XM] x Other tasks that did not complete: [ts:commonjs] +@fluentui/react-link: error Command failed with exit code 1. +@fluentui/react-slider: [XX:XX:XX XM] x Error detected while running 'ts:esm' +@fluentui/react-slider: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-slider: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-slider/tsconfig.json" +@fluentui/react-slider: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/react-slider: at ChildProcess.emit (events.js:314:20) +@fluentui/react-slider: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/react-slider: at maybeClose (internal/child_process.js:1021:16) +@fluentui/react-slider: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/react-slider: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/react-slider: [XX:XX:XX XM] x stdout: +@fluentui/react-slider: [XX:XX:XX XM] x src/next/Slider.tsx:38:27 - error TS2339: Property 'disabled' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-slider: 38 disabled && classes.disabled, +@fluentui/react-slider: ~~~~~~~~ +@fluentui/react-slider: src/next/Slider.tsx:39:27 - error TS2339: Property 'vertical' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-slider: 39 vertical && classes.vertical, +@fluentui/react-slider: ~~~~~~~~ +@fluentui/react-slider: src/next/Slider.tsx:46:36 - error TS2339: Property 'root' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-slider: 46 root: css(className, classes.root, globalClassNames.root, ...propClasses), +@fluentui/react-slider: ~~~~ +@fluentui/react-slider: src/next/Slider.tsx:47:30 - error TS2339: Property 'container' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-slider: 47 container: css(classes.container, globalClassNames.container, ...propClasses), +@fluentui/react-slider: ~~~~~~~~~ +@fluentui/react-slider: src/next/Slider.tsx:48:29 - error TS2339: Property 'slideBox' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-slider: 48 slideBox: css(classes.slideBox, globalClassNames.slideBox, ...propClasses), +@fluentui/react-slider: ~~~~~~~~ +@fluentui/react-slider: src/next/Slider.tsx:49:25 - error TS2339: Property 'line' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-slider: 49 line: css(classes.line, globalClassNames.line, ...propClasses), +@fluentui/react-slider: ~~~~ +@fluentui/react-slider: src/next/Slider.tsx:50:26 - error TS2339: Property 'thumb' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-slider: 50 thumb: css(classes.thumb, globalClassNames.thumb, ...propClasses), +@fluentui/react-slider: ~~~~~ +@fluentui/react-slider: src/next/Slider.tsx:51:34 - error TS2339: Property 'activeSection' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-slider: 51 activeSection: css(classes.activeSection, globalClassNames.activeSection, ...propClasses), +@fluentui/react-slider: ~~~~~~~~~~~~~ +@fluentui/react-slider: src/next/Slider.tsx:52:36 - error TS2339: Property 'inactiveSection' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-slider: 52 inactiveSection: css(classes.inactiveSection, globalClassNames.inactiveSection, ...propClasses), +@fluentui/react-slider: ~~~~~~~~~~~~~~~ +@fluentui/react-slider: src/next/Slider.tsx:53:34 - error TS2339: Property 'lineContainer' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-slider: 53 lineContainer: css(classes.lineContainer, ...propClasses), +@fluentui/react-slider: ~~~~~~~~~~~~~ +@fluentui/react-slider: src/next/Slider.tsx:54:31 - error TS2339: Property 'valueLabel' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-slider: 54 valueLabel: css(classes.valueLabel, globalClassNames.valueLabel, ...propClasses), +@fluentui/react-slider: ~~~~~~~~~~ +@fluentui/react-slider: src/next/Slider.tsx:55:31 - error TS2339: Property 'titleLabel' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-slider: 55 titleLabel: css(classes.titleLabel, titleLabelClassName, ...propClasses), +@fluentui/react-slider: ~~~~~~~~~~ +@fluentui/react-slider: src/next/Slider.tsx:57:29 - error TS2339: Property 'zeroTick' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-slider: 57 zeroTick: css(classes.zeroTick, globalClassNames.zeroTick, ...propClasses), +@fluentui/react-slider: ~~~~~~~~ +@fluentui/react-slider: Found 13 errors. +@fluentui/react-slider: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-slider: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/react-slider: [XX:XX:XX XM] x Other tasks that did not complete: [ts:commonjs] +@fluentui/react-slider: error Command failed with exit code 1. +@fluentui/react-tabs: [XX:XX:XX XM] x Error detected while running '_wrapFunction' +@fluentui/react-tabs: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-tabs: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-tabs/tsconfig.json" +@fluentui/react-tabs: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/react-tabs: at ChildProcess.emit (events.js:314:20) +@fluentui/react-tabs: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/react-tabs: at maybeClose (internal/child_process.js:1021:16) +@fluentui/react-tabs: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/react-tabs: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/react-tabs: [XX:XX:XX XM] x stdout: +@fluentui/react-tabs: [XX:XX:XX XM] x src/next/Pivot.tsx:33:39 - error TS2339: Property 'linkSize_large' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-tabs: 33 linkSize === 'large' && classes.linkSize_large, +@fluentui/react-tabs: ~~~~~~~~~~~~~~ +@fluentui/react-tabs: src/next/Pivot.tsx:34:40 - error TS2339: Property 'linkFormat_tabs' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-tabs: 34 linkFormat === 'tabs' && classes.linkFormat_tabs, +@fluentui/react-tabs: ~~~~~~~~~~~~~~~ +@fluentui/react-tabs: src/next/Pivot.tsx:40:17 - error TS2339: Property 'root' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-tabs: 40 classes.root, +@fluentui/react-tabs: ~~~~ +@fluentui/react-tabs: src/next/Pivot.tsx:46:25 - error TS2339: Property 'link' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-tabs: 46 link: css(classes.link, globalClassNames.link, ...modifierClasses), +@fluentui/react-tabs: ~~~~ +@fluentui/react-tabs: src/next/Pivot.tsx:47:31 - error TS2339: Property 'linkInMenu' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-tabs: 47 linkInMenu: css(classes.linkInMenu, globalClassNames.linkInMenu, ...modifierClasses), +@fluentui/react-tabs: ~~~~~~~~~~ +@fluentui/react-tabs: src/next/Pivot.tsx:49:35 - error TS2339: Property 'linkIsSelected' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-tabs: 49 linkIsSelected: css(classes.linkIsSelected, globalClassNames.linkIsSelected), +@fluentui/react-tabs: ~~~~~~~~~~~~~~ +@fluentui/react-tabs: src/next/Pivot.tsx:50:32 - error TS2339: Property 'linkContent' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-tabs: 50 linkContent: css(classes.linkContent, globalClassNames.linkContent, ...modifierClasses), +@fluentui/react-tabs: ~~~~~~~~~~~ +@fluentui/react-tabs: src/next/Pivot.tsx:51:25 - error TS2339: Property 'text' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-tabs: 51 text: css(classes.text, globalClassNames.text, ...modifierClasses), +@fluentui/react-tabs: ~~~~ +@fluentui/react-tabs: src/next/Pivot.tsx:52:26 - error TS2339: Property 'count' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-tabs: 52 count: css(classes.count, globalClassNames.count, ...modifierClasses), +@fluentui/react-tabs: ~~~~~ +@fluentui/react-tabs: src/next/Pivot.tsx:54:34 - error TS2339: Property 'itemContainer' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-tabs: 54 itemContainer: css(classes.itemContainer, ...modifierClasses), +@fluentui/react-tabs: ~~~~~~~~~~~~~ +@fluentui/react-tabs: src/next/Pivot.tsx:55:39 - error TS2339: Property 'overflowMenuButton' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-tabs: 55 overflowMenuButton: css(classes.overflowMenuButton, globalClassNames.overflowMenuButton, ...modifierClasses), +@fluentui/react-tabs: ~~~~~~~~~~~~~~~~~~ +@fluentui/react-tabs: Found 11 errors. +@fluentui/react-tabs: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-tabs: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/react-tabs: [XX:XX:XX XM] x Other tasks that did not complete: [ts:esm] +@fluentui/react-tabs: error Command failed with exit code 1. +@fluentui/react-toggle: [XX:XX:XX XM] x Error detected while running '_wrapFunction' +@fluentui/react-toggle: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-toggle: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-toggle/tsconfig.json" +@fluentui/react-toggle: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/react-toggle: at ChildProcess.emit (events.js:314:20) +@fluentui/react-toggle: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/react-toggle: at maybeClose (internal/child_process.js:1021:16) +@fluentui/react-toggle: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/react-toggle: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/react-toggle: [XX:XX:XX XM] x stdout: +@fluentui/react-toggle: [XX:XX:XX XM] x src/next/Toggle.tsx:31:26 - error TS2339: Property 'checked' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-toggle: 31 checked && classes.checked, +@fluentui/react-toggle: ~~~~~~~ +@fluentui/react-toggle: src/next/Toggle.tsx:32:27 - error TS2339: Property 'disabled' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-toggle: 32 disabled && classes.disabled, +@fluentui/react-toggle: ~~~~~~~~ +@fluentui/react-toggle: src/next/Toggle.tsx:33:30 - error TS2339: Property 'inlineLabel' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-toggle: 33 inlineLabel && classes.inlineLabel, +@fluentui/react-toggle: ~~~~~~~~~~~ +@fluentui/react-toggle: src/next/Toggle.tsx:34:31 - error TS2339: Property 'onOffMissing' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-toggle: 34 onOffMissing && classes.onOffMissing, +@fluentui/react-toggle: ~~~~~~~~~~~~ +@fluentui/react-toggle: src/next/Toggle.tsx:40:36 - error TS2339: Property 'root' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-toggle: 40 root: css(className, classes.root, globalClassNames.root, ...rootStaticClasses, ...propControlledClasses), +@fluentui/react-toggle: ~~~~ +@fluentui/react-toggle: src/next/Toggle.tsx:41:26 - error TS2339: Property 'label' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-toggle: 41 label: css(classes.label, globalClassNames.label, ...propControlledClasses), +@fluentui/react-toggle: ~~~~~ +@fluentui/react-toggle: src/next/Toggle.tsx:42:30 - error TS2339: Property 'container' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-toggle: 42 container: css(classes.container, globalClassNames.container, ...propControlledClasses), +@fluentui/react-toggle: ~~~~~~~~~ +@fluentui/react-toggle: src/next/Toggle.tsx:43:25 - error TS2339: Property 'pill' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-toggle: 43 pill: css(classes.pill, globalClassNames.pill, ...propControlledClasses), +@fluentui/react-toggle: ~~~~ +@fluentui/react-toggle: src/next/Toggle.tsx:44:26 - error TS2339: Property 'thumb' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-toggle: 44 thumb: css(classes.thumb, globalClassNames.thumb, ...propControlledClasses), +@fluentui/react-toggle: ~~~~~ +@fluentui/react-toggle: src/next/Toggle.tsx:45:25 - error TS2339: Property 'text' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-toggle: 45 text: css(classes.text, globalClassNames.text, ...propControlledClasses), +@fluentui/react-toggle: ~~~~ +@fluentui/react-toggle: Found 10 errors. +@fluentui/react-toggle: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-toggle: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/react-toggle: [XX:XX:XX XM] x Other tasks that did not complete: [ts:esm] +@fluentui/react-toggle: error Command failed with exit code 1. +codesandbox-react-northstar-template: [XX:XX:XX XM] x Error detected while running 'ts:esm' +codesandbox-react-northstar-template: [XX:XX:XX XM] x ------------------------------------ +codesandbox-react-northstar-template: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/apps/codesandbox-react-northstar-template/tsconfig.json" +codesandbox-react-northstar-template: at ChildProcess.exithandler (child_process.js:308:12) +codesandbox-react-northstar-template: at ChildProcess.emit (events.js:314:20) +codesandbox-react-northstar-template: at ChildProcess.EventEmitter.emit (domain.js:506:15) +codesandbox-react-northstar-template: at maybeClose (internal/child_process.js:1021:16) +codesandbox-react-northstar-template: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +codesandbox-react-northstar-template: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +codesandbox-react-northstar-template: [XX:XX:XX XM] x stdout: +codesandbox-react-northstar-template: [XX:XX:XX XM] x src/index.tsx:15:8 - error TS2307: Cannot find module '@fluentui/react-northstar' or its corresponding type declarations. +codesandbox-react-northstar-template: 15 } from '@fluentui/react-northstar'; +codesandbox-react-northstar-template: ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +codesandbox-react-northstar-template: src/index.tsx:16:28 - error TS2307: Cannot find module '@fluentui/code-sandbox' or its corresponding type declarations. +codesandbox-react-northstar-template: 16 import { SandboxApp } from '@fluentui/code-sandbox'; +codesandbox-react-northstar-template: ~~~~~~~~~~~~~~~~~~~~~~~~ +codesandbox-react-northstar-template: Found 2 errors. +codesandbox-react-northstar-template: [XX:XX:XX XM] x ------------------------------------ +codesandbox-react-northstar-template: [XX:XX:XX XM] x Error previously detected. See above for error messages. +codesandbox-react-northstar-template: [XX:XX:XX XM] x Other tasks that did not complete: [ts:commonjs] +codesandbox-react-northstar-template: error Command failed with exit code 1. +@fluentui/react-builder: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/react-builder: [XX:XX:XX XM] x Command not defined: ts +@fluentui/react: [XX:XX:XX XM] x Error detected while running 'ts:esm' +@fluentui/react: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react/tsconfig.json" +@fluentui/react: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/react: at ChildProcess.emit (events.js:314:20) +@fluentui/react: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/react: at maybeClose (internal/child_process.js:1021:16) +@fluentui/react: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/react: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/react: [XX:XX:XX XM] x stdout: +@fluentui/react: [XX:XX:XX XM] x src/components/ComboBox/ComboBox.tsx:451:13 - error TS2554: Expected 1 arguments, but got 2. +@fluentui/react: 451 this._onRenderContainer, +@fluentui/react: ~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react: src/components/DetailsList/DetailsColumn.base.tsx:194:14 - error TS2790: The operand of a 'delete' operator must be optional. +@fluentui/react: 194 delete this._dragDropSubscription; +@fluentui/react: ~~~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react: src/components/DetailsList/DetailsColumn.base.tsx:208:14 - error TS2790: The operand of a 'delete' operator must be optional. +@fluentui/react: 208 delete this._dragDropSubscription; +@fluentui/react: ~~~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react: src/components/DetailsList/DetailsHeader.base.tsx:132:14 - error TS2790: The operand of a 'delete' operator must be optional. +@fluentui/react: 132 delete this._subscriptionObject; +@fluentui/react: ~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react: src/components/DetailsList/DetailsHeader.base.tsx:154:14 - error TS2790: The operand of a 'delete' operator must be optional. +@fluentui/react: 154 delete this._subscriptionObject; +@fluentui/react: ~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react: src/components/DetailsList/DetailsRow.base.tsx:118:16 - error TS2790: The operand of a 'delete' operator must be optional. +@fluentui/react: 118 delete this._dragDropSubscription; +@fluentui/react: ~~~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react: src/components/DetailsList/DetailsRow.base.tsx:156:14 - error TS2790: The operand of a 'delete' operator must be optional. +@fluentui/react: 156 delete this._dragDropSubscription; +@fluentui/react: ~~~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react: src/components/GroupedList/GroupedListSection.tsx:172:16 - error TS2790: The operand of a 'delete' operator must be optional. +@fluentui/react: 172 delete this._dragDropSubscription; +@fluentui/react: ~~~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react: Found 8 errors. +@fluentui/react: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/react: [XX:XX:XX XM] x Other tasks that did not complete: [ts:commonjs] +@fluentui/react: error Command failed with exit code 1. +@fluentui/docs: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/docs: [XX:XX:XX XM] x Command not defined: ts +@fluentui/react-experiments: [XX:XX:XX XM] x Error detected while running '_wrapFunction' +@fluentui/react-experiments: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-experiments: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/react-experiments/tsconfig.json" +@fluentui/react-experiments: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/react-experiments: at ChildProcess.emit (events.js:314:20) +@fluentui/react-experiments: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/react-experiments: at maybeClose (internal/child_process.js:1021:16) +@fluentui/react-experiments: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/react-experiments: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/react-experiments: [XX:XX:XX XM] x stdout: +@fluentui/react-experiments: [XX:XX:XX XM] x src/components/FloatingSuggestions/FloatingPeopleSuggestions/defaults/DefaultPeopleSuggestionsItem.tsx:12:72 - error TS2339: Property 'peoplePickerPersonaContent' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 12
+@fluentui/react-experiments: ~~~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/FloatingSuggestions/FloatingPeopleSuggestions/defaults/DefaultPeopleSuggestionsItem.tsx:16:64 - error TS2339: Property 'peoplePickerPersona' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 16 className={css('ms-PeoplePicker-Persona', stylesImport.peoplePickerPersona)} +@fluentui/react-experiments: ~~~~~~~~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/FloatingSuggestions/FloatingSuggestions.tsx:202:27 - error TS2339: Property 'callout' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 202 className={styles.callout} +@fluentui/react-experiments: ~~~~~~~ +@fluentui/react-experiments: src/components/SelectedItemsList/Items/subcomponents/DefaultEditingItem.tsx:75:102 - error TS2339: Property 'editingContainer' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 75 +@fluentui/react-experiments: ~~~~~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/SelectedItemsList/Items/subcomponents/DefaultEditingItem.tsx:86:29 - error TS2339: Property 'editingInput' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 86 className={styles.editingInput} +@fluentui/react-experiments: ~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/SelectedItemsList/SelectedPeopleList/SelectedPeopleList.test.tsx:94:9 - error TS2322: Type 'ComponentType>' is not assignable to type 'ComponentClass, any> | FunctionComponent> | undefined'. +@fluentui/react-experiments: Type 'ComponentClass, any>' is not assignable to type 'ComponentClass, any> | FunctionComponent> | undefined'. +@fluentui/react-experiments: Type 'ComponentClass, any>' is not assignable to type 'ComponentClass, any>'. +@fluentui/react-experiments: Types of property 'propTypes' are incompatible. +@fluentui/react-experiments: Type 'WeakValidationMap> | undefined' is not assignable to type 'WeakValidationMap> | undefined'. +@fluentui/react-experiments: Type 'WeakValidationMap>' is not assignable to type 'WeakValidationMap>'. +@fluentui/react-experiments: Types of property 'item' are incompatible. +@fluentui/react-experiments: Type 'Validator | undefined' is not assignable to type 'Validator | undefined'. +@fluentui/react-experiments: Type 'Validator' is not assignable to type 'Validator'. +@fluentui/react-experiments: Type 'unknown' is not assignable to type 'IPersonaProps & BaseSelectedItem'. +@fluentui/react-experiments: Type 'unknown' is not assignable to type 'IPersonaProps'. +@fluentui/react-experiments: 94 onRenderItem={SelectedItem} +@fluentui/react-experiments: ~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/SelectedItemsList/SelectedItemsList.types.ts:75:3 +@fluentui/react-experiments: 75 onRenderItem?: React.ComponentType>; +@fluentui/react-experiments: ~~~~~~~~~~~~ +@fluentui/react-experiments: The expected type comes from property 'onRenderItem' which is declared here on type 'IntrinsicAttributes & Pick, "onChange" | ... 16 more ... | "replaceItem"> & RefAttributes<...>' +@fluentui/react-experiments: src/components/StaticList/StaticList.tsx:14:37 - error TS2339: Property 'root' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 14 { className: css(stylesImport.root, className) }, +@fluentui/react-experiments: ~~~~ +@fluentui/react-experiments: src/components/Tile/Tile.tsx:175:97 - error TS2339: Property 'label' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 175 +@fluentui/react-experiments: ~~~~~ +@fluentui/react-experiments: src/components/Tile/Tile.tsx:253:68 - error TS2339: Property 'description' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 253 className={css('ms-Tile-description', TileStylesModule.description)} +@fluentui/react-experiments: ~~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signal.tsx:15:83 - error TS2339: Property 'signal' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 15 +@fluentui/react-experiments: ~~~~~~ +@fluentui/react-experiments: src/components/signals/SignalField.tsx:24:27 - error TS2339: Property 'signalField' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 24 SignalFieldStyles.signalField, +@fluentui/react-experiments: ~~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/SignalField.tsx:26:30 - error TS2339: Property 'wide' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 26 [SignalFieldStyles.wide]: signalsFieldMode === 'wide', +@fluentui/react-experiments: ~~~~ +@fluentui/react-experiments: src/components/signals/SignalField.tsx:27:30 - error TS2339: Property 'compact' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 27 [SignalFieldStyles.compact]: signalsFieldMode === 'compact', +@fluentui/react-experiments: ~~~~~~~ +@fluentui/react-experiments: src/components/signals/SignalField.tsx:33:42 - error TS2339: Property 'signalFieldValue' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 33 {props.children} +@fluentui/react-experiments: ~~~~~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:13:60 - error TS2339: Property 'youCheckedOut' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 13 return ; +@fluentui/react-experiments: ~~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:17:60 - error TS2339: Property 'blocked' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 17 return ; +@fluentui/react-experiments: ~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:24:34 - error TS2339: Property 'missingMetadata' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 24 signalClass={SignalsStyles.missingMetadata} +@fluentui/react-experiments: ~~~~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:31:60 - error TS2339: Property 'warning' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 31 return ; +@fluentui/react-experiments: ~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:35:60 - error TS2339: Property 'awaitingApproval' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 35 return ; +@fluentui/react-experiments: ~~~~~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:39:60 - error TS2339: Property 'trending' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 39 return ; +@fluentui/react-experiments: ~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:43:60 - error TS2339: Property 'someoneCheckedOut' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 43 return ; +@fluentui/react-experiments: ~~~~~~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:47:60 - error TS2339: Property 'record' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 47 return ; +@fluentui/react-experiments: ~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:51:60 - error TS2339: Property 'needsRepublishing' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 51 return ; +@fluentui/react-experiments: ~~~~~~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:55:60 - error TS2339: Property 'itemScheduled' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 55 return ; +@fluentui/react-experiments: ~~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:65:54 - error TS2339: Property 'signal' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 65 +@fluentui/react-experiments: ~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:65:76 - error TS2339: Property 'newSignal' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 65 +@fluentui/react-experiments: ~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:66:70 - error TS2339: Property 'newIcon' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 66 +@fluentui/react-experiments: ~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:77:58 - error TS2339: Property 'liveEdit' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 77 return ; +@fluentui/react-experiments: ~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:81:60 - error TS2339: Property 'mention' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 81 return ; +@fluentui/react-experiments: ~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:91:42 - error TS2339: Property 'comments' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 91 +@fluentui/react-experiments: ~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:92:70 - error TS2339: Property 'commentsIcon' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 92 +@fluentui/react-experiments: ~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:93:54 - error TS2339: Property 'commentsCount' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 93 {children ? {children} : null} +@fluentui/react-experiments: ~~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:102:60 - error TS2339: Property 'unseenReply' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 102 return ; +@fluentui/react-experiments: ~~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:106:60 - error TS2339: Property 'unseenEdit' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 106 return ; +@fluentui/react-experiments: ~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:110:60 - error TS2339: Property 'readOnly' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 110 return ; +@fluentui/react-experiments: ~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:114:60 - error TS2339: Property 'emailed' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 114 return ; +@fluentui/react-experiments: ~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:118:60 - error TS2339: Property 'shared' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 118 return ; +@fluentui/react-experiments: ~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:122:60 - error TS2339: Property 'folder' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 122 return ; +@fluentui/react-experiments: ~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:126:60 - error TS2339: Property 'folder' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 126 return ; +@fluentui/react-experiments: ~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:130:60 - error TS2339: Property 'folder' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 130 return ; +@fluentui/react-experiments: ~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:134:60 - error TS2339: Property 'malwareDetected' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 134 return ; +@fluentui/react-experiments: ~~~~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:143:60 - error TS2339: Property 'external' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 143 return ; +@fluentui/react-experiments: ~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:147:60 - error TS2339: Property 'bookmarkOutline' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 147 return ; +@fluentui/react-experiments: ~~~~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:151:60 - error TS2339: Property 'bookmarkFilled' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 151 return ; +@fluentui/react-experiments: ~~~~~~~~~~~~~~ +@fluentui/react-experiments: src/components/signals/Signals.tsx:169:82 - error TS2339: Property 'signal' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 169 +@fluentui/react-experiments: ~~~~~~ +@fluentui/react-experiments: src/utilities/scrolling/ScrollContainer.tsx:76:68 - error TS2339: Property 'root' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-experiments: 76 className={css('ms-ScrollContainer', ScrollContainerStyles.root, className)} +@fluentui/react-experiments: ~~~~ +@fluentui/react-experiments: Found 46 errors. +@fluentui/react-experiments: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-experiments: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/react-experiments: [XX:XX:XX XM] x Other tasks that did not complete: [ts:esm] +@fluentui/react-experiments: error Command failed with exit code 1. +@fluentui/react-monaco-editor: [XX:XX:XX XM] x Error detected while running 'ts:esm' +@fluentui/react-monaco-editor: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-monaco-editor: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-monaco-editor/tsconfig.json" +@fluentui/react-monaco-editor: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/react-monaco-editor: at ChildProcess.emit (events.js:314:20) +@fluentui/react-monaco-editor: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/react-monaco-editor: at maybeClose (internal/child_process.js:1021:16) +@fluentui/react-monaco-editor: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/react-monaco-editor: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/react-monaco-editor: [XX:XX:XX XM] x stdout: +@fluentui/react-monaco-editor: [XX:XX:XX XM] x ../monaco-editor/monaco-typescript.d.ts:8:25 - error TS2307: Cannot find module '@fluentui/monaco-editor' or its corresponding type declarations. +@fluentui/react-monaco-editor: 8 import * as monaco from '@fluentui/monaco-editor'; +@fluentui/react-monaco-editor: ~~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-monaco-editor: src/components/Editor.tsx:1:25 - error TS2307: Cannot find module '@fluentui/monaco-editor' or its corresponding type declarations. +@fluentui/react-monaco-editor: 1 import * as monaco from '@fluentui/monaco-editor'; +@fluentui/react-monaco-editor: ~~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-monaco-editor: src/components/TsxEditor.tsx:3:25 - error TS2307: Cannot find module '@fluentui/monaco-editor' or its corresponding type declarations. +@fluentui/react-monaco-editor: 3 import * as monaco from '@fluentui/monaco-editor'; +@fluentui/react-monaco-editor: ~~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-monaco-editor: src/interfaces/monaco.ts:5:25 - error TS2307: Cannot find module '@fluentui/monaco-editor/esm/vs/editor/editor.api' or its corresponding type declarations. +@fluentui/react-monaco-editor: 5 import * as monaco from '@fluentui/monaco-editor/esm/vs/editor/editor.api'; +@fluentui/react-monaco-editor: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-monaco-editor: src/transpiler/transpile.ts:2:25 - error TS2307: Cannot find module '@fluentui/monaco-editor' or its corresponding type declarations. +@fluentui/react-monaco-editor: 2 import * as monaco from '@fluentui/monaco-editor'; +@fluentui/react-monaco-editor: ~~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-monaco-editor: src/transpiler/transpile.ts:26:11 - error TS7006: Parameter 'worker' implicitly has an 'any' type. +@fluentui/react-monaco-editor: 26 .then(worker => { +@fluentui/react-monaco-editor: ~~~~~~ +@fluentui/react-monaco-editor: src/transpiler/transpile.ts:31:62 - error TS7006: Parameter 'syntacticDiagnostics' implicitly has an 'any' type. +@fluentui/react-monaco-editor: 31 return worker.getSyntacticDiagnostics(filename).then(syntacticDiagnostics => { +@fluentui/react-monaco-editor: ~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-monaco-editor: src/transpiler/transpile.ts:32:62 - error TS7006: Parameter 'd' implicitly has an 'any' type. +@fluentui/react-monaco-editor: 32 syntacticDiagnostics = syntacticDiagnostics.filter(d => d.category === 1 /*error*/); +@fluentui/react-monaco-editor: ~ +@fluentui/react-monaco-editor: src/transpiler/transpile.ts:50:12 - error TS7006: Parameter 'ex' implicitly has an 'any' type. +@fluentui/react-monaco-editor: 50 .catch(ex => { +@fluentui/react-monaco-editor: ~~ +@fluentui/react-monaco-editor: src/utilities/getQueryParam.test.ts:7:12 - error TS2790: The operand of a 'delete' operator must be optional. +@fluentui/react-monaco-editor: 7 delete window.location; +@fluentui/react-monaco-editor: ~~~~~~~~~~~~~~~ +@fluentui/react-monaco-editor: Found 10 errors. +@fluentui/react-monaco-editor: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-monaco-editor: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/react-monaco-editor: [XX:XX:XX XM] x Other tasks that did not complete: [ts:commonjs] +@fluentui/react-monaco-editor: error Command failed with exit code 1. +@fluentui/e2e: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/e2e: [XX:XX:XX XM] x Command not defined: ts +@fluentui/perf: [XX:XX:XX XM] x Cannot find config file "null". Please create a file called "just.config.js" in the root of the project next to "package.json". +@fluentui/perf: [XX:XX:XX XM] x Command not defined: ts +@fluentui/api-docs: [XX:XX:XX XM] x Error detected while running '_wrapFunction' +@fluentui/api-docs: [XX:XX:XX XM] x ------------------------------------ +@fluentui/api-docs: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib-commonjs --module commonjs --project "/office-ui-fabric-react/packages/api-docs/tsconfig.json" +@fluentui/api-docs: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/api-docs: at ChildProcess.emit (events.js:314:20) +@fluentui/api-docs: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/api-docs: at maybeClose (internal/child_process.js:1021:16) +@fluentui/api-docs: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/api-docs: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/api-docs: [XX:XX:XX XM] x stdout: +@fluentui/api-docs: [XX:XX:XX XM] x src/tableJson.ts:52:9 - error TS2322: Type 'readonly HeritageType[] | undefined' is not assignable to type 'HeritageType[] | undefined'. +@fluentui/api-docs: The type 'readonly HeritageType[]' is 'readonly' and cannot be assigned to the mutable type 'HeritageType[]'. +@fluentui/api-docs: 52 const extendsArr: HeritageType[] | undefined = +@fluentui/api-docs: ~~~~~~~~~~ +@fluentui/api-docs: Found 1 error. +@fluentui/api-docs: [XX:XX:XX XM] x ------------------------------------ +@fluentui/api-docs: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/api-docs: [XX:XX:XX XM] x Other tasks that did not complete: [ts:esm] +@fluentui/api-docs: error Command failed with exit code 1. +@fluentui/react-docsite-components: [XX:XX:XX XM] x Error detected while running 'ts:esm' +@fluentui/react-docsite-components: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-docsite-components: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-docsite-components/tsconfig.json" +@fluentui/react-docsite-components: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/react-docsite-components: at ChildProcess.emit (events.js:314:20) +@fluentui/react-docsite-components: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/react-docsite-components: at maybeClose (internal/child_process.js:1021:16) +@fluentui/react-docsite-components: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/react-docsite-components: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/react-docsite-components: [XX:XX:XX XM] x stdout: +@fluentui/react-docsite-components: [XX:XX:XX XM] x src/components/Page/Page.tsx:21:25 - error TS2307: Cannot find module './Page.module.scss' or its corresponding type declarations. +@fluentui/react-docsite-components: 21 import * as styles from './Page.module.scss'; +@fluentui/react-docsite-components: ~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-docsite-components: src/components/Page/sections/BestPracticesSection.tsx:7:25 - error TS2307: Cannot find module '../Page.module.scss' or its corresponding type declarations. +@fluentui/react-docsite-components: 7 import * as styles from '../Page.module.scss'; +@fluentui/react-docsite-components: ~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-docsite-components: src/components/Page/sections/ExamplesSection.tsx:4:25 - error TS2307: Cannot find module '../Page.module.scss' or its corresponding type declarations. +@fluentui/react-docsite-components: 4 import * as styles from '../Page.module.scss'; +@fluentui/react-docsite-components: ~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-docsite-components: src/components/Page/sections/FeedbackSection.tsx:5:25 - error TS2307: Cannot find module '../Page.module.scss' or its corresponding type declarations. +@fluentui/react-docsite-components: 5 import * as styles from '../Page.module.scss'; +@fluentui/react-docsite-components: ~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-docsite-components: src/components/Page/sections/ImplementationSection.tsx:5:25 - error TS2307: Cannot find module '../Page.module.scss' or its corresponding type declarations. +@fluentui/react-docsite-components: 5 import * as styles from '../Page.module.scss'; +@fluentui/react-docsite-components: ~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-docsite-components: src/components/Page/sections/MarkdownSection.tsx:7:25 - error TS2307: Cannot find module '../Page.module.scss' or its corresponding type declarations. +@fluentui/react-docsite-components: 7 import * as styles from '../Page.module.scss'; +@fluentui/react-docsite-components: ~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-docsite-components: src/components/Page/sections/OtherPageSection.tsx:4:25 - error TS2307: Cannot find module '../Page.module.scss' or its corresponding type declarations. +@fluentui/react-docsite-components: 4 import * as styles from '../Page.module.scss'; +@fluentui/react-docsite-components: ~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-docsite-components: src/components/Page/sections/OverviewSection.tsx:4:25 - error TS2307: Cannot find module '../Page.module.scss' or its corresponding type declarations. +@fluentui/react-docsite-components: 4 import * as styles from '../Page.module.scss'; +@fluentui/react-docsite-components: ~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-docsite-components: src/components/PlatformPicker/PlatformPicker.tsx:6:25 - error TS2307: Cannot find module './PlatformPicker.module.scss' or its corresponding type declarations. +@fluentui/react-docsite-components: 6 import * as styles from './PlatformPicker.module.scss'; +@fluentui/react-docsite-components: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-docsite-components: src/components/Table/Table.tsx:4:25 - error TS2307: Cannot find module './Table.module.scss' or its corresponding type declarations. +@fluentui/react-docsite-components: 4 import * as styles from './Table.module.scss'; +@fluentui/react-docsite-components: ~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-docsite-components: src/components/TopNav/TopNav.tsx:8:25 - error TS2307: Cannot find module './TopNav.module.scss' or its corresponding type declarations. +@fluentui/react-docsite-components: 8 import * as styles from './TopNav.module.scss'; +@fluentui/react-docsite-components: ~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-docsite-components: src/components/Video/Video.tsx:4:25 - error TS2307: Cannot find module './Video.module.scss' or its corresponding type declarations. +@fluentui/react-docsite-components: 4 import * as styles from './Video.module.scss'; +@fluentui/react-docsite-components: ~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-docsite-components: src/utilities/createDemoApp.tsx:52:71 - error TS2783: 'appDefinition' is specified more than once, so this usage will be overwritten. +@fluentui/react-docsite-components: 52 const App: React.FunctionComponent = props => ; +@fluentui/react-docsite-components: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@fluentui/react-docsite-components: src/utilities/createDemoApp.tsx:52:101 +@fluentui/react-docsite-components: 52 const App: React.FunctionComponent = props => ; +@fluentui/react-docsite-components: ~~~~~~~~~~ +@fluentui/react-docsite-components: This spread always overwrites this property. +@fluentui/react-docsite-components: Found 13 errors. +@fluentui/react-docsite-components: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-docsite-components: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/react-docsite-components: [XX:XX:XX XM] x Other tasks that did not complete: [ts:commonjs] +@fluentui/react-docsite-components: error Command failed with exit code 1. +theming-designer: [XX:XX:XX XM] x Error detected while running 'ts:esm' +theming-designer: [XX:XX:XX XM] x ------------------------------------ +theming-designer: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/apps/theming-designer/tsconfig.json" +theming-designer: at ChildProcess.exithandler (child_process.js:308:12) +theming-designer: at ChildProcess.emit (events.js:314:20) +theming-designer: at ChildProcess.EventEmitter.emit (domain.js:506:15) +theming-designer: at maybeClose (internal/child_process.js:1021:16) +theming-designer: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +theming-designer: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +theming-designer: [XX:XX:XX XM] x stdout: +theming-designer: [XX:XX:XX XM] x ../../packages/react-monaco-editor/lib/interfaces/monaco.d.ts:1:25 - error TS2307: Cannot find module '@fluentui/monaco-editor/esm/vs/editor/editor.api' or its corresponding type declarations. +theming-designer: 1 import * as monaco from '@fluentui/monaco-editor/esm/vs/editor/editor.api'; +theming-designer: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +theming-designer: Found 1 error. +theming-designer: [XX:XX:XX XM] x ------------------------------------ +theming-designer: [XX:XX:XX XM] x Error previously detected. See above for error messages. +theming-designer: [XX:XX:XX XM] x Other tasks that did not complete: [ts:commonjs] +theming-designer: error Command failed with exit code 1. +@fluentui/react-examples: [XX:XX:XX XM] x Error detected while running 'ts:esm' +@fluentui/react-examples: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-examples: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/packages/react-examples/tsconfig.json" +@fluentui/react-examples: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/react-examples: at ChildProcess.emit (events.js:314:20) +@fluentui/react-examples: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/react-examples: at maybeClose (internal/child_process.js:1021:16) +@fluentui/react-examples: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/react-examples: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/react-examples: [XX:XX:XX XM] x stdout: +@fluentui/react-examples: [XX:XX:XX XM] x src/date-time/WeeklyDayPicker/WeeklyDayPicker.Inline.Example.tsx:22:30 - error TS2339: Property 'wrapper' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 22
+@fluentui/react-examples: ~~~~~~~ +@fluentui/react-examples: src/date-time/WeeklyDayPicker/WeeklyDayPicker.Inline.Example.tsx:34:44 - error TS2339: Property 'button' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 34 +@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/date-time/WeeklyDayPicker/WeeklyDayPicker.Inline.Example.tsx:35:44 - error TS2339: Property 'button' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 35 +@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/date-time/WeeklyDayPicker/WeeklyDayPicker.Inline.Expandable.Example.tsx:27:30 - error TS2339: Property 'wrapper' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 27
+@fluentui/react-examples: ~~~~~~~ +@fluentui/react-examples: src/date-time/WeeklyDayPicker/WeeklyDayPicker.Inline.Expandable.Example.tsx:34:31 - error TS2339: Property 'button' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 34 className={styles.button} +@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/date-time/WeeklyDayPicker/WeeklyDayPicker.Inline.Expandable.Example.tsx:49:44 - error TS2339: Property 'button' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 49 +@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/date-time/WeeklyDayPicker/WeeklyDayPicker.Inline.Expandable.Example.tsx:50:44 - error TS2339: Property 'button' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 50 +@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-avatar/utils/StoryExample.tsx:5:27 - error TS2339: Property 'root' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 5
+@fluentui/react-examples: ~~~~ +@fluentui/react-examples: src/react-avatar/utils/StoryExample.tsx:7:29 - error TS2339: Property 'content' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 7
{children}
+@fluentui/react-examples: ~~~~~~~ +@fluentui/react-examples: src/react-button/Button/Button.stories.tsx:12:57 - error TS2339: Property 'hStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 12 return
; +@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-button/Button/Button.stories.tsx:12:74 - error TS2339: Property 'vStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 12 return
; +@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-button/Button/Button.stories.tsx:19:88 - error TS2339: Property 'text' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 19 const Text = (props: React.PropsWithChildren<{}>) =>

; +@fluentui/react-examples: ~~~~ +@fluentui/react-examples: src/react-button/CompoundButton/CompoundButton.stories.tsx:11:57 - error TS2339: Property 'hStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 11 return
; +@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-button/CompoundButton/CompoundButton.stories.tsx:11:74 - error TS2339: Property 'vStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 11 return
; +@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-button/CompoundButton/CompoundButton.stories.tsx:18:88 - error TS2339: Property 'text' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 18 const Text = (props: React.PropsWithChildren<{}>) =>

; +@fluentui/react-examples: ~~~~ +@fluentui/react-examples: src/react-button/MenuButton/MenuButton.stories.tsx:24:27 - error TS2339: Property 'hStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 24
+@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-button/MenuButton/MenuButton.stories.tsx:61:29 - error TS2339: Property 'vStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 61
+@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-button/MenuButton/MenuButton.stories.tsx:75:29 - error TS2339: Property 'vStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 75
+@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-button/SplitButton/SplitButton.stories.tsx:20:27 - error TS2339: Property 'hStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 20
+@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-button/SplitButton/SplitButton.stories.tsx:69:29 - error TS2339: Property 'vStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 69
+@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-button/ToggleButton/ToggleButton.stories.tsx:7:27 - error TS2339: Property 'hStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 7
+@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-button/ToggleButton/ToggleButton.stories.tsx:44:29 - error TS2339: Property 'vStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 44
+@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-button/ToggleButton/ToggleButton.stories.tsx:55:29 - error TS2339: Property 'vStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 55
+@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-button/ToggleButton/ToggleButton.stories.tsx:64:29 - error TS2339: Property 'vStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 64
+@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-cards/next/Card/Card.stories.tsx:15:57 - error TS2339: Property 'hStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 15 return
; +@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-cards/next/Card/Card.stories.tsx:15:74 - error TS2339: Property 'vStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 15 return
; +@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-experiments/Tile/Tile.Folder.Example.tsx:85:56 - error TS2339: Property 'tileFolder' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 85 +@fluentui/react-examples: ~~~~~~~~~~ +@fluentui/react-examples: src/react-experiments/Tile/Tile.Media.Example.tsx:21:50 - error TS2339: Property 'activityBlock' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 21 +@fluentui/react-examples: ~~~~~~~~~~~~~ +@fluentui/react-examples: src/react-experiments/Tile/Tile.Media.Example.tsx:41:50 - error TS2339: Property 'activityBlock' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 41 +@fluentui/react-examples: ~~~~~~~~~~~~~ +@fluentui/react-examples: src/react-experiments/Tile/Tile.Media.Example.tsx:61:50 - error TS2339: Property 'activityBlock' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 61 +@fluentui/react-examples: ~~~~~~~~~~~~~ +@fluentui/react-examples: src/react-experiments/Tile/Tile.Media.Example.tsx:81:50 - error TS2339: Property 'activityBlock' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 81 +@fluentui/react-examples: ~~~~~~~~~~~~~ +@fluentui/react-examples: src/react-experiments/VirtualizedList/VirtualizedList.Basic.Example.tsx:33:72 - error TS2339: Property 'fixedHeight' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 33 +@fluentui/react-examples: ~~~~~~~~~~~ +@fluentui/react-examples: src/react-experiments/VirtualizedList/VirtualizedList.Basic2.Example.tsx:39:98 - error TS2339: Property 'fixedHeight' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 39 +@fluentui/react-examples: ~~~~~~~~~~~ +@fluentui/react-examples: src/react-image/Image/Image.stories.tsx:11:57 - error TS2339: Property 'hStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 11 return
; +@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: src/react-image/Image/Image.stories.tsx:11:74 - error TS2339: Property 'vStack' does not exist on type 'typeof import("*.scss")'. +@fluentui/react-examples: 11 return
; +@fluentui/react-examples: ~~~~~~ +@fluentui/react-examples: Found 35 errors. +@fluentui/react-examples: [XX:XX:XX XM] x ------------------------------------ +@fluentui/react-examples: [XX:XX:XX XM] x Error previously detected. See above for error messages. +@fluentui/react-examples: [XX:XX:XX XM] x Other tasks that did not complete: [ts:commonjs] +@fluentui/react-examples: error Command failed with exit code 1. +@fluentui/public-docsite: [XX:XX:XX XM] x Error detected while running 'ts:esm' +@fluentui/public-docsite: [XX:XX:XX XM] x ------------------------------------ +@fluentui/public-docsite: [XX:XX:XX XM] x Error: Command failed: /usr/local/bin/node "/office-ui-fabric-react/node_modules/typescript/lib/tsc.js" --pretty --target es5 --outDir lib --module esnext --project "/office-ui-fabric-react/apps/public-docsite/tsconfig.json" +@fluentui/public-docsite: at ChildProcess.exithandler (child_process.js:308:12) +@fluentui/public-docsite: at ChildProcess.emit (events.js:314:20) +@fluentui/public-docsite: at ChildProcess.EventEmitter.emit (domain.js:506:15) +@fluentui/public-docsite: at maybeClose (internal/child_process.js:1021:16) +@fluentui/public-docsite: at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) +@fluentui/public-docsite: at Process.callbackTrampoline (internal/async_hooks.js:126:14) +@fluentui/public-docsite: [XX:XX:XX XM] x stdout: +@fluentui/public-docsite: [XX:XX:XX XM] x src/components/Nav/Nav.tsx:69:35 - error TS2339: Property 'navWrapper' does not exist on type 'typeof import("*.scss")'. +@fluentui/public-docsite: 69 return
{this._renderPageNav(pages)}
; +@fluentui/public-docsite: ~~~~~~~~~~ +@fluentui/public-docsite: src/components/Nav/Nav.tsx:86:34 - error TS2339: Property 'nav' does not exist on type 'typeof import("*.scss")'. +@fluentui/public-docsite: 86