From c999a87f7ab8041a9f2a921d41d97075ac1776fe Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 16 Jun 2025 15:45:46 -0700 Subject: [PATCH 1/9] Update dependencies (#1185) --- .dprint.jsonc | 2 +- NOTICE.txt | 2 +- _tools/go.mod | 8 +- _tools/go.sum | 16 +- go.mod | 2 +- go.sum | 4 +- package-lock.json | 761 ++++++++++++++++++++++++++++------------------ 7 files changed, 485 insertions(+), 310 deletions(-) diff --git a/.dprint.jsonc b/.dprint.jsonc index 92befa51e5..c4352b346a 100644 --- a/.dprint.jsonc +++ b/.dprint.jsonc @@ -59,7 +59,7 @@ // Note: if adding new languages, make sure settings.template.json is updated too. // Also, if updating typescript, update the one in package.json. "plugins": [ - "https://plugins.dprint.dev/typescript-0.95.5.wasm", + "https://plugins.dprint.dev/typescript-0.95.7.wasm", "https://plugins.dprint.dev/json-0.20.0.wasm", "https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.1.wasm", "https://plugins.dprint.dev/exec-0.5.1.json@492414e39dea4dccc07b4af796d2f4efdb89e84bae2bd4e1e924c0cc050855bf" diff --git a/NOTICE.txt b/NOTICE.txt index d04bc33fde..4a13eb8af6 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -264,7 +264,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------- -golang.org/x/sync v0.14.0 - BSD-3-Clause +golang.org/x/sync v0.15.0 - BSD-3-Clause Copyright 2009 The Go Authors. diff --git a/_tools/go.mod b/_tools/go.mod index 03fe29ace6..71a647aee5 100644 --- a/_tools/go.mod +++ b/_tools/go.mod @@ -3,13 +3,13 @@ module github.com/microsoft/typescript-go/_tools go 1.24.0 require ( - github.com/golangci/plugin-module-register v0.1.2-0.20250519122030-95854f10c778 - golang.org/x/mod v0.24.0 - golang.org/x/tools v0.33.0 + github.com/golangci/plugin-module-register v0.1.2 + golang.org/x/mod v0.25.0 + golang.org/x/tools v0.34.0 gotest.tools/v3 v3.5.2 ) require ( github.com/google/go-cmp v0.6.0 // indirect - golang.org/x/sync v0.14.0 // indirect + golang.org/x/sync v0.15.0 // indirect ) diff --git a/_tools/go.sum b/_tools/go.sum index a70bf1c86f..448f8c3839 100644 --- a/_tools/go.sum +++ b/_tools/go.sum @@ -1,12 +1,12 @@ -github.com/golangci/plugin-module-register v0.1.2-0.20250519122030-95854f10c778 h1:a5T2fJwhfuTPuhCau4IPP4ZGGndS/ysLzDorg1mA2P4= -github.com/golangci/plugin-module-register v0.1.2-0.20250519122030-95854f10c778/go.mod h1:1+QGTsKBvAIvPvoY/os+G5eoqxWn70HYDm2uvUyGuVw= +github.com/golangci/plugin-module-register v0.1.2 h1:e5WM6PO6NIAEcij3B053CohVp3HIYbzSuP53UAYgOpg= +github.com/golangci/plugin-module-register v0.1.2/go.mod h1:1+QGTsKBvAIvPvoY/os+G5eoqxWn70HYDm2uvUyGuVw= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= -golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= -golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= -golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc= -golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI= +golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= +golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= +golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= +golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= +golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q= gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA= diff --git a/go.mod b/go.mod index 17708b2bc0..0c7f7420a8 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-json-experiment/json v0.0.0-20250517221953-25912455fbc8 github.com/google/go-cmp v0.7.0 github.com/peter-evans/patience v0.3.0 - golang.org/x/sync v0.14.0 + golang.org/x/sync v0.15.0 golang.org/x/sys v0.33.0 gotest.tools/v3 v3.5.2 ) diff --git a/go.sum b/go.sum index 27d22a1f29..96fbae77b7 100644 --- a/go.sum +++ b/go.sum @@ -20,8 +20,8 @@ github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0t github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= -golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= -golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= +golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/tools v0.32.0 h1:Q7N1vhpkQv7ybVzLFtTjvQya2ewbwNDZzUgfXGqtMWU= diff --git a/package-lock.json b/package-lock.json index 0857524fd4..c52f9d3c9a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -130,9 +130,9 @@ } }, "node_modules/@azure/core-rest-pipeline": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.20.0.tgz", - "integrity": "sha512-ASoP8uqZBS3H/8N8at/XwFr6vYrRP3syTK0EUjDXQy0Y1/AUS+QeIRThKmTNJO2RggvBBxaXDPM7YoIwDGeA0g==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.21.0.tgz", + "integrity": "sha512-a4MBwe/5WKbq9MIxikzgxLBbruC5qlkFYlBdI7Ev50Y7ib5Vo/Jvt5jnJo7NaWeJ908LCHL0S1Us4UMf1VoTfg==", "dev": true, "dependencies": { "@azure/abort-controller": "^2.0.0", @@ -140,7 +140,7 @@ "@azure/core-tracing": "^1.0.1", "@azure/core-util": "^1.11.0", "@azure/logger": "^1.0.0", - "@typespec/ts-http-runtime": "^0.2.2", + "@typespec/ts-http-runtime": "^0.2.3", "tslib": "^2.6.2" }, "engines": { @@ -174,9 +174,9 @@ } }, "node_modules/@azure/identity": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.10.0.tgz", - "integrity": "sha512-iT53Sre2NJK6wzMWnvpjNiR3md597LZ3uK/5kQD2TkrY9vqhrY5bt2KwELNjkOWQ9n8S/92knj/QEykTtjMNqQ==", + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.10.1.tgz", + "integrity": "sha512-YM/z6RxRtFlXUH2egAYF/FDPes+MUE6ZoknjEdaq7ebJMMNUzn9zCJ3bd2ZZZlkP0r1xKa88kolhFH/FGV7JnA==", "dev": true, "dependencies": { "@azure/abort-controller": "^2.0.0", @@ -209,9 +209,9 @@ } }, "node_modules/@azure/msal-browser": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.13.0.tgz", - "integrity": "sha512-n2ySryLd+wHmm/0Y1mwFI4J9UXVCu2DeWKtoWNWLVcpvK2k0Ez1qIigKleUm2ZfTbfAXdue+V8htmFft0qgyGQ==", + "version": "4.13.1", + "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.13.1.tgz", + "integrity": "sha512-oTp2zhVljB2CRp87swOTsBcqLDrvZq9In+yDMBzuuMN4z2wrIU6ITHBZlLfs+FaAVmM1zY3k7ITekXaJ2bsDKA==", "dev": true, "dependencies": { "@azure/msal-common": "15.7.0" @@ -783,6 +783,27 @@ "node": ">=18" } }, + "node_modules/@isaacs/balanced-match": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", + "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", + "dev": true, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/brace-expansion": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", + "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", + "dev": true, + "dependencies": { + "@isaacs/balanced-match": "^4.0.1" + }, + "engines": { + "node": "20 || >=22" + } + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -1104,24 +1125,24 @@ } }, "node_modules/@textlint/ast-node-types": { - "version": "14.7.2", - "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-14.7.2.tgz", - "integrity": "sha512-3rZc9vD8y/DlcFe3Y/cyKRRVgBH4ElEUzVFYdRVDwoMSwV/cIyZgYzVG6ZuOItQt+cHSREuijuucZ4VqZynbtg==", + "version": "14.8.4", + "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-14.8.4.tgz", + "integrity": "sha512-+fI7miec/r9VeniFV9ppL4jRCmHNsTxieulTUf/4tvGII3db5hGriKHC4p/diq1SkQ9Sgs7kg6UyydxZtpTz1Q==", "dev": true }, "node_modules/@textlint/linter-formatter": { - "version": "14.7.2", - "resolved": "https://registry.npmjs.org/@textlint/linter-formatter/-/linter-formatter-14.7.2.tgz", - "integrity": "sha512-QZOqft5uK+o/UN8UcEF3cHgfbG1r3+OWqlJojyjGNkEBbBNPSyDfYlVxDjHqnOAwm7jBaeqVGlwvw/7PUFmsmw==", + "version": "14.8.4", + "resolved": "https://registry.npmjs.org/@textlint/linter-formatter/-/linter-formatter-14.8.4.tgz", + "integrity": "sha512-sZ0UfYRDBNHnfMVBqLqqYnqTB7Ec169ljlmo+SEHR1T+dHUPYy1/DZK4p7QREXlBSFL4cnkswETCbc9xRodm4Q==", "dev": true, "dependencies": { "@azu/format-text": "^1.0.2", "@azu/style-format": "^1.0.1", - "@textlint/module-interop": "^14.7.2", - "@textlint/resolver": "^14.7.2", - "@textlint/types": "^14.7.2", + "@textlint/module-interop": "14.8.4", + "@textlint/resolver": "14.8.4", + "@textlint/types": "14.8.4", "chalk": "^4.1.2", - "debug": "^4.4.0", + "debug": "^4.4.1", "js-yaml": "^3.14.1", "lodash": "^4.17.21", "pluralize": "^2.0.0", @@ -1249,24 +1270,24 @@ } }, "node_modules/@textlint/module-interop": { - "version": "14.7.2", - "resolved": "https://registry.npmjs.org/@textlint/module-interop/-/module-interop-14.7.2.tgz", - "integrity": "sha512-rDQhFERa2+xMqhyrPFvAL9d5Tb4RpQGKQExwrezvtCTREh6Zsp/nKxtK0r6o0P9xn1+zq2sZHW9NZjpe7av3xw==", + "version": "14.8.4", + "resolved": "https://registry.npmjs.org/@textlint/module-interop/-/module-interop-14.8.4.tgz", + "integrity": "sha512-1LdPYLAVpa27NOt6EqvuFO99s4XLB0c19Hw9xKSG6xQ1K82nUEyuWhzTQKb3KJ5Qx7qj14JlXZLfnEuL6A16Bw==", "dev": true }, "node_modules/@textlint/resolver": { - "version": "14.7.2", - "resolved": "https://registry.npmjs.org/@textlint/resolver/-/resolver-14.7.2.tgz", - "integrity": "sha512-FCZa9XJx5KihK/4gxXLhS/KfOnBD6vD5UxAMtgrvbifn+JFrW9Kh17uZLCcuJDDJJCnZOHq8jdT7AU+rpmJZ+w==", + "version": "14.8.4", + "resolved": "https://registry.npmjs.org/@textlint/resolver/-/resolver-14.8.4.tgz", + "integrity": "sha512-nMDOgDAVwNU9ommh+Db0U+MCMNDPbQ/1HBNjbnHwxZkCpcT6hsAJwBe38CW/DtWVUv8yeR4R40IYNPT84srNwA==", "dev": true }, "node_modules/@textlint/types": { - "version": "14.7.2", - "resolved": "https://registry.npmjs.org/@textlint/types/-/types-14.7.2.tgz", - "integrity": "sha512-VpsmtJf9+7cnIxmKtAVVGVzI6f2k09kBZnzjdTAO8JZ+HTmV46jeoVrotpSfQbWDpuQk2UFPfrsZL/LNf/99ew==", + "version": "14.8.4", + "resolved": "https://registry.npmjs.org/@textlint/types/-/types-14.8.4.tgz", + "integrity": "sha512-9nyY8vVXlr8hHKxa6+37omJhXWCwovMQcgMteuldYd4dOxGm14AK2nXdkgtKEUQnzLGaXy46xwLCfhQy7V7/YA==", "dev": true, "dependencies": { - "@textlint/ast-node-types": "^14.7.2" + "@textlint/ast-node-types": "14.8.4" } }, "node_modules/@types/adm-zip": { @@ -1279,12 +1300,12 @@ } }, "node_modules/@types/node": { - "version": "22.15.29", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.29.tgz", - "integrity": "sha512-LNdjOkUDlU1RZb8e1kOIUpN1qQUlzGkEtbVNo53vbrwDg5om6oduhm4SiUaPW5ASTXhAiP0jInWG8Qx9fVlOeQ==", + "version": "24.0.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.3.tgz", + "integrity": "sha512-R4I/kzCYAdRLzfiCabn9hxWfbuHS573x+r0dJMkkzThEa7pbrcDWK+9zu3e7aBOouf+rQAciqPFMnxwr0aWgKg==", "dev": true, "dependencies": { - "undici-types": "~6.21.0" + "undici-types": "~7.8.0" } }, "node_modules/@types/normalize-package-data": { @@ -1300,9 +1321,9 @@ "dev": true }, "node_modules/@types/vscode": { - "version": "1.100.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.100.0.tgz", - "integrity": "sha512-4uNyvzHoraXEeCamR3+fzcBlh7Afs4Ifjs4epINyUX/jvdk0uzLnwiDY35UKDKnkCHP5Nu3dljl2H8lR6s+rQw==", + "version": "1.101.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.101.0.tgz", + "integrity": "sha512-ZWf0IWa+NGegdW3iU42AcDTFHWW7fApLdkdnBqwYEtHVIBGbTu0ZNQKP/kX3Ds/uMJXIMQNAojHR4vexCEEz5Q==", "dev": true }, "node_modules/@types/which": { @@ -1324,9 +1345,9 @@ "link": true }, "node_modules/@typespec/ts-http-runtime": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.2.2.tgz", - "integrity": "sha512-Gz/Sm64+Sq/vklJu1tt9t+4R2lvnud8NbTD/ZfpZtMiUX7YeVpCA8j6NSW8ptwcoLL+NmYANwqP8DV0q/bwl2w==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.2.3.tgz", + "integrity": "sha512-oRhjSzcVjX8ExyaF8hC0zzTqxlVuRlgMHL/Bh4w3xB9+wjbm0FpXylVU/lBrn+kgphwYTrOk3tp+AVShGmlYCg==", "dev": true, "dependencies": { "http-proxy-agent": "^7.0.0", @@ -1338,19 +1359,19 @@ } }, "node_modules/@vscode/vsce": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-3.4.2.tgz", - "integrity": "sha512-U2gC7GiQc22nxRpWH4cdW16rRr5u9w+Bjsjm8g8mEjY4aeOG1U6/3XNGq+ElwdeoT8jAyhBmBAuYG7INcSe/6A==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-3.5.0.tgz", + "integrity": "sha512-2Eb6fBh8OzNhWqviCjeUPA1MW+d2GCb1QlVxrpOR8lrLHGk8x7HD4LbfELnZPyOz2X33Myz9FE9t4LwYbmeMRg==", "dev": true, "dependencies": { "@azure/identity": "^4.1.0", - "@secretlint/node": "^9.3.2", - "@secretlint/secretlint-formatter-sarif": "^9.3.2", - "@secretlint/secretlint-rule-no-dotenv": "^9.3.2", - "@secretlint/secretlint-rule-preset-recommend": "^9.3.2", + "@secretlint/node": "^9.3.4", + "@secretlint/secretlint-formatter-sarif": "^9.3.4", + "@secretlint/secretlint-rule-no-dotenv": "^9.3.4", + "@secretlint/secretlint-rule-preset-recommend": "^9.3.4", "@vscode/vsce-sign": "^2.0.0", "azure-devops-node-api": "^12.5.0", - "chalk": "^2.4.2", + "chalk": "^4.1.2", "cheerio": "^1.0.0-rc.9", "cockatiel": "^3.1.2", "commander": "^12.1.0", @@ -1364,7 +1385,7 @@ "minimatch": "^3.0.3", "parse-semver": "^1.1.1", "read": "^1.0.7", - "secretlint": "^9.3.2", + "secretlint": "^9.3.4", "semver": "^7.5.2", "tmp": "^0.2.3", "typed-rest-client": "^1.8.4", @@ -1384,27 +1405,27 @@ } }, "node_modules/@vscode/vsce-sign": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign/-/vsce-sign-2.0.5.tgz", - "integrity": "sha512-GfYWrsT/vypTMDMgWDm75iDmAOMe7F71sZECJ+Ws6/xyIfmB3ELVnVN+LwMFAvmXY+e6eWhR2EzNGF/zAhWY3Q==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign/-/vsce-sign-2.0.6.tgz", + "integrity": "sha512-j9Ashk+uOWCDHYDxgGsqzKq5FXW9b9MW7QqOIYZ8IYpneJclWTBeHZz2DJCSKQgo+JAqNcaRRE1hzIx0dswqAw==", "dev": true, "hasInstallScript": true, "optionalDependencies": { - "@vscode/vsce-sign-alpine-arm64": "2.0.2", - "@vscode/vsce-sign-alpine-x64": "2.0.2", - "@vscode/vsce-sign-darwin-arm64": "2.0.2", - "@vscode/vsce-sign-darwin-x64": "2.0.2", - "@vscode/vsce-sign-linux-arm": "2.0.2", - "@vscode/vsce-sign-linux-arm64": "2.0.2", - "@vscode/vsce-sign-linux-x64": "2.0.2", - "@vscode/vsce-sign-win32-arm64": "2.0.2", - "@vscode/vsce-sign-win32-x64": "2.0.2" + "@vscode/vsce-sign-alpine-arm64": "2.0.5", + "@vscode/vsce-sign-alpine-x64": "2.0.5", + "@vscode/vsce-sign-darwin-arm64": "2.0.5", + "@vscode/vsce-sign-darwin-x64": "2.0.5", + "@vscode/vsce-sign-linux-arm": "2.0.5", + "@vscode/vsce-sign-linux-arm64": "2.0.5", + "@vscode/vsce-sign-linux-x64": "2.0.5", + "@vscode/vsce-sign-win32-arm64": "2.0.5", + "@vscode/vsce-sign-win32-x64": "2.0.5" } }, "node_modules/@vscode/vsce-sign-alpine-arm64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-arm64/-/vsce-sign-alpine-arm64-2.0.2.tgz", - "integrity": "sha512-E80YvqhtZCLUv3YAf9+tIbbqoinWLCO/B3j03yQPbjT3ZIHCliKZlsy1peNc4XNZ5uIb87Jn0HWx/ZbPXviuAQ==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-arm64/-/vsce-sign-alpine-arm64-2.0.5.tgz", + "integrity": "sha512-XVmnF40APwRPXSLYA28Ye+qWxB25KhSVpF2eZVtVOs6g7fkpOxsVnpRU1Bz2xG4ySI79IRuapDJoAQFkoOgfdQ==", "cpu": [ "arm64" ], @@ -1415,9 +1436,9 @@ ] }, "node_modules/@vscode/vsce-sign-alpine-x64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-x64/-/vsce-sign-alpine-x64-2.0.2.tgz", - "integrity": "sha512-n1WC15MSMvTaeJ5KjWCzo0nzjydwxLyoHiMJHu1Ov0VWTZiddasmOQHekA47tFRycnt4FsQrlkSCTdgHppn6bw==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-x64/-/vsce-sign-alpine-x64-2.0.5.tgz", + "integrity": "sha512-JuxY3xcquRsOezKq6PEHwCgd1rh1GnhyH6urVEWUzWn1c1PC4EOoyffMD+zLZtFuZF5qR1I0+cqDRNKyPvpK7Q==", "cpu": [ "x64" ], @@ -1428,9 +1449,9 @@ ] }, "node_modules/@vscode/vsce-sign-darwin-arm64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-arm64/-/vsce-sign-darwin-arm64-2.0.2.tgz", - "integrity": "sha512-rz8F4pMcxPj8fjKAJIfkUT8ycG9CjIp888VY/6pq6cuI2qEzQ0+b5p3xb74CJnBbSC0p2eRVoe+WgNCAxCLtzQ==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-arm64/-/vsce-sign-darwin-arm64-2.0.5.tgz", + "integrity": "sha512-z2Q62bk0ptADFz8a0vtPvnm6vxpyP3hIEYMU+i1AWz263Pj8Mc38cm/4sjzxu+LIsAfhe9HzvYNS49lV+KsatQ==", "cpu": [ "arm64" ], @@ -1441,9 +1462,9 @@ ] }, "node_modules/@vscode/vsce-sign-darwin-x64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-x64/-/vsce-sign-darwin-x64-2.0.2.tgz", - "integrity": "sha512-MCjPrQ5MY/QVoZ6n0D92jcRb7eYvxAujG/AH2yM6lI0BspvJQxp0o9s5oiAM9r32r9tkLpiy5s2icsbwefAQIw==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-x64/-/vsce-sign-darwin-x64-2.0.5.tgz", + "integrity": "sha512-ma9JDC7FJ16SuPXlLKkvOD2qLsmW/cKfqK4zzM2iJE1PbckF3BlR08lYqHV89gmuoTpYB55+z8Y5Fz4wEJBVDA==", "cpu": [ "x64" ], @@ -1454,9 +1475,9 @@ ] }, "node_modules/@vscode/vsce-sign-linux-arm": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm/-/vsce-sign-linux-arm-2.0.2.tgz", - "integrity": "sha512-Fkb5jpbfhZKVw3xwR6t7WYfwKZktVGNXdg1m08uEx1anO0oUPUkoQRsNm4QniL3hmfw0ijg00YA6TrxCRkPVOQ==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm/-/vsce-sign-linux-arm-2.0.5.tgz", + "integrity": "sha512-cdCwtLGmvC1QVrkIsyzv01+o9eR+wodMJUZ9Ak3owhcGxPRB53/WvrDHAFYA6i8Oy232nuen1YqWeEohqBuSzA==", "cpu": [ "arm" ], @@ -1467,9 +1488,9 @@ ] }, "node_modules/@vscode/vsce-sign-linux-arm64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm64/-/vsce-sign-linux-arm64-2.0.2.tgz", - "integrity": "sha512-Ybeu7cA6+/koxszsORXX0OJk9N0GgfHq70Wqi4vv2iJCZvBrOWwcIrxKjvFtwyDgdeQzgPheH5nhLVl5eQy7WA==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm64/-/vsce-sign-linux-arm64-2.0.5.tgz", + "integrity": "sha512-Hr1o0veBymg9SmkCqYnfaiUnes5YK6k/lKFA5MhNmiEN5fNqxyPUCdRZMFs3Ajtx2OFW4q3KuYVRwGA7jdLo7Q==", "cpu": [ "arm64" ], @@ -1480,9 +1501,9 @@ ] }, "node_modules/@vscode/vsce-sign-linux-x64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-x64/-/vsce-sign-linux-x64-2.0.2.tgz", - "integrity": "sha512-NsPPFVtLaTlVJKOiTnO8Cl78LZNWy0Q8iAg+LlBiCDEgC12Gt4WXOSs2pmcIjDYzj2kY4NwdeN1mBTaujYZaPg==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-x64/-/vsce-sign-linux-x64-2.0.5.tgz", + "integrity": "sha512-XLT0gfGMcxk6CMRLDkgqEPTyG8Oa0OFe1tPv2RVbphSOjFWJwZgK3TYWx39i/7gqpDHlax0AP6cgMygNJrA6zg==", "cpu": [ "x64" ], @@ -1493,9 +1514,9 @@ ] }, "node_modules/@vscode/vsce-sign-win32-arm64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-arm64/-/vsce-sign-win32-arm64-2.0.2.tgz", - "integrity": "sha512-wPs848ymZ3Ny+Y1Qlyi7mcT6VSigG89FWQnp2qRYCyMhdJxOpA4lDwxzlpL8fG6xC8GjQjGDkwbkWUcCobvksQ==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-arm64/-/vsce-sign-win32-arm64-2.0.5.tgz", + "integrity": "sha512-hco8eaoTcvtmuPhavyCZhrk5QIcLiyAUhEso87ApAWDllG7djIrWiOCtqn48k4pHz+L8oCQlE0nwNHfcYcxOPw==", "cpu": [ "arm64" ], @@ -1506,9 +1527,9 @@ ] }, "node_modules/@vscode/vsce-sign-win32-x64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-x64/-/vsce-sign-win32-x64-2.0.2.tgz", - "integrity": "sha512-pAiRN6qSAhDM5SVOIxgx+2xnoVUePHbRNC7OD2aOR3WltTKxxF25OfpK8h8UQ7A0BuRkSgREbB59DBlFk4iAeg==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-x64/-/vsce-sign-win32-x64-2.0.5.tgz", + "integrity": "sha512-1ixKFGM2FwM+6kQS2ojfY3aAelICxjiCzeg4nTHpkeU1Tfs4RC+lVLrgq5NwcBC7ZLr6UfY3Ct3D6suPeOf7BQ==", "cpu": [ "x64" ], @@ -1518,15 +1539,74 @@ "win32" ] }, + "node_modules/@vscode/vsce/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@vscode/vsce/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@vscode/vsce/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@vscode/vsce/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@vscode/vsce/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "node_modules/@vscode/vsce/node_modules/glob": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.2.tgz", - "integrity": "sha512-YT7U7Vye+t5fZ/QMkBFrTJ7ZQxInIUjwyAjVj84CYXqgBdv30MFUPGnBR6sQaVq6Is15wYJUsnzTuWaGRBhBAQ==", + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz", + "integrity": "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==", "dev": true, "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^4.0.1", - "minimatch": "^10.0.0", + "foreground-child": "^3.3.1", + "jackspeak": "^4.1.1", + "minimatch": "^10.0.3", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^2.0.0" @@ -1542,12 +1622,12 @@ } }, "node_modules/@vscode/vsce/node_modules/glob/node_modules/minimatch": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", - "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz", + "integrity": "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==", "dev": true, "dependencies": { - "brace-expansion": "^2.0.1" + "@isaacs/brace-expansion": "^5.0.0" }, "engines": { "node": "20 || >=22" @@ -1556,6 +1636,15 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/@vscode/vsce/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/@vscode/vsce/node_modules/jackspeak": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz", @@ -1592,16 +1681,6 @@ "node": "*" } }, - "node_modules/@vscode/vsce/node_modules/minimatch/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/@vscode/vsce/node_modules/path-scurry": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", @@ -1618,6 +1697,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/@vscode/vsce/node_modules/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, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/adm-zip": { "version": "0.5.16", "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.16.tgz", @@ -1825,9 +1916,9 @@ "dev": true }, "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dependencies": { "balanced-match": "^1.0.0" } @@ -1943,21 +2034,21 @@ } }, "node_modules/cheerio": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0.tgz", - "integrity": "sha512-quS9HgjQpdaXOvsZz82Oz7uxtXiy6UIsIQcpBj7HRw2M63Skasm9qlDocAM7jNuaxdhpPU7c4kJN+gA5MCu4ww==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.1.0.tgz", + "integrity": "sha512-+0hMx9eYhJvWbgpKV9hN7jg0JcwydpopZE4hgi+KvQtByZXPp04NiCWU0LzcAbP63abZckIHkTQaXVF52mX3xQ==", "dev": true, "dependencies": { "cheerio-select": "^2.1.0", "dom-serializer": "^2.0.0", "domhandler": "^5.0.3", - "domutils": "^3.1.0", + "domutils": "^3.2.2", "encoding-sniffer": "^0.2.0", - "htmlparser2": "^9.1.0", - "parse5": "^7.1.2", - "parse5-htmlparser2-tree-adapter": "^7.0.0", + "htmlparser2": "^10.0.0", + "parse5": "^7.3.0", + "parse5-htmlparser2-tree-adapter": "^7.1.0", "parse5-parser-stream": "^7.1.2", - "undici": "^6.19.5", + "undici": "^7.10.0", "whatwg-mimetype": "^4.0.0" }, "engines": { @@ -2372,9 +2463,9 @@ "dev": true }, "node_modules/encoding-sniffer": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.0.tgz", - "integrity": "sha512-ju7Wq1kg04I3HtiYIOrUrdfdDvkyO9s5XM8QAj/bN61Yo/Vb4vgJxy5vi4Yxk01gWHbrofpPtpxM8bKger9jhg==", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.1.tgz", + "integrity": "sha512-5gvq20T6vfpekVtqrYQsSCFZ1wEg5+wW0/QaZMWkFr6BqD3NfKs0rLCx4rrVlSWJeZb5NBJgVLswK/w2MWU+Gw==", "dev": true, "dependencies": { "iconv-lite": "^0.6.3", @@ -2385,9 +2476,9 @@ } }, "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", "dev": true, "optional": true, "dependencies": { @@ -2667,14 +2758,15 @@ } }, "node_modules/form-data": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.2.tgz", - "integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.3.tgz", + "integrity": "sha512-qsITQPfmvMOSAdeyZ+12I1c+CKSstAFAwu+97zrnWAbIr5u8wfsExUzCesVLC8NgHuRUqNN4Zy6UPWUTRGslcA==", "dev": true, "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", "mime-types": "^2.1.12" }, "engines": { @@ -2972,9 +3064,9 @@ } }, "node_modules/htmlparser2": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-9.1.0.tgz", - "integrity": "sha512-5zfg6mHUoaer/97TxnGpxmbR7zJtPwIYFMZ/H5ucTlPZhKvtum05yiPK3Mgai3a0DyVxv7qYqoweaEd2nrYQzQ==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-10.0.0.tgz", + "integrity": "sha512-TwAZM+zE5Tq3lrEHvOlvwgj1XLWQCtaaibSN11Q+gGBAS7Y1uZSWwXXRe4iF6OXnaq1riyQAPFOBtYc77Mxq0g==", "dev": true, "funding": [ "https://github.com/fb55/htmlparser2?sponsor=1", @@ -2986,8 +3078,20 @@ "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.3", - "domutils": "^3.1.0", - "entities": "^4.5.0" + "domutils": "^3.2.1", + "entities": "^6.0.0" + } + }, + "node_modules/htmlparser2/node_modules/entities": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", + "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", + "dev": true, + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" } }, "node_modules/http-proxy-agent": { @@ -3917,9 +4021,9 @@ } }, "node_modules/parse5/node_modules/entities": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.0.tgz", - "integrity": "sha512-aKstq2TDOndCn4diEyp9Uq/Flu2i1GlLkc6XIDQSDMuaFE3OPW5OphLCyQ5SpSJZTb4reN+kTcYru5yIfXoRPw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", + "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", "dev": true, "engines": { "node": ">=0.12" @@ -4041,9 +4145,9 @@ } }, "node_modules/pump": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz", - "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", "dev": true, "optional": true, "dependencies": { @@ -5016,18 +5120,18 @@ "dev": true }, "node_modules/undici": { - "version": "6.21.3", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.3.tgz", - "integrity": "sha512-gBLkYIlEnSp8pFbT64yFgGE6UIB9tAkhukC23PmMDCe5Nd+cRqKxSjw5y54MK2AZMgZfJWMaNE4nYUHgi1XEOw==", + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.10.0.tgz", + "integrity": "sha512-u5otvFBOBZvmdjWLVW+5DAc9Nkq8f24g0O9oY7qw2JVIF1VocIFoyz9JFkuVOS2j41AufeO0xnlweJ2RLT8nGw==", "dev": true, "engines": { - "node": ">=18.17" + "node": ">=20.18.1" } }, "node_modules/undici-types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", - "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", + "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==", "dev": true }, "node_modules/unicorn-magic": { @@ -5442,9 +5546,9 @@ } }, "@azure/core-rest-pipeline": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.20.0.tgz", - "integrity": "sha512-ASoP8uqZBS3H/8N8at/XwFr6vYrRP3syTK0EUjDXQy0Y1/AUS+QeIRThKmTNJO2RggvBBxaXDPM7YoIwDGeA0g==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.21.0.tgz", + "integrity": "sha512-a4MBwe/5WKbq9MIxikzgxLBbruC5qlkFYlBdI7Ev50Y7ib5Vo/Jvt5jnJo7NaWeJ908LCHL0S1Us4UMf1VoTfg==", "dev": true, "requires": { "@azure/abort-controller": "^2.0.0", @@ -5452,7 +5556,7 @@ "@azure/core-tracing": "^1.0.1", "@azure/core-util": "^1.11.0", "@azure/logger": "^1.0.0", - "@typespec/ts-http-runtime": "^0.2.2", + "@typespec/ts-http-runtime": "^0.2.3", "tslib": "^2.6.2" } }, @@ -5477,9 +5581,9 @@ } }, "@azure/identity": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.10.0.tgz", - "integrity": "sha512-iT53Sre2NJK6wzMWnvpjNiR3md597LZ3uK/5kQD2TkrY9vqhrY5bt2KwELNjkOWQ9n8S/92knj/QEykTtjMNqQ==", + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.10.1.tgz", + "integrity": "sha512-YM/z6RxRtFlXUH2egAYF/FDPes+MUE6ZoknjEdaq7ebJMMNUzn9zCJ3bd2ZZZlkP0r1xKa88kolhFH/FGV7JnA==", "dev": true, "requires": { "@azure/abort-controller": "^2.0.0", @@ -5506,9 +5610,9 @@ } }, "@azure/msal-browser": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.13.0.tgz", - "integrity": "sha512-n2ySryLd+wHmm/0Y1mwFI4J9UXVCu2DeWKtoWNWLVcpvK2k0Ez1qIigKleUm2ZfTbfAXdue+V8htmFft0qgyGQ==", + "version": "4.13.1", + "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.13.1.tgz", + "integrity": "sha512-oTp2zhVljB2CRp87swOTsBcqLDrvZq9In+yDMBzuuMN4z2wrIU6ITHBZlLfs+FaAVmM1zY3k7ITekXaJ2bsDKA==", "dev": true, "requires": { "@azure/msal-common": "15.7.0" @@ -5786,6 +5890,21 @@ "dev": true, "optional": true }, + "@isaacs/balanced-match": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", + "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", + "dev": true + }, + "@isaacs/brace-expansion": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", + "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", + "dev": true, + "requires": { + "@isaacs/balanced-match": "^4.0.1" + } + }, "@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -6034,24 +6153,24 @@ "dev": true }, "@textlint/ast-node-types": { - "version": "14.7.2", - "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-14.7.2.tgz", - "integrity": "sha512-3rZc9vD8y/DlcFe3Y/cyKRRVgBH4ElEUzVFYdRVDwoMSwV/cIyZgYzVG6ZuOItQt+cHSREuijuucZ4VqZynbtg==", + "version": "14.8.4", + "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-14.8.4.tgz", + "integrity": "sha512-+fI7miec/r9VeniFV9ppL4jRCmHNsTxieulTUf/4tvGII3db5hGriKHC4p/diq1SkQ9Sgs7kg6UyydxZtpTz1Q==", "dev": true }, "@textlint/linter-formatter": { - "version": "14.7.2", - "resolved": "https://registry.npmjs.org/@textlint/linter-formatter/-/linter-formatter-14.7.2.tgz", - "integrity": "sha512-QZOqft5uK+o/UN8UcEF3cHgfbG1r3+OWqlJojyjGNkEBbBNPSyDfYlVxDjHqnOAwm7jBaeqVGlwvw/7PUFmsmw==", + "version": "14.8.4", + "resolved": "https://registry.npmjs.org/@textlint/linter-formatter/-/linter-formatter-14.8.4.tgz", + "integrity": "sha512-sZ0UfYRDBNHnfMVBqLqqYnqTB7Ec169ljlmo+SEHR1T+dHUPYy1/DZK4p7QREXlBSFL4cnkswETCbc9xRodm4Q==", "dev": true, "requires": { "@azu/format-text": "^1.0.2", "@azu/style-format": "^1.0.1", - "@textlint/module-interop": "^14.7.2", - "@textlint/resolver": "^14.7.2", - "@textlint/types": "^14.7.2", + "@textlint/module-interop": "14.8.4", + "@textlint/resolver": "14.8.4", + "@textlint/types": "14.8.4", "chalk": "^4.1.2", - "debug": "^4.4.0", + "debug": "^4.4.1", "js-yaml": "^3.14.1", "lodash": "^4.17.21", "pluralize": "^2.0.0", @@ -6151,24 +6270,24 @@ } }, "@textlint/module-interop": { - "version": "14.7.2", - "resolved": "https://registry.npmjs.org/@textlint/module-interop/-/module-interop-14.7.2.tgz", - "integrity": "sha512-rDQhFERa2+xMqhyrPFvAL9d5Tb4RpQGKQExwrezvtCTREh6Zsp/nKxtK0r6o0P9xn1+zq2sZHW9NZjpe7av3xw==", + "version": "14.8.4", + "resolved": "https://registry.npmjs.org/@textlint/module-interop/-/module-interop-14.8.4.tgz", + "integrity": "sha512-1LdPYLAVpa27NOt6EqvuFO99s4XLB0c19Hw9xKSG6xQ1K82nUEyuWhzTQKb3KJ5Qx7qj14JlXZLfnEuL6A16Bw==", "dev": true }, "@textlint/resolver": { - "version": "14.7.2", - "resolved": "https://registry.npmjs.org/@textlint/resolver/-/resolver-14.7.2.tgz", - "integrity": "sha512-FCZa9XJx5KihK/4gxXLhS/KfOnBD6vD5UxAMtgrvbifn+JFrW9Kh17uZLCcuJDDJJCnZOHq8jdT7AU+rpmJZ+w==", + "version": "14.8.4", + "resolved": "https://registry.npmjs.org/@textlint/resolver/-/resolver-14.8.4.tgz", + "integrity": "sha512-nMDOgDAVwNU9ommh+Db0U+MCMNDPbQ/1HBNjbnHwxZkCpcT6hsAJwBe38CW/DtWVUv8yeR4R40IYNPT84srNwA==", "dev": true }, "@textlint/types": { - "version": "14.7.2", - "resolved": "https://registry.npmjs.org/@textlint/types/-/types-14.7.2.tgz", - "integrity": "sha512-VpsmtJf9+7cnIxmKtAVVGVzI6f2k09kBZnzjdTAO8JZ+HTmV46jeoVrotpSfQbWDpuQk2UFPfrsZL/LNf/99ew==", + "version": "14.8.4", + "resolved": "https://registry.npmjs.org/@textlint/types/-/types-14.8.4.tgz", + "integrity": "sha512-9nyY8vVXlr8hHKxa6+37omJhXWCwovMQcgMteuldYd4dOxGm14AK2nXdkgtKEUQnzLGaXy46xwLCfhQy7V7/YA==", "dev": true, "requires": { - "@textlint/ast-node-types": "^14.7.2" + "@textlint/ast-node-types": "14.8.4" } }, "@types/adm-zip": { @@ -6181,12 +6300,12 @@ } }, "@types/node": { - "version": "22.15.29", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.29.tgz", - "integrity": "sha512-LNdjOkUDlU1RZb8e1kOIUpN1qQUlzGkEtbVNo53vbrwDg5om6oduhm4SiUaPW5ASTXhAiP0jInWG8Qx9fVlOeQ==", + "version": "24.0.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.3.tgz", + "integrity": "sha512-R4I/kzCYAdRLzfiCabn9hxWfbuHS573x+r0dJMkkzThEa7pbrcDWK+9zu3e7aBOouf+rQAciqPFMnxwr0aWgKg==", "dev": true, "requires": { - "undici-types": "~6.21.0" + "undici-types": "~7.8.0" } }, "@types/normalize-package-data": { @@ -6202,9 +6321,9 @@ "dev": true }, "@types/vscode": { - "version": "1.100.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.100.0.tgz", - "integrity": "sha512-4uNyvzHoraXEeCamR3+fzcBlh7Afs4Ifjs4epINyUX/jvdk0uzLnwiDY35UKDKnkCHP5Nu3dljl2H8lR6s+rQw==", + "version": "1.101.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.101.0.tgz", + "integrity": "sha512-ZWf0IWa+NGegdW3iU42AcDTFHWW7fApLdkdnBqwYEtHVIBGbTu0ZNQKP/kX3Ds/uMJXIMQNAojHR4vexCEEz5Q==", "dev": true }, "@types/which": { @@ -6228,9 +6347,9 @@ "version": "file:_packages/native-preview" }, "@typespec/ts-http-runtime": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.2.2.tgz", - "integrity": "sha512-Gz/Sm64+Sq/vklJu1tt9t+4R2lvnud8NbTD/ZfpZtMiUX7YeVpCA8j6NSW8ptwcoLL+NmYANwqP8DV0q/bwl2w==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.2.3.tgz", + "integrity": "sha512-oRhjSzcVjX8ExyaF8hC0zzTqxlVuRlgMHL/Bh4w3xB9+wjbm0FpXylVU/lBrn+kgphwYTrOk3tp+AVShGmlYCg==", "dev": true, "requires": { "http-proxy-agent": "^7.0.0", @@ -6239,19 +6358,19 @@ } }, "@vscode/vsce": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-3.4.2.tgz", - "integrity": "sha512-U2gC7GiQc22nxRpWH4cdW16rRr5u9w+Bjsjm8g8mEjY4aeOG1U6/3XNGq+ElwdeoT8jAyhBmBAuYG7INcSe/6A==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-3.5.0.tgz", + "integrity": "sha512-2Eb6fBh8OzNhWqviCjeUPA1MW+d2GCb1QlVxrpOR8lrLHGk8x7HD4LbfELnZPyOz2X33Myz9FE9t4LwYbmeMRg==", "dev": true, "requires": { "@azure/identity": "^4.1.0", - "@secretlint/node": "^9.3.2", - "@secretlint/secretlint-formatter-sarif": "^9.3.2", - "@secretlint/secretlint-rule-no-dotenv": "^9.3.2", - "@secretlint/secretlint-rule-preset-recommend": "^9.3.2", + "@secretlint/node": "^9.3.4", + "@secretlint/secretlint-formatter-sarif": "^9.3.4", + "@secretlint/secretlint-rule-no-dotenv": "^9.3.4", + "@secretlint/secretlint-rule-preset-recommend": "^9.3.4", "@vscode/vsce-sign": "^2.0.0", "azure-devops-node-api": "^12.5.0", - "chalk": "^2.4.2", + "chalk": "^4.1.2", "cheerio": "^1.0.0-rc.9", "cockatiel": "^3.1.2", "commander": "^12.1.0", @@ -6266,7 +6385,7 @@ "minimatch": "^3.0.3", "parse-semver": "^1.1.1", "read": "^1.0.7", - "secretlint": "^9.3.2", + "secretlint": "^9.3.4", "semver": "^7.5.2", "tmp": "^0.2.3", "typed-rest-client": "^1.8.4", @@ -6276,31 +6395,81 @@ "yazl": "^2.2.2" }, "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "glob": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.2.tgz", - "integrity": "sha512-YT7U7Vye+t5fZ/QMkBFrTJ7ZQxInIUjwyAjVj84CYXqgBdv30MFUPGnBR6sQaVq6Is15wYJUsnzTuWaGRBhBAQ==", + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz", + "integrity": "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==", "dev": true, "requires": { - "foreground-child": "^3.1.0", - "jackspeak": "^4.0.1", - "minimatch": "^10.0.0", + "foreground-child": "^3.3.1", + "jackspeak": "^4.1.1", + "minimatch": "^10.0.3", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^2.0.0" }, "dependencies": { "minimatch": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", - "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz", + "integrity": "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==", "dev": true, "requires": { - "brace-expansion": "^2.0.1" + "@isaacs/brace-expansion": "^5.0.0" } } } }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, "jackspeak": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz", @@ -6323,18 +6492,6 @@ "dev": true, "requires": { "brace-expansion": "^1.1.7" - }, - "dependencies": { - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - } } }, "path-scurry": { @@ -6346,86 +6503,95 @@ "lru-cache": "^11.0.0", "minipass": "^7.1.2" } + }, + "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" + } } } }, "@vscode/vsce-sign": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign/-/vsce-sign-2.0.5.tgz", - "integrity": "sha512-GfYWrsT/vypTMDMgWDm75iDmAOMe7F71sZECJ+Ws6/xyIfmB3ELVnVN+LwMFAvmXY+e6eWhR2EzNGF/zAhWY3Q==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign/-/vsce-sign-2.0.6.tgz", + "integrity": "sha512-j9Ashk+uOWCDHYDxgGsqzKq5FXW9b9MW7QqOIYZ8IYpneJclWTBeHZz2DJCSKQgo+JAqNcaRRE1hzIx0dswqAw==", "dev": true, "requires": { - "@vscode/vsce-sign-alpine-arm64": "2.0.2", - "@vscode/vsce-sign-alpine-x64": "2.0.2", - "@vscode/vsce-sign-darwin-arm64": "2.0.2", - "@vscode/vsce-sign-darwin-x64": "2.0.2", - "@vscode/vsce-sign-linux-arm": "2.0.2", - "@vscode/vsce-sign-linux-arm64": "2.0.2", - "@vscode/vsce-sign-linux-x64": "2.0.2", - "@vscode/vsce-sign-win32-arm64": "2.0.2", - "@vscode/vsce-sign-win32-x64": "2.0.2" + "@vscode/vsce-sign-alpine-arm64": "2.0.5", + "@vscode/vsce-sign-alpine-x64": "2.0.5", + "@vscode/vsce-sign-darwin-arm64": "2.0.5", + "@vscode/vsce-sign-darwin-x64": "2.0.5", + "@vscode/vsce-sign-linux-arm": "2.0.5", + "@vscode/vsce-sign-linux-arm64": "2.0.5", + "@vscode/vsce-sign-linux-x64": "2.0.5", + "@vscode/vsce-sign-win32-arm64": "2.0.5", + "@vscode/vsce-sign-win32-x64": "2.0.5" } }, "@vscode/vsce-sign-alpine-arm64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-arm64/-/vsce-sign-alpine-arm64-2.0.2.tgz", - "integrity": "sha512-E80YvqhtZCLUv3YAf9+tIbbqoinWLCO/B3j03yQPbjT3ZIHCliKZlsy1peNc4XNZ5uIb87Jn0HWx/ZbPXviuAQ==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-arm64/-/vsce-sign-alpine-arm64-2.0.5.tgz", + "integrity": "sha512-XVmnF40APwRPXSLYA28Ye+qWxB25KhSVpF2eZVtVOs6g7fkpOxsVnpRU1Bz2xG4ySI79IRuapDJoAQFkoOgfdQ==", "dev": true, "optional": true }, "@vscode/vsce-sign-alpine-x64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-x64/-/vsce-sign-alpine-x64-2.0.2.tgz", - "integrity": "sha512-n1WC15MSMvTaeJ5KjWCzo0nzjydwxLyoHiMJHu1Ov0VWTZiddasmOQHekA47tFRycnt4FsQrlkSCTdgHppn6bw==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-x64/-/vsce-sign-alpine-x64-2.0.5.tgz", + "integrity": "sha512-JuxY3xcquRsOezKq6PEHwCgd1rh1GnhyH6urVEWUzWn1c1PC4EOoyffMD+zLZtFuZF5qR1I0+cqDRNKyPvpK7Q==", "dev": true, "optional": true }, "@vscode/vsce-sign-darwin-arm64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-arm64/-/vsce-sign-darwin-arm64-2.0.2.tgz", - "integrity": "sha512-rz8F4pMcxPj8fjKAJIfkUT8ycG9CjIp888VY/6pq6cuI2qEzQ0+b5p3xb74CJnBbSC0p2eRVoe+WgNCAxCLtzQ==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-arm64/-/vsce-sign-darwin-arm64-2.0.5.tgz", + "integrity": "sha512-z2Q62bk0ptADFz8a0vtPvnm6vxpyP3hIEYMU+i1AWz263Pj8Mc38cm/4sjzxu+LIsAfhe9HzvYNS49lV+KsatQ==", "dev": true, "optional": true }, "@vscode/vsce-sign-darwin-x64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-x64/-/vsce-sign-darwin-x64-2.0.2.tgz", - "integrity": "sha512-MCjPrQ5MY/QVoZ6n0D92jcRb7eYvxAujG/AH2yM6lI0BspvJQxp0o9s5oiAM9r32r9tkLpiy5s2icsbwefAQIw==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-x64/-/vsce-sign-darwin-x64-2.0.5.tgz", + "integrity": "sha512-ma9JDC7FJ16SuPXlLKkvOD2qLsmW/cKfqK4zzM2iJE1PbckF3BlR08lYqHV89gmuoTpYB55+z8Y5Fz4wEJBVDA==", "dev": true, "optional": true }, "@vscode/vsce-sign-linux-arm": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm/-/vsce-sign-linux-arm-2.0.2.tgz", - "integrity": "sha512-Fkb5jpbfhZKVw3xwR6t7WYfwKZktVGNXdg1m08uEx1anO0oUPUkoQRsNm4QniL3hmfw0ijg00YA6TrxCRkPVOQ==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm/-/vsce-sign-linux-arm-2.0.5.tgz", + "integrity": "sha512-cdCwtLGmvC1QVrkIsyzv01+o9eR+wodMJUZ9Ak3owhcGxPRB53/WvrDHAFYA6i8Oy232nuen1YqWeEohqBuSzA==", "dev": true, "optional": true }, "@vscode/vsce-sign-linux-arm64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm64/-/vsce-sign-linux-arm64-2.0.2.tgz", - "integrity": "sha512-Ybeu7cA6+/koxszsORXX0OJk9N0GgfHq70Wqi4vv2iJCZvBrOWwcIrxKjvFtwyDgdeQzgPheH5nhLVl5eQy7WA==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm64/-/vsce-sign-linux-arm64-2.0.5.tgz", + "integrity": "sha512-Hr1o0veBymg9SmkCqYnfaiUnes5YK6k/lKFA5MhNmiEN5fNqxyPUCdRZMFs3Ajtx2OFW4q3KuYVRwGA7jdLo7Q==", "dev": true, "optional": true }, "@vscode/vsce-sign-linux-x64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-x64/-/vsce-sign-linux-x64-2.0.2.tgz", - "integrity": "sha512-NsPPFVtLaTlVJKOiTnO8Cl78LZNWy0Q8iAg+LlBiCDEgC12Gt4WXOSs2pmcIjDYzj2kY4NwdeN1mBTaujYZaPg==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-x64/-/vsce-sign-linux-x64-2.0.5.tgz", + "integrity": "sha512-XLT0gfGMcxk6CMRLDkgqEPTyG8Oa0OFe1tPv2RVbphSOjFWJwZgK3TYWx39i/7gqpDHlax0AP6cgMygNJrA6zg==", "dev": true, "optional": true }, "@vscode/vsce-sign-win32-arm64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-arm64/-/vsce-sign-win32-arm64-2.0.2.tgz", - "integrity": "sha512-wPs848ymZ3Ny+Y1Qlyi7mcT6VSigG89FWQnp2qRYCyMhdJxOpA4lDwxzlpL8fG6xC8GjQjGDkwbkWUcCobvksQ==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-arm64/-/vsce-sign-win32-arm64-2.0.5.tgz", + "integrity": "sha512-hco8eaoTcvtmuPhavyCZhrk5QIcLiyAUhEso87ApAWDllG7djIrWiOCtqn48k4pHz+L8oCQlE0nwNHfcYcxOPw==", "dev": true, "optional": true }, "@vscode/vsce-sign-win32-x64": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-x64/-/vsce-sign-win32-x64-2.0.2.tgz", - "integrity": "sha512-pAiRN6qSAhDM5SVOIxgx+2xnoVUePHbRNC7OD2aOR3WltTKxxF25OfpK8h8UQ7A0BuRkSgREbB59DBlFk4iAeg==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-x64/-/vsce-sign-win32-x64-2.0.5.tgz", + "integrity": "sha512-1ixKFGM2FwM+6kQS2ojfY3aAelICxjiCzeg4nTHpkeU1Tfs4RC+lVLrgq5NwcBC7ZLr6UfY3Ct3D6suPeOf7BQ==", "dev": true, "optional": true }, @@ -6578,9 +6744,9 @@ "dev": true }, "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "requires": { "balanced-match": "^1.0.0" } @@ -6658,21 +6824,21 @@ } }, "cheerio": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0.tgz", - "integrity": "sha512-quS9HgjQpdaXOvsZz82Oz7uxtXiy6UIsIQcpBj7HRw2M63Skasm9qlDocAM7jNuaxdhpPU7c4kJN+gA5MCu4ww==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.1.0.tgz", + "integrity": "sha512-+0hMx9eYhJvWbgpKV9hN7jg0JcwydpopZE4hgi+KvQtByZXPp04NiCWU0LzcAbP63abZckIHkTQaXVF52mX3xQ==", "dev": true, "requires": { "cheerio-select": "^2.1.0", "dom-serializer": "^2.0.0", "domhandler": "^5.0.3", - "domutils": "^3.1.0", + "domutils": "^3.2.2", "encoding-sniffer": "^0.2.0", - "htmlparser2": "^9.1.0", - "parse5": "^7.1.2", - "parse5-htmlparser2-tree-adapter": "^7.0.0", + "htmlparser2": "^10.0.0", + "parse5": "^7.3.0", + "parse5-htmlparser2-tree-adapter": "^7.1.0", "parse5-parser-stream": "^7.1.2", - "undici": "^6.19.5", + "undici": "^7.10.0", "whatwg-mimetype": "^4.0.0" } }, @@ -6969,9 +7135,9 @@ "dev": true }, "encoding-sniffer": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.0.tgz", - "integrity": "sha512-ju7Wq1kg04I3HtiYIOrUrdfdDvkyO9s5XM8QAj/bN61Yo/Vb4vgJxy5vi4Yxk01gWHbrofpPtpxM8bKger9jhg==", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.1.tgz", + "integrity": "sha512-5gvq20T6vfpekVtqrYQsSCFZ1wEg5+wW0/QaZMWkFr6BqD3NfKs0rLCx4rrVlSWJeZb5NBJgVLswK/w2MWU+Gw==", "dev": true, "requires": { "iconv-lite": "^0.6.3", @@ -6979,9 +7145,9 @@ } }, "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", "dev": true, "optional": true, "requires": { @@ -7186,14 +7352,15 @@ } }, "form-data": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.2.tgz", - "integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.3.tgz", + "integrity": "sha512-qsITQPfmvMOSAdeyZ+12I1c+CKSstAFAwu+97zrnWAbIr5u8wfsExUzCesVLC8NgHuRUqNN4Zy6UPWUTRGslcA==", "dev": true, "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", "mime-types": "^2.1.12" } }, @@ -7404,15 +7571,23 @@ } }, "htmlparser2": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-9.1.0.tgz", - "integrity": "sha512-5zfg6mHUoaer/97TxnGpxmbR7zJtPwIYFMZ/H5ucTlPZhKvtum05yiPK3Mgai3a0DyVxv7qYqoweaEd2nrYQzQ==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-10.0.0.tgz", + "integrity": "sha512-TwAZM+zE5Tq3lrEHvOlvwgj1XLWQCtaaibSN11Q+gGBAS7Y1uZSWwXXRe4iF6OXnaq1riyQAPFOBtYc77Mxq0g==", "dev": true, "requires": { "domelementtype": "^2.3.0", "domhandler": "^5.0.3", - "domutils": "^3.1.0", - "entities": "^4.5.0" + "domutils": "^3.2.1", + "entities": "^6.0.0" + }, + "dependencies": { + "entities": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", + "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", + "dev": true + } } }, "http-proxy-agent": { @@ -8086,9 +8261,9 @@ }, "dependencies": { "entities": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.0.tgz", - "integrity": "sha512-aKstq2TDOndCn4diEyp9Uq/Flu2i1GlLkc6XIDQSDMuaFE3OPW5OphLCyQ5SpSJZTb4reN+kTcYru5yIfXoRPw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", + "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", "dev": true } } @@ -8189,9 +8364,9 @@ } }, "pump": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz", - "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", "dev": true, "optional": true, "requires": { @@ -8876,15 +9051,15 @@ "dev": true }, "undici": { - "version": "6.21.3", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.3.tgz", - "integrity": "sha512-gBLkYIlEnSp8pFbT64yFgGE6UIB9tAkhukC23PmMDCe5Nd+cRqKxSjw5y54MK2AZMgZfJWMaNE4nYUHgi1XEOw==", + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.10.0.tgz", + "integrity": "sha512-u5otvFBOBZvmdjWLVW+5DAc9Nkq8f24g0O9oY7qw2JVIF1VocIFoyz9JFkuVOS2j41AufeO0xnlweJ2RLT8nGw==", "dev": true }, "undici-types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", - "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", + "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==", "dev": true }, "unicorn-magic": { From 00191c549536f713554cb02d34b8a12d89398851 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Jun 2025 16:16:48 -0700 Subject: [PATCH 2/9] Port TypeScript PR #60303: Fix template string escaping (#1142) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> --- internal/printer/printer_test.go | 2 ++ internal/printer/utilities.go | 2 +- internal/printer/utilities_test.go | 1 + .../templateStringControlCharacterEscapes03.types | 2 +- .../templateStringControlCharacterEscapes03.types.diff | 8 -------- .../templateStringControlCharacterEscapes03_ES6.types | 2 +- ...templateStringControlCharacterEscapes03_ES6.types.diff | 8 -------- 7 files changed, 6 insertions(+), 19 deletions(-) delete mode 100644 testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03.types.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03_ES6.types.diff diff --git a/internal/printer/printer_test.go b/internal/printer/printer_test.go index 1bd17cc6c6..2e4fdd46a1 100644 --- a/internal/printer/printer_test.go +++ b/internal/printer/printer_test.go @@ -28,6 +28,8 @@ func TestEmit(t *testing.T) { {title: "BooleanLiteral#1", input: `true`, output: `true;`}, {title: "BooleanLiteral#2", input: `false`, output: `false;`}, {title: "NoSubstitutionTemplateLiteral", input: "``", output: "``;"}, + {title: "NoSubstitutionTemplateLiteral#2", input: "`\n`", output: "`\n`;"}, + {title: "RegularExpressionLiteral#1", input: `/a/`, output: `/a/;`}, {title: "RegularExpressionLiteral#2", input: `/a/g`, output: `/a/g;`}, {title: "NullLiteral", input: `null`, output: `null;`}, diff --git a/internal/printer/utilities.go b/internal/printer/utilities.go index 6561a5a95a..9eac7f1b89 100644 --- a/internal/printer/utilities.go +++ b/internal/printer/utilities.go @@ -103,7 +103,7 @@ func escapeStringWorker(s string, quoteChar QuoteChar, flags getLiteralTextFlags escape = true } default: - if ch < '\u001f' || flags&getLiteralTextFlagsNeverAsciiEscape == 0 && ch > '\u007f' { + if ch <= '\u001f' || flags&getLiteralTextFlagsNeverAsciiEscape == 0 && ch > '\u007f' { escape = true } } diff --git a/internal/printer/utilities_test.go b/internal/printer/utilities_test.go index cbe034f22d..02281a0f8b 100644 --- a/internal/printer/utilities_test.go +++ b/internal/printer/utilities_test.go @@ -25,6 +25,7 @@ func TestEscapeString(t *testing.T) { {s: "ab'c", quoteChar: QuoteCharSingleQuote, expected: `ab\'c`}, {s: "ab\"c", quoteChar: QuoteCharSingleQuote, expected: `ab"c`}, {s: "ab`c", quoteChar: QuoteCharBacktick, expected: "ab\\`c"}, + {s: "\u001f", quoteChar: QuoteCharBacktick, expected: "\\u001F"}, } for i, rec := range data { t.Run(fmt.Sprintf("[%d] escapeString(%q, %v)", i, rec.s, rec.quoteChar), func(t *testing.T) { diff --git a/testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03.types b/testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03.types index cb40439a14..aea47c3578 100644 --- a/testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03.types +++ b/testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03.types @@ -3,5 +3,5 @@ === templateStringControlCharacterEscapes03.ts === var x = `\x1F\u001f 1F 1f`; >x : string ->`\x1F\u001f 1F 1f` : " 1F 1f" +>`\x1F\u001f 1F 1f` : "\u001F\u001F 1F 1f" diff --git a/testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03.types.diff b/testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03.types.diff deleted file mode 100644 index 5fcd94380c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03.types.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.templateStringControlCharacterEscapes03.types -+++ new.templateStringControlCharacterEscapes03.types -@@= skipped -2, +2 lines =@@ - === templateStringControlCharacterEscapes03.ts === - var x = `\x1F\u001f 1F 1f`; - >x : string -->`\x1F\u001f 1F 1f` : "\u001F\u001F 1F 1f" -+>`\x1F\u001f 1F 1f` : " 1F 1f" diff --git a/testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03_ES6.types b/testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03_ES6.types index f1e600e06b..42501f67b6 100644 --- a/testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03_ES6.types +++ b/testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03_ES6.types @@ -3,5 +3,5 @@ === templateStringControlCharacterEscapes03_ES6.ts === var x = `\x1F\u001f 1F 1f`; >x : string ->`\x1F\u001f 1F 1f` : " 1F 1f" +>`\x1F\u001f 1F 1f` : "\u001F\u001F 1F 1f" diff --git a/testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03_ES6.types.diff b/testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03_ES6.types.diff deleted file mode 100644 index 30a3c9a4e6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/templateStringControlCharacterEscapes03_ES6.types.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.templateStringControlCharacterEscapes03_ES6.types -+++ new.templateStringControlCharacterEscapes03_ES6.types -@@= skipped -2, +2 lines =@@ - === templateStringControlCharacterEscapes03_ES6.ts === - var x = `\x1F\u001f 1F 1f`; - >x : string -->`\x1F\u001f 1F 1f` : "\u001F\u001F 1F 1f" -+>`\x1F\u001f 1F 1f` : " 1F 1f" From f28cbe476c36b847e610c5321ace9f035b7de155 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 16 Jun 2025 16:21:53 -0700 Subject: [PATCH 3/9] Remove unicodeES5Identifier and co (#1203) --- internal/checker/nodebuilderimpl.go | 22 +- internal/ls/completions.go | 21 +- internal/ls/findallreferences.go | 4 +- internal/ls/string_completions.go | 1 - internal/scanner/scanner.go | 79 +- internal/scanner/utilities.go | 6 +- internal/transformers/jsx.go | 2 +- ...odeEscapesInNames02(target=es5).errors.txt | 124 +- ...capesInNames02(target=es5).errors.txt.diff | 206 ++-- .../unicodeEscapesInNames02(target=es5).js | 56 +- ...nicodeEscapesInNames02(target=es5).js.diff | 85 +- ...unicodeEscapesInNames02(target=es5).js.map | 4 +- ...deEscapesInNames02(target=es5).js.map.diff | 4 +- ...EscapesInNames02(target=es5).sourcemap.txt | 723 ++++------- ...esInNames02(target=es5).sourcemap.txt.diff | 1083 ++++++++++------- ...nicodeEscapesInNames02(target=es5).symbols | 39 +- ...eEscapesInNames02(target=es5).symbols.diff | 64 +- .../unicodeEscapesInNames02(target=es5).types | 66 +- ...odeEscapesInNames02(target=es5).types.diff | 117 +- 19 files changed, 1283 insertions(+), 1423 deletions(-) diff --git a/internal/checker/nodebuilderimpl.go b/internal/checker/nodebuilderimpl.go index ed9f3182ff..e15722e5a2 100644 --- a/internal/checker/nodebuilderimpl.go +++ b/internal/checker/nodebuilderimpl.go @@ -632,7 +632,7 @@ func (b *nodeBuilderImpl) createExpressionFromSymbolChain(chain []*ast.Symbol, i return b.f.NewStringLiteral(b.getSpecifierForModuleSymbol(symbol, core.ResolutionModeNone)) } - if index == 0 || canUsePropertyAccess(symbolName, b.ch.languageVersion) { + if index == 0 || canUsePropertyAccess(symbolName) { identifier := b.f.NewIdentifier(symbolName) b.e.AddEmitFlags(identifier, printer.EFNoAsciiEscaping) // !!! TODO: smuggle type arguments out @@ -667,16 +667,16 @@ func (b *nodeBuilderImpl) createExpressionFromSymbolChain(chain []*ast.Symbol, i return b.f.NewElementAccessExpression(b.createExpressionFromSymbolChain(chain, index-1), nil, expression, ast.NodeFlagsNone) } -func canUsePropertyAccess(name string, languageVersion core.ScriptTarget) bool { +func canUsePropertyAccess(name string) bool { if len(name) == 0 { return false } // TODO: in strada, this only used `isIdentifierStart` on the first character, while this checks the whole string for validity // - possible strada bug? if strings.HasPrefix(name, "#") { - return len(name) > 1 && scanner.IsIdentifierText(name[1:], languageVersion, core.LanguageVariantStandard) + return len(name) > 1 && scanner.IsIdentifierText(name[1:], core.LanguageVariantStandard) } - return scanner.IsIdentifierText(name, languageVersion, core.LanguageVariantStandard) + return scanner.IsIdentifierText(name, core.LanguageVariantStandard) } func startsWithSingleOrDoubleQuote(str string) bool { @@ -705,7 +705,7 @@ func (b *nodeBuilderImpl) getNameOfSymbolFromNameType(symbol *ast.Symbol) string case jsnum.Number: name = v.String() } - if !scanner.IsIdentifierText(name, b.ch.compilerOptions.GetEmitScriptTarget(), core.LanguageVariantStandard) && !isNumericLiteralName(name) { + if !scanner.IsIdentifierText(name, core.LanguageVariantStandard) && !isNumericLiteralName(name) { return b.ch.valueToString(nameType.AsLiteralType().value) } if isNumericLiteralName(name) && strings.HasPrefix(name, "-") { @@ -1976,9 +1976,9 @@ func (b *nodeBuilderImpl) trackComputedName(accessExpression *ast.Node, enclosin } } -func (b *nodeBuilderImpl) createPropertyNameNodeForIdentifierOrLiteral(name string, target core.ScriptTarget, _singleQuote bool, stringNamed bool, isMethod bool) *ast.Node { +func (b *nodeBuilderImpl) createPropertyNameNodeForIdentifierOrLiteral(name string, _singleQuote bool, stringNamed bool, isMethod bool) *ast.Node { isMethodNamedNew := isMethod && name == "new" - if !isMethodNamedNew && scanner.IsIdentifierText(name, target, core.LanguageVariantStandard) { + if !isMethodNamedNew && scanner.IsIdentifierText(name, core.LanguageVariantStandard) { return b.f.NewIdentifier(name) } if !stringNamed && !isMethodNamedNew && isNumericLiteralName(name) && jsnum.FromString(name) >= 0 { @@ -2020,7 +2020,7 @@ func (b *nodeBuilderImpl) getPropertyNameNodeForSymbol(symbol *ast.Symbol) *ast. if fromNameType != nil { return fromNameType } - return b.createPropertyNameNodeForIdentifierOrLiteral(symbol.Name, b.ch.compilerOptions.GetEmitScriptTarget(), singleQuote, stringNamed, isMethod) + return b.createPropertyNameNodeForIdentifierOrLiteral(symbol.Name, singleQuote, stringNamed, isMethod) } // See getNameForSymbolFromNameType for a stringy equivalent @@ -2040,14 +2040,14 @@ func (b *nodeBuilderImpl) getPropertyNameNodeForSymbolFromNameType(symbol *ast.S case string: name = nameType.AsLiteralType().value.(string) } - if !scanner.IsIdentifierText(name, b.ch.compilerOptions.GetEmitScriptTarget(), core.LanguageVariantStandard) && (stringNamed || !isNumericLiteralName(name)) { + if !scanner.IsIdentifierText(name, core.LanguageVariantStandard) && (stringNamed || !isNumericLiteralName(name)) { // !!! TODO: set singleQuote return b.f.NewStringLiteral(name) } if isNumericLiteralName(name) && name[0] == '-' { return b.f.NewComputedPropertyName(b.f.NewPrefixUnaryExpression(ast.KindMinusToken, b.f.NewNumericLiteral(name[1:]))) } - return b.createPropertyNameNodeForIdentifierOrLiteral(name, b.ch.compilerOptions.GetEmitScriptTarget(), singleQuote, stringNamed, isMethod) + return b.createPropertyNameNodeForIdentifierOrLiteral(name, singleQuote, stringNamed, isMethod) } if nameType.flags&TypeFlagsUniqueESSymbol != 0 { return b.f.NewComputedPropertyName(b.symbolToExpression(nameType.AsUniqueESSymbolType().symbol, ast.SymbolFlagsValue)) @@ -2737,7 +2737,7 @@ func (b *nodeBuilderImpl) typeToTypeNode(t *Type) *ast.TypeNode { return parentName } memberName := ast.SymbolName(t.symbol) - if scanner.IsIdentifierText(memberName, core.ScriptTargetES5, core.LanguageVariantStandard) { + if scanner.IsIdentifierText(memberName, core.LanguageVariantStandard) { return b.appendReferenceToType(parentName /* as TypeReferenceNode | ImportTypeNode */, b.f.NewTypeReferenceNode(b.f.NewIdentifier(memberName), nil /*typeArguments*/)) } if ast.IsImportTypeNode(parentName) { diff --git a/internal/ls/completions.go b/internal/ls/completions.go index 228c9b4e85..3d1927f49a 100644 --- a/internal/ls/completions.go +++ b/internal/ls/completions.go @@ -1555,7 +1555,6 @@ func (l *LanguageService) completionInfoFromData( position, file, program, - compilerOptions.GetEmitScriptTarget(), preferences, compilerOptions, clientOptions, @@ -1593,7 +1592,6 @@ func (l *LanguageService) completionInfoFromData( file, position, &uniqueNames, - compilerOptions.GetEmitScriptTarget(), sortedEntries, ) } @@ -1617,7 +1615,6 @@ func (l *LanguageService) getCompletionEntriesFromSymbols( position int, file *ast.SourceFile, program *compiler.Program, - target core.ScriptTarget, preferences *UserPreferences, compilerOptions *core.CompilerOptions, clientOptions *lsproto.CompletionClientCapabilities, @@ -1637,7 +1634,6 @@ func (l *LanguageService) getCompletionEntriesFromSymbols( origin := data.symbolToOriginInfoMap[symbolId] name, needsConvertPropertyAccess := getCompletionEntryDisplayNameForSymbol( symbol, - target, origin, data.completionKind, data.isJsxIdentifierExpected, @@ -1951,8 +1947,7 @@ func (l *LanguageService) createCompletionItem( parentNamedImportOrExport := ast.FindAncestor(data.location, isNamedImportsOrExports) if parentNamedImportOrExport != nil { - languageVersion := compilerOptions.GetEmitScriptTarget() - if !scanner.IsIdentifierText(name, languageVersion, core.LanguageVariantStandard) { + if !scanner.IsIdentifierText(name, core.LanguageVariantStandard) { insertText = quotePropertyName(file, preferences, name) if parentNamedImportOrExport.Kind == ast.KindNamedImports { @@ -1962,7 +1957,7 @@ func (l *LanguageService) createCompletionItem( scanner.SetText(file.Text()) scanner.ResetPos(position) if !(scanner.Scan() == ast.KindAsKeyword && scanner.Scan() == ast.KindIdentifier) { - insertText += " as " + generateIdentifierForArbitraryString(name, languageVersion) + insertText += " as " + generateIdentifierForArbitraryString(name) } } } else if parentNamedImportOrExport.Kind == ast.KindNamedImports { @@ -2273,7 +2268,6 @@ func shouldIncludeSymbol( func getCompletionEntryDisplayNameForSymbol( symbol *ast.Symbol, - target core.ScriptTarget, origin *symbolOriginInfo, completionKind CompletionKind, isJsxIdentifierExpected bool, @@ -2299,7 +2293,7 @@ func getCompletionEntryDisplayNameForSymbol( variant := core.IfElse(isJsxIdentifierExpected, core.LanguageVariantJSX, core.LanguageVariantStandard) // name is a valid identifier or private identifier text - if scanner.IsIdentifierText(name, target, variant) || + if scanner.IsIdentifierText(name, variant) || symbol.ValueDeclaration != nil && ast.IsPrivateIdentifierClassElementDeclaration(symbol.ValueDeclaration) { return name, false } @@ -2819,7 +2813,7 @@ func isNamedImportsOrExports(node *ast.Node) bool { return ast.IsNamedImports(node) || ast.IsNamedExports(node) } -func generateIdentifierForArbitraryString(text string, languageVersion core.ScriptTarget) string { +func generateIdentifierForArbitraryString(text string) string { needsUnderscore := false identifier := "" var ch rune @@ -2830,9 +2824,9 @@ func generateIdentifierForArbitraryString(text string, languageVersion core.Scri ch, size = utf8.DecodeRuneInString(text[pos:]) var validChar bool if pos == 0 { - validChar = scanner.IsIdentifierStart(ch, languageVersion) + validChar = scanner.IsIdentifierStart(ch) } else { - validChar = scanner.IsIdentifierPart(ch, languageVersion) + validChar = scanner.IsIdentifierPart(ch) } if size > 0 && validChar { if needsUnderscore { @@ -3121,7 +3115,6 @@ func getJSCompletionEntries( file *ast.SourceFile, position int, uniqueNames *collections.Set[string], - target core.ScriptTarget, sortedEntries []*lsproto.CompletionItem, ) []*lsproto.CompletionItem { nameTable := getNameTable(file) @@ -3130,7 +3123,7 @@ func getJSCompletionEntries( if pos == position { continue } - if !uniqueNames.Has(name) && scanner.IsIdentifierText(name, target, core.LanguageVariantStandard) { + if !uniqueNames.Has(name) && scanner.IsIdentifierText(name, core.LanguageVariantStandard) { uniqueNames.Add(name) sortedEntries = core.InsertSorted( sortedEntries, diff --git a/internal/ls/findallreferences.go b/internal/ls/findallreferences.go index ec2a9aa513..ff48544ba1 100644 --- a/internal/ls/findallreferences.go +++ b/internal/ls/findallreferences.go @@ -835,8 +835,8 @@ func getPossibleSymbolReferencePositions(sourceFile *ast.SourceFile, symbolName // before and after it have to be a non-identifier char). endPosition := position + symbolNameLength - if (position == 0 || !scanner.IsIdentifierPart(rune(text[position-1]), core.ScriptTargetLatest)) && - (endPosition == sourceLength || !scanner.IsIdentifierPart(rune(text[endPosition]), core.ScriptTargetLatest)) { + if (position == 0 || !scanner.IsIdentifierPart(rune(text[position-1]))) && + (endPosition == sourceLength || !scanner.IsIdentifierPart(rune(text[endPosition]))) { // Found a real match. Keep searching. positions = append(positions, position) } diff --git a/internal/ls/string_completions.go b/internal/ls/string_completions.go index 78abe3af9f..0821a41d2f 100644 --- a/internal/ls/string_completions.go +++ b/internal/ls/string_completions.go @@ -114,7 +114,6 @@ func (l *LanguageService) convertStringLiteralCompletions( position, file, program, - core.ScriptTargetESNext, preferences, options, clientOptions, diff --git a/internal/scanner/scanner.go b/internal/scanner/scanner.go index 336c1ba826..69df81e277 100644 --- a/internal/scanner/scanner.go +++ b/internal/scanner/scanner.go @@ -186,34 +186,6 @@ var textToToken = func() map[string]ast.Kind { return m }() -// As per ECMAScript Language Specification 5th Edition, Section 7.6: ISyntaxToken Names and Identifiers -// IdentifierStart :: -// -// Can contain Unicode 6.2 categories: -// Uppercase letter (Lu), -// Lowercase letter (Ll), -// Titlecase letter (Lt), -// Modifier letter (Lm), -// Other letter (Lo), or -// Letter number (Nl). -// -// IdentifierPart :: -// -// Can contain IdentifierStart + Unicode 6.2 categories: -// Non-spacing mark (Mn), -// Combining spacing mark (Mc), -// Decimal number (Nd), -// Connector punctuation (Pc), -// , or -// . -// -// Codepoint ranges for ES5 Identifiers are extracted from the Unicode 6.2 specification at: -// http://www.unicode.org/Public/6.2.0/ucd/UnicodeData.txt -var ( - unicodeES5IdentifierStart = []rune{170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500} - unicodeES5IdentifierPart = []rune{170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500} -) - // Generated by scripts/regenerate-unicode-identifier-parts.mjs on node v22.1.0 with unicode 15.1 // based on http://www.unicode.org/reports/tr31/ and https://www.ecma-international.org/ecma-262/6.0/#sec-names-and-keywords // unicodeESNextIdentifierStart corresponds to the ID_Start and Other_ID_Start property, and @@ -244,7 +216,8 @@ type ScannerState struct { } type Scanner struct { - text string + text string + // TODO: remove this? unused except for (unimplemented) regex checking languageVersion core.ScriptTarget languageVariant core.LanguageVariant onError ErrorCallback @@ -846,7 +819,7 @@ func (s *Scanner) Scan() ast.Kind { s.token = ast.KindAtToken case '\\': cp := s.peekUnicodeEscape() - if cp >= 0 && IsIdentifierStart(cp, s.languageVersion) { + if cp >= 0 && IsIdentifierStart(cp) { s.tokenValue = string(s.scanUnicodeEscape(true)) + s.scanIdentifierParts() s.token = GetIdentifierToken(s.tokenValue) } else { @@ -869,7 +842,7 @@ func (s *Scanner) Scan() ast.Kind { if s.charAt(1) == '\\' { s.pos++ cp := s.peekUnicodeEscape() - if cp >= 0 && IsIdentifierStart(cp, s.languageVersion) { + if cp >= 0 && IsIdentifierStart(cp) { s.tokenValue = "#" + string(s.scanUnicodeEscape(true)) + s.scanIdentifierParts() s.token = ast.KindPrivateIdentifier break @@ -1104,7 +1077,7 @@ func (s *Scanner) ReScanSlashToken() ast.Kind { s.pos++ for { ch, size := s.charAndSize() - if size == 0 || !IsIdentifierPart(ch, s.languageVersion) { + if size == 0 || !IsIdentifierPart(ch) { break } s.pos += size @@ -1371,7 +1344,7 @@ func (s *Scanner) ScanJSDocToken() ast.Kind { case '\\': s.pos-- cp := s.peekUnicodeEscape() - if cp >= 0 && IsIdentifierStart(cp, s.languageVersion) { + if cp >= 0 && IsIdentifierStart(cp) { s.tokenValue = string(s.scanUnicodeEscape(true)) + s.scanIdentifierParts() s.token = GetIdentifierToken(s.tokenValue) } else { @@ -1380,14 +1353,14 @@ func (s *Scanner) ScanJSDocToken() ast.Kind { return s.token } - if IsIdentifierStart(ch, s.languageVersion) { + if IsIdentifierStart(ch) { char := ch for { if s.pos >= len(s.text) { break } char, size = s.charAndSize() - if !IsIdentifierPart(char, s.languageVersion) && char != '-' { + if !IsIdentifierPart(char) && char != '-' { break } s.pos += size @@ -1424,11 +1397,11 @@ func (s *Scanner) scanIdentifier(prefixLength int) bool { s.pos = start + prefixLength } ch, size := s.charAndSize() - if IsIdentifierStart(ch, s.languageVersion) { + if IsIdentifierStart(ch) { for { s.pos += size ch, size = s.charAndSize() - if !IsIdentifierPart(ch, s.languageVersion) { + if !IsIdentifierPart(ch) { break } } @@ -1446,13 +1419,13 @@ func (s *Scanner) scanIdentifierParts() string { start := s.pos for { ch, size := s.charAndSize() - if IsIdentifierPart(ch, s.languageVersion) { + if IsIdentifierPart(ch) { s.pos += size continue } if ch == '\\' { escaped := s.peekUnicodeEscape() - if escaped >= 0 && IsIdentifierPart(escaped, s.languageVersion) { + if escaped >= 0 && IsIdentifierPart(escaped) { sb.WriteString(s.text[start:s.pos]) sb.WriteRune(s.scanUnicodeEscape(true)) start = s.pos @@ -1653,7 +1626,7 @@ func (s *Scanner) scanEscapeSequence(flags EscapeSequenceScanningFlags) string { // case CharacterCodes.paragraphSeparator !!! return "" default: - if flags&EscapeSequenceScanningFlagsAnyUnicodeMode != 0 || flags&EscapeSequenceScanningFlagsRegularExpression != 0 && flags&EscapeSequenceScanningFlagsAnnexB == 0 && IsIdentifierPart(ch, s.languageVersion) { + if flags&EscapeSequenceScanningFlagsAnyUnicodeMode != 0 || flags&EscapeSequenceScanningFlagsRegularExpression != 0 && flags&EscapeSequenceScanningFlagsAnnexB == 0 && IsIdentifierPart(ch) { s.errorAt(diagnostics.This_character_cannot_be_escaped_in_a_regular_expression, s.pos-2, 2) } return string(ch) @@ -1796,7 +1769,7 @@ func (s *Scanner) scanNumber() ast.Kind { result = ast.KindNumericLiteral } ch, _ := s.charAndSize() - if IsIdentifierStart(ch, s.languageVersion) { + if IsIdentifierStart(ch) { idStart := s.pos id := s.scanIdentifierParts() if result != ast.KindBigIntLiteral && len(id) == 1 && s.text[idStart] == 'n' { @@ -1965,12 +1938,12 @@ func GetIdentifierToken(str string) ast.Kind { return ast.KindIdentifier } -func IsValidIdentifier(s string, languageVersion core.ScriptTarget) bool { +func IsValidIdentifier(s string) bool { if len(s) == 0 { return false } for i, ch := range s { - if i == 0 && !IsIdentifierStart(ch, languageVersion) || i != 0 && !IsIdentifierPart(ch, languageVersion) { + if i == 0 && !IsIdentifierStart(ch) || i != 0 && !IsIdentifierPart(ch) { return false } } @@ -1982,26 +1955,26 @@ func isWordCharacter(ch rune) bool { return stringutil.IsASCIILetter(ch) || stringutil.IsDigit(ch) || ch == '_' } -func IsIdentifierStart(ch rune, languageVersion core.ScriptTarget) bool { - return stringutil.IsASCIILetter(ch) || ch == '_' || ch == '$' || ch >= utf8.RuneSelf && isUnicodeIdentifierStart(ch, languageVersion) +func IsIdentifierStart(ch rune) bool { + return stringutil.IsASCIILetter(ch) || ch == '_' || ch == '$' || ch >= utf8.RuneSelf && isUnicodeIdentifierStart(ch) } -func IsIdentifierPart(ch rune, languageVersion core.ScriptTarget) bool { - return IsIdentifierPartEx(ch, languageVersion, core.LanguageVariantStandard) +func IsIdentifierPart(ch rune) bool { + return IsIdentifierPartEx(ch, core.LanguageVariantStandard) } -func IsIdentifierPartEx(ch rune, languageVersion core.ScriptTarget, languageVariant core.LanguageVariant) bool { +func IsIdentifierPartEx(ch rune, languageVariant core.LanguageVariant) bool { return isWordCharacter(ch) || ch == '$' || - ch >= utf8.RuneSelf && isUnicodeIdentifierPart(ch, languageVersion) || + ch >= utf8.RuneSelf && isUnicodeIdentifierPart(ch) || languageVariant == core.LanguageVariantJSX && (ch == '-' || ch == ':') // "-" and ":" are valid in JSX Identifiers } -func isUnicodeIdentifierStart(ch rune, languageVersion core.ScriptTarget) bool { - return isInUnicodeRanges(ch, core.IfElse(languageVersion >= core.ScriptTargetES2015, unicodeESNextIdentifierStart, unicodeES5IdentifierStart)) +func isUnicodeIdentifierStart(ch rune) bool { + return isInUnicodeRanges(ch, unicodeESNextIdentifierStart) } -func isUnicodeIdentifierPart(ch rune, languageVersion core.ScriptTarget) bool { - return isInUnicodeRanges(ch, core.IfElse(languageVersion >= core.ScriptTargetES2015, unicodeESNextIdentifierPart, unicodeES5IdentifierPart)) +func isUnicodeIdentifierPart(ch rune) bool { + return isInUnicodeRanges(ch, unicodeESNextIdentifierPart) } func isInUnicodeRanges(cp rune, ranges []rune) bool { diff --git a/internal/scanner/utilities.go b/internal/scanner/utilities.go index bcf178e6c7..06ba7cf666 100644 --- a/internal/scanner/utilities.go +++ b/internal/scanner/utilities.go @@ -47,14 +47,14 @@ func DeclarationNameToString(name *ast.Node) string { return GetTextOfNode(name) } -func IsIdentifierText(name string, languageVersion core.ScriptTarget, languageVariant core.LanguageVariant) bool { +func IsIdentifierText(name string, languageVariant core.LanguageVariant) bool { ch, size := utf8.DecodeRuneInString(name) - if !IsIdentifierStart(ch, languageVersion) { + if !IsIdentifierStart(ch) { return false } for i := size; i < len(name); { ch, size = utf8.DecodeRuneInString(name[i:]) - if !IsIdentifierPartEx(ch, languageVersion, languageVariant) { + if !IsIdentifierPartEx(ch, languageVariant) { return false } i += size diff --git a/internal/transformers/jsx.go b/internal/transformers/jsx.go index 9f55368e53..e4f047016b 100644 --- a/internal/transformers/jsx.go +++ b/internal/transformers/jsx.go @@ -507,7 +507,7 @@ func (tx *JSXTransformer) getAttributeName(node *ast.JsxAttribute) *ast.Node { name := node.Name() if ast.IsIdentifier(name) { text := name.Text() - if scanner.IsIdentifierText(text, tx.compilerOptions.GetEmitScriptTarget(), core.LanguageVariantStandard) { + if scanner.IsIdentifierText(text, core.LanguageVariantStandard) { return name } return tx.factory.NewStringLiteral(text) diff --git a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).errors.txt b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).errors.txt index 9c6d434461..9a74eabd76 100644 --- a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).errors.txt +++ b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).errors.txt @@ -1,157 +1,37 @@ -astralAsSurrogatePair.ts(1,11): error TS1127: Invalid character. -astralAsSurrogatePair.ts(1,13): error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'as'. astralAsSurrogatePair.ts(1,16): error TS1127: Invalid character. astralAsSurrogatePair.ts(1,17): error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'uD800'. astralAsSurrogatePair.ts(1,22): error TS1127: Invalid character. astralAsSurrogatePair.ts(1,23): error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'uDEA7'. -extendedEscapesForAstralsInVarsAndClasses.ts(2,5): error TS1127: Invalid character. -extendedEscapesForAstralsInVarsAndClasses.ts(2,6): error TS1134: Variable declaration expected. -extendedEscapesForAstralsInVarsAndClasses.ts(3,5): error TS1127: Invalid character. -extendedEscapesForAstralsInVarsAndClasses.ts(3,7): error TS1005: ',' expected. -extendedEscapesForAstralsInVarsAndClasses.ts(3,11): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. -extendedEscapesForAstralsInVarsAndClasses.ts(6,5): error TS1127: Invalid character. -extendedEscapesForAstralsInVarsAndClasses.ts(6,7): error TS1128: Declaration or statement expected. -extendedEscapesForAstralsInVarsAndClasses.ts(9,5): error TS1127: Invalid character. -extendedEscapesForAstralsInVarsAndClasses.ts(9,6): error TS1434: Unexpected keyword or identifier. -extendedEscapesForAstralsInVarsAndClasses.ts(9,11): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. -extendedEscapesForAstralsInVarsAndClasses.ts(9,15): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. -extendedEscapesForAstralsInVarsAndClasses.ts(13,5): error TS1127: Invalid character. -extendedEscapesForAstralsInVarsAndClasses.ts(13,6): error TS1434: Unexpected keyword or identifier. -extendedEscapesForAstralsInVarsAndClasses.ts(13,7): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -extendedEscapesForAstralsInVarsAndClasses.ts(13,11): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. -extendedEscapesForAstralsInVarsAndClasses.ts(13,14): error TS1128: Declaration or statement expected. -extendedEscapesForAstralsInVarsAndClasses.ts(14,5): error TS2304: Cannot find name 'constructor'. -extendedEscapesForAstralsInVarsAndClasses.ts(14,19): error TS1005: ';' expected. -extendedEscapesForAstralsInVarsAndClasses.ts(15,9): error TS2532: Object is possibly 'undefined'. -extendedEscapesForAstralsInVarsAndClasses.ts(15,14): error TS1127: Invalid character. -extendedEscapesForAstralsInVarsAndClasses.ts(15,15): error TS1434: Unexpected keyword or identifier. -extendedEscapesForAstralsInVarsAndClasses.ts(15,20): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. -extendedEscapesForAstralsInVarsAndClasses.ts(15,24): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. -extendedEscapesForAstralsInVarsAndClasses.ts(17,5): error TS2304: Cannot find name 'methodA'. -extendedEscapesForAstralsInVarsAndClasses.ts(17,15): error TS1005: ';' expected. -extendedEscapesForAstralsInVarsAndClasses.ts(18,21): error TS1127: Invalid character. -extendedEscapesForAstralsInVarsAndClasses.ts(20,1): error TS1128: Declaration or statement expected. -extendedEscapesForAstralsInVarsAndClasses.ts(22,13): error TS1127: Invalid character. -extendedEscapesForAstralsInVarsAndClasses.ts(22,15): error TS1134: Variable declaration expected. -extendedEscapesForAstralsInVarsAndClasses.ts(22,17): error TS1389: 'new' is not allowed as a variable declaration name. -extendedEscapesForAstralsInVarsAndClasses.ts(22,27): error TS1127: Invalid character. -extendedEscapesForAstralsInVarsAndClasses.ts(22,28): error TS1434: Unexpected keyword or identifier. -extendedEscapesForAstralsInVarsAndClasses.ts(22,33): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. -extendedEscapesForAstralsInVarsAndClasses.ts(22,49): error TS2339: Property 'methodA' does not exist on type 'Foo'. -extendedEscapesForAstralsInVarsAndClasses.ts(24,2): error TS1127: Invalid character. -extendedEscapesForAstralsInVarsAndClasses.ts(24,3): error TS1434: Unexpected keyword or identifier. -extendedEscapesForAstralsInVarsAndClasses.ts(24,8): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. -extendedEscapesForAstralsInVarsAndClasses.ts(24,12): error TS1128: Declaration or statement expected. -==== extendedEscapesForAstralsInVarsAndClasses.ts (38 errors) ==== +==== extendedEscapesForAstralsInVarsAndClasses.ts (0 errors) ==== // U+102A7 CARIAN LETTER A2 var ðЧ: string; - ~ -!!! error TS1127: Invalid character. - ~ -!!! error TS1134: Variable declaration expected. var \u{102A7}: string; - ~ -!!! error TS1127: Invalid character. - ~ -!!! error TS1005: ',' expected. - ~~ -!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. if (Math.random()) { ðŠ§ = "hello"; - ~ -!!! error TS1127: Invalid character. - ~ -!!! error TS1128: Declaration or statement expected. } else { \u{102A7} = "hallo"; - ~ -!!! error TS1127: Invalid character. - ~ -!!! error TS1434: Unexpected keyword or identifier. - ~~ -!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. - ~ -!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. } class Foo { \u{102A7}: string; - ~ -!!! error TS1127: Invalid character. - ~ -!!! error TS1434: Unexpected keyword or identifier. - ~ -!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - ~~ -!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. - ~ -!!! error TS1128: Declaration or statement expected. constructor() { - ~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'constructor'. - ~ -!!! error TS1005: ';' expected. this.\u{102A7} = " world"; - ~~~~ -!!! error TS2532: Object is possibly 'undefined'. - ~ -!!! error TS1127: Invalid character. - ~ -!!! error TS1434: Unexpected keyword or identifier. - ~~ -!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. - ~ -!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. } methodA() { - ~~~~~~~ -!!! error TS2304: Cannot find name 'methodA'. - ~ -!!! error TS1005: ';' expected. return this.ðЧ; - ~ -!!! error TS1127: Invalid character. } } - ~ -!!! error TS1128: Declaration or statement expected. export var _ðŠ§ = new Foo().\u{102A7} + new Foo().methodA(); - ~ -!!! error TS1127: Invalid character. - ~ -!!! error TS1134: Variable declaration expected. - ~~~ -!!! error TS1389: 'new' is not allowed as a variable declaration name. - ~ -!!! error TS1127: Invalid character. - ~ -!!! error TS1434: Unexpected keyword or identifier. - ~~ -!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. - ~~~~~~~ -!!! error TS2339: Property 'methodA' does not exist on type 'Foo'. _\u{102A7} += "!"; - ~ -!!! error TS1127: Invalid character. - ~ -!!! error TS1434: Unexpected keyword or identifier. - ~~ -!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. - ~~ -!!! error TS1128: Declaration or statement expected. -==== astralAsSurrogatePair.ts (6 errors) ==== +==== astralAsSurrogatePair.ts (4 errors) ==== import { _ðŠ§ as \uD800\uDEA7 } from "./extendedEscapesForAstralsInVarsAndClasses.js"; - ~ -!!! error TS1127: Invalid character. - ~~ -!!! error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'as'. ~ !!! error TS1127: Invalid character. ~~~~~ diff --git a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).errors.txt.diff index 988061d8ac..d17b7dcc0e 100644 --- a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).errors.txt.diff @@ -2,160 +2,176 @@ +++ new.unicodeEscapesInNames02(target=es5).errors.txt @@= skipped -0, +0 lines =@@ -error TS-1: Pre-emit (44) and post-emit (45) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! - astralAsSurrogatePair.ts(1,11): error TS1127: Invalid character. +-astralAsSurrogatePair.ts(1,11): error TS1127: Invalid character. -astralAsSurrogatePair.ts(1,14): error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'as'. -astralAsSurrogatePair.ts(1,17): error TS1127: Invalid character. -astralAsSurrogatePair.ts(1,18): error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'uD800'. -astralAsSurrogatePair.ts(1,23): error TS1127: Invalid character. -astralAsSurrogatePair.ts(1,24): error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'uDEA7'. -+astralAsSurrogatePair.ts(1,13): error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'as'. -+astralAsSurrogatePair.ts(1,16): error TS1127: Invalid character. -+astralAsSurrogatePair.ts(1,17): error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'uD800'. -+astralAsSurrogatePair.ts(1,22): error TS1127: Invalid character. -+astralAsSurrogatePair.ts(1,23): error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'uDEA7'. - extendedEscapesForAstralsInVarsAndClasses.ts(2,5): error TS1127: Invalid character. +-extendedEscapesForAstralsInVarsAndClasses.ts(2,5): error TS1127: Invalid character. -extendedEscapesForAstralsInVarsAndClasses.ts(2,7): error TS1134: Variable declaration expected. -+extendedEscapesForAstralsInVarsAndClasses.ts(2,6): error TS1134: Variable declaration expected. - extendedEscapesForAstralsInVarsAndClasses.ts(3,5): error TS1127: Invalid character. - extendedEscapesForAstralsInVarsAndClasses.ts(3,7): error TS1005: ',' expected. - extendedEscapesForAstralsInVarsAndClasses.ts(3,11): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. - extendedEscapesForAstralsInVarsAndClasses.ts(6,5): error TS1127: Invalid character. +-extendedEscapesForAstralsInVarsAndClasses.ts(3,5): error TS1127: Invalid character. +-extendedEscapesForAstralsInVarsAndClasses.ts(3,7): error TS1005: ',' expected. +-extendedEscapesForAstralsInVarsAndClasses.ts(3,11): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +-extendedEscapesForAstralsInVarsAndClasses.ts(6,5): error TS1127: Invalid character. -extendedEscapesForAstralsInVarsAndClasses.ts(6,8): error TS1128: Declaration or statement expected. -+extendedEscapesForAstralsInVarsAndClasses.ts(6,7): error TS1128: Declaration or statement expected. - extendedEscapesForAstralsInVarsAndClasses.ts(9,5): error TS1127: Invalid character. - extendedEscapesForAstralsInVarsAndClasses.ts(9,6): error TS1434: Unexpected keyword or identifier. - extendedEscapesForAstralsInVarsAndClasses.ts(9,11): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. -@@= skipped -32, +31 lines =@@ - extendedEscapesForAstralsInVarsAndClasses.ts(18,21): error TS1127: Invalid character. - extendedEscapesForAstralsInVarsAndClasses.ts(20,1): error TS1128: Declaration or statement expected. - extendedEscapesForAstralsInVarsAndClasses.ts(22,13): error TS1127: Invalid character. +-extendedEscapesForAstralsInVarsAndClasses.ts(9,5): error TS1127: Invalid character. +-extendedEscapesForAstralsInVarsAndClasses.ts(9,6): error TS1434: Unexpected keyword or identifier. +-extendedEscapesForAstralsInVarsAndClasses.ts(9,11): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +-extendedEscapesForAstralsInVarsAndClasses.ts(9,15): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. +-extendedEscapesForAstralsInVarsAndClasses.ts(13,5): error TS1127: Invalid character. +-extendedEscapesForAstralsInVarsAndClasses.ts(13,6): error TS1434: Unexpected keyword or identifier. +-extendedEscapesForAstralsInVarsAndClasses.ts(13,7): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +-extendedEscapesForAstralsInVarsAndClasses.ts(13,11): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +-extendedEscapesForAstralsInVarsAndClasses.ts(13,14): error TS1128: Declaration or statement expected. +-extendedEscapesForAstralsInVarsAndClasses.ts(14,5): error TS2304: Cannot find name 'constructor'. +-extendedEscapesForAstralsInVarsAndClasses.ts(14,19): error TS1005: ';' expected. +-extendedEscapesForAstralsInVarsAndClasses.ts(15,9): error TS2532: Object is possibly 'undefined'. +-extendedEscapesForAstralsInVarsAndClasses.ts(15,14): error TS1127: Invalid character. +-extendedEscapesForAstralsInVarsAndClasses.ts(15,15): error TS1434: Unexpected keyword or identifier. +-extendedEscapesForAstralsInVarsAndClasses.ts(15,20): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +-extendedEscapesForAstralsInVarsAndClasses.ts(15,24): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. +-extendedEscapesForAstralsInVarsAndClasses.ts(17,5): error TS2304: Cannot find name 'methodA'. +-extendedEscapesForAstralsInVarsAndClasses.ts(17,15): error TS1005: ';' expected. +-extendedEscapesForAstralsInVarsAndClasses.ts(18,21): error TS1127: Invalid character. +-extendedEscapesForAstralsInVarsAndClasses.ts(20,1): error TS1128: Declaration or statement expected. +-extendedEscapesForAstralsInVarsAndClasses.ts(22,13): error TS1127: Invalid character. -extendedEscapesForAstralsInVarsAndClasses.ts(22,16): error TS1134: Variable declaration expected. -extendedEscapesForAstralsInVarsAndClasses.ts(22,18): error TS1389: 'new' is not allowed as a variable declaration name. -extendedEscapesForAstralsInVarsAndClasses.ts(22,28): error TS1127: Invalid character. -extendedEscapesForAstralsInVarsAndClasses.ts(22,29): error TS1434: Unexpected keyword or identifier. -extendedEscapesForAstralsInVarsAndClasses.ts(22,34): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. -extendedEscapesForAstralsInVarsAndClasses.ts(22,50): error TS2339: Property 'methodA' does not exist on type 'Foo'. -+extendedEscapesForAstralsInVarsAndClasses.ts(22,15): error TS1134: Variable declaration expected. -+extendedEscapesForAstralsInVarsAndClasses.ts(22,17): error TS1389: 'new' is not allowed as a variable declaration name. -+extendedEscapesForAstralsInVarsAndClasses.ts(22,27): error TS1127: Invalid character. -+extendedEscapesForAstralsInVarsAndClasses.ts(22,28): error TS1434: Unexpected keyword or identifier. -+extendedEscapesForAstralsInVarsAndClasses.ts(22,33): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. -+extendedEscapesForAstralsInVarsAndClasses.ts(22,49): error TS2339: Property 'methodA' does not exist on type 'Foo'. - extendedEscapesForAstralsInVarsAndClasses.ts(24,2): error TS1127: Invalid character. - extendedEscapesForAstralsInVarsAndClasses.ts(24,3): error TS1434: Unexpected keyword or identifier. - extendedEscapesForAstralsInVarsAndClasses.ts(24,8): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. - extendedEscapesForAstralsInVarsAndClasses.ts(24,12): error TS1128: Declaration or statement expected. - - +-extendedEscapesForAstralsInVarsAndClasses.ts(24,2): error TS1127: Invalid character. +-extendedEscapesForAstralsInVarsAndClasses.ts(24,3): error TS1434: Unexpected keyword or identifier. +-extendedEscapesForAstralsInVarsAndClasses.ts(24,8): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +-extendedEscapesForAstralsInVarsAndClasses.ts(24,12): error TS1128: Declaration or statement expected. +- +- -!!! error TS-1: Pre-emit (44) and post-emit (45) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! -!!! related TS-1: The excess diagnostics are: -!!! related TS2532 extendedEscapesForAstralsInVarsAndClasses.ts:18:16: Object is possibly 'undefined'. - ==== extendedEscapesForAstralsInVarsAndClasses.ts (38 errors) ==== +-==== extendedEscapesForAstralsInVarsAndClasses.ts (38 errors) ==== ++astralAsSurrogatePair.ts(1,16): error TS1127: Invalid character. ++astralAsSurrogatePair.ts(1,17): error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'uD800'. ++astralAsSurrogatePair.ts(1,22): error TS1127: Invalid character. ++astralAsSurrogatePair.ts(1,23): error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'uDEA7'. ++ ++ ++==== extendedEscapesForAstralsInVarsAndClasses.ts (0 errors) ==== // U+102A7 CARIAN LETTER A2 var ðЧ: string; - ~~ -+ ~ - !!! error TS1127: Invalid character. +-!!! error TS1127: Invalid character. - ~ -+ ~ - !!! error TS1134: Variable declaration expected. +-!!! error TS1134: Variable declaration expected. var \u{102A7}: string; - -+ ~ - !!! error TS1127: Invalid character. - ~ - !!! error TS1005: ',' expected. -@@= skipped -32, +29 lines =@@ +-!!! error TS1127: Invalid character. +- ~ +-!!! error TS1005: ',' expected. +- ~~ +-!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. if (Math.random()) { ðŠ§ = "hello"; - ~~ -+ ~ - !!! error TS1127: Invalid character. +-!!! error TS1127: Invalid character. - ~ -+ ~ - !!! error TS1128: Declaration or statement expected. +-!!! error TS1128: Declaration or statement expected. } else { \u{102A7} = "hallo"; - -+ ~ - !!! error TS1127: Invalid character. - ~ - !!! error TS1434: Unexpected keyword or identifier. -@@= skipped -19, +19 lines =@@ +-!!! error TS1127: Invalid character. +- ~ +-!!! error TS1434: Unexpected keyword or identifier. +- ~~ +-!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +- ~ +-!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. + } class Foo { \u{102A7}: string; - -+ ~ - !!! error TS1127: Invalid character. - ~ - !!! error TS1434: Unexpected keyword or identifier. -@@= skipped -18, +18 lines =@@ +-!!! error TS1127: Invalid character. +- ~ +-!!! error TS1434: Unexpected keyword or identifier. +- ~ +-!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +- ~~ +-!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +- ~ +-!!! error TS1128: Declaration or statement expected. + constructor() { +- ~~~~~~~~~~~ +-!!! error TS2304: Cannot find name 'constructor'. +- ~ +-!!! error TS1005: ';' expected. this.\u{102A7} = " world"; - ~~~~ - !!! error TS2532: Object is possibly 'undefined'. +- ~~~~ +-!!! error TS2532: Object is possibly 'undefined'. - -+ ~ - !!! error TS1127: Invalid character. - ~ - !!! error TS1434: Unexpected keyword or identifier. -@@= skipped -15, +15 lines =@@ - ~ - !!! error TS1005: ';' expected. +-!!! error TS1127: Invalid character. +- ~ +-!!! error TS1434: Unexpected keyword or identifier. +- ~~ +-!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +- ~ +-!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. + } + methodA() { +- ~~~~~~~ +-!!! error TS2304: Cannot find name 'methodA'. +- ~ +-!!! error TS1005: ';' expected. return this.ðЧ; - ~~ -+ ~ - !!! error TS1127: Invalid character. +-!!! error TS1127: Invalid character. } } -@@= skipped -8, +8 lines =@@ - !!! error TS1128: Declaration or statement expected. +- ~ +-!!! error TS1128: Declaration or statement expected. export var _ðŠ§ = new Foo().\u{102A7} + new Foo().methodA(); - ~~ -+ ~ - !!! error TS1127: Invalid character. +-!!! error TS1127: Invalid character. - ~ -+ ~ - !!! error TS1134: Variable declaration expected. +-!!! error TS1134: Variable declaration expected. - ~~~ -+ ~~~ - !!! error TS1389: 'new' is not allowed as a variable declaration name. +-!!! error TS1389: 'new' is not allowed as a variable declaration name. - -+ ~ - !!! error TS1127: Invalid character. +-!!! error TS1127: Invalid character. - ~ -+ ~ - !!! error TS1434: Unexpected keyword or identifier. +-!!! error TS1434: Unexpected keyword or identifier. - ~~ -+ ~~ - !!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +-!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. - ~~~~~~~ -+ ~~~~~~~ - !!! error TS2339: Property 'methodA' does not exist on type 'Foo'. +-!!! error TS2339: Property 'methodA' does not exist on type 'Foo'. _\u{102A7} += "!"; - -+ ~ - !!! error TS1127: Invalid character. - ~ - !!! error TS1434: Unexpected keyword or identifier. -@@= skipped -27, +27 lines =@@ +-!!! error TS1127: Invalid character. +- ~ +-!!! error TS1434: Unexpected keyword or identifier. +- ~~ +-!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. +- ~~ +-!!! error TS1128: Declaration or statement expected. - ==== astralAsSurrogatePair.ts (6 errors) ==== +-==== astralAsSurrogatePair.ts (6 errors) ==== ++==== astralAsSurrogatePair.ts (4 errors) ==== import { _ðŠ§ as \uD800\uDEA7 } from "./extendedEscapesForAstralsInVarsAndClasses.js"; - ~~ -+ ~ - !!! error TS1127: Invalid character. +-!!! error TS1127: Invalid character. - ~~ -+ ~~ - !!! error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'as'. +-!!! error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'as'. - -+ ~ - !!! error TS1127: Invalid character. +-!!! error TS1127: Invalid character. - ~~~~~ ++ ~ ++!!! error TS1127: Invalid character. + ~~~~~ !!! error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'uD800'. - diff --git a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js index 7b2e943ca8..09e147f3bc 100644 --- a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js +++ b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js @@ -32,57 +32,25 @@ import { _ðŠ§ as \uD800\uDEA7 } from "./extendedEscapesForAstralsInVarsAndClass //// [extendedEscapesForAstralsInVarsAndClasses.js] // U+102A7 CARIAN LETTER A2 -var string; -var u, { 102: A7 }; +var ðЧ; +var \u{102A7}; if (Math.random()) { - "hello"; + ðŠ§ = "hello"; } else { - u; - { - 102; - A7; - } - "hallo"; + \u{102A7} = "hallo"; } class Foo { - u; -} -{ - 102; - A7; -} -string; -constructor(); -{ - this.; - u; - { - 102; - A7; + \u{102A7}; + constructor() { + this.\u{102A7} = " world"; + } + methodA() { + return this.ðЧ; } - " world"; -} -methodA(); -{ - return this.; - ; -} -export var _; -new Foo().; -u; -{ - 102; - A7; -} -+new Foo().methodA(); -_; -u; -{ - 102; - A7; } -"!"; +export var _ðŠ§ = new Foo().\u{102A7} + new Foo().methodA(); +_\u{102A7} += "!"; //# sourceMappingURL=extendedEscapesForAstralsInVarsAndClasses.js.map //// [astralAsSurrogatePair.js] export {}; diff --git a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js.diff b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js.diff index 4c42e1ae4b..054118bcab 100644 --- a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js.diff +++ b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js.diff @@ -1,36 +1,77 @@ --- old.unicodeEscapesInNames02(target=es5).js +++ new.unicodeEscapesInNames02(target=es5).js -@@= skipped -32, +32 lines =@@ +@@= skipped -31, +31 lines =@@ + //// [extendedEscapesForAstralsInVarsAndClasses.js] // U+102A7 CARIAN LETTER A2 - var string; +-var string; -var u, A7 = (void 0)[102]; -+var u, { 102: A7 }; ++var ðЧ; ++var \u{102A7}; if (Math.random()) { - "hello"; - } -@@= skipped -12, +12 lines =@@ - } - "hallo"; +- "hello"; ++ ðŠ§ = "hello"; } + else { +- u; +- { +- 102; +- A7; +- } +- "hallo"; +-} -var Foo = /** @class */ (function () { - function Foo() { - } - return Foo; -}()); +-{ +- 102; +- A7; +-} +-string; +-constructor(); +-{ +- this.; +- u; +- { +- 102; +- A7; +- } +- " world"; +-} +-methodA(); +-{ +- return this.ðЧ; +-} +-export var _; +-new Foo().; +-u; +-{ +- 102; +- A7; +-} +-+new Foo().methodA(); +-_; +-u; +-{ +- 102; +- A7; +-} +-"!"; ++ \u{102A7} = "hallo"; ++} +class Foo { -+ u; ++ \u{102A7}; ++ constructor() { ++ this.\u{102A7} = " world"; ++ } ++ methodA() { ++ return this.ðЧ; ++ } +} - { - 102; - A7; -@@= skipped -22, +20 lines =@@ - } - methodA(); - { -- return this.ðЧ; -+ return this.; -+ ; - } - export var _; - new Foo().; \ No newline at end of file ++export var _ðŠ§ = new Foo().\u{102A7} + new Foo().methodA(); ++_\u{102A7} += "!"; + //# sourceMappingURL=extendedEscapesForAstralsInVarsAndClasses.js.map + //// [astralAsSurrogatePair.js] + export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js.map b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js.map index 6c9300cc12..00ac89b844 100644 --- a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js.map +++ b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js.map @@ -1,6 +1,6 @@ //// [extendedEscapesForAstralsInVarsAndClasses.js.map] -{"version":3,"file":"extendedEscapesForAstralsInVarsAndClasses.js","sourceRoot":"","sources":["extendedEscapesForAstralsInVarsAndClasses.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,IAAO,MAAM,CAAC;AACd,IAAK,CAAC,EAAA,EAAC,GAAG,EAAA,EAAE,EAAS,CAAC;AAEtB,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;IACZ,OAAO,CAAC;AAChB,CAAC;KACI,CAAC;IACD,CAAC,CAAA;IAAA,CAAC;QAAA,GAAG,CAAA;QAAA,EAAE,CAAA;IAAA,CAAC;IAAG,OAAO,CAAC;AACxB,CAAC;AAED,MAAM,GAAG;IACJ,CAAC,CAAA;CAAA;AAAA,CAAC;IAAA,GAAG,CAAA;IAAA,EAAE,CAAA;AAAA,CAAC;AAAE,MAAM,CAAC;AAClB,WAAW,EAAE,CAAA;AAAC,CAAC;IACX,IAAI,CAAC,CAAA;IAAC,CAAC,CAAA;IAAA,CAAC;QAAA,GAAG,CAAA;QAAA,EAAE,CAAA;IAAA,CAAC;IAAG,QAAQ,CAAC;AAC9B,CAAC;AACD,OAAO,EAAE,CAAA;AAAC,CAAC;IACP,OAAO,IAAI,CAAC,CAAA;IAAC,CAAC;AAClB,CAAC;AAGL,MAAM,CAAC,IAAI,CAAI,CAAA;AAAC,IAAI,GAAG,EAAE,CAAC,CAAA;AAAC,CAAC,CAAA;AAAA,CAAC;IAAA,GAAG,CAAA;IAAA,EAAE,CAAA;AAAA,CAAC;AAAC,CAAE,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;AAE1D,CAAC,CAAA;AAAC,CAAC,CAAA;AAAA,CAAC;IAAA,GAAG,CAAA;IAAA,EAAE,CAAA;AAAA,CAAC;AAAI,GAAG,CAAC"} -//// https://sokra.github.io/source-map-visualization#base64,Ly8gVSsxMDJBNyBDQVJJQU4gTEVUVEVSIEEyDQp2YXIgc3RyaW5nOw0KdmFyIHUsIHsgMTAyOiBBNyB9Ow0KaWYgKE1hdGgucmFuZG9tKCkpIHsNCiAgICAiaGVsbG8iOw0KfQ0KZWxzZSB7DQogICAgdTsNCiAgICB7DQogICAgICAgIDEwMjsNCiAgICAgICAgQTc7DQogICAgfQ0KICAgICJoYWxsbyI7DQp9DQpjbGFzcyBGb28gew0KICAgIHU7DQp9DQp7DQogICAgMTAyOw0KICAgIEE3Ow0KfQ0Kc3RyaW5nOw0KY29uc3RydWN0b3IoKTsNCnsNCiAgICB0aGlzLjsNCiAgICB1Ow0KICAgIHsNCiAgICAgICAgMTAyOw0KICAgICAgICBBNzsNCiAgICB9DQogICAgIiB3b3JsZCI7DQp9DQptZXRob2RBKCk7DQp7DQogICAgcmV0dXJuIHRoaXMuOw0KICAgIDsNCn0NCmV4cG9ydCB2YXIgXzsNCm5ldyBGb28oKS47DQp1Ow0Kew0KICAgIDEwMjsNCiAgICBBNzsNCn0NCituZXcgRm9vKCkubWV0aG9kQSgpOw0KXzsNCnU7DQp7DQogICAgMTAyOw0KICAgIEE3Ow0KfQ0KIiEiOw0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9ZXh0ZW5kZWRFc2NhcGVzRm9yQXN0cmFsc0luVmFyc0FuZENsYXNzZXMuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXh0ZW5kZWRFc2NhcGVzRm9yQXN0cmFsc0luVmFyc0FuZENsYXNzZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJleHRlbmRlZEVzY2FwZXNGb3JBc3RyYWxzSW5WYXJzQW5kQ2xhc3Nlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyQkFBMkI7QUFDM0IsSUFBTyxNQUFNLENBQUM7QUFDZCxJQUFLLENBQUMsRUFBQSxFQUFDLEdBQUcsRUFBQSxFQUFFLEVBQVMsQ0FBQztBQUV0QixJQUFJLElBQUksQ0FBQyxNQUFNLEVBQUUsRUFBRSxDQUFDO0lBQ1osT0FBTyxDQUFDO0FBQ2hCLENBQUM7S0FDSSxDQUFDO0lBQ0QsQ0FBQyxDQUFBO0lBQUEsQ0FBQztRQUFBLEdBQUcsQ0FBQTtRQUFBLEVBQUUsQ0FBQTtJQUFBLENBQUM7SUFBRyxPQUFPLENBQUM7QUFDeEIsQ0FBQztBQUVELE1BQU0sR0FBRztJQUNKLENBQUMsQ0FBQTtDQUFBO0FBQUEsQ0FBQztJQUFBLEdBQUcsQ0FBQTtJQUFBLEVBQUUsQ0FBQTtBQUFBLENBQUM7QUFBRSxNQUFNLENBQUM7QUFDbEIsV0FBVyxFQUFFLENBQUE7QUFBQyxDQUFDO0lBQ1gsSUFBSSxDQUFDLENBQUE7SUFBQyxDQUFDLENBQUE7SUFBQSxDQUFDO1FBQUEsR0FBRyxDQUFBO1FBQUEsRUFBRSxDQUFBO0lBQUEsQ0FBQztJQUFHLFFBQVEsQ0FBQztBQUM5QixDQUFDO0FBQ0QsT0FBTyxFQUFFLENBQUE7QUFBQyxDQUFDO0lBQ1AsT0FBTyxJQUFJLENBQUMsQ0FBQTtJQUFDLENBQUM7QUFDbEIsQ0FBQztBQUdMLE1BQU0sQ0FBQyxJQUFJLENBQUksQ0FBQTtBQUFDLElBQUksR0FBRyxFQUFFLENBQUMsQ0FBQTtBQUFDLENBQUMsQ0FBQTtBQUFBLENBQUM7SUFBQSxHQUFHLENBQUE7SUFBQSxFQUFFLENBQUE7QUFBQSxDQUFDO0FBQUMsQ0FBRSxJQUFJLEdBQUcsRUFBRSxDQUFDLE9BQU8sRUFBRSxDQUFDO0FBRTFELENBQUMsQ0FBQTtBQUFDLENBQUMsQ0FBQTtBQUFBLENBQUM7SUFBQSxHQUFHLENBQUE7SUFBQSxFQUFFLENBQUE7QUFBQSxDQUFDO0FBQUksR0FBRyxDQUFDIn0=,Ly8gVSsxMDJBNyBDQVJJQU4gTEVUVEVSIEEyCnZhciDwkIqnOiBzdHJpbmc7CnZhciBcdXsxMDJBN306IHN0cmluZzsKCmlmIChNYXRoLnJhbmRvbSgpKSB7CiAgICDwkIqnID0gImhlbGxvIjsKfQplbHNlIHsKICAgIFx1ezEwMkE3fSA9ICJoYWxsbyI7Cn0KCmNsYXNzIEZvbyB7CiAgICBcdXsxMDJBN306IHN0cmluZzsKICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgIHRoaXMuXHV7MTAyQTd9ID0gIiB3b3JsZCI7CiAgICB9CiAgICBtZXRob2RBKCkgewogICAgICAgIHJldHVybiB0aGlzLvCQiqc7CiAgICB9Cn0KCmV4cG9ydCB2YXIgX/CQiqcgPSBuZXcgRm9vKCkuXHV7MTAyQTd9ICsgbmV3IEZvbygpLm1ldGhvZEEoKTsKCl9cdXsxMDJBN30gKz0gIiEiOwo= +{"version":3,"file":"extendedEscapesForAstralsInVarsAndClasses.js","sourceRoot":"","sources":["extendedEscapesForAstralsInVarsAndClasses.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,IAAI,IAAS,CAAC;AACd,IAAI,SAAiB,CAAC;AAEtB,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;IAChB,IAAC,GAAG,OAAO,CAAC;AAChB,CAAC;KACI,CAAC;IACF,SAAS,GAAG,OAAO,CAAC;AACxB,CAAC;AAED,MAAM,GAAG;IACL,SAAS,CAAS;IAClB,cAAc;QACV,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAAA,CAC7B;IACD,OAAO,GAAG;QACN,OAAO,IAAI,CAAC,IAAC,CAAC;IAAA,CACjB;CACJ;AAED,MAAM,CAAC,IAAI,KAAE,GAAG,IAAI,GAAG,EAAE,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;AAE1D,UAAU,IAAI,GAAG,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,Ly8gVSsxMDJBNyBDQVJJQU4gTEVUVEVSIEEyDQp2YXIg8JCKpzsNCnZhciBcdXsxMDJBN307DQppZiAoTWF0aC5yYW5kb20oKSkgew0KICAgIPCQiqcgPSAiaGVsbG8iOw0KfQ0KZWxzZSB7DQogICAgXHV7MTAyQTd9ID0gImhhbGxvIjsNCn0NCmNsYXNzIEZvbyB7DQogICAgXHV7MTAyQTd9Ow0KICAgIGNvbnN0cnVjdG9yKCkgew0KICAgICAgICB0aGlzLlx1ezEwMkE3fSA9ICIgd29ybGQiOw0KICAgIH0NCiAgICBtZXRob2RBKCkgew0KICAgICAgICByZXR1cm4gdGhpcy7wkIqnOw0KICAgIH0NCn0NCmV4cG9ydCB2YXIgX/CQiqcgPSBuZXcgRm9vKCkuXHV7MTAyQTd9ICsgbmV3IEZvbygpLm1ldGhvZEEoKTsNCl9cdXsxMDJBN30gKz0gIiEiOw0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9ZXh0ZW5kZWRFc2NhcGVzRm9yQXN0cmFsc0luVmFyc0FuZENsYXNzZXMuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXh0ZW5kZWRFc2NhcGVzRm9yQXN0cmFsc0luVmFyc0FuZENsYXNzZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJleHRlbmRlZEVzY2FwZXNGb3JBc3RyYWxzSW5WYXJzQW5kQ2xhc3Nlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyQkFBMkI7QUFDM0IsSUFBSSxJQUFTLENBQUM7QUFDZCxJQUFJLFNBQWlCLENBQUM7QUFFdEIsSUFBSSxJQUFJLENBQUMsTUFBTSxFQUFFLEVBQUUsQ0FBQztJQUNoQixJQUFDLEdBQUcsT0FBTyxDQUFDO0FBQ2hCLENBQUM7S0FDSSxDQUFDO0lBQ0YsU0FBUyxHQUFHLE9BQU8sQ0FBQztBQUN4QixDQUFDO0FBRUQsTUFBTSxHQUFHO0lBQ0wsU0FBUyxDQUFTO0lBQ2xCLGNBQWM7UUFDVixJQUFJLENBQUMsU0FBUyxHQUFHLFFBQVEsQ0FBQztJQUFBLENBQzdCO0lBQ0QsT0FBTyxHQUFHO1FBQ04sT0FBTyxJQUFJLENBQUMsSUFBQyxDQUFDO0lBQUEsQ0FDakI7Q0FDSjtBQUVELE1BQU0sQ0FBQyxJQUFJLEtBQUUsR0FBRyxJQUFJLEdBQUcsRUFBRSxDQUFDLFNBQVMsR0FBRyxJQUFJLEdBQUcsRUFBRSxDQUFDLE9BQU8sRUFBRSxDQUFDO0FBRTFELFVBQVUsSUFBSSxHQUFHLENBQUMifQ==,Ly8gVSsxMDJBNyBDQVJJQU4gTEVUVEVSIEEyCnZhciDwkIqnOiBzdHJpbmc7CnZhciBcdXsxMDJBN306IHN0cmluZzsKCmlmIChNYXRoLnJhbmRvbSgpKSB7CiAgICDwkIqnID0gImhlbGxvIjsKfQplbHNlIHsKICAgIFx1ezEwMkE3fSA9ICJoYWxsbyI7Cn0KCmNsYXNzIEZvbyB7CiAgICBcdXsxMDJBN306IHN0cmluZzsKICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgIHRoaXMuXHV7MTAyQTd9ID0gIiB3b3JsZCI7CiAgICB9CiAgICBtZXRob2RBKCkgewogICAgICAgIHJldHVybiB0aGlzLvCQiqc7CiAgICB9Cn0KCmV4cG9ydCB2YXIgX/CQiqcgPSBuZXcgRm9vKCkuXHV7MTAyQTd9ICsgbmV3IEZvbygpLm1ldGhvZEEoKTsKCl9cdXsxMDJBN30gKz0gIiEiOwo= //// [astralAsSurrogatePair.js.map] {"version":3,"file":"astralAsSurrogatePair.js","sourceRoot":"","sources":["astralAsSurrogatePair.ts"],"names":[],"mappings":""} diff --git a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js.map.diff b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js.map.diff index a5e1f52b36..77ff38f103 100644 --- a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js.map.diff +++ b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).js.map.diff @@ -4,8 +4,8 @@ //// [extendedEscapesForAstralsInVarsAndClasses.js.map] -{"version":3,"file":"extendedEscapesForAstralsInVarsAndClasses.js","sourceRoot":"","sources":["extendedEscapesForAstralsInVarsAndClasses.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,IAAQ,MAAM,CAAC;AACV,IAAA,CAAC,EAAI,EAAE,gBAAA,CAAU;AAEtB,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;IACX,OAAO,CAAC;AACjB,CAAC;KACI,CAAC;IACD,CAAC,CAAA;IAAA,CAAC;QAAA,GAAG,CAAA;QAAA,EAAE,CAAA;IAAA,CAAC;IAAG,OAAO,CAAC;AACxB,CAAC;AAED;IAAA;IACM,CAAC,AAAD;IAAA,UAAC;AAAD,CAAC,AAAD,AADN,IACM;AAAA,CAAC;IAAA,GAAG,CAAA;IAAA,EAAE,CAAA;AAAA,CAAC;AAAE,MAAM,CAAC;AAClB,WAAW,EAAE,CAAA;AAAC,CAAC;IACX,IAAI,CAAC,CAAA;IAAC,CAAC,CAAA;IAAA,CAAC;QAAA,GAAG,CAAA;QAAA,EAAE,CAAA;IAAA,CAAC;IAAG,QAAQ,CAAC;AAC9B,CAAC;AACD,OAAO,EAAE,CAAA;AAAC,CAAC;IACP,OAAO,IAAI,CAAC,EAAE,CAAC;AACnB,CAAC;AAGL,MAAM,CAAC,IAAI,CAAK,CAAA;AAAC,IAAI,GAAG,EAAE,CAAC,CAAA;AAAC,CAAC,CAAA;AAAA,CAAC;IAAA,GAAG,CAAA;IAAA,EAAE,CAAA;AAAA,CAAC;AAAC,CAAE,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;AAE3D,CAAC,CAAA;AAAC,CAAC,CAAA;AAAA,CAAC;IAAA,GAAG,CAAA;IAAA,EAAE,CAAA;AAAA,CAAC;AAAI,GAAG,CAAC"} -//// https://sokra.github.io/source-map-visualization#base64,Ly8gVSsxMDJBNyBDQVJJQU4gTEVUVEVSIEEyDQp2YXIgc3RyaW5nOw0KdmFyIHUsIEE3ID0gKHZvaWQgMClbMTAyXTsNCmlmIChNYXRoLnJhbmRvbSgpKSB7DQogICAgImhlbGxvIjsNCn0NCmVsc2Ugew0KICAgIHU7DQogICAgew0KICAgICAgICAxMDI7DQogICAgICAgIEE3Ow0KICAgIH0NCiAgICAiaGFsbG8iOw0KfQ0KdmFyIEZvbyA9IC8qKiBAY2xhc3MgKi8gKGZ1bmN0aW9uICgpIHsNCiAgICBmdW5jdGlvbiBGb28oKSB7DQogICAgfQ0KICAgIHJldHVybiBGb287DQp9KCkpOw0Kew0KICAgIDEwMjsNCiAgICBBNzsNCn0NCnN0cmluZzsNCmNvbnN0cnVjdG9yKCk7DQp7DQogICAgdGhpcy47DQogICAgdTsNCiAgICB7DQogICAgICAgIDEwMjsNCiAgICAgICAgQTc7DQogICAgfQ0KICAgICIgd29ybGQiOw0KfQ0KbWV0aG9kQSgpOw0Kew0KICAgIHJldHVybiB0aGlzLu2ggO26pzsNCn0NCmV4cG9ydCB2YXIgXzsNCm5ldyBGb28oKS47DQp1Ow0Kew0KICAgIDEwMjsNCiAgICBBNzsNCn0NCituZXcgRm9vKCkubWV0aG9kQSgpOw0KXzsNCnU7DQp7DQogICAgMTAyOw0KICAgIEE3Ow0KfQ0KIiEiOw0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9ZXh0ZW5kZWRFc2NhcGVzRm9yQXN0cmFsc0luVmFyc0FuZENsYXNzZXMuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXh0ZW5kZWRFc2NhcGVzRm9yQXN0cmFsc0luVmFyc0FuZENsYXNzZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJleHRlbmRlZEVzY2FwZXNGb3JBc3RyYWxzSW5WYXJzQW5kQ2xhc3Nlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyQkFBMkI7QUFDM0IsSUFBUSxNQUFNLENBQUM7QUFDVixJQUFBLENBQUMsRUFBSSxFQUFFLGdCQUFBLENBQVU7QUFFdEIsSUFBSSxJQUFJLENBQUMsTUFBTSxFQUFFLEVBQUUsQ0FBQztJQUNYLE9BQU8sQ0FBQztBQUNqQixDQUFDO0tBQ0ksQ0FBQztJQUNELENBQUMsQ0FBQTtJQUFBLENBQUM7UUFBQSxHQUFHLENBQUE7UUFBQSxFQUFFLENBQUE7SUFBQSxDQUFDO0lBQUcsT0FBTyxDQUFDO0FBQ3hCLENBQUM7QUFFRDtJQUFBO0lBQ00sQ0FBQyxBQUFEO0lBQUEsVUFBQztBQUFELENBQUMsQUFBRCxBQUROLElBQ007QUFBQSxDQUFDO0lBQUEsR0FBRyxDQUFBO0lBQUEsRUFBRSxDQUFBO0FBQUEsQ0FBQztBQUFFLE1BQU0sQ0FBQztBQUNsQixXQUFXLEVBQUUsQ0FBQTtBQUFDLENBQUM7SUFDWCxJQUFJLENBQUMsQ0FBQTtJQUFDLENBQUMsQ0FBQTtJQUFBLENBQUM7UUFBQSxHQUFHLENBQUE7UUFBQSxFQUFFLENBQUE7SUFBQSxDQUFDO0lBQUcsUUFBUSxDQUFDO0FBQzlCLENBQUM7QUFDRCxPQUFPLEVBQUUsQ0FBQTtBQUFDLENBQUM7SUFDUCxPQUFPLElBQUksQ0FBQyxFQUFFLENBQUM7QUFDbkIsQ0FBQztBQUdMLE1BQU0sQ0FBQyxJQUFJLENBQUssQ0FBQTtBQUFDLElBQUksR0FBRyxFQUFFLENBQUMsQ0FBQTtBQUFDLENBQUMsQ0FBQTtBQUFBLENBQUM7SUFBQSxHQUFHLENBQUE7SUFBQSxFQUFFLENBQUE7QUFBQSxDQUFDO0FBQUMsQ0FBRSxJQUFJLEdBQUcsRUFBRSxDQUFDLE9BQU8sRUFBRSxDQUFDO0FBRTNELENBQUMsQ0FBQTtBQUFDLENBQUMsQ0FBQTtBQUFBLENBQUM7SUFBQSxHQUFHLENBQUE7SUFBQSxFQUFFLENBQUE7QUFBQSxDQUFDO0FBQUksR0FBRyxDQUFDIn0=,Ly8gVSsxMDJBNyBDQVJJQU4gTEVUVEVSIEEyCnZhciDtoIDtuqc6IHN0cmluZzsKdmFyIFx1ezEwMkE3fTogc3RyaW5nOwoKaWYgKE1hdGgucmFuZG9tKCkpIHsKICAgIO2ggO26pyA9ICJoZWxsbyI7Cn0KZWxzZSB7CiAgICBcdXsxMDJBN30gPSAiaGFsbG8iOwp9CgpjbGFzcyBGb28gewogICAgXHV7MTAyQTd9OiBzdHJpbmc7CiAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICB0aGlzLlx1ezEwMkE3fSA9ICIgd29ybGQiOwogICAgfQogICAgbWV0aG9kQSgpIHsKICAgICAgICByZXR1cm4gdGhpcy7toIDtuqc7CiAgICB9Cn0KCmV4cG9ydCB2YXIgX+2ggO26pyA9IG5ldyBGb28oKS5cdXsxMDJBN30gKyBuZXcgRm9vKCkubWV0aG9kQSgpOwoKX1x1ezEwMkE3fSArPSAiISI7Cg== -+{"version":3,"file":"extendedEscapesForAstralsInVarsAndClasses.js","sourceRoot":"","sources":["extendedEscapesForAstralsInVarsAndClasses.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,IAAO,MAAM,CAAC;AACd,IAAK,CAAC,EAAA,EAAC,GAAG,EAAA,EAAE,EAAS,CAAC;AAEtB,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;IACZ,OAAO,CAAC;AAChB,CAAC;KACI,CAAC;IACD,CAAC,CAAA;IAAA,CAAC;QAAA,GAAG,CAAA;QAAA,EAAE,CAAA;IAAA,CAAC;IAAG,OAAO,CAAC;AACxB,CAAC;AAED,MAAM,GAAG;IACJ,CAAC,CAAA;CAAA;AAAA,CAAC;IAAA,GAAG,CAAA;IAAA,EAAE,CAAA;AAAA,CAAC;AAAE,MAAM,CAAC;AAClB,WAAW,EAAE,CAAA;AAAC,CAAC;IACX,IAAI,CAAC,CAAA;IAAC,CAAC,CAAA;IAAA,CAAC;QAAA,GAAG,CAAA;QAAA,EAAE,CAAA;IAAA,CAAC;IAAG,QAAQ,CAAC;AAC9B,CAAC;AACD,OAAO,EAAE,CAAA;AAAC,CAAC;IACP,OAAO,IAAI,CAAC,CAAA;IAAC,CAAC;AAClB,CAAC;AAGL,MAAM,CAAC,IAAI,CAAI,CAAA;AAAC,IAAI,GAAG,EAAE,CAAC,CAAA;AAAC,CAAC,CAAA;AAAA,CAAC;IAAA,GAAG,CAAA;IAAA,EAAE,CAAA;AAAA,CAAC;AAAC,CAAE,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;AAE1D,CAAC,CAAA;AAAC,CAAC,CAAA;AAAA,CAAC;IAAA,GAAG,CAAA;IAAA,EAAE,CAAA;AAAA,CAAC;AAAI,GAAG,CAAC"} -+//// https://sokra.github.io/source-map-visualization#base64,Ly8gVSsxMDJBNyBDQVJJQU4gTEVUVEVSIEEyDQp2YXIgc3RyaW5nOw0KdmFyIHUsIHsgMTAyOiBBNyB9Ow0KaWYgKE1hdGgucmFuZG9tKCkpIHsNCiAgICAiaGVsbG8iOw0KfQ0KZWxzZSB7DQogICAgdTsNCiAgICB7DQogICAgICAgIDEwMjsNCiAgICAgICAgQTc7DQogICAgfQ0KICAgICJoYWxsbyI7DQp9DQpjbGFzcyBGb28gew0KICAgIHU7DQp9DQp7DQogICAgMTAyOw0KICAgIEE3Ow0KfQ0Kc3RyaW5nOw0KY29uc3RydWN0b3IoKTsNCnsNCiAgICB0aGlzLjsNCiAgICB1Ow0KICAgIHsNCiAgICAgICAgMTAyOw0KICAgICAgICBBNzsNCiAgICB9DQogICAgIiB3b3JsZCI7DQp9DQptZXRob2RBKCk7DQp7DQogICAgcmV0dXJuIHRoaXMuOw0KICAgIDsNCn0NCmV4cG9ydCB2YXIgXzsNCm5ldyBGb28oKS47DQp1Ow0Kew0KICAgIDEwMjsNCiAgICBBNzsNCn0NCituZXcgRm9vKCkubWV0aG9kQSgpOw0KXzsNCnU7DQp7DQogICAgMTAyOw0KICAgIEE3Ow0KfQ0KIiEiOw0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9ZXh0ZW5kZWRFc2NhcGVzRm9yQXN0cmFsc0luVmFyc0FuZENsYXNzZXMuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXh0ZW5kZWRFc2NhcGVzRm9yQXN0cmFsc0luVmFyc0FuZENsYXNzZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJleHRlbmRlZEVzY2FwZXNGb3JBc3RyYWxzSW5WYXJzQW5kQ2xhc3Nlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyQkFBMkI7QUFDM0IsSUFBTyxNQUFNLENBQUM7QUFDZCxJQUFLLENBQUMsRUFBQSxFQUFDLEdBQUcsRUFBQSxFQUFFLEVBQVMsQ0FBQztBQUV0QixJQUFJLElBQUksQ0FBQyxNQUFNLEVBQUUsRUFBRSxDQUFDO0lBQ1osT0FBTyxDQUFDO0FBQ2hCLENBQUM7S0FDSSxDQUFDO0lBQ0QsQ0FBQyxDQUFBO0lBQUEsQ0FBQztRQUFBLEdBQUcsQ0FBQTtRQUFBLEVBQUUsQ0FBQTtJQUFBLENBQUM7SUFBRyxPQUFPLENBQUM7QUFDeEIsQ0FBQztBQUVELE1BQU0sR0FBRztJQUNKLENBQUMsQ0FBQTtDQUFBO0FBQUEsQ0FBQztJQUFBLEdBQUcsQ0FBQTtJQUFBLEVBQUUsQ0FBQTtBQUFBLENBQUM7QUFBRSxNQUFNLENBQUM7QUFDbEIsV0FBVyxFQUFFLENBQUE7QUFBQyxDQUFDO0lBQ1gsSUFBSSxDQUFDLENBQUE7SUFBQyxDQUFDLENBQUE7SUFBQSxDQUFDO1FBQUEsR0FBRyxDQUFBO1FBQUEsRUFBRSxDQUFBO0lBQUEsQ0FBQztJQUFHLFFBQVEsQ0FBQztBQUM5QixDQUFDO0FBQ0QsT0FBTyxFQUFFLENBQUE7QUFBQyxDQUFDO0lBQ1AsT0FBTyxJQUFJLENBQUMsQ0FBQTtJQUFDLENBQUM7QUFDbEIsQ0FBQztBQUdMLE1BQU0sQ0FBQyxJQUFJLENBQUksQ0FBQTtBQUFDLElBQUksR0FBRyxFQUFFLENBQUMsQ0FBQTtBQUFDLENBQUMsQ0FBQTtBQUFBLENBQUM7SUFBQSxHQUFHLENBQUE7SUFBQSxFQUFFLENBQUE7QUFBQSxDQUFDO0FBQUMsQ0FBRSxJQUFJLEdBQUcsRUFBRSxDQUFDLE9BQU8sRUFBRSxDQUFDO0FBRTFELENBQUMsQ0FBQTtBQUFDLENBQUMsQ0FBQTtBQUFBLENBQUM7SUFBQSxHQUFHLENBQUE7SUFBQSxFQUFFLENBQUE7QUFBQSxDQUFDO0FBQUksR0FBRyxDQUFDIn0=,Ly8gVSsxMDJBNyBDQVJJQU4gTEVUVEVSIEEyCnZhciDwkIqnOiBzdHJpbmc7CnZhciBcdXsxMDJBN306IHN0cmluZzsKCmlmIChNYXRoLnJhbmRvbSgpKSB7CiAgICDwkIqnID0gImhlbGxvIjsKfQplbHNlIHsKICAgIFx1ezEwMkE3fSA9ICJoYWxsbyI7Cn0KCmNsYXNzIEZvbyB7CiAgICBcdXsxMDJBN306IHN0cmluZzsKICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgIHRoaXMuXHV7MTAyQTd9ID0gIiB3b3JsZCI7CiAgICB9CiAgICBtZXRob2RBKCkgewogICAgICAgIHJldHVybiB0aGlzLvCQiqc7CiAgICB9Cn0KCmV4cG9ydCB2YXIgX/CQiqcgPSBuZXcgRm9vKCkuXHV7MTAyQTd9ICsgbmV3IEZvbygpLm1ldGhvZEEoKTsKCl9cdXsxMDJBN30gKz0gIiEiOwo= ++{"version":3,"file":"extendedEscapesForAstralsInVarsAndClasses.js","sourceRoot":"","sources":["extendedEscapesForAstralsInVarsAndClasses.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,IAAI,IAAS,CAAC;AACd,IAAI,SAAiB,CAAC;AAEtB,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;IAChB,IAAC,GAAG,OAAO,CAAC;AAChB,CAAC;KACI,CAAC;IACF,SAAS,GAAG,OAAO,CAAC;AACxB,CAAC;AAED,MAAM,GAAG;IACL,SAAS,CAAS;IAClB,cAAc;QACV,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAAA,CAC7B;IACD,OAAO,GAAG;QACN,OAAO,IAAI,CAAC,IAAC,CAAC;IAAA,CACjB;CACJ;AAED,MAAM,CAAC,IAAI,KAAE,GAAG,IAAI,GAAG,EAAE,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;AAE1D,UAAU,IAAI,GAAG,CAAC"} ++//// https://sokra.github.io/source-map-visualization#base64,Ly8gVSsxMDJBNyBDQVJJQU4gTEVUVEVSIEEyDQp2YXIg8JCKpzsNCnZhciBcdXsxMDJBN307DQppZiAoTWF0aC5yYW5kb20oKSkgew0KICAgIPCQiqcgPSAiaGVsbG8iOw0KfQ0KZWxzZSB7DQogICAgXHV7MTAyQTd9ID0gImhhbGxvIjsNCn0NCmNsYXNzIEZvbyB7DQogICAgXHV7MTAyQTd9Ow0KICAgIGNvbnN0cnVjdG9yKCkgew0KICAgICAgICB0aGlzLlx1ezEwMkE3fSA9ICIgd29ybGQiOw0KICAgIH0NCiAgICBtZXRob2RBKCkgew0KICAgICAgICByZXR1cm4gdGhpcy7wkIqnOw0KICAgIH0NCn0NCmV4cG9ydCB2YXIgX/CQiqcgPSBuZXcgRm9vKCkuXHV7MTAyQTd9ICsgbmV3IEZvbygpLm1ldGhvZEEoKTsNCl9cdXsxMDJBN30gKz0gIiEiOw0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9ZXh0ZW5kZWRFc2NhcGVzRm9yQXN0cmFsc0luVmFyc0FuZENsYXNzZXMuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXh0ZW5kZWRFc2NhcGVzRm9yQXN0cmFsc0luVmFyc0FuZENsYXNzZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJleHRlbmRlZEVzY2FwZXNGb3JBc3RyYWxzSW5WYXJzQW5kQ2xhc3Nlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyQkFBMkI7QUFDM0IsSUFBSSxJQUFTLENBQUM7QUFDZCxJQUFJLFNBQWlCLENBQUM7QUFFdEIsSUFBSSxJQUFJLENBQUMsTUFBTSxFQUFFLEVBQUUsQ0FBQztJQUNoQixJQUFDLEdBQUcsT0FBTyxDQUFDO0FBQ2hCLENBQUM7S0FDSSxDQUFDO0lBQ0YsU0FBUyxHQUFHLE9BQU8sQ0FBQztBQUN4QixDQUFDO0FBRUQsTUFBTSxHQUFHO0lBQ0wsU0FBUyxDQUFTO0lBQ2xCLGNBQWM7UUFDVixJQUFJLENBQUMsU0FBUyxHQUFHLFFBQVEsQ0FBQztJQUFBLENBQzdCO0lBQ0QsT0FBTyxHQUFHO1FBQ04sT0FBTyxJQUFJLENBQUMsSUFBQyxDQUFDO0lBQUEsQ0FDakI7Q0FDSjtBQUVELE1BQU0sQ0FBQyxJQUFJLEtBQUUsR0FBRyxJQUFJLEdBQUcsRUFBRSxDQUFDLFNBQVMsR0FBRyxJQUFJLEdBQUcsRUFBRSxDQUFDLE9BQU8sRUFBRSxDQUFDO0FBRTFELFVBQVUsSUFBSSxHQUFHLENBQUMifQ==,Ly8gVSsxMDJBNyBDQVJJQU4gTEVUVEVSIEEyCnZhciDwkIqnOiBzdHJpbmc7CnZhciBcdXsxMDJBN306IHN0cmluZzsKCmlmIChNYXRoLnJhbmRvbSgpKSB7CiAgICDwkIqnID0gImhlbGxvIjsKfQplbHNlIHsKICAgIFx1ezEwMkE3fSA9ICJoYWxsbyI7Cn0KCmNsYXNzIEZvbyB7CiAgICBcdXsxMDJBN306IHN0cmluZzsKICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgIHRoaXMuXHV7MTAyQTd9ID0gIiB3b3JsZCI7CiAgICB9CiAgICBtZXRob2RBKCkgewogICAgICAgIHJldHVybiB0aGlzLvCQiqc7CiAgICB9Cn0KCmV4cG9ydCB2YXIgX/CQiqcgPSBuZXcgRm9vKCkuXHV7MTAyQTd9ICsgbmV3IEZvbygpLm1ldGhvZEEoKTsKCl9cdXsxMDJBN30gKz0gIiEiOwo= //// [astralAsSurrogatePair.js.map] {"version":3,"file":"astralAsSurrogatePair.js","sourceRoot":"","sources":["astralAsSurrogatePair.ts"],"names":[],"mappings":""} diff --git a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).sourcemap.txt b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).sourcemap.txt index 192084c52f..42e001a697 100644 --- a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).sourcemap.txt +++ b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).sourcemap.txt @@ -16,55 +16,37 @@ sourceFile:extendedEscapesForAstralsInVarsAndClasses.ts 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 28) Source(1, 28) + SourceIndex(0) --- ->>>var string; +>>>var ðЧ; 1 > 2 >^^^^ -3 > ^^^^^^ -4 > ^ -5 > ^^^^^^^^^-> +3 > ^^^^ +4 > ^ +5 > ^^^^^^-> 1 > > -2 >var ðŠ -3 > §: str -4 > i +2 >var +3 > ðЧ: str +4 > i 1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(2, 5) Source(2, 8) + SourceIndex(0) -3 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 15) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 9) Source(2, 14) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 15) + SourceIndex(0) --- ->>>var u, { 102: A7 }; +>>>var \u{102A7}; 1-> 2 >^^^^ -3 > ^ -4 > ^^ -5 > ^^ -6 > ^^^ -7 > ^^ -8 > ^^ -9 > ^^ -10> ^ -11> ^^-> +3 > ^^^^^^^^^ +4 > ^ +5 > ^^^^^^^-> 1->ng; > -2 >var \ -3 > u -4 > -5 > { -6 > 102 -7 > -8 > A7 -9 > }: string -10> ; +2 >var +3 > \u{102A7}: string +4 > ; 1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(3, 5) Source(3, 6) + SourceIndex(0) -3 >Emitted(3, 6) Source(3, 7) + SourceIndex(0) -4 >Emitted(3, 8) Source(3, 7) + SourceIndex(0) -5 >Emitted(3, 10) Source(3, 8) + SourceIndex(0) -6 >Emitted(3, 13) Source(3, 11) + SourceIndex(0) -7 >Emitted(3, 15) Source(3, 11) + SourceIndex(0) -8 >Emitted(3, 17) Source(3, 13) + SourceIndex(0) -9 >Emitted(3, 19) Source(3, 22) + SourceIndex(0) -10>Emitted(3, 20) Source(3, 23) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 14) Source(3, 22) + SourceIndex(0) +4 >Emitted(3, 15) Source(3, 23) + SourceIndex(0) --- >>>if (Math.random()) { 1-> @@ -94,17 +76,23 @@ sourceFile:extendedEscapesForAstralsInVarsAndClasses.ts 7 >Emitted(4, 20) Source(5, 20) + SourceIndex(0) 8 >Emitted(4, 21) Source(5, 21) + SourceIndex(0) --- ->>> "hello"; +>>> ðŠ§ = "hello"; 1 >^^^^ -2 > ^^^^^^^ -3 > ^ +2 > ^^^^ +3 > ^^^ +4 > ^^^^^^^ +5 > ^ 1 > - > ðŠ§ -2 > = "hel -3 > l -1 >Emitted(5, 5) Source(6, 9) + SourceIndex(0) -2 >Emitted(5, 12) Source(6, 16) + SourceIndex(0) -3 >Emitted(5, 13) Source(6, 17) + SourceIndex(0) + > +2 > ð +3 > Ч +4 > = "hel +5 > l +1 >Emitted(5, 5) Source(6, 5) + SourceIndex(0) +2 >Emitted(5, 9) Source(6, 6) + SourceIndex(0) +3 >Emitted(5, 12) Source(6, 9) + SourceIndex(0) +4 >Emitted(5, 19) Source(6, 16) + SourceIndex(0) +5 >Emitted(5, 20) Source(6, 17) + SourceIndex(0) --- >>>} 1 > @@ -119,75 +107,30 @@ sourceFile:extendedEscapesForAstralsInVarsAndClasses.ts >>>else { 1->^^^^^ 2 > ^ -3 > ^-> +3 > ^^^^^^^^^^^^^^^^^^^-> 1-> >else 2 > { 1->Emitted(7, 6) Source(8, 6) + SourceIndex(0) 2 >Emitted(7, 7) Source(8, 7) + SourceIndex(0) --- ->>> u; +>>> \u{102A7} = "hallo"; 1->^^^^ -2 > ^ -3 > ^ +2 > ^^^^^^^^^ +3 > ^^^ +4 > ^^^^^^^ +5 > ^ 1-> - > \ -2 > u -3 > -1->Emitted(8, 5) Source(9, 6) + SourceIndex(0) -2 >Emitted(8, 6) Source(9, 7) + SourceIndex(0) -3 >Emitted(8, 7) Source(9, 7) + SourceIndex(0) ---- ->>> { -1 >^^^^ -2 > ^ -3 > ^^^^^^^^-> -1 > -2 > { -1 >Emitted(9, 5) Source(9, 7) + SourceIndex(0) -2 >Emitted(9, 6) Source(9, 8) + SourceIndex(0) ---- ->>> 102; -1->^^^^^^^^ -2 > ^^^ -3 > ^ -1-> -2 > 102 -3 > -1->Emitted(10, 9) Source(9, 8) + SourceIndex(0) -2 >Emitted(10, 12) Source(9, 11) + SourceIndex(0) -3 >Emitted(10, 13) Source(9, 11) + SourceIndex(0) ---- ->>> A7; -1 >^^^^^^^^ -2 > ^^ -3 > ^ -1 > -2 > A7 -3 > -1 >Emitted(11, 9) Source(9, 11) + SourceIndex(0) -2 >Emitted(11, 11) Source(9, 13) + SourceIndex(0) -3 >Emitted(11, 12) Source(9, 13) + SourceIndex(0) ---- ->>> } -1 >^^^^ -2 > ^ -3 > ^^^^^^^^-> -1 > -2 > } -1 >Emitted(12, 5) Source(9, 13) + SourceIndex(0) -2 >Emitted(12, 6) Source(9, 14) + SourceIndex(0) ---- ->>> "hallo"; -1->^^^^ -2 > ^^^^^^^ -3 > ^ -1-> = -2 > "hallo" -3 > ; -1->Emitted(13, 5) Source(9, 17) + SourceIndex(0) -2 >Emitted(13, 12) Source(9, 24) + SourceIndex(0) -3 >Emitted(13, 13) Source(9, 25) + SourceIndex(0) + > +2 > \u{102A7} +3 > = +4 > "hallo" +5 > ; +1->Emitted(8, 5) Source(9, 5) + SourceIndex(0) +2 >Emitted(8, 14) Source(9, 14) + SourceIndex(0) +3 >Emitted(8, 17) Source(9, 17) + SourceIndex(0) +4 >Emitted(8, 24) Source(9, 24) + SourceIndex(0) +5 >Emitted(8, 25) Source(9, 25) + SourceIndex(0) --- >>>} 1 > @@ -196,462 +139,210 @@ sourceFile:extendedEscapesForAstralsInVarsAndClasses.ts 1 > > 2 >} -1 >Emitted(14, 1) Source(10, 1) + SourceIndex(0) -2 >Emitted(14, 2) Source(10, 2) + SourceIndex(0) +1 >Emitted(9, 1) Source(10, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(10, 2) + SourceIndex(0) --- >>>class Foo { 1-> 2 >^^^^^^ 3 > ^^^ +4 > ^^^^^^-> 1-> > > 2 >class 3 > Foo -1->Emitted(15, 1) Source(12, 1) + SourceIndex(0) -2 >Emitted(15, 7) Source(12, 7) + SourceIndex(0) -3 >Emitted(15, 10) Source(12, 10) + SourceIndex(0) +1->Emitted(10, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(10, 7) Source(12, 7) + SourceIndex(0) +3 >Emitted(10, 10) Source(12, 10) + SourceIndex(0) --- ->>> u; -1 >^^^^ -2 > ^ -3 > ^ -1 > { - > \ -2 > u -3 > -1 >Emitted(16, 5) Source(13, 6) + SourceIndex(0) -2 >Emitted(16, 6) Source(13, 7) + SourceIndex(0) -3 >Emitted(16, 7) Source(13, 7) + SourceIndex(0) ---- ->>>} -1 >^ -2 > ^-> -1 > -1 >Emitted(17, 2) Source(13, 7) + SourceIndex(0) ---- ->>>{ -1-> -2 >^ -3 > ^^^^^^^^-> -1-> -2 >{ -1->Emitted(18, 1) Source(13, 7) + SourceIndex(0) -2 >Emitted(18, 2) Source(13, 8) + SourceIndex(0) ---- ->>> 102; +>>> \u{102A7}; 1->^^^^ -2 > ^^^ -3 > ^ -1-> -2 > 102 -3 > -1->Emitted(19, 5) Source(13, 8) + SourceIndex(0) -2 >Emitted(19, 8) Source(13, 11) + SourceIndex(0) -3 >Emitted(19, 9) Source(13, 11) + SourceIndex(0) ---- ->>> A7; -1 >^^^^ -2 > ^^ -3 > ^ -1 > -2 > A7 -3 > -1 >Emitted(20, 5) Source(13, 11) + SourceIndex(0) -2 >Emitted(20, 7) Source(13, 13) + SourceIndex(0) -3 >Emitted(20, 8) Source(13, 13) + SourceIndex(0) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^-> -1 > -2 >} -1 >Emitted(21, 1) Source(13, 13) + SourceIndex(0) -2 >Emitted(21, 2) Source(13, 14) + SourceIndex(0) ---- ->>>string; -1-> -2 >^^^^^^ -3 > ^ -4 > ^^^^^^^^-> -1->: -2 >string -3 > ; -1->Emitted(22, 1) Source(13, 16) + SourceIndex(0) -2 >Emitted(22, 7) Source(13, 22) + SourceIndex(0) -3 >Emitted(22, 8) Source(13, 23) + SourceIndex(0) ---- ->>>constructor(); -1-> -2 >^^^^^^^^^^^ -3 > ^^ -4 > ^ -1-> +2 > ^^^^^^^^^ +3 > ^ +4 > ^^^^^^-> +1-> { > -2 >constructor -3 > () -4 > -1->Emitted(23, 1) Source(14, 5) + SourceIndex(0) -2 >Emitted(23, 12) Source(14, 16) + SourceIndex(0) -3 >Emitted(23, 14) Source(14, 18) + SourceIndex(0) -4 >Emitted(23, 15) Source(14, 18) + SourceIndex(0) ---- ->>>{ -1 > -2 >^ -3 > ^^^^^^^^^^-> -1 > -2 >{ -1 >Emitted(24, 1) Source(14, 19) + SourceIndex(0) -2 >Emitted(24, 2) Source(14, 20) + SourceIndex(0) +2 > \u{102A7} +3 > : string; +1->Emitted(11, 5) Source(13, 5) + SourceIndex(0) +2 >Emitted(11, 14) Source(13, 14) + SourceIndex(0) +3 >Emitted(11, 15) Source(13, 23) + SourceIndex(0) --- ->>> this.; +>>> constructor() { 1->^^^^ -2 > ^^^^ -3 > ^ -4 > ^ +2 > ^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^-> 1-> - > -2 > this -3 > . -4 > -1->Emitted(25, 5) Source(15, 9) + SourceIndex(0) -2 >Emitted(25, 9) Source(15, 13) + SourceIndex(0) -3 >Emitted(25, 10) Source(15, 14) + SourceIndex(0) -4 >Emitted(25, 11) Source(15, 14) + SourceIndex(0) ---- ->>> u; -1 >^^^^ -2 > ^ -3 > ^ -1 >\ -2 > u -3 > -1 >Emitted(26, 5) Source(15, 15) + SourceIndex(0) -2 >Emitted(26, 6) Source(15, 16) + SourceIndex(0) -3 >Emitted(26, 7) Source(15, 16) + SourceIndex(0) ---- ->>> { -1 >^^^^ -2 > ^ -3 > ^^^^^^^^-> -1 > -2 > { -1 >Emitted(27, 5) Source(15, 16) + SourceIndex(0) -2 >Emitted(27, 6) Source(15, 17) + SourceIndex(0) + > +2 > constructor() +1->Emitted(12, 5) Source(14, 5) + SourceIndex(0) +2 >Emitted(12, 19) Source(14, 19) + SourceIndex(0) --- ->>> 102; +>>> this.\u{102A7} = " world"; 1->^^^^^^^^ -2 > ^^^ -3 > ^ -1-> -2 > 102 -3 > -1->Emitted(28, 9) Source(15, 17) + SourceIndex(0) -2 >Emitted(28, 12) Source(15, 20) + SourceIndex(0) -3 >Emitted(28, 13) Source(15, 20) + SourceIndex(0) ---- ->>> A7; -1 >^^^^^^^^ -2 > ^^ -3 > ^ -1 > -2 > A7 -3 > -1 >Emitted(29, 9) Source(15, 20) + SourceIndex(0) -2 >Emitted(29, 11) Source(15, 22) + SourceIndex(0) -3 >Emitted(29, 12) Source(15, 22) + SourceIndex(0) +2 > ^^^^ +3 > ^ +4 > ^^^^^^^^^ +5 > ^^^ +6 > ^^^^^^^^ +7 > ^ +1->{ + > +2 > this +3 > . +4 > \u{102A7} +5 > = +6 > " world" +7 > ; +1->Emitted(13, 9) Source(15, 9) + SourceIndex(0) +2 >Emitted(13, 13) Source(15, 13) + SourceIndex(0) +3 >Emitted(13, 14) Source(15, 14) + SourceIndex(0) +4 >Emitted(13, 23) Source(15, 23) + SourceIndex(0) +5 >Emitted(13, 26) Source(15, 26) + SourceIndex(0) +6 >Emitted(13, 34) Source(15, 34) + SourceIndex(0) +7 >Emitted(13, 35) Source(15, 35) + SourceIndex(0) --- >>> } 1 >^^^^ 2 > ^ -3 > ^^^^^^^^^-> +3 > ^^^^^^^^^^^-> 1 > -2 > } -1 >Emitted(30, 5) Source(15, 22) + SourceIndex(0) -2 >Emitted(30, 6) Source(15, 23) + SourceIndex(0) +2 > + > } +1 >Emitted(14, 5) Source(15, 35) + SourceIndex(0) +2 >Emitted(14, 6) Source(16, 6) + SourceIndex(0) --- ->>> " world"; +>>> methodA() { 1->^^^^ -2 > ^^^^^^^^ -3 > ^ -1-> = -2 > " world" -3 > ; -1->Emitted(31, 5) Source(15, 26) + SourceIndex(0) -2 >Emitted(31, 13) Source(15, 34) + SourceIndex(0) -3 >Emitted(31, 14) Source(15, 35) + SourceIndex(0) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^-> -1 > - > -2 >} -1 >Emitted(32, 1) Source(16, 5) + SourceIndex(0) -2 >Emitted(32, 2) Source(16, 6) + SourceIndex(0) ---- ->>>methodA(); -1-> -2 >^^^^^^^ -3 > ^^ -4 > ^ +2 > ^^^^^^^ +3 > ^^^ +4 > ^^^^^^^^^^^^-> 1-> > -2 >methodA -3 > () -4 > -1->Emitted(33, 1) Source(17, 5) + SourceIndex(0) -2 >Emitted(33, 8) Source(17, 12) + SourceIndex(0) -3 >Emitted(33, 10) Source(17, 14) + SourceIndex(0) -4 >Emitted(33, 11) Source(17, 14) + SourceIndex(0) +2 > methodA +3 > () +1->Emitted(15, 5) Source(17, 5) + SourceIndex(0) +2 >Emitted(15, 12) Source(17, 12) + SourceIndex(0) +3 >Emitted(15, 15) Source(17, 15) + SourceIndex(0) --- ->>>{ -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^-> -1 > -2 >{ -1 >Emitted(34, 1) Source(17, 15) + SourceIndex(0) -2 >Emitted(34, 2) Source(17, 16) + SourceIndex(0) ---- ->>> return this.; -1->^^^^ -2 > ^^^^^^^ -3 > ^^^^ -4 > ^ -5 > ^ -1-> +>>> return this.ðЧ; +1->^^^^^^^^ +2 > ^^^^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^^ +6 > ^ +1->{ > -2 > return -3 > this -4 > . -5 > -1->Emitted(35, 5) Source(18, 9) + SourceIndex(0) -2 >Emitted(35, 12) Source(18, 16) + SourceIndex(0) -3 >Emitted(35, 16) Source(18, 20) + SourceIndex(0) -4 >Emitted(35, 17) Source(18, 21) + SourceIndex(0) -5 >Emitted(35, 18) Source(18, 21) + SourceIndex(0) +2 > return +3 > this +4 > . +5 > ð +6 > +1->Emitted(16, 9) Source(18, 9) + SourceIndex(0) +2 >Emitted(16, 16) Source(18, 16) + SourceIndex(0) +3 >Emitted(16, 20) Source(18, 20) + SourceIndex(0) +4 >Emitted(16, 21) Source(18, 21) + SourceIndex(0) +5 >Emitted(16, 25) Source(18, 22) + SourceIndex(0) +6 >Emitted(16, 26) Source(18, 23) + SourceIndex(0) --- ->>> ; +>>> } 1 >^^^^ 2 > ^ -1 >ð -2 > -1 >Emitted(36, 5) Source(18, 22) + SourceIndex(0) -2 >Emitted(36, 6) Source(18, 23) + SourceIndex(0) +1 > +2 > Ч; + > } +1 >Emitted(17, 5) Source(18, 23) + SourceIndex(0) +2 >Emitted(17, 6) Source(19, 6) + SourceIndex(0) --- >>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^-> -1 >Ч; - > -2 >} -1 >Emitted(37, 1) Source(19, 5) + SourceIndex(0) -2 >Emitted(37, 2) Source(19, 6) + SourceIndex(0) +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(18, 2) Source(20, 2) + SourceIndex(0) --- ->>>export var _; +>>>export var _ðŠ§ = new Foo().\u{102A7} + new Foo().methodA(); 1-> 2 >^^^^^^ 3 > ^ 4 > ^^^^ -5 > ^ -6 > ^ +5 > ^^^^^ +6 > ^^^ +7 > ^^^^ +8 > ^^^ +9 > ^^ +10> ^ +11> ^^^^^^^^^ +12> ^^^ +13> ^^^^ +14> ^^^ +15> ^^ +16> ^ +17> ^^^^^^^ +18> ^^ +19> ^ 1-> - >} > > 2 >export 3 > 4 > var -5 > _ðŠ -6 > -1->Emitted(38, 1) Source(22, 1) + SourceIndex(0) -2 >Emitted(38, 7) Source(22, 7) + SourceIndex(0) -3 >Emitted(38, 8) Source(22, 8) + SourceIndex(0) -4 >Emitted(38, 12) Source(22, 12) + SourceIndex(0) -5 >Emitted(38, 13) Source(22, 16) + SourceIndex(0) -6 >Emitted(38, 14) Source(22, 16) + SourceIndex(0) ---- ->>>new Foo().; -1 > -2 >^^^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^ -1 >§ -2 > = n -3 > ew -4 > Fo -5 > o -6 > -1 >Emitted(39, 1) Source(22, 17) + SourceIndex(0) -2 >Emitted(39, 5) Source(22, 21) + SourceIndex(0) -3 >Emitted(39, 8) Source(22, 24) + SourceIndex(0) -4 >Emitted(39, 10) Source(22, 26) + SourceIndex(0) -5 >Emitted(39, 11) Source(22, 27) + SourceIndex(0) -6 >Emitted(39, 12) Source(22, 27) + SourceIndex(0) ---- ->>>u; -1 > -2 >^ -3 > ^ -1 >( -2 >) -3 > -1 >Emitted(40, 1) Source(22, 28) + SourceIndex(0) -2 >Emitted(40, 2) Source(22, 29) + SourceIndex(0) -3 >Emitted(40, 3) Source(22, 29) + SourceIndex(0) ---- ->>>{ -1 > -2 >^ -3 > ^^^^^^^^-> -1 > -2 >. -1 >Emitted(41, 1) Source(22, 29) + SourceIndex(0) -2 >Emitted(41, 2) Source(22, 30) + SourceIndex(0) ---- ->>> 102; -1->^^^^ -2 > ^^^ -3 > ^ -1-> -2 > \u{ -3 > -1->Emitted(42, 5) Source(22, 30) + SourceIndex(0) -2 >Emitted(42, 8) Source(22, 33) + SourceIndex(0) -3 >Emitted(42, 9) Source(22, 33) + SourceIndex(0) ---- ->>> A7; -1 >^^^^ -2 > ^^ -3 > ^ -1 > -2 > 10 -3 > -1 >Emitted(43, 5) Source(22, 33) + SourceIndex(0) -2 >Emitted(43, 7) Source(22, 35) + SourceIndex(0) -3 >Emitted(43, 8) Source(22, 35) + SourceIndex(0) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >2 -1 >Emitted(44, 1) Source(22, 35) + SourceIndex(0) -2 >Emitted(44, 2) Source(22, 36) + SourceIndex(0) ---- ->>>+new Foo().methodA(); -1-> -2 >^ -3 > ^^^^ -4 > ^^^ -5 > ^^ -6 > ^ -7 > ^^^^^^^ -8 > ^^ -9 > ^ -1->A -2 >7} -3 > + n -4 > ew -5 > Fo -6 > o -7 > ().meth -8 > od -9 > A -1->Emitted(45, 1) Source(22, 37) + SourceIndex(0) -2 >Emitted(45, 2) Source(22, 39) + SourceIndex(0) -3 >Emitted(45, 6) Source(22, 43) + SourceIndex(0) -4 >Emitted(45, 9) Source(22, 46) + SourceIndex(0) -5 >Emitted(45, 11) Source(22, 48) + SourceIndex(0) -6 >Emitted(45, 12) Source(22, 49) + SourceIndex(0) -7 >Emitted(45, 19) Source(22, 56) + SourceIndex(0) -8 >Emitted(45, 21) Source(22, 58) + SourceIndex(0) -9 >Emitted(45, 22) Source(22, 59) + SourceIndex(0) ---- ->>>_; -1 > -2 >^ -3 > ^ -4 > ^-> +5 > _ð +6 > Ч +7 > = n +8 > ew +9 > Fo +10> o +11> ().\u{102 +12> A7} +13> + n +14> ew +15> Fo +16> o +17> ().meth +18> od +19> A +1->Emitted(19, 1) Source(22, 1) + SourceIndex(0) +2 >Emitted(19, 7) Source(22, 7) + SourceIndex(0) +3 >Emitted(19, 8) Source(22, 8) + SourceIndex(0) +4 >Emitted(19, 12) Source(22, 12) + SourceIndex(0) +5 >Emitted(19, 17) Source(22, 14) + SourceIndex(0) +6 >Emitted(19, 20) Source(22, 17) + SourceIndex(0) +7 >Emitted(19, 24) Source(22, 21) + SourceIndex(0) +8 >Emitted(19, 27) Source(22, 24) + SourceIndex(0) +9 >Emitted(19, 29) Source(22, 26) + SourceIndex(0) +10>Emitted(19, 30) Source(22, 27) + SourceIndex(0) +11>Emitted(19, 39) Source(22, 36) + SourceIndex(0) +12>Emitted(19, 42) Source(22, 39) + SourceIndex(0) +13>Emitted(19, 46) Source(22, 43) + SourceIndex(0) +14>Emitted(19, 49) Source(22, 46) + SourceIndex(0) +15>Emitted(19, 51) Source(22, 48) + SourceIndex(0) +16>Emitted(19, 52) Source(22, 49) + SourceIndex(0) +17>Emitted(19, 59) Source(22, 56) + SourceIndex(0) +18>Emitted(19, 61) Source(22, 58) + SourceIndex(0) +19>Emitted(19, 62) Source(22, 59) + SourceIndex(0) +--- +>>>_\u{102A7} += "!"; +1 > +2 >^^^^^^^^^^ +3 > ^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >(); > > -2 >_ -3 > -1 >Emitted(46, 1) Source(24, 1) + SourceIndex(0) -2 >Emitted(46, 2) Source(24, 2) + SourceIndex(0) -3 >Emitted(46, 3) Source(24, 2) + SourceIndex(0) ---- ->>>u; -1-> -2 >^ -3 > ^ -1->\ -2 >u -3 > -1->Emitted(47, 1) Source(24, 3) + SourceIndex(0) -2 >Emitted(47, 2) Source(24, 4) + SourceIndex(0) -3 >Emitted(47, 3) Source(24, 4) + SourceIndex(0) ---- ->>>{ -1 > -2 >^ -3 > ^^^^^^^^-> -1 > -2 >{ -1 >Emitted(48, 1) Source(24, 4) + SourceIndex(0) -2 >Emitted(48, 2) Source(24, 5) + SourceIndex(0) ---- ->>> 102; -1->^^^^ -2 > ^^^ -3 > ^ -1-> -2 > 102 -3 > -1->Emitted(49, 5) Source(24, 5) + SourceIndex(0) -2 >Emitted(49, 8) Source(24, 8) + SourceIndex(0) -3 >Emitted(49, 9) Source(24, 8) + SourceIndex(0) ---- ->>> A7; -1 >^^^^ -2 > ^^ -3 > ^ -1 > -2 > A7 -3 > -1 >Emitted(50, 5) Source(24, 8) + SourceIndex(0) -2 >Emitted(50, 7) Source(24, 10) + SourceIndex(0) -3 >Emitted(50, 8) Source(24, 10) + SourceIndex(0) ---- ->>>} -1 > -2 >^ -3 > ^^^^-> -1 > -2 >} -1 >Emitted(51, 1) Source(24, 10) + SourceIndex(0) -2 >Emitted(51, 2) Source(24, 11) + SourceIndex(0) ---- ->>>"!"; -1-> -2 >^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> += -2 >"!" -3 > ; -1->Emitted(52, 1) Source(24, 15) + SourceIndex(0) -2 >Emitted(52, 4) Source(24, 18) + SourceIndex(0) -3 >Emitted(52, 5) Source(24, 19) + SourceIndex(0) +2 >_\u{102A7} +3 > += +4 > "!" +5 > ; +1 >Emitted(20, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(20, 11) Source(24, 11) + SourceIndex(0) +3 >Emitted(20, 15) Source(24, 15) + SourceIndex(0) +4 >Emitted(20, 18) Source(24, 18) + SourceIndex(0) +5 >Emitted(20, 19) Source(24, 19) + SourceIndex(0) --- >>>//# sourceMappingURL=extendedEscapesForAstralsInVarsAndClasses.js.map=================================================================== JsFile: astralAsSurrogatePair.js diff --git a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).sourcemap.txt.diff b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).sourcemap.txt.diff index 0391e75308..f65234039f 100644 --- a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).sourcemap.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).sourcemap.txt.diff @@ -1,75 +1,71 @@ --- old.unicodeEscapesInNames02(target=es5).sourcemap.txt +++ new.unicodeEscapesInNames02(target=es5).sourcemap.txt -@@= skipped -20, +20 lines =@@ +@@= skipped -15, +15 lines =@@ + 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) + 2 >Emitted(1, 28) Source(1, 28) + SourceIndex(0) + --- +->>>var string; ++>>>var ðЧ; + 1 > 2 >^^^^ - 3 > ^^^^^^ - 4 > ^ +-3 > ^^^^^^ +-4 > ^ -5 > ^^^^^^^^^^^^^^^^-> -+5 > ^^^^^^^^^-> ++3 > ^^^^ ++4 > ^ ++5 > ^^^^^^-> 1 > > -2 >var ðЧ: -3 > string -4 > ; -+2 >var ðŠ -+3 > §: str -+4 > i ++2 >var ++3 > ðЧ: str ++4 > i 1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(2, 5) Source(2, 9) + SourceIndex(0) -3 >Emitted(2, 11) Source(2, 15) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 16) + SourceIndex(0) -+2 >Emitted(2, 5) Source(2, 8) + SourceIndex(0) -+3 >Emitted(2, 11) Source(2, 14) + SourceIndex(0) -+4 >Emitted(2, 12) Source(2, 15) + SourceIndex(0) ++2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) ++3 >Emitted(2, 9) Source(2, 14) + SourceIndex(0) ++4 >Emitted(2, 10) Source(2, 15) + SourceIndex(0) --- ->>>var u, A7 = (void 0)[102]; -+>>>var u, { 102: A7 }; ++>>>var \u{102A7}; 1-> 2 >^^^^ - 3 > ^ - 4 > ^^ - 5 > ^^ +-3 > ^ +-4 > ^^ +-5 > ^^ -6 > ^^^^^^^^^^^^^^^^ -7 > ^ -1-> - >var \ -2 > -+6 > ^^^ -+7 > ^^ -+8 > ^^ -+9 > ^^ -+10> ^ -+11> ^^-> -+1->ng; -+ > -+2 >var \ - 3 > u +-3 > u -4 > {102 -5 > A7 -6 > -7 > }: string; -1->Emitted(3, 1) Source(3, 6) + SourceIndex(0) -+4 > -+5 > { -+6 > 102 -+7 > -+8 > A7 -+9 > }: string -+10> ; -+1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) - 2 >Emitted(3, 5) Source(3, 6) + SourceIndex(0) - 3 >Emitted(3, 6) Source(3, 7) + SourceIndex(0) +-2 >Emitted(3, 5) Source(3, 6) + SourceIndex(0) +-3 >Emitted(3, 6) Source(3, 7) + SourceIndex(0) -4 >Emitted(3, 8) Source(3, 11) + SourceIndex(0) -5 >Emitted(3, 10) Source(3, 13) + SourceIndex(0) -6 >Emitted(3, 26) Source(3, 13) + SourceIndex(0) -7 >Emitted(3, 27) Source(3, 23) + SourceIndex(0) -+4 >Emitted(3, 8) Source(3, 7) + SourceIndex(0) -+5 >Emitted(3, 10) Source(3, 8) + SourceIndex(0) -+6 >Emitted(3, 13) Source(3, 11) + SourceIndex(0) -+7 >Emitted(3, 15) Source(3, 11) + SourceIndex(0) -+8 >Emitted(3, 17) Source(3, 13) + SourceIndex(0) -+9 >Emitted(3, 19) Source(3, 22) + SourceIndex(0) -+10>Emitted(3, 20) Source(3, 23) + SourceIndex(0) ++3 > ^^^^^^^^^ ++4 > ^ ++5 > ^^^^^^^-> ++1->ng; ++ > ++2 >var ++3 > \u{102A7}: string ++4 > ; ++1->Emitted(3, 1) Source(3, 1) + SourceIndex(0) ++2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) ++3 >Emitted(3, 14) Source(3, 22) + SourceIndex(0) ++4 >Emitted(3, 15) Source(3, 23) + SourceIndex(0) --- >>>if (Math.random()) { -1 > @@ -77,7 +73,7 @@ 2 >^^^^ 3 > ^^^^ 4 > ^ -@@= skipped -44, +54 lines =@@ +@@= skipped -49, +41 lines =@@ 6 > ^^ 7 > ^^ 8 > ^ @@ -95,9 +91,19 @@ 2 >Emitted(4, 5) Source(5, 5) + SourceIndex(0) 3 >Emitted(4, 9) Source(5, 9) + SourceIndex(0) 4 >Emitted(4, 10) Source(5, 10) + SourceIndex(0) -@@= skipped -14, +14 lines =@@ - 2 > ^^^^^^^ - 3 > ^ +@@= skipped -9, +9 lines =@@ + 7 >Emitted(4, 20) Source(5, 20) + SourceIndex(0) + 8 >Emitted(4, 21) Source(5, 21) + SourceIndex(0) + --- +->>> "hello"; ++>>> ðŠ§ = "hello"; + 1 >^^^^ +-2 > ^^^^^^^ +-3 > ^ ++2 > ^^^^ ++3 > ^^^ ++4 > ^^^^^^^ ++5 > ^ 1 > - > ðŠ§ = -2 > "hello" @@ -105,12 +111,16 @@ -1 >Emitted(5, 5) Source(6, 10) + SourceIndex(0) -2 >Emitted(5, 12) Source(6, 17) + SourceIndex(0) -3 >Emitted(5, 13) Source(6, 18) + SourceIndex(0) -+ > ðŠ§ -+2 > = "hel -+3 > l -+1 >Emitted(5, 5) Source(6, 9) + SourceIndex(0) -+2 >Emitted(5, 12) Source(6, 16) + SourceIndex(0) -+3 >Emitted(5, 13) Source(6, 17) + SourceIndex(0) ++ > ++2 > ð ++3 > Ч ++4 > = "hel ++5 > l ++1 >Emitted(5, 5) Source(6, 5) + SourceIndex(0) ++2 >Emitted(5, 9) Source(6, 6) + SourceIndex(0) ++3 >Emitted(5, 12) Source(6, 9) + SourceIndex(0) ++4 >Emitted(5, 19) Source(6, 16) + SourceIndex(0) ++5 >Emitted(5, 20) Source(6, 17) + SourceIndex(0) --- >>>} 1 > @@ -121,34 +131,98 @@ > 2 >} 1 >Emitted(6, 1) Source(7, 1) + SourceIndex(0) -@@= skipped -93, +93 lines =@@ - >>>} - 1 > - 2 >^ --3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -+3 > ^^^^^^^^^^^-> - 1 > - > - 2 >} - 1 >Emitted(14, 1) Source(10, 1) + SourceIndex(0) - 2 >Emitted(14, 2) Source(10, 2) + SourceIndex(0) +@@= skipped -25, +31 lines =@@ + >>>else { + 1->^^^^^ + 2 > ^ +-3 > ^-> ++3 > ^^^^^^^^^^^^^^^^^^^-> + 1-> + >else + 2 > { + 1->Emitted(7, 6) Source(8, 6) + SourceIndex(0) + 2 >Emitted(7, 7) Source(8, 7) + SourceIndex(0) --- +->>> u; +-1->^^^^ +-2 > ^ +-3 > ^ +-1-> +- > \ +-2 > u +-3 > +-1->Emitted(8, 5) Source(9, 6) + SourceIndex(0) +-2 >Emitted(8, 6) Source(9, 7) + SourceIndex(0) +-3 >Emitted(8, 7) Source(9, 7) + SourceIndex(0) +---- +->>> { +-1 >^^^^ +-2 > ^ +-3 > ^^^^^^^^-> +-1 > +-2 > { +-1 >Emitted(9, 5) Source(9, 7) + SourceIndex(0) +-2 >Emitted(9, 6) Source(9, 8) + SourceIndex(0) +---- +->>> 102; +-1->^^^^^^^^ +-2 > ^^^ +-3 > ^ +-1-> +-2 > 102 +-3 > +-1->Emitted(10, 9) Source(9, 8) + SourceIndex(0) +-2 >Emitted(10, 12) Source(9, 11) + SourceIndex(0) +-3 >Emitted(10, 13) Source(9, 11) + SourceIndex(0) +---- +->>> A7; +-1 >^^^^^^^^ +-2 > ^^ +-3 > ^ +-1 > +-2 > A7 +-3 > +-1 >Emitted(11, 9) Source(9, 11) + SourceIndex(0) +-2 >Emitted(11, 11) Source(9, 13) + SourceIndex(0) +-3 >Emitted(11, 12) Source(9, 13) + SourceIndex(0) +---- +->>> } +-1 >^^^^ +-2 > ^ +-3 > ^^^^^^^^-> +-1 > +-2 > } +-1 >Emitted(12, 5) Source(9, 13) + SourceIndex(0) +-2 >Emitted(12, 6) Source(9, 14) + SourceIndex(0) +---- +->>> "hallo"; +-1->^^^^ +-2 > ^^^^^^^ +-3 > ^ +-1-> = +-2 > "hallo" +-3 > ; +-1->Emitted(13, 5) Source(9, 17) + SourceIndex(0) +-2 >Emitted(13, 12) Source(9, 24) + SourceIndex(0) +-3 >Emitted(13, 13) Source(9, 25) + SourceIndex(0) +---- +->>>} +-1 > +-2 >^ +-3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +-1 > +- > +-2 >} +-1 >Emitted(14, 1) Source(10, 1) + SourceIndex(0) +-2 >Emitted(14, 2) Source(10, 2) + SourceIndex(0) +---- ->>>var Foo = /** @class */ (function () { -1-> -2 >^^^^^^^^^^^^^^^^^^^^^-> -1-> - > - > -+>>>class Foo { -+1-> -+2 >^^^^^^ -+3 > ^^^ -+1-> -+ > -+ > -+2 >class -+3 > Foo - 1->Emitted(15, 1) Source(12, 1) + SourceIndex(0) +-1->Emitted(15, 1) Source(12, 1) + SourceIndex(0) ---- ->>> function Foo() { -1->^^^^ @@ -158,12 +232,7 @@ ---- ->>> } -1->^^^^ -+2 >Emitted(15, 7) Source(12, 7) + SourceIndex(0) -+3 >Emitted(15, 10) Source(12, 10) + SourceIndex(0) -+--- -+>>> u; -+1 >^^^^ - 2 > ^ +-2 > ^ -3 > -4 > ^^^^^^^^^^^-> -1->class Foo { @@ -199,251 +268,319 @@ -3 >Emitted(19, 2) Source(13, 7) + SourceIndex(0) -4 >Emitted(19, 2) Source(12, 1) + SourceIndex(0) -5 >Emitted(19, 6) Source(13, 7) + SourceIndex(0) -+3 > ^ -+1 > { -+ > \ -+2 > u -+3 > -+1 >Emitted(16, 5) Source(13, 6) + SourceIndex(0) -+2 >Emitted(16, 6) Source(13, 7) + SourceIndex(0) -+3 >Emitted(16, 7) Source(13, 7) + SourceIndex(0) -+--- -+>>>} -+1 >^ -+2 > ^-> -+1 > -+1 >Emitted(17, 2) Source(13, 7) + SourceIndex(0) - --- - >>>{ +---- +->>>{ -1 > -+1-> - 2 >^ - 3 > ^^^^^^^^-> +-2 >^ +-3 > ^^^^^^^^-> -1 > -+1-> - 2 >{ +-2 >{ -1 >Emitted(20, 1) Source(13, 7) + SourceIndex(0) -2 >Emitted(20, 2) Source(13, 8) + SourceIndex(0) -+1->Emitted(18, 1) Source(13, 7) + SourceIndex(0) -+2 >Emitted(18, 2) Source(13, 8) + SourceIndex(0) - --- - >>> 102; - 1->^^^^ -@@= skipped -76, +54 lines =@@ - 1-> - 2 > 102 - 3 > +---- +->>> 102; +-1->^^^^ +-2 > ^^^ +-3 > ^ +-1-> +-2 > 102 +-3 > -1->Emitted(21, 5) Source(13, 8) + SourceIndex(0) -2 >Emitted(21, 8) Source(13, 11) + SourceIndex(0) -3 >Emitted(21, 9) Source(13, 11) + SourceIndex(0) -+1->Emitted(19, 5) Source(13, 8) + SourceIndex(0) -+2 >Emitted(19, 8) Source(13, 11) + SourceIndex(0) -+3 >Emitted(19, 9) Source(13, 11) + SourceIndex(0) - --- - >>> A7; - 1 >^^^^ -@@= skipped -11, +11 lines =@@ - 1 > - 2 > A7 - 3 > +---- +->>> A7; +-1 >^^^^ +-2 > ^^ +-3 > ^ +-1 > +-2 > A7 +-3 > -1 >Emitted(22, 5) Source(13, 11) + SourceIndex(0) -2 >Emitted(22, 7) Source(13, 13) + SourceIndex(0) -3 >Emitted(22, 8) Source(13, 13) + SourceIndex(0) -+1 >Emitted(20, 5) Source(13, 11) + SourceIndex(0) -+2 >Emitted(20, 7) Source(13, 13) + SourceIndex(0) -+3 >Emitted(20, 8) Source(13, 13) + SourceIndex(0) - --- - >>>} - 1 > -@@= skipped -10, +10 lines =@@ - 3 > ^^^^^^^-> - 1 > - 2 >} +---- +->>>} +-1 > +-2 >^ +-3 > ^^^^^^^-> +-1 > +-2 >} -1 >Emitted(23, 1) Source(13, 13) + SourceIndex(0) -2 >Emitted(23, 2) Source(13, 14) + SourceIndex(0) -+1 >Emitted(21, 1) Source(13, 13) + SourceIndex(0) -+2 >Emitted(21, 2) Source(13, 14) + SourceIndex(0) - --- - >>>string; +---- +->>>string; ++>>> \u{102A7} = "hallo"; ++1->^^^^ ++2 > ^^^^^^^^^ ++3 > ^^^ ++4 > ^^^^^^^ ++5 > ^ ++1-> ++ > ++2 > \u{102A7} ++3 > = ++4 > "hallo" ++5 > ; ++1->Emitted(8, 5) Source(9, 5) + SourceIndex(0) ++2 >Emitted(8, 14) Source(9, 14) + SourceIndex(0) ++3 >Emitted(8, 17) Source(9, 17) + SourceIndex(0) ++4 >Emitted(8, 24) Source(9, 24) + SourceIndex(0) ++5 >Emitted(8, 25) Source(9, 25) + SourceIndex(0) ++--- ++>>>} ++1 > ++2 >^ ++3 > ^^^^^^^^^^^-> ++1 > ++ > ++2 >} ++1 >Emitted(9, 1) Source(10, 1) + SourceIndex(0) ++2 >Emitted(9, 2) Source(10, 2) + SourceIndex(0) ++--- ++>>>class Foo { 1-> -@@= skipped -11, +11 lines =@@ - 1->: - 2 >string - 3 > ; + 2 >^^^^^^ +-3 > ^ +-4 > ^^^^^^^^-> +-1->: +-2 >string +-3 > ; -1->Emitted(24, 1) Source(13, 16) + SourceIndex(0) -2 >Emitted(24, 7) Source(13, 22) + SourceIndex(0) -3 >Emitted(24, 8) Source(13, 23) + SourceIndex(0) -+1->Emitted(22, 1) Source(13, 16) + SourceIndex(0) -+2 >Emitted(22, 7) Source(13, 22) + SourceIndex(0) -+3 >Emitted(22, 8) Source(13, 23) + SourceIndex(0) - --- - >>>constructor(); - 1-> -@@= skipped -14, +14 lines =@@ - 2 >constructor - 3 > () - 4 > +---- +->>>constructor(); +-1-> +-2 >^^^^^^^^^^^ +-3 > ^^ +-4 > ^ +-1-> +- > +-2 >constructor +-3 > () +-4 > -1->Emitted(25, 1) Source(14, 5) + SourceIndex(0) -2 >Emitted(25, 12) Source(14, 16) + SourceIndex(0) -3 >Emitted(25, 14) Source(14, 18) + SourceIndex(0) -4 >Emitted(25, 15) Source(14, 18) + SourceIndex(0) -+1->Emitted(23, 1) Source(14, 5) + SourceIndex(0) -+2 >Emitted(23, 12) Source(14, 16) + SourceIndex(0) -+3 >Emitted(23, 14) Source(14, 18) + SourceIndex(0) -+4 >Emitted(23, 15) Source(14, 18) + SourceIndex(0) - --- - >>>{ - 1 > -@@= skipped -11, +11 lines =@@ - 3 > ^^^^^^^^^^-> - 1 > - 2 >{ +---- +->>>{ +-1 > +-2 >^ +-3 > ^^^^^^^^^^-> +-1 > +-2 >{ -1 >Emitted(26, 1) Source(14, 19) + SourceIndex(0) -2 >Emitted(26, 2) Source(14, 20) + SourceIndex(0) -+1 >Emitted(24, 1) Source(14, 19) + SourceIndex(0) -+2 >Emitted(24, 2) Source(14, 20) + SourceIndex(0) - --- - >>> this.; - 1->^^^^ -@@= skipped -13, +13 lines =@@ - 2 > this - 3 > . - 4 > +---- +->>> this.; +-1->^^^^ +-2 > ^^^^ +-3 > ^ +-4 > ^ +-1-> +- > +-2 > this +-3 > . +-4 > -1->Emitted(27, 5) Source(15, 9) + SourceIndex(0) -2 >Emitted(27, 9) Source(15, 13) + SourceIndex(0) -3 >Emitted(27, 10) Source(15, 14) + SourceIndex(0) -4 >Emitted(27, 11) Source(15, 14) + SourceIndex(0) -+1->Emitted(25, 5) Source(15, 9) + SourceIndex(0) -+2 >Emitted(25, 9) Source(15, 13) + SourceIndex(0) -+3 >Emitted(25, 10) Source(15, 14) + SourceIndex(0) -+4 >Emitted(25, 11) Source(15, 14) + SourceIndex(0) - --- - >>> u; - 1 >^^^^ -@@= skipped -12, +12 lines =@@ - 1 >\ - 2 > u - 3 > +---- +->>> u; +-1 >^^^^ +-2 > ^ +-3 > ^ +-1 >\ +-2 > u +-3 > -1 >Emitted(28, 5) Source(15, 15) + SourceIndex(0) -2 >Emitted(28, 6) Source(15, 16) + SourceIndex(0) -3 >Emitted(28, 7) Source(15, 16) + SourceIndex(0) -+1 >Emitted(26, 5) Source(15, 15) + SourceIndex(0) -+2 >Emitted(26, 6) Source(15, 16) + SourceIndex(0) -+3 >Emitted(26, 7) Source(15, 16) + SourceIndex(0) - --- - >>> { - 1 >^^^^ -@@= skipped -10, +10 lines =@@ - 3 > ^^^^^^^^-> - 1 > - 2 > { +---- +->>> { +-1 >^^^^ +-2 > ^ +-3 > ^^^^^^^^-> +-1 > +-2 > { -1 >Emitted(29, 5) Source(15, 16) + SourceIndex(0) -2 >Emitted(29, 6) Source(15, 17) + SourceIndex(0) -+1 >Emitted(27, 5) Source(15, 16) + SourceIndex(0) -+2 >Emitted(27, 6) Source(15, 17) + SourceIndex(0) - --- - >>> 102; +---- +->>> 102; ++3 > ^^^ ++4 > ^^^^^^-> ++1-> ++ > ++ > ++2 >class ++3 > Foo ++1->Emitted(10, 1) Source(12, 1) + SourceIndex(0) ++2 >Emitted(10, 7) Source(12, 7) + SourceIndex(0) ++3 >Emitted(10, 10) Source(12, 10) + SourceIndex(0) ++--- ++>>> \u{102A7}; ++1->^^^^ ++2 > ^^^^^^^^^ ++3 > ^ ++4 > ^^^^^^-> ++1-> { ++ > ++2 > \u{102A7} ++3 > : string; ++1->Emitted(11, 5) Source(13, 5) + SourceIndex(0) ++2 >Emitted(11, 14) Source(13, 14) + SourceIndex(0) ++3 >Emitted(11, 15) Source(13, 23) + SourceIndex(0) ++--- ++>>> constructor() { ++1->^^^^ ++2 > ^^^^^^^^^^^^^^ ++3 > ^^^^^^^^^^^^^^^^^-> ++1-> ++ > ++2 > constructor() ++1->Emitted(12, 5) Source(14, 5) + SourceIndex(0) ++2 >Emitted(12, 19) Source(14, 19) + SourceIndex(0) ++--- ++>>> this.\u{102A7} = " world"; 1->^^^^^^^^ -@@= skipped -10, +10 lines =@@ - 1-> - 2 > 102 - 3 > +-2 > ^^^ +-3 > ^ +-1-> +-2 > 102 +-3 > -1->Emitted(30, 9) Source(15, 17) + SourceIndex(0) -2 >Emitted(30, 12) Source(15, 20) + SourceIndex(0) -3 >Emitted(30, 13) Source(15, 20) + SourceIndex(0) -+1->Emitted(28, 9) Source(15, 17) + SourceIndex(0) -+2 >Emitted(28, 12) Source(15, 20) + SourceIndex(0) -+3 >Emitted(28, 13) Source(15, 20) + SourceIndex(0) - --- - >>> A7; - 1 >^^^^^^^^ -@@= skipped -11, +11 lines =@@ - 1 > - 2 > A7 - 3 > +---- +->>> A7; +-1 >^^^^^^^^ +-2 > ^^ +-3 > ^ +-1 > +-2 > A7 +-3 > -1 >Emitted(31, 9) Source(15, 20) + SourceIndex(0) -2 >Emitted(31, 11) Source(15, 22) + SourceIndex(0) -3 >Emitted(31, 12) Source(15, 22) + SourceIndex(0) -+1 >Emitted(29, 9) Source(15, 20) + SourceIndex(0) -+2 >Emitted(29, 11) Source(15, 22) + SourceIndex(0) -+3 >Emitted(29, 12) Source(15, 22) + SourceIndex(0) - --- - >>> } - 1 >^^^^ -@@= skipped -10, +10 lines =@@ - 3 > ^^^^^^^^^-> - 1 > - 2 > } +---- +->>> } +-1 >^^^^ +-2 > ^ +-3 > ^^^^^^^^^-> +-1 > +-2 > } -1 >Emitted(32, 5) Source(15, 22) + SourceIndex(0) -2 >Emitted(32, 6) Source(15, 23) + SourceIndex(0) -+1 >Emitted(30, 5) Source(15, 22) + SourceIndex(0) -+2 >Emitted(30, 6) Source(15, 23) + SourceIndex(0) - --- - >>> " world"; - 1->^^^^ -@@= skipped -10, +10 lines =@@ - 1-> = - 2 > " world" - 3 > ; +---- +->>> " world"; +-1->^^^^ +-2 > ^^^^^^^^ ++2 > ^^^^ + 3 > ^ +-1-> = +-2 > " world" +-3 > ; -1->Emitted(33, 5) Source(15, 26) + SourceIndex(0) -2 >Emitted(33, 13) Source(15, 34) + SourceIndex(0) -3 >Emitted(33, 14) Source(15, 35) + SourceIndex(0) -+1->Emitted(31, 5) Source(15, 26) + SourceIndex(0) -+2 >Emitted(31, 13) Source(15, 34) + SourceIndex(0) -+3 >Emitted(31, 14) Source(15, 35) + SourceIndex(0) - --- - >>>} - 1 > -@@= skipped -11, +11 lines =@@ - 1 > - > - 2 >} +---- +->>>} +-1 > +-2 >^ +-3 > ^^^^^^^^^^-> +-1 > +- > +-2 >} -1 >Emitted(34, 1) Source(16, 5) + SourceIndex(0) -2 >Emitted(34, 2) Source(16, 6) + SourceIndex(0) -+1 >Emitted(32, 1) Source(16, 5) + SourceIndex(0) -+2 >Emitted(32, 2) Source(16, 6) + SourceIndex(0) - --- - >>>methodA(); - 1-> -@@= skipped -13, +13 lines =@@ - 2 >methodA - 3 > () - 4 > +---- +->>>methodA(); +-1-> +-2 >^^^^^^^ +-3 > ^^ +-4 > ^ +-1-> +- > +-2 >methodA +-3 > () +-4 > -1->Emitted(35, 1) Source(17, 5) + SourceIndex(0) -2 >Emitted(35, 8) Source(17, 12) + SourceIndex(0) -3 >Emitted(35, 10) Source(17, 14) + SourceIndex(0) -4 >Emitted(35, 11) Source(17, 14) + SourceIndex(0) -+1->Emitted(33, 1) Source(17, 5) + SourceIndex(0) -+2 >Emitted(33, 8) Source(17, 12) + SourceIndex(0) -+3 >Emitted(33, 10) Source(17, 14) + SourceIndex(0) -+4 >Emitted(33, 11) Source(17, 14) + SourceIndex(0) - --- - >>>{ - 1 > - 2 >^ +---- +->>>{ +-1 > +-2 >^ -3 > ^^^^^^^^^^^^^^^^^^^-> -+3 > ^^^^^^^^^^^^^^^^^-> - 1 > - 2 >{ +-1 > +-2 >{ -1 >Emitted(36, 1) Source(17, 15) + SourceIndex(0) -2 >Emitted(36, 2) Source(17, 16) + SourceIndex(0) -+1 >Emitted(34, 1) Source(17, 15) + SourceIndex(0) -+2 >Emitted(34, 2) Source(17, 16) + SourceIndex(0) - --- +---- ->>> return this.ðЧ; -+>>> return this.; ++4 > ^^^^^^^^^ ++5 > ^^^ ++6 > ^^^^^^^^ ++7 > ^ ++1->{ ++ > ++2 > this ++3 > . ++4 > \u{102A7} ++5 > = ++6 > " world" ++7 > ; ++1->Emitted(13, 9) Source(15, 9) + SourceIndex(0) ++2 >Emitted(13, 13) Source(15, 13) + SourceIndex(0) ++3 >Emitted(13, 14) Source(15, 14) + SourceIndex(0) ++4 >Emitted(13, 23) Source(15, 23) + SourceIndex(0) ++5 >Emitted(13, 26) Source(15, 26) + SourceIndex(0) ++6 >Emitted(13, 34) Source(15, 34) + SourceIndex(0) ++7 >Emitted(13, 35) Source(15, 35) + SourceIndex(0) ++--- ++>>> } ++1 >^^^^ ++2 > ^ ++3 > ^^^^^^^^^^^-> ++1 > ++2 > ++ > } ++1 >Emitted(14, 5) Source(15, 35) + SourceIndex(0) ++2 >Emitted(14, 6) Source(16, 6) + SourceIndex(0) ++--- ++>>> methodA() { 1->^^^^ 2 > ^^^^^^^ - 3 > ^^^^ - 4 > ^ +-3 > ^^^^ +-4 > ^ -5 > ^^ -6 > ^ -+5 > ^ ++3 > ^^^ ++4 > ^^^^^^^^^^^^-> 1-> ++ > ++2 > methodA ++3 > () ++1->Emitted(15, 5) Source(17, 5) + SourceIndex(0) ++2 >Emitted(15, 12) Source(17, 12) + SourceIndex(0) ++3 >Emitted(15, 15) Source(17, 15) + SourceIndex(0) ++--- ++>>> return this.ðЧ; ++1->^^^^^^^^ ++2 > ^^^^^^^ ++3 > ^^^^ ++4 > ^ ++5 > ^^^^ ++6 > ^ ++1->{ > - 2 > return - 3 > this - 4 > . +-2 > return +-3 > this +-4 > . -5 > ðŠ§ -6 > ; -1->Emitted(37, 5) Source(18, 9) + SourceIndex(0) @@ -452,107 +589,115 @@ -4 >Emitted(37, 17) Source(18, 21) + SourceIndex(0) -5 >Emitted(37, 19) Source(18, 23) + SourceIndex(0) -6 >Emitted(37, 20) Source(18, 24) + SourceIndex(0) -+5 > -+1->Emitted(35, 5) Source(18, 9) + SourceIndex(0) -+2 >Emitted(35, 12) Source(18, 16) + SourceIndex(0) -+3 >Emitted(35, 16) Source(18, 20) + SourceIndex(0) -+4 >Emitted(35, 17) Source(18, 21) + SourceIndex(0) -+5 >Emitted(35, 18) Source(18, 21) + SourceIndex(0) ++2 > return ++3 > this ++4 > . ++5 > ð ++6 > ++1->Emitted(16, 9) Source(18, 9) + SourceIndex(0) ++2 >Emitted(16, 16) Source(18, 16) + SourceIndex(0) ++3 >Emitted(16, 20) Source(18, 20) + SourceIndex(0) ++4 >Emitted(16, 21) Source(18, 21) + SourceIndex(0) ++5 >Emitted(16, 25) Source(18, 22) + SourceIndex(0) ++6 >Emitted(16, 26) Source(18, 23) + SourceIndex(0) +--- -+>>> ; ++>>> } +1 >^^^^ +2 > ^ -+1 >ð -+2 > -+1 >Emitted(36, 5) Source(18, 22) + SourceIndex(0) -+2 >Emitted(36, 6) Source(18, 23) + SourceIndex(0) ++1 > ++2 > Ч; ++ > } ++1 >Emitted(17, 5) Source(18, 23) + SourceIndex(0) ++2 >Emitted(17, 6) Source(19, 6) + SourceIndex(0) --- >>>} - 1 > - 2 >^ - 3 > ^^^^^^^^^^^^^-> -1 > -+1 >Ч; - > - 2 >} +-2 >^ +-3 > ^^^^^^^^^^^^^-> +-1 > +- > +-2 >} -1 >Emitted(38, 1) Source(19, 5) + SourceIndex(0) -2 >Emitted(38, 2) Source(19, 6) + SourceIndex(0) -+1 >Emitted(37, 1) Source(19, 5) + SourceIndex(0) -+2 >Emitted(37, 2) Source(19, 6) + SourceIndex(0) - --- - >>>export var _; - 1-> -@@= skipped -59, +64 lines =@@ +---- +->>>export var _; +-1-> +-2 >^^^^^^ +-3 > ^ +-4 > ^^^^ +-5 > ^ +-6 > ^ +-1-> ++1 >^ ++2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> ++1 > + >} ++1 >Emitted(18, 2) Source(20, 2) + SourceIndex(0) ++--- ++>>>export var _ðŠ§ = new Foo().\u{102A7} + new Foo().methodA(); ++1-> ++2 >^^^^^^ ++3 > ^ ++4 > ^^^^ ++5 > ^^^^^ ++6 > ^^^ ++7 > ^^^^ ++8 > ^^^ ++9 > ^^ ++10> ^ ++11> ^^^^^^^^^ ++12> ^^^ ++13> ^^^^ ++14> ^^^ ++15> ^^ ++16> ^ ++17> ^^^^^^^ ++18> ^^ ++19> ^ ++1-> + > + > 2 >export 3 > 4 > var -5 > _ðŠ§ = -+5 > _ðŠ - 6 > +-6 > -1->Emitted(39, 1) Source(22, 1) + SourceIndex(0) -2 >Emitted(39, 7) Source(22, 7) + SourceIndex(0) -3 >Emitted(39, 8) Source(22, 8) + SourceIndex(0) -4 >Emitted(39, 12) Source(22, 12) + SourceIndex(0) -5 >Emitted(39, 13) Source(22, 17) + SourceIndex(0) -6 >Emitted(39, 14) Source(22, 17) + SourceIndex(0) -+1->Emitted(38, 1) Source(22, 1) + SourceIndex(0) -+2 >Emitted(38, 7) Source(22, 7) + SourceIndex(0) -+3 >Emitted(38, 8) Source(22, 8) + SourceIndex(0) -+4 >Emitted(38, 12) Source(22, 12) + SourceIndex(0) -+5 >Emitted(38, 13) Source(22, 16) + SourceIndex(0) -+6 >Emitted(38, 14) Source(22, 16) + SourceIndex(0) - --- - >>>new Foo().; - 1 > -@@= skipped -16, +16 lines =@@ - 4 > ^^ - 5 > ^ - 6 > ^ +---- +->>>new Foo().; +-1 > +-2 >^^^^ +-3 > ^^^ +-4 > ^^ +-5 > ^ +-6 > ^ -1 > -2 >new -3 > Foo -4 > () -5 > . -+1 >§ -+2 > = n -+3 > ew -+4 > Fo -+5 > o - 6 > +-6 > -1 >Emitted(40, 1) Source(22, 18) + SourceIndex(0) -2 >Emitted(40, 5) Source(22, 22) + SourceIndex(0) -3 >Emitted(40, 8) Source(22, 25) + SourceIndex(0) -4 >Emitted(40, 10) Source(22, 27) + SourceIndex(0) -5 >Emitted(40, 11) Source(22, 28) + SourceIndex(0) -6 >Emitted(40, 12) Source(22, 28) + SourceIndex(0) -+1 >Emitted(39, 1) Source(22, 17) + SourceIndex(0) -+2 >Emitted(39, 5) Source(22, 21) + SourceIndex(0) -+3 >Emitted(39, 8) Source(22, 24) + SourceIndex(0) -+4 >Emitted(39, 10) Source(22, 26) + SourceIndex(0) -+5 >Emitted(39, 11) Source(22, 27) + SourceIndex(0) -+6 >Emitted(39, 12) Source(22, 27) + SourceIndex(0) - --- - >>>u; - 1 > - 2 >^ - 3 > ^ +---- +->>>u; +-1 > +-2 >^ +-3 > ^ -1 >\ -2 >u -+1 >( -+2 >) - 3 > -+1 >Emitted(40, 1) Source(22, 28) + SourceIndex(0) -+2 >Emitted(40, 2) Source(22, 29) + SourceIndex(0) -+3 >Emitted(40, 3) Source(22, 29) + SourceIndex(0) -+--- -+>>>{ -+1 > -+2 >^ -+3 > ^^^^^^^^-> -+1 > -+2 >. - 1 >Emitted(41, 1) Source(22, 29) + SourceIndex(0) - 2 >Emitted(41, 2) Source(22, 30) + SourceIndex(0) +-3 > +-1 >Emitted(41, 1) Source(22, 29) + SourceIndex(0) +-2 >Emitted(41, 2) Source(22, 30) + SourceIndex(0) -3 >Emitted(41, 3) Source(22, 30) + SourceIndex(0) ---- ->>>{ @@ -563,55 +708,48 @@ -2 >{ -1 >Emitted(42, 1) Source(22, 30) + SourceIndex(0) -2 >Emitted(42, 2) Source(22, 31) + SourceIndex(0) - --- - >>> 102; - 1->^^^^ - 2 > ^^^ - 3 > ^ - 1-> +---- +->>> 102; +-1->^^^^ +-2 > ^^^ +-3 > ^ +-1-> -2 > 102 -+2 > \u{ - 3 > +-3 > -1->Emitted(43, 5) Source(22, 31) + SourceIndex(0) -2 >Emitted(43, 8) Source(22, 34) + SourceIndex(0) -3 >Emitted(43, 9) Source(22, 34) + SourceIndex(0) -+1->Emitted(42, 5) Source(22, 30) + SourceIndex(0) -+2 >Emitted(42, 8) Source(22, 33) + SourceIndex(0) -+3 >Emitted(42, 9) Source(22, 33) + SourceIndex(0) - --- - >>> A7; - 1 >^^^^ - 2 > ^^ - 3 > ^ - 1 > +---- +->>> A7; +-1 >^^^^ +-2 > ^^ +-3 > ^ +-1 > -2 > A7 -+2 > 10 - 3 > +-3 > -1 >Emitted(44, 5) Source(22, 34) + SourceIndex(0) -2 >Emitted(44, 7) Source(22, 36) + SourceIndex(0) -3 >Emitted(44, 8) Source(22, 36) + SourceIndex(0) -+1 >Emitted(43, 5) Source(22, 33) + SourceIndex(0) -+2 >Emitted(43, 7) Source(22, 35) + SourceIndex(0) -+3 >Emitted(43, 8) Source(22, 35) + SourceIndex(0) - --- - >>>} - 1 > - 2 >^ - 3 > ^^^^^^^^^^^^^^^^^^^^^-> - 1 > +---- +->>>} +-1 > +-2 >^ +-3 > ^^^^^^^^^^^^^^^^^^^^^-> +-1 > -2 >} -1 >Emitted(45, 1) Source(22, 36) + SourceIndex(0) -2 >Emitted(45, 2) Source(22, 37) + SourceIndex(0) -+2 >2 -+1 >Emitted(44, 1) Source(22, 35) + SourceIndex(0) -+2 >Emitted(44, 2) Source(22, 36) + SourceIndex(0) - --- - >>>+new Foo().methodA(); - 1-> -@@= skipped -74, +74 lines =@@ - 7 > ^^^^^^^ - 8 > ^^ - 9 > ^ +---- +->>>+new Foo().methodA(); +-1-> +-2 >^ +-3 > ^^^^ +-4 > ^^^ +-5 > ^^ +-6 > ^ +-7 > ^^^^^^^ +-8 > ^^ +-9 > ^ -1-> -2 >+ -3 > new @@ -630,116 +768,137 @@ -7 >Emitted(46, 19) Source(22, 57) + SourceIndex(0) -8 >Emitted(46, 21) Source(22, 59) + SourceIndex(0) -9 >Emitted(46, 22) Source(22, 60) + SourceIndex(0) -+1->A -+2 >7} -+3 > + n -+4 > ew -+5 > Fo -+6 > o -+7 > ().meth -+8 > od -+9 > A -+1->Emitted(45, 1) Source(22, 37) + SourceIndex(0) -+2 >Emitted(45, 2) Source(22, 39) + SourceIndex(0) -+3 >Emitted(45, 6) Source(22, 43) + SourceIndex(0) -+4 >Emitted(45, 9) Source(22, 46) + SourceIndex(0) -+5 >Emitted(45, 11) Source(22, 48) + SourceIndex(0) -+6 >Emitted(45, 12) Source(22, 49) + SourceIndex(0) -+7 >Emitted(45, 19) Source(22, 56) + SourceIndex(0) -+8 >Emitted(45, 21) Source(22, 58) + SourceIndex(0) -+9 >Emitted(45, 22) Source(22, 59) + SourceIndex(0) - --- - >>>_; - 1 > - 2 >^ - 3 > ^ - 4 > ^-> +---- +->>>_; -1 > -+1 >(); - > - > - 2 >_ - 3 > +-2 >^ +-3 > ^ +-4 > ^-> +-1 > +- > +- > +-2 >_ +-3 > -1 >Emitted(47, 1) Source(24, 1) + SourceIndex(0) -2 >Emitted(47, 2) Source(24, 2) + SourceIndex(0) -3 >Emitted(47, 3) Source(24, 2) + SourceIndex(0) -+1 >Emitted(46, 1) Source(24, 1) + SourceIndex(0) -+2 >Emitted(46, 2) Source(24, 2) + SourceIndex(0) -+3 >Emitted(46, 3) Source(24, 2) + SourceIndex(0) - --- - >>>u; - 1-> -@@= skipped -40, +40 lines =@@ - 1->\ - 2 >u - 3 > +---- +->>>u; +-1-> +-2 >^ +-3 > ^ +-1->\ +-2 >u +-3 > -1->Emitted(48, 1) Source(24, 3) + SourceIndex(0) -2 >Emitted(48, 2) Source(24, 4) + SourceIndex(0) -3 >Emitted(48, 3) Source(24, 4) + SourceIndex(0) -+1->Emitted(47, 1) Source(24, 3) + SourceIndex(0) -+2 >Emitted(47, 2) Source(24, 4) + SourceIndex(0) -+3 >Emitted(47, 3) Source(24, 4) + SourceIndex(0) - --- - >>>{ - 1 > -@@= skipped -10, +10 lines =@@ - 3 > ^^^^^^^^-> - 1 > - 2 >{ +---- +->>>{ +-1 > +-2 >^ +-3 > ^^^^^^^^-> +-1 > +-2 >{ -1 >Emitted(49, 1) Source(24, 4) + SourceIndex(0) -2 >Emitted(49, 2) Source(24, 5) + SourceIndex(0) -+1 >Emitted(48, 1) Source(24, 4) + SourceIndex(0) -+2 >Emitted(48, 2) Source(24, 5) + SourceIndex(0) - --- - >>> 102; - 1->^^^^ -@@= skipped -10, +10 lines =@@ - 1-> - 2 > 102 - 3 > +---- +->>> 102; +-1->^^^^ +-2 > ^^^ +-3 > ^ +-1-> +-2 > 102 +-3 > -1->Emitted(50, 5) Source(24, 5) + SourceIndex(0) -2 >Emitted(50, 8) Source(24, 8) + SourceIndex(0) -3 >Emitted(50, 9) Source(24, 8) + SourceIndex(0) -+1->Emitted(49, 5) Source(24, 5) + SourceIndex(0) -+2 >Emitted(49, 8) Source(24, 8) + SourceIndex(0) -+3 >Emitted(49, 9) Source(24, 8) + SourceIndex(0) - --- - >>> A7; - 1 >^^^^ -@@= skipped -11, +11 lines =@@ - 1 > - 2 > A7 - 3 > +---- +->>> A7; +-1 >^^^^ +-2 > ^^ +-3 > ^ +-1 > +-2 > A7 +-3 > -1 >Emitted(51, 5) Source(24, 8) + SourceIndex(0) -2 >Emitted(51, 7) Source(24, 10) + SourceIndex(0) -3 >Emitted(51, 8) Source(24, 10) + SourceIndex(0) -+1 >Emitted(50, 5) Source(24, 8) + SourceIndex(0) -+2 >Emitted(50, 7) Source(24, 10) + SourceIndex(0) -+3 >Emitted(50, 8) Source(24, 10) + SourceIndex(0) - --- - >>>} - 1 > -@@= skipped -10, +10 lines =@@ - 3 > ^^^^-> - 1 > - 2 >} +---- +->>>} +-1 > +-2 >^ +-3 > ^^^^-> +-1 > +-2 >} -1 >Emitted(52, 1) Source(24, 10) + SourceIndex(0) -2 >Emitted(52, 2) Source(24, 11) + SourceIndex(0) -+1 >Emitted(51, 1) Source(24, 10) + SourceIndex(0) -+2 >Emitted(51, 2) Source(24, 11) + SourceIndex(0) - --- - >>>"!"; - 1-> -@@= skipped -11, +11 lines =@@ - 1-> += - 2 >"!" - 3 > ; +---- +->>>"!"; +-1-> +-2 >^^^ +-3 > ^ +-4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +-1-> += +-2 >"!" +-3 > ; -1->Emitted(53, 1) Source(24, 15) + SourceIndex(0) -2 >Emitted(53, 4) Source(24, 18) + SourceIndex(0) -3 >Emitted(53, 5) Source(24, 19) + SourceIndex(0) -+1->Emitted(52, 1) Source(24, 15) + SourceIndex(0) -+2 >Emitted(52, 4) Source(24, 18) + SourceIndex(0) -+3 >Emitted(52, 5) Source(24, 19) + SourceIndex(0) ++5 > _ð ++6 > Ч ++7 > = n ++8 > ew ++9 > Fo ++10> o ++11> ().\u{102 ++12> A7} ++13> + n ++14> ew ++15> Fo ++16> o ++17> ().meth ++18> od ++19> A ++1->Emitted(19, 1) Source(22, 1) + SourceIndex(0) ++2 >Emitted(19, 7) Source(22, 7) + SourceIndex(0) ++3 >Emitted(19, 8) Source(22, 8) + SourceIndex(0) ++4 >Emitted(19, 12) Source(22, 12) + SourceIndex(0) ++5 >Emitted(19, 17) Source(22, 14) + SourceIndex(0) ++6 >Emitted(19, 20) Source(22, 17) + SourceIndex(0) ++7 >Emitted(19, 24) Source(22, 21) + SourceIndex(0) ++8 >Emitted(19, 27) Source(22, 24) + SourceIndex(0) ++9 >Emitted(19, 29) Source(22, 26) + SourceIndex(0) ++10>Emitted(19, 30) Source(22, 27) + SourceIndex(0) ++11>Emitted(19, 39) Source(22, 36) + SourceIndex(0) ++12>Emitted(19, 42) Source(22, 39) + SourceIndex(0) ++13>Emitted(19, 46) Source(22, 43) + SourceIndex(0) ++14>Emitted(19, 49) Source(22, 46) + SourceIndex(0) ++15>Emitted(19, 51) Source(22, 48) + SourceIndex(0) ++16>Emitted(19, 52) Source(22, 49) + SourceIndex(0) ++17>Emitted(19, 59) Source(22, 56) + SourceIndex(0) ++18>Emitted(19, 61) Source(22, 58) + SourceIndex(0) ++19>Emitted(19, 62) Source(22, 59) + SourceIndex(0) ++--- ++>>>_\u{102A7} += "!"; ++1 > ++2 >^^^^^^^^^^ ++3 > ^^^^ ++4 > ^^^ ++5 > ^ ++6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> ++1 >(); ++ > ++ > ++2 >_\u{102A7} ++3 > += ++4 > "!" ++5 > ; ++1 >Emitted(20, 1) Source(24, 1) + SourceIndex(0) ++2 >Emitted(20, 11) Source(24, 11) + SourceIndex(0) ++3 >Emitted(20, 15) Source(24, 15) + SourceIndex(0) ++4 >Emitted(20, 18) Source(24, 18) + SourceIndex(0) ++5 >Emitted(20, 19) Source(24, 19) + SourceIndex(0) --- >>>//# sourceMappingURL=extendedEscapesForAstralsInVarsAndClasses.js.map=================================================================== JsFile: astralAsSurrogatePair.js \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).symbols b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).symbols index c09897a11b..cab0af96fc 100644 --- a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).symbols +++ b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).symbols @@ -3,11 +3,10 @@ === extendedEscapesForAstralsInVarsAndClasses.ts === // U+102A7 CARIAN LETTER A2 var ðЧ: string; ->string : Symbol(string, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 6)) +>ðŠ§ : Symbol(ðЧ, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 3), Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 3)) var \u{102A7}: string; ->u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5)) ->A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7)) +>\u{102A7} : Symbol(ðЧ, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 3), Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 3)) if (Math.random()) { >Math.random : Symbol(random, Decl(lib.es5.d.ts, --, --)) @@ -15,47 +14,51 @@ if (Math.random()) { >random : Symbol(random, Decl(lib.es5.d.ts, --, --)) ðŠ§ = "hello"; +>ðŠ§ : Symbol(ðЧ, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 3), Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 3)) } else { \u{102A7} = "hallo"; ->u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5)) ->A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7)) +>\u{102A7} : Symbol(ðЧ, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 3), Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 3)) } class Foo { >Foo : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1)) \u{102A7}: string; ->u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 12, 5)) ->A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7)) ->string : Symbol(string, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 6)) +>\u{102A7} : Symbol(\u{102A7}, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11)) constructor() { this.\u{102A7} = " world"; ->u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5)) ->A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7)) +>this.\u{102A7} : Symbol(\u{102A7}, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11)) +>this : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1)) +>\u{102A7} : Symbol(\u{102A7}, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11)) } methodA() { +>methodA : Symbol(methodA, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 15, 5)) + return this.ðЧ; +>this.ðŠ§ : Symbol(\u{102A7}, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11)) +>this : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1)) +>ðŠ§ : Symbol(\u{102A7}, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11)) } } export var _ðŠ§ = new Foo().\u{102A7} + new Foo().methodA(); ->_ : Symbol(_, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 21, 10)) +>_ðŠ§ : Symbol(_ðЧ, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 21, 10)) +>new Foo().\u{102A7} : Symbol(\u{102A7}, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11)) >Foo : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1)) ->u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5)) ->A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7)) +>\u{102A7} : Symbol(\u{102A7}, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11)) +>new Foo().methodA : Symbol(methodA, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 15, 5)) >Foo : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1)) +>methodA : Symbol(methodA, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 15, 5)) _\u{102A7} += "!"; ->_ : Symbol(_, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 21, 10)) ->u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5)) ->A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7)) +>_\u{102A7} : Symbol(_ðЧ, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 21, 10)) === astralAsSurrogatePair.ts === import { _ðŠ§ as \uD800\uDEA7 } from "./extendedEscapesForAstralsInVarsAndClasses.js"; ->_ : Symbol(_, Decl(astralAsSurrogatePair.ts, 0, 8)) ->as : Symbol(as, Decl(astralAsSurrogatePair.ts, 0, 11)) +>_ðŠ§ : Symbol(_ðЧ, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 21, 10)) +> : Symbol((Missing), Decl(astralAsSurrogatePair.ts, 0, 8)) >uD800 : Symbol(uD800, Decl(astralAsSurrogatePair.ts, 0, 16)) >uDEA7 : Symbol(uDEA7, Decl(astralAsSurrogatePair.ts, 0, 22)) diff --git a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).symbols.diff b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).symbols.diff index 4c96f19628..b10ca03c5f 100644 --- a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).symbols.diff @@ -5,11 +5,12 @@ // U+102A7 CARIAN LETTER A2 var ðЧ: string; ->string : Symbol(string, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 7)) -+>string : Symbol(string, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 6)) ++>ðŠ§ : Symbol(ðЧ, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 3), Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 3)) var \u{102A7}: string; - >u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5)) - >A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7)) +->u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5)) +->A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7)) ++>\u{102A7} : Symbol(ðЧ, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 3), Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 3)) if (Math.random()) { ->Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) @@ -19,26 +20,69 @@ +>random : Symbol(random, Decl(lib.es5.d.ts, --, --)) ðŠ§ = "hello"; ++>ðŠ§ : Symbol(ðЧ, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 3), Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 3)) } -@@= skipped -23, +23 lines =@@ + else { + \u{102A7} = "hallo"; +->u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5)) +->A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7)) ++>\u{102A7} : Symbol(ðЧ, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 3), Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 3)) + } + + class Foo { >Foo : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1)) \u{102A7}: string; ->u : Symbol(Foo.u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 12, 5)) -+>u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 12, 5)) - >A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7)) +->A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7)) ->string : Symbol(string, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 7)) -+>string : Symbol(string, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 6)) ++>\u{102A7} : Symbol(\u{102A7}, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11)) constructor() { this.\u{102A7} = " world"; -@@= skipped -29, +29 lines =@@ +->u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5)) +->A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7)) ++>this.\u{102A7} : Symbol(\u{102A7}, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11)) ++>this : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1)) ++>\u{102A7} : Symbol(\u{102A7}, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11)) + } + methodA() { ++>methodA : Symbol(methodA, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 15, 5)) ++ + return this.ðЧ; ++>this.ðŠ§ : Symbol(\u{102A7}, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11)) ++>this : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1)) ++>ðŠ§ : Symbol(\u{102A7}, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11)) + } + } + + export var _ðŠ§ = new Foo().\u{102A7} + new Foo().methodA(); +->_ : Symbol(_, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 21, 10)) +->Foo : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1)) +->u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5)) +->A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7)) +->Foo : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1)) ++>_ðŠ§ : Symbol(_ðЧ, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 21, 10)) ++>new Foo().\u{102A7} : Symbol(\u{102A7}, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11)) ++>Foo : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1)) ++>\u{102A7} : Symbol(\u{102A7}, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11)) ++>new Foo().methodA : Symbol(methodA, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 15, 5)) ++>Foo : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1)) ++>methodA : Symbol(methodA, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 15, 5)) + + _\u{102A7} += "!"; +->_ : Symbol(_, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 21, 10)) +->u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5)) +->A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7)) ++>_\u{102A7} : Symbol(_ðЧ, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 21, 10)) + === astralAsSurrogatePair.ts === import { _ðŠ§ as \uD800\uDEA7 } from "./extendedEscapesForAstralsInVarsAndClasses.js"; - >_ : Symbol(_, Decl(astralAsSurrogatePair.ts, 0, 8)) +->_ : Symbol(_, Decl(astralAsSurrogatePair.ts, 0, 8)) ->as : Symbol(as, Decl(astralAsSurrogatePair.ts, 0, 12)) ->uD800 : Symbol(uD800, Decl(astralAsSurrogatePair.ts, 0, 17)) ->uDEA7 : Symbol(uDEA7, Decl(astralAsSurrogatePair.ts, 0, 23)) -+>as : Symbol(as, Decl(astralAsSurrogatePair.ts, 0, 11)) ++>_ðŠ§ : Symbol(_ðЧ, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 21, 10)) ++> : Symbol((Missing), Decl(astralAsSurrogatePair.ts, 0, 8)) +>uD800 : Symbol(uD800, Decl(astralAsSurrogatePair.ts, 0, 16)) +>uDEA7 : Symbol(uDEA7, Decl(astralAsSurrogatePair.ts, 0, 22)) diff --git a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).types b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).types index 1011ef90f8..0d896de541 100644 --- a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).types +++ b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).types @@ -3,11 +3,10 @@ === extendedEscapesForAstralsInVarsAndClasses.ts === // U+102A7 CARIAN LETTER A2 var ðЧ: string; ->string : any +>ðŠ§ : string var \u{102A7}: string; ->u : any ->A7 : string +>\u{102A7} : string if (Math.random()) { >Math.random() : number @@ -16,13 +15,14 @@ if (Math.random()) { >random : () => number ðŠ§ = "hello"; +>ðŠ§ = "hello" : "hello" +>ðŠ§ : string >"hello" : "hello" } else { \u{102A7} = "hallo"; ->u : any ->102 : 102 ->A7 : string +>\u{102A7} = "hallo" : "hallo" +>\u{102A7} : string >"hallo" : "hallo" } @@ -30,62 +30,48 @@ class Foo { >Foo : Foo \u{102A7}: string; ->u : any ->102 : 102 ->A7 : string ->string : any +>\u{102A7} : string constructor() { ->constructor() : any ->constructor : any - this.\u{102A7} = " world"; ->this. : any ->this : undefined -> : any ->u : any ->102 : 102 ->A7 : string +>this.\u{102A7} = " world" : " world" +>this.\u{102A7} : string +>this : this +>\u{102A7} : string >" world" : " world" } methodA() { ->methodA() : any ->methodA : any +>methodA : () => string return this.ðЧ; ->this. : any ->this : undefined -> : any +>this.ðŠ§ : string +>this : this +>ðŠ§ : string } } export var _ðŠ§ = new Foo().\u{102A7} + new Foo().methodA(); ->_ : any ->new Foo(). : any +>_ðŠ§ : string +>new Foo().\u{102A7} + new Foo().methodA() : string +>new Foo().\u{102A7} : string >new Foo() : Foo >Foo : typeof Foo -> : any ->u : any ->102 : 102 ->A7 : string ->+ new Foo().methodA() : number ->new Foo().methodA() : any ->new Foo().methodA : any +>\u{102A7} : string +>new Foo().methodA() : string +>new Foo().methodA : () => string >new Foo() : Foo >Foo : typeof Foo ->methodA : any +>methodA : () => string _\u{102A7} += "!"; ->_ : any ->u : any ->102 : 102 ->A7 : string +>_\u{102A7} += "!" : string +>_\u{102A7} : string >"!" : "!" === astralAsSurrogatePair.ts === import { _ðŠ§ as \uD800\uDEA7 } from "./extendedEscapesForAstralsInVarsAndClasses.js"; ->_ : any ->as : any +>_ðŠ§ : string +> : string >uD800 : any >uDEA7 : any diff --git a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).types.diff b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).types.diff index 9974d2bd05..b0827b18c4 100644 --- a/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).types.diff +++ b/testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames02(target=es5).types.diff @@ -1,13 +1,120 @@ --- old.unicodeEscapesInNames02(target=es5).types +++ new.unicodeEscapesInNames02(target=es5).types -@@= skipped -52, +52 lines =@@ - >methodA : any +@@= skipped -2, +2 lines =@@ + === extendedEscapesForAstralsInVarsAndClasses.ts === + // U+102A7 CARIAN LETTER A2 + var ðЧ: string; +->string : any ++>ðŠ§ : string + + var \u{102A7}: string; +->u : any +->A7 : string ++>\u{102A7} : string + + if (Math.random()) { + >Math.random() : number +@@= skipped -13, +12 lines =@@ + >random : () => number + + ðŠ§ = "hello"; ++>ðŠ§ = "hello" : "hello" ++>ðŠ§ : string + >"hello" : "hello" + } + else { + \u{102A7} = "hallo"; +->u : any +->102 : 102 +->A7 : string ++>\u{102A7} = "hallo" : "hallo" ++>\u{102A7} : string + >"hallo" : "hallo" + } + +@@= skipped -14, +15 lines =@@ + >Foo : Foo + + \u{102A7}: string; +->u : any +->102 : 102 +->A7 : string +->string : any ++>\u{102A7} : string + + constructor() { +->constructor() : any +->constructor : any +- + this.\u{102A7} = " world"; +->this. : any +->this : undefined +-> : any +->u : any +->102 : 102 +->A7 : string ++>this.\u{102A7} = " world" : " world" ++>this.\u{102A7} : string ++>this : this ++>\u{102A7} : string + >" world" : " world" + } + methodA() { +->methodA() : any +->methodA : any ++>methodA : () => string return this.ðЧ; ->this.ðŠ§ : any -+>this. : any - >this : undefined +->this : undefined ->ðŠ§ : any -+> : any ++>this.ðŠ§ : string ++>this : this ++>ðŠ§ : string } } + + export var _ðŠ§ = new Foo().\u{102A7} + new Foo().methodA(); +->_ : any +->new Foo(). : any +->new Foo() : Foo +->Foo : typeof Foo +-> : any +->u : any +->102 : 102 +->A7 : string +->+ new Foo().methodA() : number +->new Foo().methodA() : any +->new Foo().methodA : any +->new Foo() : Foo +->Foo : typeof Foo +->methodA : any ++>_ðŠ§ : string ++>new Foo().\u{102A7} + new Foo().methodA() : string ++>new Foo().\u{102A7} : string ++>new Foo() : Foo ++>Foo : typeof Foo ++>\u{102A7} : string ++>new Foo().methodA() : string ++>new Foo().methodA : () => string ++>new Foo() : Foo ++>Foo : typeof Foo ++>methodA : () => string + + _\u{102A7} += "!"; +->_ : any +->u : any +->102 : 102 +->A7 : string ++>_\u{102A7} += "!" : string ++>_\u{102A7} : string + >"!" : "!" + + === astralAsSurrogatePair.ts === + import { _ðŠ§ as \uD800\uDEA7 } from "./extendedEscapesForAstralsInVarsAndClasses.js"; +->_ : any +->as : any ++>_ðŠ§ : string ++> : string + >uD800 : any + >uDEA7 : any From 0839714e5bdaf38278d85af190a15cbc87371e89 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Mon, 16 Jun 2025 23:07:52 -0700 Subject: [PATCH 4/9] docs: linkify npm package name (#1208) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fb59792dc3..f6286786a1 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Preview -A preview build is available on npm as `@typescript/native-preview`. +A preview build is available on npm as [`@typescript/native-preview`](https://www.npmjs.com/package/@typescript/native-preview). ```sh npm install @typescript/native-preview From 48fa6e4def1fa9fe17f37bc0a2e012bf0b825ad8 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Tue, 17 Jun 2025 09:16:28 -0700 Subject: [PATCH 5/9] Simplify parser options passing, share ASTs even more (#1158) --- internal/api/encoder/encoder_test.go | 22 +-- internal/ast/ast.go | 40 ++-- internal/ast/parseoptions.go | 162 +++++++++++++++++ internal/ast/utilities.go | 20 +- internal/astnav/tokens_test.go | 21 ++- internal/binder/binder.go | 42 +++-- internal/binder/binder_test.go | 13 +- internal/bundled/generate.go | 7 +- internal/checker/checker.go | 4 +- internal/checker/grammarchecks.go | 4 +- internal/compiler/fileloader.go | 31 ++-- internal/compiler/host.go | 12 +- internal/compiler/parsetask.go | 2 +- internal/compiler/program.go | 19 +- internal/core/compileroptions.go | 12 +- internal/execute/tsc.go | 20 +- internal/execute/watch.go | 6 +- internal/format/api_test.go | 29 ++- internal/fourslash/fourslash.go | 34 +--- internal/ls/completions.go | 2 +- internal/ls/completions_test.go | 2 +- internal/packagejson/packagejson_test.go | 7 +- internal/parser/jsdoc.go | 2 - internal/parser/parser.go | 172 ++++-------------- internal/parser/parser_test.go | 46 +++-- internal/parser/utilities.go | 19 +- internal/printer/namegenerator_test.go | 45 +++-- internal/printer/printer.go | 2 +- internal/printer/printer_test.go | 120 ++++++------ internal/project/documentregistry.go | 76 +++----- internal/project/project.go | 30 ++- internal/scanner/scanner.go | 21 +-- internal/testrunner/test_case_parser.go | 7 +- internal/testutil/harnessutil/harnessutil.go | 54 ++---- .../testutil/parsetestutil/parsetestutil.go | 10 +- .../testutil/tsbaseline/js_emit_baseline.go | 15 +- internal/transformers/commonjsmodule_test.go | 5 +- internal/transformers/esmodule_test.go | 5 +- internal/transformers/importelision_test.go | 6 +- internal/transformers/runtimesyntax_test.go | 6 +- internal/tsoptions/tsconfigparsing.go | 17 +- internal/tsoptions/tsconfigparsing_test.go | 16 +- 42 files changed, 583 insertions(+), 602 deletions(-) create mode 100644 internal/ast/parseoptions.go diff --git a/internal/api/encoder/encoder_test.go b/internal/api/encoder/encoder_test.go index d72fafe5ae..95459fbefa 100644 --- a/internal/api/encoder/encoder_test.go +++ b/internal/api/encoder/encoder_test.go @@ -13,18 +13,21 @@ import ( "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/parser" "github.com/microsoft/typescript-go/internal/repo" - "github.com/microsoft/typescript-go/internal/scanner" "github.com/microsoft/typescript-go/internal/testutil/baseline" "gotest.tools/v3/assert" ) -var parseCompilerOptions = &core.SourceFileAffectingCompilerOptions{ +var parseCompilerOptions = core.SourceFileAffectingCompilerOptions{ EmitScriptTarget: core.ScriptTargetLatest, } func TestEncodeSourceFile(t *testing.T) { t.Parallel() - sourceFile := parser.ParseSourceFile("/test.ts", "/test.ts", "import { bar } from \"bar\";\nexport function foo(a: string, b: string): any {}\nfoo();", parseCompilerOptions, nil, scanner.JSDocParsingModeParseAll) + sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/test.ts", + Path: "/test.ts", + CompilerOptions: parseCompilerOptions, + }, "import { bar } from \"bar\";\nexport function foo(a: string, b: string): any {}\nfoo();", core.ScriptKindTS) t.Run("baseline", func(t *testing.T) { t.Parallel() buf, err := encoder.EncodeSourceFile(sourceFile, "") @@ -42,14 +45,11 @@ func BenchmarkEncodeSourceFile(b *testing.B) { filePath := filepath.Join(repo.TypeScriptSubmodulePath, "src/compiler/checker.ts") fileContent, err := os.ReadFile(filePath) assert.NilError(b, err) - sourceFile := parser.ParseSourceFile( - "/checker.ts", - "/checker.ts", - string(fileContent), - parseCompilerOptions, - nil, - scanner.JSDocParsingModeParseAll, - ) + sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/checker.ts", + Path: "/checker.ts", + CompilerOptions: parseCompilerOptions, + }, string(fileContent), core.ScriptKindTS) for b.Loop() { _, err := encoder.EncodeSourceFile(sourceFile, "") diff --git a/internal/ast/ast.go b/internal/ast/ast.go index ddd62ebed4..58205a3135 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -9985,17 +9985,14 @@ type SourceFile struct { compositeNodeBase // Fields set by NewSourceFile - - text string - fileName string - path tspath.Path - Statements *NodeList // NodeList[*Statement] + fileName string // For debugging convenience + parseOptions SourceFileParseOptions + text string + Statements *NodeList // NodeList[*Statement] // Fields set by parser - diagnostics []*Diagnostic jsdocDiagnostics []*Diagnostic - LanguageVersion core.ScriptTarget LanguageVariant core.LanguageVariant ScriptKind core.ScriptKind IsDeclarationFile bool @@ -10040,30 +10037,36 @@ type SourceFile struct { tokenCache map[core.TextRange]*Node } -func (f *NodeFactory) NewSourceFile(text string, fileName string, path tspath.Path, statements *NodeList) *Node { - if (tspath.GetEncodedRootLength(fileName) == 0 && !strings.HasPrefix(fileName, "^/")) || fileName != tspath.NormalizePath(fileName) { - panic(fmt.Sprintf("fileName should be normalized and absolute: %q", fileName)) +func (f *NodeFactory) NewSourceFile(opts SourceFileParseOptions, text string, statements *NodeList) *Node { + if (tspath.GetEncodedRootLength(opts.FileName) == 0 && !strings.HasPrefix(opts.FileName, "^/")) || opts.FileName != tspath.NormalizePath(opts.FileName) { + panic(fmt.Sprintf("fileName should be normalized and absolute: %q", opts.FileName)) } - data := &SourceFile{} + data.fileName = opts.FileName + data.parseOptions = opts data.text = text - data.fileName = fileName - data.path = path data.Statements = statements - data.LanguageVersion = core.ScriptTargetLatest return f.newNode(KindSourceFile, data) } +func (node *SourceFile) ParseOptions() SourceFileParseOptions { + return node.parseOptions +} + +func (node *SourceFile) LanguageVersion() core.ScriptTarget { + return node.parseOptions.CompilerOptions.EmitScriptTarget +} + func (node *SourceFile) Text() string { return node.text } func (node *SourceFile) FileName() string { - return node.fileName + return node.parseOptions.FileName } func (node *SourceFile) Path() tspath.Path { - return node.path + return node.parseOptions.Path } func (node *SourceFile) OriginalFileName() string { @@ -10120,7 +10123,6 @@ func (node *SourceFile) IsJS() bool { func (node *SourceFile) copyFrom(other *SourceFile) { // Do not copy fields set by NewSourceFile (Text, FileName, Path, or Statements) - node.LanguageVersion = other.LanguageVersion node.LanguageVariant = other.LanguageVariant node.ScriptKind = other.ScriptKind node.IsDeclarationFile = other.IsDeclarationFile @@ -10141,7 +10143,7 @@ func (node *SourceFile) copyFrom(other *SourceFile) { } func (node *SourceFile) Clone(f NodeFactoryCoercible) *Node { - updated := f.AsNodeFactory().NewSourceFile(node.Text(), node.FileName(), node.Path(), node.Statements) + updated := f.AsNodeFactory().NewSourceFile(node.parseOptions, node.text, node.Statements) newFile := updated.AsSourceFile() newFile.copyFrom(node) return cloneNode(updated, node.AsNode(), f.AsNodeFactory().hooks) @@ -10153,7 +10155,7 @@ func (node *SourceFile) computeSubtreeFacts() SubtreeFacts { func (f *NodeFactory) UpdateSourceFile(node *SourceFile, statements *StatementList) *Node { if statements != node.Statements { - updated := f.NewSourceFile(node.Text(), node.fileName, node.path, statements).AsSourceFile() + updated := f.NewSourceFile(node.parseOptions, node.text, statements).AsSourceFile() updated.copyFrom(node) return updateNode(updated.AsNode(), node.AsNode(), f.hooks) } diff --git a/internal/ast/parseoptions.go b/internal/ast/parseoptions.go new file mode 100644 index 0000000000..465728e64a --- /dev/null +++ b/internal/ast/parseoptions.go @@ -0,0 +1,162 @@ +package ast + +import ( + "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/tspath" +) + +type JSDocParsingMode int + +const ( + JSDocParsingModeParseAll JSDocParsingMode = iota + JSDocParsingModeParseNone + JSDocParsingModeParseForTypeErrors + JSDocParsingModeParseForTypeInfo +) + +type SourceFileParseOptions struct { + FileName string + Path tspath.Path + CompilerOptions core.SourceFileAffectingCompilerOptions + ExternalModuleIndicatorOptions ExternalModuleIndicatorOptions + JSDocParsingMode JSDocParsingMode +} + +func GetSourceFileAffectingCompilerOptions(fileName string, options *core.CompilerOptions) core.SourceFileAffectingCompilerOptions { + // Declaration files are not parsed/bound differently depending on compiler options. + if tspath.IsDeclarationFileName(fileName) { + return core.SourceFileAffectingCompilerOptions{} + } + return options.SourceFileAffecting() +} + +type ExternalModuleIndicatorOptions struct { + jsx bool + force bool +} + +func GetExternalModuleIndicatorOptions(fileName string, options *core.CompilerOptions, metadata SourceFileMetaData) ExternalModuleIndicatorOptions { + if tspath.IsDeclarationFileName(fileName) { + return ExternalModuleIndicatorOptions{} + } + + switch options.GetEmitModuleDetectionKind() { + case core.ModuleDetectionKindForce: + // All non-declaration files are modules, declaration files still do the usual isFileProbablyExternalModule + return ExternalModuleIndicatorOptions{force: true} + case core.ModuleDetectionKindLegacy: + // Files are modules if they have imports, exports, or import.meta + return ExternalModuleIndicatorOptions{} + case core.ModuleDetectionKindAuto: + // If module is nodenext or node16, all esm format files are modules + // If jsx is react-jsx or react-jsxdev then jsx tags force module-ness + // otherwise, the presence of import or export statments (or import.meta) implies module-ness + return ExternalModuleIndicatorOptions{ + jsx: options.Jsx == core.JsxEmitReactJSX || options.Jsx == core.JsxEmitReactJSXDev, + force: isFileForcedToBeModuleByFormat(fileName, options, metadata), + } + default: + return ExternalModuleIndicatorOptions{} + } +} + +var isFileForcedToBeModuleByFormatExtensions = []string{tspath.ExtensionCjs, tspath.ExtensionCts, tspath.ExtensionMjs, tspath.ExtensionMts} + +func isFileForcedToBeModuleByFormat(fileName string, options *core.CompilerOptions, metadata SourceFileMetaData) bool { + // Excludes declaration files - they still require an explicit `export {}` or the like + // for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files + // that aren't esm-mode (meaning not in a `type: module` scope). + if GetImpliedNodeFormatForEmitWorker(fileName, options.GetEmitModuleKind(), metadata) == core.ModuleKindESNext || tspath.FileExtensionIsOneOf(fileName, isFileForcedToBeModuleByFormatExtensions) { + return true + } + return false +} + +func SetExternalModuleIndicator(file *SourceFile, opts ExternalModuleIndicatorOptions) { + file.ExternalModuleIndicator = getExternalModuleIndicator(file, opts) +} + +func getExternalModuleIndicator(file *SourceFile, opts ExternalModuleIndicatorOptions) *Node { + if file.ScriptKind == core.ScriptKindJSON { + return nil + } + + if node := isFileProbablyExternalModule(file); node != nil { + return node + } + + if file.IsDeclarationFile { + return nil + } + + if opts.jsx { + if node := isFileModuleFromUsingJSXTag(file); node != nil { + return node + } + } + + if opts.force { + return file.AsNode() + } + + return nil +} + +func isFileProbablyExternalModule(sourceFile *SourceFile) *Node { + for _, statement := range sourceFile.Statements.Nodes { + if IsExternalModuleIndicator(statement) { + return statement + } + } + return getImportMetaIfNecessary(sourceFile) +} + +func getImportMetaIfNecessary(sourceFile *SourceFile) *Node { + if sourceFile.AsNode().Flags&NodeFlagsPossiblyContainsImportMeta != 0 { + return findChildNode(sourceFile.AsNode(), IsImportMeta) + } + return nil +} + +func findChildNode(root *Node, check func(*Node) bool) *Node { + var result *Node + var visit func(*Node) bool + visit = func(node *Node) bool { + if check(node) { + result = node + return true + } + return node.ForEachChild(visit) + } + visit(root) + return result +} + +func isFileModuleFromUsingJSXTag(file *SourceFile) *Node { + return walkTreeForJSXTags(file.AsNode()) +} + +// This is a somewhat unavoidable full tree walk to locate a JSX tag - `import.meta` requires the same, +// but we avoid that walk (or parts of it) if at all possible using the `PossiblyContainsImportMeta` node flag. +// Unfortunately, there's no `NodeFlag` space to do the same for JSX. +func walkTreeForJSXTags(node *Node) *Node { + var found *Node + + var visitor func(node *Node) bool + visitor = func(node *Node) bool { + if found != nil { + return true + } + if node.SubtreeFacts()&SubtreeContainsJsx == 0 { + return false + } + if IsJsxOpeningElement(node) || IsJsxFragment(node) { + found = node + return true + } + return node.ForEachChild(visitor) + } + visitor(node) + + return found +} diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index 946979917e..ea3fef8edc 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -2549,7 +2549,7 @@ func GetImpliedNodeFormatForFile(path string, packageJsonType string) core.Modul return impliedNodeFormat } -func GetEmitModuleFormatOfFileWorker(fileName string, options *core.CompilerOptions, sourceFileMetaData *SourceFileMetaData) core.ModuleKind { +func GetEmitModuleFormatOfFileWorker(fileName string, options *core.CompilerOptions, sourceFileMetaData SourceFileMetaData) core.ModuleKind { result := GetImpliedNodeFormatForEmitWorker(fileName, options.GetEmitModuleKind(), sourceFileMetaData) if result != core.ModuleKindNone { return result @@ -2557,19 +2557,16 @@ func GetEmitModuleFormatOfFileWorker(fileName string, options *core.CompilerOpti return options.GetEmitModuleKind() } -func GetImpliedNodeFormatForEmitWorker(fileName string, emitModuleKind core.ModuleKind, sourceFileMetaData *SourceFileMetaData) core.ResolutionMode { +func GetImpliedNodeFormatForEmitWorker(fileName string, emitModuleKind core.ModuleKind, sourceFileMetaData SourceFileMetaData) core.ResolutionMode { if core.ModuleKindNode16 <= emitModuleKind && emitModuleKind <= core.ModuleKindNodeNext { - if sourceFileMetaData == nil { - return core.ModuleKindNone - } return sourceFileMetaData.ImpliedNodeFormat } - if sourceFileMetaData != nil && sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindCommonJS && + if sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindCommonJS && (sourceFileMetaData.PackageJsonType == "commonjs" || tspath.FileExtensionIsOneOf(fileName, []string{tspath.ExtensionCjs, tspath.ExtensionCts})) { return core.ModuleKindCommonJS } - if sourceFileMetaData != nil && sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindESNext && + if sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindESNext && (sourceFileMetaData.PackageJsonType == "module" || tspath.FileExtensionIsOneOf(fileName, []string{tspath.ExtensionMjs, tspath.ExtensionMts})) { return core.ModuleKindESNext @@ -2899,15 +2896,6 @@ func GetClassLikeDeclarationOfSymbol(symbol *Symbol) *Node { return core.Find(symbol.Declarations, IsClassLike) } -func GetLanguageVariant(scriptKind core.ScriptKind) core.LanguageVariant { - switch scriptKind { - case core.ScriptKindTSX, core.ScriptKindJSX, core.ScriptKindJS, core.ScriptKindJSON: - // .tsx and .jsx files are treated as jsx language variant. - return core.LanguageVariantJSX - } - return core.LanguageVariantStandard -} - func IsCallLikeExpression(node *Node) bool { switch node.Kind { case KindJsxOpeningElement, KindJsxSelfClosingElement, KindJsxOpeningFragment, KindCallExpression, KindNewExpression, diff --git a/internal/astnav/tokens_test.go b/internal/astnav/tokens_test.go index 208b137d60..30f425c080 100644 --- a/internal/astnav/tokens_test.go +++ b/internal/astnav/tokens_test.go @@ -14,7 +14,6 @@ import ( "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/parser" "github.com/microsoft/typescript-go/internal/repo" - "github.com/microsoft/typescript-go/internal/scanner" "github.com/microsoft/typescript-go/internal/testutil/baseline" "github.com/microsoft/typescript-go/internal/testutil/jstest" "gotest.tools/v3/assert" @@ -26,7 +25,7 @@ var testFiles = []string{ filepath.Join(repo.TypeScriptSubmodulePath, "src/services/mapCode.ts"), } -var parseCompilerOptions = &core.SourceFileAffectingCompilerOptions{ +var parseCompilerOptions = core.SourceFileAffectingCompilerOptions{ EmitScriptTarget: core.ScriptTargetLatest, } @@ -57,7 +56,11 @@ func TestGetTokenAtPosition(t *testing.T) { return 0; } ` - file := parser.ParseSourceFile("/file.ts", "/file.ts", fileText, parseCompilerOptions, nil, scanner.JSDocParsingModeParseAll) + file := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/file.ts", + Path: "/file.ts", + CompilerOptions: parseCompilerOptions, + }, fileText, core.ScriptKindTS) assert.Equal(t, astnav.GetTokenAtPosition(file, 0), astnav.GetTokenAtPosition(file, 0)) }) } @@ -92,7 +95,11 @@ func baselineTokens(t *testing.T, testName string, includeEOF bool, getTSTokens positions[i] = i } tsTokens := getTSTokens(string(fileText), positions) - file := parser.ParseSourceFile("/file.ts", "/file.ts", string(fileText), parseCompilerOptions, nil, scanner.JSDocParsingModeParseAll) + file := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/file.ts", + Path: "/file.ts", + CompilerOptions: parseCompilerOptions, + }, string(fileText), core.ScriptKindTS) var output strings.Builder currentRange := core.NewTextRange(0, 0) @@ -425,7 +432,11 @@ export function isAnyDirectorySeparator(charCode: number): boolean { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { t.Parallel() - file := parser.ParseSourceFile("/file.ts", "/file.ts", testCase.fileContent, parseCompilerOptions, nil, scanner.JSDocParsingModeParseAll) + file := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/file.ts", + Path: "/file.ts", + CompilerOptions: parseCompilerOptions, + }, testCase.fileContent, core.ScriptKindTS) token := astnav.FindPrecedingToken(file, testCase.position) assert.Equal(t, token.Kind, testCase.expectedKind) }) diff --git a/internal/binder/binder.go b/internal/binder/binder.go index 393d4a8efb..ce8e4defd8 100644 --- a/internal/binder/binder.go +++ b/internal/binder/binder.go @@ -42,7 +42,6 @@ const ( type Binder struct { file *ast.SourceFile - options *core.SourceFileAffectingCompilerOptions languageVersion core.ScriptTarget bindFunc func(*ast.Node) bool unreachableFlow *ast.FlowNode @@ -77,6 +76,10 @@ type Binder struct { singleDeclarationsPool core.Pool[*ast.Node] } +func (b *Binder) options() core.SourceFileAffectingCompilerOptions { + return b.file.ParseOptions().CompilerOptions +} + type ActiveLabel struct { next *ActiveLabel breakTarget *ast.FlowLabel @@ -88,11 +91,11 @@ type ActiveLabel struct { func (label *ActiveLabel) BreakTarget() *ast.FlowNode { return label.breakTarget } func (label *ActiveLabel) ContinueTarget() *ast.FlowNode { return label.continueTarget } -func BindSourceFile(file *ast.SourceFile, options *core.SourceFileAffectingCompilerOptions) { +func BindSourceFile(file *ast.SourceFile) { // This is constructed this way to make the compiler "out-line" the function, // avoiding most work in the common case where the file has already been bound. if !file.IsBound() { - bindSourceFile(file, options) + bindSourceFile(file) } } @@ -113,14 +116,13 @@ func putBinder(b *Binder) { binderPool.Put(b) } -func bindSourceFile(file *ast.SourceFile, options *core.SourceFileAffectingCompilerOptions) { +func bindSourceFile(file *ast.SourceFile) { file.BindOnce(func() { b := getBinder() defer putBinder(b) b.file = file - b.options = options - b.languageVersion = options.EmitScriptTarget - b.inStrictMode = options.BindInStrictMode && !file.IsDeclarationFile || ast.IsExternalModule(file) + b.languageVersion = b.options().EmitScriptTarget + b.inStrictMode = b.options().BindInStrictMode && !file.IsDeclarationFile || ast.IsExternalModule(file) b.unreachableFlow = b.newFlowNode(ast.FlowFlagsUnreachable) b.reportedUnreachableFlow = b.newFlowNode(ast.FlowFlagsUnreachable) b.bind(file.AsNode()) @@ -1441,7 +1443,7 @@ func (b *Binder) checkStrictModeWithStatement(node *ast.Node) { func (b *Binder) checkStrictModeLabeledStatement(node *ast.Node) { // Grammar checking for labeledStatement - if b.inStrictMode && b.options.EmitScriptTarget >= core.ScriptTargetES2015 { + if b.inStrictMode && b.options().EmitScriptTarget >= core.ScriptTargetES2015 { data := node.AsLabeledStatement() if ast.IsDeclarationStatement(data.Statement) || ast.IsVariableStatement(data.Statement) { b.errorOnFirstToken(data.Label, diagnostics.A_label_is_not_allowed_here) @@ -1614,7 +1616,7 @@ func (b *Binder) bindChildren(node *ast.Node) { return } kind := node.Kind - if kind >= ast.KindFirstStatement && kind <= ast.KindLastStatement && (b.options.AllowUnreachableCode != core.TSTrue || kind == ast.KindReturnStatement) { + if kind >= ast.KindFirstStatement && kind <= ast.KindLastStatement && (b.options().AllowUnreachableCode != core.TSTrue || kind == ast.KindReturnStatement) { hasFlowNodeData := node.FlowNodeData() if hasFlowNodeData != nil { hasFlowNodeData.FlowNode = b.currentFlow @@ -1749,11 +1751,11 @@ func (b *Binder) checkUnreachable(node *ast.Node) bool { // report errors on instantiated modules reportError := ast.IsStatementButNotDeclaration(node) && !ast.IsEmptyStatement(node) || ast.IsClassDeclaration(node) || - isEnumDeclarationWithPreservedEmit(node, b.options) || + isEnumDeclarationWithPreservedEmit(node, b.options()) || ast.IsModuleDeclaration(node) && b.shouldReportErrorOnModuleDeclaration(node) if reportError { b.currentFlow = b.reportedUnreachableFlow - if b.options.AllowUnreachableCode != core.TSTrue { + if b.options().AllowUnreachableCode != core.TSTrue { // unreachable code is reported if // - user has explicitly asked about it AND // - statement is in not ambient context (statements in ambient context is already an error @@ -1763,7 +1765,7 @@ func (b *Binder) checkUnreachable(node *ast.Node) bool { // - node is not block scoped variable statement and at least one variable declaration has initializer // Rationale: we don't want to report errors on non-initialized var's since they are hoisted // On the other side we do want to report errors on non-initialized 'lets' because of TDZ - isError := unreachableCodeIsError(b.options) && node.Flags&ast.NodeFlagsAmbient == 0 && (!ast.IsVariableStatement(node) || + isError := unreachableCodeIsError(b.options()) && node.Flags&ast.NodeFlagsAmbient == 0 && (!ast.IsVariableStatement(node) || ast.GetCombinedNodeFlags(node.AsVariableStatement().DeclarationList)&ast.NodeFlagsBlockScoped != 0 || core.Some(node.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes, func(d *ast.Node) bool { return d.AsVariableDeclaration().Initializer != nil @@ -1777,7 +1779,7 @@ func (b *Binder) checkUnreachable(node *ast.Node) bool { func (b *Binder) shouldReportErrorOnModuleDeclaration(node *ast.Node) bool { instanceState := ast.GetModuleInstanceState(node) - return instanceState == ast.ModuleInstanceStateInstantiated || (instanceState == ast.ModuleInstanceStateConstEnumOnly && b.options.ShouldPreserveConstEnums) + return instanceState == ast.ModuleInstanceStateInstantiated || (instanceState == ast.ModuleInstanceStateConstEnumOnly && b.options().ShouldPreserveConstEnums) } func (b *Binder) errorOnEachUnreachableRange(node *ast.Node, isError bool) { @@ -1820,7 +1822,7 @@ func (b *Binder) isPurelyTypeDeclaration(s *ast.Node) bool { case ast.KindModuleDeclaration: return ast.GetModuleInstanceState(s) != ast.ModuleInstanceStateInstantiated case ast.KindEnumDeclaration: - return !isEnumDeclarationWithPreservedEmit(s, b.options) + return !isEnumDeclarationWithPreservedEmit(s, b.options()) default: return false } @@ -2171,7 +2173,7 @@ func (b *Binder) bindCaseBlock(node *ast.Node) { clause := clauses[i] b.bind(clause) fallthroughFlow = b.currentFlow - if b.currentFlow.Flags&ast.FlowFlagsUnreachable == 0 && i != len(clauses)-1 && b.options.NoFallthroughCasesInSwitch == core.TSTrue { + if b.currentFlow.Flags&ast.FlowFlagsUnreachable == 0 && i != len(clauses)-1 && b.options().NoFallthroughCasesInSwitch == core.TSTrue { clause.AsCaseOrDefaultClause().FallthroughFlowNode = b.currentFlow } } @@ -2216,8 +2218,8 @@ func (b *Binder) bindLabeledStatement(node *ast.Node) { } b.bind(stmt.Label) b.bind(stmt.Statement) - if !b.activeLabelList.referenced && b.options.AllowUnusedLabels != core.TSTrue { - b.errorOrSuggestionOnNode(unusedLabelIsError(b.options), stmt.Label, diagnostics.Unused_label) + if !b.activeLabelList.referenced && b.options().AllowUnusedLabels != core.TSTrue { + b.errorOrSuggestionOnNode(unusedLabelIsError(b.options()), stmt.Label, diagnostics.Unused_label) } b.activeLabelList = b.activeLabelList.next b.addAntecedent(postStatementLabel, b.currentFlow) @@ -2539,7 +2541,7 @@ func (b *Binder) bindInitializer(node *ast.Node) { b.currentFlow = b.finishFlowLabel(exitFlow) } -func isEnumDeclarationWithPreservedEmit(node *ast.Node, options *core.SourceFileAffectingCompilerOptions) bool { +func isEnumDeclarationWithPreservedEmit(node *ast.Node, options core.SourceFileAffectingCompilerOptions) bool { return node.Kind == ast.KindEnumDeclaration && (!ast.IsEnumConst(node) || options.ShouldPreserveConstEnums) } @@ -2871,11 +2873,11 @@ func isFunctionSymbol(symbol *ast.Symbol) bool { return false } -func unreachableCodeIsError(options *core.SourceFileAffectingCompilerOptions) bool { +func unreachableCodeIsError(options core.SourceFileAffectingCompilerOptions) bool { return options.AllowUnreachableCode == core.TSFalse } -func unusedLabelIsError(options *core.SourceFileAffectingCompilerOptions) bool { +func unusedLabelIsError(options core.SourceFileAffectingCompilerOptions) bool { return options.AllowUnusedLabels == core.TSFalse } diff --git a/internal/binder/binder_test.go b/internal/binder/binder_test.go index 776fc717f0..afffa138e0 100644 --- a/internal/binder/binder_test.go +++ b/internal/binder/binder_test.go @@ -7,7 +7,6 @@ import ( "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/parser" - "github.com/microsoft/typescript-go/internal/scanner" "github.com/microsoft/typescript-go/internal/testutil/fixtures" "github.com/microsoft/typescript-go/internal/tspath" "github.com/microsoft/typescript-go/internal/vfs/osvfs" @@ -25,9 +24,17 @@ func BenchmarkBind(b *testing.B) { compilerOptions := &core.CompilerOptions{Target: core.ScriptTargetESNext, Module: core.ModuleKindNodeNext} sourceAffecting := compilerOptions.SourceFileAffecting() + parseOptions := ast.SourceFileParseOptions{ + FileName: fileName, + Path: path, + CompilerOptions: sourceAffecting, + JSDocParsingMode: ast.JSDocParsingModeParseAll, + } + scriptKind := core.GetScriptKindFromFileName(fileName) + sourceFiles := make([]*ast.SourceFile, b.N) for i := range b.N { - sourceFiles[i] = parser.ParseSourceFile(fileName, path, sourceText, sourceAffecting, nil, scanner.JSDocParsingModeParseAll) + sourceFiles[i] = parser.ParseSourceFile(parseOptions, sourceText, scriptKind) } // The above parses do a lot of work; ensure GC is finished before we start collecting performance data. @@ -37,7 +44,7 @@ func BenchmarkBind(b *testing.B) { b.ResetTimer() for i := range b.N { - BindSourceFile(sourceFiles[i], sourceAffecting) + BindSourceFile(sourceFiles[i]) } }) } diff --git a/internal/bundled/generate.go b/internal/bundled/generate.go index 5c1e667583..c39032bcd9 100644 --- a/internal/bundled/generate.go +++ b/internal/bundled/generate.go @@ -12,6 +12,8 @@ import ( "slices" "strings" + "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/parser" "github.com/microsoft/typescript-go/internal/repo" "github.com/microsoft/typescript-go/internal/tspath" @@ -140,7 +142,10 @@ func readLibs() []lib { log.Fatalf("failed to open libs.json: %v", err) } - sourceFile := parser.ParseJSONText(libsFile, tspath.Path(libsFile), string(b)) + sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: libsFile, + Path: tspath.Path(libsFile), + }, string(b), core.ScriptKindJSON) diags := sourceFile.Diagnostics() if len(diags) > 0 { diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 77b5ff3b1d..fca04dd588 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -534,7 +534,7 @@ type Program interface { GetImpliedNodeFormatForEmit(sourceFile ast.HasFileName) core.ModuleKind GetResolvedModule(currentSourceFile ast.HasFileName, moduleReference string, mode core.ResolutionMode) *module.ResolvedModule GetResolvedModules() map[tspath.Path]module.ModeAwareCache[*module.ResolvedModule] - GetSourceFileMetaData(path tspath.Path) *ast.SourceFileMetaData + GetSourceFileMetaData(path tspath.Path) ast.SourceFileMetaData GetJSXRuntimeImportSpecifier(path tspath.Path) (moduleReference string, specifier *ast.Node) GetImportHelpersImportSpecifier(path tspath.Path) *ast.Node SourceFileMayBeEmitted(sourceFile *ast.SourceFile, forceDtsEmit bool) bool @@ -10261,7 +10261,7 @@ func (c *Checker) checkNewTargetMetaProperty(node *ast.Node) *Type { func (c *Checker) checkImportMetaProperty(node *ast.Node) *Type { if core.ModuleKindNode16 <= c.moduleKind && c.moduleKind <= core.ModuleKindNodeNext { sourceFileMetaData := c.program.GetSourceFileMetaData(ast.GetSourceFileOfNode(node).Path()) - if sourceFileMetaData == nil || sourceFileMetaData.ImpliedNodeFormat != core.ModuleKindESNext { + if sourceFileMetaData.ImpliedNodeFormat != core.ModuleKindESNext { c.error(node, diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output) } } else if c.moduleKind < core.ModuleKindES2020 && c.moduleKind != core.ModuleKindSystem { diff --git a/internal/checker/grammarchecks.go b/internal/checker/grammarchecks.go index acd23758e7..cd3cca23f3 100644 --- a/internal/checker/grammarchecks.go +++ b/internal/checker/grammarchecks.go @@ -1230,7 +1230,7 @@ func (c *Checker) checkGrammarForInOrForOfStatement(forInOrOfStatement *ast.ForI switch c.moduleKind { case core.ModuleKindNode16, core.ModuleKindNode18, core.ModuleKindNodeNext: sourceFileMetaData := c.program.GetSourceFileMetaData(sourceFile.Path()) - if sourceFileMetaData != nil && sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindCommonJS { + if sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindCommonJS { c.diagnostics.Add(createDiagnosticForNode(forInOrOfStatement.AwaitModifier, diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level)) break } @@ -1737,7 +1737,7 @@ func (c *Checker) checkGrammarAwaitOrAwaitUsing(node *ast.Node) bool { core.ModuleKindNode18, core.ModuleKindNodeNext: sourceFileMetaData := c.program.GetSourceFileMetaData(sourceFile.Path()) - if sourceFileMetaData != nil && sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindCommonJS { + if sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindCommonJS { if !spanCalculated { span = scanner.GetRangeOfTokenAtPosition(sourceFile, node.Pos()) } diff --git a/internal/compiler/fileloader.go b/internal/compiler/fileloader.go index 78140ef85f..2a9b962262 100644 --- a/internal/compiler/fileloader.go +++ b/internal/compiler/fileloader.go @@ -44,7 +44,7 @@ type processedFiles struct { missingFiles []string resolvedModules map[tspath.Path]module.ModeAwareCache[*module.ResolvedModule] typeResolutionsInFile map[tspath.Path]module.ModeAwareCache[*module.ResolvedTypeReferenceDirective] - sourceFileMetaDatas map[tspath.Path]*ast.SourceFileMetaData + sourceFileMetaDatas map[tspath.Path]ast.SourceFileMetaData jsxRuntimeImportSpecifiers map[tspath.Path]*jsxRuntimeImportSpecifier importHelpersImportSpecifiers map[tspath.Path]*ast.Node // List of present unsupported extensions @@ -103,7 +103,7 @@ func processAllProgramFiles( filesByPath := make(map[tspath.Path]*ast.SourceFile, totalFileCount) resolvedModules := make(map[tspath.Path]module.ModeAwareCache[*module.ResolvedModule], totalFileCount) typeResolutionsInFile := make(map[tspath.Path]module.ModeAwareCache[*module.ResolvedTypeReferenceDirective], totalFileCount) - sourceFileMetaDatas := make(map[tspath.Path]*ast.SourceFileMetaData, totalFileCount) + sourceFileMetaDatas := make(map[tspath.Path]ast.SourceFileMetaData, totalFileCount) var jsxRuntimeImportSpecifiers map[tspath.Path]*jsxRuntimeImportSpecifier var importHelpersImportSpecifiers map[tspath.Path]*ast.Node var unsupportedExtensions []string @@ -259,7 +259,7 @@ func (p *fileLoader) getDefaultLibFilePriority(a *ast.SourceFile) int { return len(tsoptions.Libs) + 2 } -func (p *fileLoader) loadSourceFileMetaData(fileName string) *ast.SourceFileMetaData { +func (p *fileLoader) loadSourceFileMetaData(fileName string) ast.SourceFileMetaData { packageJsonScope := p.resolver.GetPackageJsonScopeIfApplicable(fileName) var packageJsonType, packageJsonDirectory string if packageJsonScope.Exists() { @@ -269,7 +269,7 @@ func (p *fileLoader) loadSourceFileMetaData(fileName string) *ast.SourceFileMeta } } impliedNodeFormat := ast.GetImpliedNodeFormatForFile(fileName, packageJsonType) - return &ast.SourceFileMetaData{ + return ast.SourceFileMetaData{ PackageJsonType: packageJsonType, PackageJsonDirectory: packageJsonDirectory, ImpliedNodeFormat: impliedNodeFormat, @@ -278,7 +278,14 @@ func (p *fileLoader) loadSourceFileMetaData(fileName string) *ast.SourceFileMeta func (p *fileLoader) parseSourceFile(t *parseTask) *ast.SourceFile { path := p.toPath(t.normalizedFilePath) - sourceFile := p.opts.Host.GetSourceFile(t.normalizedFilePath, path, p.projectReferenceFileMapper.getCompilerOptionsForFile(t).SourceFileAffecting(), t.metadata) + options := p.projectReferenceFileMapper.getCompilerOptionsForFile(t) + sourceFile := p.opts.Host.GetSourceFile(ast.SourceFileParseOptions{ + FileName: t.normalizedFilePath, + Path: path, + CompilerOptions: ast.GetSourceFileAffectingCompilerOptions(t.normalizedFilePath, options), + ExternalModuleIndicatorOptions: ast.GetExternalModuleIndicatorOptions(t.normalizedFilePath, options, t.metadata), + JSDocParsingMode: p.opts.JSDocParsingMode, + }) return sourceFile } @@ -292,7 +299,7 @@ func (p *fileLoader) resolveTripleslashPathReference(moduleName string, containi return tspath.NormalizePath(referencedFileName) } -func (p *fileLoader) resolveTypeReferenceDirectives(file *ast.SourceFile, meta *ast.SourceFileMetaData) ( +func (p *fileLoader) resolveTypeReferenceDirectives(file *ast.SourceFile, meta ast.SourceFileMetaData) ( toParse []string, typeResolutionsInFile module.ModeAwareCache[*module.ResolvedTypeReferenceDirective], ) { @@ -314,7 +321,7 @@ func (p *fileLoader) resolveTypeReferenceDirectives(file *ast.SourceFile, meta * const externalHelpersModuleNameText = "tslib" // TODO(jakebailey): dedupe -func (p *fileLoader) resolveImportsAndModuleAugmentations(file *ast.SourceFile, meta *ast.SourceFileMetaData) ( +func (p *fileLoader) resolveImportsAndModuleAugmentations(file *ast.SourceFile, meta ast.SourceFileMetaData) ( toParse []string, resolutionsInFile module.ModeAwareCache[*module.ResolvedModule], importHelpersImportSpecifier *ast.Node, @@ -397,7 +404,7 @@ func (p *fileLoader) resolveImportsAndModuleAugmentations(file *ast.SourceFile, return toParse, resolutionsInFile, importHelpersImportSpecifier, jsxRuntimeImportSpecifier_ } -func (p *fileLoader) resolveModuleNames(entries []*ast.Node, file *ast.SourceFile, meta *ast.SourceFileMetaData, redirect *tsoptions.ParsedCommandLine) []*resolution { +func (p *fileLoader) resolveModuleNames(entries []*ast.Node, file *ast.SourceFile, meta ast.SourceFileMetaData, redirect *tsoptions.ParsedCommandLine) []*resolution { if len(entries) == 0 { return nil } @@ -434,7 +441,7 @@ type resolution struct { resolvedModule *module.ResolvedModule } -func getModeForTypeReferenceDirectiveInFile(ref *ast.FileReference, file *ast.SourceFile, meta *ast.SourceFileMetaData, options *core.CompilerOptions) core.ResolutionMode { +func getModeForTypeReferenceDirectiveInFile(ref *ast.FileReference, file *ast.SourceFile, meta ast.SourceFileMetaData, options *core.CompilerOptions) core.ResolutionMode { if ref.ResolutionMode != core.ResolutionModeNone { return ref.ResolutionMode } else { @@ -442,7 +449,7 @@ func getModeForTypeReferenceDirectiveInFile(ref *ast.FileReference, file *ast.So } } -func getDefaultResolutionModeForFile(fileName string, meta *ast.SourceFileMetaData, options *core.CompilerOptions) core.ResolutionMode { +func getDefaultResolutionModeForFile(fileName string, meta ast.SourceFileMetaData, options *core.CompilerOptions) core.ResolutionMode { if importSyntaxAffectsModuleResolution(options) { return ast.GetImpliedNodeFormatForEmitWorker(fileName, options.GetEmitModuleKind(), meta) } else { @@ -450,7 +457,7 @@ func getDefaultResolutionModeForFile(fileName string, meta *ast.SourceFileMetaDa } } -func getModeForUsageLocation(fileName string, meta *ast.SourceFileMetaData, usage *ast.StringLiteralLike, options *core.CompilerOptions) core.ResolutionMode { +func getModeForUsageLocation(fileName string, meta ast.SourceFileMetaData, usage *ast.StringLiteralLike, options *core.CompilerOptions) core.ResolutionMode { if ast.IsImportDeclaration(usage.Parent) || ast.IsExportDeclaration(usage.Parent) || ast.IsJSDocImportTag(usage.Parent) { isTypeOnly := ast.IsExclusivelyTypeOnlyImportOrExport(usage.Parent) if isTypeOnly { @@ -488,7 +495,7 @@ func importSyntaxAffectsModuleResolution(options *core.CompilerOptions) bool { options.GetResolvePackageJsonExports() || options.GetResolvePackageJsonImports() } -func getEmitSyntaxForUsageLocationWorker(fileName string, meta *ast.SourceFileMetaData, usage *ast.Node, options *core.CompilerOptions) core.ResolutionMode { +func getEmitSyntaxForUsageLocationWorker(fileName string, meta ast.SourceFileMetaData, usage *ast.Node, options *core.CompilerOptions) core.ResolutionMode { if ast.IsRequireCall(usage.Parent, false /*requireStringLiteralLikeArgument*/) || ast.IsExternalModuleReference(usage.Parent) && ast.IsImportEqualsDeclaration(usage.Parent.Parent) { return core.ModuleKindCommonJS } diff --git a/internal/compiler/host.go b/internal/compiler/host.go index fcaef38c6f..82c8c697a3 100644 --- a/internal/compiler/host.go +++ b/internal/compiler/host.go @@ -5,7 +5,6 @@ import ( "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/parser" - "github.com/microsoft/typescript-go/internal/scanner" "github.com/microsoft/typescript-go/internal/tsoptions" "github.com/microsoft/typescript-go/internal/tspath" "github.com/microsoft/typescript-go/internal/vfs" @@ -18,7 +17,7 @@ type CompilerHost interface { GetCurrentDirectory() string NewLine() string Trace(msg string) - GetSourceFile(fileName string, path tspath.Path, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData) *ast.SourceFile + GetSourceFile(opts ast.SourceFileParseOptions) *ast.SourceFile GetResolvedProjectReference(fileName string, path tspath.Path) *tsoptions.ParsedCommandLine } @@ -90,15 +89,12 @@ func (h *compilerHost) Trace(msg string) { //!!! TODO: implement } -func (h *compilerHost) GetSourceFile(fileName string, path tspath.Path, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData) *ast.SourceFile { - text, ok := h.FS().ReadFile(fileName) +func (h *compilerHost) GetSourceFile(opts ast.SourceFileParseOptions) *ast.SourceFile { + text, ok := h.FS().ReadFile(opts.FileName) if !ok { return nil } - if tspath.FileExtensionIs(fileName, tspath.ExtensionJson) { - return parser.ParseJSONText(fileName, path, text) - } - return parser.ParseSourceFile(fileName, path, text, options, metadata, scanner.JSDocParsingModeParseForTypeErrors) + return parser.ParseSourceFile(opts, text, core.GetScriptKindFromFileName(opts.FileName)) } func (h *compilerHost) GetResolvedProjectReference(fileName string, path tspath.Path) *tsoptions.ParsedCommandLine { diff --git a/internal/compiler/parsetask.go b/internal/compiler/parsetask.go index 5c4e506918..3143336e72 100644 --- a/internal/compiler/parsetask.go +++ b/internal/compiler/parsetask.go @@ -16,7 +16,7 @@ type parseTask struct { isRedirected bool subTasks []*parseTask - metadata *ast.SourceFileMetaData + metadata ast.SourceFileMetaData resolutionsInFile module.ModeAwareCache[*module.ResolvedModule] typeResolutionsInFile module.ModeAwareCache[*module.ResolvedTypeReferenceDirective] importHelpersImportSpecifier *ast.Node diff --git a/internal/compiler/program.go b/internal/compiler/program.go index 3be053f2d7..8cea5d5dea 100644 --- a/internal/compiler/program.go +++ b/internal/compiler/program.go @@ -30,6 +30,7 @@ type ProgramOptions struct { CreateCheckerPool func(*Program) CheckerPool TypingsLocation string ProjectName string + JSDocParsingMode ast.JSDocParsingMode } func (p *ProgramOptions) canUseProjectReferenceSource() bool { @@ -225,9 +226,7 @@ func NewProgram(opts ProgramOptions) *Program { // In addition to a new program, return a boolean indicating whether the data of the old program was reused. func (p *Program) UpdateProgram(changedFilePath tspath.Path) (*Program, bool) { oldFile := p.filesByPath[changedFilePath] - // TODO(jakebailey): is wrong because the new file may have new metadata? - metadata := p.sourceFileMetaDatas[changedFilePath] - newFile := p.Host().GetSourceFile(oldFile.FileName(), changedFilePath, p.Options().SourceFileAffecting(), metadata) + newFile := p.Host().GetSourceFile(oldFile.ParseOptions()) if !canReplaceFileInProgram(oldFile, newFile) { return NewProgram(p.opts), false } @@ -257,14 +256,8 @@ func (p *Program) initCheckerPool() { } func canReplaceFileInProgram(file1 *ast.SourceFile, file2 *ast.SourceFile) bool { - // TODO(jakebailey): metadata?? return file2 != nil && - file1.FileName() == file2.FileName() && - file1.Path() == file2.Path() && - file1.LanguageVersion == file2.LanguageVersion && - file1.LanguageVariant == file2.LanguageVariant && - file1.ScriptKind == file2.ScriptKind && - file1.IsDeclarationFile == file2.IsDeclarationFile && + file1.ParseOptions() == file2.ParseOptions() && file1.HasNoDefaultLib == file2.HasNoDefaultLib && file1.UsesUriStyleNodeCoreModules == file2.UsesUriStyleNodeCoreModules && slices.EqualFunc(file1.Imports(), file2.Imports(), equalModuleSpecifiers) && @@ -308,7 +301,7 @@ func (p *Program) BindSourceFiles() { for _, file := range p.files { if !file.IsBound() { wg.Queue(func() { - binder.BindSourceFile(file, p.projectReferenceFileMapper.getCompilerOptionsForFile(file).SourceFileAffecting()) + binder.BindSourceFile(file) }) } } @@ -601,7 +594,7 @@ func compactAndMergeRelatedInfos(diagnostics []*ast.Diagnostic) []*ast.Diagnosti func (p *Program) getDiagnosticsHelper(ctx context.Context, sourceFile *ast.SourceFile, ensureBound bool, ensureChecked bool, getDiagnostics func(context.Context, *ast.SourceFile) []*ast.Diagnostic) []*ast.Diagnostic { if sourceFile != nil { if ensureBound { - binder.BindSourceFile(sourceFile, p.projectReferenceFileMapper.getCompilerOptionsForFile(sourceFile).SourceFileAffecting()) + binder.BindSourceFile(sourceFile) } return SortAndDeduplicateDiagnostics(getDiagnostics(ctx, sourceFile)) } @@ -670,7 +663,7 @@ func (p *Program) InstantiationCount() int { return count } -func (p *Program) GetSourceFileMetaData(path tspath.Path) *ast.SourceFileMetaData { +func (p *Program) GetSourceFileMetaData(path tspath.Path) ast.SourceFileMetaData { return p.sourceFileMetaDatas[path] } diff --git a/internal/core/compileroptions.go b/internal/core/compileroptions.go index e6c7f859e9..c7c84e3259 100644 --- a/internal/core/compileroptions.go +++ b/internal/core/compileroptions.go @@ -149,7 +149,7 @@ type CompilerOptions struct { Quiet Tristate `json:"quiet,omitzero"` sourceFileAffectingCompilerOptionsOnce sync.Once - sourceFileAffectingCompilerOptions *SourceFileAffectingCompilerOptions + sourceFileAffectingCompilerOptions SourceFileAffectingCompilerOptions } // noCopy may be embedded into structs which must not be copied @@ -355,24 +355,18 @@ type SourceFileAffectingCompilerOptions struct { AllowUnreachableCode Tristate AllowUnusedLabels Tristate BindInStrictMode bool - EmitModuleDetectionKind ModuleDetectionKind - EmitModuleKind ModuleKind EmitScriptTarget ScriptTarget - JsxEmit JsxEmit NoFallthroughCasesInSwitch Tristate ShouldPreserveConstEnums bool } -func (options *CompilerOptions) SourceFileAffecting() *SourceFileAffectingCompilerOptions { +func (options *CompilerOptions) SourceFileAffecting() SourceFileAffectingCompilerOptions { options.sourceFileAffectingCompilerOptionsOnce.Do(func() { - options.sourceFileAffectingCompilerOptions = &SourceFileAffectingCompilerOptions{ + options.sourceFileAffectingCompilerOptions = SourceFileAffectingCompilerOptions{ AllowUnreachableCode: options.AllowUnreachableCode, AllowUnusedLabels: options.AllowUnusedLabels, BindInStrictMode: options.AlwaysStrict.IsTrue() || options.Strict.IsTrue(), - EmitModuleDetectionKind: options.GetEmitModuleDetectionKind(), - EmitModuleKind: options.GetEmitModuleKind(), EmitScriptTarget: options.GetEmitScriptTarget(), - JsxEmit: options.Jsx, NoFallthroughCasesInSwitch: options.NoFallthroughCasesInSwitch, ShouldPreserveConstEnums: options.ShouldPreserveConstEnums(), } diff --git a/internal/execute/tsc.go b/internal/execute/tsc.go index a252f6e584..3a6a4f31cf 100644 --- a/internal/execute/tsc.go +++ b/internal/execute/tsc.go @@ -17,7 +17,6 @@ import ( "github.com/microsoft/typescript-go/internal/format" "github.com/microsoft/typescript-go/internal/parser" "github.com/microsoft/typescript-go/internal/pprof" - "github.com/microsoft/typescript-go/internal/scanner" "github.com/microsoft/typescript-go/internal/tsoptions" "github.com/microsoft/typescript-go/internal/tspath" ) @@ -74,16 +73,14 @@ func fmtMain(sys System, input, output string) ExitStatus { } text := fileContent pathified := tspath.ToPath(input, sys.GetCurrentDirectory(), true) - sourceFile := parser.ParseSourceFile( - string(pathified), - pathified, - text, - &core.SourceFileAffectingCompilerOptions{ + sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: string(pathified), + Path: pathified, + CompilerOptions: core.SourceFileAffectingCompilerOptions{ EmitScriptTarget: core.ScriptTargetLatest, }, - nil, - scanner.JSDocParsingModeParseAll, - ) + JSDocParsingMode: ast.JSDocParsingModeParseAll, + }, text, core.GetScriptKindFromFileName(string(pathified))) ast.SetParentInChildren(sourceFile.AsNode()) edits := format.FormatDocument(ctx, sourceFile) newText := applyBulkEdits(text, edits) @@ -246,8 +243,9 @@ func performCompilation( // todo: cache, statistics, tracing parseStart := sys.Now() program := compiler.NewProgram(compiler.ProgramOptions{ - Config: config, - Host: host, + Config: config, + Host: host, + JSDocParsingMode: ast.JSDocParsingModeParseForTypeErrors, }) parseTime := sys.Now().Sub(parseStart) diff --git a/internal/execute/watch.go b/internal/execute/watch.go index 84e49c78a4..6d587951d1 100644 --- a/internal/execute/watch.go +++ b/internal/execute/watch.go @@ -4,6 +4,7 @@ import ( "fmt" "time" + "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/compiler" ) @@ -36,8 +37,9 @@ func (w *watcher) doCycle() { } // updateProgram() w.program = compiler.NewProgram(compiler.ProgramOptions{ - Config: w.options, - Host: w.host, + Config: w.options, + Host: w.host, + JSDocParsingMode: ast.JSDocParsingModeParseForTypeErrors, }) if w.hasBeenModified(w.program) { fmt.Fprint(w.sys.Writer(), "build starting at ", w.sys.Now(), w.sys.NewLine()) diff --git a/internal/format/api_test.go b/internal/format/api_test.go index d60227f7dd..76e00e5113 100644 --- a/internal/format/api_test.go +++ b/internal/format/api_test.go @@ -12,7 +12,6 @@ import ( "github.com/microsoft/typescript-go/internal/parser" "github.com/microsoft/typescript-go/internal/printer" "github.com/microsoft/typescript-go/internal/repo" - "github.com/microsoft/typescript-go/internal/scanner" "gotest.tools/v3/assert" ) @@ -34,7 +33,7 @@ func applyBulkEdits(text string, edits []core.TextChange) string { return b.String() } -var parseCompilerOptions = &core.SourceFileAffectingCompilerOptions{ +var parseCompilerOptions = core.SourceFileAffectingCompilerOptions{ EmitScriptTarget: core.ScriptTargetLatest, } @@ -60,14 +59,11 @@ func TestFormat(t *testing.T) { fileContent, err := os.ReadFile(filePath) assert.NilError(t, err) text := string(fileContent) - sourceFile := parser.ParseSourceFile( - "/checker.ts", - "/checker.ts", - text, - parseCompilerOptions, - nil, - scanner.JSDocParsingModeParseAll, - ) + sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/checker.ts", + Path: "/checker.ts", + CompilerOptions: parseCompilerOptions, + }, text, core.ScriptKindTS) ast.SetParentInChildren(sourceFile.AsNode()) edits := format.FormatDocument(ctx, sourceFile) newText := applyBulkEdits(text, edits) @@ -94,14 +90,11 @@ func BenchmarkFormat(b *testing.B) { fileContent, err := os.ReadFile(filePath) assert.NilError(b, err) text := string(fileContent) - sourceFile := parser.ParseSourceFile( - "/checker.ts", - "/checker.ts", - text, - parseCompilerOptions, - nil, - scanner.JSDocParsingModeParseAll, - ) + sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/checker.ts", + Path: "/checker.ts", + CompilerOptions: parseCompilerOptions, + }, text, core.ScriptKindTS) ast.SetParentInChildren(sourceFile.AsNode()) b.Run("format checker.ts", func(b *testing.B) { diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index 3090fcc8ae..c299f819ae 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -76,21 +76,8 @@ var sourceFileCache collections.SyncMap[harnessutil.SourceFileCacheKey, *ast.Sou type parsedFileCache struct{} -func (c *parsedFileCache) GetFile( - fileName string, - path tspath.Path, - text string, - options *core.SourceFileAffectingCompilerOptions, - metadata *ast.SourceFileMetaData, -) *ast.SourceFile { - key := harnessutil.GetSourceFileCacheKey( - fileName, - path, - text, - options, - metadata, - ) - +func (c *parsedFileCache) GetFile(opts ast.SourceFileParseOptions, text string, scriptKind core.ScriptKind) *ast.SourceFile { + key := harnessutil.GetSourceFileCacheKey(opts, text, scriptKind) cachedFile, ok := sourceFileCache.Load(key) if !ok { return nil @@ -98,21 +85,8 @@ func (c *parsedFileCache) GetFile( return cachedFile } -func (c *parsedFileCache) CacheFile( - fileName string, - path tspath.Path, - text string, - options *core.SourceFileAffectingCompilerOptions, - metadata *ast.SourceFileMetaData, - sourceFile *ast.SourceFile, -) { - key := harnessutil.GetSourceFileCacheKey( - fileName, - path, - text, - options, - metadata, - ) +func (c *parsedFileCache) CacheFile(opts ast.SourceFileParseOptions, text string, scriptKind core.ScriptKind, sourceFile *ast.SourceFile) { + key := harnessutil.GetSourceFileCacheKey(opts, text, scriptKind) sourceFileCache.Store(key, sourceFile) } diff --git a/internal/ls/completions.go b/internal/ls/completions.go index 3d1927f49a..47e2a7f518 100644 --- a/internal/ls/completions.go +++ b/internal/ls/completions.go @@ -1513,7 +1513,7 @@ func (l *LanguageService) completionInfoFromData( defer done() // Verify if the file is JSX language variant - if ast.GetLanguageVariant(file.ScriptKind) == core.LanguageVariantJSX { + if file.LanguageVariant == core.LanguageVariantJSX { list := l.getJsxClosingTagCompletion(data.location, file, position, clientOptions) if list != nil { return list diff --git a/internal/ls/completions_test.go b/internal/ls/completions_test.go index 028153adcc..7dbdeca8ab 100644 --- a/internal/ls/completions_test.go +++ b/internal/ls/completions_test.go @@ -2172,7 +2172,7 @@ func assertIncludesItem(t *testing.T, actual *lsproto.CompletionList, expected * func createLanguageService(ctx context.Context, fileName string, files map[string]any) (*ls.LanguageService, func()) { projectService, _ := projecttestutil.Setup(files, nil) - projectService.OpenFile(fileName, files[fileName].(string), core.ScriptKindTS, "") + projectService.OpenFile(fileName, files[fileName].(string), core.GetScriptKindFromFileName(fileName), "") project := projectService.Projects()[0] return project.GetLanguageServiceForRequest(ctx) } diff --git a/internal/packagejson/packagejson_test.go b/internal/packagejson/packagejson_test.go index 389580490d..e216d9c1d2 100644 --- a/internal/packagejson/packagejson_test.go +++ b/internal/packagejson/packagejson_test.go @@ -6,6 +6,8 @@ import ( "testing" json2 "github.com/go-json-experiment/json" + "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/packagejson" "github.com/microsoft/typescript-go/internal/parser" "github.com/microsoft/typescript-go/internal/repo" @@ -48,7 +50,10 @@ func BenchmarkPackageJSON(b *testing.B) { b.Run(f.Name(), func(b *testing.B) { fileName := "/" + f.Name() for b.Loop() { - parser.ParseJSONText(fileName, tspath.Path(fileName), string(content)) + parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: fileName, + Path: tspath.Path(fileName), + }, string(content), core.ScriptKindJSON) } }) }) diff --git a/internal/parser/jsdoc.go b/internal/parser/jsdoc.go index 55a80b572e..e9e9604d73 100644 --- a/internal/parser/jsdoc.go +++ b/internal/parser/jsdoc.go @@ -127,7 +127,6 @@ func (p *Parser) parseJSDocComment(parent *ast.Node, start int, end int, fullSta saveToken := p.token saveContextFlags := p.contextFlags saveParsingContexts := p.parsingContexts - saveParsingMode := p.scanner.JSDocParsingMode saveScannerState := p.scanner.Mark() saveDiagnosticsLength := len(p.diagnostics) saveHasParseError := p.hasParseError @@ -157,7 +156,6 @@ func (p *Parser) parseJSDocComment(parent *ast.Node, start int, end int, fullSta p.scanner.SetText(p.sourceText) p.parsingContexts = saveParsingContexts p.contextFlags = saveContextFlags - p.scanner.JSDocParsingMode = saveParsingMode p.scanner.Rewind(saveScannerState) p.token = saveToken p.hasParseError = saveHasParseError diff --git a/internal/parser/parser.go b/internal/parser/parser.go index de189f3d19..1952d6ffe8 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -50,12 +50,9 @@ type Parser struct { scanner *scanner.Scanner factory ast.NodeFactory - fileName string - path tspath.Path - sourceText string - options *core.SourceFileAffectingCompilerOptions - metadata *ast.SourceFileMetaData - languageVersion core.ScriptTarget + opts ast.SourceFileParseOptions + sourceText string + scriptKind core.ScriptKind languageVariant core.LanguageVariant diagnostics []*ast.Diagnostic @@ -99,19 +96,18 @@ func putParser(p *Parser) { parserPool.Put(p) } -func ParseSourceFile(fileName string, path tspath.Path, sourceText string, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData, jsdocParsingMode scanner.JSDocParsingMode) *ast.SourceFile { +func ParseSourceFile(opts ast.SourceFileParseOptions, sourceText string, scriptKind core.ScriptKind) *ast.SourceFile { p := getParser() defer putParser(p) - p.initializeState(fileName, path, sourceText, options, metadata, core.ScriptKindUnknown, jsdocParsingMode) + p.initializeState(opts, sourceText, scriptKind) p.nextToken() + if p.scriptKind == core.ScriptKindJSON { + return p.parseJSONText() + } return p.parseSourceFileWorker() } -func ParseJSONText(fileName string, path tspath.Path, sourceText string) *ast.SourceFile { - p := getParser() - defer putParser(p) - p.initializeState(fileName, path, sourceText, &core.SourceFileAffectingCompilerOptions{EmitScriptTarget: core.ScriptTargetES2015}, nil, core.ScriptKindJSON, scanner.JSDocParsingModeParseAll) - p.nextToken() +func (p *Parser) parseJSONText() *ast.SourceFile { pos := p.nodePos() var statements *ast.NodeList @@ -172,40 +168,41 @@ func ParseJSONText(fileName string, path tspath.Path, sourceText string) *ast.So statements = p.newNodeList(core.NewTextRange(pos, p.nodePos()), []*ast.Node{statement}) p.parseExpectedToken(ast.KindEndOfFile) } - node := p.factory.NewSourceFile(p.sourceText, p.fileName, p.path, statements) + node := p.factory.NewSourceFile(p.opts, p.sourceText, statements) p.finishNode(node, pos) result := node.AsSourceFile() - result.ScriptKind = core.ScriptKindJSON - result.LanguageVersion = core.ScriptTargetES2015 - result.Flags |= p.sourceFlags - result.SetDiagnostics(attachFileToDiagnostics(p.diagnostics, result)) - result.SetJSDocDiagnostics(attachFileToDiagnostics(p.jsdocDiagnostics, result)) + p.finishSourceFile(result, false) return result } func ParseIsolatedEntityName(text string, languageVersion core.ScriptTarget) *ast.EntityName { p := getParser() defer putParser(p) - p.initializeState("", "", text, &core.SourceFileAffectingCompilerOptions{EmitScriptTarget: languageVersion}, nil, core.ScriptKindJS, scanner.JSDocParsingModeParseAll) + p.initializeState(ast.SourceFileParseOptions{ + CompilerOptions: core.SourceFileAffectingCompilerOptions{ + EmitScriptTarget: languageVersion, + }, + JSDocParsingMode: ast.JSDocParsingModeParseAll, + }, text, core.ScriptKindJS) p.nextToken() entityName := p.parseEntityName(true, nil) return core.IfElse(p.token == ast.KindEndOfFile && len(p.diagnostics) == 0, entityName, nil) } -func (p *Parser) initializeState(fileName string, path tspath.Path, sourceText string, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData, scriptKind core.ScriptKind, jsdocParsingMode scanner.JSDocParsingMode) { +func (p *Parser) initializeState(opts ast.SourceFileParseOptions, sourceText string, scriptKind core.ScriptKind) { + if scriptKind == core.ScriptKindUnknown { + panic("ScriptKind must be specified when parsing source files.") + } + if p.scanner == nil { p.scanner = scanner.NewScanner() } else { p.scanner.Reset() } - p.fileName = fileName - p.path = path + p.opts = opts p.sourceText = sourceText - p.options = options - p.metadata = metadata - p.languageVersion = options.EmitScriptTarget - p.scriptKind = ensureScriptKind(fileName, scriptKind) - p.languageVariant = ast.GetLanguageVariant(p.scriptKind) + p.scriptKind = scriptKind + p.languageVariant = getLanguageVariant(p.scriptKind) switch p.scriptKind { case core.ScriptKindJS, core.ScriptKindJSX: p.contextFlags = ast.NodeFlagsJavaScriptFile @@ -216,10 +213,10 @@ func (p *Parser) initializeState(fileName string, path tspath.Path, sourceText s } p.scanner.SetText(p.sourceText) p.scanner.SetOnError(p.scanError) - p.scanner.SetScriptTarget(p.languageVersion) + p.scanner.SetScriptTarget(p.opts.CompilerOptions.EmitScriptTarget) p.scanner.SetLanguageVariant(p.languageVariant) p.scanner.SetScriptKind(p.scriptKind) - p.scanner.SetJSDocParsingMode(jsdocParsingMode) + p.scanner.SetJSDocParsingMode(p.opts.JSDocParsingMode) } func (p *Parser) scanError(message *diagnostics.Message, pos int, length int, args ...any) { @@ -317,7 +314,7 @@ func (p *Parser) hasPrecedingJSDocComment() bool { } func (p *Parser) parseSourceFileWorker() *ast.SourceFile { - isDeclarationFile := tspath.IsDeclarationFileName(p.fileName) + isDeclarationFile := tspath.IsDeclarationFileName(p.opts.FileName) if isDeclarationFile { p.contextFlags |= ast.NodeFlagsAmbient } @@ -327,7 +324,7 @@ func (p *Parser) parseSourceFileWorker() *ast.SourceFile { if eof.Kind != ast.KindEndOfFile { panic("Expected end of file token from scanner.") } - node := p.factory.NewSourceFile(p.sourceText, p.fileName, p.path, statements) + node := p.factory.NewSourceFile(p.opts, p.sourceText, statements) p.finishNode(node, pos) result := node.AsSourceFile() p.finishSourceFile(result, isDeclarationFile) @@ -348,9 +345,9 @@ func (p *Parser) finishSourceFile(result *ast.SourceFile, isDeclarationFile bool result.Pragmas = getCommentPragmas(&p.factory, p.sourceText) p.processPragmasIntoFields(result) result.SetDiagnostics(attachFileToDiagnostics(p.diagnostics, result)) + result.SetJSDocDiagnostics(attachFileToDiagnostics(p.jsdocDiagnostics, result)) result.CommonJSModuleIndicator = p.commonJSModuleIndicator result.IsDeclarationFile = isDeclarationFile - result.LanguageVersion = p.languageVersion result.LanguageVariant = p.languageVariant result.ScriptKind = p.scriptKind result.Flags |= p.sourceFlags @@ -359,82 +356,7 @@ func (p *Parser) finishSourceFile(result *ast.SourceFile, isDeclarationFile bool result.TextCount = p.factory.TextCount() result.IdentifierCount = p.identifierCount result.SetJSDocCache(p.jsdocCache) - result.ExternalModuleIndicator = getExternalModuleIndicator(result, p.options, p.metadata) -} - -func getExternalModuleIndicator(file *ast.SourceFile, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData) *ast.Node { - // All detection kinds start by checking this. - if node := isFileProbablyExternalModule(file); node != nil { - return node - } - - switch options.EmitModuleDetectionKind { - case core.ModuleDetectionKindForce: - // All non-declaration files are modules, declaration files still do the usual isFileProbablyExternalModule - if !file.IsDeclarationFile { - return file.AsNode() - } - return nil - case core.ModuleDetectionKindLegacy: - // Files are modules if they have imports, exports, or import.meta - return nil - case core.ModuleDetectionKindAuto: - // If module is nodenext or node16, all esm format files are modules - // If jsx is react-jsx or react-jsxdev then jsx tags force module-ness - // otherwise, the presence of import or export statments (or import.meta) implies module-ness - if options.JsxEmit == core.JsxEmitReactJSX || options.JsxEmit == core.JsxEmitReactJSXDev { - if node := isFileModuleFromUsingJSXTag(file); node != nil { - return node - } - } - return isFileForcedToBeModuleByFormat(file, options, metadata) - default: - return nil - } -} - -func isFileModuleFromUsingJSXTag(file *ast.SourceFile) *ast.Node { - if file.IsDeclarationFile { - return nil - } - return walkTreeForJSXTags(file.AsNode()) -} - -// This is a somewhat unavoidable full tree walk to locate a JSX tag - `import.meta` requires the same, -// but we avoid that walk (or parts of it) if at all possible using the `PossiblyContainsImportMeta` node flag. -// Unfortunately, there's no `NodeFlag` space to do the same for JSX. -func walkTreeForJSXTags(node *ast.Node) *ast.Node { - var found *ast.Node - - var visitor func(node *ast.Node) bool - visitor = func(node *ast.Node) bool { - if found != nil { - return true - } - if node.SubtreeFacts()&ast.SubtreeContainsJsx == 0 { - return false - } - if ast.IsJsxOpeningElement(node) || ast.IsJsxFragment(node) { - found = node - return true - } - return node.ForEachChild(visitor) - } - visitor(node) - - return found -} - -var isFileForcedToBeModuleByFormatExtensions = []string{tspath.ExtensionCjs, tspath.ExtensionCts, tspath.ExtensionMjs, tspath.ExtensionMts} - -func isFileForcedToBeModuleByFormat(file *ast.SourceFile, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData) *ast.Node { - // Excludes declaration files - they still require an explicit `export {}` or the like - // for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files - // that aren't esm-mode (meaning not in a `type: module` scope). - if !file.IsDeclarationFile && (ast.GetImpliedNodeFormatForEmitWorker(file.FileName(), options.EmitModuleKind, metadata) == core.ModuleKindESNext || tspath.FileExtensionIsOneOf(file.FileName(), isFileForcedToBeModuleByFormatExtensions)) { - return file.AsNode() - } - return nil + ast.SetExternalModuleIndicator(result, p.opts.ExternalModuleIndicatorOptions) } func (p *Parser) parseToplevelStatement(i int) *ast.Node { @@ -539,7 +461,7 @@ func (p *Parser) reparseTopLevelAwait(sourceFile *ast.SourceFile) *ast.Node { } } - return p.factory.NewSourceFile(sourceFile.Text(), sourceFile.FileName(), sourceFile.Path(), p.newNodeList(sourceFile.Statements.Loc, statements)) + return p.factory.NewSourceFile(sourceFile.ParseOptions(), p.sourceText, p.newNodeList(sourceFile.Statements.Loc, statements)) } func (p *Parser) parseListIndex(kind ParsingContext, parseElement func(p *Parser, index int) *ast.Node) *ast.NodeList { @@ -6428,36 +6350,6 @@ func isReservedWord(token ast.Kind) bool { return ast.KindFirstReservedWord <= token && token <= ast.KindLastReservedWord } -func isFileProbablyExternalModule(sourceFile *ast.SourceFile) *ast.Node { - for _, statement := range sourceFile.Statements.Nodes { - if ast.IsExternalModuleIndicator(statement) { - return statement - } - } - return getImportMetaIfNecessary(sourceFile) -} - -func getImportMetaIfNecessary(sourceFile *ast.SourceFile) *ast.Node { - if sourceFile.AsNode().Flags&ast.NodeFlagsPossiblyContainsImportMeta != 0 { - return findChildNode(sourceFile.AsNode(), ast.IsImportMeta) - } - return nil -} - -func findChildNode(root *ast.Node, check func(*ast.Node) bool) *ast.Node { - var result *ast.Node - var visit func(*ast.Node) bool - visit = func(node *ast.Node) bool { - if check(node) { - result = node - return true - } - return node.ForEachChild(visit) - } - visit(root) - return result -} - func tagNamesAreEquivalent(lhs *ast.Expression, rhs *ast.Expression) bool { if lhs.Kind != rhs.Kind { return false diff --git a/internal/parser/parser_test.go b/internal/parser/parser_test.go index 0833bd4b14..11a01b0220 100644 --- a/internal/parser/parser_test.go +++ b/internal/parser/parser_test.go @@ -7,10 +7,10 @@ import ( "path/filepath" "testing" + "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/repo" - "github.com/microsoft/typescript-go/internal/scanner" "github.com/microsoft/typescript-go/internal/testutil/fixtures" "github.com/microsoft/typescript-go/internal/tspath" "github.com/microsoft/typescript-go/internal/vfs/osvfs" @@ -20,10 +20,10 @@ import ( func BenchmarkParse(b *testing.B) { jsdocModes := []struct { name string - mode scanner.JSDocParsingMode + mode ast.JSDocParsingMode }{ - {"tsc", scanner.JSDocParsingModeParseForTypeErrors}, - {"server", scanner.JSDocParsingModeParseAll}, + {"tsc", ast.JSDocParsingModeParseForTypeErrors}, + {"server", ast.JSDocParsingModeParseAll}, } for _, f := range fixtures.BenchFixtures { @@ -33,15 +33,23 @@ func BenchmarkParse(b *testing.B) { fileName := tspath.GetNormalizedAbsolutePath(f.Path(), "/") path := tspath.ToPath(fileName, "/", osvfs.FS().UseCaseSensitiveFileNames()) sourceText := f.ReadFile(b) - options := &core.SourceFileAffectingCompilerOptions{ - EmitScriptTarget: core.ScriptTargetESNext, - } + scriptKind := core.GetScriptKindFromFileName(fileName) for _, jsdoc := range jsdocModes { b.Run(jsdoc.name, func(b *testing.B) { jsdocMode := jsdoc.mode + + opts := ast.SourceFileParseOptions{ + FileName: fileName, + Path: path, + CompilerOptions: core.SourceFileAffectingCompilerOptions{ + EmitScriptTarget: core.ScriptTargetESNext, + }, + JSDocParsingMode: jsdocMode, + } + for b.Loop() { - ParseSourceFile(fileName, path, sourceText, options, nil, jsdocMode) + ParseSourceFile(opts, sourceText, scriptKind) } }) } @@ -106,13 +114,13 @@ func FuzzParser(f *testing.F) { sourceText, err := os.ReadFile(file.path) assert.NilError(f, err) extension := tspath.TryGetExtensionFromPath(file.path) - f.Add(extension, string(sourceText), int(core.ScriptTargetESNext), int(scanner.JSDocParsingModeParseAll)) + f.Add(extension, string(sourceText), int(core.ScriptTargetESNext), int(ast.JSDocParsingModeParseAll)) } } f.Fuzz(func(t *testing.T, extension string, sourceText string, scriptTarget_ int, jsdocParsingMode_ int) { scriptTarget := core.ScriptTarget(scriptTarget_) - jsdocParsingMode := scanner.JSDocParsingMode(jsdocParsingMode_) + jsdocParsingMode := ast.JSDocParsingMode(jsdocParsingMode_) if !extensions.Has(extension) { t.Skip() @@ -122,22 +130,22 @@ func FuzzParser(f *testing.F) { t.Skip() } - if jsdocParsingMode < scanner.JSDocParsingModeParseAll || jsdocParsingMode > scanner.JSDocParsingModeParseNone { + if jsdocParsingMode < ast.JSDocParsingModeParseAll || jsdocParsingMode > ast.JSDocParsingModeParseNone { t.Skip() } fileName := "/index" + extension path := tspath.Path(fileName) - if extension == ".json" { - ParseJSONText(fileName, path, sourceText) - return - } - - options := &core.SourceFileAffectingCompilerOptions{ - EmitScriptTarget: scriptTarget, + opts := ast.SourceFileParseOptions{ + FileName: fileName, + Path: path, + CompilerOptions: core.SourceFileAffectingCompilerOptions{ + EmitScriptTarget: scriptTarget, + }, + JSDocParsingMode: jsdocParsingMode, } - ParseSourceFile(fileName, path, sourceText, options, nil, jsdocParsingMode) + ParseSourceFile(opts, sourceText, core.GetScriptKindFromFileName(fileName)) }) } diff --git a/internal/parser/utilities.go b/internal/parser/utilities.go index b2487f9539..ca9715f247 100644 --- a/internal/parser/utilities.go +++ b/internal/parser/utilities.go @@ -8,20 +8,13 @@ import ( "github.com/microsoft/typescript-go/internal/scanner" ) -func ensureScriptKind(fileName string, scriptKind core.ScriptKind) core.ScriptKind { - // Using scriptKind as a condition handles both: - // - 'scriptKind' is unspecified and thus it is `undefined` - // - 'scriptKind' is set and it is `Unknown` (0) - // If the 'scriptKind' is 'undefined' or 'Unknown' then we attempt - // to get the ScriptKind from the file name. If it cannot be resolved - // from the file name then the default 'TS' script kind is returned. - if scriptKind == core.ScriptKindUnknown { - scriptKind = core.GetScriptKindFromFileName(fileName) +func getLanguageVariant(scriptKind core.ScriptKind) core.LanguageVariant { + switch scriptKind { + case core.ScriptKindTSX, core.ScriptKindJSX, core.ScriptKindJS, core.ScriptKindJSON: + // .tsx and .jsx files are treated as jsx language variant. + return core.LanguageVariantJSX } - if scriptKind == core.ScriptKindUnknown { - scriptKind = core.ScriptKindTS - } - return scriptKind + return core.LanguageVariantStandard } func tokenIsIdentifierOrKeyword(token ast.Kind) bool { diff --git a/internal/printer/namegenerator_test.go b/internal/printer/namegenerator_test.go index 220bf606e6..26d638a884 100644 --- a/internal/printer/namegenerator_test.go +++ b/internal/printer/namegenerator_test.go @@ -5,14 +5,11 @@ import ( "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/binder" - "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/printer" "github.com/microsoft/typescript-go/internal/testutil/parsetestutil" "gotest.tools/v3/assert" ) -var defaultSourceFileAffectingOptions = (&core.CompilerOptions{}).SourceFileAffecting() - func TestTempVariable1(t *testing.T) { t.Parallel() @@ -260,7 +257,7 @@ func TestGeneratedNameForIdentifier1(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("function f() {}", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := file.Statements.Nodes[0].Name() name1 := ec.Factory.NewGeneratedNameForNode(n) @@ -277,7 +274,7 @@ func TestGeneratedNameForIdentifier2(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("function f() {}", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := file.Statements.Nodes[0].Name() name1 := ec.Factory.NewGeneratedNameForNodeEx(n, printer.AutoGenerateOptions{ @@ -297,7 +294,7 @@ func TestGeneratedNameForIdentifier3(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("function f() {}", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := file.Statements.Nodes[0].Name() name1 := ec.Factory.NewGeneratedNameForNodeEx(n, printer.AutoGenerateOptions{ @@ -319,7 +316,7 @@ func TestGeneratedNameForNamespace1(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("namespace foo { }", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) ns1 := file.Statements.Nodes[0] name1 := ec.Factory.NewGeneratedNameForNode(ns1) @@ -337,7 +334,7 @@ func TestGeneratedNameForNamespace2(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("namespace foo { var foo; }", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) ns1 := file.Statements.Nodes[0] name1 := ec.Factory.NewGeneratedNameForNode(ns1) @@ -355,7 +352,7 @@ func TestGeneratedNameForNamespace3(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("namespace ns1 { namespace foo { var foo; } } namespace ns2 { namespace foo { var foo; } }", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) ns1 := file.Statements.Nodes[0].AsModuleDeclaration().Body.AsModuleBlock().Statements.Nodes[0] ns2 := file.Statements.Nodes[1].AsModuleDeclaration().Body.AsModuleBlock().Statements.Nodes[0] @@ -377,7 +374,7 @@ func TestGeneratedNameForNamespace4(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("namespace ns1 { namespace foo { var foo; } } namespace ns2 { namespace foo { var foo; } }", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) ns1 := file.Statements.Nodes[0].AsModuleDeclaration().Body.AsModuleBlock().Statements.Nodes[0] ns2 := file.Statements.Nodes[1].AsModuleDeclaration().Body.AsModuleBlock().Statements.Nodes[0] @@ -404,7 +401,7 @@ func TestGeneratedNameForNodeCached(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("namespace foo { var foo; }", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) ns1 := file.Statements.Nodes[0] name1 := ec.Factory.NewGeneratedNameForNode(ns1) @@ -424,7 +421,7 @@ func TestGeneratedNameForImport(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("import * as foo from 'foo'", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := file.Statements.Nodes[0] name1 := ec.Factory.NewGeneratedNameForNode(n) @@ -441,7 +438,7 @@ func TestGeneratedNameForExport(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("export * as foo from 'foo'", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := file.Statements.Nodes[0] name1 := ec.Factory.NewGeneratedNameForNode(n) @@ -458,7 +455,7 @@ func TestGeneratedNameForFunctionDeclaration1(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("export function f() {}", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := file.Statements.Nodes[0] name1 := ec.Factory.NewGeneratedNameForNode(n) @@ -475,7 +472,7 @@ func TestGeneratedNameForFunctionDeclaration2(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("export default function () {}", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := file.Statements.Nodes[0] name1 := ec.Factory.NewGeneratedNameForNode(n) @@ -492,7 +489,7 @@ func TestGeneratedNameForClassDeclaration1(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("export class C {}", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := file.Statements.Nodes[0] name1 := ec.Factory.NewGeneratedNameForNode(n) @@ -509,7 +506,7 @@ func TestGeneratedNameForClassDeclaration2(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("export default class {}", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := file.Statements.Nodes[0] name1 := ec.Factory.NewGeneratedNameForNode(n) @@ -526,7 +523,7 @@ func TestGeneratedNameForExportAssignment(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("export default 0", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := file.Statements.Nodes[0] name1 := ec.Factory.NewGeneratedNameForNode(n) @@ -543,7 +540,7 @@ func TestGeneratedNameForClassExpression(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("(class {})", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := file.Statements.Nodes[0].AsExpressionStatement().Expression.AsParenthesizedExpression().Expression name1 := ec.Factory.NewGeneratedNameForNode(n) @@ -560,7 +557,7 @@ func TestGeneratedNameForMethod1(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("class C { m() {} }", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := file.Statements.Nodes[0].AsClassDeclaration().Members.Nodes[0] name1 := ec.Factory.NewGeneratedNameForNode(n) @@ -577,7 +574,7 @@ func TestGeneratedNameForMethod2(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("class C { 0() {} }", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := file.Statements.Nodes[0].AsClassDeclaration().Members.Nodes[0] name1 := ec.Factory.NewGeneratedNameForNode(n) @@ -594,7 +591,7 @@ func TestGeneratedPrivateNameForMethod(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("class C { m() {} }", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := file.Statements.Nodes[0].AsClassDeclaration().Members.Nodes[0] name1 := ec.Factory.NewGeneratedPrivateNameForNode(n) @@ -611,7 +608,7 @@ func TestGeneratedNameForComputedPropertyName(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("class C { [x] }", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := file.Statements.Nodes[0].AsClassDeclaration().Members.Nodes[0].Name() name1 := ec.Factory.NewGeneratedNameForNode(n) @@ -628,7 +625,7 @@ func TestGeneratedNameForOther(t *testing.T) { ec := printer.NewEmitContext() file := parsetestutil.ParseTypeScript("class C { [x] }", false /*jsx*/) - binder.BindSourceFile(file, defaultSourceFileAffectingOptions) + binder.BindSourceFile(file) n := ec.Factory.NewObjectLiteralExpression( ec.Factory.NewNodeList([]*ast.Node{}), diff --git a/internal/printer/printer.go b/internal/printer/printer.go index 21e36e3ef3..9184bd3274 100644 --- a/internal/printer/printer.go +++ b/internal/printer/printer.go @@ -844,7 +844,7 @@ func (p *Printer) shouldAllowTrailingComma(node *ast.Node, list *ast.NodeList) b return false } - target := p.currentSourceFile.LanguageVersion + target := p.currentSourceFile.LanguageVersion() switch node.Kind { case ast.KindObjectLiteralExpression: return target >= core.ScriptTargetES5 diff --git a/internal/printer/printer_test.go b/internal/printer/printer_test.go index 2e4fdd46a1..90fb6e2f56 100644 --- a/internal/printer/printer_test.go +++ b/internal/printer/printer_test.go @@ -590,7 +590,7 @@ func TestParenthesizeDecorator(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewClassDeclaration( factory.NewModifierList( @@ -623,7 +623,7 @@ func TestParenthesizeComputedPropertyName(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewClassDeclaration( nil, /*modifiers*/ @@ -660,7 +660,7 @@ func TestParenthesizeArrayLiteral(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewArrayLiteralExpression( @@ -690,7 +690,7 @@ func TestParenthesizePropertyAccess1(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewPropertyAccessExpression( @@ -718,7 +718,7 @@ func TestParenthesizePropertyAccess2(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewPropertyAccessExpression( @@ -745,7 +745,7 @@ func TestParenthesizePropertyAccess3(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewPropertyAccessExpression( @@ -771,7 +771,7 @@ func TestParenthesizeElementAccess1(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewElementAccessExpression( @@ -799,7 +799,7 @@ func TestParenthesizeElementAccess2(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewElementAccessExpression( @@ -826,7 +826,7 @@ func TestParenthesizeElementAccess3(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewElementAccessExpression( @@ -852,7 +852,7 @@ func TestParenthesizeCall1(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewCallExpression( @@ -881,7 +881,7 @@ func TestParenthesizeCall2(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewCallExpression( @@ -909,7 +909,7 @@ func TestParenthesizeCall3(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewCallExpression( @@ -936,7 +936,7 @@ func TestParenthesizeCall4(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewCallExpression( @@ -966,7 +966,7 @@ func TestParenthesizeNew1(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewNewExpression( @@ -993,7 +993,7 @@ func TestParenthesizeNew2(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewNewExpression( @@ -1020,7 +1020,7 @@ func TestParenthesizeNew3(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewNewExpression( @@ -1048,7 +1048,7 @@ func TestParenthesizeTaggedTemplate1(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewTaggedTemplateExpression( @@ -1077,7 +1077,7 @@ func TestParenthesizeTaggedTemplate2(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewTaggedTemplateExpression( @@ -1105,7 +1105,7 @@ func TestParenthesizeTypeAssertion1(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewTypeAssertion( @@ -1134,7 +1134,7 @@ func TestParenthesizeArrowFunction1(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewArrowFunction( @@ -1161,7 +1161,7 @@ func TestParenthesizeArrowFunction2(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewArrowFunction( @@ -1193,7 +1193,7 @@ func TestParenthesizeDelete(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewDeleteExpression( @@ -1218,7 +1218,7 @@ func TestParenthesizeVoid(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewVoidExpression( @@ -1243,7 +1243,7 @@ func TestParenthesizeTypeOf(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewTypeOfExpression( @@ -1268,7 +1268,7 @@ func TestParenthesizeAwait(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewAwaitExpression( @@ -1394,7 +1394,7 @@ func TestParenthesizeBinary(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewBinaryExpression( @@ -1418,7 +1418,7 @@ func TestParenthesizeConditional1(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewConditionalExpression( @@ -1447,7 +1447,7 @@ func TestParenthesizeConditional2(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewConditionalExpression( @@ -1476,7 +1476,7 @@ func TestParenthesizeConditional3(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewConditionalExpression( @@ -1509,7 +1509,7 @@ func TestParenthesizeConditional4(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewConditionalExpression( @@ -1532,7 +1532,7 @@ func TestParenthesizeConditional5(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewConditionalExpression( @@ -1561,7 +1561,7 @@ func TestParenthesizeConditional6(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewConditionalExpression( @@ -1590,7 +1590,7 @@ func TestParenthesizeYield1(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewYieldExpression( @@ -1620,7 +1620,7 @@ func TestParenthesizeSpreadElement1(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewArrayLiteralExpression( @@ -1652,7 +1652,7 @@ func TestParenthesizeSpreadElement2(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewCallExpression( @@ -1687,7 +1687,7 @@ func TestParenthesizeSpreadElement3(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewNewExpression( @@ -1720,7 +1720,7 @@ func TestParenthesizeExpressionWithTypeArguments(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewExpressionWithTypeArguments( @@ -1753,7 +1753,7 @@ func TestParenthesizeAsExpression(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewAsExpression( @@ -1782,7 +1782,7 @@ func TestParenthesizeSatisfiesExpression(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewSatisfiesExpression( @@ -1811,7 +1811,7 @@ func TestParenthesizeNonNullExpression(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewNonNullExpression( @@ -1837,7 +1837,7 @@ func TestParenthesizeExpressionStatement1(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewObjectLiteralExpression( @@ -1858,7 +1858,7 @@ func TestParenthesizeExpressionStatement2(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewFunctionExpression( @@ -1887,7 +1887,7 @@ func TestParenthesizeExpressionStatement3(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExpressionStatement( factory.NewClassExpression( @@ -1911,7 +1911,7 @@ func TestParenthesizeExpressionDefault1(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExportAssignment( nil, /*modifiers*/ @@ -1939,7 +1939,7 @@ func TestParenthesizeExpressionDefault2(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExportAssignment( nil, /*modifiers*/ @@ -1974,7 +1974,7 @@ func TestParenthesizeExpressionDefault3(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewExportAssignment( nil, /*modifiers*/ @@ -2000,7 +2000,7 @@ func TestParenthesizeArrayType(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewTypeAliasDeclaration( nil, /*modifiers*/ @@ -2029,7 +2029,7 @@ func TestParenthesizeOptionalType(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewTypeAliasDeclaration( nil, /*modifiers*/ @@ -2064,7 +2064,7 @@ func TestParenthesizeUnionType1(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewTypeAliasDeclaration( nil, /*modifiers*/ @@ -2097,7 +2097,7 @@ func TestParenthesizeUnionType2(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewTypeAliasDeclaration( nil, /*modifiers*/ @@ -2131,7 +2131,7 @@ func TestParenthesizeIntersectionType(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewTypeAliasDeclaration( nil, /*modifiers*/ @@ -2165,7 +2165,7 @@ func TestParenthesizeReadonlyTypeOperator1(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewTypeAliasDeclaration( nil, /*modifiers*/ @@ -2195,7 +2195,7 @@ func TestParenthesizeReadonlyTypeOperator2(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewTypeAliasDeclaration( nil, /*modifiers*/ @@ -2221,7 +2221,7 @@ func TestParenthesizeKeyofTypeOperator(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewTypeAliasDeclaration( nil, /*modifiers*/ @@ -2251,7 +2251,7 @@ func TestParenthesizeIndexedAccessType(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewTypeAliasDeclaration( nil, /*modifiers*/ @@ -2281,7 +2281,7 @@ func TestParenthesizeConditionalType1(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewTypeAliasDeclaration( nil, /*modifiers*/ @@ -2312,7 +2312,7 @@ func TestParenthesizeConditionalType2(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewTypeAliasDeclaration( nil, /*modifiers*/ @@ -2342,7 +2342,7 @@ func TestParenthesizeConditionalType3(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList( + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList( []*ast.Node{ factory.NewTypeAliasDeclaration( nil, /*modifiers*/ @@ -2380,7 +2380,7 @@ func TestParenthesizeConditionalType4(t *testing.T) { t.Parallel() var factory ast.NodeFactory - file := factory.NewSourceFile("", "/file.ts", "/file.ts", factory.NewNodeList([]*ast.Node{ + file := factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", factory.NewNodeList([]*ast.Node{ factory.NewTypeAliasDeclaration( nil, /*modifiers*/ factory.NewIdentifier("_"), /*name*/ @@ -2422,7 +2422,7 @@ func TestParenthesizeConditionalType4(t *testing.T) { func TestNameGeneration(t *testing.T) { t.Parallel() ec := printer.NewEmitContext() - file := ec.Factory.NewSourceFile("", "/file.ts", "/file.ts", ec.Factory.NewNodeList([]*ast.Node{ + file := ec.Factory.NewSourceFile(ast.SourceFileParseOptions{FileName: "/file.ts", Path: "/file.ts"}, "", ec.Factory.NewNodeList([]*ast.Node{ ec.Factory.NewVariableStatement(nil, ec.Factory.NewVariableDeclarationList( ast.NodeFlagsNone, ec.Factory.NewNodeList([]*ast.Node{ diff --git a/internal/project/documentregistry.go b/internal/project/documentregistry.go index dc497f320d..add8801864 100644 --- a/internal/project/documentregistry.go +++ b/internal/project/documentregistry.go @@ -7,23 +7,18 @@ import ( "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/parser" - "github.com/microsoft/typescript-go/internal/scanner" "github.com/microsoft/typescript-go/internal/tspath" ) type registryKey struct { - core.SourceFileAffectingCompilerOptions - ast.SourceFileMetaData - path tspath.Path + ast.SourceFileParseOptions scriptKind core.ScriptKind } -func newRegistryKey(options *core.CompilerOptions, path tspath.Path, scriptKind core.ScriptKind, metadata *ast.SourceFileMetaData) registryKey { +func newRegistryKey(opts ast.SourceFileParseOptions, scriptKind core.ScriptKind) registryKey { return registryKey{ - SourceFileAffectingCompilerOptions: *options.SourceFileAffecting(), - SourceFileMetaData: *metadata, - path: path, - scriptKind: scriptKind, + SourceFileParseOptions: opts, + scriptKind: scriptKind, } } @@ -58,18 +53,17 @@ type DocumentRegistry struct { // LanguageService instance over time, as well as across multiple instances. Here, we still // reuse files across multiple LanguageServices, but we only reuse them across Program updates // when the files haven't changed. -func (r *DocumentRegistry) AcquireDocument(scriptInfo *ScriptInfo, compilerOptions *core.CompilerOptions, metadata *ast.SourceFileMetaData, oldSourceFile *ast.SourceFile, oldCompilerOptions *core.CompilerOptions, oldMetadata *ast.SourceFileMetaData) *ast.SourceFile { - key := newRegistryKey(compilerOptions, scriptInfo.path, scriptInfo.scriptKind, metadata) - document := r.getDocumentWorker(scriptInfo, compilerOptions, metadata, key) - if oldSourceFile != nil && oldCompilerOptions != nil { - oldKey := newRegistryKey(oldCompilerOptions, scriptInfo.path, oldSourceFile.ScriptKind, oldMetadata) - r.releaseDocumentWithKey(oldKey) +func (r *DocumentRegistry) AcquireDocument(scriptInfo *ScriptInfo, opts ast.SourceFileParseOptions, oldSourceFile *ast.SourceFile) *ast.SourceFile { + key := newRegistryKey(opts, scriptInfo.scriptKind) + document := r.getDocumentWorker(scriptInfo, key) + if oldSourceFile != nil { + r.releaseDocumentWithKey(key) } return document } -func (r *DocumentRegistry) ReleaseDocument(file *ast.SourceFile, compilerOptions *core.CompilerOptions, metadata *ast.SourceFileMetaData) { - key := newRegistryKey(compilerOptions, file.Path(), file.ScriptKind, metadata) +func (r *DocumentRegistry) ReleaseDocument(file *ast.SourceFile) { + key := newRegistryKey(file.ParseOptions(), file.ScriptKind) r.releaseDocumentWithKey(key) } @@ -87,20 +81,14 @@ func (r *DocumentRegistry) releaseDocumentWithKey(key registryKey) { } } -func (r *DocumentRegistry) getDocumentWorker( - scriptInfo *ScriptInfo, - compilerOptions *core.CompilerOptions, - metadata *ast.SourceFileMetaData, - key registryKey, -) *ast.SourceFile { - scriptTarget := core.IfElse(scriptInfo.scriptKind == core.ScriptKindJSON, core.ScriptTargetJSON, compilerOptions.GetEmitScriptTarget()) +func (r *DocumentRegistry) getDocumentWorker(scriptInfo *ScriptInfo, key registryKey) *ast.SourceFile { scriptInfoVersion := scriptInfo.Version() scriptInfoText := scriptInfo.Text() if entry, ok := r.documents.Load(key); ok { // We have an entry for this file. However, it may be for a different version of // the script snapshot. If so, update it appropriately. if entry.version != scriptInfoVersion { - sourceFile := r.getParsedFile(scriptInfo.fileName, scriptInfo.path, scriptInfoText, scriptTarget, compilerOptions, metadata) + sourceFile := r.getParsedFile(key.SourceFileParseOptions, scriptInfoText, key.scriptKind) entry.mu.Lock() defer entry.mu.Unlock() entry.sourceFile = sourceFile @@ -110,7 +98,7 @@ func (r *DocumentRegistry) getDocumentWorker( return entry.sourceFile } else { // Have never seen this file with these settings. Create a new source file for it. - sourceFile := r.getParsedFile(scriptInfo.fileName, scriptInfo.path, scriptInfoText, scriptTarget, compilerOptions, metadata) + sourceFile := r.getParsedFile(key.SourceFileParseOptions, scriptInfoText, key.scriptKind) entry, _ := r.documents.LoadOrStore(key, ®istryEntry{ sourceFile: sourceFile, refCount: 0, @@ -123,30 +111,23 @@ func (r *DocumentRegistry) getDocumentWorker( } } -func (r *DocumentRegistry) getFileVersion(file *ast.SourceFile, options *core.CompilerOptions, metadata *ast.SourceFileMetaData) int { - key := newRegistryKey(options, file.Path(), file.ScriptKind, metadata) +func (r *DocumentRegistry) getFileVersion(file *ast.SourceFile) int { + key := newRegistryKey(file.ParseOptions(), file.ScriptKind) if entry, ok := r.documents.Load(key); ok && entry.sourceFile == file { return entry.version } return -1 } -func (r *DocumentRegistry) getParsedFile( - fileName string, - path tspath.Path, - sourceText string, - scriptTarget core.ScriptTarget, - options *core.CompilerOptions, - metadata *ast.SourceFileMetaData, -) *ast.SourceFile { +func (r *DocumentRegistry) getParsedFile(opts ast.SourceFileParseOptions, text string, scriptKind core.ScriptKind) *ast.SourceFile { if r.parsedFileCache != nil { - if file := r.parsedFileCache.GetFile(fileName, path, sourceText, options.SourceFileAffecting(), metadata); file != nil { + if file := r.parsedFileCache.GetFile(opts, text, scriptKind); file != nil { return file } } - file := parser.ParseSourceFile(fileName, path, sourceText, options.SourceFileAffecting(), metadata, scanner.JSDocParsingModeParseAll) + file := parser.ParseSourceFile(opts, text, scriptKind) if r.parsedFileCache != nil { - r.parsedFileCache.CacheFile(fileName, path, sourceText, options.SourceFileAffecting(), metadata, file) + r.parsedFileCache.CacheFile(opts, text, scriptKind, file) } return file } @@ -157,19 +138,6 @@ func (r *DocumentRegistry) size() int { } type ParsedFileCache interface { - GetFile( - fileName string, - path tspath.Path, - text string, - options *core.SourceFileAffectingCompilerOptions, - metadata *ast.SourceFileMetaData, - ) *ast.SourceFile - CacheFile( - fileName string, - path tspath.Path, - text string, - options *core.SourceFileAffectingCompilerOptions, - metadata *ast.SourceFileMetaData, - sourceFile *ast.SourceFile, - ) + GetFile(opts ast.SourceFileParseOptions, text string, scriptKind core.ScriptKind) *ast.SourceFile + CacheFile(opts ast.SourceFileParseOptions, text string, scriptKind core.ScriptKind, sourceFile *ast.SourceFile) } diff --git a/internal/project/project.go b/internal/project/project.go index 4680e75279..3ed15c5096 100644 --- a/internal/project/project.go +++ b/internal/project/project.go @@ -48,7 +48,7 @@ type snapshot struct { func (s *snapshot) GetLineMap(fileName string) *ls.LineMap { file := s.program.GetSourceFile(fileName) scriptInfo := s.project.host.GetScriptInfoByPath(file.Path()) - if s.project.getFileVersion(file, s.program.Options(), s.program.GetSourceFileMetaData(file.Path())) == scriptInfo.Version() { + if s.project.getFileVersion(file) == scriptInfo.Version() { return scriptInfo.LineMap() } return ls.ComputeLineStarts(file.Text()) @@ -273,20 +273,14 @@ func (p *Project) GetCompilerOptions() *core.CompilerOptions { } // GetSourceFile implements compiler.CompilerHost. -func (p *Project) GetSourceFile(fileName string, path tspath.Path, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData) *ast.SourceFile { - scriptKind := p.getScriptKind(fileName) - if scriptInfo := p.getOrCreateScriptInfoAndAttachToProject(fileName, scriptKind); scriptInfo != nil { - var ( - oldSourceFile *ast.SourceFile - oldCompilerOptions *core.CompilerOptions - oldMetadata *ast.SourceFileMetaData - ) +func (p *Project) GetSourceFile(opts ast.SourceFileParseOptions) *ast.SourceFile { + scriptKind := p.getScriptKind(opts.FileName) + if scriptInfo := p.getOrCreateScriptInfoAndAttachToProject(opts.FileName, scriptKind); scriptInfo != nil { + var oldSourceFile *ast.SourceFile if p.program != nil { oldSourceFile = p.program.GetSourceFileByPath(scriptInfo.path) - oldCompilerOptions = p.program.Options() - oldMetadata = p.program.GetSourceFileMetaData(scriptInfo.path) } - return p.host.DocumentRegistry().AcquireDocument(scriptInfo, p.compilerOptions, metadata, oldSourceFile, oldCompilerOptions, oldMetadata) + return p.host.DocumentRegistry().AcquireDocument(scriptInfo, opts, oldSourceFile) } return nil } @@ -525,7 +519,7 @@ func (p *Project) updateGraph() (*compiler.Program, bool) { if oldProgram != nil { for _, oldSourceFile := range oldProgram.GetSourceFiles() { if p.program.GetSourceFileByPath(oldSourceFile.Path()) == nil { - p.host.DocumentRegistry().ReleaseDocument(oldSourceFile, oldProgram.Options(), oldProgram.GetSourceFileMetaData(oldSourceFile.Path())) + p.host.DocumentRegistry().ReleaseDocument(oldSourceFile) p.detachScriptInfoIfNotInferredRoot(oldSourceFile.Path()) } } @@ -591,6 +585,7 @@ func (p *Project) updateProgram() bool { p.checkerPool = newCheckerPool(4, program, p.Log) return p.checkerPool }, + JSDocParsingMode: ast.JSDocParsingModeParseAll, }) } else { // The only change in the current program is the contents of the file named by p.dirtyFilePath. @@ -1005,13 +1000,12 @@ func (p *Project) print(writeFileNames bool, writeFileExplanation bool, writeFil builder.WriteString("\n\tFiles (0) NoProgram\n") } else { sourceFiles := p.program.GetSourceFiles() - options := p.program.Options() builder.WriteString(fmt.Sprintf("\n\tFiles (%d)\n", len(sourceFiles))) if writeFileNames { for _, sourceFile := range sourceFiles { builder.WriteString("\n\t\t" + sourceFile.FileName()) if writeFileVersionAndText { - builder.WriteString(fmt.Sprintf(" %d %s", p.getFileVersion(sourceFile, options, p.program.GetSourceFileMetaData(sourceFile.Path())), sourceFile.Text())) + builder.WriteString(fmt.Sprintf(" %d %s", p.getFileVersion(sourceFile), sourceFile.Text())) } } // !!! @@ -1022,8 +1016,8 @@ func (p *Project) print(writeFileNames bool, writeFileExplanation bool, writeFil return builder.String() } -func (p *Project) getFileVersion(file *ast.SourceFile, options *core.CompilerOptions, metadata *ast.SourceFileMetaData) int { - return p.host.DocumentRegistry().getFileVersion(file, options, metadata) +func (p *Project) getFileVersion(file *ast.SourceFile) int { + return p.host.DocumentRegistry().getFileVersion(file) } func (p *Project) Log(s string) { @@ -1049,7 +1043,7 @@ func (p *Project) Close() { if p.program != nil { for _, sourceFile := range p.program.GetSourceFiles() { - p.host.DocumentRegistry().ReleaseDocument(sourceFile, p.program.Options(), p.program.GetSourceFileMetaData(sourceFile.Path())) + p.host.DocumentRegistry().ReleaseDocument(sourceFile) // Detach script info if its not root or is root of non inferred project p.detachScriptInfoIfNotInferredRoot(sourceFile.Path()) } diff --git a/internal/scanner/scanner.go b/internal/scanner/scanner.go index 69df81e277..5ca20bacfa 100644 --- a/internal/scanner/scanner.go +++ b/internal/scanner/scanner.go @@ -195,15 +195,6 @@ var ( unicodeESNextIdentifierPart = []rune{48, 57, 65, 90, 95, 95, 97, 122, 170, 170, 181, 181, 183, 183, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 895, 895, 902, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1519, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2045, 2045, 2048, 2093, 2112, 2139, 2144, 2154, 2160, 2183, 2185, 2190, 2200, 2273, 2275, 2403, 2406, 2415, 2417, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2556, 2556, 2558, 2558, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2809, 2815, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2901, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3072, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3132, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3162, 3165, 3165, 3168, 3171, 3174, 3183, 3200, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3293, 3294, 3296, 3299, 3302, 3311, 3313, 3315, 3328, 3340, 3342, 3344, 3346, 3396, 3398, 3400, 3402, 3406, 3412, 3415, 3423, 3427, 3430, 3439, 3450, 3455, 3457, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3558, 3567, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3773, 3776, 3780, 3782, 3782, 3784, 3790, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4969, 4977, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5909, 5919, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6159, 6169, 6176, 6264, 6272, 6314, 6320, 6389, 6400, 6430, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6618, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6832, 6845, 6847, 6862, 6912, 6988, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7376, 7378, 7380, 7418, 7424, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12447, 12449, 12543, 12549, 12591, 12593, 12686, 12704, 12735, 12784, 12799, 13312, 19903, 19968, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42737, 42775, 42783, 42786, 42888, 42891, 42954, 42960, 42961, 42963, 42963, 42965, 42969, 42994, 43047, 43052, 43052, 43072, 43123, 43136, 43205, 43216, 43225, 43232, 43255, 43259, 43259, 43261, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43488, 43518, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43881, 43888, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65071, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66045, 66045, 66176, 66204, 66208, 66256, 66272, 66272, 66304, 66335, 66349, 66378, 66384, 66426, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66720, 66729, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 66928, 66938, 66940, 66954, 66956, 66962, 66964, 66965, 66967, 66977, 66979, 66993, 66995, 67001, 67003, 67004, 67072, 67382, 67392, 67413, 67424, 67431, 67456, 67461, 67463, 67504, 67506, 67514, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68099, 68101, 68102, 68108, 68115, 68117, 68119, 68121, 68149, 68152, 68154, 68159, 68159, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68326, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68903, 68912, 68921, 69248, 69289, 69291, 69292, 69296, 69297, 69373, 69404, 69415, 69415, 69424, 69456, 69488, 69509, 69552, 69572, 69600, 69622, 69632, 69702, 69734, 69749, 69759, 69818, 69826, 69826, 69840, 69864, 69872, 69881, 69888, 69940, 69942, 69951, 69956, 69959, 69968, 70003, 70006, 70006, 70016, 70084, 70089, 70092, 70094, 70106, 70108, 70108, 70144, 70161, 70163, 70199, 70206, 70209, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70378, 70384, 70393, 70400, 70403, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70459, 70468, 70471, 70472, 70475, 70477, 70480, 70480, 70487, 70487, 70493, 70499, 70502, 70508, 70512, 70516, 70656, 70730, 70736, 70745, 70750, 70753, 70784, 70853, 70855, 70855, 70864, 70873, 71040, 71093, 71096, 71104, 71128, 71133, 71168, 71232, 71236, 71236, 71248, 71257, 71296, 71352, 71360, 71369, 71424, 71450, 71453, 71467, 71472, 71481, 71488, 71494, 71680, 71738, 71840, 71913, 71935, 71942, 71945, 71945, 71948, 71955, 71957, 71958, 71960, 71989, 71991, 71992, 71995, 72003, 72016, 72025, 72096, 72103, 72106, 72151, 72154, 72161, 72163, 72164, 72192, 72254, 72263, 72263, 72272, 72345, 72349, 72349, 72368, 72440, 72704, 72712, 72714, 72758, 72760, 72768, 72784, 72793, 72818, 72847, 72850, 72871, 72873, 72886, 72960, 72966, 72968, 72969, 72971, 73014, 73018, 73018, 73020, 73021, 73023, 73031, 73040, 73049, 73056, 73061, 73063, 73064, 73066, 73102, 73104, 73105, 73107, 73112, 73120, 73129, 73440, 73462, 73472, 73488, 73490, 73530, 73534, 73538, 73552, 73561, 73648, 73648, 73728, 74649, 74752, 74862, 74880, 75075, 77712, 77808, 77824, 78895, 78912, 78933, 82944, 83526, 92160, 92728, 92736, 92766, 92768, 92777, 92784, 92862, 92864, 92873, 92880, 92909, 92912, 92916, 92928, 92982, 92992, 92995, 93008, 93017, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94031, 94087, 94095, 94111, 94176, 94177, 94179, 94180, 94192, 94193, 94208, 100343, 100352, 101589, 101632, 101640, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 113821, 113822, 118528, 118573, 118576, 118598, 119141, 119145, 119149, 119154, 119163, 119170, 119173, 119179, 119210, 119213, 119362, 119364, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 120782, 120831, 121344, 121398, 121403, 121452, 121461, 121461, 121476, 121476, 121499, 121503, 121505, 121519, 122624, 122654, 122661, 122666, 122880, 122886, 122888, 122904, 122907, 122913, 122915, 122916, 122918, 122922, 122928, 122989, 123023, 123023, 123136, 123180, 123184, 123197, 123200, 123209, 123214, 123214, 123536, 123566, 123584, 123641, 124112, 124153, 124896, 124902, 124904, 124907, 124909, 124910, 124912, 124926, 124928, 125124, 125136, 125142, 125184, 125259, 125264, 125273, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 130032, 130041, 131072, 173791, 173824, 177977, 177984, 178205, 178208, 183969, 183984, 191456, 191472, 192093, 194560, 195101, 196608, 201546, 201552, 205743, 917760, 917999} ) -type JSDocParsingMode int - -const ( - JSDocParsingModeParseAll JSDocParsingMode = iota - JSDocParsingModeParseNone - JSDocParsingModeParseForTypeErrors - JSDocParsingModeParseForTypeInfo -) - type ScannerState struct { pos int // Current position in text (and ending position of current token) fullStartPos int // Starting position of current token including preceding whitespace @@ -222,7 +213,7 @@ type Scanner struct { languageVariant core.LanguageVariant onError ErrorCallback skipTrivia bool - JSDocParsingMode JSDocParsingMode + JSDocParsingMode ast.JSDocParsingMode scriptKind core.ScriptKind ScannerState } @@ -356,7 +347,7 @@ func (s *Scanner) SetScriptKind(scriptKind core.ScriptKind) { s.scriptKind = scriptKind } -func (s *Scanner) SetJSDocParsingMode(kind JSDocParsingMode) { +func (s *Scanner) SetJSDocParsingMode(kind ast.JSDocParsingMode) { s.JSDocParsingMode = kind } @@ -398,16 +389,16 @@ func (s *Scanner) charAndSize() (rune, int) { func (s *Scanner) shouldParseJSDoc() bool { switch s.JSDocParsingMode { - case JSDocParsingModeParseAll: + case ast.JSDocParsingModeParseAll: return true - case JSDocParsingModeParseNone: + case ast.JSDocParsingModeParseNone: return false } if s.scriptKind != core.ScriptKindTS && s.scriptKind != core.ScriptKindTSX { // If outside of TS, we need JSDoc to get any type info. return true } - if s.JSDocParsingMode == JSDocParsingModeParseForTypeInfo { + if s.JSDocParsingMode == ast.JSDocParsingModeParseForTypeInfo { // If we're in TS, but we don't need to produce reliable errors, // we don't need to parse to find @see or @link. return false @@ -2246,7 +2237,7 @@ func GetScannerForSourceFile(sourceFile *ast.SourceFile, pos int) *Scanner { s := NewScanner() s.text = sourceFile.Text() s.pos = pos - s.languageVersion = sourceFile.LanguageVersion + s.languageVersion = sourceFile.LanguageVersion() s.languageVariant = sourceFile.LanguageVariant s.Scan() return s diff --git a/internal/testrunner/test_case_parser.go b/internal/testrunner/test_case_parser.go index 6984acc8c6..62fa71de79 100644 --- a/internal/testrunner/test_case_parser.go +++ b/internal/testrunner/test_case_parser.go @@ -5,6 +5,8 @@ import ( "slices" "strings" + "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/parser" "github.com/microsoft/typescript-go/internal/scanner" "github.com/microsoft/typescript-go/internal/testutil/harnessutil" @@ -72,7 +74,10 @@ func makeUnitsFromTest(code string, fileName string) testCaseContent { if harnessutil.GetConfigNameFromFileName(data.name) != "" { configFileName := tspath.GetNormalizedAbsolutePath(data.name, currentDirectory) path := tspath.ToPath(data.name, parseConfigHost.GetCurrentDirectory(), parseConfigHost.Vfs.UseCaseSensitiveFileNames()) - configJson := parser.ParseJSONText(configFileName, path, data.content) + configJson := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: configFileName, + Path: path, + }, data.content, core.ScriptKindJSON) tsConfigSourceFile := &tsoptions.TsConfigSourceFile{ SourceFile: configJson, } diff --git a/internal/testutil/harnessutil/harnessutil.go b/internal/testutil/harnessutil/harnessutil.go index f816bde694..acce099b89 100644 --- a/internal/testutil/harnessutil/harnessutil.go +++ b/internal/testutil/harnessutil/harnessutil.go @@ -23,7 +23,6 @@ import ( "github.com/microsoft/typescript-go/internal/outputpaths" "github.com/microsoft/typescript-go/internal/parser" "github.com/microsoft/typescript-go/internal/repo" - "github.com/microsoft/typescript-go/internal/scanner" "github.com/microsoft/typescript-go/internal/sourcemap" "github.com/microsoft/typescript-go/internal/testutil" "github.com/microsoft/typescript-go/internal/tsoptions" @@ -467,62 +466,42 @@ func getOptionValue(t *testing.T, option *tsoptions.CommandLineOption, value str type cachedCompilerHost struct { compiler.CompilerHost - options *core.CompilerOptions } var sourceFileCache collections.SyncMap[SourceFileCacheKey, *ast.SourceFile] type SourceFileCacheKey struct { - core.SourceFileAffectingCompilerOptions - ast.SourceFileMetaData - fileName string - path tspath.Path - text string + opts ast.SourceFileParseOptions + text string + scriptKind core.ScriptKind } -func GetSourceFileCacheKey( - fileName string, - path tspath.Path, - text string, - options *core.SourceFileAffectingCompilerOptions, - metadata *ast.SourceFileMetaData, -) SourceFileCacheKey { +func GetSourceFileCacheKey(opts ast.SourceFileParseOptions, text string, scriptKind core.ScriptKind) SourceFileCacheKey { return SourceFileCacheKey{ - SourceFileAffectingCompilerOptions: *options, - SourceFileMetaData: *metadata, - fileName: fileName, - path: path, - text: text, + opts: opts, + text: text, + scriptKind: scriptKind, } } -func (h *cachedCompilerHost) GetSourceFile(fileName string, path tspath.Path, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData) *ast.SourceFile { - text, ok := h.FS().ReadFile(fileName) +func (h *cachedCompilerHost) GetSourceFile(opts ast.SourceFileParseOptions) *ast.SourceFile { + text, ok := h.FS().ReadFile(opts.FileName) if !ok { return nil } - key := GetSourceFileCacheKey( - fileName, - path, - text, - h.options.SourceFileAffecting(), - metadata, - ) + scriptKind := core.GetScriptKindFromFileName(opts.FileName) + if scriptKind == core.ScriptKindUnknown { + panic("Unknown script kind for file " + opts.FileName) + } + + key := GetSourceFileCacheKey(opts, text, scriptKind) if cached, ok := sourceFileCache.Load(key); ok { return cached } - // !!! dedupe with compiler.compilerHost - var sourceFile *ast.SourceFile - if tspath.FileExtensionIs(fileName, tspath.ExtensionJson) { - sourceFile = parser.ParseJSONText(fileName, path, text) - } else { - // !!! JSDocParsingMode - sourceFile = parser.ParseSourceFile(fileName, path, text, options, metadata, scanner.JSDocParsingModeParseAll) - } - + sourceFile := parser.ParseSourceFile(opts, text, scriptKind) result, _ := sourceFileCache.LoadOrStore(key, sourceFile) return result } @@ -530,7 +509,6 @@ func (h *cachedCompilerHost) GetSourceFile(fileName string, path tspath.Path, op func createCompilerHost(fs vfs.FS, defaultLibraryPath string, options *core.CompilerOptions, currentDirectory string) compiler.CompilerHost { return &cachedCompilerHost{ CompilerHost: compiler.NewCompilerHost(options, currentDirectory, fs, defaultLibraryPath, nil), - options: options, } } diff --git a/internal/testutil/parsetestutil/parsetestutil.go b/internal/testutil/parsetestutil/parsetestutil.go index 76833960d0..73fbc556ce 100644 --- a/internal/testutil/parsetestutil/parsetestutil.go +++ b/internal/testutil/parsetestutil/parsetestutil.go @@ -8,18 +8,22 @@ import ( "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/diagnosticwriter" "github.com/microsoft/typescript-go/internal/parser" - "github.com/microsoft/typescript-go/internal/scanner" "github.com/microsoft/typescript-go/internal/tspath" ) -var parseCompilerOptions = &core.SourceFileAffectingCompilerOptions{ +var parseCompilerOptions = core.SourceFileAffectingCompilerOptions{ EmitScriptTarget: core.ScriptTargetLatest, } // Simplifies parsing an input string into a SourceFile for testing purposes. func ParseTypeScript(text string, jsx bool) *ast.SourceFile { fileName := core.IfElse(jsx, "/main.tsx", "/main.ts") - file := parser.ParseSourceFile(fileName, tspath.Path(fileName), text, parseCompilerOptions, nil, scanner.JSDocParsingModeParseNone) + file := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: fileName, + Path: tspath.Path(fileName), + CompilerOptions: parseCompilerOptions, + JSDocParsingMode: ast.JSDocParsingModeParseNone, + }, text, core.GetScriptKindFromFileName(fileName)) ast.SetParentInChildren(file.AsNode()) return file } diff --git a/internal/testutil/tsbaseline/js_emit_baseline.go b/internal/testutil/tsbaseline/js_emit_baseline.go index ea9d78be7a..5e29b07404 100644 --- a/internal/testutil/tsbaseline/js_emit_baseline.go +++ b/internal/testutil/tsbaseline/js_emit_baseline.go @@ -5,9 +5,9 @@ import ( "strings" "testing" + "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/parser" - "github.com/microsoft/typescript-go/internal/scanner" "github.com/microsoft/typescript-go/internal/testutil/baseline" "github.com/microsoft/typescript-go/internal/testutil/harnessutil" "github.com/microsoft/typescript-go/internal/tspath" @@ -61,14 +61,11 @@ func DoJSEmitBaseline( jsCode.WriteString("\r\n") } if len(result.Diagnostics) == 0 && strings.HasSuffix(file.UnitName, tspath.ExtensionJson) { - fileParseResult := parser.ParseSourceFile( - file.UnitName, - tspath.Path(file.UnitName), - file.Content, - options.SourceFileAffecting(), - nil, // TODO(jakebailey): need to grab this somehow? - scanner.JSDocParsingModeParseAll, - ) + fileParseResult := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: file.UnitName, + Path: tspath.Path(file.UnitName), + CompilerOptions: options.SourceFileAffecting(), + }, file.Content, core.ScriptKindJSON) if len(fileParseResult.Diagnostics()) > 0 { jsCode.WriteString(getErrorBaseline(t, []*harnessutil.TestFile{file}, fileParseResult.Diagnostics(), false /*pretty*/)) continue diff --git a/internal/transformers/commonjsmodule_test.go b/internal/transformers/commonjsmodule_test.go index 0fe35fe055..a62a3c4ff6 100644 --- a/internal/transformers/commonjsmodule_test.go +++ b/internal/transformers/commonjsmodule_test.go @@ -1031,17 +1031,16 @@ exports.a = a;`, } compilerOptions.Module = core.ModuleKindCommonJS - sourceFileAffecting := compilerOptions.SourceFileAffecting() file := parsetestutil.ParseTypeScript(rec.input, rec.jsx) parsetestutil.CheckDiagnostics(t, file) - binder.BindSourceFile(file, sourceFileAffecting) + binder.BindSourceFile(file) var other *ast.SourceFile if len(rec.other) > 0 { other = parsetestutil.ParseTypeScript(rec.other, rec.jsx) parsetestutil.CheckDiagnostics(t, other) - binder.BindSourceFile(other, sourceFileAffecting) + binder.BindSourceFile(other) } emitContext := printer.NewEmitContext() diff --git a/internal/transformers/esmodule_test.go b/internal/transformers/esmodule_test.go index 94e592978d..7c7c38b58f 100644 --- a/internal/transformers/esmodule_test.go +++ b/internal/transformers/esmodule_test.go @@ -224,16 +224,15 @@ var __rewriteRelativeImportExtension;`, compilerOptions = &core.CompilerOptions{} } - sourceFileAffecting := compilerOptions.SourceFileAffecting() file := parsetestutil.ParseTypeScript(rec.input, rec.jsx) parsetestutil.CheckDiagnostics(t, file) - binder.BindSourceFile(file, sourceFileAffecting) + binder.BindSourceFile(file) var other *ast.SourceFile if len(rec.other) > 0 { other = parsetestutil.ParseTypeScript(rec.other, rec.jsx) parsetestutil.CheckDiagnostics(t, other) - binder.BindSourceFile(other, sourceFileAffecting) + binder.BindSourceFile(other) } emitContext := printer.NewEmitContext() diff --git a/internal/transformers/importelision_test.go b/internal/transformers/importelision_test.go index 5bfc261266..c46aa9e037 100644 --- a/internal/transformers/importelision_test.go +++ b/internal/transformers/importelision_test.go @@ -104,7 +104,7 @@ func (p *fakeProgram) BindSourceFiles() { for _, file := range p.files { if !file.IsBound() { wg.Queue(func() { - binder.BindSourceFile(file, p.compilerOptions.SourceFileAffecting()) + binder.BindSourceFile(file) }) } } @@ -139,8 +139,8 @@ func (p *fakeProgram) GetSourceFileForResolvedModule(FileName string) *ast.Sourc return p.getSourceFileForResolvedModule(FileName) } -func (p *fakeProgram) GetSourceFileMetaData(path tspath.Path) *ast.SourceFileMetaData { - return nil +func (p *fakeProgram) GetSourceFileMetaData(path tspath.Path) ast.SourceFileMetaData { + return ast.SourceFileMetaData{} } func (p *fakeProgram) GetImportHelpersImportSpecifier(path tspath.Path) *ast.Node { diff --git a/internal/transformers/runtimesyntax_test.go b/internal/transformers/runtimesyntax_test.go index f102b5aec5..617d3bbb21 100644 --- a/internal/transformers/runtimesyntax_test.go +++ b/internal/transformers/runtimesyntax_test.go @@ -233,7 +233,7 @@ var E; options := &core.CompilerOptions{} file := parsetestutil.ParseTypeScript(rec.input, false /*jsx*/) parsetestutil.CheckDiagnostics(t, file) - binder.BindSourceFile(file, options.SourceFileAffecting()) + binder.BindSourceFile(file) emitContext := printer.NewEmitContext() resolver := binder.NewReferenceResolver(options, binder.ReferenceResolverHooks{}) emittestutil.CheckEmit(t, emitContext, NewRuntimeSyntaxTransformer(emitContext, options, resolver).TransformSourceFile(file), rec.output) @@ -411,7 +411,7 @@ func TestNamespaceTransformer(t *testing.T) { options := &core.CompilerOptions{} file := parsetestutil.ParseTypeScript(rec.input, false /*jsx*/) parsetestutil.CheckDiagnostics(t, file) - binder.BindSourceFile(file, options.SourceFileAffecting()) + binder.BindSourceFile(file) emitContext := printer.NewEmitContext() resolver := binder.NewReferenceResolver(options, binder.ReferenceResolverHooks{}) emittestutil.CheckEmit(t, emitContext, NewRuntimeSyntaxTransformer(emitContext, options, resolver).TransformSourceFile(file), rec.output) @@ -447,7 +447,7 @@ func TestParameterPropertyTransformer(t *testing.T) { options := &core.CompilerOptions{} file := parsetestutil.ParseTypeScript(rec.input, false /*jsx*/) parsetestutil.CheckDiagnostics(t, file) - binder.BindSourceFile(file, options.SourceFileAffecting()) + binder.BindSourceFile(file) emitContext := printer.NewEmitContext() resolver := binder.NewReferenceResolver(options, binder.ReferenceResolverHooks{}) file = NewTypeEraserTransformer(emitContext, options).TransformSourceFile(file) diff --git a/internal/tsoptions/tsconfigparsing.go b/internal/tsoptions/tsconfigparsing.go index 9cb90e150f..3128fa3cbc 100644 --- a/internal/tsoptions/tsconfigparsing.go +++ b/internal/tsoptions/tsconfigparsing.go @@ -252,7 +252,10 @@ func tsconfigToSourceFile(tsconfigSourceFile *TsConfigSourceFile) *ast.SourceFil } func NewTsconfigSourceFileFromFilePath(configFileName string, configPath tspath.Path, configSourceText string) *TsConfigSourceFile { - sourceFile := parser.ParseJSONText(configFileName, configPath, configSourceText) + sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: configFileName, + Path: configPath, + }, configSourceText, core.ScriptKindJSON) return &TsConfigSourceFile{ SourceFile: sourceFile, } @@ -624,7 +627,10 @@ func directoryOfCombinedPath(fileName string, basePath string) string { // fileName is the path to the config file // jsonText is the text of the config file func ParseConfigFileTextToJson(fileName string, path tspath.Path, jsonText string) (any, []*ast.Diagnostic) { - jsonSourceFile := parser.ParseJSONText(fileName, path, jsonText) + jsonSourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: fileName, + Path: path, + }, jsonText, core.ScriptKindJSON) config, errors := convertConfigFileToObject(jsonSourceFile /*jsonConversionNotifier*/, nil) if len(jsonSourceFile.Diagnostics()) > 0 { errors = []*ast.Diagnostic{jsonSourceFile.Diagnostics()[0]} @@ -876,11 +882,14 @@ func readJsonConfigFile(fileName string, path tspath.Path, readFile func(fileNam text, diagnostic := tryReadFile(fileName, readFile, []*ast.Diagnostic{}) if text != "" { return &TsConfigSourceFile{ - SourceFile: parser.ParseJSONText(fileName, path, text), + SourceFile: parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: fileName, + Path: path, + }, text, core.ScriptKindJSON), }, diagnostic } else { file := &TsConfigSourceFile{ - SourceFile: (&ast.NodeFactory{}).NewSourceFile("", fileName, path, nil).AsSourceFile(), + SourceFile: (&ast.NodeFactory{}).NewSourceFile(ast.SourceFileParseOptions{FileName: fileName, Path: path}, "", nil).AsSourceFile(), } file.SourceFile.SetDiagnostics(diagnostic) return file, diagnostic diff --git a/internal/tsoptions/tsconfigparsing_test.go b/internal/tsoptions/tsconfigparsing_test.go index 36fcb9b6d0..071dca0942 100644 --- a/internal/tsoptions/tsconfigparsing_test.go +++ b/internal/tsoptions/tsconfigparsing_test.go @@ -11,6 +11,7 @@ import ( "testing" "github.com/google/go-cmp/cmp/cmpopts" + "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/diagnosticwriter" "github.com/microsoft/typescript-go/internal/parser" @@ -590,7 +591,10 @@ func TestParseJsonSourceFileConfigFileContent(t *testing.T) { func getParsedWithJsonSourceFileApi(config testConfig, host tsoptions.ParseConfigHost, basePath string) *tsoptions.ParsedCommandLine { configFileName := tspath.GetNormalizedAbsolutePath(config.configFileName, basePath) path := tspath.ToPath(config.configFileName, basePath, host.FS().UseCaseSensitiveFileNames()) - parsed := parser.ParseJSONText(configFileName, path, config.jsonText) + parsed := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: configFileName, + Path: path, + }, config.jsonText, core.ScriptKindJSON) tsConfigSourceFile := &tsoptions.TsConfigSourceFile{ SourceFile: parsed, } @@ -808,7 +812,10 @@ func TestParseSrcCompiler(t *testing.T) { jsonText, ok := fs.ReadFile(tsconfigFileName) assert.Assert(t, ok) tsconfigPath := tspath.ToPath(tsconfigFileName, compilerDir, fs.UseCaseSensitiveFileNames()) - parsed := parser.ParseJSONText(tsconfigFileName, tsconfigPath, jsonText) + parsed := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: tsconfigFileName, + Path: tsconfigPath, + }, jsonText, core.ScriptKindJSON) if len(parsed.Diagnostics()) > 0 { for _, error := range parsed.Diagnostics() { @@ -975,7 +982,10 @@ func BenchmarkParseSrcCompiler(b *testing.B) { jsonText, ok := fs.ReadFile(tsconfigFileName) assert.Assert(b, ok) tsconfigPath := tspath.ToPath(tsconfigFileName, compilerDir, fs.UseCaseSensitiveFileNames()) - parsed := parser.ParseJSONText(tsconfigFileName, tsconfigPath, jsonText) + parsed := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: tsconfigFileName, + Path: tsconfigPath, + }, jsonText, core.ScriptKindJSON) b.ReportAllocs() From 79b2727c6d394b2f02b9ea3dc36d9184a53c388a Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Tue, 17 Jun 2025 10:35:54 -0700 Subject: [PATCH 6/9] Remove NoFallthroughCasesInSwitch from SourceFileAffectingCompilerOptions (#1206) --- internal/binder/binder.go | 2 +- internal/core/compileroptions.go | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/internal/binder/binder.go b/internal/binder/binder.go index ce8e4defd8..2b24232767 100644 --- a/internal/binder/binder.go +++ b/internal/binder/binder.go @@ -2173,7 +2173,7 @@ func (b *Binder) bindCaseBlock(node *ast.Node) { clause := clauses[i] b.bind(clause) fallthroughFlow = b.currentFlow - if b.currentFlow.Flags&ast.FlowFlagsUnreachable == 0 && i != len(clauses)-1 && b.options().NoFallthroughCasesInSwitch == core.TSTrue { + if b.currentFlow.Flags&ast.FlowFlagsUnreachable == 0 && i != len(clauses)-1 { clause.AsCaseOrDefaultClause().FallthroughFlowNode = b.currentFlow } } diff --git a/internal/core/compileroptions.go b/internal/core/compileroptions.go index c7c84e3259..8b2db983c9 100644 --- a/internal/core/compileroptions.go +++ b/internal/core/compileroptions.go @@ -352,23 +352,21 @@ func (options *CompilerOptions) GetPathsBasePath(currentDirectory string) string // SourceFileAffectingCompilerOptions are the precomputed CompilerOptions values which // affect the parse and bind of a source file. type SourceFileAffectingCompilerOptions struct { - AllowUnreachableCode Tristate - AllowUnusedLabels Tristate - BindInStrictMode bool - EmitScriptTarget ScriptTarget - NoFallthroughCasesInSwitch Tristate - ShouldPreserveConstEnums bool + AllowUnreachableCode Tristate + AllowUnusedLabels Tristate + BindInStrictMode bool + EmitScriptTarget ScriptTarget + ShouldPreserveConstEnums bool } func (options *CompilerOptions) SourceFileAffecting() SourceFileAffectingCompilerOptions { options.sourceFileAffectingCompilerOptionsOnce.Do(func() { options.sourceFileAffectingCompilerOptions = SourceFileAffectingCompilerOptions{ - AllowUnreachableCode: options.AllowUnreachableCode, - AllowUnusedLabels: options.AllowUnusedLabels, - BindInStrictMode: options.AlwaysStrict.IsTrue() || options.Strict.IsTrue(), - EmitScriptTarget: options.GetEmitScriptTarget(), - NoFallthroughCasesInSwitch: options.NoFallthroughCasesInSwitch, - ShouldPreserveConstEnums: options.ShouldPreserveConstEnums(), + AllowUnreachableCode: options.AllowUnreachableCode, + AllowUnusedLabels: options.AllowUnusedLabels, + BindInStrictMode: options.AlwaysStrict.IsTrue() || options.Strict.IsTrue(), + EmitScriptTarget: options.GetEmitScriptTarget(), + ShouldPreserveConstEnums: options.ShouldPreserveConstEnums(), } }) return options.sourceFileAffectingCompilerOptions From 7c1f54eef17bcd4125a75cdbb98f165677b23ae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Tue, 17 Jun 2025 19:45:59 +0200 Subject: [PATCH 7/9] Assume clause-less imports to be unemittable (#1198) --- internal/ast/utilities.go | 2 +- .../allowImportingTypesDtsExtension2.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 testdata/tests/cases/conformance/moduleResolution/allowImportingTypesDtsExtension2.ts diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index ea3fef8edc..7b4c56611e 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -3106,7 +3106,7 @@ func IsPartOfExclusivelyTypeOnlyImportOrExportDeclaration(node *Node) bool { func IsEmittableImport(node *Node) bool { switch node.Kind { case KindImportDeclaration: - return node.AsImportDeclaration().ImportClause == nil || !node.AsImportDeclaration().ImportClause.IsTypeOnly() + return node.AsImportDeclaration().ImportClause != nil && !node.AsImportDeclaration().ImportClause.IsTypeOnly() case KindExportDeclaration: return !node.AsExportDeclaration().IsTypeOnly case KindImportEqualsDeclaration: diff --git a/testdata/tests/cases/conformance/moduleResolution/allowImportingTypesDtsExtension2.ts b/testdata/tests/cases/conformance/moduleResolution/allowImportingTypesDtsExtension2.ts new file mode 100644 index 0000000000..e316333480 --- /dev/null +++ b/testdata/tests/cases/conformance/moduleResolution/allowImportingTypesDtsExtension2.ts @@ -0,0 +1,13 @@ +// @strict: true +// @verbatimModuleSyntax: true,false +// @noUncheckedSideEffectImports: true,false +// @noEmit: true +// @noTypesAndSymbols: true + +// https://github.com/microsoft/typescript-go/issues/1190 + +// @filename: /types.d.ts +export type MyType = { foo: string; }; + +// @filename: /index.ts +import "./types.d.ts"; From ba0fb2963db1def8e21ecff0f20dc4e38402090e Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Tue, 17 Jun 2025 11:16:05 -0700 Subject: [PATCH 8/9] Implement maxNodeModuleJsDepth, noResolve (#1189) --- internal/ast/parseoptions.go | 8 +- internal/ast/utilities.go | 5 +- internal/compiler/fileloader.go | 150 ++++++--- internal/compiler/fileloadertask.go | 76 +++-- internal/compiler/parsetask.go | 38 ++- internal/compiler/program.go | 17 - .../compiler/projectreferenceparsetask.go | 19 +- .../allowJsCrossMonorepoPackage.errors.txt | 51 --- ...llowJsCrossMonorepoPackage.errors.txt.diff | 55 ---- .../allowJsCrossMonorepoPackage.symbols | 16 + .../allowJsCrossMonorepoPackage.symbols.diff | 22 -- .../allowJsCrossMonorepoPackage.types | 19 +- .../allowJsCrossMonorepoPackage.types.diff | 25 -- ...nmentDefineProperrtyPotentialMerge.symbols | 41 +++ ...DefineProperrtyPotentialMerge.symbols.diff | 68 ++-- ...ignmentDefineProperrtyPotentialMerge.types | 58 +++- .../jsEnumTagOnObjectFrozen.errors.txt | 50 +++ .../compiler/jsEnumTagOnObjectFrozen.symbols | 51 +++ .../jsEnumTagOnObjectFrozen.symbols.diff | 96 +++--- .../compiler/jsEnumTagOnObjectFrozen.types | 85 ++++- .../missingFunctionImplementation2.js | 4 +- .../missingFunctionImplementation2.js.diff | 14 - .../moduleAugmentationDisallowedExtensions.js | 14 +- ...leAugmentationDisallowedExtensions.js.diff | 30 -- ...opertyCheckFromContainedLiteral.errors.txt | 16 +- ...sPropertyCheckFromContainedLiteral.symbols | 63 ++++ ...ertyCheckFromContainedLiteral.symbols.diff | 83 ++--- ...essPropertyCheckFromContainedLiteral.types | 87 ++++- .../compiler/moduleResolutionNoResolve.js | 6 +- .../moduleResolutionNoResolve.js.diff | 17 - ...tionWithExtensions_notSupported.errors.txt | 4 +- ...ithExtensions_notSupported.errors.txt.diff | 4 +- ...leResolutionWithExtensions_notSupported.js | 1 - ...olutionWithExtensions_notSupported.js.diff | 10 - ...olutionWithExtensions_notSupported.symbols | 2 - ...onWithExtensions_notSupported.symbols.diff | 8 - ...esolutionWithExtensions_notSupported.types | 2 - ...tionWithExtensions_notSupported.types.diff | 8 - ...solution_explicitNodeModulesImport.symbols | 6 + ...ion_explicitNodeModulesImport.symbols.diff | 15 +- ...Resolution_explicitNodeModulesImport.types | 10 +- ...ution_explicitNodeModulesImport.types.diff | 16 - ...tImport_aliasWithRoot_realRootFile.symbols | 4 + ...rt_aliasWithRoot_realRootFile.symbols.diff | 10 - ...ootImport_aliasWithRoot_realRootFile.types | 6 +- ...port_aliasWithRoot_realRootFile.types.diff | 16 - ...mport_noAliasWithRoot_realRootFile.symbols | 4 + ..._noAliasWithRoot_realRootFile.symbols.diff | 10 - ...tImport_noAliasWithRoot_realRootFile.types | 6 +- ...rt_noAliasWithRoot_realRootFile.types.diff | 16 - .../requireOfJsonFileInJsFile.errors.txt | 12 +- .../requireOfJsonFileInJsFile.symbols | 8 + .../requireOfJsonFileInJsFile.symbols.diff | 27 +- .../compiler/requireOfJsonFileInJsFile.types | 16 +- .../chainedPrototypeAssignment.errors.txt | 11 +- .../chainedPrototypeAssignment.symbols | 49 +++ .../chainedPrototypeAssignment.symbols.diff | 78 ++--- .../chainedPrototypeAssignment.types | 79 ++++- ...heckExportsObjectAssignProperty.errors.txt | 50 ++- ...xportsObjectAssignProperty.errors.txt.diff | 75 ----- .../checkExportsObjectAssignProperty.symbols | 105 +++++++ ...ckExportsObjectAssignProperty.symbols.diff | 186 ++++++----- .../checkExportsObjectAssignProperty.types | 185 +++++++++++ ...tsObjectAssignPrototypeProperty.errors.txt | 11 +- ...portsObjectAssignPrototypeProperty.symbols | 83 +++++ ...ObjectAssignPrototypeProperty.symbols.diff | 139 ++++---- ...ExportsObjectAssignPrototypeProperty.types | 128 +++++++- ...tsObjectAssignPrototypeProperty.types.diff | 260 --------------- .../checkObjectDefineProperty.errors.txt | 56 +++- .../checkObjectDefineProperty.errors.txt.diff | 39 --- .../checkObjectDefineProperty.symbols | 122 ++++++++ .../checkObjectDefineProperty.symbols.diff | 192 ++++++------ .../checkObjectDefineProperty.types | 198 +++++++++++- .../checkObjectDefineProperty.types.diff | 290 ----------------- .../checkOtherObjectAssignProperty.errors.txt | 24 +- .../checkOtherObjectAssignProperty.symbols | 56 ++++ ...heckOtherObjectAssignProperty.symbols.diff | 96 +++--- .../checkOtherObjectAssignProperty.types | 90 ++++++ .../commonJSAliasedExport.errors.txt | 27 ++ .../conformance/commonJSAliasedExport.symbols | 25 ++ .../commonJSAliasedExport.symbols.diff | 44 +-- .../conformance/commonJSAliasedExport.types | 32 +- .../conformance/commonJSReexport.symbols | 29 ++ .../conformance/commonJSReexport.symbols.diff | 54 ++-- .../conformance/commonJSReexport.types | 45 ++- ...extensions=false,module=node18).errors.txt | 15 + ...sions=false,module=node18).errors.txt.diff | 24 +- ...aryextensions=false,module=node18).symbols | 7 - ...tensions=false,module=node18).symbols.diff | 14 - ...traryextensions=false,module=node18).types | 15 +- ...extensions=false,module=node18).types.diff | 24 -- ...tensions=false,module=nodenext).errors.txt | 15 + ...ons=false,module=nodenext).errors.txt.diff | 24 +- ...yextensions=false,module=nodenext).symbols | 7 - ...nsions=false,module=nodenext).symbols.diff | 14 - ...aryextensions=false,module=nodenext).types | 15 +- ...tensions=false,module=nodenext).types.diff | 24 -- ...DeclarationsClassExtendsVisibility.symbols | 11 + ...rationsClassExtendsVisibility.symbols.diff | 27 +- ...jsDeclarationsClassExtendsVisibility.types | 17 +- ...jsDeclarationsCommonjsRelativePath.symbols | 13 + ...larationsCommonjsRelativePath.symbols.diff | 26 +- .../jsDeclarationsCommonjsRelativePath.types | 35 ++- ...clarationsExportAssignedVisibility.symbols | 15 + ...tionsExportAssignedVisibility.symbols.diff | 32 +- ...DeclarationsExportAssignedVisibility.types | 32 +- ...jsDeclarationsExportedClassAliases.symbols | 25 ++ ...larationsExportedClassAliases.symbols.diff | 32 +- .../jsDeclarationsExportedClassAliases.types | 44 ++- ...tAliasExposedWithinNamespaceCjs.errors.txt | 22 +- ...portAliasExposedWithinNamespaceCjs.symbols | 29 ++ ...liasExposedWithinNamespaceCjs.symbols.diff | 50 ++- ...ImportAliasExposedWithinNamespaceCjs.types | 32 +- .../jsDeclarationsReexportedCjsAlias.symbols | 36 +++ ...eclarationsReexportedCjsAlias.symbols.diff | 59 ++-- .../jsDeclarationsReexportedCjsAlias.types | 58 +++- ...ferenceToClassInstanceCrossFile.errors.txt | 46 +++ ...sReferenceToClassInstanceCrossFile.symbols | 73 +++++ ...renceToClassInstanceCrossFile.symbols.diff | 123 ++++---- ...onsReferenceToClassInstanceCrossFile.types | 103 +++++- ...edefPropertyAndExportAssignment.errors.txt | 18 +- ...TypedefPropertyAndExportAssignment.symbols | 55 ++++ ...efPropertyAndExportAssignment.symbols.diff | 72 +---- ...nsTypedefPropertyAndExportAssignment.types | 68 +++- .../conformance/jsdocImportType.symbols | 23 ++ .../conformance/jsdocImportType.symbols.diff | 41 ++- .../conformance/jsdocImportType.types | 39 ++- .../conformance/jsdocImportType2.symbols | 21 ++ .../conformance/jsdocImportType2.symbols.diff | 41 +-- .../conformance/jsdocImportType2.types | 38 ++- ...jsdocTypeFromChainedAssignment2.errors.txt | 25 +- .../jsdocTypeFromChainedAssignment2.symbols | 35 +++ ...docTypeFromChainedAssignment2.symbols.diff | 51 +-- .../jsdocTypeFromChainedAssignment2.types | 65 +++- ...erenceToImportOfClassExpression.errors.txt | 5 +- ...ReferenceToImportOfClassExpression.symbols | 27 ++ ...enceToImportOfClassExpression.symbols.diff | 47 +-- ...peReferenceToImportOfClassExpression.types | 38 ++- ...nceToImportOfFunctionExpression.errors.txt | 8 +- ...erenceToImportOfFunctionExpression.symbols | 27 ++ ...eToImportOfFunctionExpression.symbols.diff | 47 +-- ...eferenceToImportOfFunctionExpression.types | 48 ++- ...ndAssignmentDeclarationSupport1.errors.txt | 27 +- ...BoundAssignmentDeclarationSupport1.symbols | 26 ++ ...AssignmentDeclarationSupport1.symbols.diff | 37 +-- ...teBoundAssignmentDeclarationSupport1.types | 46 ++- ...ndAssignmentDeclarationSupport2.errors.txt | 27 +- ...BoundAssignmentDeclarationSupport2.symbols | 32 ++ ...AssignmentDeclarationSupport2.symbols.diff | 50 +-- ...teBoundAssignmentDeclarationSupport2.types | 52 ++- ...ndAssignmentDeclarationSupport3.errors.txt | 15 +- ...BoundAssignmentDeclarationSupport3.symbols | 40 +++ ...AssignmentDeclarationSupport3.symbols.diff | 62 ++-- ...teBoundAssignmentDeclarationSupport3.types | 60 +++- ...ndAssignmentDeclarationSupport4.errors.txt | 11 +- ...BoundAssignmentDeclarationSupport4.symbols | 59 ++++ ...AssignmentDeclarationSupport4.symbols.diff | 87 +++-- ...teBoundAssignmentDeclarationSupport4.types | 83 ++++- ...ndAssignmentDeclarationSupport5.errors.txt | 11 +- ...BoundAssignmentDeclarationSupport5.symbols | 60 ++++ ...AssignmentDeclarationSupport5.symbols.diff | 91 +++--- ...teBoundAssignmentDeclarationSupport5.types | 82 ++++- ...ndAssignmentDeclarationSupport6.errors.txt | 11 +- ...BoundAssignmentDeclarationSupport6.symbols | 72 +++++ ...AssignmentDeclarationSupport6.symbols.diff | 106 ++++--- ...teBoundAssignmentDeclarationSupport6.types | 100 +++++- ...ndAssignmentDeclarationSupport7.errors.txt | 20 -- ...BoundAssignmentDeclarationSupport7.symbols | 43 +++ ...AssignmentDeclarationSupport7.symbols.diff | 69 ++-- ...teBoundAssignmentDeclarationSupport7.types | 75 ++++- .../conformance/moduleExportAlias2.errors.txt | 30 ++ .../conformance/moduleExportAlias2.symbols | 24 ++ .../moduleExportAlias2.symbols.diff | 49 ++- .../conformance/moduleExportAlias2.types | 44 ++- .../moduleExportAssignment.errors.txt | 44 +++ .../moduleExportAssignment.symbols | 45 +++ .../moduleExportAssignment.symbols.diff | 80 +++-- .../conformance/moduleExportAssignment.types | 70 ++++- .../moduleExportAssignment3.symbols | 13 + .../moduleExportAssignment3.symbols.diff | 26 +- .../conformance/moduleExportAssignment3.types | 23 +- .../moduleExportDuplicateAlias.errors.txt | 23 +- .../moduleExportDuplicateAlias.symbols | 27 ++ .../moduleExportDuplicateAlias.symbols.diff | 47 +-- .../moduleExportDuplicateAlias.types | 36 ++- .../moduleExportDuplicateAlias2.errors.txt | 26 +- .../moduleExportDuplicateAlias2.symbols | 36 +++ .../moduleExportDuplicateAlias2.symbols.diff | 65 ++-- .../moduleExportDuplicateAlias2.types | 45 ++- .../moduleExportDuplicateAlias3.errors.txt | 38 ++- .../moduleExportDuplicateAlias3.symbols | 44 +++ .../moduleExportDuplicateAlias3.symbols.diff | 83 +++-- .../moduleExportDuplicateAlias3.types | 60 +++- ...ortWithExportPropertyAssignment.errors.txt | 26 ++ ...ExportWithExportPropertyAssignment.symbols | 15 + ...tWithExportPropertyAssignment.symbols.diff | 35 +-- ...leExportWithExportPropertyAssignment.types | 30 +- ...rtWithExportPropertyAssignment2.errors.txt | 25 ++ ...xportWithExportPropertyAssignment2.symbols | 15 + ...WithExportPropertyAssignment2.symbols.diff | 32 +- ...eExportWithExportPropertyAssignment2.types | 32 +- ...rtWithExportPropertyAssignment3.errors.txt | 43 +++ ...xportWithExportPropertyAssignment3.symbols | 48 +++ ...WithExportPropertyAssignment3.symbols.diff | 75 +++-- ...eExportWithExportPropertyAssignment3.types | 90 ++++-- ...rtWithExportPropertyAssignment4.errors.txt | 41 +++ ...xportWithExportPropertyAssignment4.symbols | 60 ++++ ...WithExportPropertyAssignment4.symbols.diff | 90 ++++-- ...eExportWithExportPropertyAssignment4.types | 109 +++++-- ...eExportsElementAccessAssignment.errors.txt | 11 +- ...duleExportsElementAccessAssignment.symbols | 47 +++ ...xportsElementAccessAssignment.symbols.diff | 64 ++-- ...moduleExportsElementAccessAssignment.types | 99 ++++-- .../nestedDestructuringOfRequire.symbols | 18 ++ .../nestedDestructuringOfRequire.symbols.diff | 37 +-- .../nestedDestructuringOfRequire.types | 25 +- .../paramTagTypeResolution.symbols | 15 + .../paramTagTypeResolution.symbols.diff | 30 +- .../conformance/paramTagTypeResolution.types | 23 +- .../requireTwoPropertyAccesses.symbols | 17 + .../requireTwoPropertyAccesses.symbols.diff | 31 +- .../requireTwoPropertyAccesses.types | 31 +- .../typeFromPropertyAssignment17.errors.txt | 35 +++ .../typeFromPropertyAssignment17.symbols | 56 ++++ .../typeFromPropertyAssignment17.symbols.diff | 93 +++--- .../typeFromPropertyAssignment17.types | 85 ++++- .../typeFromPropertyAssignment19.errors.txt | 23 ++ .../typeFromPropertyAssignment19.symbols | 18 ++ .../typeFromPropertyAssignment19.symbols.diff | 35 ++- .../typeFromPropertyAssignment19.types | 32 ++ .../typeFromPropertyAssignment37.errors.txt | 27 ++ .../typeFromPropertyAssignment37.symbols | 9 + .../typeFromPropertyAssignment37.symbols.diff | 18 +- .../typeFromPropertyAssignment37.types | 24 ++ .../typedefCrossModule2.errors.txt | 73 +++++ .../conformance/typedefCrossModule2.symbols | 44 +++ .../typedefCrossModule2.symbols.diff | 81 ++--- .../conformance/typedefCrossModule2.types | 72 ++++- .../untypedModuleImport_allowJs.symbols | 9 + .../untypedModuleImport_allowJs.symbols.diff | 20 +- .../untypedModuleImport_allowJs.types | 20 +- .../untypedModuleImport_allowJs.types.diff | 28 -- .../varRequireFromJavascript.errors.txt | 32 -- .../varRequireFromJavascript.symbols | 31 ++ .../varRequireFromJavascript.symbols.diff | 48 +-- .../varRequireFromJavascript.types | 49 ++- ...ntDefineProperrtyPotentialMerge.types.diff | 91 +++--- .../jsEnumTagOnObjectFrozen.errors.txt.diff | 54 ++++ .../jsEnumTagOnObjectFrozen.types.diff | 137 +++----- ...yCheckFromContainedLiteral.errors.txt.diff | 16 +- ...opertyCheckFromContainedLiteral.types.diff | 120 +++---- ...ution_explicitNodeModulesImport.types.diff | 10 + .../requireOfJsonFileInJsFile.errors.txt.diff | 38 --- .../requireOfJsonFileInJsFile.types.diff | 42 +-- ...chainedPrototypeAssignment.errors.txt.diff | 18 +- .../chainedPrototypeAssignment.types.diff | 126 ++++---- ...xportsObjectAssignProperty.errors.txt.diff | 147 +++++++++ ...heckExportsObjectAssignProperty.types.diff | 296 +++++++++--------- ...ectAssignPrototypeProperty.errors.txt.diff | 31 +- ...tsObjectAssignPrototypeProperty.types.diff | 246 +++++++++++++++ .../checkObjectDefineProperty.errors.txt.diff | 106 +++++++ .../checkObjectDefineProperty.types.diff | 293 +++++++++++++++++ ...kOtherObjectAssignProperty.errors.txt.diff | 45 ++- .../checkOtherObjectAssignProperty.types.diff | 148 +++++---- .../commonJSAliasedExport.errors.txt.diff | 31 ++ .../commonJSAliasedExport.types.diff | 44 ++- .../conformance/commonJSReexport.types.diff | 65 ++-- ...larationsClassExtendsVisibility.types.diff | 43 +-- ...eclarationsCommonjsRelativePath.types.diff | 57 ++-- ...rationsExportAssignedVisibility.types.diff | 60 ++-- ...eclarationsExportedClassAliases.types.diff | 58 ++-- ...sExposedWithinNamespaceCjs.errors.txt.diff | 22 +- ...tAliasExposedWithinNamespaceCjs.types.diff | 58 ++-- ...sDeclarationsReexportedCjsAlias.types.diff | 77 ++--- ...ceToClassInstanceCrossFile.errors.txt.diff | 50 +++ ...ferenceToClassInstanceCrossFile.types.diff | 136 +++----- ...ropertyAndExportAssignment.errors.txt.diff | 18 +- ...edefPropertyAndExportAssignment.types.diff | 88 ++---- .../conformance/jsdocImportType.types.diff | 75 +---- .../conformance/jsdocImportType2.types.diff | 73 ++--- ...TypeFromChainedAssignment2.errors.txt.diff | 36 ++- ...jsdocTypeFromChainedAssignment2.types.diff | 103 +++--- ...eToImportOfClassExpression.errors.txt.diff | 5 +- ...erenceToImportOfClassExpression.types.diff | 67 ++-- ...ImportOfFunctionExpression.errors.txt.diff | 8 +- ...nceToImportOfFunctionExpression.types.diff | 81 ++--- ...ignmentDeclarationSupport1.errors.txt.diff | 45 --- ...ndAssignmentDeclarationSupport1.types.diff | 79 ++--- ...ignmentDeclarationSupport2.errors.txt.diff | 44 +-- ...ndAssignmentDeclarationSupport2.types.diff | 85 ++--- ...ignmentDeclarationSupport3.errors.txt.diff | 28 -- ...ndAssignmentDeclarationSupport3.types.diff | 96 ++---- ...ignmentDeclarationSupport4.errors.txt.diff | 14 +- ...ndAssignmentDeclarationSupport4.types.diff | 136 ++++---- ...ignmentDeclarationSupport5.errors.txt.diff | 14 +- ...ndAssignmentDeclarationSupport5.types.diff | 129 ++++---- ...ignmentDeclarationSupport6.errors.txt.diff | 14 +- ...ndAssignmentDeclarationSupport6.types.diff | 162 +++++----- ...ignmentDeclarationSupport7.errors.txt.diff | 24 -- ...ndAssignmentDeclarationSupport7.types.diff | 116 +++---- .../moduleExportAlias2.errors.txt.diff | 34 ++ .../conformance/moduleExportAlias2.types.diff | 83 ++--- .../moduleExportAssignment.errors.txt.diff | 48 +++ .../moduleExportAssignment.types.diff | 106 ++++--- .../moduleExportAssignment3.types.diff | 43 +-- ...moduleExportDuplicateAlias.errors.txt.diff | 26 +- .../moduleExportDuplicateAlias.types.diff | 56 ++-- ...oduleExportDuplicateAlias2.errors.txt.diff | 26 +- .../moduleExportDuplicateAlias2.types.diff | 65 ++-- ...oduleExportDuplicateAlias3.errors.txt.diff | 38 ++- .../moduleExportDuplicateAlias3.types.diff | 96 +++--- ...thExportPropertyAssignment.errors.txt.diff | 43 +-- ...ortWithExportPropertyAssignment.types.diff | 43 +-- ...hExportPropertyAssignment2.errors.txt.diff | 42 +-- ...rtWithExportPropertyAssignment2.types.diff | 50 +-- ...hExportPropertyAssignment3.errors.txt.diff | 64 ++-- ...rtWithExportPropertyAssignment3.types.diff | 126 ++++---- ...hExportPropertyAssignment4.errors.txt.diff | 66 ++-- ...rtWithExportPropertyAssignment4.types.diff | 163 ++++++---- ...rtsElementAccessAssignment.errors.txt.diff | 11 +- ...eExportsElementAccessAssignment.types.diff | 158 ++++------ .../nestedDestructuringOfRequire.types.diff | 41 +-- .../paramTagTypeResolution.types.diff | 34 +- .../requireTwoPropertyAccesses.types.diff | 49 +-- ...peFromPropertyAssignment17.errors.txt.diff | 39 +++ .../typeFromPropertyAssignment17.types.diff | 131 ++++---- ...peFromPropertyAssignment19.errors.txt.diff | 27 ++ .../typeFromPropertyAssignment19.types.diff | 58 ++-- ...peFromPropertyAssignment37.errors.txt.diff | 31 ++ .../typeFromPropertyAssignment37.types.diff | 38 ++- .../typedefCrossModule2.errors.txt.diff | 108 ++++--- .../typedefCrossModule2.types.diff | 100 +++--- .../untypedModuleImport_allowJs.types.diff | 11 + .../varRequireFromJavascript.errors.txt.diff | 36 --- .../varRequireFromJavascript.types.diff | 77 +---- 335 files changed, 11056 insertions(+), 6264 deletions(-) delete mode 100644 testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.types.diff create mode 100644 testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/missingFunctionImplementation2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleAugmentationDisallowedExtensions.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionNoResolve.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.types.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.types.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types.diff create mode 100644 testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types.diff create mode 100644 testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types.diff create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/moduleExportAlias2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/moduleExportAssignment.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_explicitNodeModulesImport.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignProperty.errors.txt.diff rename testdata/baselines/reference/{submodule => submoduleAccepted}/conformance/checkExportsObjectAssignProperty.types.diff (59%) rename testdata/baselines/reference/{submodule => submoduleAccepted}/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt.diff (63%) create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport1.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport3.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport7.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment19.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment37.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.errors.txt.diff diff --git a/internal/ast/parseoptions.go b/internal/ast/parseoptions.go index 465728e64a..f464a4523d 100644 --- a/internal/ast/parseoptions.go +++ b/internal/ast/parseoptions.go @@ -104,13 +104,19 @@ func getExternalModuleIndicator(file *SourceFile, opts ExternalModuleIndicatorOp func isFileProbablyExternalModule(sourceFile *SourceFile) *Node { for _, statement := range sourceFile.Statements.Nodes { - if IsExternalModuleIndicator(statement) { + if isAnExternalModuleIndicatorNode(statement) { return statement } } return getImportMetaIfNecessary(sourceFile) } +func isAnExternalModuleIndicatorNode(node *Node) bool { + return HasSyntacticModifier(node, ModifierFlagsExport) || + IsImportEqualsDeclaration(node) && IsExternalModuleReference(node.AsImportEqualsDeclaration().ModuleReference) || + IsImportDeclaration(node) || IsExportAssignment(node) || IsExportDeclaration(node) +} + func getImportMetaIfNecessary(sourceFile *SourceFile) *Node { if sourceFile.AsNode().Flags&NodeFlagsPossiblyContainsImportMeta != 0 { return findChildNode(sourceFile.AsNode(), IsImportMeta) diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index 7b4c56611e..70b00a5746 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -1615,9 +1615,8 @@ func isCommonJSContainingModuleKind(kind core.ModuleKind) bool { } func IsExternalModuleIndicator(node *Statement) bool { - return HasSyntacticModifier(node, ModifierFlagsExport) || - IsImportEqualsDeclaration(node) && IsExternalModuleReference(node.AsImportEqualsDeclaration().ModuleReference) || - IsImportDeclaration(node) || IsExportAssignment(node) || IsExportDeclaration(node) + // Exported top-level member indicates moduleness + return IsAnyImportOrReExport(node) || IsExportAssignment(node) || HasSyntacticModifier(node, ModifierFlagsExport) } func IsExportNamespaceAsDefaultDeclaration(node *Node) bool { diff --git a/internal/compiler/fileloader.go b/internal/compiler/fileloader.go index 2a9b962262..1751edc63e 100644 --- a/internal/compiler/fileloader.go +++ b/internal/compiler/fileloader.go @@ -10,6 +10,7 @@ import ( "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/diagnostics" "github.com/microsoft/typescript-go/internal/module" "github.com/microsoft/typescript-go/internal/tsoptions" "github.com/microsoft/typescript-go/internal/tspath" @@ -64,6 +65,10 @@ func processAllProgramFiles( compilerOptions := opts.Config.CompilerOptions() rootFiles := opts.Config.FileNames() supportedExtensions := tsoptions.GetSupportedExtensions(compilerOptions, nil /*extraFileExtensions*/) + var maxNodeModuleJsDepth int + if p := opts.Config.CompilerOptions().MaxNodeModuleJsDepth; p != nil { + maxNodeModuleJsDepth = *p + } loader := fileLoader{ opts: opts, defaultLibraryPath: tspath.GetNormalizedAbsolutePath(opts.Host.DefaultLibraryPath(), opts.Host.GetCurrentDirectory()), @@ -72,12 +77,11 @@ func processAllProgramFiles( CurrentDirectory: opts.Host.GetCurrentDirectory(), }, parseTasks: &fileLoaderWorker[*parseTask]{ - wg: core.NewWorkGroup(singleThreaded), - getSubTasks: getSubTasksOfParseTask, + wg: core.NewWorkGroup(singleThreaded), + maxDepth: maxNodeModuleJsDepth, }, projectReferenceParseTasks: &fileLoaderWorker[*projectReferenceParseTask]{ - wg: core.NewWorkGroup(singleThreaded), - getSubTasks: getSubTasksOfProjectReferenceParseTask, + wg: core.NewWorkGroup(singleThreaded), }, rootTasks: make([]*parseTask, 0, len(rootFiles)+len(libs)), supportedExtensions: core.Flatten(tsoptions.GetSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, supportedExtensions)), @@ -289,22 +293,24 @@ func (p *fileLoader) parseSourceFile(t *parseTask) *ast.SourceFile { return sourceFile } -func (p *fileLoader) resolveTripleslashPathReference(moduleName string, containingFile string) string { +func (p *fileLoader) resolveTripleslashPathReference(moduleName string, containingFile string) resolvedRef { basePath := tspath.GetDirectoryPath(containingFile) referencedFileName := moduleName if !tspath.IsRootedDiskPath(moduleName) { referencedFileName = tspath.CombinePaths(basePath, moduleName) } - return tspath.NormalizePath(referencedFileName) + return resolvedRef{ + fileName: tspath.NormalizePath(referencedFileName), + } } func (p *fileLoader) resolveTypeReferenceDirectives(file *ast.SourceFile, meta ast.SourceFileMetaData) ( - toParse []string, + toParse []resolvedRef, typeResolutionsInFile module.ModeAwareCache[*module.ResolvedTypeReferenceDirective], ) { if len(file.TypeReferenceDirectives) != 0 { - toParse = make([]string, 0, len(file.TypeReferenceDirectives)) + toParse = make([]resolvedRef, 0, len(file.TypeReferenceDirectives)) typeResolutionsInFile = make(module.ModeAwareCache[*module.ResolvedTypeReferenceDirective], len(file.TypeReferenceDirectives)) for _, ref := range file.TypeReferenceDirectives { redirect := p.projectReferenceFileMapper.getRedirectForResolution(file) @@ -312,7 +318,11 @@ func (p *fileLoader) resolveTypeReferenceDirectives(file *ast.SourceFile, meta a resolved := p.resolver.ResolveTypeReferenceDirective(ref.FileName, file.FileName(), resolutionMode, redirect) typeResolutionsInFile[module.ModeAwareCacheKey{Name: ref.FileName, Mode: resolutionMode}] = resolved if resolved.IsResolved() { - toParse = append(toParse, resolved.ResolvedFileName) + toParse = append(toParse, resolvedRef{ + fileName: resolved.ResolvedFileName, + increaseDepth: resolved.IsExternalLibraryImport, + elideOnDepth: false, + }) } } } @@ -322,19 +332,12 @@ func (p *fileLoader) resolveTypeReferenceDirectives(file *ast.SourceFile, meta a const externalHelpersModuleNameText = "tslib" // TODO(jakebailey): dedupe func (p *fileLoader) resolveImportsAndModuleAugmentations(file *ast.SourceFile, meta ast.SourceFileMetaData) ( - toParse []string, + toParse []resolvedRef, resolutionsInFile module.ModeAwareCache[*module.ResolvedModule], importHelpersImportSpecifier *ast.Node, jsxRuntimeImportSpecifier_ *jsxRuntimeImportSpecifier, ) { moduleNames := make([]*ast.Node, 0, len(file.Imports())+len(file.ModuleAugmentations)+2) - moduleNames = append(moduleNames, file.Imports()...) - for _, imp := range file.ModuleAugmentations { - if imp.Kind == ast.KindStringLiteral { - moduleNames = append(moduleNames, imp) - } - // Do nothing if it's an Identifier; we don't need to do module resolution for `declare global`. - } isJavaScriptFile := ast.IsSourceFileJS(file) isExternalModuleFile := ast.IsExternalModule(file) @@ -359,19 +362,39 @@ func (p *fileLoader) resolveImportsAndModuleAugmentations(file *ast.SourceFile, } } + importsStart := len(moduleNames) + + moduleNames = append(moduleNames, file.Imports()...) + for _, imp := range file.ModuleAugmentations { + if imp.Kind == ast.KindStringLiteral { + moduleNames = append(moduleNames, imp) + } + // Do nothing if it's an Identifier; we don't need to do module resolution for `declare global`. + } + if len(moduleNames) != 0 { - toParse = make([]string, 0, len(moduleNames)) + toParse = make([]resolvedRef, 0, len(moduleNames)) + resolutionsInFile = make(module.ModeAwareCache[*module.ResolvedModule], len(moduleNames)) - resolutions := p.resolveModuleNames(moduleNames, file, meta, redirect) + for index, entry := range moduleNames { + moduleName := entry.Text() + if moduleName == "" { + continue + } - resolutionsInFile = make(module.ModeAwareCache[*module.ResolvedModule], len(resolutions)) + mode := getModeForUsageLocation(file.FileName(), meta, entry, module.GetCompilerOptionsWithRedirect(p.opts.Config.CompilerOptions(), redirect)) + resolvedModule := p.resolver.ResolveModuleName(moduleName, file.FileName(), mode, redirect) + resolutionsInFile[module.ModeAwareCacheKey{Name: moduleName, Mode: mode}] = resolvedModule - for _, resolution := range resolutions { - resolvedFileName := resolution.resolvedModule.ResolvedFileName - // TODO(ercornel): !!!: check if from node modules + if !resolvedModule.IsResolved() { + continue + } - mode := getModeForUsageLocation(file.FileName(), meta, resolution.node, optionsForFile) - resolutionsInFile[module.ModeAwareCacheKey{Name: resolution.node.Text(), Mode: mode}] = resolution.resolvedModule + resolvedFileName := resolvedModule.ResolvedFileName + isFromNodeModulesSearch := resolvedModule.IsExternalLibraryImport + // Don't treat redirected files as JS files. + isJsFile := !tspath.FileExtensionIsOneOf(resolvedFileName, tspath.SupportedTSExtensionsWithJsonFlat) && p.projectReferenceFileMapper.getRedirectForResolution(ast.NewHasFileName(resolvedFileName, p.toPath(resolvedFileName))) == nil + isJsFileFromNodeModules := isFromNodeModulesSearch && isJsFile && strings.Contains(resolvedFileName, "/node_modules/") // add file to program only if: // - resolution was successful @@ -379,24 +402,20 @@ func (p *fileLoader) resolveImportsAndModuleAugmentations(file *ast.SourceFile, // - module name comes from the list of imports // - it's not a top level JavaScript module that exceeded the search max - // const elideImport = isJSFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth; + importIndex := index - importsStart - // Don't add the file if it has a bad extension (e.g. 'tsx' if we don't have '--allowJs') - // This may still end up being an untyped module -- the file won't be included but imports will be allowed. - hasAllowedExtension := false - if optionsForFile.GetResolveJsonModule() { - hasAllowedExtension = tspath.FileExtensionIsOneOf(resolvedFileName, tspath.SupportedTSExtensionsWithJsonFlat) - } else if optionsForFile.AllowJs.IsTrue() { - hasAllowedExtension = tspath.FileExtensionIsOneOf(resolvedFileName, tspath.SupportedJSExtensionsFlat) || tspath.FileExtensionIsOneOf(resolvedFileName, tspath.SupportedTSExtensionsFlat) - } else { - hasAllowedExtension = tspath.FileExtensionIsOneOf(resolvedFileName, tspath.SupportedTSExtensionsFlat) - } - shouldAddFile := resolution.resolvedModule.IsResolved() && hasAllowedExtension - // TODO(ercornel): !!!: other checks on whether or not to add the file + shouldAddFile := moduleName != "" && + getResolutionDiagnostic(optionsForFile, resolvedModule, file) == nil && + !optionsForFile.NoResolve.IsTrue() && + !(isJsFile && !optionsForFile.GetAllowJS()) && + (importIndex < 0 || (importIndex < len(file.Imports()) && (ast.IsInJSFile(file.Imports()[importIndex]) || file.Imports()[importIndex].Flags&ast.NodeFlagsJSDoc == 0))) if shouldAddFile { - // p.findSourceFile(resolvedFileName, FileIncludeReason{Import, 0}) - toParse = append(toParse, resolvedFileName) + toParse = append(toParse, resolvedRef{ + fileName: resolvedFileName, + increaseDepth: resolvedModule.IsExternalLibraryImport, + elideOnDepth: isJsFileFromNodeModules, + }) } } } @@ -404,6 +423,57 @@ func (p *fileLoader) resolveImportsAndModuleAugmentations(file *ast.SourceFile, return toParse, resolutionsInFile, importHelpersImportSpecifier, jsxRuntimeImportSpecifier_ } +// Returns a DiagnosticMessage if we won't include a resolved module due to its extension. +// The DiagnosticMessage's parameters are the imported module name, and the filename it resolved to. +// This returns a diagnostic even if the module will be an untyped module. +func getResolutionDiagnostic(options *core.CompilerOptions, resolvedModule *module.ResolvedModule, file *ast.SourceFile) *diagnostics.Message { + needJsx := func() *diagnostics.Message { + if options.Jsx != core.JsxEmitNone { + return nil + } + return diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set + } + + needAllowJs := func() *diagnostics.Message { + if options.GetAllowJS() || !options.NoImplicitAny.DefaultIfUnknown(options.Strict).IsTrue() { + return nil + } + return diagnostics.Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used + } + + needResolveJsonModule := func() *diagnostics.Message { + if options.GetResolveJsonModule() { + return nil + } + return diagnostics.Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used + } + + needAllowArbitraryExtensions := func() *diagnostics.Message { + if file.IsDeclarationFile || options.AllowArbitraryExtensions.IsTrue() { + return nil + } + return diagnostics.Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set + } + + switch resolvedModule.Extension { + case tspath.ExtensionTs, tspath.ExtensionDts, + tspath.ExtensionMts, tspath.ExtensionDmts, + tspath.ExtensionCts, tspath.ExtensionDcts: + // These are always allowed. + return nil + case tspath.ExtensionTsx: + return needJsx() + case tspath.ExtensionJsx: + return core.Coalesce(needJsx(), needAllowJs()) + case tspath.ExtensionJs, tspath.ExtensionMjs, tspath.ExtensionCjs: + return needAllowJs() + case tspath.ExtensionJson: + return needResolveJsonModule() + default: + return needAllowArbitraryExtensions() + } +} + func (p *fileLoader) resolveModuleNames(entries []*ast.Node, file *ast.SourceFile, meta ast.SourceFileMetaData, redirect *tsoptions.ParsedCommandLine) []*resolution { if len(entries) == 0 { return nil diff --git a/internal/compiler/fileloadertask.go b/internal/compiler/fileloadertask.go index 9ad77d7f32..8dbf9ce76f 100644 --- a/internal/compiler/fileloadertask.go +++ b/internal/compiler/fileloadertask.go @@ -1,43 +1,75 @@ package compiler import ( + "math" + "sync" + "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/tspath" ) -type fileLoaderWorkerTask interface { +type fileLoaderWorkerTask[T any] interface { comparable FileName() string - start(loader *fileLoader) + isLoaded() bool + load(loader *fileLoader) + getSubTasks() []T + shouldIncreaseDepth() bool + shouldElideOnDepth() bool } -type fileLoaderWorker[K fileLoaderWorkerTask] struct { +type fileLoaderWorker[K fileLoaderWorkerTask[K]] struct { wg core.WorkGroup - tasksByFileName collections.SyncMap[string, K] - getSubTasks func(t K) []K + tasksByFileName collections.SyncMap[string, *queuedTask[K]] + maxDepth int +} + +type queuedTask[K fileLoaderWorkerTask[K]] struct { + task K + mu sync.Mutex + lowestDepth int } func (w *fileLoaderWorker[K]) runAndWait(loader *fileLoader, tasks []K) { - w.start(loader, tasks) + w.start(loader, tasks, 0) w.wg.RunAndWait() } -func (w *fileLoaderWorker[K]) start(loader *fileLoader, tasks []K) { - if len(tasks) > 0 { - for i, task := range tasks { - loadedTask, loaded := w.tasksByFileName.LoadOrStore(task.FileName(), task) - if loaded { - // dedup tasks to ensure correct file order, regardless of which task would be started first - tasks[i] = loadedTask - } else { - w.wg.Queue(func() { - task.start(loader) - subTasks := w.getSubTasks(task) - w.start(loader, subTasks) - }) - } +func (w *fileLoaderWorker[K]) start(loader *fileLoader, tasks []K, depth int) { + for i, task := range tasks { + newTask := &queuedTask[K]{task: task, lowestDepth: math.MaxInt} + loadedTask, loaded := w.tasksByFileName.LoadOrStore(task.FileName(), newTask) + task = loadedTask.task + if loaded { + tasks[i] = task + } + + currentDepth := depth + if task.shouldIncreaseDepth() { + currentDepth++ + } + + if task.shouldElideOnDepth() && currentDepth > w.maxDepth { + continue } + + w.wg.Queue(func() { + loadedTask.mu.Lock() + defer loadedTask.mu.Unlock() + + if !task.isLoaded() { + task.load(loader) + } + + if currentDepth < loadedTask.lowestDepth { + // If we're seeing this task at a lower depth than before, + // reprocess its subtasks to ensure they are loaded. + loadedTask.lowestDepth = currentDepth + subTasks := task.getSubTasks() + w.start(loader, subTasks, currentDepth) + } + }) } } @@ -49,12 +81,12 @@ func (w *fileLoaderWorker[K]) collectWorker(loader *fileLoader, tasks []K, itera var results []tspath.Path for _, task := range tasks { // ensure we only walk each task once - if seen.Has(task) { + if !task.isLoaded() || seen.Has(task) { continue } seen.Add(task) var subResults []tspath.Path - if subTasks := w.getSubTasks(task); len(subTasks) > 0 { + if subTasks := task.getSubTasks(); len(subTasks) > 0 { subResults = w.collectWorker(loader, subTasks, iterate, seen) } iterate(task, subResults) diff --git a/internal/compiler/parsetask.go b/internal/compiler/parsetask.go index 3143336e72..fab536949f 100644 --- a/internal/compiler/parsetask.go +++ b/internal/compiler/parsetask.go @@ -15,12 +15,15 @@ type parseTask struct { isLib bool isRedirected bool subTasks []*parseTask + loaded bool metadata ast.SourceFileMetaData resolutionsInFile module.ModeAwareCache[*module.ResolvedModule] typeResolutionsInFile module.ModeAwareCache[*module.ResolvedTypeReferenceDirective] importHelpersImportSpecifier *ast.Node jsxRuntimeImportSpecifier *jsxRuntimeImportSpecifier + increaseDepth bool + elideOnDepth bool } func (t *parseTask) FileName() string { @@ -31,7 +34,9 @@ func (t *parseTask) Path() tspath.Path { return t.path } -func (t *parseTask) start(loader *fileLoader) { +func (t *parseTask) load(loader *fileLoader) { + t.loaded = true + t.path = loader.toPath(t.normalizedFilePath) redirect := loader.projectReferenceFileMapper.getParseFileRedirect(t) if redirect != "" { @@ -52,7 +57,6 @@ func (t *parseTask) start(loader *fileLoader) { t.file = file - // !!! if noResolve, skip all of this t.subTasks = make([]*parseTask, 0, len(file.ReferencedFiles)+len(file.Imports())+len(file.ModuleAugmentations)) for _, ref := range file.ReferencedFiles { @@ -73,7 +77,7 @@ func (t *parseTask) start(loader *fileLoader) { if !ok { continue } - t.addSubTask(tspath.CombinePaths(loader.defaultLibraryPath, name), true) + t.addSubTask(resolvedRef{fileName: tspath.CombinePaths(loader.defaultLibraryPath, name)}, true) } } @@ -89,14 +93,34 @@ func (t *parseTask) start(loader *fileLoader) { func (t *parseTask) redirect(loader *fileLoader, fileName string) { t.isRedirected = true + // increaseDepth and elideOnDepth are not copied to redirects, otherwise their depth would be double counted. t.subTasks = []*parseTask{{normalizedFilePath: tspath.NormalizePath(fileName), isLib: t.isLib}} } -func (t *parseTask) addSubTask(fileName string, isLib bool) { - normalizedFilePath := tspath.NormalizePath(fileName) - t.subTasks = append(t.subTasks, &parseTask{normalizedFilePath: normalizedFilePath, isLib: isLib}) +type resolvedRef struct { + fileName string + increaseDepth bool + elideOnDepth bool +} + +func (t *parseTask) addSubTask(ref resolvedRef, isLib bool) { + normalizedFilePath := tspath.NormalizePath(ref.fileName) + subTask := &parseTask{normalizedFilePath: normalizedFilePath, isLib: isLib, increaseDepth: ref.increaseDepth, elideOnDepth: ref.elideOnDepth} + t.subTasks = append(t.subTasks, subTask) } -func getSubTasksOfParseTask(t *parseTask) []*parseTask { +func (t *parseTask) getSubTasks() []*parseTask { return t.subTasks } + +func (t *parseTask) shouldIncreaseDepth() bool { + return t.increaseDepth +} + +func (t *parseTask) shouldElideOnDepth() bool { + return t.elideOnDepth +} + +func (t *parseTask) isLoaded() bool { + return t.loaded +} diff --git a/internal/compiler/program.go b/internal/compiler/program.go index 8cea5d5dea..8928bba703 100644 --- a/internal/compiler/program.go +++ b/internal/compiler/program.go @@ -46,16 +46,6 @@ type Program struct { processedFiles - // The below settings are to track if a .js file should be add to the program if loaded via searching under node_modules. - // This works as imported modules are discovered recursively in a depth first manner, specifically: - // - For each root file, findSourceFile is called. - // - This calls processImportedModules for each module imported in the source file. - // - This calls resolveModuleNames, and then calls findSourceFile for each resolved module. - // As all these operations happen - and are nested - within the createProgram call, they close over the below variables. - // The current resolution depth is tracked by incrementing/decrementing as the depth first search progresses. - // maxNodeModuleJsDepth int - currentNodeModulesDepth int - usesUriStyleNodeCoreModules core.Tristate commonSourceDirectory string @@ -194,12 +184,6 @@ func NewProgram(opts ProgramOptions) *Program { } p.initCheckerPool() - // p.maxNodeModuleJsDepth = p.options.MaxNodeModuleJsDepth - - // TODO(ercornel): !!! tracing? - // tracing?.push(tracing.Phase.Program, "createProgram", { configFilePath: options.configFilePath, rootDir: options.rootDir }, /*separateBeginAndEnd*/ true); - // performance.mark("beforeProgram"); - var libs []string if compilerOptions.NoLib != core.TSTrue { @@ -235,7 +219,6 @@ func (p *Program) UpdateProgram(changedFilePath tspath.Path) (*Program, bool) { nodeModules: p.nodeModules, comparePathsOptions: p.comparePathsOptions, processedFiles: p.processedFiles, - currentNodeModulesDepth: p.currentNodeModulesDepth, usesUriStyleNodeCoreModules: p.usesUriStyleNodeCoreModules, } result.initCheckerPool() diff --git a/internal/compiler/projectreferenceparsetask.go b/internal/compiler/projectreferenceparsetask.go index c65dcd6267..647a3f6273 100644 --- a/internal/compiler/projectreferenceparsetask.go +++ b/internal/compiler/projectreferenceparsetask.go @@ -6,6 +6,7 @@ import ( ) type projectReferenceParseTask struct { + loaded bool configName string resolved *tsoptions.ParsedCommandLine subTasks []*projectReferenceParseTask @@ -15,7 +16,9 @@ func (t *projectReferenceParseTask) FileName() string { return t.configName } -func (t *projectReferenceParseTask) start(loader *fileLoader) { +func (t *projectReferenceParseTask) load(loader *fileLoader) { + t.loaded = true + t.resolved = loader.opts.Host.GetResolvedProjectReference(t.configName, loader.toPath(t.configName)) if t.resolved == nil { return @@ -32,10 +35,22 @@ func (t *projectReferenceParseTask) start(loader *fileLoader) { t.subTasks = createProjectReferenceParseTasks(subReferences) } -func getSubTasksOfProjectReferenceParseTask(t *projectReferenceParseTask) []*projectReferenceParseTask { +func (t *projectReferenceParseTask) getSubTasks() []*projectReferenceParseTask { return t.subTasks } +func (t *projectReferenceParseTask) shouldIncreaseDepth() bool { + return false +} + +func (t *projectReferenceParseTask) shouldElideOnDepth() bool { + return false +} + +func (t *projectReferenceParseTask) isLoaded() bool { + return t.loaded +} + func createProjectReferenceParseTasks(projectReferences []string) []*projectReferenceParseTask { return core.Map(projectReferences, func(configName string) *projectReferenceParseTask { return &projectReferenceParseTask{ diff --git a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.errors.txt b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.errors.txt deleted file mode 100644 index aa8d24f0dc..0000000000 --- a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.errors.txt +++ /dev/null @@ -1,51 +0,0 @@ -/packages/main/index.ts(1,19): error TS7016: Could not find a declaration file for module 'shared'. '/packages/shared/index.js' implicitly has an 'any' type. - Try `npm i --save-dev @types/shared` if it exists or add a new declaration (.d.ts) file containing `declare module 'shared';` - - -==== /packages/main/tsconfig.json (0 errors) ==== - { - "compilerOptions": { - "noEmit": true, - "checkJs": true, - "strict": true, - "module": "esnext", - "moduleResolution": "bundler", - "traceResolution": true, - } - } - - -==== /packages/main/index.ts (1 errors) ==== - import { x } from "shared"; - ~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module 'shared'. '/packages/shared/index.js' implicitly has an 'any' type. -!!! error TS7016: Try `npm i --save-dev @types/shared` if it exists or add a new declaration (.d.ts) file containing `declare module 'shared';` - -==== /node_modules/pkg/index.d.ts (0 errors) ==== - export declare function pkg(): "pkg"; - -==== /packages/shared/package.json (0 errors) ==== - { - "name": "shared", - "version": "1.0.0", - "type": "module", - "exports": "./index.js" - } - -==== /packages/shared/utils.js (0 errors) ==== - export { pkg } from "pkg"; - -==== /packages/shared/index.js (0 errors) ==== - import { pkg } from "./utils.js"; - export const x = pkg(); - -==== /packages/main/package.json (0 errors) ==== - { - "name": "main", - "version": "1.0.0", - "type": "module", - "dependencies": { - "shared": "workspace:*" - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.errors.txt.diff deleted file mode 100644 index c1914b50c9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.errors.txt.diff +++ /dev/null @@ -1,55 +0,0 @@ ---- old.allowJsCrossMonorepoPackage.errors.txt -+++ new.allowJsCrossMonorepoPackage.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/packages/main/index.ts(1,19): error TS7016: Could not find a declaration file for module 'shared'. '/packages/shared/index.js' implicitly has an 'any' type. -+ Try `npm i --save-dev @types/shared` if it exists or add a new declaration (.d.ts) file containing `declare module 'shared';` -+ -+ -+==== /packages/main/tsconfig.json (0 errors) ==== -+ { -+ "compilerOptions": { -+ "noEmit": true, -+ "checkJs": true, -+ "strict": true, -+ "module": "esnext", -+ "moduleResolution": "bundler", -+ "traceResolution": true, -+ } -+ } -+ -+ -+==== /packages/main/index.ts (1 errors) ==== -+ import { x } from "shared"; -+ ~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module 'shared'. '/packages/shared/index.js' implicitly has an 'any' type. -+!!! error TS7016: Try `npm i --save-dev @types/shared` if it exists or add a new declaration (.d.ts) file containing `declare module 'shared';` -+ -+==== /node_modules/pkg/index.d.ts (0 errors) ==== -+ export declare function pkg(): "pkg"; -+ -+==== /packages/shared/package.json (0 errors) ==== -+ { -+ "name": "shared", -+ "version": "1.0.0", -+ "type": "module", -+ "exports": "./index.js" -+ } -+ -+==== /packages/shared/utils.js (0 errors) ==== -+ export { pkg } from "pkg"; -+ -+==== /packages/shared/index.js (0 errors) ==== -+ import { pkg } from "./utils.js"; -+ export const x = pkg(); -+ -+==== /packages/main/package.json (0 errors) ==== -+ { -+ "name": "main", -+ "version": "1.0.0", -+ "type": "module", -+ "dependencies": { -+ "shared": "workspace:*" -+ } -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.symbols b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.symbols index 2e20d79553..dbdc37a135 100644 --- a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.symbols +++ b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.symbols @@ -4,3 +4,19 @@ import { x } from "shared"; >x : Symbol(x, Decl(index.ts, 0, 8)) +=== /node_modules/pkg/index.d.ts === +export declare function pkg(): "pkg"; +>pkg : Symbol(pkg, Decl(index.d.ts, 0, 0)) + +=== /packages/shared/utils.js === +export { pkg } from "pkg"; +>pkg : Symbol(pkg, Decl(utils.js, 0, 8)) + +=== /packages/shared/index.js === +import { pkg } from "./utils.js"; +>pkg : Symbol(pkg, Decl(index.js, 0, 8)) + +export const x = pkg(); +>x : Symbol(x, Decl(index.js, 1, 12)) +>pkg : Symbol(pkg, Decl(index.js, 0, 8)) + diff --git a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.symbols.diff b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.symbols.diff deleted file mode 100644 index 69d3699f37..0000000000 --- a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.symbols.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.allowJsCrossMonorepoPackage.symbols -+++ new.allowJsCrossMonorepoPackage.symbols -@@= skipped -3, +3 lines =@@ - import { x } from "shared"; - >x : Symbol(x, Decl(index.ts, 0, 8)) - --=== /node_modules/pkg/index.d.ts === --export declare function pkg(): "pkg"; -->pkg : Symbol(pkg, Decl(index.d.ts, 0, 0)) -- --=== /packages/shared/utils.js === --export { pkg } from "pkg"; -->pkg : Symbol(pkg, Decl(utils.js, 0, 8)) -- --=== /packages/shared/index.js === --import { pkg } from "./utils.js"; -->pkg : Symbol(pkg, Decl(index.js, 0, 8)) -- --export const x = pkg(); -->x : Symbol(x, Decl(index.js, 1, 12)) -->pkg : Symbol(pkg, Decl(index.js, 0, 8)) -- \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.types b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.types index 8472a76ba2..8a0ecbf103 100644 --- a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.types +++ b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.types @@ -2,5 +2,22 @@ === /packages/main/index.ts === import { x } from "shared"; ->x : any +>x : "pkg" + +=== /node_modules/pkg/index.d.ts === +export declare function pkg(): "pkg"; +>pkg : () => "pkg" + +=== /packages/shared/utils.js === +export { pkg } from "pkg"; +>pkg : () => "pkg" + +=== /packages/shared/index.js === +import { pkg } from "./utils.js"; +>pkg : () => "pkg" + +export const x = pkg(); +>x : "pkg" +>pkg() : "pkg" +>pkg : () => "pkg" diff --git a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.types.diff b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.types.diff deleted file mode 100644 index 77e6ed8ace..0000000000 --- a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.types.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.allowJsCrossMonorepoPackage.types -+++ new.allowJsCrossMonorepoPackage.types -@@= skipped -1, +1 lines =@@ - - === /packages/main/index.ts === - import { x } from "shared"; -->x : "pkg" -- --=== /node_modules/pkg/index.d.ts === --export declare function pkg(): "pkg"; -->pkg : () => "pkg" -- --=== /packages/shared/utils.js === --export { pkg } from "pkg"; -->pkg : () => "pkg" -- --=== /packages/shared/index.js === --import { pkg } from "./utils.js"; -->pkg : () => "pkg" -- --export const x = pkg(); -->x : "pkg" -->pkg() : "pkg" -->pkg : () => "pkg" -+>x : any diff --git a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols index 245a4ff4c8..146e0f03bc 100644 --- a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols +++ b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols @@ -4,6 +4,7 @@ const _item = require("./namespacer"); >_item : Symbol(_item, Decl(index.js, 0, 5)) >require : Symbol(require) +>"./namespacer" : Symbol("namespacer", Decl(namespacer.js, 0, 0)) module.exports = 12; >module.exports : Symbol(export=, Decl(index.js, 0, 38)) @@ -16,3 +17,43 @@ Object.defineProperty(module, "exports", { value: "oh no" }); >defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) >value : Symbol(value, Decl(index.js, 2, 42)) +=== namespacey.js === +const A = {} +>A : Symbol(A, Decl(namespacey.js, 0, 5)) + +A.bar = class Q {} +>A.bar : Symbol(bar, Decl(namespacey.js, 0, 12)) +>A : Symbol(A, Decl(namespacey.js, 0, 5)) +>bar : Symbol(bar, Decl(namespacey.js, 0, 12)) +>Q : Symbol(Q, Decl(namespacey.js, 1, 7)) + +module.exports = A; +>module.exports : Symbol(A, Decl(namespacey.js, 0, 5)) +>module : Symbol(module.exports) +>exports : Symbol(A, Decl(namespacey.js, 0, 5)) +>A : Symbol(A, Decl(namespacey.js, 0, 5)) + +=== namespacer.js === +const B = {} +>B : Symbol(B, Decl(namespacer.js, 0, 5)) + +B.NS = require("./namespacey"); +>B.NS : Symbol(NS, Decl(namespacer.js, 0, 12)) +>B : Symbol(B, Decl(namespacer.js, 0, 5)) +>NS : Symbol(NS, Decl(namespacer.js, 0, 12)) +>require : Symbol(require) + +Object.defineProperty(B, "NS", { value: "why though", writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>B : Symbol(B, Decl(namespacer.js, 0, 5)) +>value : Symbol(value, Decl(namespacer.js, 2, 32)) +>writable : Symbol(writable, Decl(namespacer.js, 2, 53)) + +module.exports = B; +>module.exports : Symbol(B, Decl(namespacer.js, 0, 5)) +>module : Symbol(module.exports) +>exports : Symbol(B, Decl(namespacer.js, 0, 5)) +>B : Symbol(B, Decl(namespacer.js, 0, 5)) + diff --git a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff index d57516ef97..325d923238 100644 --- a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff @@ -1,10 +1,7 @@ --- old.ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols +++ new.ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols -@@= skipped -3, +3 lines =@@ - const _item = require("./namespacer"); - >_item : Symbol(_item, Decl(index.js, 0, 5)) - >require : Symbol(require) -->"./namespacer" : Symbol("namespacer", Decl(namespacer.js, 0, 0)) +@@= skipped -6, +6 lines =@@ + >"./namespacer" : Symbol("namespacer", Decl(namespacer.js, 0, 0)) module.exports = 12; ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) @@ -22,45 +19,64 @@ ->"exports" : Symbol(module.exports, Decl(index.js, 1, 20)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) >value : Symbol(value, Decl(index.js, 2, 42)) -- --=== namespacey.js === --const A = {} + + === namespacey.js === + const A = {} ->A : Symbol(A, Decl(namespacey.js, 0, 5), Decl(namespacey.js, 0, 12)) -- --A.bar = class Q {} ++>A : Symbol(A, Decl(namespacey.js, 0, 5)) + + A.bar = class Q {} ->A.bar : Symbol(A.bar, Decl(namespacey.js, 0, 12)) ->A : Symbol(A, Decl(namespacey.js, 0, 5), Decl(namespacey.js, 0, 12)) ->bar : Symbol(A.bar, Decl(namespacey.js, 0, 12)) -->Q : Symbol(Q, Decl(namespacey.js, 1, 7)) -- --module.exports = A; ++>A.bar : Symbol(bar, Decl(namespacey.js, 0, 12)) ++>A : Symbol(A, Decl(namespacey.js, 0, 5)) ++>bar : Symbol(bar, Decl(namespacey.js, 0, 12)) + >Q : Symbol(Q, Decl(namespacey.js, 1, 7)) + + module.exports = A; ->module.exports : Symbol(module.exports, Decl(namespacey.js, 0, 0)) ->module : Symbol(export=, Decl(namespacey.js, 1, 18)) ->exports : Symbol(export=, Decl(namespacey.js, 1, 18)) ->A : Symbol(A, Decl(namespacey.js, 0, 5), Decl(namespacey.js, 0, 12)) -- --=== namespacer.js === --const B = {} ++>module.exports : Symbol(A, Decl(namespacey.js, 0, 5)) ++>module : Symbol(module.exports) ++>exports : Symbol(A, Decl(namespacey.js, 0, 5)) ++>A : Symbol(A, Decl(namespacey.js, 0, 5)) + + === namespacer.js === + const B = {} ->B : Symbol(B, Decl(namespacer.js, 0, 5), Decl(namespacer.js, 0, 12), Decl(namespacer.js, 2, 22)) -- --B.NS = require("./namespacey"); ++>B : Symbol(B, Decl(namespacer.js, 0, 5)) + + B.NS = require("./namespacey"); ->B.NS : Symbol(B.NS, Decl(namespacer.js, 0, 12), Decl(namespacer.js, 1, 31)) ->B : Symbol(B, Decl(namespacer.js, 0, 5), Decl(namespacer.js, 0, 12), Decl(namespacer.js, 2, 22)) ->NS : Symbol(B.NS, Decl(namespacer.js, 0, 12), Decl(namespacer.js, 1, 31)) -->require : Symbol(require) ++>B.NS : Symbol(NS, Decl(namespacer.js, 0, 12)) ++>B : Symbol(B, Decl(namespacer.js, 0, 5)) ++>NS : Symbol(NS, Decl(namespacer.js, 0, 12)) + >require : Symbol(require) ->"./namespacey" : Symbol("namespacey", Decl(namespacey.js, 0, 0)) -- --Object.defineProperty(B, "NS", { value: "why though", writable: true }); + + Object.defineProperty(B, "NS", { value: "why though", writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->B : Symbol(B, Decl(namespacer.js, 0, 5), Decl(namespacer.js, 0, 12), Decl(namespacer.js, 2, 22)) ->"NS" : Symbol(B.NS, Decl(namespacer.js, 0, 12), Decl(namespacer.js, 1, 31)) -->value : Symbol(value, Decl(namespacer.js, 2, 32)) -->writable : Symbol(writable, Decl(namespacer.js, 2, 53)) -- --module.exports = B; ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>B : Symbol(B, Decl(namespacer.js, 0, 5)) + >value : Symbol(value, Decl(namespacer.js, 2, 32)) + >writable : Symbol(writable, Decl(namespacer.js, 2, 53)) + + module.exports = B; ->module.exports : Symbol(module.exports, Decl(namespacer.js, 0, 0)) ->module : Symbol(export=, Decl(namespacer.js, 2, 72)) ->exports : Symbol(export=, Decl(namespacer.js, 2, 72)) ->B : Symbol(B, Decl(namespacer.js, 0, 5), Decl(namespacer.js, 0, 12), Decl(namespacer.js, 2, 22)) ++>module.exports : Symbol(B, Decl(namespacer.js, 0, 5)) ++>module : Symbol(module.exports) ++>exports : Symbol(B, Decl(namespacer.js, 0, 5)) ++>B : Symbol(B, Decl(namespacer.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types index c6be5e731c..4f72e4fd3c 100644 --- a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types +++ b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types @@ -2,8 +2,8 @@ === index.js === const _item = require("./namespacer"); ->_item : any ->require("./namespacer") : any +>_item : { NS: { bar: typeof Q; }; } +>require("./namespacer") : { NS: { bar: typeof Q; }; } >require : any >"./namespacer" : "./namespacer" @@ -25,3 +25,57 @@ Object.defineProperty(module, "exports", { value: "oh no" }); >value : string >"oh no" : "oh no" +=== namespacey.js === +const A = {} +>A : { bar: typeof Q; } +>{} : { bar: typeof Q; } + +A.bar = class Q {} +>A.bar = class Q {} : typeof Q +>A.bar : typeof Q +>A : { bar: typeof Q; } +>bar : typeof Q +>class Q {} : typeof Q +>Q : typeof Q + +module.exports = A; +>module.exports = A : { bar: typeof Q; } +>module.exports : { bar: typeof Q; } +>module : { readonly A: { bar: typeof Q; }; } +>exports : { bar: typeof Q; } +>A : { bar: typeof Q; } + +=== namespacer.js === +const B = {} +>B : { NS: { bar: typeof Q; }; } +>{} : { NS: { bar: typeof Q; }; } + +B.NS = require("./namespacey"); +>B.NS = require("./namespacey") : { bar: typeof Q; } +>B.NS : { bar: typeof Q; } +>B : { NS: { bar: typeof Q; }; } +>NS : { bar: typeof Q; } +>require("./namespacey") : { bar: typeof Q; } +>require : any +>"./namespacey" : "./namespacey" + +Object.defineProperty(B, "NS", { value: "why though", writable: true }); +>Object.defineProperty(B, "NS", { value: "why though", writable: true }) : { NS: { bar: typeof Q; }; } +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>B : { NS: { bar: typeof Q; }; } +>"NS" : "NS" +>{ value: "why though", writable: true } : { value: string; writable: true; } +>value : string +>"why though" : "why though" +>writable : true +>true : true + +module.exports = B; +>module.exports = B : { NS: { bar: typeof Q; }; } +>module.exports : { NS: { bar: typeof Q; }; } +>module : { readonly B: { NS: { bar: typeof Q; }; }; } +>exports : { NS: { bar: typeof Q; }; } +>B : { NS: { bar: typeof Q; }; } + diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt new file mode 100644 index 0000000000..2d268cb5a4 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt @@ -0,0 +1,50 @@ +index.js(10,12): error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? +index.js(17,16): error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? + + +==== usage.js (0 errors) ==== + const { Thing, useThing, cbThing } = require("./index"); + + useThing(Thing.a); + + /** + * @typedef {Object} LogEntry + * @property {string} type + * @property {number} time + */ + + cbThing(type => { + /** @type {LogEntry} */ + const logEntry = { + time: Date.now(), + type, + }; + }); + +==== index.js (2 errors) ==== + /** @enum {string} */ + const Thing = Object.freeze({ + a: "thing", + b: "chill" + }); + + exports.Thing = Thing; + + /** + * @param {Thing} x + ~~~~~ +!!! error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? + */ + function useThing(x) {} + + exports.useThing = useThing; + + /** + * @param {(x: Thing) => void} x + ~~~~~ +!!! error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? + */ + function cbThing(x) {} + + exports.cbThing = cbThing; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols index b46908c5b0..22ca93d390 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols @@ -6,10 +6,13 @@ const { Thing, useThing, cbThing } = require("./index"); >useThing : Symbol(useThing, Decl(usage.js, 0, 14)) >cbThing : Symbol(cbThing, Decl(usage.js, 0, 24)) >require : Symbol(require) +>"./index" : Symbol("index", Decl(index.js, 0, 0)) useThing(Thing.a); >useThing : Symbol(useThing, Decl(usage.js, 0, 14)) +>Thing.a : Symbol(a, Decl(index.js, 1, 29)) >Thing : Symbol(Thing, Decl(usage.js, 0, 7)) +>a : Symbol(a, Decl(index.js, 1, 29)) /** * @typedef {Object} LogEntry @@ -37,3 +40,51 @@ cbThing(type => { }; }); +=== index.js === +/** @enum {string} */ +const Thing = Object.freeze({ +>Thing : Symbol(Thing, Decl(index.js, 1, 5)) +>Object.freeze : Symbol(freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>freeze : Symbol(freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + + a: "thing", +>a : Symbol(a, Decl(index.js, 1, 29)) + + b: "chill" +>b : Symbol(b, Decl(index.js, 2, 15)) + +}); + +exports.Thing = Thing; +>exports.Thing : Symbol(Thing, Decl(index.js, 4, 3)) +>exports : Symbol("index", Decl(index.js, 0, 0)) +>Thing : Symbol(Thing, Decl(index.js, 4, 3)) +>Thing : Symbol(Thing, Decl(index.js, 1, 5)) + +/** + * @param {Thing} x + */ +function useThing(x) {} +>useThing : Symbol(useThing, Decl(index.js, 6, 22)) +>x : Symbol(x, Decl(index.js, 11, 18)) + +exports.useThing = useThing; +>exports.useThing : Symbol(useThing, Decl(index.js, 11, 23)) +>exports : Symbol("index", Decl(index.js, 0, 0)) +>useThing : Symbol(useThing, Decl(index.js, 11, 23)) +>useThing : Symbol(useThing, Decl(index.js, 6, 22)) + +/** + * @param {(x: Thing) => void} x + */ +function cbThing(x) {} +>cbThing : Symbol(cbThing, Decl(index.js, 13, 28)) +>x : Symbol(x, Decl(index.js, 18, 17)) + +exports.cbThing = cbThing; +>exports.cbThing : Symbol(cbThing, Decl(index.js, 18, 22)) +>exports : Symbol("index", Decl(index.js, 0, 0)) +>cbThing : Symbol(cbThing, Decl(index.js, 18, 22)) +>cbThing : Symbol(cbThing, Decl(index.js, 13, 28)) + diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols.diff index 040b35b093..2a2a752d9e 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols.diff @@ -1,20 +1,6 @@ --- old.jsEnumTagOnObjectFrozen.symbols +++ new.jsEnumTagOnObjectFrozen.symbols -@@= skipped -5, +5 lines =@@ - >useThing : Symbol(useThing, Decl(usage.js, 0, 14)) - >cbThing : Symbol(cbThing, Decl(usage.js, 0, 24)) - >require : Symbol(require) -->"./index" : Symbol("index", Decl(index.js, 0, 0)) - - useThing(Thing.a); - >useThing : Symbol(useThing, Decl(usage.js, 0, 14)) -->Thing.a : Symbol(a, Decl(index.js, 1, 29)) - >Thing : Symbol(Thing, Decl(usage.js, 0, 7)) -->a : Symbol(a, Decl(index.js, 1, 29)) - - /** - * @typedef {Object} LogEntry -@@= skipped -24, +21 lines =@@ +@@= skipped -29, +29 lines =@@ time: Date.now(), >time : Symbol(time, Decl(usage.js, 12, 22)) @@ -26,54 +12,46 @@ type, >type : Symbol(type, Decl(usage.js, 13, 25)) - - }; - }); -- --=== index.js === --/** @enum {string} */ --const Thing = Object.freeze({ +@@= skipped -13, +13 lines =@@ + === index.js === + /** @enum {string} */ + const Thing = Object.freeze({ ->Thing : Symbol(Thing, Decl(index.js, 1, 5), Decl(index.js, 0, 4)) ->Object.freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Thing : Symbol(Thing, Decl(index.js, 1, 5)) ++>Object.freeze : Symbol(freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -- -- a: "thing", -->a : Symbol(a, Decl(index.js, 1, 29)) -- -- b: "chill" -->b : Symbol(b, Decl(index.js, 2, 15)) -- --}); -- --exports.Thing = Thing; -->exports.Thing : Symbol(Thing, Decl(index.js, 4, 3)) ++>freeze : Symbol(freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + + a: "thing", + >a : Symbol(a, Decl(index.js, 1, 29)) +@@= skipped -15, +15 lines =@@ + + exports.Thing = Thing; + >exports.Thing : Symbol(Thing, Decl(index.js, 4, 3)) ->exports : Symbol(Thing, Decl(index.js, 4, 3)) -->Thing : Symbol(Thing, Decl(index.js, 4, 3)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) + >Thing : Symbol(Thing, Decl(index.js, 4, 3)) ->Thing : Symbol(Thing, Decl(index.js, 1, 5), Decl(index.js, 0, 4)) -- --/** -- * @param {Thing} x -- */ --function useThing(x) {} -->useThing : Symbol(useThing, Decl(index.js, 6, 22)) -->x : Symbol(x, Decl(index.js, 11, 18)) -- --exports.useThing = useThing; -->exports.useThing : Symbol(useThing, Decl(index.js, 11, 23)) ++>Thing : Symbol(Thing, Decl(index.js, 1, 5)) + + /** + * @param {Thing} x +@@= skipped -13, +13 lines =@@ + + exports.useThing = useThing; + >exports.useThing : Symbol(useThing, Decl(index.js, 11, 23)) ->exports : Symbol(useThing, Decl(index.js, 11, 23)) -->useThing : Symbol(useThing, Decl(index.js, 11, 23)) -->useThing : Symbol(useThing, Decl(index.js, 6, 22)) -- --/** -- * @param {(x: Thing) => void} x -- */ --function cbThing(x) {} -->cbThing : Symbol(cbThing, Decl(index.js, 13, 28)) -->x : Symbol(x, Decl(index.js, 18, 17)) -- --exports.cbThing = cbThing; -->exports.cbThing : Symbol(cbThing, Decl(index.js, 18, 22)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) + >useThing : Symbol(useThing, Decl(index.js, 11, 23)) + >useThing : Symbol(useThing, Decl(index.js, 6, 22)) + +@@= skipped -13, +13 lines =@@ + + exports.cbThing = cbThing; + >exports.cbThing : Symbol(cbThing, Decl(index.js, 18, 22)) ->exports : Symbol(cbThing, Decl(index.js, 18, 22)) -->cbThing : Symbol(cbThing, Decl(index.js, 18, 22)) -->cbThing : Symbol(cbThing, Decl(index.js, 13, 28)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) + >cbThing : Symbol(cbThing, Decl(index.js, 18, 22)) + >cbThing : Symbol(cbThing, Decl(index.js, 13, 28)) diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types index a845130443..935ccf7ad4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types +++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types @@ -2,19 +2,19 @@ === usage.js === const { Thing, useThing, cbThing } = require("./index"); ->Thing : any ->useThing : any ->cbThing : any ->require("./index") : any +>Thing : Readonly<{ a: "thing"; b: "chill"; }> +>useThing : (x: Thing) => void +>cbThing : (x: (x: Thing) => void) => void +>require("./index") : typeof import("./index") >require : any >"./index" : "./index" useThing(Thing.a); ->useThing(Thing.a) : any ->useThing : any ->Thing.a : any ->Thing : any ->a : any +>useThing(Thing.a) : void +>useThing : (x: Thing) => void +>Thing.a : "thing" +>Thing : Readonly<{ a: "thing"; b: "chill"; }> +>a : "thing" /** * @typedef {Object} LogEntry @@ -23,15 +23,15 @@ useThing(Thing.a); */ cbThing(type => { ->cbThing(type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };}) : any ->cbThing : any ->type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };} : (type: any) => void ->type : any +>cbThing(type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };}) : void +>cbThing : (x: (x: Thing) => void) => void +>type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };} : (type: Thing) => void +>type : Thing /** @type {LogEntry} */ const logEntry = { >logEntry : LogEntry ->{ time: Date.now(), type, } : { time: number; type: any; } +>{ time: Date.now(), type, } : { time: number; type: Thing; } time: Date.now(), >time : number @@ -41,8 +41,63 @@ cbThing(type => { >now : () => number type, ->type : any +>type : Thing }; }); +=== index.js === +/** @enum {string} */ +const Thing = Object.freeze({ +>Thing : Readonly<{ a: "thing"; b: "chill"; }> +>Object.freeze({ a: "thing", b: "chill"}) : Readonly<{ a: "thing"; b: "chill"; }> +>Object.freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } +>Object : ObjectConstructor +>freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } +>{ a: "thing", b: "chill"} : { a: "thing"; b: "chill"; } + + a: "thing", +>a : "thing" +>"thing" : "thing" + + b: "chill" +>b : "chill" +>"chill" : "chill" + +}); + +exports.Thing = Thing; +>exports.Thing = Thing : Readonly<{ a: "thing"; b: "chill"; }> +>exports.Thing : Readonly<{ a: "thing"; b: "chill"; }> +>exports : typeof import(".") +>Thing : Readonly<{ a: "thing"; b: "chill"; }> +>Thing : Readonly<{ a: "thing"; b: "chill"; }> + +/** + * @param {Thing} x + */ +function useThing(x) {} +>useThing : (x: Thing) => void +>x : Thing + +exports.useThing = useThing; +>exports.useThing = useThing : (x: Thing) => void +>exports.useThing : (x: Thing) => void +>exports : typeof import(".") +>useThing : (x: Thing) => void +>useThing : (x: Thing) => void + +/** + * @param {(x: Thing) => void} x + */ +function cbThing(x) {} +>cbThing : (x: (x: Thing) => void) => void +>x : (x: Thing) => void + +exports.cbThing = cbThing; +>exports.cbThing = cbThing : (x: (x: Thing) => void) => void +>exports.cbThing : (x: (x: Thing) => void) => void +>exports : typeof import(".") +>cbThing : (x: (x: Thing) => void) => void +>cbThing : (x: (x: Thing) => void) => void + diff --git a/testdata/baselines/reference/submodule/compiler/missingFunctionImplementation2.js b/testdata/baselines/reference/submodule/compiler/missingFunctionImplementation2.js index e27cdb8eb5..4c554e23c8 100644 --- a/testdata/baselines/reference/submodule/compiler/missingFunctionImplementation2.js +++ b/testdata/baselines/reference/submodule/compiler/missingFunctionImplementation2.js @@ -9,9 +9,9 @@ declare module "./missingFunctionImplementation2_b" { //// [missingFunctionImplementation2_b.ts] export function f(a?, b?); -//// [missingFunctionImplementation2_b.js] +//// [missingFunctionImplementation2_a.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -//// [missingFunctionImplementation2_a.js] +//// [missingFunctionImplementation2_b.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/compiler/missingFunctionImplementation2.js.diff b/testdata/baselines/reference/submodule/compiler/missingFunctionImplementation2.js.diff deleted file mode 100644 index b93cf2426d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/missingFunctionImplementation2.js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.missingFunctionImplementation2.js -+++ new.missingFunctionImplementation2.js -@@= skipped -8, +8 lines =@@ - //// [missingFunctionImplementation2_b.ts] - export function f(a?, b?); - --//// [missingFunctionImplementation2_a.js] -+//// [missingFunctionImplementation2_b.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --//// [missingFunctionImplementation2_b.js] -+//// [missingFunctionImplementation2_a.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDisallowedExtensions.js b/testdata/baselines/reference/submodule/compiler/moduleAugmentationDisallowedExtensions.js index 79a13fcabe..653c0fc501 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDisallowedExtensions.js +++ b/testdata/baselines/reference/submodule/compiler/moduleAugmentationDisallowedExtensions.js @@ -50,6 +50,13 @@ import "./x"; Object.defineProperty(exports, "__esModule", { value: true }); exports.a = void 0; exports.a = 1; +//// [x.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var N1; +(function (N1) { + N1.x = 1; +})(N1 || (N1 = {})); //// [observable.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -60,13 +67,6 @@ exports.x = 1; Object.defineProperty(exports, "__esModule", { value: true }); exports.b = void 0; exports.b = 1; -//// [x.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var N1; -(function (N1) { - N1.x = 1; -})(N1 || (N1 = {})); //// [main.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDisallowedExtensions.js.diff b/testdata/baselines/reference/submodule/compiler/moduleAugmentationDisallowedExtensions.js.diff deleted file mode 100644 index 5c38bd1388..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDisallowedExtensions.js.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.moduleAugmentationDisallowedExtensions.js -+++ new.moduleAugmentationDisallowedExtensions.js -@@= skipped -49, +49 lines =@@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.a = void 0; - exports.a = 1; --//// [x.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --var N1; --(function (N1) { -- N1.x = 1; --})(N1 || (N1 = {})); - //// [observable.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); -@@= skipped -17, +10 lines =@@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.b = void 0; - exports.b = 1; -+//// [x.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+var N1; -+(function (N1) { -+ N1.x = 1; -+})(N1 || (N1 = {})); - //// [main.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt index 03300ec63b..fd2276e9f7 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt @@ -1,14 +1,10 @@ -eslint.config.js(1,29): error TS7016: Could not find a declaration file for module './eslint-plugin-react.js'. 'eslint-plugin-react.js' implicitly has an 'any' type. -eslint.config.js(2,26): error TS7016: Could not find a declaration file for module './typescript-eslint.js'. 'typescript-eslint.js' implicitly has an 'any' type. +typescript-eslint.js(12,17): error TS7019: Rest parameter 'configs' implicitly has an 'any[]' type. +typescript-eslint.js(14,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== eslint.config.js (2 errors) ==== +==== eslint.config.js (0 errors) ==== const eslintReact = require('./eslint-plugin-react.js'); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './eslint-plugin-react.js'. 'eslint-plugin-react.js' implicitly has an 'any' type. const tseslint = require('./typescript-eslint.js'); - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './typescript-eslint.js'. 'typescript-eslint.js' implicitly has an 'any' type. tseslint.config(eslintReact) @@ -30,7 +26,7 @@ eslint.config.js(2,26): error TS7016: Could not find a declaration file for modu }, }; -==== typescript-eslint.js (0 errors) ==== +==== typescript-eslint.js (2 errors) ==== /** * @typedef {{ rules: Record }} Plugin */ @@ -43,6 +39,10 @@ eslint.config.js(2,26): error TS7016: Could not find a declaration file for modu * @type {(...configs: Config[]) => void} */ function config(...configs) { } + ~~~~~~~~~~ +!!! error TS7019: Rest parameter 'configs' implicitly has an 'any[]' type. module.exports = { config }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols index e05a7fe633..5ea722d79d 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols +++ b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols @@ -4,12 +4,75 @@ const eslintReact = require('./eslint-plugin-react.js'); >eslintReact : Symbol(eslintReact, Decl(eslint.config.js, 0, 5)) >require : Symbol(require) +>'./eslint-plugin-react.js' : Symbol("eslint-plugin-react", Decl(eslint-plugin-react.js, 0, 0)) const tseslint = require('./typescript-eslint.js'); >tseslint : Symbol(tseslint, Decl(eslint.config.js, 1, 5)) >require : Symbol(require) +>'./typescript-eslint.js' : Symbol("typescript-eslint", Decl(typescript-eslint.js, 0, 0)) tseslint.config(eslintReact) +>tseslint.config : Symbol(config, Decl(typescript-eslint.js, 13, 18)) >tseslint : Symbol(tseslint, Decl(eslint.config.js, 1, 5)) +>config : Symbol(config, Decl(typescript-eslint.js, 13, 18)) >eslintReact : Symbol(eslintReact, Decl(eslint.config.js, 0, 5)) +=== eslint-plugin-react.js === +const deprecatedRules = { +>deprecatedRules : Symbol(deprecatedRules, Decl(eslint-plugin-react.js, 0, 5)) + + "jsx-sort-default-props": true +>"jsx-sort-default-props" : Symbol("jsx-sort-default-props", Decl(eslint-plugin-react.js, 0, 25)) +} + +const allRules = { +>allRules : Symbol(allRules, Decl(eslint-plugin-react.js, 4, 5)) + + 'no-unsafe': true +>'no-unsafe' : Symbol('no-unsafe', Decl(eslint-plugin-react.js, 4, 18)) +} + +module.exports = { +>module.exports : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1)) + + plugins: { +>plugins : Symbol(plugins, Decl(eslint-plugin-react.js, 8, 18)) + + react: { +>react : Symbol(react, Decl(eslint-plugin-react.js, 9, 12)) + + deprecatedRules, +>deprecatedRules : Symbol(deprecatedRules, Decl(eslint-plugin-react.js, 10, 12)) + + rules: allRules, +>rules : Symbol(rules, Decl(eslint-plugin-react.js, 11, 22)) +>allRules : Symbol(allRules, Decl(eslint-plugin-react.js, 4, 5)) + + }, + }, +}; + +=== typescript-eslint.js === +/** + * @typedef {{ rules: Record }} Plugin + */ + +/** + * @typedef {{ plugins: Record }} Config + */ + +/** + * @type {(...configs: Config[]) => void} + */ +function config(...configs) { } +>config : Symbol(config, Decl(typescript-eslint.js, 0, 0)) +>configs : Symbol(configs, Decl(typescript-eslint.js, 11, 16)) + +module.exports = { config }; +>module.exports : Symbol(export=, Decl(typescript-eslint.js, 11, 31)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(typescript-eslint.js, 11, 31)) +>config : Symbol(config, Decl(typescript-eslint.js, 13, 18)) + diff --git a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols.diff b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols.diff index d14a3ca0fe..c3a004ee08 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols.diff @@ -1,77 +1,40 @@ --- old.moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols +++ new.moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols -@@= skipped -3, +3 lines =@@ - const eslintReact = require('./eslint-plugin-react.js'); - >eslintReact : Symbol(eslintReact, Decl(eslint.config.js, 0, 5)) - >require : Symbol(require) -->'./eslint-plugin-react.js' : Symbol("eslint-plugin-react", Decl(eslint-plugin-react.js, 0, 0)) - +@@= skipped -8, +8 lines =@@ const tseslint = require('./typescript-eslint.js'); >tseslint : Symbol(tseslint, Decl(eslint.config.js, 1, 5)) >require : Symbol(require) ->'./typescript-eslint.js' : Symbol(tseslint, Decl(typescript-eslint.js, 0, 0)) ++>'./typescript-eslint.js' : Symbol("typescript-eslint", Decl(typescript-eslint.js, 0, 0)) tseslint.config(eslintReact) ->tseslint.config : Symbol(tseslint.config, Decl(typescript-eslint.js, 13, 18)) ++>tseslint.config : Symbol(config, Decl(typescript-eslint.js, 13, 18)) >tseslint : Symbol(tseslint, Decl(eslint.config.js, 1, 5)) ->config : Symbol(tseslint.config, Decl(typescript-eslint.js, 13, 18)) ++>config : Symbol(config, Decl(typescript-eslint.js, 13, 18)) >eslintReact : Symbol(eslintReact, Decl(eslint.config.js, 0, 5)) -- --=== eslint-plugin-react.js === --const deprecatedRules = { -->deprecatedRules : Symbol(deprecatedRules, Decl(eslint-plugin-react.js, 0, 5)) -- -- "jsx-sort-default-props": true -->"jsx-sort-default-props" : Symbol("jsx-sort-default-props", Decl(eslint-plugin-react.js, 0, 25)) --} -- --const allRules = { -->allRules : Symbol(allRules, Decl(eslint-plugin-react.js, 4, 5)) -- -- 'no-unsafe': true -->'no-unsafe' : Symbol('no-unsafe', Decl(eslint-plugin-react.js, 4, 18)) --} -- --module.exports = { + + === eslint-plugin-react.js === +@@= skipped -24, +24 lines =@@ + } + + module.exports = { ->module.exports : Symbol(module.exports, Decl(eslint-plugin-react.js, 0, 0)) ->module : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1)) -->exports : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1)) -- -- plugins: { -->plugins : Symbol(plugins, Decl(eslint-plugin-react.js, 8, 18)) -- -- react: { -->react : Symbol(react, Decl(eslint-plugin-react.js, 9, 12)) -- -- deprecatedRules, -->deprecatedRules : Symbol(deprecatedRules, Decl(eslint-plugin-react.js, 10, 12)) -- -- rules: allRules, -->rules : Symbol(rules, Decl(eslint-plugin-react.js, 11, 22)) -->allRules : Symbol(allRules, Decl(eslint-plugin-react.js, 4, 5)) -- -- }, -- }, --}; -- --=== typescript-eslint.js === --/** -- * @typedef {{ rules: Record }} Plugin -- */ -- --/** -- * @typedef {{ plugins: Record }} Config -- */ -- --/** -- * @type {(...configs: Config[]) => void} -- */ --function config(...configs) { } -->config : Symbol(config, Decl(typescript-eslint.js, 0, 0)) -->configs : Symbol(configs, Decl(typescript-eslint.js, 11, 16)) -- --module.exports = { config }; ++>module.exports : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1)) + + plugins: { +@@= skipped -38, +38 lines =@@ + >configs : Symbol(configs, Decl(typescript-eslint.js, 11, 16)) + + module.exports = { config }; ->module.exports : Symbol(module.exports, Decl(typescript-eslint.js, 0, 0)) ->module : Symbol(module, Decl(typescript-eslint.js, 11, 31)) ->exports : Symbol(module.exports, Decl(typescript-eslint.js, 0, 0)) -->config : Symbol(config, Decl(typescript-eslint.js, 13, 18)) ++>module.exports : Symbol(export=, Decl(typescript-eslint.js, 11, 31)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(typescript-eslint.js, 11, 31)) + >config : Symbol(config, Decl(typescript-eslint.js, 13, 18)) diff --git a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types index 464fc0be72..b805edc844 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types +++ b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types @@ -2,21 +2,90 @@ === eslint.config.js === const eslintReact = require('./eslint-plugin-react.js'); ->eslintReact : any ->require('./eslint-plugin-react.js') : any +>eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } +>require('./eslint-plugin-react.js') : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } >require : any >'./eslint-plugin-react.js' : "./eslint-plugin-react.js" const tseslint = require('./typescript-eslint.js'); ->tseslint : any ->require('./typescript-eslint.js') : any +>tseslint : { config: (...configs: any[]) => void; } +>require('./typescript-eslint.js') : { config: (...configs: any[]) => void; } >require : any >'./typescript-eslint.js' : "./typescript-eslint.js" tseslint.config(eslintReact) ->tseslint.config(eslintReact) : any ->tseslint.config : any ->tseslint : any ->config : any ->eslintReact : any +>tseslint.config(eslintReact) : void +>tseslint.config : (...configs: any[]) => void +>tseslint : { config: (...configs: any[]) => void; } +>config : (...configs: any[]) => void +>eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } + +=== eslint-plugin-react.js === +const deprecatedRules = { +>deprecatedRules : { "jsx-sort-default-props": boolean; } +>{ "jsx-sort-default-props": true} : { "jsx-sort-default-props": boolean; } + + "jsx-sort-default-props": true +>"jsx-sort-default-props" : boolean +>true : true +} + +const allRules = { +>allRules : { "no-unsafe": boolean; } +>{ 'no-unsafe': true} : { "no-unsafe": boolean; } + + 'no-unsafe': true +>'no-unsafe' : boolean +>true : true +} + +module.exports = { +>module.exports = { plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } +>module.exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } +>module : { "export=": { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; }; } +>exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } +>{ plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } + + plugins: { +>plugins : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; } +>{ react: { deprecatedRules, rules: allRules, }, } : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; } + + react: { +>react : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; } +>{ deprecatedRules, rules: allRules, } : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; } + + deprecatedRules, +>deprecatedRules : { "jsx-sort-default-props": boolean; } + + rules: allRules, +>rules : { "no-unsafe": boolean; } +>allRules : { "no-unsafe": boolean; } + + }, + }, +}; + +=== typescript-eslint.js === +/** + * @typedef {{ rules: Record }} Plugin + */ + +/** + * @typedef {{ plugins: Record }} Config + */ + +/** + * @type {(...configs: Config[]) => void} + */ +function config(...configs) { } +>config : (...configs: any[]) => void +>configs : any[] + +module.exports = { config }; +>module.exports = { config } : { config: (...configs: any[]) => void; } +>module.exports : { config: (...configs: any[]) => void; } +>module : { "export=": { config: (...configs: any[]) => void; }; } +>exports : { config: (...configs: any[]) => void; } +>{ config } : { config: (...configs: any[]) => void; } +>config : (...configs: any[]) => void diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionNoResolve.js b/testdata/baselines/reference/submodule/compiler/moduleResolutionNoResolve.js index c56c3bd15a..805d4925a2 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionNoResolve.js +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionNoResolve.js @@ -7,11 +7,11 @@ import a = require('./b'); export var c = ''; +//// [a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); //// [b.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.c = void 0; exports.c = ''; -//// [a.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionNoResolve.js.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionNoResolve.js.diff deleted file mode 100644 index ea3a587f95..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionNoResolve.js.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.moduleResolutionNoResolve.js -+++ new.moduleResolutionNoResolve.js -@@= skipped -6, +6 lines =@@ - export var c = ''; - - --//// [a.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); - //// [b.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.c = void 0; - exports.c = ''; -+//// [a.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt index a033a08480..b756d61a76 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt @@ -1,10 +1,10 @@ -/a.ts(1,17): error TS2306: File '/tsx.tsx' is not a module. +/a.ts(1,17): error TS2307: Cannot find module './tsx' or its corresponding type declarations. ==== /a.ts (1 errors) ==== import tsx from "./tsx"; // Not allowed. ~~~~~~~ -!!! error TS2306: File '/tsx.tsx' is not a module. +!!! error TS2307: Cannot find module './tsx' or its corresponding type declarations. import jsx from "./jsx"; // Not allowed. import js from "./js"; // OK because it's an untyped module. diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt.diff index 2c86f94389..ac4179cf7c 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt.diff @@ -6,14 +6,14 @@ - - -==== /a.ts (2 errors) ==== -+/a.ts(1,17): error TS2306: File '/tsx.tsx' is not a module. ++/a.ts(1,17): error TS2307: Cannot find module './tsx' or its corresponding type declarations. + + +==== /a.ts (1 errors) ==== import tsx from "./tsx"; // Not allowed. ~~~~~~~ -!!! error TS6142: Module './tsx' was resolved to '/tsx.tsx', but '--jsx' is not set. -+!!! error TS2306: File '/tsx.tsx' is not a module. ++!!! error TS2307: Cannot find module './tsx' or its corresponding type declarations. import jsx from "./jsx"; // Not allowed. - ~~~~~~~ -!!! error TS6142: Module './jsx' was resolved to '/jsx.jsx', but '--jsx' is not set. diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.js b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.js index 227fbc2f1c..66c323b005 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.js +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.js @@ -12,7 +12,6 @@ import jsx from "./jsx"; // Not allowed. import js from "./js"; // OK because it's an untyped module. -//// [tsx.js] //// [a.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.js.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.js.diff deleted file mode 100644 index b70735a823..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.moduleResolutionWithExtensions_notSupported.js -+++ new.moduleResolutionWithExtensions_notSupported.js -@@= skipped -11, +11 lines =@@ - import js from "./js"; // OK because it's an untyped module. - - -+//// [tsx.js] - //// [a.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.symbols b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.symbols index 7bc8195165..0a10d073ac 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.symbols +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.symbols @@ -10,5 +10,3 @@ import jsx from "./jsx"; // Not allowed. import js from "./js"; // OK because it's an untyped module. >js : Symbol(js, Decl(a.ts, 2, 6)) -=== /tsx.tsx === - diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.symbols.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.symbols.diff deleted file mode 100644 index 5b29a22046..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.symbols.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.moduleResolutionWithExtensions_notSupported.symbols -+++ new.moduleResolutionWithExtensions_notSupported.symbols -@@= skipped -9, +9 lines =@@ - import js from "./js"; // OK because it's an untyped module. - >js : Symbol(js, Decl(a.ts, 2, 6)) - -+=== /tsx.tsx === -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.types b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.types index b5d9603425..60c5e5876b 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.types +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.types @@ -10,5 +10,3 @@ import jsx from "./jsx"; // Not allowed. import js from "./js"; // OK because it's an untyped module. >js : any -=== /tsx.tsx === - diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.types.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.types.diff deleted file mode 100644 index 05b174fd9c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.types.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.moduleResolutionWithExtensions_notSupported.types -+++ new.moduleResolutionWithExtensions_notSupported.types -@@= skipped -9, +9 lines =@@ - import js from "./js"; // OK because it's an untyped module. - >js : any - -+=== /tsx.tsx === -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols index f2913b8182..952599a809 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols +++ b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols @@ -4,3 +4,9 @@ import { x } from "../node_modules/foo"; >x : Symbol(x, Decl(index.ts, 0, 8)) +=== /node_modules/foo/index.js === +exports.x = 0; +>exports.x : Symbol(x, Decl(index.js, 0, 0)) +>exports : Symbol("/node_modules/foo/index", Decl(index.js, 0, 0)) +>x : Symbol(x, Decl(index.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols.diff b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols.diff index 48ff1bbf6e..ec3db09aa2 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols.diff @@ -1,12 +1,9 @@ --- old.moduleResolution_explicitNodeModulesImport.symbols +++ new.moduleResolution_explicitNodeModulesImport.symbols -@@= skipped -3, +3 lines =@@ - import { x } from "../node_modules/foo"; - >x : Symbol(x, Decl(index.ts, 0, 8)) - --=== /node_modules/foo/index.js === --exports.x = 0; -->exports.x : Symbol(x, Decl(index.js, 0, 0)) +@@= skipped -6, +6 lines =@@ + === /node_modules/foo/index.js === + exports.x = 0; + >exports.x : Symbol(x, Decl(index.js, 0, 0)) ->exports : Symbol(x, Decl(index.js, 0, 0)) -->x : Symbol(x, Decl(index.js, 0, 0)) -- \ No newline at end of file ++>exports : Symbol("/node_modules/foo/index", Decl(index.js, 0, 0)) + >x : Symbol(x, Decl(index.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.types b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.types index 2a2ce37bc4..67d34851b5 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.types +++ b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.types @@ -2,5 +2,13 @@ === /src/index.ts === import { x } from "../node_modules/foo"; ->x : any +>x : 0 + +=== /node_modules/foo/index.js === +exports.x = 0; +>exports.x = 0 : 0 +>exports.x : 0 +>exports : typeof import("foo") +>x : 0 +>0 : 0 diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.types.diff b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.types.diff deleted file mode 100644 index 630fd31648..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.moduleResolution_explicitNodeModulesImport.types -+++ new.moduleResolution_explicitNodeModulesImport.types -@@= skipped -1, +1 lines =@@ - - === /src/index.ts === - import { x } from "../node_modules/foo"; -->x : 0 -- --=== /node_modules/foo/index.js === --exports.x = 0; -->exports.x = 0 : 0 -->exports.x : 0 -->exports : typeof import("/node_modules/foo/index") -->x : 0 -->0 : 0 -+>x : any diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols index 0c7788ec5f..6e0b0e75fc 100644 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols +++ b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols @@ -11,3 +11,7 @@ import { bar } from "/bar"; export function foo() {} >foo : Symbol(foo, Decl(foo.ts, 0, 0)) +=== /bar.js === +export function bar() {} +>bar : Symbol(bar, Decl(bar.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols.diff b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols.diff deleted file mode 100644 index c30898bf6f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols -+++ new.pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols -@@= skipped -10, +10 lines =@@ - export function foo() {} - >foo : Symbol(foo, Decl(foo.ts, 0, 0)) - --=== /bar.js === --export function bar() {} -->bar : Symbol(bar, Decl(bar.js, 0, 0)) -- \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types index 8912ae5e8d..e189dff5ab 100644 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types +++ b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types @@ -5,9 +5,13 @@ import { foo } from "/foo"; >foo : () => void import { bar } from "/bar"; ->bar : any +>bar : () => void === /foo.ts === export function foo() {} >foo : () => void +=== /bar.js === +export function bar() {} +>bar : () => void + diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types.diff b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types.diff deleted file mode 100644 index 67dd6a4fda..0000000000 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types -+++ new.pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types -@@= skipped -4, +4 lines =@@ - >foo : () => void - - import { bar } from "/bar"; -->bar : () => void -+>bar : any - - === /foo.ts === - export function foo() {} - >foo : () => void -- --=== /bar.js === --export function bar() {} -->bar : () => void diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols index 24988bbfbe..d048de95e6 100644 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols +++ b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols @@ -11,3 +11,7 @@ import { bar } from "/bar"; export function foo() {} >foo : Symbol(foo, Decl(foo.ts, 0, 0)) +=== /bar.js === +export function bar() {} +>bar : Symbol(bar, Decl(bar.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols.diff b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols.diff deleted file mode 100644 index cc74837d30..0000000000 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols -+++ new.pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols -@@= skipped -10, +10 lines =@@ - export function foo() {} - >foo : Symbol(foo, Decl(foo.ts, 0, 0)) - --=== /bar.js === --export function bar() {} -->bar : Symbol(bar, Decl(bar.js, 0, 0)) -- \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types index b2a131dd24..54630514ac 100644 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types +++ b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types @@ -5,9 +5,13 @@ import { foo } from "/foo"; >foo : () => void import { bar } from "/bar"; ->bar : any +>bar : () => void === /foo.ts === export function foo() {} >foo : () => void +=== /bar.js === +export function bar() {} +>bar : () => void + diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types.diff b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types.diff deleted file mode 100644 index c9aa92e057..0000000000 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types -+++ new.pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types -@@= skipped -4, +4 lines =@@ - >foo : () => void - - import { bar } from "/bar"; -->bar : () => void -+>bar : any - - === /foo.ts === - export function foo() {} - >foo : () => void -- --=== /bar.js === --export function bar() {} -->bar : () => void diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.errors.txt b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.errors.txt index ce6e3565a7..247aaa31b5 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.errors.txt @@ -1,11 +1,10 @@ /user.js(2,7): error TS2339: Property 'b' does not exist on type '{ a: number; }'. /user.js(5,7): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: number; }'. -/user.js(8,21): error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. /user.js(9,7): error TS2339: Property 'b' does not exist on type '{ a: number; }'. -/user.js(12,21): error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. +/user.js(12,7): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: number; }'. -==== /user.js (5 errors) ==== +==== /user.js (4 errors) ==== const json0 = require("./json.json"); json0.b; // Error (good) ~ @@ -19,16 +18,15 @@ json1.b; // No error (OK since that's the type annotation) const js0 = require("./js.js"); - ~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. json0.b; // Error (good) ~ !!! error TS2339: Property 'b' does not exist on type '{ a: number; }'. /** @type {{ b: number }} */ const js1 = require("./js.js"); // Error (good) - ~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. + ~~~ +!!! error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: number; }'. +!!! related TS2728 /user.js:11:14: 'b' is declared here. js1.b; ==== /json.json (0 errors) ==== { "a": 0 } diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols index ce9272af12..9f3eb97f2f 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols @@ -22,6 +22,7 @@ json1.b; // No error (OK since that's the type annotation) const js0 = require("./js.js"); >js0 : Symbol(js0, Decl(user.js, 7, 5)) >require : Symbol(require) +>"./js.js" : Symbol("/js", Decl(js.js, 0, 0)) json0.b; // Error (good) >json0 : Symbol(json0, Decl(user.js, 0, 5)) @@ -40,3 +41,10 @@ js1.b; { "a": 0 } >"a" : Symbol("a", Decl(json.json, 0, 1)) +=== /js.js === +module.exports = { a: 0 }; +>module.exports : Symbol(export=, Decl(js.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(js.js, 0, 0)) +>a : Symbol(a, Decl(js.js, 0, 18)) + diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff index f07c1f94db..4c49920155 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff @@ -8,15 +8,7 @@ json1.b; // No error (OK since that's the type annotation) >json1.b : Symbol(b, Decl(user.js, 3, 12)) -@@= skipped -10, +9 lines =@@ - const js0 = require("./js.js"); - >js0 : Symbol(js0, Decl(user.js, 7, 5)) - >require : Symbol(require) -->"./js.js" : Symbol("/js", Decl(js.js, 0, 0)) - - json0.b; // Error (good) - >json0 : Symbol(json0, Decl(user.js, 0, 5)) -@@= skipped -9, +8 lines =@@ +@@= skipped -19, +18 lines =@@ const js1 = require("./js.js"); // Error (good) >js1 : Symbol(js1, Decl(user.js, 11, 5)) >require : Symbol(require) @@ -24,14 +16,13 @@ js1.b; >js1.b : Symbol(b, Decl(user.js, 10, 12)) -@@= skipped -10, +9 lines =@@ - === /json.json === - { "a": 0 } - >"a" : Symbol("a", Decl(json.json, 0, 1)) -- --=== /js.js === --module.exports = { a: 0 }; +@@= skipped -13, +12 lines =@@ + + === /js.js === + module.exports = { a: 0 }; ->module.exports : Symbol(module.exports, Decl(js.js, 0, 0)) ->module : Symbol(export=, Decl(js.js, 0, 0)) -->exports : Symbol(export=, Decl(js.js, 0, 0)) -->a : Symbol(a, Decl(js.js, 0, 18)) ++>module.exports : Symbol(export=, Decl(js.js, 0, 0)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(js.js, 0, 0)) + >a : Symbol(a, Decl(js.js, 0, 18)) diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types index 664584e335..82a79912d2 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types @@ -25,8 +25,8 @@ json1.b; // No error (OK since that's the type annotation) >b : number const js0 = require("./js.js"); ->js0 : any ->require("./js.js") : any +>js0 : { a: number; } +>require("./js.js") : { a: number; } >require : any >"./js.js" : "./js.js" @@ -38,7 +38,7 @@ json0.b; // Error (good) /** @type {{ b: number }} */ const js1 = require("./js.js"); // Error (good) >js1 : { b: number; } ->require("./js.js") : any +>require("./js.js") : { a: number; } >require : any >"./js.js" : "./js.js" @@ -53,3 +53,13 @@ js1.b; >"a" : number >0 : 0 +=== /js.js === +module.exports = { a: 0 }; +>module.exports = { a: 0 } : { a: number; } +>module.exports : { a: number; } +>module : { "export=": { a: number; }; } +>exports : { a: number; } +>{ a: 0 } : { a: number; } +>a : number +>0 : 0 + diff --git a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.errors.txt index 9f96511b1a..54fcff7501 100644 --- a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.errors.txt @@ -1,13 +1,16 @@ -use.js(2,19): error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. +use.js(3,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. +use.js(4,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -==== use.js (1 errors) ==== +==== use.js (2 errors) ==== /// var mod = require('./mod'); - ~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. var a = new mod.A() + ~~~~~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. var b = new mod.B() + ~~~~~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. a.m('nope') b.m('not really') diff --git a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols index 791a5288d2..7d83e2d1a6 100644 --- a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols @@ -5,14 +5,19 @@ var mod = require('./mod'); >mod : Symbol(mod, Decl(use.js, 1, 3)) >require : Symbol(require, Decl(types.d.ts, 0, 0)) +>'./mod' : Symbol("mod", Decl(mod.js, 0, 0)) var a = new mod.A() >a : Symbol(a, Decl(use.js, 2, 3)) +>mod.A : Symbol(A, Decl(mod.js, 6, 1)) >mod : Symbol(mod, Decl(use.js, 1, 3)) +>A : Symbol(A, Decl(mod.js, 6, 1)) var b = new mod.B() >b : Symbol(b, Decl(use.js, 3, 3)) +>mod.B : Symbol(B, Decl(mod.js, 7, 13)) >mod : Symbol(mod, Decl(use.js, 1, 3)) +>B : Symbol(B, Decl(mod.js, 7, 13)) a.m('nope') >a : Symbol(a, Decl(use.js, 2, 3)) @@ -28,3 +33,47 @@ declare function require(name: string): any; declare var exports: any; >exports : Symbol(exports, Decl(types.d.ts, 1, 11)) +=== mod.js === +/// +var A = function A() { +>A : Symbol(A, Decl(mod.js, 1, 3)) +>A : Symbol(A, Decl(mod.js, 1, 7)) + + this.a = 1 +} +var B = function B() { +>B : Symbol(B, Decl(mod.js, 4, 3)) +>B : Symbol(B, Decl(mod.js, 4, 7)) + + this.b = 2 +} +exports.A = A +>exports.A : Symbol(A, Decl(mod.js, 6, 1)) +>exports : Symbol("mod", Decl(mod.js, 0, 0)) +>A : Symbol(A, Decl(mod.js, 6, 1)) +>A : Symbol(A, Decl(mod.js, 1, 3)) + +exports.B = B +>exports.B : Symbol(B, Decl(mod.js, 7, 13)) +>exports : Symbol("mod", Decl(mod.js, 0, 0)) +>B : Symbol(B, Decl(mod.js, 7, 13)) +>B : Symbol(B, Decl(mod.js, 4, 3)) + +A.prototype = B.prototype = { +>A.prototype : Symbol(prototype, Decl(mod.js, 8, 13)) +>A : Symbol(A, Decl(mod.js, 1, 3)) +>prototype : Symbol(prototype, Decl(mod.js, 8, 13)) +>B.prototype : Symbol(prototype, Decl(mod.js, 9, 13)) +>B : Symbol(B, Decl(mod.js, 4, 3)) +>prototype : Symbol(prototype, Decl(mod.js, 9, 13)) + + /** @param {number} n */ + m(n) { +>m : Symbol(m, Decl(mod.js, 9, 29)) +>n : Symbol(n, Decl(mod.js, 11, 6)) + + return n + 1 +>n : Symbol(n, Decl(mod.js, 11, 6)) + } +} + diff --git a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols.diff index e1ca2a180b..678af985d9 100644 --- a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols.diff @@ -5,18 +5,23 @@ >mod : Symbol(mod, Decl(use.js, 1, 3)) >require : Symbol(require, Decl(types.d.ts, 0, 0)) ->'./mod' : Symbol(mod, Decl(mod.js, 0, 0)) ++>'./mod' : Symbol("mod", Decl(mod.js, 0, 0)) var a = new mod.A() >a : Symbol(a, Decl(use.js, 2, 3)) ->mod.A : Symbol(mod.A, Decl(mod.js, 6, 1)) ++>mod.A : Symbol(A, Decl(mod.js, 6, 1)) >mod : Symbol(mod, Decl(use.js, 1, 3)) ->A : Symbol(mod.A, Decl(mod.js, 6, 1)) ++>A : Symbol(A, Decl(mod.js, 6, 1)) var b = new mod.B() >b : Symbol(b, Decl(use.js, 3, 3)) ->mod.B : Symbol(mod.B, Decl(mod.js, 7, 13)) ++>mod.B : Symbol(B, Decl(mod.js, 7, 13)) >mod : Symbol(mod, Decl(use.js, 1, 3)) ->B : Symbol(mod.B, Decl(mod.js, 7, 13)) ++>B : Symbol(B, Decl(mod.js, 7, 13)) a.m('nope') ->a.m : Symbol(m, Decl(mod.js, 9, 29)) @@ -30,57 +35,58 @@ === types.d.ts === declare function require(name: string): any; -@@= skipped -31, +22 lines =@@ - - declare var exports: any; - >exports : Symbol(exports, Decl(types.d.ts, 1, 11)) -- --=== mod.js === --/// --var A = function A() { +@@= skipped -35, +31 lines =@@ + === mod.js === + /// + var A = function A() { ->A : Symbol(A, Decl(mod.js, 1, 3), Decl(mod.js, 8, 13)) -->A : Symbol(A, Decl(mod.js, 1, 7)) -- -- this.a = 1 ++>A : Symbol(A, Decl(mod.js, 1, 3)) + >A : Symbol(A, Decl(mod.js, 1, 7)) + + this.a = 1 ->this.a : Symbol(A.a, Decl(mod.js, 1, 22)) ->this : Symbol(A, Decl(mod.js, 1, 7)) ->a : Symbol(A.a, Decl(mod.js, 1, 22)) --} --var B = function B() { + } + var B = function B() { ->B : Symbol(B, Decl(mod.js, 4, 3), Decl(mod.js, 9, 13)) -->B : Symbol(B, Decl(mod.js, 4, 7)) -- -- this.b = 2 ++>B : Symbol(B, Decl(mod.js, 4, 3)) + >B : Symbol(B, Decl(mod.js, 4, 7)) + + this.b = 2 ->this.b : Symbol(B.b, Decl(mod.js, 4, 22)) ->this : Symbol(B, Decl(mod.js, 4, 7)) ->b : Symbol(B.b, Decl(mod.js, 4, 22)) --} --exports.A = A -->exports.A : Symbol(A, Decl(mod.js, 6, 1)) + } + exports.A = A + >exports.A : Symbol(A, Decl(mod.js, 6, 1)) ->exports : Symbol(A, Decl(mod.js, 6, 1)) -->A : Symbol(A, Decl(mod.js, 6, 1)) ++>exports : Symbol("mod", Decl(mod.js, 0, 0)) + >A : Symbol(A, Decl(mod.js, 6, 1)) ->A : Symbol(A, Decl(mod.js, 1, 3), Decl(mod.js, 8, 13)) -- --exports.B = B -->exports.B : Symbol(B, Decl(mod.js, 7, 13)) ++>A : Symbol(A, Decl(mod.js, 1, 3)) + + exports.B = B + >exports.B : Symbol(B, Decl(mod.js, 7, 13)) ->exports : Symbol(B, Decl(mod.js, 7, 13)) -->B : Symbol(B, Decl(mod.js, 7, 13)) ++>exports : Symbol("mod", Decl(mod.js, 0, 0)) + >B : Symbol(B, Decl(mod.js, 7, 13)) ->B : Symbol(B, Decl(mod.js, 4, 3), Decl(mod.js, 9, 13)) -- --A.prototype = B.prototype = { ++>B : Symbol(B, Decl(mod.js, 4, 3)) + + A.prototype = B.prototype = { ->A.prototype : Symbol(A.prototype, Decl(mod.js, 8, 13)) ->A : Symbol(A, Decl(mod.js, 1, 3), Decl(mod.js, 8, 13)) ->prototype : Symbol(A.prototype, Decl(mod.js, 8, 13)) ->B.prototype : Symbol(B.prototype, Decl(mod.js, 9, 13)) ->B : Symbol(B, Decl(mod.js, 4, 3), Decl(mod.js, 9, 13)) ->prototype : Symbol(B.prototype, Decl(mod.js, 9, 13)) -- -- /** @param {number} n */ -- m(n) { -->m : Symbol(m, Decl(mod.js, 9, 29)) -->n : Symbol(n, Decl(mod.js, 11, 6)) -- -- return n + 1 -->n : Symbol(n, Decl(mod.js, 11, 6)) -- } --} ++>A.prototype : Symbol(prototype, Decl(mod.js, 8, 13)) ++>A : Symbol(A, Decl(mod.js, 1, 3)) ++>prototype : Symbol(prototype, Decl(mod.js, 8, 13)) ++>B.prototype : Symbol(prototype, Decl(mod.js, 9, 13)) ++>B : Symbol(B, Decl(mod.js, 4, 3)) ++>prototype : Symbol(prototype, Decl(mod.js, 9, 13)) + + /** @param {number} n */ + m(n) { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.types b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.types index a3627f661a..4dbebc0c05 100644 --- a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.types @@ -3,24 +3,24 @@ === use.js === /// var mod = require('./mod'); ->mod : any ->require('./mod') : any +>mod : typeof mod +>require('./mod') : typeof mod >require : (name: string) => any >'./mod' : "./mod" var a = new mod.A() >a : any >new mod.A() : any ->mod.A : any ->mod : any ->A : any +>mod.A : { (): void; prototype: { m(n: number): number; }; } +>mod : typeof mod +>A : { (): void; prototype: { m(n: number): number; }; } var b = new mod.B() >b : any >new mod.B() : any ->mod.B : any ->mod : any ->B : any +>mod.B : { (): void; prototype: { m(n: number): number; }; } +>mod : typeof mod +>B : { (): void; prototype: { m(n: number): number; }; } a.m('nope') >a.m('nope') : any @@ -44,3 +44,66 @@ declare function require(name: string): any; declare var exports: any; >exports : any +=== mod.js === +/// +var A = function A() { +>A : { (): void; prototype: { m(n: number): number; }; } +>function A() { this.a = 1} : { (): void; prototype: { m(n: number): number; }; } +>A : { (): void; prototype: { m(n: number): number; }; } + + this.a = 1 +>this.a = 1 : 1 +>this.a : any +>this : any +>a : any +>1 : 1 +} +var B = function B() { +>B : { (): void; prototype: { m(n: number): number; }; } +>function B() { this.b = 2} : { (): void; prototype: { m(n: number): number; }; } +>B : { (): void; prototype: { m(n: number): number; }; } + + this.b = 2 +>this.b = 2 : 2 +>this.b : any +>this : any +>b : any +>2 : 2 +} +exports.A = A +>exports.A = A : { (): void; prototype: { m(n: number): number; }; } +>exports.A : { (): void; prototype: { m(n: number): number; }; } +>exports : typeof import("./mod") +>A : { (): void; prototype: { m(n: number): number; }; } +>A : { (): void; prototype: { m(n: number): number; }; } + +exports.B = B +>exports.B = B : { (): void; prototype: { m(n: number): number; }; } +>exports.B : { (): void; prototype: { m(n: number): number; }; } +>exports : typeof import("./mod") +>B : { (): void; prototype: { m(n: number): number; }; } +>B : { (): void; prototype: { m(n: number): number; }; } + +A.prototype = B.prototype = { +>A.prototype = B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } +>A.prototype : { m(n: number): number; } +>A : { (): void; prototype: { m(n: number): number; }; } +>prototype : { m(n: number): number; } +>B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } +>B.prototype : { m(n: number): number; } +>B : { (): void; prototype: { m(n: number): number; }; } +>prototype : { m(n: number): number; } +>{ /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } + + /** @param {number} n */ + m(n) { +>m : (n: number) => number +>n : number + + return n + 1 +>n + 1 : number +>n : number +>1 : 1 + } +} + diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.errors.txt b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.errors.txt index 01aee03b63..db9ca448b3 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.errors.txt @@ -1,5 +1,17 @@ -validator.ts(3,21): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. -validator.ts(23,21): error TS7016: Could not find a declaration file for module './mod2'. 'mod2.js' implicitly has an 'any' type. +index.js(4,19): error TS2306: File 'mod1.js' is not a module. +index.js(9,19): error TS2306: File 'mod2.js' is not a module. +mod1.js(1,23): error TS2304: Cannot find name 'exports'. +mod1.js(2,23): error TS2304: Cannot find name 'exports'. +mod1.js(3,23): error TS2304: Cannot find name 'exports'. +mod1.js(4,23): error TS2304: Cannot find name 'exports'. +mod1.js(5,23): error TS2304: Cannot find name 'exports'. +mod2.js(1,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +mod2.js(2,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +mod2.js(3,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +mod2.js(4,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +mod2.js(5,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +validator.ts(3,21): error TS2306: File 'mod1.js' is not a module. +validator.ts(23,21): error TS2306: File 'mod2.js' is not a module. ==== validator.ts (2 errors) ==== @@ -7,7 +19,7 @@ validator.ts(23,21): error TS7016: Could not find a declaration file for module import m1 = require("./mod1"); ~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. +!!! error TS2306: File 'mod1.js' is not a module. m1.thing; m1.readonlyProp; @@ -29,7 +41,7 @@ validator.ts(23,21): error TS7016: Could not find a declaration file for module import m2 = require("./mod2"); ~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './mod2'. 'mod2.js' implicitly has an 'any' type. +!!! error TS2306: File 'mod2.js' is not a module. m2.thing; m2.readonlyProp; @@ -49,38 +61,62 @@ validator.ts(23,21): error TS7016: Could not find a declaration file for module m2.rwAccessors = "no"; m2.setonlyAccessor = 0; -==== mod1.js (0 errors) ==== +==== mod1.js (5 errors) ==== Object.defineProperty(exports, "thing", { value: 42, writable: true }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. Object.defineProperty(exports, "setonlyAccessor", { + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. /** @param {string} str */ set(str) { this.rwAccessors = Number(str) } }); -==== mod2.js (0 errors) ==== +==== mod2.js (5 errors) ==== Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. Object.defineProperty(module.exports, "setonlyAccessor", { + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @param {string} str */ set(str) { this.rwAccessors = Number(str) } }); -==== index.js (0 errors) ==== +==== index.js (2 errors) ==== /** * @type {number} */ const q = require("./mod1").thing; + ~~~~~~~~ +!!! error TS2306: File 'mod1.js' is not a module. /** * @type {string} */ const u = require("./mod2").thing; + ~~~~~~~~ +!!! error TS2306: File 'mod2.js' is not a module. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.errors.txt.diff deleted file mode 100644 index 4643514dff..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.errors.txt.diff +++ /dev/null @@ -1,75 +0,0 @@ ---- old.checkExportsObjectAssignProperty.errors.txt -+++ new.checkExportsObjectAssignProperty.errors.txt -@@= skipped -0, +0 lines =@@ --validator.ts(17,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. --validator.ts(18,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. --validator.ts(19,1): error TS2322: Type 'string' is not assignable to type 'number'. --validator.ts(20,1): error TS2322: Type 'string' is not assignable to type 'number'. --validator.ts(21,1): error TS2322: Type 'number' is not assignable to type 'string'. --validator.ts(37,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. --validator.ts(38,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. --validator.ts(39,1): error TS2322: Type 'number' is not assignable to type 'string'. --validator.ts(40,1): error TS2322: Type 'string' is not assignable to type 'number'. --validator.ts(41,1): error TS2322: Type 'number' is not assignable to type 'string'. -- -- --==== validator.ts (10 errors) ==== -+validator.ts(3,21): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. -+validator.ts(23,21): error TS7016: Could not find a declaration file for module './mod2'. 'mod2.js' implicitly has an 'any' type. -+ -+ -+==== validator.ts (2 errors) ==== - import "./"; - - import m1 = require("./mod1"); -+ ~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. - - m1.thing; - m1.readonlyProp; -@@= skipped -27, +21 lines =@@ - - // disallowed assignments - m1.readonlyProp = "name"; -- ~~~~~~~~~~~~ --!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. - m1.readonlyAccessor = 12; -- ~~~~~~~~~~~~~~~~ --!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. - m1.thing = "no"; -- ~~~~~~~~ --!!! error TS2322: Type 'string' is not assignable to type 'number'. - m1.rwAccessors = "no"; -- ~~~~~~~~~~~~~~ --!!! error TS2322: Type 'string' is not assignable to type 'number'. - m1.setonlyAccessor = 0; -- ~~~~~~~~~~~~~~~~~~ --!!! error TS2322: Type 'number' is not assignable to type 'string'. - - import m2 = require("./mod2"); -+ ~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './mod2'. 'mod2.js' implicitly has an 'any' type. - - m2.thing; - m2.readonlyProp; -@@= skipped -30, +22 lines =@@ - - // disallowed assignments - m2.readonlyProp = "name"; -- ~~~~~~~~~~~~ --!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. - m2.readonlyAccessor = 12; -- ~~~~~~~~~~~~~~~~ --!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. - m2.thing = 0; -- ~~~~~~~~ --!!! error TS2322: Type 'number' is not assignable to type 'string'. - m2.rwAccessors = "no"; -- ~~~~~~~~~~~~~~ --!!! error TS2322: Type 'string' is not assignable to type 'number'. - m2.setonlyAccessor = 0; -- ~~~~~~~~~~~~~~~~~~ --!!! error TS2322: Type 'number' is not assignable to type 'string'. - - ==== mod1.js (0 errors) ==== - Object.defineProperty(exports, "thing", { value: 42, writable: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols index 88e351f6fc..6ca428e500 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols @@ -91,3 +91,108 @@ m2.rwAccessors = "no"; m2.setonlyAccessor = 0; >m2 : Symbol(m2, Decl(validator.ts, 20, 23)) +=== mod1.js === +Object.defineProperty(exports, "thing", { value: 42, writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(mod1.js, 0, 41)) +>writable : Symbol(writable, Decl(mod1.js, 0, 52)) + +Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(mod1.js, 1, 48)) +>writable : Symbol(writable, Decl(mod1.js, 1, 64)) + +Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>get : Symbol(get, Decl(mod1.js, 2, 47)) +>set : Symbol(set, Decl(mod1.js, 2, 71)) +>_ : Symbol(_, Decl(mod1.js, 2, 76)) + +Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>get : Symbol(get, Decl(mod1.js, 3, 52)) + +Object.defineProperty(exports, "setonlyAccessor", { +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + + /** @param {string} str */ + set(str) { +>set : Symbol(set, Decl(mod1.js, 4, 51)) +>str : Symbol(str, Decl(mod1.js, 6, 8)) + + this.rwAccessors = Number(str) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>str : Symbol(str, Decl(mod1.js, 6, 8)) + } +}); + +=== mod2.js === +Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(mod2.js, 0, 48)) +>writable : Symbol(writable, Decl(mod2.js, 0, 62)) + +Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(mod2.js, 1, 55)) +>writable : Symbol(writable, Decl(mod2.js, 1, 71)) + +Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>get : Symbol(get, Decl(mod2.js, 2, 54)) +>set : Symbol(set, Decl(mod2.js, 2, 78)) +>_ : Symbol(_, Decl(mod2.js, 2, 83)) + +Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>get : Symbol(get, Decl(mod2.js, 3, 59)) + +Object.defineProperty(module.exports, "setonlyAccessor", { +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + + /** @param {string} str */ + set(str) { +>set : Symbol(set, Decl(mod2.js, 4, 58)) +>str : Symbol(str, Decl(mod2.js, 6, 8)) + + this.rwAccessors = Number(str) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>str : Symbol(str, Decl(mod2.js, 6, 8)) + } +}); + +=== index.js === +/** + * @type {number} + */ +const q = require("./mod1").thing; +>q : Symbol(q, Decl(index.js, 3, 5)) +>require : Symbol(require) + +/** + * @type {string} + */ +const u = require("./mod2").thing; +>u : Symbol(u, Decl(index.js, 8, 5)) +>require : Symbol(require) + diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols.diff index 0c4e0757ea..d162070662 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols.diff @@ -139,146 +139,162 @@ ->m2.setonlyAccessor : Symbol(m2.setonlyAccessor, Decl(mod2.js, 3, 86)) >m2 : Symbol(m2, Decl(validator.ts, 20, 23)) ->setonlyAccessor : Symbol(m2.setonlyAccessor, Decl(mod2.js, 3, 86)) -- --=== mod1.js === --Object.defineProperty(exports, "thing", { value: 42, writable: true }); + + === mod1.js === + Object.defineProperty(exports, "thing", { value: 42, writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"thing" : Symbol(thing, Decl(mod1.js, 0, 0)) -->value : Symbol(value, Decl(mod1.js, 0, 41)) -->writable : Symbol(writable, Decl(mod1.js, 0, 52)) -- --Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >value : Symbol(value, Decl(mod1.js, 0, 41)) + >writable : Symbol(writable, Decl(mod1.js, 0, 52)) + + Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"readonlyProp" : Symbol(readonlyProp, Decl(mod1.js, 0, 71)) -->value : Symbol(value, Decl(mod1.js, 1, 48)) -->writable : Symbol(writable, Decl(mod1.js, 1, 64)) -- --Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >value : Symbol(value, Decl(mod1.js, 1, 48)) + >writable : Symbol(writable, Decl(mod1.js, 1, 64)) + + Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"rwAccessors" : Symbol(rwAccessors, Decl(mod1.js, 1, 84)) -->get : Symbol(get, Decl(mod1.js, 2, 47)) -->set : Symbol(set, Decl(mod1.js, 2, 71)) -->_ : Symbol(_, Decl(mod1.js, 2, 76)) -- --Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >get : Symbol(get, Decl(mod1.js, 2, 47)) + >set : Symbol(set, Decl(mod1.js, 2, 71)) + >_ : Symbol(_, Decl(mod1.js, 2, 76)) + + Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"readonlyAccessor" : Symbol(readonlyAccessor, Decl(mod1.js, 2, 97)) -->get : Symbol(get, Decl(mod1.js, 3, 52)) -- --Object.defineProperty(exports, "setonlyAccessor", { ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >get : Symbol(get, Decl(mod1.js, 3, 52)) + + Object.defineProperty(exports, "setonlyAccessor", { ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"setonlyAccessor" : Symbol(setonlyAccessor, Decl(mod1.js, 3, 79)) -- -- /** @param {string} str */ -- set(str) { -->set : Symbol(set, Decl(mod1.js, 4, 51)) -->str : Symbol(str, Decl(mod1.js, 6, 8)) -- -- this.rwAccessors = Number(str) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + + /** @param {string} str */ + set(str) { +@@= skipped -186, +124 lines =@@ + >str : Symbol(str, Decl(mod1.js, 6, 8)) + + this.rwAccessors = Number(str) ->rwAccessors : Symbol(rwAccessors, Decl(mod1.js, 6, 14)) -->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -->str : Symbol(str, Decl(mod1.js, 6, 8)) -- } --}); -- --=== mod2.js === --Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); + >Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + >str : Symbol(str, Decl(mod1.js, 6, 8)) + } +@@= skipped -8, +7 lines =@@ + + === mod2.js === + Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->module.exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->module : Symbol(module, Decl(mod2.js, 0, 22)) ->exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->"thing" : Symbol(thing, Decl(mod2.js, 0, 0)) -->value : Symbol(value, Decl(mod2.js, 0, 48)) -->writable : Symbol(writable, Decl(mod2.js, 0, 62)) -- --Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >value : Symbol(value, Decl(mod2.js, 0, 48)) + >writable : Symbol(writable, Decl(mod2.js, 0, 62)) + + Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->module.exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->module : Symbol(module, Decl(mod2.js, 0, 22)) ->exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->"readonlyProp" : Symbol(readonlyProp, Decl(mod2.js, 0, 81)) -->value : Symbol(value, Decl(mod2.js, 1, 55)) -->writable : Symbol(writable, Decl(mod2.js, 1, 71)) -- --Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >value : Symbol(value, Decl(mod2.js, 1, 55)) + >writable : Symbol(writable, Decl(mod2.js, 1, 71)) + + Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->module.exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->module : Symbol(module, Decl(mod2.js, 0, 22)) ->exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->"rwAccessors" : Symbol(rwAccessors, Decl(mod2.js, 1, 91)) -->get : Symbol(get, Decl(mod2.js, 2, 54)) -->set : Symbol(set, Decl(mod2.js, 2, 78)) -->_ : Symbol(_, Decl(mod2.js, 2, 83)) -- --Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >get : Symbol(get, Decl(mod2.js, 2, 54)) + >set : Symbol(set, Decl(mod2.js, 2, 78)) + >_ : Symbol(_, Decl(mod2.js, 2, 83)) + + Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->module.exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->module : Symbol(module, Decl(mod2.js, 0, 22)) ->exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->"readonlyAccessor" : Symbol(readonlyAccessor, Decl(mod2.js, 2, 104)) -->get : Symbol(get, Decl(mod2.js, 3, 59)) -- --Object.defineProperty(module.exports, "setonlyAccessor", { ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >get : Symbol(get, Decl(mod2.js, 3, 59)) + + Object.defineProperty(module.exports, "setonlyAccessor", { ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->module.exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->module : Symbol(module, Decl(mod2.js, 0, 22)) ->exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->"setonlyAccessor" : Symbol(setonlyAccessor, Decl(mod2.js, 3, 86)) -- -- /** @param {string} str */ -- set(str) { -->set : Symbol(set, Decl(mod2.js, 4, 58)) -->str : Symbol(str, Decl(mod2.js, 6, 8)) -- -- this.rwAccessors = Number(str) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + + /** @param {string} str */ + set(str) { +@@= skipped -58, +38 lines =@@ + >str : Symbol(str, Decl(mod2.js, 6, 8)) + + this.rwAccessors = Number(str) ->rwAccessors : Symbol(rwAccessors, Decl(mod2.js, 6, 14)) -->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -->str : Symbol(str, Decl(mod2.js, 6, 8)) -- } --}); -- --=== index.js === --/** -- * @type {number} -- */ --const q = require("./mod1").thing; -->q : Symbol(q, Decl(index.js, 3, 5)) + >Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + >str : Symbol(str, Decl(mod2.js, 6, 8)) + } +@@= skipped -12, +11 lines =@@ + */ + const q = require("./mod1").thing; + >q : Symbol(q, Decl(index.js, 3, 5)) ->require("./mod1").thing : Symbol(thing, Decl(mod1.js, 0, 0)) -->require : Symbol(require) + >require : Symbol(require) ->"./mod1" : Symbol("mod1", Decl(mod1.js, 0, 0)) ->thing : Symbol(thing, Decl(mod1.js, 0, 0)) -- --/** -- * @type {string} -- */ --const u = require("./mod2").thing; -->u : Symbol(u, Decl(index.js, 8, 5)) + + /** + * @type {string} + */ + const u = require("./mod2").thing; + >u : Symbol(u, Decl(index.js, 8, 5)) ->require("./mod2").thing : Symbol(thing, Decl(mod2.js, 0, 0)) -->require : Symbol(require) + >require : Symbol(require) ->"./mod2" : Symbol("mod2", Decl(mod2.js, 0, 0)) ->thing : Symbol(thing, Decl(mod2.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.types b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.types index f054d833a8..a743cd286c 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.types +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.types @@ -175,3 +175,188 @@ m2.setonlyAccessor = 0; >setonlyAccessor : any >0 : 0 +=== mod1.js === +Object.defineProperty(exports, "thing", { value: 42, writable: true }); +>Object.defineProperty(exports, "thing", { value: 42, writable: true }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"thing" : "thing" +>{ value: 42, writable: true } : { value: number; writable: true; } +>value : number +>42 : 42 +>writable : true +>true : true + +Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); +>Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"readonlyProp" : "readonlyProp" +>{ value: "Smith", writable: false } : { value: string; writable: false; } +>value : string +>"Smith" : "Smith" +>writable : false +>false : false + +Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"rwAccessors" : "rwAccessors" +>{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } +>get : () => number +>98122 : 98122 +>set : (_: any) => void +>_ : any + +Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); +>Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"readonlyAccessor" : "readonlyAccessor" +>{ get() { return 21.75 } } : { get(): number; } +>get : () => number +>21.75 : 21.75 + +Object.defineProperty(exports, "setonlyAccessor", { +>Object.defineProperty(exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"setonlyAccessor" : "setonlyAccessor" +>{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } + + /** @param {string} str */ + set(str) { +>set : (str: string) => void +>str : string + + this.rwAccessors = Number(str) +>this.rwAccessors = Number(str) : number +>this.rwAccessors : any +>this : any +>rwAccessors : any +>Number(str) : number +>Number : NumberConstructor +>str : string + } +}); + +=== mod2.js === +Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); +>Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>module.exports : any +>module : any +>exports : any +>"thing" : "thing" +>{ value: "yes", writable: true } : { value: string; writable: true; } +>value : string +>"yes" : "yes" +>writable : true +>true : true + +Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); +>Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>module.exports : any +>module : any +>exports : any +>"readonlyProp" : "readonlyProp" +>{ value: "Smith", writable: false } : { value: string; writable: false; } +>value : string +>"Smith" : "Smith" +>writable : false +>false : false + +Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>module.exports : any +>module : any +>exports : any +>"rwAccessors" : "rwAccessors" +>{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } +>get : () => number +>98122 : 98122 +>set : (_: any) => void +>_ : any + +Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); +>Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>module.exports : any +>module : any +>exports : any +>"readonlyAccessor" : "readonlyAccessor" +>{ get() { return 21.75 } } : { get(): number; } +>get : () => number +>21.75 : 21.75 + +Object.defineProperty(module.exports, "setonlyAccessor", { +>Object.defineProperty(module.exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>module.exports : any +>module : any +>exports : any +>"setonlyAccessor" : "setonlyAccessor" +>{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } + + /** @param {string} str */ + set(str) { +>set : (str: string) => void +>str : string + + this.rwAccessors = Number(str) +>this.rwAccessors = Number(str) : number +>this.rwAccessors : any +>this : any +>rwAccessors : any +>Number(str) : number +>Number : NumberConstructor +>str : string + } +}); + +=== index.js === +/** + * @type {number} + */ +const q = require("./mod1").thing; +>q : number +>require("./mod1").thing : any +>require("./mod1") : any +>require : any +>"./mod1" : "./mod1" +>thing : any + +/** + * @type {string} + */ +const u = require("./mod2").thing; +>u : string +>require("./mod2").thing : any +>require("./mod2") : any +>require : any +>"./mod2" : "./mod2" +>thing : any + diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt index d2fb479a94..15c06af9b4 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt @@ -1,14 +1,15 @@ -validator.ts(3,25): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. +mod1.js(6,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. +validator.ts(5,12): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ==== validator.ts (1 errors) ==== import "./"; import Person = require("./mod1"); - ~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. const m1 = new Person("Name") + ~~~~~~~~~~~~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. m1.thing; m1.readonlyProp; @@ -29,13 +30,15 @@ validator.ts(3,25): error TS7016: Could not find a declaration file for module ' m1.setonlyAccessor = 0; -==== mod1.js (0 errors) ==== +==== mod1.js (1 errors) ==== /** * @constructor * @param {string} name */ function Person(name) { this.name = name; + ~~~~ +!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. } Person.prototype.describe = function () { return "Person called " + this.name; diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols index 38e3c7f227..6b6cc08719 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols @@ -52,3 +52,86 @@ m1.setonlyAccessor = 0; >m1 : Symbol(m1, Decl(validator.ts, 4, 5)) +=== mod1.js === +/** + * @constructor + * @param {string} name + */ +function Person(name) { +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) +>name : Symbol(name, Decl(mod1.js, 4, 16)) + + this.name = name; +>name : Symbol(name, Decl(mod1.js, 4, 16)) +} +Person.prototype.describe = function () { +>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + + return "Person called " + this.name; +}; +Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(mod1.js, 10, 50)) +>writable : Symbol(writable, Decl(mod1.js, 10, 61)) + +Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(mod1.js, 11, 57)) +>writable : Symbol(writable, Decl(mod1.js, 11, 73)) + +Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>get : Symbol(get, Decl(mod1.js, 12, 56)) +>set : Symbol(set, Decl(mod1.js, 12, 80)) +>_ : Symbol(_, Decl(mod1.js, 12, 85)) + +Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>get : Symbol(get, Decl(mod1.js, 13, 61)) + +Object.defineProperty(Person.prototype, "setonlyAccessor", { +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + + /** @param {string} str */ + set(str) { +>set : Symbol(set, Decl(mod1.js, 14, 60)) +>str : Symbol(str, Decl(mod1.js, 16, 8)) + + this.rwAccessors = Number(str) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>str : Symbol(str, Decl(mod1.js, 16, 8)) + } +}); +module.exports = Person; +>module.exports : Symbol(Person, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(Person, Decl(mod1.js, 0, 0)) +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff index d39aaf1ec1..18f65d0d8d 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff @@ -69,104 +69,123 @@ ->m1.setonlyAccessor : Symbol(Person.setonlyAccessor, Decl(mod1.js, 13, 88)) >m1 : Symbol(m1, Decl(validator.ts, 4, 5)) ->setonlyAccessor : Symbol(Person.setonlyAccessor, Decl(mod1.js, 13, 88)) -- -- --=== mod1.js === --/** -- * @constructor -- * @param {string} name -- */ --function Person(name) { -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) -->name : Symbol(name, Decl(mod1.js, 4, 16)) -- -- this.name = name; + + + === mod1.js === +@@= skipped -77, +51 lines =@@ + >name : Symbol(name, Decl(mod1.js, 4, 16)) + + this.name = name; ->this.name : Symbol(Person.name, Decl(mod1.js, 4, 23)) ->this : Symbol(Person, Decl(mod1.js, 0, 0)) ->name : Symbol(Person.name, Decl(mod1.js, 4, 23)) -->name : Symbol(name, Decl(mod1.js, 4, 16)) --} --Person.prototype.describe = function () { + >name : Symbol(name, Decl(mod1.js, 4, 16)) + } + Person.prototype.describe = function () { ->Person.prototype : Symbol(Person.describe, Decl(mod1.js, 6, 1)) -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) ++>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >Person : Symbol(Person, Decl(mod1.js, 0, 0)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->describe : Symbol(Person.describe, Decl(mod1.js, 6, 1)) -- -- return "Person called " + this.name; ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + + return "Person called " + this.name; ->this.name : Symbol(Person.name, Decl(mod1.js, 4, 23)) ->this : Symbol(Person, Decl(mod1.js, 0, 0)) ->name : Symbol(Person.name, Decl(mod1.js, 4, 23)) - --}; --Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); + }; + Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->Person.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >Person : Symbol(Person, Decl(mod1.js, 0, 0)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->"thing" : Symbol(Person.thing, Decl(mod1.js, 9, 2)) -->value : Symbol(value, Decl(mod1.js, 10, 50)) -->writable : Symbol(writable, Decl(mod1.js, 10, 61)) -- --Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }); ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >value : Symbol(value, Decl(mod1.js, 10, 50)) + >writable : Symbol(writable, Decl(mod1.js, 10, 61)) + + Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->Person.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >Person : Symbol(Person, Decl(mod1.js, 0, 0)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->"readonlyProp" : Symbol(Person.readonlyProp, Decl(mod1.js, 10, 80)) -->value : Symbol(value, Decl(mod1.js, 11, 57)) -->writable : Symbol(writable, Decl(mod1.js, 11, 73)) -- --Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >value : Symbol(value, Decl(mod1.js, 11, 57)) + >writable : Symbol(writable, Decl(mod1.js, 11, 73)) + + Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->Person.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >Person : Symbol(Person, Decl(mod1.js, 0, 0)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->"rwAccessors" : Symbol(Person.rwAccessors, Decl(mod1.js, 11, 93)) -->get : Symbol(get, Decl(mod1.js, 12, 56)) -->set : Symbol(set, Decl(mod1.js, 12, 80)) -->_ : Symbol(_, Decl(mod1.js, 12, 85)) -- --Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }); ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >get : Symbol(get, Decl(mod1.js, 12, 56)) + >set : Symbol(set, Decl(mod1.js, 12, 80)) + >_ : Symbol(_, Decl(mod1.js, 12, 85)) + + Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->Person.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >Person : Symbol(Person, Decl(mod1.js, 0, 0)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->"readonlyAccessor" : Symbol(Person.readonlyAccessor, Decl(mod1.js, 12, 106)) -->get : Symbol(get, Decl(mod1.js, 13, 61)) -- --Object.defineProperty(Person.prototype, "setonlyAccessor", { ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >get : Symbol(get, Decl(mod1.js, 13, 61)) + + Object.defineProperty(Person.prototype, "setonlyAccessor", { ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->Person.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >Person : Symbol(Person, Decl(mod1.js, 0, 0)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->"setonlyAccessor" : Symbol(Person.setonlyAccessor, Decl(mod1.js, 13, 88)) -- -- /** @param {string} str */ -- set(str) { -->set : Symbol(set, Decl(mod1.js, 14, 60)) -->str : Symbol(str, Decl(mod1.js, 16, 8)) -- -- this.rwAccessors = Number(str) ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + + /** @param {string} str */ + set(str) { +@@= skipped -76, +63 lines =@@ + >str : Symbol(str, Decl(mod1.js, 16, 8)) + + this.rwAccessors = Number(str) ->this.rwAccessors : Symbol(Person.rwAccessors, Decl(mod1.js, 11, 93)) ->this : Symbol(Person, Decl(mod1.js, 0, 0)) ->rwAccessors : Symbol(rwAccessors, Decl(mod1.js, 16, 14)) -->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -->str : Symbol(str, Decl(mod1.js, 16, 8)) -- } --}); --module.exports = Person; + >Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + >str : Symbol(str, Decl(mod1.js, 16, 8)) + } + }); + module.exports = Person; ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 19, 3)) ->exports : Symbol(export=, Decl(mod1.js, 19, 3)) -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) -+ ++>module.exports : Symbol(Person, Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(Person, Decl(mod1.js, 0, 0)) + >Person : Symbol(Person, Decl(mod1.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types index 9f5d4aaaa0..96e3ff07e3 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types @@ -4,12 +4,12 @@ import "./"; import Person = require("./mod1"); ->Person : any +>Person : (name: string) => void const m1 = new Person("Name") >m1 : any >new Person("Name") : any ->Person : any +>Person : (name: string) => void >"Name" : "Name" m1.thing; @@ -96,3 +96,127 @@ m1.setonlyAccessor = 0; >0 : 0 +=== mod1.js === +/** + * @constructor + * @param {string} name + */ +function Person(name) { +>Person : (name: string) => void +>name : string + + this.name = name; +>this.name = name : string +>this.name : any +>this : any +>name : any +>name : string +} +Person.prototype.describe = function () { +>Person.prototype.describe = function () { return "Person called " + this.name;} : () => string +>Person.prototype.describe : any +>Person.prototype : any +>Person : (name: string) => void +>prototype : any +>describe : any +>function () { return "Person called " + this.name;} : () => string + + return "Person called " + this.name; +>"Person called " + this.name : string +>"Person called " : "Person called " +>this.name : any +>this : any +>name : any + +}; +Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); +>Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Person.prototype : any +>Person : (name: string) => void +>prototype : any +>"thing" : "thing" +>{ value: 42, writable: true } : { value: number; writable: true; } +>value : number +>42 : 42 +>writable : true +>true : true + +Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }); +>Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Person.prototype : any +>Person : (name: string) => void +>prototype : any +>"readonlyProp" : "readonlyProp" +>{ value: "Smith", writable: false } : { value: string; writable: false; } +>value : string +>"Smith" : "Smith" +>writable : false +>false : false + +Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Person.prototype : any +>Person : (name: string) => void +>prototype : any +>"rwAccessors" : "rwAccessors" +>{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } +>get : () => number +>98122 : 98122 +>set : (_: any) => void +>_ : any + +Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }); +>Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Person.prototype : any +>Person : (name: string) => void +>prototype : any +>"readonlyAccessor" : "readonlyAccessor" +>{ get() { return 21.75 } } : { get(): number; } +>get : () => number +>21.75 : 21.75 + +Object.defineProperty(Person.prototype, "setonlyAccessor", { +>Object.defineProperty(Person.prototype, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Person.prototype : any +>Person : (name: string) => void +>prototype : any +>"setonlyAccessor" : "setonlyAccessor" +>{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } + + /** @param {string} str */ + set(str) { +>set : (str: string) => void +>str : string + + this.rwAccessors = Number(str) +>this.rwAccessors = Number(str) : number +>this.rwAccessors : any +>this : any +>rwAccessors : any +>Number(str) : number +>Number : NumberConstructor +>str : string + } +}); +module.exports = Person; +>module.exports = Person : (name: string) => void +>module.exports : (name: string) => void +>module : { Person(name: string): void; } +>exports : (name: string) => void +>Person : (name: string) => void + diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types.diff b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types.diff deleted file mode 100644 index cac0370523..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types.diff +++ /dev/null @@ -1,260 +0,0 @@ ---- old.checkExportsObjectAssignPrototypeProperty.types -+++ new.checkExportsObjectAssignPrototypeProperty.types -@@= skipped -3, +3 lines =@@ - import "./"; - - import Person = require("./mod1"); -->Person : typeof Person -+>Person : any - - const m1 = new Person("Name") -->m1 : Person -->new Person("Name") : Person -->Person : typeof Person -+>m1 : any -+>new Person("Name") : any -+>Person : any - >"Name" : "Name" - - m1.thing; -->m1.thing : number -->m1 : Person -->thing : number -+>m1.thing : any -+>m1 : any -+>thing : any - - m1.readonlyProp; -->m1.readonlyProp : string -->m1 : Person -->readonlyProp : string -+>m1.readonlyProp : any -+>m1 : any -+>readonlyProp : any - - m1.rwAccessors; -->m1.rwAccessors : number -->m1 : Person -->rwAccessors : number -+>m1.rwAccessors : any -+>m1 : any -+>rwAccessors : any - - m1.readonlyAccessor; -->m1.readonlyAccessor : number -->m1 : Person -->readonlyAccessor : number -+>m1.readonlyAccessor : any -+>m1 : any -+>readonlyAccessor : any - - m1.setonlyAccessor; -->m1.setonlyAccessor : string -->m1 : Person -->setonlyAccessor : string -+>m1.setonlyAccessor : any -+>m1 : any -+>setonlyAccessor : any - - // allowed assignments - m1.thing = 10; - >m1.thing = 10 : 10 -->m1.thing : number -->m1 : Person -->thing : number -+>m1.thing : any -+>m1 : any -+>thing : any - >10 : 10 - - m1.rwAccessors = 11; - >m1.rwAccessors = 11 : 11 -->m1.rwAccessors : number -->m1 : Person -->rwAccessors : number -+>m1.rwAccessors : any -+>m1 : any -+>rwAccessors : any - >11 : 11 - - m1.setonlyAccessor = "yes"; - >m1.setonlyAccessor = "yes" : "yes" -->m1.setonlyAccessor : string -->m1 : Person -->setonlyAccessor : string -+>m1.setonlyAccessor : any -+>m1 : any -+>setonlyAccessor : any - >"yes" : "yes" - - // disallowed assignments - m1.readonlyProp = "name"; - >m1.readonlyProp = "name" : "name" - >m1.readonlyProp : any -->m1 : Person -+>m1 : any - >readonlyProp : any - >"name" : "name" - - m1.readonlyAccessor = 12; - >m1.readonlyAccessor = 12 : 12 - >m1.readonlyAccessor : any -->m1 : Person -+>m1 : any - >readonlyAccessor : any - >12 : 12 - - m1.thing = "no"; - >m1.thing = "no" : "no" -->m1.thing : number -->m1 : Person -->thing : number -+>m1.thing : any -+>m1 : any -+>thing : any - >"no" : "no" - - m1.rwAccessors = "no"; - >m1.rwAccessors = "no" : "no" -->m1.rwAccessors : number -->m1 : Person -->rwAccessors : number -+>m1.rwAccessors : any -+>m1 : any -+>rwAccessors : any - >"no" : "no" - - m1.setonlyAccessor = 0; - >m1.setonlyAccessor = 0 : 0 -->m1.setonlyAccessor : string -->m1 : Person -->setonlyAccessor : string -+>m1.setonlyAccessor : any -+>m1 : any -+>setonlyAccessor : any - >0 : 0 - -- --=== mod1.js === --/** -- * @constructor -- * @param {string} name -- */ --function Person(name) { -->Person : typeof Person -->name : string -- -- this.name = name; -->this.name = name : string -->this.name : any -->this : this -->name : any -->name : string --} --Person.prototype.describe = function () { -->Person.prototype.describe = function () { return "Person called " + this.name;} : () => string -->Person.prototype.describe : any -->Person.prototype : any -->Person : typeof Person -->prototype : any -->describe : any -->function () { return "Person called " + this.name;} : () => string -- -- return "Person called " + this.name; -->"Person called " + this.name : string -->"Person called " : "Person called " -->this.name : string -->this : this -->name : string -- --}; --Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); -->Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }) : any -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Person.prototype : any -->Person : typeof Person -->prototype : any -->"thing" : "thing" -->{ value: 42, writable: true } : { value: number; writable: true; } -->value : number -->42 : 42 -->writable : true -->true : true -- --Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }); -->Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }) : any -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Person.prototype : any -->Person : typeof Person -->prototype : any -->"readonlyProp" : "readonlyProp" -->{ value: "Smith", writable: false } : { value: string; writable: false; } -->value : string -->"Smith" : "Smith" -->writable : false -->false : false -- --Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); -->Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Person.prototype : any -->Person : typeof Person -->prototype : any -->"rwAccessors" : "rwAccessors" -->{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } -->get : () => number -->98122 : 98122 -->set : (_: any) => void -->_ : any -- --Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }); -->Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }) : any -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Person.prototype : any -->Person : typeof Person -->prototype : any -->"readonlyAccessor" : "readonlyAccessor" -->{ get() { return 21.75 } } : { get(): number; } -->get : () => number -->21.75 : 21.75 -- --Object.defineProperty(Person.prototype, "setonlyAccessor", { -->Object.defineProperty(Person.prototype, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Person.prototype : any -->Person : typeof Person -->prototype : any -->"setonlyAccessor" : "setonlyAccessor" -->{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } -- -- /** @param {string} str */ -- set(str) { -->set : (str: string) => void -->str : string -- -- this.rwAccessors = Number(str) -->this.rwAccessors = Number(str) : number -->this.rwAccessors : number -->this : this -->rwAccessors : number -->Number(str) : number -->Number : NumberConstructor -->str : string -- } --}); --module.exports = Person; -->module.exports = Person : typeof Person -->module.exports : typeof Person -->module : { exports: typeof Person; } -->exports : typeof Person -->Person : typeof Person diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt index 988e6d0f38..26d070eca5 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt @@ -1,28 +1,67 @@ -validate.ts(2,20): error TS7016: Could not find a declaration file for module './'. 'index.js' implicitly has an 'any' type. +index.js(19,10): error TS2741: Property 'name' is missing in type '{}' but required in type '{ name: string; }'. +index.js(23,11): error TS2339: Property 'zip' does not exist on type '{}'. +index.js(28,11): error TS2339: Property 'houseNumber' does not exist on type '{}'. +validate.ts(3,3): error TS2339: Property 'name' does not exist on type '{}'. +validate.ts(4,3): error TS2339: Property 'middleInit' does not exist on type '{}'. +validate.ts(5,3): error TS2339: Property 'lastName' does not exist on type '{}'. +validate.ts(6,3): error TS2339: Property 'zip' does not exist on type '{}'. +validate.ts(7,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. +validate.ts(8,3): error TS2339: Property 'zipStr' does not exist on type '{}'. +validate.ts(10,3): error TS2339: Property 'name' does not exist on type '{}'. +validate.ts(11,3): error TS2339: Property 'zip' does not exist on type '{}'. +validate.ts(12,3): error TS2339: Property 'zipStr' does not exist on type '{}'. +validate.ts(14,3): error TS2339: Property 'lastName' does not exist on type '{}'. +validate.ts(15,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. +validate.ts(16,3): error TS2339: Property 'zipStr' does not exist on type '{}'. +validate.ts(17,3): error TS2339: Property 'middleInit' does not exist on type '{}'. -==== validate.ts (1 errors) ==== +==== validate.ts (13 errors) ==== // Validate in TS as simple validations would usually be interpreted as more special assignments import x = require("./"); - ~~~~ -!!! error TS7016: Could not find a declaration file for module './'. 'index.js' implicitly has an 'any' type. x.name; + ~~~~ +!!! error TS2339: Property 'name' does not exist on type '{}'. x.middleInit; + ~~~~~~~~~~ +!!! error TS2339: Property 'middleInit' does not exist on type '{}'. x.lastName; + ~~~~~~~~ +!!! error TS2339: Property 'lastName' does not exist on type '{}'. x.zip; + ~~~ +!!! error TS2339: Property 'zip' does not exist on type '{}'. x.houseNumber; + ~~~~~~~~~~~ +!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. x.zipStr; + ~~~~~~ +!!! error TS2339: Property 'zipStr' does not exist on type '{}'. x.name = "Another"; + ~~~~ +!!! error TS2339: Property 'name' does not exist on type '{}'. x.zip = 98123; + ~~~ +!!! error TS2339: Property 'zip' does not exist on type '{}'. x.zipStr = "OK"; + ~~~~~~ +!!! error TS2339: Property 'zipStr' does not exist on type '{}'. x.lastName = "should fail"; + ~~~~~~~~ +!!! error TS2339: Property 'lastName' does not exist on type '{}'. x.houseNumber = 12; // should also fail + ~~~~~~~~~~~ +!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. x.zipStr = 12; // should fail + ~~~~~~ +!!! error TS2339: Property 'zipStr' does not exist on type '{}'. x.middleInit = "R"; // should also fail + ~~~~~~~~~~ +!!! error TS2339: Property 'middleInit' does not exist on type '{}'. -==== index.js (0 errors) ==== +==== index.js (3 errors) ==== const x = {}; Object.defineProperty(x, "name", { value: "Charles", writable: true }); Object.defineProperty(x, "middleInit", { value: "H" }); @@ -42,15 +81,22 @@ validate.ts(2,20): error TS7016: Could not find a declaration file for module '. function takeName(named) { return named.name; } takeName(x); + ~ +!!! error TS2741: Property 'name' is missing in type '{}' but required in type '{ name: string; }'. +!!! related TS2728 index.js:15:13: 'name' is declared here. /** * @type {number} */ var a = x.zip; + ~~~ +!!! error TS2339: Property 'zip' does not exist on type '{}'. /** * @type {number} */ var b = x.houseNumber; + ~~~~~~~~~~~ +!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. const returnExemplar = () => x; const needsExemplar = (_ = x) => void 0; diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt.diff deleted file mode 100644 index a93789fa9f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt.diff +++ /dev/null @@ -1,39 +0,0 @@ ---- old.checkObjectDefineProperty.errors.txt -+++ new.checkObjectDefineProperty.errors.txt -@@= skipped -0, +0 lines =@@ --validate.ts(14,3): error TS2540: Cannot assign to 'lastName' because it is a read-only property. --validate.ts(15,3): error TS2540: Cannot assign to 'houseNumber' because it is a read-only property. --validate.ts(16,1): error TS2322: Type 'number' is not assignable to type 'string'. --validate.ts(17,3): error TS2540: Cannot assign to 'middleInit' because it is a read-only property. -- -- --==== validate.ts (4 errors) ==== -+validate.ts(2,20): error TS7016: Could not find a declaration file for module './'. 'index.js' implicitly has an 'any' type. -+ -+ -+==== validate.ts (1 errors) ==== - // Validate in TS as simple validations would usually be interpreted as more special assignments - import x = require("./"); -+ ~~~~ -+!!! error TS7016: Could not find a declaration file for module './'. 'index.js' implicitly has an 'any' type. - x.name; - x.middleInit; - x.lastName; -@@= skipped -18, +17 lines =@@ - x.zipStr = "OK"; - - x.lastName = "should fail"; -- ~~~~~~~~ --!!! error TS2540: Cannot assign to 'lastName' because it is a read-only property. - x.houseNumber = 12; // should also fail -- ~~~~~~~~~~~ --!!! error TS2540: Cannot assign to 'houseNumber' because it is a read-only property. - x.zipStr = 12; // should fail -- ~~~~~~~~ --!!! error TS2322: Type 'number' is not assignable to type 'string'. - x.middleInit = "R"; // should also fail -- ~~~~~~~~~~ --!!! error TS2540: Cannot assign to 'middleInit' because it is a read-only property. - - ==== index.js (0 errors) ==== - const x = {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols index af5cca6dd2..fb8fb1c8c0 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols @@ -44,3 +44,125 @@ x.zipStr = 12; // should fail x.middleInit = "R"; // should also fail >x : Symbol(x, Decl(validate.ts, 0, 0)) +=== index.js === +const x = {}; +>x : Symbol(x, Decl(index.js, 0, 5)) + +Object.defineProperty(x, "name", { value: "Charles", writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(index.js, 0, 5)) +>value : Symbol(value, Decl(index.js, 1, 34)) +>writable : Symbol(writable, Decl(index.js, 1, 52)) + +Object.defineProperty(x, "middleInit", { value: "H" }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(index.js, 0, 5)) +>value : Symbol(value, Decl(index.js, 2, 40)) + +Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(index.js, 0, 5)) +>value : Symbol(value, Decl(index.js, 3, 38)) +>writable : Symbol(writable, Decl(index.js, 3, 54)) + +Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(index.js, 0, 5)) +>get : Symbol(get, Decl(index.js, 4, 33)) +>set : Symbol(set, Decl(index.js, 4, 57)) +>_ : Symbol(_, Decl(index.js, 4, 62)) + +Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(index.js, 0, 5)) +>get : Symbol(get, Decl(index.js, 5, 41)) + +Object.defineProperty(x, "zipStr", { +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(index.js, 0, 5)) + + /** @param {string} str */ + set(str) { +>set : Symbol(set, Decl(index.js, 6, 36)) +>str : Symbol(str, Decl(index.js, 8, 8)) + + this.zip = Number(str) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>str : Symbol(str, Decl(index.js, 8, 8)) + } +}); + +/** + * @param {{name: string}} named + */ +function takeName(named) { return named.name; } +>takeName : Symbol(takeName, Decl(index.js, 11, 3)) +>named : Symbol(named, Decl(index.js, 16, 18)) +>named.name : Symbol(name, Decl(index.js, 14, 12)) +>named : Symbol(named, Decl(index.js, 16, 18)) +>name : Symbol(name, Decl(index.js, 14, 12)) + +takeName(x); +>takeName : Symbol(takeName, Decl(index.js, 11, 3)) +>x : Symbol(x, Decl(index.js, 0, 5)) + +/** + * @type {number} + */ +var a = x.zip; +>a : Symbol(a, Decl(index.js, 22, 3)) +>x : Symbol(x, Decl(index.js, 0, 5)) + +/** + * @type {number} + */ +var b = x.houseNumber; +>b : Symbol(b, Decl(index.js, 27, 3)) +>x : Symbol(x, Decl(index.js, 0, 5)) + +const returnExemplar = () => x; +>returnExemplar : Symbol(returnExemplar, Decl(index.js, 29, 5)) +>x : Symbol(x, Decl(index.js, 0, 5)) + +const needsExemplar = (_ = x) => void 0; +>needsExemplar : Symbol(needsExemplar, Decl(index.js, 30, 5)) +>_ : Symbol(_, Decl(index.js, 30, 23)) +>x : Symbol(x, Decl(index.js, 0, 5)) + +const expected = /** @type {{name: string, readonly middleInit: string, readonly lastName: string, zip: number, readonly houseNumber: number, zipStr: string}} */(/** @type {*} */(null)); +>expected : Symbol(expected, Decl(index.js, 32, 5)) + +/** + * + * @param {typeof returnExemplar} a + * @param {typeof needsExemplar} b + */ +function match(a, b) {} +>match : Symbol(match, Decl(index.js, 32, 186)) +>a : Symbol(a, Decl(index.js, 39, 15)) +>b : Symbol(b, Decl(index.js, 39, 17)) + +match(() => expected, (x = expected) => void 0); +>match : Symbol(match, Decl(index.js, 32, 186)) +>expected : Symbol(expected, Decl(index.js, 32, 5)) +>x : Symbol(x, Decl(index.js, 41, 23)) +>expected : Symbol(expected, Decl(index.js, 32, 5)) + +module.exports = x; +>module.exports : Symbol(x, Decl(index.js, 0, 5)) +>module : Symbol(module.exports) +>exports : Symbol(x, Decl(index.js, 0, 5)) +>x : Symbol(x, Decl(index.js, 0, 5)) + diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff index 44f4224a15..46a9c331b0 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff @@ -67,136 +67,140 @@ ->x.middleInit : Symbol(x.middleInit, Decl(index.js, 1, 71)) >x : Symbol(x, Decl(validate.ts, 0, 0)) ->middleInit : Symbol(x.middleInit, Decl(index.js, 1, 71)) -- --=== index.js === --const x = {}; + + === index.js === + const x = {}; ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) -- --Object.defineProperty(x, "name", { value: "Charles", writable: true }); ++>x : Symbol(x, Decl(index.js, 0, 5)) + + Object.defineProperty(x, "name", { value: "Charles", writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->"name" : Symbol(x.name, Decl(index.js, 0, 13)) -->value : Symbol(value, Decl(index.js, 1, 34)) -->writable : Symbol(writable, Decl(index.js, 1, 52)) -- --Object.defineProperty(x, "middleInit", { value: "H" }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + >value : Symbol(value, Decl(index.js, 1, 34)) + >writable : Symbol(writable, Decl(index.js, 1, 52)) + + Object.defineProperty(x, "middleInit", { value: "H" }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->"middleInit" : Symbol(x.middleInit, Decl(index.js, 1, 71)) -->value : Symbol(value, Decl(index.js, 2, 40)) -- --Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + >value : Symbol(value, Decl(index.js, 2, 40)) + + Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->"lastName" : Symbol(x.lastName, Decl(index.js, 2, 55)) -->value : Symbol(value, Decl(index.js, 3, 38)) -->writable : Symbol(writable, Decl(index.js, 3, 54)) -- --Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + >value : Symbol(value, Decl(index.js, 3, 38)) + >writable : Symbol(writable, Decl(index.js, 3, 54)) + + Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->"zip" : Symbol(x.zip, Decl(index.js, 3, 74)) -->get : Symbol(get, Decl(index.js, 4, 33)) -->set : Symbol(set, Decl(index.js, 4, 57)) -->_ : Symbol(_, Decl(index.js, 4, 62)) -- --Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + >get : Symbol(get, Decl(index.js, 4, 33)) + >set : Symbol(set, Decl(index.js, 4, 57)) + >_ : Symbol(_, Decl(index.js, 4, 62)) + + Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->"houseNumber" : Symbol(x.houseNumber, Decl(index.js, 4, 83)) -->get : Symbol(get, Decl(index.js, 5, 41)) -- --Object.defineProperty(x, "zipStr", { ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + >get : Symbol(get, Decl(index.js, 5, 41)) + + Object.defineProperty(x, "zipStr", { ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->"zipStr" : Symbol(x.zipStr, Decl(index.js, 5, 68)) -- -- /** @param {string} str */ -- set(str) { -->set : Symbol(set, Decl(index.js, 6, 36)) -->str : Symbol(str, Decl(index.js, 8, 8)) -- -- this.zip = Number(str) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + + /** @param {string} str */ + set(str) { +@@= skipped -125, +93 lines =@@ + >str : Symbol(str, Decl(index.js, 8, 8)) + + this.zip = Number(str) ->zip : Symbol(zip, Decl(index.js, 8, 14)) -->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -->str : Symbol(str, Decl(index.js, 8, 8)) -- } --}); -- --/** -- * @param {{name: string}} named -- */ --function takeName(named) { return named.name; } -->takeName : Symbol(takeName, Decl(index.js, 11, 3)) -->named : Symbol(named, Decl(index.js, 16, 18)) -->named.name : Symbol(name, Decl(index.js, 14, 12)) -->named : Symbol(named, Decl(index.js, 16, 18)) -->name : Symbol(name, Decl(index.js, 14, 12)) -- --takeName(x); -->takeName : Symbol(takeName, Decl(index.js, 11, 3)) + >Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + >str : Symbol(str, Decl(index.js, 8, 8)) + } +@@= skipped -18, +17 lines =@@ + + takeName(x); + >takeName : Symbol(takeName, Decl(index.js, 11, 3)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) -- --/** -- * @type {number} -- */ --var a = x.zip; -->a : Symbol(a, Decl(index.js, 22, 3)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + + /** + * @type {number} + */ + var a = x.zip; + >a : Symbol(a, Decl(index.js, 22, 3)) ->x.zip : Symbol(x.zip, Decl(index.js, 3, 74)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->zip : Symbol(x.zip, Decl(index.js, 3, 74)) -- --/** -- * @type {number} -- */ --var b = x.houseNumber; -->b : Symbol(b, Decl(index.js, 27, 3)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + + /** + * @type {number} + */ + var b = x.houseNumber; + >b : Symbol(b, Decl(index.js, 27, 3)) ->x.houseNumber : Symbol(x.houseNumber, Decl(index.js, 4, 83)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->houseNumber : Symbol(x.houseNumber, Decl(index.js, 4, 83)) -- --const returnExemplar = () => x; -->returnExemplar : Symbol(returnExemplar, Decl(index.js, 29, 5)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + + const returnExemplar = () => x; + >returnExemplar : Symbol(returnExemplar, Decl(index.js, 29, 5)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) -- --const needsExemplar = (_ = x) => void 0; -->needsExemplar : Symbol(needsExemplar, Decl(index.js, 30, 5)) -->_ : Symbol(_, Decl(index.js, 30, 23)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + + const needsExemplar = (_ = x) => void 0; + >needsExemplar : Symbol(needsExemplar, Decl(index.js, 30, 5)) + >_ : Symbol(_, Decl(index.js, 30, 23)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) -- --const expected = /** @type {{name: string, readonly middleInit: string, readonly lastName: string, zip: number, readonly houseNumber: number, zipStr: string}} */(/** @type {*} */(null)); -->expected : Symbol(expected, Decl(index.js, 32, 5)) -- --/** -- * -- * @param {typeof returnExemplar} a -- * @param {typeof needsExemplar} b -- */ --function match(a, b) {} -->match : Symbol(match, Decl(index.js, 32, 186)) -->a : Symbol(a, Decl(index.js, 39, 15)) -->b : Symbol(b, Decl(index.js, 39, 17)) -- --match(() => expected, (x = expected) => void 0); -->match : Symbol(match, Decl(index.js, 32, 186)) -->expected : Symbol(expected, Decl(index.js, 32, 5)) -->x : Symbol(x, Decl(index.js, 41, 23)) -->expected : Symbol(expected, Decl(index.js, 32, 5)) -- --module.exports = x; ++>x : Symbol(x, Decl(index.js, 0, 5)) + + const expected = /** @type {{name: string, readonly middleInit: string, readonly lastName: string, zip: number, readonly houseNumber: number, zipStr: string}} */(/** @type {*} */(null)); + >expected : Symbol(expected, Decl(index.js, 32, 5)) +@@= skipped -49, +45 lines =@@ + >expected : Symbol(expected, Decl(index.js, 32, 5)) + + module.exports = x; ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 41, 48)) ->exports : Symbol(export=, Decl(index.js, 41, 48)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ++>module.exports : Symbol(x, Decl(index.js, 0, 5)) ++>module : Symbol(module.exports) ++>exports : Symbol(x, Decl(index.js, 0, 5)) ++>x : Symbol(x, Decl(index.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types index cf53736a27..c2033ef342 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types @@ -3,84 +3,254 @@ === validate.ts === // Validate in TS as simple validations would usually be interpreted as more special assignments import x = require("./"); ->x : any +>x : {} x.name; >x.name : any ->x : any +>x : {} >name : any x.middleInit; >x.middleInit : any ->x : any +>x : {} >middleInit : any x.lastName; >x.lastName : any ->x : any +>x : {} >lastName : any x.zip; >x.zip : any ->x : any +>x : {} >zip : any x.houseNumber; >x.houseNumber : any ->x : any +>x : {} >houseNumber : any x.zipStr; >x.zipStr : any ->x : any +>x : {} >zipStr : any x.name = "Another"; >x.name = "Another" : "Another" >x.name : any ->x : any +>x : {} >name : any >"Another" : "Another" x.zip = 98123; >x.zip = 98123 : 98123 >x.zip : any ->x : any +>x : {} >zip : any >98123 : 98123 x.zipStr = "OK"; >x.zipStr = "OK" : "OK" >x.zipStr : any ->x : any +>x : {} >zipStr : any >"OK" : "OK" x.lastName = "should fail"; >x.lastName = "should fail" : "should fail" >x.lastName : any ->x : any +>x : {} >lastName : any >"should fail" : "should fail" x.houseNumber = 12; // should also fail >x.houseNumber = 12 : 12 >x.houseNumber : any ->x : any +>x : {} >houseNumber : any >12 : 12 x.zipStr = 12; // should fail >x.zipStr = 12 : 12 >x.zipStr : any ->x : any +>x : {} >zipStr : any >12 : 12 x.middleInit = "R"; // should also fail >x.middleInit = "R" : "R" >x.middleInit : any ->x : any +>x : {} >middleInit : any >"R" : "R" +=== index.js === +const x = {}; +>x : {} +>{} : {} + +Object.defineProperty(x, "name", { value: "Charles", writable: true }); +>Object.defineProperty(x, "name", { value: "Charles", writable: true }) : {} +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>x : {} +>"name" : "name" +>{ value: "Charles", writable: true } : { value: string; writable: true; } +>value : string +>"Charles" : "Charles" +>writable : true +>true : true + +Object.defineProperty(x, "middleInit", { value: "H" }); +>Object.defineProperty(x, "middleInit", { value: "H" }) : {} +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>x : {} +>"middleInit" : "middleInit" +>{ value: "H" } : { value: string; } +>value : string +>"H" : "H" + +Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); +>Object.defineProperty(x, "lastName", { value: "Smith", writable: false }) : {} +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>x : {} +>"lastName" : "lastName" +>{ value: "Smith", writable: false } : { value: string; writable: false; } +>value : string +>"Smith" : "Smith" +>writable : false +>false : false + +Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }) : {} +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>x : {} +>"zip" : "zip" +>{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } +>get : () => number +>98122 : 98122 +>set : (_: any) => void +>_ : any + +Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); +>Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }) : {} +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>x : {} +>"houseNumber" : "houseNumber" +>{ get() { return 21.75 } } : { get(): number; } +>get : () => number +>21.75 : 21.75 + +Object.defineProperty(x, "zipStr", { +>Object.defineProperty(x, "zipStr", { /** @param {string} str */ set(str) { this.zip = Number(str) }}) : {} +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>x : {} +>"zipStr" : "zipStr" +>{ /** @param {string} str */ set(str) { this.zip = Number(str) }} : { set(str: string): void; } + + /** @param {string} str */ + set(str) { +>set : (str: string) => void +>str : string + + this.zip = Number(str) +>this.zip = Number(str) : number +>this.zip : any +>this : any +>zip : any +>Number(str) : number +>Number : NumberConstructor +>str : string + } +}); + +/** + * @param {{name: string}} named + */ +function takeName(named) { return named.name; } +>takeName : (named: { name: string; }) => string +>named : { name: string; } +>named.name : string +>named : { name: string; } +>name : string + +takeName(x); +>takeName(x) : string +>takeName : (named: { name: string; }) => string +>x : {} + +/** + * @type {number} + */ +var a = x.zip; +>a : number +>x.zip : any +>x : {} +>zip : any + +/** + * @type {number} + */ +var b = x.houseNumber; +>b : number +>x.houseNumber : any +>x : {} +>houseNumber : any + +const returnExemplar = () => x; +>returnExemplar : () => {} +>() => x : () => {} +>x : {} + +const needsExemplar = (_ = x) => void 0; +>needsExemplar : (_?: {}) => undefined +>(_ = x) => void 0 : (_?: {}) => undefined +>_ : {} +>x : {} +>void 0 : undefined +>0 : 0 + +const expected = /** @type {{name: string, readonly middleInit: string, readonly lastName: string, zip: number, readonly houseNumber: number, zipStr: string}} */(/** @type {*} */(null)); +>expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } +>(/** @type {*} */(null)) : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } +>(null) : any + +/** + * + * @param {typeof returnExemplar} a + * @param {typeof needsExemplar} b + */ +function match(a, b) {} +>match : (a: () => {}, b: (_?: {}) => undefined) => void +>a : () => {} +>b : (_?: {}) => undefined + +match(() => expected, (x = expected) => void 0); +>match(() => expected, (x = expected) => void 0) : void +>match : (a: () => {}, b: (_?: {}) => undefined) => void +>() => expected : () => { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } +>expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } +>(x = expected) => void 0 : (x?: {} | undefined) => undefined +>x : {} | undefined +>expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } +>void 0 : undefined +>0 : 0 + +module.exports = x; +>module.exports = x : {} +>module.exports : {} +>module : { readonly x: {}; } +>exports : {} +>x : {} + diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types.diff b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types.diff deleted file mode 100644 index 06b8b08e67..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types.diff +++ /dev/null @@ -1,290 +0,0 @@ ---- old.checkObjectDefineProperty.types -+++ new.checkObjectDefineProperty.types -@@= skipped -2, +2 lines =@@ - === validate.ts === - // Validate in TS as simple validations would usually be interpreted as more special assignments - import x = require("./"); -->x : typeof x -+>x : any - - x.name; -->x.name : string -->x : typeof x -->name : string -+>x.name : any -+>x : any -+>name : any - - x.middleInit; -->x.middleInit : string -->x : typeof x -->middleInit : string -+>x.middleInit : any -+>x : any -+>middleInit : any - - x.lastName; -->x.lastName : string -->x : typeof x -->lastName : string -+>x.lastName : any -+>x : any -+>lastName : any - - x.zip; -->x.zip : number -->x : typeof x -->zip : number -+>x.zip : any -+>x : any -+>zip : any - - x.houseNumber; -->x.houseNumber : number -->x : typeof x -->houseNumber : number -+>x.houseNumber : any -+>x : any -+>houseNumber : any - - x.zipStr; -->x.zipStr : string -->x : typeof x -->zipStr : string -+>x.zipStr : any -+>x : any -+>zipStr : any - - x.name = "Another"; - >x.name = "Another" : "Another" -->x.name : string -->x : typeof x -->name : string -+>x.name : any -+>x : any -+>name : any - >"Another" : "Another" - - x.zip = 98123; - >x.zip = 98123 : 98123 -->x.zip : number -->x : typeof x -->zip : number -+>x.zip : any -+>x : any -+>zip : any - >98123 : 98123 - - x.zipStr = "OK"; - >x.zipStr = "OK" : "OK" -->x.zipStr : string -->x : typeof x -->zipStr : string -+>x.zipStr : any -+>x : any -+>zipStr : any - >"OK" : "OK" - - x.lastName = "should fail"; - >x.lastName = "should fail" : "should fail" - >x.lastName : any -->x : typeof x -+>x : any - >lastName : any - >"should fail" : "should fail" - - x.houseNumber = 12; // should also fail - >x.houseNumber = 12 : 12 - >x.houseNumber : any -->x : typeof x -+>x : any - >houseNumber : any - >12 : 12 - - x.zipStr = 12; // should fail - >x.zipStr = 12 : 12 -->x.zipStr : string -->x : typeof x -->zipStr : string -+>x.zipStr : any -+>x : any -+>zipStr : any - >12 : 12 - - x.middleInit = "R"; // should also fail - >x.middleInit = "R" : "R" - >x.middleInit : any -->x : typeof x -+>x : any - >middleInit : any - >"R" : "R" -- --=== index.js === --const x = {}; -->x : typeof x -->{} : {} -- --Object.defineProperty(x, "name", { value: "Charles", writable: true }); -->Object.defineProperty(x, "name", { value: "Charles", writable: true }) : typeof x -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->x : typeof x -->"name" : "name" -->{ value: "Charles", writable: true } : { value: string; writable: true; } -->value : string -->"Charles" : "Charles" -->writable : true -->true : true -- --Object.defineProperty(x, "middleInit", { value: "H" }); -->Object.defineProperty(x, "middleInit", { value: "H" }) : typeof x -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->x : typeof x -->"middleInit" : "middleInit" -->{ value: "H" } : { value: string; } -->value : string -->"H" : "H" -- --Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); -->Object.defineProperty(x, "lastName", { value: "Smith", writable: false }) : typeof x -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->x : typeof x -->"lastName" : "lastName" -->{ value: "Smith", writable: false } : { value: string; writable: false; } -->value : string -->"Smith" : "Smith" -->writable : false -->false : false -- --Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }); -->Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }) : typeof x -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->x : typeof x -->"zip" : "zip" -->{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } -->get : () => number -->98122 : 98122 -->set : (_: any) => void -->_ : any -- --Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); -->Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }) : typeof x -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->x : typeof x -->"houseNumber" : "houseNumber" -->{ get() { return 21.75 } } : { get(): number; } -->get : () => number -->21.75 : 21.75 -- --Object.defineProperty(x, "zipStr", { -->Object.defineProperty(x, "zipStr", { /** @param {string} str */ set(str) { this.zip = Number(str) }}) : typeof x -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->x : typeof x -->"zipStr" : "zipStr" -->{ /** @param {string} str */ set(str) { this.zip = Number(str) }} : { set(str: string): void; } -- -- /** @param {string} str */ -- set(str) { -->set : (str: string) => void -->str : string -- -- this.zip = Number(str) -->this.zip = Number(str) : number -->this.zip : any -->this : any -->zip : any -->Number(str) : number -->Number : NumberConstructor -->str : string -- } --}); -- --/** -- * @param {{name: string}} named -- */ --function takeName(named) { return named.name; } -->takeName : (named: { name: string; }) => string -->named : { name: string; } -->named.name : string -->named : { name: string; } -->name : string -- --takeName(x); -->takeName(x) : string -->takeName : (named: { name: string; }) => string -->x : typeof x -- --/** -- * @type {number} -- */ --var a = x.zip; -->a : number -->x.zip : number -->x : typeof x -->zip : number -- --/** -- * @type {number} -- */ --var b = x.houseNumber; -->b : number -->x.houseNumber : number -->x : typeof x -->houseNumber : number -- --const returnExemplar = () => x; -->returnExemplar : () => typeof x -->() => x : () => typeof x -->x : typeof x -- --const needsExemplar = (_ = x) => void 0; -->needsExemplar : (_?: typeof x) => undefined -->(_ = x) => void 0 : (_?: typeof x) => undefined -->_ : typeof x -->x : typeof x -->void 0 : undefined -->0 : 0 -- --const expected = /** @type {{name: string, readonly middleInit: string, readonly lastName: string, zip: number, readonly houseNumber: number, zipStr: string}} */(/** @type {*} */(null)); -->expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } -->(/** @type {*} */(null)) : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } -->(null) : any -- --/** -- * -- * @param {typeof returnExemplar} a -- * @param {typeof needsExemplar} b -- */ --function match(a, b) {} -->match : (a: typeof returnExemplar, b: typeof needsExemplar) => void -->a : () => typeof x -->b : (_?: typeof x) => undefined -- --match(() => expected, (x = expected) => void 0); -->match(() => expected, (x = expected) => void 0) : void -->match : (a: typeof returnExemplar, b: typeof needsExemplar) => void -->() => expected : () => { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } -->expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } -->(x = expected) => void 0 : (x?: typeof x | undefined) => undefined -->x : typeof x | undefined -->expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } -->void 0 : undefined -->0 : 0 -- --module.exports = x; -->module.exports = x : typeof x -->module.exports : typeof x -->module : { exports: typeof x; } -->exports : typeof x -->x : typeof x diff --git a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.errors.txt b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.errors.txt index 8e0d93de69..b339a4e9ee 100644 --- a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.errors.txt @@ -1,10 +1,16 @@ -importer.js(1,21): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. +importer.js(1,21): error TS2306: File 'mod1.js' is not a module. +mod1.js(2,23): error TS2304: Cannot find name 'exports'. +mod1.js(8,23): error TS2304: Cannot find name 'exports'. +mod1.js(11,23): error TS2304: Cannot find name 'exports'. +mod1.js(14,23): error TS2304: Cannot find name 'exports'. +mod1.js(15,23): error TS2304: Cannot find name 'exports'. +mod1.js(16,23): error TS2304: Cannot find name 'exports'. ==== importer.js (1 errors) ==== const mod = require("./mod1"); ~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. +!!! error TS2306: File 'mod1.js' is not a module. mod.thing; mod.other; mod.prop; @@ -20,21 +26,33 @@ importer.js(1,21): error TS7016: Could not find a declaration file for module '. mod.bad2 = 0; mod.bad3 = 0; -==== mod1.js (0 errors) ==== +==== mod1.js (6 errors) ==== const obj = { value: 42, writable: true }; Object.defineProperty(exports, "thing", obj); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. /** * @type {string} */ let str = /** @type {string} */("other"); Object.defineProperty(exports, str, { value: 42, writable: true }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. const propName = "prop" Object.defineProperty(exports, propName, { value: 42, writable: true }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. Object.defineProperty(exports, "bad1", { }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. Object.defineProperty(exports, "bad3", { writable: true }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols index 1cd432e219..a395d22191 100644 --- a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols @@ -42,3 +42,59 @@ mod.bad2 = 0; mod.bad3 = 0; >mod : Symbol(mod, Decl(importer.js, 0, 5)) +=== mod1.js === +const obj = { value: 42, writable: true }; +>obj : Symbol(obj, Decl(mod1.js, 0, 5)) +>value : Symbol(value, Decl(mod1.js, 0, 13)) +>writable : Symbol(writable, Decl(mod1.js, 0, 24)) + +Object.defineProperty(exports, "thing", obj); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>obj : Symbol(obj, Decl(mod1.js, 0, 5)) + +/** + * @type {string} + */ +let str = /** @type {string} */("other"); +>str : Symbol(str, Decl(mod1.js, 6, 3)) + +Object.defineProperty(exports, str, { value: 42, writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>str : Symbol(str, Decl(mod1.js, 6, 3)) +>value : Symbol(value, Decl(mod1.js, 7, 37)) +>writable : Symbol(writable, Decl(mod1.js, 7, 48)) + +const propName = "prop" +>propName : Symbol(propName, Decl(mod1.js, 9, 5)) + +Object.defineProperty(exports, propName, { value: 42, writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>propName : Symbol(propName, Decl(mod1.js, 9, 5)) +>value : Symbol(value, Decl(mod1.js, 10, 42)) +>writable : Symbol(writable, Decl(mod1.js, 10, 53)) + + +Object.defineProperty(exports, "bad1", { }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + +Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>get : Symbol(get, Decl(mod1.js, 14, 40)) +>value : Symbol(value, Decl(mod1.js, 14, 61)) + +Object.defineProperty(exports, "bad3", { writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>writable : Symbol(writable, Decl(mod1.js, 15, 40)) + diff --git a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols.diff index b4c513b038..238be46b00 100644 --- a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols.diff @@ -56,69 +56,77 @@ ->mod.bad3 : Symbol(mod.bad3, Decl(mod1.js, 14, 77)) >mod : Symbol(mod, Decl(importer.js, 0, 5)) ->bad3 : Symbol(mod.bad3, Decl(mod1.js, 14, 77)) -- --=== mod1.js === --const obj = { value: 42, writable: true }; -->obj : Symbol(obj, Decl(mod1.js, 0, 5)) -->value : Symbol(value, Decl(mod1.js, 0, 13)) -->writable : Symbol(writable, Decl(mod1.js, 0, 24)) -- --Object.defineProperty(exports, "thing", obj); + + === mod1.js === + const obj = { value: 42, writable: true }; +@@= skipped -21, +15 lines =@@ + >writable : Symbol(writable, Decl(mod1.js, 0, 24)) + + Object.defineProperty(exports, "thing", obj); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"thing" : Symbol(thing, Decl(mod1.js, 0, 42)) -->obj : Symbol(obj, Decl(mod1.js, 0, 5)) -- --/** -- * @type {string} -- */ --let str = /** @type {string} */("other"); -->str : Symbol(str, Decl(mod1.js, 6, 3)) -- --Object.defineProperty(exports, str, { value: 42, writable: true }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >obj : Symbol(obj, Decl(mod1.js, 0, 5)) + + /** +@@= skipped -14, +12 lines =@@ + >str : Symbol(str, Decl(mod1.js, 6, 3)) + + Object.defineProperty(exports, str, { value: 42, writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) -->str : Symbol(str, Decl(mod1.js, 6, 3)) -->value : Symbol(value, Decl(mod1.js, 7, 37)) -->writable : Symbol(writable, Decl(mod1.js, 7, 48)) -- --const propName = "prop" -->propName : Symbol(propName, Decl(mod1.js, 9, 5)) -- --Object.defineProperty(exports, propName, { value: 42, writable: true }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >str : Symbol(str, Decl(mod1.js, 6, 3)) + >value : Symbol(value, Decl(mod1.js, 7, 37)) + >writable : Symbol(writable, Decl(mod1.js, 7, 48)) +@@= skipped -12, +11 lines =@@ + >propName : Symbol(propName, Decl(mod1.js, 9, 5)) + + Object.defineProperty(exports, propName, { value: 42, writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) -->propName : Symbol(propName, Decl(mod1.js, 9, 5)) -->value : Symbol(value, Decl(mod1.js, 10, 42)) -->writable : Symbol(writable, Decl(mod1.js, 10, 53)) -- -- --Object.defineProperty(exports, "bad1", { }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >propName : Symbol(propName, Decl(mod1.js, 9, 5)) + >value : Symbol(value, Decl(mod1.js, 10, 42)) + >writable : Symbol(writable, Decl(mod1.js, 10, 53)) + + + Object.defineProperty(exports, "bad1", { }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"bad1" : Symbol(bad1, Decl(mod1.js, 10, 72)) -- --Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + + Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"bad2" : Symbol(bad2, Decl(mod1.js, 13, 44)) -->get : Symbol(get, Decl(mod1.js, 14, 40)) -->value : Symbol(value, Decl(mod1.js, 14, 61)) -- --Object.defineProperty(exports, "bad3", { writable: true }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >get : Symbol(get, Decl(mod1.js, 14, 40)) + >value : Symbol(value, Decl(mod1.js, 14, 61)) + + Object.defineProperty(exports, "bad3", { writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"bad3" : Symbol(bad3, Decl(mod1.js, 14, 77)) -->writable : Symbol(writable, Decl(mod1.js, 15, 40)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >writable : Symbol(writable, Decl(mod1.js, 15, 40)) diff --git a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.types b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.types index a465cf600e..948015e68b 100644 --- a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.types +++ b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.types @@ -80,3 +80,93 @@ mod.bad3 = 0; >bad3 : any >0 : 0 +=== mod1.js === +const obj = { value: 42, writable: true }; +>obj : { value: number; writable: boolean; } +>{ value: 42, writable: true } : { value: number; writable: boolean; } +>value : number +>42 : 42 +>writable : boolean +>true : true + +Object.defineProperty(exports, "thing", obj); +>Object.defineProperty(exports, "thing", obj) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"thing" : "thing" +>obj : { value: number; writable: boolean; } + +/** + * @type {string} + */ +let str = /** @type {string} */("other"); +>str : string +>("other") : string +>"other" : "other" + +Object.defineProperty(exports, str, { value: 42, writable: true }); +>Object.defineProperty(exports, str, { value: 42, writable: true }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>str : string +>{ value: 42, writable: true } : { value: number; writable: true; } +>value : number +>42 : 42 +>writable : true +>true : true + +const propName = "prop" +>propName : "prop" +>"prop" : "prop" + +Object.defineProperty(exports, propName, { value: 42, writable: true }); +>Object.defineProperty(exports, propName, { value: 42, writable: true }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>propName : "prop" +>{ value: 42, writable: true } : { value: number; writable: true; } +>value : number +>42 : 42 +>writable : true +>true : true + + +Object.defineProperty(exports, "bad1", { }); +>Object.defineProperty(exports, "bad1", { }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"bad1" : "bad1" +>{ } : {} + +Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); +>Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"bad2" : "bad2" +>{ get() { return 12 }, value: "no" } : { get(): number; value: string; } +>get : () => number +>12 : 12 +>value : string +>"no" : "no" + +Object.defineProperty(exports, "bad3", { writable: true }); +>Object.defineProperty(exports, "bad3", { writable: true }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"bad3" : "bad3" +>{ writable: true } : { writable: true; } +>writable : true +>true : true + diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.errors.txt b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.errors.txt new file mode 100644 index 0000000000..9702659e53 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.errors.txt @@ -0,0 +1,27 @@ +bug43713.js(1,9): error TS2305: Module '"./commonJSAliasedExport"' has no exported member 'funky'. +commonJSAliasedExport.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +commonJSAliasedExport.js(7,16): error TS2339: Property 'funky' does not exist on type '(ast: any) => any'. + + +==== bug43713.js (1 errors) ==== + const { funky } = require('./commonJSAliasedExport'); + ~~~~~ +!!! error TS2305: Module '"./commonJSAliasedExport"' has no exported member 'funky'. + /** @type {boolean} */ + var diddy + var diddy = funky(1) + + +==== commonJSAliasedExport.js (2 errors) ==== + const donkey = (ast) => ast; + + function funky(declaration) { + return false; + } + module.exports = donkey; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.funky = funky; + ~~~~~ +!!! error TS2339: Property 'funky' does not exist on type '(ast: any) => any'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols index b7748b291e..8c3b8e0421 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols +++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols @@ -4,6 +4,7 @@ const { funky } = require('./commonJSAliasedExport'); >funky : Symbol(funky, Decl(bug43713.js, 0, 7)) >require : Symbol(require) +>'./commonJSAliasedExport' : Symbol("commonJSAliasedExport", Decl(commonJSAliasedExport.js, 0, 0)) /** @type {boolean} */ var diddy @@ -14,3 +15,27 @@ var diddy = funky(1) >funky : Symbol(funky, Decl(bug43713.js, 0, 7)) +=== commonJSAliasedExport.js === +const donkey = (ast) => ast; +>donkey : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) +>ast : Symbol(ast, Decl(commonJSAliasedExport.js, 0, 16)) +>ast : Symbol(ast, Decl(commonJSAliasedExport.js, 0, 16)) + +function funky(declaration) { +>funky : Symbol(funky, Decl(commonJSAliasedExport.js, 0, 29)) +>declaration : Symbol(declaration, Decl(commonJSAliasedExport.js, 2, 15)) + + return false; +} +module.exports = donkey; +>module.exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) +>module : Symbol(module.exports) +>exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) +>donkey : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) + +module.exports.funky = funky; +>module.exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) +>module : Symbol(module.exports) +>exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) +>funky : Symbol(funky, Decl(commonJSAliasedExport.js, 0, 29)) + diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff index 033029b962..57e789428e 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff @@ -1,40 +1,24 @@ --- old.commonJSAliasedExport.symbols +++ new.commonJSAliasedExport.symbols -@@= skipped -3, +3 lines =@@ - const { funky } = require('./commonJSAliasedExport'); - >funky : Symbol(funky, Decl(bug43713.js, 0, 7)) - >require : Symbol(require) -->'./commonJSAliasedExport' : Symbol("commonJSAliasedExport", Decl(commonJSAliasedExport.js, 0, 0)) - - /** @type {boolean} */ - var diddy -@@= skipped -10, +9 lines =@@ - >diddy : Symbol(diddy, Decl(bug43713.js, 2, 3), Decl(bug43713.js, 3, 3)) - >funky : Symbol(funky, Decl(bug43713.js, 0, 7)) - -- --=== commonJSAliasedExport.js === --const donkey = (ast) => ast; -->donkey : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) -->ast : Symbol(ast, Decl(commonJSAliasedExport.js, 0, 16)) -->ast : Symbol(ast, Decl(commonJSAliasedExport.js, 0, 16)) -- --function funky(declaration) { -->funky : Symbol(funky, Decl(commonJSAliasedExport.js, 0, 29)) -->declaration : Symbol(declaration, Decl(commonJSAliasedExport.js, 2, 15)) -- -- return false; --} --module.exports = donkey; +@@= skipped -27, +27 lines =@@ + return false; + } + module.exports = donkey; ->module.exports : Symbol(module.exports, Decl(commonJSAliasedExport.js, 0, 0)) ->module : Symbol(export=, Decl(commonJSAliasedExport.js, 4, 1)) ->exports : Symbol(export=, Decl(commonJSAliasedExport.js, 4, 1)) -->donkey : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) -- --module.exports.funky = funky; ++>module.exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) ++>module : Symbol(module.exports) ++>exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) + >donkey : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) + + module.exports.funky = funky; ->module.exports.funky : Symbol(funky, Decl(commonJSAliasedExport.js, 5, 24)) ->module.exports : Symbol(funky, Decl(commonJSAliasedExport.js, 5, 24)) ->module : Symbol(module, Decl(commonJSAliasedExport.js, 4, 1)) ->exports : Symbol(module.exports, Decl(commonJSAliasedExport.js, 0, 0)) ->funky : Symbol(funky, Decl(commonJSAliasedExport.js, 5, 24)) -->funky : Symbol(funky, Decl(commonJSAliasedExport.js, 0, 29)) ++>module.exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) ++>module : Symbol(module.exports) ++>exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) + >funky : Symbol(funky, Decl(commonJSAliasedExport.js, 0, 29)) diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types index cc0fc9ebc6..b4d9bc810d 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types +++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types @@ -3,7 +3,7 @@ === bug43713.js === const { funky } = require('./commonJSAliasedExport'); >funky : any ->require('./commonJSAliasedExport') : any +>require('./commonJSAliasedExport') : (ast: any) => any >require : any >'./commonJSAliasedExport' : "./commonJSAliasedExport" @@ -18,3 +18,33 @@ var diddy = funky(1) >1 : 1 +=== commonJSAliasedExport.js === +const donkey = (ast) => ast; +>donkey : (ast: any) => any +>(ast) => ast : (ast: any) => any +>ast : any +>ast : any + +function funky(declaration) { +>funky : (declaration: any) => boolean +>declaration : any + + return false; +>false : false +} +module.exports = donkey; +>module.exports = donkey : (ast: any) => any +>module.exports : (ast: any) => any +>module : { readonly donkey: (ast: any) => any; } +>exports : (ast: any) => any +>donkey : (ast: any) => any + +module.exports.funky = funky; +>module.exports.funky = funky : (declaration: any) => boolean +>module.exports.funky : any +>module.exports : (ast: any) => any +>module : { readonly donkey: (ast: any) => any; } +>exports : (ast: any) => any +>funky : any +>funky : (declaration: any) => boolean + diff --git a/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols b/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols index 7dbfb5c117..a9258f816a 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols +++ b/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols @@ -3,8 +3,37 @@ === main.js === const { hardline } = require('./second').nested; >hardline : Symbol(hardline, Decl(main.js, 0, 7)) +>require('./second').nested : Symbol(nested, Decl(second.js, 0, 18)) >require : Symbol(require) +>nested : Symbol(nested, Decl(second.js, 0, 18)) hardline >hardline : Symbol(hardline, Decl(main.js, 0, 7)) +=== first.js === +const hardline = { type: "hard" } +>hardline : Symbol(hardline, Decl(first.js, 0, 5)) +>type : Symbol(type, Decl(first.js, 0, 18)) + +module.exports = { +>module.exports : Symbol(export=, Decl(first.js, 0, 33)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(first.js, 0, 33)) + + hardline +>hardline : Symbol(hardline, Decl(first.js, 1, 18)) +} + + +=== second.js === +module.exports = { +>module.exports : Symbol(export=, Decl(second.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(second.js, 0, 0)) + + nested: require('./first') +>nested : Symbol(nested, Decl(second.js, 0, 18)) +>require : Symbol(require) + +}; + diff --git a/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols.diff b/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols.diff index bf249a8752..bd49fde05b 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols.diff @@ -1,41 +1,39 @@ --- old.commonJSReexport.symbols +++ new.commonJSReexport.symbols -@@= skipped -2, +2 lines =@@ - === main.js === - const { hardline } = require('./second').nested; +@@= skipped -4, +4 lines =@@ >hardline : Symbol(hardline, Decl(main.js, 0, 7)) -->require('./second').nested : Symbol(nested, Decl(second.js, 0, 18)) + >require('./second').nested : Symbol(nested, Decl(second.js, 0, 18)) >require : Symbol(require) ->'./second' : Symbol("second", Decl(second.js, 0, 0)) -->nested : Symbol(nested, Decl(second.js, 0, 18)) + >nested : Symbol(nested, Decl(second.js, 0, 18)) hardline - >hardline : Symbol(hardline, Decl(main.js, 0, 7)) -- --=== first.js === --const hardline = { type: "hard" } -->hardline : Symbol(hardline, Decl(first.js, 0, 5)) -->type : Symbol(type, Decl(first.js, 0, 18)) -- --module.exports = { +@@= skipped -12, +11 lines =@@ + >type : Symbol(type, Decl(first.js, 0, 18)) + + module.exports = { ->module.exports : Symbol(module.exports, Decl(first.js, 0, 0)) ->module : Symbol(module, Decl(first.js, 0, 33)) ->exports : Symbol(module.exports, Decl(first.js, 0, 0)) -- -- hardline -->hardline : Symbol(hardline, Decl(first.js, 1, 18)) --} -- -- --=== second.js === --module.exports = { ++>module.exports : Symbol(export=, Decl(first.js, 0, 33)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(first.js, 0, 33)) + + hardline + >hardline : Symbol(hardline, Decl(first.js, 1, 18)) +@@= skipped -11, +11 lines =@@ + + === second.js === + module.exports = { ->module.exports : Symbol(module.exports, Decl(second.js, 0, 0)) ->module : Symbol(export=, Decl(second.js, 0, 0)) -->exports : Symbol(export=, Decl(second.js, 0, 0)) -- -- nested: require('./first') -->nested : Symbol(nested, Decl(second.js, 0, 18)) -->require : Symbol(require) ++>module.exports : Symbol(export=, Decl(second.js, 0, 0)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(second.js, 0, 0)) + + nested: require('./first') + >nested : Symbol(nested, Decl(second.js, 0, 18)) + >require : Symbol(require) ->'./first' : Symbol("first", Decl(first.js, 0, 0)) -- --}; + + }; diff --git a/testdata/baselines/reference/submodule/conformance/commonJSReexport.types b/testdata/baselines/reference/submodule/conformance/commonJSReexport.types index 5a6d596276..396924551e 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSReexport.types +++ b/testdata/baselines/reference/submodule/conformance/commonJSReexport.types @@ -2,13 +2,48 @@ === main.js === const { hardline } = require('./second').nested; ->hardline : any ->require('./second').nested : any ->require('./second') : any +>hardline : { type: string; } +>require('./second').nested : { hardline: { type: string; }; } +>require('./second') : { nested: { hardline: { type: string; }; }; } >require : any >'./second' : "./second" ->nested : any +>nested : { hardline: { type: string; }; } hardline ->hardline : any +>hardline : { type: string; } + +=== first.js === +const hardline = { type: "hard" } +>hardline : { type: string; } +>{ type: "hard" } : { type: string; } +>type : string +>"hard" : "hard" + +module.exports = { +>module.exports = { hardline} : { hardline: { type: string; }; } +>module.exports : { hardline: { type: string; }; } +>module : { "export=": { hardline: { type: string; }; }; } +>exports : { hardline: { type: string; }; } +>{ hardline} : { hardline: { type: string; }; } + + hardline +>hardline : { type: string; } +} + + +=== second.js === +module.exports = { +>module.exports = { nested: require('./first')} : { nested: { hardline: { type: string; }; }; } +>module.exports : { nested: { hardline: { type: string; }; }; } +>module : { "export=": { nested: { hardline: { type: string; }; }; }; } +>exports : { nested: { hardline: { type: string; }; }; } +>{ nested: require('./first')} : { nested: { hardline: { type: string; }; }; } + + nested: require('./first') +>nested : { hardline: { type: string; }; } +>require('./first') : { hardline: { type: string; }; } +>require : any +>'./first' : "./first" + +}; diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt new file mode 100644 index 0000000000..b02d019f6c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt @@ -0,0 +1,15 @@ +main.ts(1,22): error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + + +==== main.ts (1 errors) ==== + import mod = require("./dir/native.node"); + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + mod.doNativeThing("good"); + +==== package.json (0 errors) ==== + {"type": "module"} +==== dir/package.json (0 errors) ==== + {"type": "commonjs"} +==== dir/native.d.node.ts (0 errors) ==== + export function doNativeThing(flag: string): unknown; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt.diff index 205b4b3208..3a70da5bf4 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt.diff @@ -2,18 +2,14 @@ +++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt @@= skipped -0, +0 lines =@@ -main.ts(1,22): error TS6263: Module './dir/native.node' was resolved to 'dir/native.d.node.ts', but '--allowArbitraryExtensions' is not set. -- -- --==== main.ts (1 errors) ==== -- import mod = require("./dir/native.node"); -- ~~~~~~~~~~~~~~~~~~~ ++main.ts(1,22): error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + + + ==== main.ts (1 errors) ==== + import mod = require("./dir/native.node"); + ~~~~~~~~~~~~~~~~~~~ -!!! error TS6263: Module './dir/native.node' was resolved to 'dir/native.d.node.ts', but '--allowArbitraryExtensions' is not set. -- mod.doNativeThing("good"); -- --==== package.json (0 errors) ==== -- {"type": "module"} --==== dir/package.json (0 errors) ==== -- {"type": "commonjs"} --==== dir/native.d.node.ts (0 errors) ==== -- export function doNativeThing(flag: string): unknown; -+ \ No newline at end of file ++!!! error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + mod.doNativeThing("good"); + + ==== package.json (0 errors) ==== \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols index f95e518bed..ea430da48c 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols @@ -5,12 +5,5 @@ import mod = require("./dir/native.node"); >mod : Symbol(mod, Decl(main.ts, 0, 0)) mod.doNativeThing("good"); ->mod.doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) >mod : Symbol(mod, Decl(main.ts, 0, 0)) ->doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) - -=== dir/native.d.node.ts === -export function doNativeThing(flag: string): unknown; ->doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) ->flag : Symbol(flag, Decl(native.d.node.ts, 0, 30)) diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols.diff deleted file mode 100644 index d15932c4c5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols -@@= skipped -4, +4 lines =@@ - >mod : Symbol(mod, Decl(main.ts, 0, 0)) - - mod.doNativeThing("good"); -+>mod.doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) - >mod : Symbol(mod, Decl(main.ts, 0, 0)) -+>doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) -+ -+=== dir/native.d.node.ts === -+export function doNativeThing(flag: string): unknown; -+>doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) -+>flag : Symbol(flag, Decl(native.d.node.ts, 0, 30)) diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types index 96373ebb9b..8beb10bd23 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types @@ -2,17 +2,12 @@ === main.ts === import mod = require("./dir/native.node"); ->mod : typeof mod +>mod : any mod.doNativeThing("good"); ->mod.doNativeThing("good") : unknown ->mod.doNativeThing : (flag: string) => unknown ->mod : typeof mod ->doNativeThing : (flag: string) => unknown +>mod.doNativeThing("good") : any +>mod.doNativeThing : any +>mod : any +>doNativeThing : any >"good" : "good" -=== dir/native.d.node.ts === -export function doNativeThing(flag: string): unknown; ->doNativeThing : (flag: string) => unknown ->flag : string - diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types.diff deleted file mode 100644 index eb5b55b3e2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types -@@= skipped -1, +1 lines =@@ - - === main.ts === - import mod = require("./dir/native.node"); -->mod : any -+>mod : typeof mod - - mod.doNativeThing("good"); -->mod.doNativeThing("good") : any -->mod.doNativeThing : any -->mod : any -->doNativeThing : any -+>mod.doNativeThing("good") : unknown -+>mod.doNativeThing : (flag: string) => unknown -+>mod : typeof mod -+>doNativeThing : (flag: string) => unknown - >"good" : "good" -+ -+=== dir/native.d.node.ts === -+export function doNativeThing(flag: string): unknown; -+>doNativeThing : (flag: string) => unknown -+>flag : string diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt new file mode 100644 index 0000000000..b02d019f6c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt @@ -0,0 +1,15 @@ +main.ts(1,22): error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + + +==== main.ts (1 errors) ==== + import mod = require("./dir/native.node"); + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + mod.doNativeThing("good"); + +==== package.json (0 errors) ==== + {"type": "module"} +==== dir/package.json (0 errors) ==== + {"type": "commonjs"} +==== dir/native.d.node.ts (0 errors) ==== + export function doNativeThing(flag: string): unknown; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt.diff index 6075245c91..5ab7ae5bd1 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt.diff @@ -2,18 +2,14 @@ +++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt @@= skipped -0, +0 lines =@@ -main.ts(1,22): error TS6263: Module './dir/native.node' was resolved to 'dir/native.d.node.ts', but '--allowArbitraryExtensions' is not set. -- -- --==== main.ts (1 errors) ==== -- import mod = require("./dir/native.node"); -- ~~~~~~~~~~~~~~~~~~~ ++main.ts(1,22): error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + + + ==== main.ts (1 errors) ==== + import mod = require("./dir/native.node"); + ~~~~~~~~~~~~~~~~~~~ -!!! error TS6263: Module './dir/native.node' was resolved to 'dir/native.d.node.ts', but '--allowArbitraryExtensions' is not set. -- mod.doNativeThing("good"); -- --==== package.json (0 errors) ==== -- {"type": "module"} --==== dir/package.json (0 errors) ==== -- {"type": "commonjs"} --==== dir/native.d.node.ts (0 errors) ==== -- export function doNativeThing(flag: string): unknown; -+ \ No newline at end of file ++!!! error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + mod.doNativeThing("good"); + + ==== package.json (0 errors) ==== \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols index f95e518bed..ea430da48c 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols @@ -5,12 +5,5 @@ import mod = require("./dir/native.node"); >mod : Symbol(mod, Decl(main.ts, 0, 0)) mod.doNativeThing("good"); ->mod.doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) >mod : Symbol(mod, Decl(main.ts, 0, 0)) ->doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) - -=== dir/native.d.node.ts === -export function doNativeThing(flag: string): unknown; ->doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) ->flag : Symbol(flag, Decl(native.d.node.ts, 0, 30)) diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols.diff deleted file mode 100644 index b5e5f9676c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols -@@= skipped -4, +4 lines =@@ - >mod : Symbol(mod, Decl(main.ts, 0, 0)) - - mod.doNativeThing("good"); -+>mod.doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) - >mod : Symbol(mod, Decl(main.ts, 0, 0)) -+>doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) -+ -+=== dir/native.d.node.ts === -+export function doNativeThing(flag: string): unknown; -+>doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) -+>flag : Symbol(flag, Decl(native.d.node.ts, 0, 30)) diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types index 96373ebb9b..8beb10bd23 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types @@ -2,17 +2,12 @@ === main.ts === import mod = require("./dir/native.node"); ->mod : typeof mod +>mod : any mod.doNativeThing("good"); ->mod.doNativeThing("good") : unknown ->mod.doNativeThing : (flag: string) => unknown ->mod : typeof mod ->doNativeThing : (flag: string) => unknown +>mod.doNativeThing("good") : any +>mod.doNativeThing : any +>mod : any +>doNativeThing : any >"good" : "good" -=== dir/native.d.node.ts === -export function doNativeThing(flag: string): unknown; ->doNativeThing : (flag: string) => unknown ->flag : string - diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types.diff deleted file mode 100644 index afde6f3ec6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types -@@= skipped -1, +1 lines =@@ - - === main.ts === - import mod = require("./dir/native.node"); -->mod : any -+>mod : typeof mod - - mod.doNativeThing("good"); -->mod.doNativeThing("good") : any -->mod.doNativeThing : any -->mod : any -->doNativeThing : any -+>mod.doNativeThing("good") : unknown -+>mod.doNativeThing : (flag: string) => unknown -+>mod : typeof mod -+>doNativeThing : (flag: string) => unknown - >"good" : "good" -+ -+=== dir/native.d.node.ts === -+export function doNativeThing(flag: string): unknown; -+>doNativeThing : (flag: string) => unknown -+>flag : string diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols index e5a0af6347..bd1cc110ec 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols @@ -4,6 +4,7 @@ const Bar = require("./bar"); >Bar : Symbol(Bar, Decl(cls.js, 0, 5)) >require : Symbol(require) +>"./bar" : Symbol("bar", Decl(bar.js, 0, 0)) const Strings = { >Strings : Symbol(Strings, Decl(cls.js, 1, 5)) @@ -31,3 +32,13 @@ module.exports.Strings = Strings; >exports : Symbol(Foo, Decl(cls.js, 4, 2)) >Strings : Symbol(Strings, Decl(cls.js, 1, 5)) +=== bar.js === +class Bar {} +>Bar : Symbol(Bar, Decl(bar.js, 0, 0)) + +module.exports = Bar; +>module.exports : Symbol(Bar, Decl(bar.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(Bar, Decl(bar.js, 0, 0)) +>Bar : Symbol(Bar, Decl(bar.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff index 48e1df3f49..92f53b9b9c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff @@ -1,14 +1,6 @@ --- old.jsDeclarationsClassExtendsVisibility.symbols +++ new.jsDeclarationsClassExtendsVisibility.symbols -@@= skipped -3, +3 lines =@@ - const Bar = require("./bar"); - >Bar : Symbol(Bar, Decl(cls.js, 0, 5)) - >require : Symbol(require) -->"./bar" : Symbol("bar", Decl(bar.js, 0, 0)) - - const Strings = { - >Strings : Symbol(Strings, Decl(cls.js, 1, 5)) -@@= skipped -17, +16 lines =@@ +@@= skipped -20, +20 lines =@@ >Bar : Symbol(Bar, Decl(cls.js, 0, 5)) module.exports = Foo; @@ -30,13 +22,16 @@ +>module : Symbol(module.exports) +>exports : Symbol(Foo, Decl(cls.js, 4, 2)) >Strings : Symbol(Strings, Decl(cls.js, 1, 5)) -- --=== bar.js === --class Bar {} -->Bar : Symbol(Bar, Decl(bar.js, 0, 0)) -- --module.exports = Bar; + + === bar.js === +@@= skipped -18, +16 lines =@@ + >Bar : Symbol(Bar, Decl(bar.js, 0, 0)) + + module.exports = Bar; ->module.exports : Symbol(module.exports, Decl(bar.js, 0, 0)) ->module : Symbol(export=, Decl(bar.js, 0, 12)) ->exports : Symbol(export=, Decl(bar.js, 0, 12)) -->Bar : Symbol(Bar, Decl(bar.js, 0, 0)) ++>module.exports : Symbol(Bar, Decl(bar.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(Bar, Decl(bar.js, 0, 0)) + >Bar : Symbol(Bar, Decl(bar.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types index 0ee6696aa2..d2474b76c9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types @@ -2,8 +2,8 @@ === cls.js === const Bar = require("./bar"); ->Bar : any ->require("./bar") : any +>Bar : typeof Bar +>require("./bar") : typeof Bar >require : any >"./bar" : "./bar" @@ -22,7 +22,7 @@ const Strings = { }; class Foo extends Bar {} >Foo : Foo ->Bar : any +>Bar : Bar module.exports = Foo; >module.exports = Foo : typeof Foo @@ -40,3 +40,14 @@ module.exports.Strings = Strings; >Strings : any >Strings : { a: string; b: string; } +=== bar.js === +class Bar {} +>Bar : Bar + +module.exports = Bar; +>module.exports = Bar : typeof Bar +>module.exports : typeof Bar +>module : { Bar: typeof Bar; } +>exports : typeof Bar +>Bar : typeof Bar + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols index 5fa419d304..c23777b7c5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols @@ -4,7 +4,9 @@ 'use strict'; const Thing = require('./thing').Thing >Thing : Symbol(Thing, Decl(reexport.js, 1, 5)) +>require('./thing').Thing : Symbol(Thing, Decl(thing.js, 2, 18)) >require : Symbol(require) +>Thing : Symbol(Thing, Decl(thing.js, 2, 18)) module.exports = { Thing } >module.exports : Symbol(export=, Decl(reexport.js, 1, 38)) @@ -12,3 +14,14 @@ module.exports = { Thing } >exports : Symbol(export=, Decl(reexport.js, 1, 38)) >Thing : Symbol(Thing, Decl(reexport.js, 2, 18)) +=== thing.js === +'use strict'; +class Thing {} +>Thing : Symbol(Thing, Decl(thing.js, 0, 13)) + +module.exports = { Thing } +>module.exports : Symbol(export=, Decl(thing.js, 1, 14)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(thing.js, 1, 14)) +>Thing : Symbol(Thing, Decl(thing.js, 2, 18)) + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols.diff index 794862eb4a..af6fef4536 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols.diff @@ -1,13 +1,11 @@ --- old.jsDeclarationsCommonjsRelativePath.symbols +++ new.jsDeclarationsCommonjsRelativePath.symbols -@@= skipped -3, +3 lines =@@ - 'use strict'; - const Thing = require('./thing').Thing +@@= skipped -5, +5 lines =@@ >Thing : Symbol(Thing, Decl(reexport.js, 1, 5)) -->require('./thing').Thing : Symbol(Thing, Decl(thing.js, 2, 18)) + >require('./thing').Thing : Symbol(Thing, Decl(thing.js, 2, 18)) >require : Symbol(require) ->'./thing' : Symbol("thing", Decl(thing.js, 0, 0)) -->Thing : Symbol(Thing, Decl(thing.js, 2, 18)) + >Thing : Symbol(Thing, Decl(thing.js, 2, 18)) module.exports = { Thing } ->module.exports : Symbol(module.exports, Decl(reexport.js, 0, 0)) @@ -17,14 +15,16 @@ +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(reexport.js, 1, 38)) >Thing : Symbol(Thing, Decl(reexport.js, 2, 18)) -- --=== thing.js === --'use strict'; --class Thing {} -->Thing : Symbol(Thing, Decl(thing.js, 0, 13)) -- --module.exports = { Thing } + + === thing.js === +@@= skipped -15, +14 lines =@@ + >Thing : Symbol(Thing, Decl(thing.js, 0, 13)) + + module.exports = { Thing } ->module.exports : Symbol(module.exports, Decl(thing.js, 0, 0)) ->module : Symbol(module, Decl(thing.js, 1, 14)) ->exports : Symbol(module.exports, Decl(thing.js, 0, 0)) -->Thing : Symbol(Thing, Decl(thing.js, 2, 18)) ++>module.exports : Symbol(export=, Decl(thing.js, 1, 14)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(thing.js, 1, 14)) + >Thing : Symbol(Thing, Decl(thing.js, 2, 18)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.types index a0355d1242..592e8c0187 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.types @@ -5,18 +5,33 @@ >'use strict' : "use strict" const Thing = require('./thing').Thing ->Thing : any ->require('./thing').Thing : any ->require('./thing') : any +>Thing : typeof Thing +>require('./thing').Thing : typeof Thing +>require('./thing') : { Thing: typeof Thing; } >require : any >'./thing' : "./thing" ->Thing : any +>Thing : typeof Thing module.exports = { Thing } ->module.exports = { Thing } : { Thing: any; } ->module.exports : { Thing: any; } ->module : { "export=": { Thing: any; }; } ->exports : { Thing: any; } ->{ Thing } : { Thing: any; } ->Thing : any +>module.exports = { Thing } : { Thing: typeof Thing; } +>module.exports : { Thing: typeof Thing; } +>module : { "export=": { Thing: typeof Thing; }; } +>exports : { Thing: typeof Thing; } +>{ Thing } : { Thing: typeof Thing; } +>Thing : typeof Thing + +=== thing.js === +'use strict'; +>'use strict' : "use strict" + +class Thing {} +>Thing : Thing + +module.exports = { Thing } +>module.exports = { Thing } : { Thing: typeof Thing; } +>module.exports : { Thing: typeof Thing; } +>module : { "export=": { Thing: typeof Thing; }; } +>exports : { Thing: typeof Thing; } +>{ Thing } : { Thing: typeof Thing; } +>Thing : typeof Thing diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols index aa6482c795..a7775109f2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols @@ -4,6 +4,7 @@ const Obj = require("./obj"); >Obj : Symbol(Obj, Decl(index.js, 0, 5)) >require : Symbol(require) +>"./obj" : Symbol("obj", Decl(obj.js, 0, 0)) class Container { >Container : Symbol(Container, Decl(index.js, 0, 29)) @@ -23,3 +24,17 @@ module.exports = Container; >exports : Symbol(Container, Decl(index.js, 0, 29)) >Container : Symbol(Container, Decl(index.js, 0, 29)) +=== obj.js === +module.exports = class Obj { +>module.exports : Symbol(Obj, Decl(obj.js, 0, 16)) +>module : Symbol(module.exports) +>exports : Symbol(Obj, Decl(obj.js, 0, 16)) +>Obj : Symbol(Obj, Decl(obj.js, 0, 16)) + + constructor() { + this.x = 12; +>this.x : Symbol(x, Decl(obj.js, 1, 19)) +>this : Symbol(Obj, Decl(obj.js, 0, 16)) +>x : Symbol(x, Decl(obj.js, 1, 19)) + } +} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff index ec67a8c03f..63f91e6644 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff @@ -1,13 +1,6 @@ --- old.jsDeclarationsExportAssignedVisibility.symbols +++ new.jsDeclarationsExportAssignedVisibility.symbols -@@= skipped -3, +3 lines =@@ - const Obj = require("./obj"); - >Obj : Symbol(Obj, Decl(index.js, 0, 5)) - >require : Symbol(require) -->"./obj" : Symbol("obj", Decl(obj.js, 0, 0)) - - class Container { - >Container : Symbol(Container, Decl(index.js, 0, 29)) +@@= skipped -10, +10 lines =@@ constructor() { this.usage = new Obj(); @@ -29,17 +22,22 @@ +>exports : Symbol(Container, Decl(index.js, 0, 29)) >Container : Symbol(Container, Decl(index.js, 0, 29)) --=== obj.js === --module.exports = class Obj { + === obj.js === + module.exports = class Obj { ->module.exports : Symbol(module.exports, Decl(obj.js, 0, 0)) ->module : Symbol(export=, Decl(obj.js, 0, 0)) ->exports : Symbol(export=, Decl(obj.js, 0, 0)) -->Obj : Symbol(Obj, Decl(obj.js, 0, 16)) -- -- constructor() { -- this.x = 12; ++>module.exports : Symbol(Obj, Decl(obj.js, 0, 16)) ++>module : Symbol(module.exports) ++>exports : Symbol(Obj, Decl(obj.js, 0, 16)) + >Obj : Symbol(Obj, Decl(obj.js, 0, 16)) + + constructor() { + this.x = 12; ->this.x : Symbol(Obj.x, Decl(obj.js, 1, 19)) -->this : Symbol(Obj, Decl(obj.js, 0, 16)) ++>this.x : Symbol(x, Decl(obj.js, 1, 19)) + >this : Symbol(Obj, Decl(obj.js, 0, 16)) ->x : Symbol(Obj.x, Decl(obj.js, 1, 19)) -- } --} \ No newline at end of file ++>x : Symbol(x, Decl(obj.js, 1, 19)) + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types index ce28dd2e18..5c413e4beb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types @@ -2,8 +2,8 @@ === index.js === const Obj = require("./obj"); ->Obj : any ->require("./obj") : any +>Obj : typeof Obj +>require("./obj") : typeof Obj >require : any >"./obj" : "./obj" @@ -12,12 +12,12 @@ class Container { constructor() { this.usage = new Obj(); ->this.usage = new Obj() : any ->this.usage : any +>this.usage = new Obj() : Obj +>this.usage : Obj >this : this ->usage : any ->new Obj() : any ->Obj : any +>usage : Obj +>new Obj() : Obj +>Obj : typeof Obj } } @@ -28,3 +28,21 @@ module.exports = Container; >exports : typeof Container >Container : typeof Container +=== obj.js === +module.exports = class Obj { +>module.exports = class Obj { constructor() { this.x = 12; }} : typeof import("./obj") +>module.exports : typeof import("./obj") +>module : { Obj: typeof import("./obj"); } +>exports : typeof import("./obj") +>class Obj { constructor() { this.x = 12; }} : typeof import("./obj") +>Obj : typeof import("./obj") + + constructor() { + this.x = 12; +>this.x = 12 : 12 +>this.x : number +>this : this +>x : number +>12 : 12 + } +} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols index cef4a1612c..6a59046478 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols @@ -5,6 +5,7 @@ const errors = require("./errors"); >errors : Symbol(errors, Decl(index.js, 1, 5)) >require : Symbol(require) +>"./errors" : Symbol("utils/errors", Decl(errors.js, 0, 0)) module.exports = { >module.exports : Symbol(export=, Decl(index.js, 1, 35)) @@ -15,3 +16,27 @@ module.exports = { >errors : Symbol(errors, Decl(index.js, 3, 18)) }; +=== utils/errors.js === +class FancyError extends Error { +>FancyError : Symbol(FancyError, Decl(errors.js, 0, 0)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + + constructor(status) { +>status : Symbol(status, Decl(errors.js, 1, 16)) + + super(`error with status ${status}`); +>super : Symbol(ErrorConstructor, Decl(lib.es5.d.ts, --, --)) +>status : Symbol(status, Decl(errors.js, 1, 16)) + } +} + +module.exports = { +>module.exports : Symbol(export=, Decl(errors.js, 4, 1)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(errors.js, 4, 1)) + + FancyError +>FancyError : Symbol(FancyError, Decl(errors.js, 6, 18)) + +}; + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols.diff index 06277f7425..84b38aaf06 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols.diff @@ -5,6 +5,7 @@ >errors : Symbol(errors, Decl(index.js, 1, 5)) >require : Symbol(require) ->"./errors" : Symbol(errors, Decl(errors.js, 0, 0)) ++>"./errors" : Symbol("utils/errors", Decl(errors.js, 0, 0)) module.exports = { ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) @@ -16,29 +17,16 @@ errors >errors : Symbol(errors, Decl(index.js, 3, 18)) +@@= skipped -26, +26 lines =@@ + } - }; --=== utils/errors.js === --class FancyError extends Error { -->FancyError : Symbol(FancyError, Decl(errors.js, 0, 0)) -->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -- -- constructor(status) { -->status : Symbol(status, Decl(errors.js, 1, 16)) -- -- super(`error with status ${status}`); -->super : Symbol(ErrorConstructor, Decl(lib.es5.d.ts, --, --)) -->status : Symbol(status, Decl(errors.js, 1, 16)) -- } --} -- --module.exports = { + module.exports = { ->module.exports : Symbol(module.exports, Decl(errors.js, 0, 0)) ->module : Symbol(module, Decl(errors.js, 4, 1)) ->exports : Symbol(module.exports, Decl(errors.js, 0, 0)) -- -- FancyError -->FancyError : Symbol(FancyError, Decl(errors.js, 6, 18)) -- --}; -- \ No newline at end of file ++>module.exports : Symbol(export=, Decl(errors.js, 4, 1)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(errors.js, 4, 1)) + + FancyError + >FancyError : Symbol(FancyError, Decl(errors.js, 6, 18)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.types index 8419e558f6..0325a9c160 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.types @@ -3,19 +3,47 @@ === utils/index.js === // issue arises here on compilation const errors = require("./errors"); ->errors : any ->require("./errors") : any +>errors : { FancyError: typeof FancyError; } +>require("./errors") : { FancyError: typeof FancyError; } >require : any >"./errors" : "./errors" module.exports = { ->module.exports = { errors} : { errors: any; } ->module.exports : { errors: any; } ->module : { "export=": { errors: any; }; } ->exports : { errors: any; } ->{ errors} : { errors: any; } +>module.exports = { errors} : { errors: { FancyError: typeof FancyError; }; } +>module.exports : { errors: { FancyError: typeof FancyError; }; } +>module : { "export=": { errors: { FancyError: typeof FancyError; }; }; } +>exports : { errors: { FancyError: typeof FancyError; }; } +>{ errors} : { errors: { FancyError: typeof FancyError; }; } errors ->errors : any +>errors : { FancyError: typeof FancyError; } }; +=== utils/errors.js === +class FancyError extends Error { +>FancyError : FancyError +>Error : Error + + constructor(status) { +>status : any + + super(`error with status ${status}`); +>super(`error with status ${status}`) : void +>super : ErrorConstructor +>`error with status ${status}` : string +>status : any + } +} + +module.exports = { +>module.exports = { FancyError} : { FancyError: typeof FancyError; } +>module.exports : { FancyError: typeof FancyError; } +>module : { "export=": { FancyError: typeof FancyError; }; } +>exports : { FancyError: typeof FancyError; } +>{ FancyError} : { FancyError: typeof FancyError; } + + FancyError +>FancyError : typeof FancyError + +}; + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt index 94f4922e68..b12f06b6fa 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt @@ -1,9 +1,15 @@ +file.js(4,11): error TS2315: Type 'Object' is not generic. +file.js(10,51): error TS2300: Duplicate identifier 'myTypes'. +file.js(13,13): error TS2300: Duplicate identifier 'myTypes'. +file.js(18,15): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. +file.js(18,39): error TS2300: Duplicate identifier 'myTypes'. file2.js(6,11): error TS2315: Type 'Object' is not generic. +file2.js(12,23): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. file2.js(17,12): error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. file2.js(28,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== file2.js (3 errors) ==== +==== file2.js (4 errors) ==== const {myTypes} = require('./file.js'); /** @@ -18,6 +24,8 @@ file2.js(28,1): error TS2309: An export assignment cannot be used in a module wi }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ + ~~~~~~~ +!!! error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. /** * @function testFn @@ -38,24 +46,34 @@ file2.js(28,1): error TS2309: An export assignment cannot be used in a module wi module.exports = {testFn, testFnTypes}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== file.js (0 errors) ==== +==== file.js (5 errors) ==== /** * @namespace myTypes * @global * @type {Object} + ~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. */ const myTypes = { // SOME PROPS HERE }; /** @typedef {string|RegExp|Array} myTypes.typeA */ + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'myTypes'. /** * @typedef myTypes.typeB + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'myTypes'. * @property {myTypes.typeA} prop1 - Prop 1. * @property {string} prop2 - Prop 2. */ /** @typedef {myTypes.typeB|Function} myTypes.typeC */ + ~~~~~~~ +!!! error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'myTypes'. exports.myTypes = myTypes; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols index e22c914a4c..3882b91669 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols @@ -4,6 +4,7 @@ const {myTypes} = require('./file.js'); >myTypes : Symbol(myTypes, Decl(file2.js, 0, 7)) >require : Symbol(require) +>'./file.js' : Symbol("file", Decl(file.js, 0, 0)) /** * @namespace testFnTypes @@ -46,3 +47,31 @@ module.exports = {testFn, testFnTypes}; >testFn : Symbol(testFn, Decl(file2.js, 27, 18)) >testFnTypes : Symbol(testFnTypes, Decl(file2.js, 27, 25)) +=== file.js === +/** + * @namespace myTypes + * @global + * @type {Object} + */ +const myTypes = { +>myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 4), Decl(file.js, 12, 3), Decl(file.js, 17, 4)) + + // SOME PROPS HERE +}; + +/** @typedef {string|RegExp|Array} myTypes.typeA */ + +/** + * @typedef myTypes.typeB + * @property {myTypes.typeA} prop1 - Prop 1. + * @property {string} prop2 - Prop 2. + */ + +/** @typedef {myTypes.typeB|Function} myTypes.typeC */ + +exports.myTypes = myTypes; +>exports.myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 7, 2)) +>exports : Symbol("file", Decl(file.js, 0, 0)) +>myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 7, 2)) +>myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 4), Decl(file.js, 12, 3), Decl(file.js, 17, 4)) + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff index 1532ac94c7..a6952ae113 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff @@ -1,14 +1,6 @@ --- old.jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols +++ new.jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols -@@= skipped -3, +3 lines =@@ - const {myTypes} = require('./file.js'); - >myTypes : Symbol(myTypes, Decl(file2.js, 0, 7)) - >require : Symbol(require) -->'./file.js' : Symbol("file", Decl(file.js, 0, 0)) - - /** - * @namespace testFnTypes -@@= skipped -8, +7 lines =@@ +@@= skipped -11, +11 lines =@@ * @type {Object} */ const testFnTypes = { @@ -29,31 +21,25 @@ +>exports : Symbol(export=, Decl(file2.js, 25, 1)) >testFn : Symbol(testFn, Decl(file2.js, 27, 18)) >testFnTypes : Symbol(testFnTypes, Decl(file2.js, 27, 25)) -- --=== file.js === --/** -- * @namespace myTypes -- * @global -- * @type {Object} -- */ --const myTypes = { + +@@= skipped -13, +13 lines =@@ + * @type {Object} + */ + const myTypes = { ->myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 50), Decl(file.js, 12, 12), Decl(file.js, 17, 38)) -- -- // SOME PROPS HERE --}; -- --/** @typedef {string|RegExp|Array} myTypes.typeA */ -- --/** -- * @typedef myTypes.typeB -- * @property {myTypes.typeA} prop1 - Prop 1. -- * @property {string} prop2 - Prop 2. -- */ -- --/** @typedef {myTypes.typeB|Function} myTypes.typeC */ -- --exports.myTypes = myTypes; ++>myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 4), Decl(file.js, 12, 3), Decl(file.js, 17, 4)) + + // SOME PROPS HERE + }; +@@= skipped -16, +16 lines =@@ + /** @typedef {myTypes.typeB|Function} myTypes.typeC */ + + exports.myTypes = myTypes; ->exports.myTypes : Symbol(myTypes, Decl(file.js, 7, 2)) ->exports : Symbol(myTypes, Decl(file.js, 7, 2)) ->myTypes : Symbol(myTypes, Decl(file.js, 7, 2)) ->myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 50), Decl(file.js, 12, 12), Decl(file.js, 17, 38)) ++>exports.myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 7, 2)) ++>exports : Symbol("file", Decl(file.js, 0, 0)) ++>myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 7, 2)) ++>myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 4), Decl(file.js, 12, 3), Decl(file.js, 17, 4)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types index c09ee82411..829b051a9f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types @@ -3,7 +3,7 @@ === file2.js === const {myTypes} = require('./file.js'); >myTypes : any ->require('./file.js') : any +>require('./file.js') : typeof import("./file.js") >require : any >'./file.js' : "./file.js" @@ -56,3 +56,33 @@ module.exports = {testFn, testFnTypes}; >testFn : (input: testFnTypes.input) => number >testFnTypes : any +=== file.js === +/** + * @namespace myTypes + * @global + * @type {Object} + */ +const myTypes = { +>myTypes : any +>{ // SOME PROPS HERE} : {} + + // SOME PROPS HERE +}; + +/** @typedef {string|RegExp|Array} myTypes.typeA */ + +/** + * @typedef myTypes.typeB + * @property {myTypes.typeA} prop1 - Prop 1. + * @property {string} prop2 - Prop 2. + */ + +/** @typedef {myTypes.typeB|Function} myTypes.typeC */ + +exports.myTypes = myTypes; +>exports.myTypes = myTypes : any +>exports.myTypes : any +>exports : typeof import("./file") +>myTypes : any +>myTypes : any + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols index eee4bacaf2..b353281ce8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols @@ -3,8 +3,10 @@ === main.js === const { SomeClass, SomeClass: Another } = require('./lib'); >SomeClass : Symbol(SomeClass, Decl(main.js, 0, 7)) +>SomeClass : Symbol(SomeClass, Decl(lib.js, 14, 8)) >Another : Symbol(Another, Decl(main.js, 0, 18)) >require : Symbol(require) +>'./lib' : Symbol("lib", Decl(lib.js, 0, 0)) module.exports = { >module.exports : Symbol(export=, Decl(main.js, 0, 59)) @@ -17,3 +19,37 @@ module.exports = { Another >Another : Symbol(Another, Decl(main.js, 3, 14)) } +=== lib.js === +/** + * @param {string} a + */ +function bar(a) { +>bar : Symbol(bar, Decl(lib.js, 0, 0)) +>a : Symbol(a, Decl(lib.js, 3, 13)) + + return a + a; +>a : Symbol(a, Decl(lib.js, 3, 13)) +>a : Symbol(a, Decl(lib.js, 3, 13)) +} + +class SomeClass { +>SomeClass : Symbol(SomeClass, Decl(lib.js, 5, 1)) + + a() { +>a : Symbol(a, Decl(lib.js, 7, 17)) + + return 1; + } +} + +module.exports = { +>module.exports : Symbol(export=, Decl(lib.js, 11, 1)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(lib.js, 11, 1)) + + bar, +>bar : Symbol(bar, Decl(lib.js, 13, 18)) + + SomeClass +>SomeClass : Symbol(SomeClass, Decl(lib.js, 14, 8)) +} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols.diff index 9e40ca7489..2214e6e237 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols.diff @@ -1,13 +1,7 @@ --- old.jsDeclarationsReexportedCjsAlias.symbols +++ new.jsDeclarationsReexportedCjsAlias.symbols -@@= skipped -2, +2 lines =@@ - === main.js === - const { SomeClass, SomeClass: Another } = require('./lib'); - >SomeClass : Symbol(SomeClass, Decl(main.js, 0, 7)) -->SomeClass : Symbol(SomeClass, Decl(lib.js, 14, 8)) - >Another : Symbol(Another, Decl(main.js, 0, 18)) - >require : Symbol(require) -->'./lib' : Symbol("lib", Decl(lib.js, 0, 0)) +@@= skipped -8, +8 lines =@@ + >'./lib' : Symbol("lib", Decl(lib.js, 0, 0)) module.exports = { ->module.exports : Symbol(module.exports, Decl(main.js, 0, 0)) @@ -19,41 +13,24 @@ SomeClass, >SomeClass : Symbol(SomeClass, Decl(main.js, 2, 18)) +@@= skipped -27, +27 lines =@@ + >SomeClass : Symbol(SomeClass, Decl(lib.js, 5, 1)) - Another - >Another : Symbol(Another, Decl(main.js, 3, 14)) --} --=== lib.js === --/** -- * @param {string} a -- */ --function bar(a) { -->bar : Symbol(bar, Decl(lib.js, 0, 0)) -->a : Symbol(a, Decl(lib.js, 3, 13)) -- -- return a + a; -->a : Symbol(a, Decl(lib.js, 3, 13)) -->a : Symbol(a, Decl(lib.js, 3, 13)) --} -- --class SomeClass { -->SomeClass : Symbol(SomeClass, Decl(lib.js, 5, 1)) -- -- a() { + a() { ->a : Symbol(SomeClass.a, Decl(lib.js, 7, 17)) -- -- return 1; -- } --} -- --module.exports = { ++>a : Symbol(a, Decl(lib.js, 7, 17)) + + return 1; + } + } + + module.exports = { ->module.exports : Symbol(module.exports, Decl(lib.js, 0, 0)) ->module : Symbol(module, Decl(lib.js, 11, 1)) ->exports : Symbol(module.exports, Decl(lib.js, 0, 0)) -- -- bar, -->bar : Symbol(bar, Decl(lib.js, 13, 18)) -- -- SomeClass -->SomeClass : Symbol(SomeClass, Decl(lib.js, 14, 8)) - } \ No newline at end of file ++>module.exports : Symbol(export=, Decl(lib.js, 11, 1)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(lib.js, 11, 1)) + + bar, + >bar : Symbol(bar, Decl(lib.js, 13, 18)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.types index 92ac5167ad..48b26294e7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.types @@ -2,23 +2,61 @@ === main.js === const { SomeClass, SomeClass: Another } = require('./lib'); +>SomeClass : typeof SomeClass >SomeClass : any ->SomeClass : any ->Another : any ->require('./lib') : any +>Another : typeof SomeClass +>require('./lib') : { bar: (a: string) => string; SomeClass: typeof SomeClass; } >require : any >'./lib' : "./lib" module.exports = { ->module.exports = { SomeClass, Another} : { SomeClass: any; Another: any; } ->module.exports : { SomeClass: any; Another: any; } ->module : { "export=": { SomeClass: any; Another: any; }; } ->exports : { SomeClass: any; Another: any; } ->{ SomeClass, Another} : { SomeClass: any; Another: any; } +>module.exports = { SomeClass, Another} : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } +>module.exports : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } +>module : { "export=": { SomeClass: typeof SomeClass; Another: typeof SomeClass; }; } +>exports : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } +>{ SomeClass, Another} : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } SomeClass, ->SomeClass : any +>SomeClass : typeof SomeClass Another ->Another : any +>Another : typeof SomeClass +} +=== lib.js === +/** + * @param {string} a + */ +function bar(a) { +>bar : (a: string) => string +>a : string + + return a + a; +>a + a : string +>a : string +>a : string +} + +class SomeClass { +>SomeClass : SomeClass + + a() { +>a : () => number + + return 1; +>1 : 1 + } +} + +module.exports = { +>module.exports = { bar, SomeClass} : { bar: (a: string) => string; SomeClass: typeof SomeClass; } +>module.exports : { bar: (a: string) => string; SomeClass: typeof SomeClass; } +>module : { "export=": { bar: (a: string) => string; SomeClass: typeof SomeClass; }; } +>exports : { bar: (a: string) => string; SomeClass: typeof SomeClass; } +>{ bar, SomeClass} : { bar: (a: string) => string; SomeClass: typeof SomeClass; } + + bar, +>bar : (a: string) => string + + SomeClass +>SomeClass : typeof SomeClass } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt new file mode 100644 index 0000000000..f263e9f33f --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt @@ -0,0 +1,46 @@ +index.js(7,19): error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? +index.js(14,18): error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? + + +==== test.js (0 errors) ==== + const {Render} = require("./index"); + let render = new Render(); + + render.addRectangle(); + console.log("Objects", render.objects); +==== rectangle.js (0 errors) ==== + class Rectangle { + constructor() { + console.log("I'm a rectangle!"); + } + } + + module.exports = { Rectangle }; +==== index.js (2 errors) ==== + const {Rectangle} = require('./rectangle'); + + class Render { + constructor() { + /** + * Object list + * @type {Rectangle[]} + ~~~~~~~~~ +!!! error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? + */ + this.objects = []; + } + /** + * Adds a rectangle + * + * @returns {Rectangle} the rect + ~~~~~~~~~ +!!! error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? + */ + addRectangle() { + const obj = new Rectangle(); + this.objects.push(obj); + return obj; + } + } + + module.exports = { Render }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols index 836aa0743d..5d93790c21 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols @@ -4,17 +4,90 @@ const {Render} = require("./index"); >Render : Symbol(Render, Decl(test.js, 0, 7)) >require : Symbol(require) +>"./index" : Symbol("index", Decl(index.js, 0, 0)) let render = new Render(); >render : Symbol(render, Decl(test.js, 1, 3)) >Render : Symbol(Render, Decl(test.js, 0, 7)) render.addRectangle(); +>render.addRectangle : Symbol(addRectangle, Decl(index.js, 9, 5)) >render : Symbol(render, Decl(test.js, 1, 3)) +>addRectangle : Symbol(addRectangle, Decl(index.js, 9, 5)) console.log("Objects", render.objects); >console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) >log : Symbol(log, Decl(lib.dom.d.ts, --, --)) +>render.objects : Symbol(objects, Decl(index.js, 3, 19)) >render : Symbol(render, Decl(test.js, 1, 3)) +>objects : Symbol(objects, Decl(index.js, 3, 19)) + +=== rectangle.js === +class Rectangle { +>Rectangle : Symbol(Rectangle, Decl(rectangle.js, 0, 0)) + + constructor() { + console.log("I'm a rectangle!"); +>console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(log, Decl(lib.dom.d.ts, --, --)) + } +} + +module.exports = { Rectangle }; +>module.exports : Symbol(export=, Decl(rectangle.js, 4, 1)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(rectangle.js, 4, 1)) +>Rectangle : Symbol(Rectangle, Decl(rectangle.js, 6, 18)) + +=== index.js === +const {Rectangle} = require('./rectangle'); +>Rectangle : Symbol(Rectangle, Decl(index.js, 0, 7)) +>require : Symbol(require) +>'./rectangle' : Symbol("rectangle", Decl(rectangle.js, 0, 0)) + +class Render { +>Render : Symbol(Render, Decl(index.js, 0, 43)) + + constructor() { + /** + * Object list + * @type {Rectangle[]} + */ + this.objects = []; +>this.objects : Symbol(objects, Decl(index.js, 3, 19)) +>this : Symbol(Render, Decl(index.js, 0, 43)) +>objects : Symbol(objects, Decl(index.js, 3, 19)) + } + /** + * Adds a rectangle + * + * @returns {Rectangle} the rect + */ + addRectangle() { +>addRectangle : Symbol(addRectangle, Decl(index.js, 9, 5)) + + const obj = new Rectangle(); +>obj : Symbol(obj, Decl(index.js, 16, 13)) +>Rectangle : Symbol(Rectangle, Decl(index.js, 0, 7)) + + this.objects.push(obj); +>this.objects.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) +>this.objects : Symbol(objects, Decl(index.js, 3, 19)) +>this : Symbol(Render, Decl(index.js, 0, 43)) +>objects : Symbol(objects, Decl(index.js, 3, 19)) +>push : Symbol(push, Decl(lib.es5.d.ts, --, --)) +>obj : Symbol(obj, Decl(index.js, 16, 13)) + + return obj; +>obj : Symbol(obj, Decl(index.js, 16, 13)) + } +} + +module.exports = { Render }; +>module.exports : Symbol(export=, Decl(index.js, 20, 1)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(index.js, 20, 1)) +>Render : Symbol(Render, Decl(index.js, 22, 18)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols.diff index 530fd1602e..584479d52a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols.diff @@ -1,19 +1,14 @@ --- old.jsDeclarationsReferenceToClassInstanceCrossFile.symbols +++ new.jsDeclarationsReferenceToClassInstanceCrossFile.symbols -@@= skipped -3, +3 lines =@@ - const {Render} = require("./index"); - >Render : Symbol(Render, Decl(test.js, 0, 7)) - >require : Symbol(require) -->"./index" : Symbol("index", Decl(index.js, 0, 0)) - - let render = new Render(); - >render : Symbol(render, Decl(test.js, 1, 3)) +@@= skipped -10, +10 lines =@@ >Render : Symbol(Render, Decl(test.js, 0, 7)) render.addRectangle(); ->render.addRectangle : Symbol(Render.addRectangle, Decl(index.js, 9, 5)) ++>render.addRectangle : Symbol(addRectangle, Decl(index.js, 9, 5)) >render : Symbol(render, Decl(test.js, 1, 3)) ->addRectangle : Symbol(Render.addRectangle, Decl(index.js, 9, 5)) ++>addRectangle : Symbol(addRectangle, Decl(index.js, 9, 5)) console.log("Objects", render.objects); ->console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) @@ -22,73 +17,79 @@ ->log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) ->render.objects : Symbol(Render.objects, Decl(index.js, 3, 19)) +>log : Symbol(log, Decl(lib.dom.d.ts, --, --)) ++>render.objects : Symbol(objects, Decl(index.js, 3, 19)) >render : Symbol(render, Decl(test.js, 1, 3)) ->objects : Symbol(Render.objects, Decl(index.js, 3, 19)) -- --=== rectangle.js === --class Rectangle { -->Rectangle : Symbol(Rectangle, Decl(rectangle.js, 0, 0)) -- -- constructor() { -- console.log("I'm a rectangle!"); ++>objects : Symbol(objects, Decl(index.js, 3, 19)) + + === rectangle.js === + class Rectangle { +@@= skipped -18, +18 lines =@@ + + constructor() { + console.log("I'm a rectangle!"); ->console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) -->console : Symbol(console, Decl(lib.dom.d.ts, --, --)) ++>console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) + >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) ->log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) -- } --} -- --module.exports = { Rectangle }; ++>log : Symbol(log, Decl(lib.dom.d.ts, --, --)) + } + } + + module.exports = { Rectangle }; ->module.exports : Symbol(module.exports, Decl(rectangle.js, 0, 0)) ->module : Symbol(module, Decl(rectangle.js, 4, 1)) ->exports : Symbol(module.exports, Decl(rectangle.js, 0, 0)) -->Rectangle : Symbol(Rectangle, Decl(rectangle.js, 6, 18)) -- --=== index.js === --const {Rectangle} = require('./rectangle'); -->Rectangle : Symbol(Rectangle, Decl(index.js, 0, 7)) -->require : Symbol(require) -->'./rectangle' : Symbol("rectangle", Decl(rectangle.js, 0, 0)) -- --class Render { -->Render : Symbol(Render, Decl(index.js, 0, 43)) -- -- constructor() { -- /** -- * Object list -- * @type {Rectangle[]} -- */ -- this.objects = []; ++>module.exports : Symbol(export=, Decl(rectangle.js, 4, 1)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(rectangle.js, 4, 1)) + >Rectangle : Symbol(Rectangle, Decl(rectangle.js, 6, 18)) + + === index.js === +@@= skipped -27, +27 lines =@@ + * @type {Rectangle[]} + */ + this.objects = []; ->this.objects : Symbol(Render.objects, Decl(index.js, 3, 19)) -->this : Symbol(Render, Decl(index.js, 0, 43)) ++>this.objects : Symbol(objects, Decl(index.js, 3, 19)) + >this : Symbol(Render, Decl(index.js, 0, 43)) ->objects : Symbol(Render.objects, Decl(index.js, 3, 19)) -- } -- /** -- * Adds a rectangle -- * -- * @returns {Rectangle} the rect -- */ -- addRectangle() { ++>objects : Symbol(objects, Decl(index.js, 3, 19)) + } + /** + * Adds a rectangle +@@= skipped -10, +10 lines =@@ + * @returns {Rectangle} the rect + */ + addRectangle() { ->addRectangle : Symbol(Render.addRectangle, Decl(index.js, 9, 5)) -- -- const obj = new Rectangle(); -->obj : Symbol(obj, Decl(index.js, 16, 13)) -->Rectangle : Symbol(Rectangle, Decl(index.js, 0, 7)) -- -- this.objects.push(obj); ++>addRectangle : Symbol(addRectangle, Decl(index.js, 9, 5)) + + const obj = new Rectangle(); + >obj : Symbol(obj, Decl(index.js, 16, 13)) + >Rectangle : Symbol(Rectangle, Decl(index.js, 0, 7)) + + this.objects.push(obj); ->this.objects.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) ->this.objects : Symbol(Render.objects, Decl(index.js, 3, 19)) -->this : Symbol(Render, Decl(index.js, 0, 43)) ++>this.objects.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) ++>this.objects : Symbol(objects, Decl(index.js, 3, 19)) + >this : Symbol(Render, Decl(index.js, 0, 43)) ->objects : Symbol(Render.objects, Decl(index.js, 3, 19)) ->push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) -->obj : Symbol(obj, Decl(index.js, 16, 13)) -- -- return obj; -->obj : Symbol(obj, Decl(index.js, 16, 13)) -- } --} -- --module.exports = { Render }; ++>objects : Symbol(objects, Decl(index.js, 3, 19)) ++>push : Symbol(push, Decl(lib.es5.d.ts, --, --)) + >obj : Symbol(obj, Decl(index.js, 16, 13)) + + return obj; +@@= skipped -20, +20 lines =@@ + } + + module.exports = { Render }; ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(module, Decl(index.js, 20, 1)) ->exports : Symbol(module.exports, Decl(index.js, 0, 0)) -->Render : Symbol(Render, Decl(index.js, 22, 18)) ++>module.exports : Symbol(export=, Decl(index.js, 20, 1)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(index.js, 20, 1)) + >Render : Symbol(Render, Decl(index.js, 22, 18)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types index 862d5664de..f80120c9be 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types @@ -2,21 +2,21 @@ === test.js === const {Render} = require("./index"); ->Render : any ->require("./index") : any +>Render : typeof Render +>require("./index") : { Render: typeof Render; } >require : any >"./index" : "./index" let render = new Render(); ->render : any ->new Render() : any ->Render : any +>render : Render +>new Render() : Render +>Render : typeof Render render.addRectangle(); ->render.addRectangle() : any ->render.addRectangle : any ->render : any ->addRectangle : any +>render.addRectangle() : Rectangle +>render.addRectangle : () => Rectangle +>render : Render +>addRectangle : () => Rectangle console.log("Objects", render.objects); >console.log("Objects", render.objects) : void @@ -24,7 +24,86 @@ console.log("Objects", render.objects); >console : Console >log : (...data: any[]) => void >"Objects" : "Objects" ->render.objects : any ->render : any ->objects : any +>render.objects : Rectangle[] +>render : Render +>objects : Rectangle[] + +=== rectangle.js === +class Rectangle { +>Rectangle : Rectangle + + constructor() { + console.log("I'm a rectangle!"); +>console.log("I'm a rectangle!") : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>"I'm a rectangle!" : "I'm a rectangle!" + } +} + +module.exports = { Rectangle }; +>module.exports = { Rectangle } : { Rectangle: typeof Rectangle; } +>module.exports : { Rectangle: typeof Rectangle; } +>module : { "export=": { Rectangle: typeof Rectangle; }; } +>exports : { Rectangle: typeof Rectangle; } +>{ Rectangle } : { Rectangle: typeof Rectangle; } +>Rectangle : typeof Rectangle + +=== index.js === +const {Rectangle} = require('./rectangle'); +>Rectangle : typeof Rectangle +>require('./rectangle') : { Rectangle: typeof Rectangle; } +>require : any +>'./rectangle' : "./rectangle" + +class Render { +>Render : Render + + constructor() { + /** + * Object list + * @type {Rectangle[]} + */ + this.objects = []; +>this.objects = [] : undefined[] +>this.objects : Rectangle[] +>this : this +>objects : Rectangle[] +>[] : undefined[] + } + /** + * Adds a rectangle + * + * @returns {Rectangle} the rect + */ + addRectangle() { +>addRectangle : () => Rectangle + + const obj = new Rectangle(); +>obj : Rectangle +>new Rectangle() : Rectangle +>Rectangle : typeof Rectangle + + this.objects.push(obj); +>this.objects.push(obj) : number +>this.objects.push : (...items: Rectangle[]) => number +>this.objects : Rectangle[] +>this : this +>objects : Rectangle[] +>push : (...items: Rectangle[]) => number +>obj : Rectangle + + return obj; +>obj : Rectangle + } +} + +module.exports = { Render }; +>module.exports = { Render } : { Render: typeof Render; } +>module.exports : { Render: typeof Render; } +>module : { "export=": { Render: typeof Render; }; } +>exports : { Render: typeof Render; } +>{ Render } : { Render: typeof Render; } +>Render : typeof Render diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt index 07fcf76b77..0bb4eb949a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt @@ -1,10 +1,15 @@ +index.js(3,37): error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. index.js(21,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +module.js(24,12): error TS2315: Type 'Object' is not generic. +module.js(27,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== index.js (1 errors) ==== +==== index.js (2 errors) ==== const {taskGroups, taskNameToGroup} = require('./module.js'); /** @typedef {import('./module.js').TaskGroup} TaskGroup */ + ~~~~~~~~~ +!!! error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. /** * @typedef TaskNode @@ -25,7 +30,7 @@ index.js(21,1): error TS2309: An export assignment cannot be used in a module wi module.exports = MainThreadTasks; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== module.js (0 errors) ==== +==== module.js (2 errors) ==== /** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ /** @@ -50,9 +55,16 @@ index.js(21,1): error TS2309: An export assignment cannot be used in a module wi } /** @type {Object} */ + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. const taskNameToGroup = {}; module.exports = { + ~~~~~~~~~~~~~~~~~~ taskGroups, + ~~~~~~~~~~~~~~~ taskNameToGroup, - }; \ No newline at end of file + ~~~~~~~~~~~~~~~~~~~~ + }; + ~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols index 270ee2b76d..383deeead4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols @@ -5,6 +5,7 @@ const {taskGroups, taskNameToGroup} = require('./module.js'); >taskGroups : Symbol(taskGroups, Decl(index.js, 0, 7)) >taskNameToGroup : Symbol(taskNameToGroup, Decl(index.js, 0, 18)) >require : Symbol(require) +>'./module.js' : Symbol("module", Decl(module.js, 0, 0)) /** @typedef {import('./module.js').TaskGroup} TaskGroup */ @@ -34,3 +35,57 @@ module.exports = MainThreadTasks; >exports : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) +=== module.js === +/** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ + +/** + * @typedef TaskGroup + * @property {TaskGroupIds} id + * @property {string} label + * @property {string[]} traceEventNames + */ + +/** + * @type {{[P in TaskGroupIds]: {id: P, label: string}}} + */ +const taskGroups = { +>taskGroups : Symbol(taskGroups, Decl(module.js, 12, 5)) + + parseHTML: { +>parseHTML : Symbol(parseHTML, Decl(module.js, 12, 20)) + + id: 'parseHTML', +>id : Symbol(id, Decl(module.js, 13, 16)) + + label: 'Parse HTML & CSS' +>label : Symbol(label, Decl(module.js, 14, 24)) + + }, + styleLayout: { +>styleLayout : Symbol(styleLayout, Decl(module.js, 16, 6)) + + id: 'styleLayout', +>id : Symbol(id, Decl(module.js, 17, 18)) + + label: 'Style & Layout' +>label : Symbol(label, Decl(module.js, 18, 26)) + + }, +} + +/** @type {Object} */ +const taskNameToGroup = {}; +>taskNameToGroup : Symbol(taskNameToGroup, Decl(module.js, 24, 5)) + +module.exports = { +>module.exports : Symbol(export=, Decl(module.js, 24, 27)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(module.js, 24, 27)) + + taskGroups, +>taskGroups : Symbol(taskGroups, Decl(module.js, 26, 18)) + + taskNameToGroup, +>taskNameToGroup : Symbol(taskNameToGroup, Decl(module.js, 27, 15)) + +}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff index 38f767f395..ec22f5af98 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff @@ -1,14 +1,6 @@ --- old.jsDeclarationsTypedefPropertyAndExportAssignment.symbols +++ new.jsDeclarationsTypedefPropertyAndExportAssignment.symbols -@@= skipped -4, +4 lines =@@ - >taskGroups : Symbol(taskGroups, Decl(index.js, 0, 7)) - >taskNameToGroup : Symbol(taskNameToGroup, Decl(index.js, 0, 18)) - >require : Symbol(require) -->'./module.js' : Symbol("module", Decl(module.js, 0, 0)) - - /** @typedef {import('./module.js').TaskGroup} TaskGroup */ - -@@= skipped -25, +24 lines =@@ +@@= skipped -29, +29 lines =@@ } module.exports = MainThreadTasks; @@ -20,57 +12,17 @@ +>exports : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) --=== module.js === --/** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ -- --/** -- * @typedef TaskGroup -- * @property {TaskGroupIds} id -- * @property {string} label -- * @property {string[]} traceEventNames -- */ -- --/** -- * @type {{[P in TaskGroupIds]: {id: P, label: string}}} -- */ --const taskGroups = { -->taskGroups : Symbol(taskGroups, Decl(module.js, 12, 5)) -- -- parseHTML: { -->parseHTML : Symbol(parseHTML, Decl(module.js, 12, 20)) -- -- id: 'parseHTML', -->id : Symbol(id, Decl(module.js, 13, 16)) -- -- label: 'Parse HTML & CSS' -->label : Symbol(label, Decl(module.js, 14, 24)) -- -- }, -- styleLayout: { -->styleLayout : Symbol(styleLayout, Decl(module.js, 16, 6)) -- -- id: 'styleLayout', -->id : Symbol(id, Decl(module.js, 17, 18)) -- -- label: 'Style & Layout' -->label : Symbol(label, Decl(module.js, 18, 26)) -- -- }, --} -- --/** @type {Object} */ --const taskNameToGroup = {}; -->taskNameToGroup : Symbol(taskNameToGroup, Decl(module.js, 24, 5)) -- --module.exports = { + === module.js === +@@= skipped -48, +48 lines =@@ + >taskNameToGroup : Symbol(taskNameToGroup, Decl(module.js, 24, 5)) + + module.exports = { ->module.exports : Symbol(module.exports, Decl(module.js, 0, 0)) ->module : Symbol(module, Decl(module.js, 24, 27)) ->exports : Symbol(module.exports, Decl(module.js, 0, 0)) -- -- taskGroups, -->taskGroups : Symbol(taskGroups, Decl(module.js, 26, 18)) -- -- taskNameToGroup, -->taskNameToGroup : Symbol(taskNameToGroup, Decl(module.js, 27, 15)) -- --}; \ No newline at end of file ++>module.exports : Symbol(export=, Decl(module.js, 24, 27)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(module.js, 24, 27)) + + taskGroups, + >taskGroups : Symbol(taskGroups, Decl(module.js, 26, 18)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types index d682b59ca7..02e415dd5a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types @@ -2,9 +2,9 @@ === index.js === const {taskGroups, taskNameToGroup} = require('./module.js'); ->taskGroups : any +>taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } >taskNameToGroup : any ->require('./module.js') : any +>require('./module.js') : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } >require : any >'./module.js' : "./module.js" @@ -37,3 +37,67 @@ module.exports = MainThreadTasks; >exports : typeof MainThreadTasks >MainThreadTasks : typeof MainThreadTasks +=== module.js === +/** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ + +/** + * @typedef TaskGroup + * @property {TaskGroupIds} id + * @property {string} label + * @property {string[]} traceEventNames + */ + +/** + * @type {{[P in TaskGroupIds]: {id: P, label: string}}} + */ +const taskGroups = { +>taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } +>{ parseHTML: { id: 'parseHTML', label: 'Parse HTML & CSS' }, styleLayout: { id: 'styleLayout', label: 'Style & Layout' },} : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } + + parseHTML: { +>parseHTML : { id: "parseHTML"; label: string; } +>{ id: 'parseHTML', label: 'Parse HTML & CSS' } : { id: "parseHTML"; label: string; } + + id: 'parseHTML', +>id : "parseHTML" +>'parseHTML' : "parseHTML" + + label: 'Parse HTML & CSS' +>label : string +>'Parse HTML & CSS' : "Parse HTML & CSS" + + }, + styleLayout: { +>styleLayout : { id: "styleLayout"; label: string; } +>{ id: 'styleLayout', label: 'Style & Layout' } : { id: "styleLayout"; label: string; } + + id: 'styleLayout', +>id : "styleLayout" +>'styleLayout' : "styleLayout" + + label: 'Style & Layout' +>label : string +>'Style & Layout' : "Style & Layout" + + }, +} + +/** @type {Object} */ +const taskNameToGroup = {}; +>taskNameToGroup : any +>{} : {} + +module.exports = { +>module.exports = { taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } +>module.exports : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } +>module : { "export=": { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; }; } +>exports : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } +>{ taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } + + taskGroups, +>taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } + + taskNameToGroup, +>taskNameToGroup : any + +}; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols index f4fbe092fa..0b2cf45d42 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols @@ -8,18 +8,23 @@ var c; >c : Symbol(c, Decl(use.js, 3, 3)) c.chunk; +>c.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >c : Symbol(c, Decl(use.js, 3, 3)) +>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) const D = require("./mod1"); >D : Symbol(D, Decl(use.js, 6, 5)) >require : Symbol(require, Decl(types.d.ts, 0, 0)) +>"./mod1" : Symbol("mod1", Decl(mod1.js, 0, 0)) /** @type {D} */ var d; >d : Symbol(d, Decl(use.js, 8, 3)) d.chunk; +>d.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >d : Symbol(d, Decl(use.js, 8, 3)) +>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) === types.d.ts === declare function require(name: string): any; @@ -33,3 +38,21 @@ declare var module: { exports: any }; >module : Symbol(module, Decl(types.d.ts, 2, 11)) >exports : Symbol(exports, Decl(types.d.ts, 2, 21)) +=== mod1.js === +/// +class Chunk { +>Chunk : Symbol(Chunk, Decl(mod1.js, 0, 0)) + + constructor() { + this.chunk = 1; +>this.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) +>this : Symbol(Chunk, Decl(mod1.js, 0, 0)) +>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) + } +} +module.exports = Chunk; +>module.exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) +>Chunk : Symbol(Chunk, Decl(mod1.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff index ebcf1cf979..3fce0e069e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff @@ -5,44 +5,41 @@ c.chunk; ->c.chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>c.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >c : Symbol(c, Decl(use.js, 3, 3)) ->chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) const D = require("./mod1"); >D : Symbol(D, Decl(use.js, 6, 5)) - >require : Symbol(require, Decl(types.d.ts, 0, 0)) -->"./mod1" : Symbol("mod1", Decl(mod1.js, 0, 0)) - - /** @type {D} */ - var d; +@@= skipped -14, +14 lines =@@ >d : Symbol(d, Decl(use.js, 8, 3)) d.chunk; ->d.chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>d.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >d : Symbol(d, Decl(use.js, 8, 3)) ->chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) === types.d.ts === declare function require(name: string): any; -@@= skipped -29, +24 lines =@@ - declare var module: { exports: any }; - >module : Symbol(module, Decl(types.d.ts, 2, 11)) - >exports : Symbol(exports, Decl(types.d.ts, 2, 21)) -- --=== mod1.js === --/// --class Chunk { -->Chunk : Symbol(Chunk, Decl(mod1.js, 0, 0)) -- -- constructor() { -- this.chunk = 1; +@@= skipped -23, +23 lines =@@ + + constructor() { + this.chunk = 1; ->this.chunk : Symbol(Chunk.chunk, Decl(mod1.js, 2, 19)) -->this : Symbol(Chunk, Decl(mod1.js, 0, 0)) ++>this.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) + >this : Symbol(Chunk, Decl(mod1.js, 0, 0)) ->chunk : Symbol(Chunk.chunk, Decl(mod1.js, 2, 19)) -- } --} --module.exports = Chunk; ++>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) + } + } + module.exports = Chunk; ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 5, 1)) ->exports : Symbol(export=, Decl(mod1.js, 5, 1)) -->Chunk : Symbol(Chunk, Decl(mod1.js, 0, 0)) ++>module.exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) + >Chunk : Symbol(Chunk, Decl(mod1.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.types b/testdata/baselines/reference/submodule/conformance/jsdocImportType.types index 0e082a75f6..c028a0875a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.types @@ -5,27 +5,27 @@ /** @typedef {import("./mod1")} C * @type {C} */ var c; ->c : any +>c : D c.chunk; ->c.chunk : any ->c : any ->chunk : any +>c.chunk : number +>c : D +>chunk : number const D = require("./mod1"); ->D : any ->require("./mod1") : any +>D : typeof D +>require("./mod1") : typeof D >require : (name: string) => any >"./mod1" : "./mod1" /** @type {D} */ var d; ->d : error +>d : D d.chunk; ->d.chunk : any +>d.chunk : number >d : D ->chunk : any +>chunk : number === types.d.ts === declare function require(name: string): any; @@ -39,3 +39,24 @@ declare var module: { exports: any }; >module : { exports: any; } >exports : any +=== mod1.js === +/// +class Chunk { +>Chunk : Chunk + + constructor() { + this.chunk = 1; +>this.chunk = 1 : 1 +>this.chunk : number +>this : this +>chunk : number +>1 : 1 + } +} +module.exports = Chunk; +>module.exports = Chunk : typeof Chunk +>module.exports : typeof Chunk +>module : { Chunk: typeof Chunk; } +>exports : typeof Chunk +>Chunk : typeof Chunk + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols index 2a73980c73..3b00ab377e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols @@ -8,18 +8,23 @@ var c; >c : Symbol(c, Decl(use.js, 3, 3)) c.chunk; +>c.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >c : Symbol(c, Decl(use.js, 3, 3)) +>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) const D = require("./mod1"); >D : Symbol(D, Decl(use.js, 6, 5)) >require : Symbol(require, Decl(types.d.ts, 0, 0)) +>"./mod1" : Symbol("mod1", Decl(mod1.js, 0, 0)) /** @type {D} */ var d; >d : Symbol(d, Decl(use.js, 8, 3)) d.chunk; +>d.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >d : Symbol(d, Decl(use.js, 8, 3)) +>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) === types.d.ts === declare function require(name: string): any; @@ -33,3 +38,19 @@ declare var module: { exports: any }; >module : Symbol(module, Decl(types.d.ts, 2, 11)) >exports : Symbol(exports, Decl(types.d.ts, 2, 21)) +=== mod1.js === +/// +module.exports = class Chunk { +>module.exports : Symbol(Chunk, Decl(mod1.js, 1, 16)) +>module : Symbol(module.exports) +>exports : Symbol(Chunk, Decl(mod1.js, 1, 16)) +>Chunk : Symbol(Chunk, Decl(mod1.js, 1, 16)) + + constructor() { + this.chunk = 1; +>this.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) +>this : Symbol(Chunk, Decl(mod1.js, 1, 16)) +>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) + } +} + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols.diff index dc3a932a6c..c58d685f92 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols.diff @@ -5,42 +5,43 @@ c.chunk; ->c.chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>c.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >c : Symbol(c, Decl(use.js, 3, 3)) ->chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) const D = require("./mod1"); >D : Symbol(D, Decl(use.js, 6, 5)) - >require : Symbol(require, Decl(types.d.ts, 0, 0)) -->"./mod1" : Symbol("mod1", Decl(mod1.js, 0, 0)) - - /** @type {D} */ - var d; +@@= skipped -14, +14 lines =@@ >d : Symbol(d, Decl(use.js, 8, 3)) d.chunk; ->d.chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>d.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >d : Symbol(d, Decl(use.js, 8, 3)) ->chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) === types.d.ts === declare function require(name: string): any; -@@= skipped -29, +24 lines =@@ - declare var module: { exports: any }; - >module : Symbol(module, Decl(types.d.ts, 2, 11)) - >exports : Symbol(exports, Decl(types.d.ts, 2, 21)) -- --=== mod1.js === --/// --module.exports = class Chunk { +@@= skipped -19, +19 lines =@@ + === mod1.js === + /// + module.exports = class Chunk { ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 0, 0)) ->exports : Symbol(export=, Decl(mod1.js, 0, 0)) -->Chunk : Symbol(Chunk, Decl(mod1.js, 1, 16)) -- -- constructor() { -- this.chunk = 1; ++>module.exports : Symbol(Chunk, Decl(mod1.js, 1, 16)) ++>module : Symbol(module.exports) ++>exports : Symbol(Chunk, Decl(mod1.js, 1, 16)) + >Chunk : Symbol(Chunk, Decl(mod1.js, 1, 16)) + + constructor() { + this.chunk = 1; ->this.chunk : Symbol(Chunk.chunk, Decl(mod1.js, 2, 19)) -->this : Symbol(Chunk, Decl(mod1.js, 1, 16)) ++>this.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) + >this : Symbol(Chunk, Decl(mod1.js, 1, 16)) ->chunk : Symbol(Chunk.chunk, Decl(mod1.js, 2, 19)) -- } --} ++>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) + } + } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types index fe33c1d437..3b14ed6cdc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types @@ -5,27 +5,27 @@ /** @typedef {import("./mod1")} C * @type {C} */ var c; ->c : any +>c : D c.chunk; ->c.chunk : any ->c : any ->chunk : any +>c.chunk : number +>c : D +>chunk : number const D = require("./mod1"); ->D : any ->require("./mod1") : any +>D : typeof D +>require("./mod1") : typeof D >require : (name: string) => any >"./mod1" : "./mod1" /** @type {D} */ var d; ->d : error +>d : D d.chunk; ->d.chunk : any +>d.chunk : number >d : D ->chunk : any +>chunk : number === types.d.ts === declare function require(name: string): any; @@ -39,3 +39,23 @@ declare var module: { exports: any }; >module : { exports: any; } >exports : any +=== mod1.js === +/// +module.exports = class Chunk { +>module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof import("./mod1") +>module.exports : typeof import("./mod1") +>module : { Chunk: typeof import("./mod1"); } +>exports : typeof import("./mod1") +>class Chunk { constructor() { this.chunk = 1; }} : typeof import("./mod1") +>Chunk : typeof import("./mod1") + + constructor() { + this.chunk = 1; +>this.chunk = 1 : 1 +>this.chunk : number +>this : this +>chunk : number +>1 : 1 + } +} + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.errors.txt index dc40da3a99..7763b5edfe 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.errors.txt @@ -1,22 +1,37 @@ -use.js(1,19): error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. +mod.js(2,21): error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. +mod.js(2,37): error TS7006: Parameter 'n' implicitly has an 'any' type. +mod.js(6,35): error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. +mod.js(6,51): error TS7006: Parameter 'mom' implicitly has an 'any' type. +use.js(3,5): error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. +use.js(5,5): error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. -==== use.js (1 errors) ==== +==== use.js (2 errors) ==== var mod = require('./mod'); - ~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. mod.f('no') mod.g('also no') + ~ +!!! error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. mod.h(0) mod.i(1) + ~ +!!! error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. -==== mod.js (0 errors) ==== +==== mod.js (4 errors) ==== /** @param {number} n */ exports.f = exports.g = function fg(n) { + ~ +!!! error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. + ~ +!!! error TS7006: Parameter 'n' implicitly has an 'any' type. return n + 1 } /** @param {string} mom */ module.exports.h = module.exports.i = function hi(mom) { + ~ +!!! error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. + ~~~ +!!! error TS7006: Parameter 'mom' implicitly has an 'any' type. return `hi, ${mom}!`; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols index 6453d6ee4a..dfaa882c92 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols @@ -4,16 +4,51 @@ var mod = require('./mod'); >mod : Symbol(mod, Decl(use.js, 0, 3)) >require : Symbol(require) +>'./mod' : Symbol("mod", Decl(mod.js, 0, 0)) mod.f('no') +>mod.f : Symbol(f, Decl(mod.js, 0, 0)) >mod : Symbol(mod, Decl(use.js, 0, 3)) +>f : Symbol(f, Decl(mod.js, 0, 0)) mod.g('also no') >mod : Symbol(mod, Decl(use.js, 0, 3)) mod.h(0) +>mod.h : Symbol(h, Decl(mod.js, 3, 1)) >mod : Symbol(mod, Decl(use.js, 0, 3)) +>h : Symbol(h, Decl(mod.js, 3, 1)) mod.i(1) >mod : Symbol(mod, Decl(use.js, 0, 3)) +=== mod.js === +/** @param {number} n */ +exports.f = exports.g = function fg(n) { +>exports.f : Symbol(f, Decl(mod.js, 0, 0)) +>exports : Symbol("mod", Decl(mod.js, 0, 0)) +>f : Symbol(f, Decl(mod.js, 0, 0)) +>exports : Symbol("mod", Decl(mod.js, 0, 0)) +>fg : Symbol(fg, Decl(mod.js, 1, 23)) +>n : Symbol(n, Decl(mod.js, 1, 36)) + + return n + 1 +>n : Symbol(n, Decl(mod.js, 1, 36)) +} +/** @param {string} mom */ +module.exports.h = module.exports.i = function hi(mom) { +>module.exports.h : Symbol(h, Decl(mod.js, 3, 1)) +>module.exports : Symbol("mod", Decl(mod.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("mod", Decl(mod.js, 0, 0)) +>h : Symbol(h, Decl(mod.js, 3, 1)) +>module.exports : Symbol("mod", Decl(mod.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("mod", Decl(mod.js, 0, 0)) +>hi : Symbol(hi, Decl(mod.js, 5, 37)) +>mom : Symbol(mom, Decl(mod.js, 5, 50)) + + return `hi, ${mom}!`; +>mom : Symbol(mom, Decl(mod.js, 5, 50)) +} + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols.diff index a7faa4ca60..11a82589da 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols.diff @@ -5,11 +5,14 @@ >mod : Symbol(mod, Decl(use.js, 0, 3)) >require : Symbol(require) ->'./mod' : Symbol(mod, Decl(mod.js, 0, 0)) ++>'./mod' : Symbol("mod", Decl(mod.js, 0, 0)) mod.f('no') ->mod.f : Symbol(mod.f, Decl(mod.js, 0, 0)) ++>mod.f : Symbol(f, Decl(mod.js, 0, 0)) >mod : Symbol(mod, Decl(use.js, 0, 3)) ->f : Symbol(mod.f, Decl(mod.js, 0, 0)) ++>f : Symbol(f, Decl(mod.js, 0, 0)) mod.g('also no') ->mod.g : Symbol(mod.g, Decl(mod.js, 1, 11)) @@ -18,44 +21,48 @@ mod.h(0) ->mod.h : Symbol(mod.h, Decl(mod.js, 3, 1)) ++>mod.h : Symbol(h, Decl(mod.js, 3, 1)) >mod : Symbol(mod, Decl(use.js, 0, 3)) ->h : Symbol(mod.h, Decl(mod.js, 3, 1)) ++>h : Symbol(h, Decl(mod.js, 3, 1)) mod.i(1) ->mod.i : Symbol(mod.i, Decl(mod.js, 5, 18)) >mod : Symbol(mod, Decl(use.js, 0, 3)) ->i : Symbol(mod.i, Decl(mod.js, 5, 18)) -- --=== mod.js === --/** @param {number} n */ --exports.f = exports.g = function fg(n) { -->exports.f : Symbol(f, Decl(mod.js, 0, 0)) + + === mod.js === + /** @param {number} n */ + exports.f = exports.g = function fg(n) { + >exports.f : Symbol(f, Decl(mod.js, 0, 0)) ->exports : Symbol(f, Decl(mod.js, 0, 0)) -->f : Symbol(f, Decl(mod.js, 0, 0)) ++>exports : Symbol("mod", Decl(mod.js, 0, 0)) + >f : Symbol(f, Decl(mod.js, 0, 0)) ->exports.g : Symbol(g, Decl(mod.js, 1, 11)) ->exports : Symbol(g, Decl(mod.js, 1, 11)) ->g : Symbol(g, Decl(mod.js, 1, 11)) -->fg : Symbol(fg, Decl(mod.js, 1, 23)) -->n : Symbol(n, Decl(mod.js, 1, 36)) -- -- return n + 1 -->n : Symbol(n, Decl(mod.js, 1, 36)) --} --/** @param {string} mom */ --module.exports.h = module.exports.i = function hi(mom) { -->module.exports.h : Symbol(h, Decl(mod.js, 3, 1)) ++>exports : Symbol("mod", Decl(mod.js, 0, 0)) + >fg : Symbol(fg, Decl(mod.js, 1, 23)) + >n : Symbol(n, Decl(mod.js, 1, 36)) + +@@= skipped -40, +34 lines =@@ + /** @param {string} mom */ + module.exports.h = module.exports.i = function hi(mom) { + >module.exports.h : Symbol(h, Decl(mod.js, 3, 1)) ->module.exports : Symbol(h, Decl(mod.js, 3, 1)) ->module : Symbol(module, Decl(mod.js, 3, 1)) ->exports : Symbol(module.exports, Decl(mod.js, 0, 0)) -->h : Symbol(h, Decl(mod.js, 3, 1)) ++>module.exports : Symbol("mod", Decl(mod.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("mod", Decl(mod.js, 0, 0)) + >h : Symbol(h, Decl(mod.js, 3, 1)) ->module.exports.i : Symbol(i, Decl(mod.js, 5, 18)) ->module.exports : Symbol(i, Decl(mod.js, 5, 18)) ->module : Symbol(module, Decl(mod.js, 3, 1)) ->exports : Symbol(module.exports, Decl(mod.js, 0, 0)) ->i : Symbol(i, Decl(mod.js, 5, 18)) -->hi : Symbol(hi, Decl(mod.js, 5, 37)) -->mom : Symbol(mom, Decl(mod.js, 5, 50)) -- -- return `hi, ${mom}!`; -->mom : Symbol(mom, Decl(mod.js, 5, 50)) --} ++>module.exports : Symbol("mod", Decl(mod.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("mod", Decl(mod.js, 0, 0)) + >hi : Symbol(hi, Decl(mod.js, 5, 37)) + >mom : Symbol(mom, Decl(mod.js, 5, 50)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.types index 1043bd0ba7..59e1fe3f85 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.types @@ -2,36 +2,79 @@ === use.js === var mod = require('./mod'); ->mod : any ->require('./mod') : any +>mod : typeof mod +>require('./mod') : typeof mod >require : any >'./mod' : "./mod" mod.f('no') >mod.f('no') : any ->mod.f : any ->mod : any ->f : any +>mod.f : (n: any) => any +>mod : typeof mod +>f : (n: any) => any >'no' : "no" mod.g('also no') >mod.g('also no') : any >mod.g : any ->mod : any +>mod : typeof mod >g : any >'also no' : "also no" mod.h(0) ->mod.h(0) : any ->mod.h : any ->mod : any ->h : any +>mod.h(0) : string +>mod.h : (mom: any) => string +>mod : typeof mod +>h : (mom: any) => string >0 : 0 mod.i(1) >mod.i(1) : any >mod.i : any ->mod : any +>mod : typeof mod >i : any >1 : 1 +=== mod.js === +/** @param {number} n */ +exports.f = exports.g = function fg(n) { +>exports.f = exports.g = function fg(n) { return n + 1} : (n: any) => any +>exports.f : (n: any) => any +>exports : typeof import("./mod") +>f : (n: any) => any +>exports.g = function fg(n) { return n + 1} : (n: any) => any +>exports.g : any +>exports : typeof import("./mod") +>g : any +>function fg(n) { return n + 1} : (n: any) => any +>fg : (n: any) => any +>n : any + + return n + 1 +>n + 1 : any +>n : any +>1 : 1 +} +/** @param {string} mom */ +module.exports.h = module.exports.i = function hi(mom) { +>module.exports.h = module.exports.i = function hi(mom) { return `hi, ${mom}!`;} : (mom: any) => string +>module.exports.h : (mom: any) => string +>module.exports : typeof import("./mod") +>module : { "\"mod\"": typeof import("./mod"); } +>exports : typeof import("./mod") +>h : (mom: any) => string +>module.exports.i = function hi(mom) { return `hi, ${mom}!`;} : (mom: any) => string +>module.exports.i : any +>module.exports : typeof import("./mod") +>module : { "\"mod\"": typeof import("./mod"); } +>exports : typeof import("./mod") +>i : any +>function hi(mom) { return `hi, ${mom}!`;} : (mom: any) => string +>hi : (mom: any) => string +>mom : any + + return `hi, ${mom}!`; +>`hi, ${mom}!` : string +>mom : any +} + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt index 7b6777e042..d5614f6c67 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt @@ -1,4 +1,5 @@ MC.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ==== MC.js (1 errors) ==== @@ -18,7 +19,7 @@ MC.js(5,1): error TS2309: An export assignment cannot be used in a module with o ~ !!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== MW.js (0 errors) ==== +==== MW.js (1 errors) ==== /** @typedef {import("./MC")} MC */ class MW { @@ -31,4 +32,6 @@ MC.js(5,1): error TS2309: An export assignment cannot be used in a module with o } module.exports = MW; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols index 22778ecead..812b695c5b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols @@ -4,6 +4,7 @@ const MW = require("./MW"); >MW : Symbol(MW, Decl(MC.js, 0, 5)) >require : Symbol(require) +>"./MW" : Symbol("MW", Decl(MW.js, 0, 0)) /** @typedef {number} Cictema */ @@ -22,3 +23,29 @@ module.exports = class MC { } }; +=== MW.js === +/** @typedef {import("./MC")} MC */ + +class MW { +>MW : Symbol(MW, Decl(MW.js, 0, 0)) + + /** + * @param {MC} compiler the compiler + */ + constructor(compiler) { +>compiler : Symbol(compiler, Decl(MW.js, 6, 14)) + + this.compiler = compiler; +>this.compiler : Symbol(compiler, Decl(MW.js, 6, 25)) +>this : Symbol(MW, Decl(MW.js, 0, 0)) +>compiler : Symbol(compiler, Decl(MW.js, 6, 25)) +>compiler : Symbol(compiler, Decl(MW.js, 6, 14)) + } +} + +module.exports = MW; +>module.exports : Symbol(MW, Decl(MW.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(MW, Decl(MW.js, 0, 0)) +>MW : Symbol(MW, Decl(MW.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff index c984afa8e1..3ff921e892 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff @@ -1,11 +1,6 @@ --- old.jsdocTypeReferenceToImportOfClassExpression.symbols +++ new.jsdocTypeReferenceToImportOfClassExpression.symbols -@@= skipped -3, +3 lines =@@ - const MW = require("./MW"); - >MW : Symbol(MW, Decl(MC.js, 0, 5)) - >require : Symbol(require) -->"./MW" : Symbol("MW", Decl(MW.js, 0, 0)) - +@@= skipped -8, +8 lines =@@ /** @typedef {number} Cictema */ module.exports = class MC { @@ -23,32 +18,24 @@ return new MW(this); >MW : Symbol(MW, Decl(MC.js, 0, 5)) - >this : Symbol(MC, Decl(MC.js, 4, 16)) - } - }; -- --=== MW.js === --/** @typedef {import("./MC")} MC */ -- --class MW { -->MW : Symbol(MW, Decl(MW.js, 0, 0)) -- -- /** -- * @param {MC} compiler the compiler -- */ -- constructor(compiler) { -->compiler : Symbol(compiler, Decl(MW.js, 6, 14)) -- -- this.compiler = compiler; +@@= skipped -27, +27 lines =@@ + >compiler : Symbol(compiler, Decl(MW.js, 6, 14)) + + this.compiler = compiler; ->this.compiler : Symbol(MW.compiler, Decl(MW.js, 6, 25)) -->this : Symbol(MW, Decl(MW.js, 0, 0)) ++>this.compiler : Symbol(compiler, Decl(MW.js, 6, 25)) + >this : Symbol(MW, Decl(MW.js, 0, 0)) ->compiler : Symbol(MW.compiler, Decl(MW.js, 6, 25)) -->compiler : Symbol(compiler, Decl(MW.js, 6, 14)) -- } --} -- --module.exports = MW; ++>compiler : Symbol(compiler, Decl(MW.js, 6, 25)) + >compiler : Symbol(compiler, Decl(MW.js, 6, 14)) + } + } + + module.exports = MW; ->module.exports : Symbol(module.exports, Decl(MW.js, 0, 0)) ->module : Symbol(export=, Decl(MW.js, 9, 1)) ->exports : Symbol(export=, Decl(MW.js, 9, 1)) -->MW : Symbol(MW, Decl(MW.js, 0, 0)) ++>module.exports : Symbol(MW, Decl(MW.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(MW, Decl(MW.js, 0, 0)) + >MW : Symbol(MW, Decl(MW.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types index e022bd666d..d1d05b562b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types @@ -2,8 +2,8 @@ === MC.js === const MW = require("./MW"); ->MW : any ->require("./MW") : any +>MW : typeof MW +>require("./MW") : typeof MW >require : any >"./MW" : "./MW" @@ -18,12 +18,40 @@ module.exports = class MC { >MC : typeof import("./MC") watch() { ->watch : () => any +>watch : () => MW return new MW(this); ->new MW(this) : any ->MW : any +>new MW(this) : MW +>MW : typeof MW >this : this } }; +=== MW.js === +/** @typedef {import("./MC")} MC */ + +class MW { +>MW : MW + + /** + * @param {MC} compiler the compiler + */ + constructor(compiler) { +>compiler : import("./MC") + + this.compiler = compiler; +>this.compiler = compiler : import("./MC") +>this.compiler : import("./MC") +>this : this +>compiler : import("./MC") +>compiler : import("./MC") + } +} + +module.exports = MW; +>module.exports = MW : typeof MW +>module.exports : typeof MW +>module : { MW: typeof MW; } +>exports : typeof MW +>MW : typeof MW + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt index 1e0c9ba519..38ff7cb972 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt @@ -1,4 +1,6 @@ MC.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +MW.js(1,15): error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? +MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ==== MC.js (1 errors) ==== @@ -19,8 +21,10 @@ MC.js(6,1): error TS2309: An export assignment cannot be used in a module with o ~ !!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== MW.js (0 errors) ==== +==== MW.js (2 errors) ==== /** @typedef {import("./MC")} MC */ + ~~~~~~~~~~~~~~ +!!! error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? class MW { /** @@ -32,4 +36,6 @@ MC.js(6,1): error TS2309: An export assignment cannot be used in a module with o } module.exports = MW; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols index 1c9cadddd7..39ab556833 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols @@ -4,6 +4,7 @@ const MW = require("./MW"); >MW : Symbol(MW, Decl(MC.js, 0, 5)) >require : Symbol(require) +>"./MW" : Symbol("MW", Decl(MW.js, 0, 0)) /** @typedef {number} Meyerhauser */ @@ -24,3 +25,29 @@ module.exports = function MC() { }; +=== MW.js === +/** @typedef {import("./MC")} MC */ + +class MW { +>MW : Symbol(MW, Decl(MW.js, 0, 0)) + + /** + * @param {MC} compiler the compiler + */ + constructor(compiler) { +>compiler : Symbol(compiler, Decl(MW.js, 6, 14)) + + this.compiler = compiler; +>this.compiler : Symbol(compiler, Decl(MW.js, 6, 25)) +>this : Symbol(MW, Decl(MW.js, 0, 0)) +>compiler : Symbol(compiler, Decl(MW.js, 6, 25)) +>compiler : Symbol(compiler, Decl(MW.js, 6, 14)) + } +} + +module.exports = MW; +>module.exports : Symbol(MW, Decl(MW.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(MW, Decl(MW.js, 0, 0)) +>MW : Symbol(MW, Decl(MW.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff index 01d931837b..7d4a079c8c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff @@ -1,12 +1,6 @@ --- old.jsdocTypeReferenceToImportOfFunctionExpression.symbols +++ new.jsdocTypeReferenceToImportOfFunctionExpression.symbols -@@= skipped -3, +3 lines =@@ - const MW = require("./MW"); - >MW : Symbol(MW, Decl(MC.js, 0, 5)) - >require : Symbol(require) -->"./MW" : Symbol("MW", Decl(MW.js, 0, 0)) - - /** @typedef {number} Meyerhauser */ +@@= skipped -9, +9 lines =@@ /** @class */ module.exports = function MC() { @@ -17,33 +11,24 @@ >exports : Symbol(export=, Decl(MC.js, 0, 27)) >MC : Symbol(MC, Decl(MC.js, 5, 16)) -@@= skipped -20, +19 lines =@@ - >x : Symbol(x, Decl(MC.js, 7, 7)) +@@= skipped -28, +28 lines =@@ + >compiler : Symbol(compiler, Decl(MW.js, 6, 14)) - }; -- --=== MW.js === --/** @typedef {import("./MC")} MC */ -- --class MW { -->MW : Symbol(MW, Decl(MW.js, 0, 0)) -- -- /** -- * @param {MC} compiler the compiler -- */ -- constructor(compiler) { -->compiler : Symbol(compiler, Decl(MW.js, 6, 14)) -- -- this.compiler = compiler; + this.compiler = compiler; ->this.compiler : Symbol(MW.compiler, Decl(MW.js, 6, 25)) -->this : Symbol(MW, Decl(MW.js, 0, 0)) ++>this.compiler : Symbol(compiler, Decl(MW.js, 6, 25)) + >this : Symbol(MW, Decl(MW.js, 0, 0)) ->compiler : Symbol(MW.compiler, Decl(MW.js, 6, 25)) -->compiler : Symbol(compiler, Decl(MW.js, 6, 14)) -- } --} -- --module.exports = MW; ++>compiler : Symbol(compiler, Decl(MW.js, 6, 25)) + >compiler : Symbol(compiler, Decl(MW.js, 6, 14)) + } + } + + module.exports = MW; ->module.exports : Symbol(module.exports, Decl(MW.js, 0, 0)) ->module : Symbol(export=, Decl(MW.js, 9, 1)) ->exports : Symbol(export=, Decl(MW.js, 9, 1)) -->MW : Symbol(MW, Decl(MW.js, 0, 0)) ++>module.exports : Symbol(MW, Decl(MW.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(MW, Decl(MW.js, 0, 0)) + >MW : Symbol(MW, Decl(MW.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types index 5c7ef0e913..760a183f55 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types @@ -2,8 +2,8 @@ === MC.js === const MW = require("./MW"); ->MW : any ->require("./MW") : any +>MW : typeof MW +>require("./MW") : typeof MW >require : any >"./MW" : "./MW" @@ -11,12 +11,12 @@ const MW = require("./MW"); /** @class */ module.exports = function MC() { ->module.exports = function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => any ->module.exports : () => any ->module : { "export=": () => any; } ->exports : () => any ->function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => any ->MC : () => any +>module.exports = function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => MW +>module.exports : () => MW +>module : { "export=": () => MW; } +>exports : () => MW +>function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => MW +>MC : () => MW /** @type {any} */ var x = {} @@ -24,9 +24,37 @@ module.exports = function MC() { >{} : {} return new MW(x); ->new MW(x) : any ->MW : any +>new MW(x) : MW +>MW : typeof MW >x : any }; +=== MW.js === +/** @typedef {import("./MC")} MC */ + +class MW { +>MW : MW + + /** + * @param {MC} compiler the compiler + */ + constructor(compiler) { +>compiler : any + + this.compiler = compiler; +>this.compiler = compiler : any +>this.compiler : any +>this : this +>compiler : any +>compiler : any + } +} + +module.exports = MW; +>module.exports = MW : typeof MW +>module.exports : typeof MW +>module : { MW: typeof MW; } +>exports : typeof MW +>MW : typeof MW + diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.errors.txt b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.errors.txt index 2386146085..a63a73e1e2 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.errors.txt @@ -1,18 +1,35 @@ -usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport1.js'. 'lateBoundAssignmentDeclarationSupport1.js' implicitly has an 'any' type. +lateBoundAssignmentDeclarationSupport1.js(5,1): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. + Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. +lateBoundAssignmentDeclarationSupport1.js(6,1): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. + Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. +usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. + Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. +usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. + Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. -==== usage.js (1 errors) ==== +==== usage.js (2 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport1.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport1.js'. 'lateBoundAssignmentDeclarationSupport1.js' implicitly has an 'any' type. const y = x["my-fake-sym"]; + ~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. +!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. const z = x[x.S]; + ~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. +!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. -==== lateBoundAssignmentDeclarationSupport1.js (0 errors) ==== +==== lateBoundAssignmentDeclarationSupport1.js (2 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; exports[_sym] = "ok"; + ~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. +!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. exports[_str] = "ok"; + ~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. +!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. exports.S = _sym; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols index 62f962f254..b663516983 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols @@ -4,6 +4,7 @@ const x = require("./lateBoundAssignmentDeclarationSupport1.js"); >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) +>"./lateBoundAssignmentDeclarationSupport1.js" : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) const y = x["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) @@ -12,5 +13,30 @@ const y = x["my-fake-sym"]; const z = x[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) + +=== lateBoundAssignmentDeclarationSupport1.js === +// currently unsupported +const _sym = Symbol(); +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const _str = "my-fake-sym"; +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport1.js, 2, 5)) + +exports[_sym] = "ok"; +>exports : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5)) + +exports[_str] = "ok"; +>exports : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport1.js, 2, 5)) + +exports.S = _sym; +>exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) +>exports : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols.diff b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols.diff index b71f2864f0..cabb14b7db 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols.diff @@ -5,36 +5,27 @@ >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) ->"./lateBoundAssignmentDeclarationSupport1.js" : Symbol(x, Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) ++>"./lateBoundAssignmentDeclarationSupport1.js" : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) const y = x["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) -@@= skipped -9, +8 lines =@@ +@@= skipped -9, +9 lines =@@ const z = x[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->x.S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) ++>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) -- --=== lateBoundAssignmentDeclarationSupport1.js === --// currently unsupported --const _sym = Symbol(); -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5)) -->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -- --const _str = "my-fake-sym"; -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport1.js, 2, 5)) -- --exports[_sym] = "ok"; -->exports : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5)) -- --exports[_str] = "ok"; -->exports : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport1.js, 2, 5)) -- --exports.S = _sym; -->exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) ++>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) + + === lateBoundAssignmentDeclarationSupport1.js === + // currently unsupported +@@= skipped -23, +23 lines =@@ + + exports.S = _sym; + >exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) ->exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) -->S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5)) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) + >S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.types b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.types index dccd599da6..485d488783 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.types +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.types @@ -2,22 +2,54 @@ === usage.js === const x = require("./lateBoundAssignmentDeclarationSupport1.js"); ->x : any ->require("./lateBoundAssignmentDeclarationSupport1.js") : any +>x : typeof x +>require("./lateBoundAssignmentDeclarationSupport1.js") : typeof x >require : any >"./lateBoundAssignmentDeclarationSupport1.js" : "./lateBoundAssignmentDeclarationSupport1.js" const y = x["my-fake-sym"]; >y : any >x["my-fake-sym"] : any ->x : any +>x : typeof x >"my-fake-sym" : "my-fake-sym" const z = x[x.S]; >z : any >x[x.S] : any ->x : any ->x.S : any ->x : any ->S : any +>x : typeof x +>x.S : unique symbol +>x : typeof x +>S : unique symbol + +=== lateBoundAssignmentDeclarationSupport1.js === +// currently unsupported +const _sym = Symbol(); +>_sym : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const _str = "my-fake-sym"; +>_str : "my-fake-sym" +>"my-fake-sym" : "my-fake-sym" + +exports[_sym] = "ok"; +>exports[_sym] = "ok" : "ok" +>exports[_sym] : any +>exports : typeof import("./lateBoundAssignmentDeclarationSupport1") +>_sym : unique symbol +>"ok" : "ok" + +exports[_str] = "ok"; +>exports[_str] = "ok" : "ok" +>exports[_str] : any +>exports : typeof import("./lateBoundAssignmentDeclarationSupport1") +>_str : "my-fake-sym" +>"ok" : "ok" + +exports.S = _sym; +>exports.S = _sym : unique symbol +>exports.S : unique symbol +>exports : typeof import("./lateBoundAssignmentDeclarationSupport1") +>S : unique symbol +>_sym : unique symbol diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt index 098bb6132d..8533aa1d2e 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt @@ -1,18 +1,35 @@ -usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport2.js'. 'lateBoundAssignmentDeclarationSupport2.js' implicitly has an 'any' type. +lateBoundAssignmentDeclarationSupport2.js(5,1): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. + Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +lateBoundAssignmentDeclarationSupport2.js(6,1): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. + Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. + Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. + Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. -==== usage.js (1 errors) ==== +==== usage.js (2 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport2.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport2.js'. 'lateBoundAssignmentDeclarationSupport2.js' implicitly has an 'any' type. const y = x["my-fake-sym"]; + ~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. const z = x[x.S]; + ~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. -==== lateBoundAssignmentDeclarationSupport2.js (0 errors) ==== +==== lateBoundAssignmentDeclarationSupport2.js (2 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; module.exports[_sym] = "ok"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. module.exports[_str] = "ok"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. module.exports.S = _sym; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols index 3b5126d2b3..c9654d78f5 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols @@ -4,6 +4,7 @@ const x = require("./lateBoundAssignmentDeclarationSupport2.js"); >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) +>"./lateBoundAssignmentDeclarationSupport2.js" : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) const y = x["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) @@ -12,5 +13,36 @@ const y = x["my-fake-sym"]; const z = x[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) + +=== lateBoundAssignmentDeclarationSupport2.js === +// currently unsupported +const _sym = Symbol(); +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const _str = "my-fake-sym"; +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 5)) + +module.exports[_sym] = "ok"; +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) + +module.exports[_str] = "ok"; +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 5)) + +module.exports.S = _sym; +>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols.diff b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols.diff index d3a722c5dd..b2436e84ab 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols.diff @@ -5,42 +5,50 @@ >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) ->"./lateBoundAssignmentDeclarationSupport2.js" : Symbol(x, Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) ++>"./lateBoundAssignmentDeclarationSupport2.js" : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) const y = x["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) -@@= skipped -9, +8 lines =@@ +@@= skipped -9, +9 lines =@@ const z = x[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->x.S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) ++>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) -- --=== lateBoundAssignmentDeclarationSupport2.js === --// currently unsupported --const _sym = Symbol(); -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) -->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -- --const _str = "my-fake-sym"; -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 5)) -- --module.exports[_sym] = "ok"; ++>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) + + === lateBoundAssignmentDeclarationSupport2.js === + // currently unsupported +@@= skipped -14, +14 lines =@@ + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 5)) + + module.exports[_sym] = "ok"; ->module.exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) -- --module.exports[_str] = "ok"; ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) + + module.exports[_str] = "ok"; ->module.exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 5)) -- --module.exports.S = _sym; -->module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 5)) + + module.exports.S = _sym; + >module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) ->module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) -->S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) + >S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.types b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.types index b3614e356b..82e108b006 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.types +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.types @@ -2,22 +2,60 @@ === usage.js === const x = require("./lateBoundAssignmentDeclarationSupport2.js"); ->x : any ->require("./lateBoundAssignmentDeclarationSupport2.js") : any +>x : typeof x +>require("./lateBoundAssignmentDeclarationSupport2.js") : typeof x >require : any >"./lateBoundAssignmentDeclarationSupport2.js" : "./lateBoundAssignmentDeclarationSupport2.js" const y = x["my-fake-sym"]; >y : any >x["my-fake-sym"] : any ->x : any +>x : typeof x >"my-fake-sym" : "my-fake-sym" const z = x[x.S]; >z : any >x[x.S] : any ->x : any ->x.S : any ->x : any ->S : any +>x : typeof x +>x.S : unique symbol +>x : typeof x +>S : unique symbol + +=== lateBoundAssignmentDeclarationSupport2.js === +// currently unsupported +const _sym = Symbol(); +>_sym : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const _str = "my-fake-sym"; +>_str : "my-fake-sym" +>"my-fake-sym" : "my-fake-sym" + +module.exports[_sym] = "ok"; +>module.exports[_sym] = "ok" : "ok" +>module.exports[_sym] : any +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport2") +>module : { "\"lateBoundAssignmentDeclarationSupport2\"": typeof import("./lateBoundAssignmentDeclarationSupport2"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport2") +>_sym : unique symbol +>"ok" : "ok" + +module.exports[_str] = "ok"; +>module.exports[_str] = "ok" : "ok" +>module.exports[_str] : any +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport2") +>module : { "\"lateBoundAssignmentDeclarationSupport2\"": typeof import("./lateBoundAssignmentDeclarationSupport2"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport2") +>_str : "my-fake-sym" +>"ok" : "ok" + +module.exports.S = _sym; +>module.exports.S = _sym : unique symbol +>module.exports.S : unique symbol +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport2") +>module : { "\"lateBoundAssignmentDeclarationSupport2\"": typeof import("./lateBoundAssignmentDeclarationSupport2"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport2") +>S : unique symbol +>_sym : unique symbol diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.errors.txt b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.errors.txt index 22841144de..d65e4df9b2 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.errors.txt @@ -1,12 +1,19 @@ -usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport3.js'. 'lateBoundAssignmentDeclarationSupport3.js' implicitly has an 'any' type. +usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. + Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. +usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. + Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. -==== usage.js (1 errors) ==== +==== usage.js (2 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport3.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport3.js'. 'lateBoundAssignmentDeclarationSupport3.js' implicitly has an 'any' type. const y = x["my-fake-sym"]; + ~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. +!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. const z = x[x.S]; + ~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. +!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. ==== lateBoundAssignmentDeclarationSupport3.js (0 errors) ==== // currently unsupported diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols index 3bae7cdc52..4fbeabef51 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols @@ -4,6 +4,7 @@ const x = require("./lateBoundAssignmentDeclarationSupport3.js"); >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) +>"./lateBoundAssignmentDeclarationSupport3.js" : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) const y = x["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) @@ -12,5 +13,44 @@ const y = x["my-fake-sym"]; const z = x[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) + +=== lateBoundAssignmentDeclarationSupport3.js === +// currently unsupported +const _sym = Symbol(); +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const _str = "my-fake-sym"; +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport3.js, 2, 5)) + +Object.defineProperty(module.exports, _sym, { value: "ok" }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) +>value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport3.js, 4, 45)) + +Object.defineProperty(module.exports, _str, { value: "ok" }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport3.js, 2, 5)) +>value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 45)) + +module.exports.S = _sym; +>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols.diff b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols.diff index 16ff912a82..34b9842a8a 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols.diff @@ -5,50 +5,62 @@ >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) ->"./lateBoundAssignmentDeclarationSupport3.js" : Symbol(x, Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) ++>"./lateBoundAssignmentDeclarationSupport3.js" : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) const y = x["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) -@@= skipped -9, +8 lines =@@ +@@= skipped -9, +9 lines =@@ const z = x[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->x.S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) ++>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) -- --=== lateBoundAssignmentDeclarationSupport3.js === --// currently unsupported --const _sym = Symbol(); -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) -->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -- --const _str = "my-fake-sym"; -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport3.js, 2, 5)) -- --Object.defineProperty(module.exports, _sym, { value: "ok" }); ++>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) + + === lateBoundAssignmentDeclarationSupport3.js === + // currently unsupported +@@= skipped -14, +14 lines =@@ + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport3.js, 2, 5)) + + Object.defineProperty(module.exports, _sym, { value: "ok" }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->module.exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) -->value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport3.js, 4, 45)) -- --Object.defineProperty(module.exports, _str, { value: "ok" }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) + >value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport3.js, 4, 45)) + + Object.defineProperty(module.exports, _str, { value: "ok" }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->module.exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport3.js, 2, 5)) -->value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 45)) -- --module.exports.S = _sym; -->module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport3.js, 2, 5)) + >value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 45)) + + module.exports.S = _sym; + >module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) ->module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) -->S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) + >S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.types b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.types index 87a0d10171..9bf71295d4 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.types +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.types @@ -2,22 +2,68 @@ === usage.js === const x = require("./lateBoundAssignmentDeclarationSupport3.js"); ->x : any ->require("./lateBoundAssignmentDeclarationSupport3.js") : any +>x : typeof x +>require("./lateBoundAssignmentDeclarationSupport3.js") : typeof x >require : any >"./lateBoundAssignmentDeclarationSupport3.js" : "./lateBoundAssignmentDeclarationSupport3.js" const y = x["my-fake-sym"]; >y : any >x["my-fake-sym"] : any ->x : any +>x : typeof x >"my-fake-sym" : "my-fake-sym" const z = x[x.S]; >z : any >x[x.S] : any ->x : any ->x.S : any ->x : any ->S : any +>x : typeof x +>x.S : unique symbol +>x : typeof x +>S : unique symbol + +=== lateBoundAssignmentDeclarationSupport3.js === +// currently unsupported +const _sym = Symbol(); +>_sym : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const _str = "my-fake-sym"; +>_str : "my-fake-sym" +>"my-fake-sym" : "my-fake-sym" + +Object.defineProperty(module.exports, _sym, { value: "ok" }); +>Object.defineProperty(module.exports, _sym, { value: "ok" }) : typeof import("./lateBoundAssignmentDeclarationSupport3") +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport3") +>module : { "\"lateBoundAssignmentDeclarationSupport3\"": typeof import("./lateBoundAssignmentDeclarationSupport3"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport3") +>_sym : unique symbol +>{ value: "ok" } : { value: string; } +>value : string +>"ok" : "ok" + +Object.defineProperty(module.exports, _str, { value: "ok" }); +>Object.defineProperty(module.exports, _str, { value: "ok" }) : typeof import("./lateBoundAssignmentDeclarationSupport3") +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport3") +>module : { "\"lateBoundAssignmentDeclarationSupport3\"": typeof import("./lateBoundAssignmentDeclarationSupport3"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport3") +>_str : "my-fake-sym" +>{ value: "ok" } : { value: string; } +>value : string +>"ok" : "ok" + +module.exports.S = _sym; +>module.exports.S = _sym : unique symbol +>module.exports.S : unique symbol +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport3") +>module : { "\"lateBoundAssignmentDeclarationSupport3\"": typeof import("./lateBoundAssignmentDeclarationSupport3"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport3") +>S : unique symbol +>_sym : unique symbol diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt index c624243a82..6f68a5e892 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt @@ -1,15 +1,16 @@ -usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport4.js'. 'lateBoundAssignmentDeclarationSupport4.js' implicitly has an 'any' type. +lateBoundAssignmentDeclarationSupport4.js(9,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. +usage.js(2,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ==== usage.js (1 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport4.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport4.js'. 'lateBoundAssignmentDeclarationSupport4.js' implicitly has an 'any' type. const inst = new x.F(); + ~~~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const y = inst["my-fake-sym"]; const z = inst[x.S]; -==== lateBoundAssignmentDeclarationSupport4.js (0 errors) ==== +==== lateBoundAssignmentDeclarationSupport4.js (1 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; @@ -19,6 +20,8 @@ usage.js(1,19): error TS7016: Could not find a declaration file for module './la F.prototype[_sym] = "ok"; F.prototype[_str] = "ok"; const inst = new F(); + ~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const _y = inst[_str]; const _z = inst[_sym]; module.exports.F = F; diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols index 634958287c..746adf1266 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols @@ -4,10 +4,13 @@ const x = require("./lateBoundAssignmentDeclarationSupport4.js"); >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) +>"./lateBoundAssignmentDeclarationSupport4.js" : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) const inst = new x.F(); >inst : Symbol(inst, Decl(usage.js, 1, 5)) +>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) const y = inst["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 2, 5)) @@ -16,5 +19,61 @@ const y = inst["my-fake-sym"]; const z = inst[x.S]; >z : Symbol(z, Decl(usage.js, 3, 5)) >inst : Symbol(inst, Decl(usage.js, 1, 5)) +>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) + +=== lateBoundAssignmentDeclarationSupport4.js === +// currently unsupported +const _sym = Symbol(); +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const _str = "my-fake-sym"; +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5)) + +function F() { +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) +} +F.prototype[_sym] = "ok"; +>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) + +F.prototype[_str] = "ok"; +>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5)) + +const inst = new F(); +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport4.js, 8, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) + +const _y = inst[_str]; +>_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport4.js, 9, 5)) +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport4.js, 8, 5)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5)) + +const _z = inst[_sym]; +>_z : Symbol(_z, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 5)) +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport4.js, 8, 5)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) + +module.exports.F = F; +>module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) + +module.exports.S = _sym; +>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols.diff b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols.diff index 3f1e5d91a3..042e2bf43b 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols.diff @@ -5,73 +5,70 @@ >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) ->"./lateBoundAssignmentDeclarationSupport4.js" : Symbol(x, Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) ++>"./lateBoundAssignmentDeclarationSupport4.js" : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) const inst = new x.F(); >inst : Symbol(inst, Decl(usage.js, 1, 5)) ->x.F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) ++>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) const y = inst["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 2, 5)) -@@= skipped -15, +12 lines =@@ +@@= skipped -15, +15 lines =@@ const z = inst[x.S]; >z : Symbol(z, Decl(usage.js, 3, 5)) >inst : Symbol(inst, Decl(usage.js, 1, 5)) ->x.S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) ++>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) -- --=== lateBoundAssignmentDeclarationSupport4.js === --// currently unsupported --const _sym = Symbol(); -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) -->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -- --const _str = "my-fake-sym"; -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5)) -- --function F() { -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) --} --F.prototype[_sym] = "ok"; ++>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) + + === lateBoundAssignmentDeclarationSupport4.js === + // currently unsupported +@@= skipped -17, +17 lines =@@ + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) + } + F.prototype[_sym] = "ok"; ->F.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) ++>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) -- --F.prototype[_str] = "ok"; ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) + + F.prototype[_str] = "ok"; ->F.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) ++>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5)) -- --const inst = new F(); -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport4.js, 8, 5)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) -- --const _y = inst[_str]; -->_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport4.js, 9, 5)) -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport4.js, 8, 5)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5)) -- --const _z = inst[_sym]; -->_z : Symbol(_z, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 5)) -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport4.js, 8, 5)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) -- --module.exports.F = F; -->module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5)) + + const inst = new F(); +@@= skipped -27, +27 lines =@@ + + module.exports.F = F; + >module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) ->module.exports : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) -- --module.exports.S = _sym; -->module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) + + module.exports.S = _sym; + >module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) ->module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) -->S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) + >S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.types b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.types index 123e4b405c..5c0e03443a 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.types +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.types @@ -2,17 +2,17 @@ === usage.js === const x = require("./lateBoundAssignmentDeclarationSupport4.js"); ->x : any ->require("./lateBoundAssignmentDeclarationSupport4.js") : any +>x : typeof x +>require("./lateBoundAssignmentDeclarationSupport4.js") : typeof x >require : any >"./lateBoundAssignmentDeclarationSupport4.js" : "./lateBoundAssignmentDeclarationSupport4.js" const inst = new x.F(); >inst : any >new x.F() : any ->x.F : any ->x : any ->F : any +>x.F : () => void +>x : typeof x +>F : () => void const y = inst["my-fake-sym"]; >y : any @@ -24,7 +24,74 @@ const z = inst[x.S]; >z : any >inst[x.S] : any >inst : any ->x.S : any ->x : any ->S : any +>x.S : unique symbol +>x : typeof x +>S : unique symbol + +=== lateBoundAssignmentDeclarationSupport4.js === +// currently unsupported +const _sym = Symbol(); +>_sym : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const _str = "my-fake-sym"; +>_str : "my-fake-sym" +>"my-fake-sym" : "my-fake-sym" + +function F() { +>F : () => void +} +F.prototype[_sym] = "ok"; +>F.prototype[_sym] = "ok" : "ok" +>F.prototype[_sym] : any +>F.prototype : any +>F : () => void +>prototype : any +>_sym : unique symbol +>"ok" : "ok" + +F.prototype[_str] = "ok"; +>F.prototype[_str] = "ok" : "ok" +>F.prototype[_str] : any +>F.prototype : any +>F : () => void +>prototype : any +>_str : "my-fake-sym" +>"ok" : "ok" + +const inst = new F(); +>inst : any +>new F() : any +>F : () => void + +const _y = inst[_str]; +>_y : any +>inst[_str] : any +>inst : any +>_str : "my-fake-sym" + +const _z = inst[_sym]; +>_z : any +>inst[_sym] : any +>inst : any +>_sym : unique symbol + +module.exports.F = F; +>module.exports.F = F : () => void +>module.exports.F : () => void +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport4") +>module : { "\"lateBoundAssignmentDeclarationSupport4\"": typeof import("./lateBoundAssignmentDeclarationSupport4"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport4") +>F : () => void +>F : () => void + +module.exports.S = _sym; +>module.exports.S = _sym : unique symbol +>module.exports.S : unique symbol +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport4") +>module : { "\"lateBoundAssignmentDeclarationSupport4\"": typeof import("./lateBoundAssignmentDeclarationSupport4"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport4") +>S : unique symbol +>_sym : unique symbol diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt index cf072d5f16..356f94438c 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt @@ -1,15 +1,16 @@ -usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport5.js'. 'lateBoundAssignmentDeclarationSupport5.js' implicitly has an 'any' type. +lateBoundAssignmentDeclarationSupport5.js(11,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. +usage.js(2,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ==== usage.js (1 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport5.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport5.js'. 'lateBoundAssignmentDeclarationSupport5.js' implicitly has an 'any' type. const inst = new x.F(); + ~~~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const y = inst["my-fake-sym"]; const z = inst[x.S]; -==== lateBoundAssignmentDeclarationSupport5.js (0 errors) ==== +==== lateBoundAssignmentDeclarationSupport5.js (1 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; @@ -21,6 +22,8 @@ usage.js(1,19): error TS7016: Could not find a declaration file for module './la [_str]: "ok" } const inst = new F(); + ~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const _y = inst[_str]; const _z = inst[_sym]; module.exports.F = F; diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols index 46fc5ab27a..dfec96506b 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols @@ -4,10 +4,13 @@ const x = require("./lateBoundAssignmentDeclarationSupport5.js"); >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) +>"./lateBoundAssignmentDeclarationSupport5.js" : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) const inst = new x.F(); >inst : Symbol(inst, Decl(usage.js, 1, 5)) +>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) const y = inst["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 2, 5)) @@ -16,5 +19,62 @@ const y = inst["my-fake-sym"]; const z = inst[x.S]; >z : Symbol(z, Decl(usage.js, 3, 5)) >inst : Symbol(inst, Decl(usage.js, 1, 5)) +>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) + +=== lateBoundAssignmentDeclarationSupport5.js === +// currently unsupported +const _sym = Symbol(); +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const _str = "my-fake-sym"; +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5)) + +function F() { +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) +} +F.prototype = { +>F.prototype : Symbol(prototype, Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) +>prototype : Symbol(prototype, Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) + + [_sym]: "ok", +>[_sym] : Symbol([_sym], Decl(lateBoundAssignmentDeclarationSupport5.js, 6, 15)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) + + [_str]: "ok" +>[_str] : Symbol([_str], Decl(lateBoundAssignmentDeclarationSupport5.js, 7, 17)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5)) +} +const inst = new F(); +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) + +const _y = inst[_str]; +>_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport5.js, 11, 5)) +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5)) + +const _z = inst[_sym]; +>_z : Symbol(_z, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 5)) +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) + +module.exports.F = F; +>module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) + +module.exports.S = _sym; +>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols.diff b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols.diff index abbbbe872f..affd1d4a62 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols.diff @@ -5,74 +5,77 @@ >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) ->"./lateBoundAssignmentDeclarationSupport5.js" : Symbol(x, Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) ++>"./lateBoundAssignmentDeclarationSupport5.js" : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) const inst = new x.F(); >inst : Symbol(inst, Decl(usage.js, 1, 5)) ->x.F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ++>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) const y = inst["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 2, 5)) -@@= skipped -15, +12 lines =@@ +@@= skipped -15, +15 lines =@@ const z = inst[x.S]; >z : Symbol(z, Decl(usage.js, 3, 5)) >inst : Symbol(inst, Decl(usage.js, 1, 5)) ->x.S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) ++>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) -- --=== lateBoundAssignmentDeclarationSupport5.js === --// currently unsupported --const _sym = Symbol(); -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) -->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -- --const _str = "my-fake-sym"; -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5)) -- --function F() { ++>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) + + === lateBoundAssignmentDeclarationSupport5.js === + // currently unsupported +@@= skipped -14, +14 lines =@@ + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5)) + + function F() { ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27), Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) --} --F.prototype = { ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) + } + F.prototype = { ->F.prototype : Symbol(F.prototype, Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27), Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) ->prototype : Symbol(F.prototype, Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) -- -- [_sym]: "ok", -->[_sym] : Symbol([_sym], Decl(lateBoundAssignmentDeclarationSupport5.js, 6, 15)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) -- -- [_str]: "ok" -->[_str] : Symbol([_str], Decl(lateBoundAssignmentDeclarationSupport5.js, 7, 17)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5)) --} --const inst = new F(); -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5)) ++>F.prototype : Symbol(prototype, Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) ++>prototype : Symbol(prototype, Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) + + [_sym]: "ok", + >[_sym] : Symbol([_sym], Decl(lateBoundAssignmentDeclarationSupport5.js, 6, 15)) +@@= skipped -17, +17 lines =@@ + } + const inst = new F(); + >inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5)) ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27), Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) -- --const _y = inst[_str]; -->_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport5.js, 11, 5)) -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5)) -- --const _z = inst[_sym]; -->_z : Symbol(_z, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 5)) -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) -- --module.exports.F = F; -->module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) + + const _y = inst[_str]; + >_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport5.js, 11, 5)) +@@= skipped -14, +14 lines =@@ + + module.exports.F = F; + >module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ->module.exports : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27), Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) -- --module.exports.S = _sym; -->module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) + + module.exports.S = _sym; + >module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) ->module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) -->S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) + >S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.types b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.types index f01b6acab6..efb0a174d2 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.types +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.types @@ -2,17 +2,17 @@ === usage.js === const x = require("./lateBoundAssignmentDeclarationSupport5.js"); ->x : any ->require("./lateBoundAssignmentDeclarationSupport5.js") : any +>x : typeof x +>require("./lateBoundAssignmentDeclarationSupport5.js") : typeof x >require : any >"./lateBoundAssignmentDeclarationSupport5.js" : "./lateBoundAssignmentDeclarationSupport5.js" const inst = new x.F(); >inst : any >new x.F() : any ->x.F : any ->x : any ->F : any +>x.F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } +>x : typeof x +>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } const y = inst["my-fake-sym"]; >y : any @@ -24,7 +24,73 @@ const z = inst[x.S]; >z : any >inst[x.S] : any >inst : any ->x.S : any ->x : any ->S : any +>x.S : unique symbol +>x : typeof x +>S : unique symbol + +=== lateBoundAssignmentDeclarationSupport5.js === +// currently unsupported +const _sym = Symbol(); +>_sym : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const _str = "my-fake-sym"; +>_str : "my-fake-sym" +>"my-fake-sym" : "my-fake-sym" + +function F() { +>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } +} +F.prototype = { +>F.prototype = { [_sym]: "ok", [_str]: "ok"} : { [_sym]: string; "my-fake-sym": string; } +>F.prototype : { [_sym]: string; "my-fake-sym": string; } +>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } +>prototype : { [_sym]: string; "my-fake-sym": string; } +>{ [_sym]: "ok", [_str]: "ok"} : { [_sym]: string; "my-fake-sym": string; } + + [_sym]: "ok", +>[_sym] : string +>_sym : unique symbol +>"ok" : "ok" + + [_str]: "ok" +>[_str] : string +>_str : "my-fake-sym" +>"ok" : "ok" +} +const inst = new F(); +>inst : any +>new F() : any +>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } + +const _y = inst[_str]; +>_y : any +>inst[_str] : any +>inst : any +>_str : "my-fake-sym" + +const _z = inst[_sym]; +>_z : any +>inst[_sym] : any +>inst : any +>_sym : unique symbol + +module.exports.F = F; +>module.exports.F = F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } +>module.exports.F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport5") +>module : { "\"lateBoundAssignmentDeclarationSupport5\"": typeof import("./lateBoundAssignmentDeclarationSupport5"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport5") +>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } +>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } + +module.exports.S = _sym; +>module.exports.S = _sym : unique symbol +>module.exports.S : unique symbol +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport5") +>module : { "\"lateBoundAssignmentDeclarationSupport5\"": typeof import("./lateBoundAssignmentDeclarationSupport5"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport5") +>S : unique symbol +>_sym : unique symbol diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt index f0ded7fc59..f178d33b5d 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt @@ -1,15 +1,16 @@ -usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport6.js'. 'lateBoundAssignmentDeclarationSupport6.js' implicitly has an 'any' type. +lateBoundAssignmentDeclarationSupport6.js(10,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. +usage.js(2,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ==== usage.js (1 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport6.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport6.js'. 'lateBoundAssignmentDeclarationSupport6.js' implicitly has an 'any' type. const inst = new x.F(); + ~~~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const y = inst["my-fake-sym"]; const z = inst[x.S]; -==== lateBoundAssignmentDeclarationSupport6.js (0 errors) ==== +==== lateBoundAssignmentDeclarationSupport6.js (1 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; @@ -20,6 +21,8 @@ usage.js(1,19): error TS7016: Could not find a declaration file for module './la Object.defineProperty(F.prototype, _str, {value: "ok"}); Object.defineProperty(F.prototype, _sym, {value: "ok"}); const inst = new F(); + ~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const _y = inst[_str]; const _z = inst[_sym]; module.exports.F = F; diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols index 01aaa40dfd..0262cf32be 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols @@ -4,10 +4,13 @@ const x = require("./lateBoundAssignmentDeclarationSupport6.js"); >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) +>"./lateBoundAssignmentDeclarationSupport6.js" : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) const inst = new x.F(); >inst : Symbol(inst, Decl(usage.js, 1, 5)) +>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) const y = inst["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 2, 5)) @@ -16,5 +19,74 @@ const y = inst["my-fake-sym"]; const z = inst[x.S]; >z : Symbol(z, Decl(usage.js, 3, 5)) >inst : Symbol(inst, Decl(usage.js, 1, 5)) +>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) + +=== lateBoundAssignmentDeclarationSupport6.js === +// currently unsupported +const _sym = Symbol(); +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const _str = "my-fake-sym"; +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5)) + +function F() { +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) +} +F.prototype.defsAClass = true; +>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + +Object.defineProperty(F.prototype, _str, {value: "ok"}); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5)) +>value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport6.js, 7, 42)) + +Object.defineProperty(F.prototype, _sym, {value: "ok"}); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) +>value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport6.js, 8, 42)) + +const inst = new F(); +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport6.js, 9, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) + +const _y = inst[_str]; +>_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport6.js, 10, 5)) +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport6.js, 9, 5)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5)) + +const _z = inst[_sym]; +>_z : Symbol(_z, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 5)) +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport6.js, 9, 5)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) + +module.exports.F = F; +>module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) + +module.exports.S = _sym; +>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols.diff b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols.diff index eb78fefdea..ee8cda6b2e 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols.diff @@ -5,87 +5,89 @@ >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) ->"./lateBoundAssignmentDeclarationSupport6.js" : Symbol(x, Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) ++>"./lateBoundAssignmentDeclarationSupport6.js" : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) const inst = new x.F(); >inst : Symbol(inst, Decl(usage.js, 1, 5)) ->x.F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) ++>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) const y = inst["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 2, 5)) -@@= skipped -15, +12 lines =@@ +@@= skipped -15, +15 lines =@@ const z = inst[x.S]; >z : Symbol(z, Decl(usage.js, 3, 5)) >inst : Symbol(inst, Decl(usage.js, 1, 5)) ->x.S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) ++>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) -- --=== lateBoundAssignmentDeclarationSupport6.js === --// currently unsupported --const _sym = Symbol(); -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) -->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -- --const _str = "my-fake-sym"; -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5)) -- --function F() { -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) --} --F.prototype.defsAClass = true; ++>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) + + === lateBoundAssignmentDeclarationSupport6.js === + // currently unsupported +@@= skipped -17, +17 lines =@@ + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) + } + F.prototype.defsAClass = true; ->F.prototype : Symbol(F.defsAClass, Decl(lateBoundAssignmentDeclarationSupport6.js, 5, 1)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) ++>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->defsAClass : Symbol(F.defsAClass, Decl(lateBoundAssignmentDeclarationSupport6.js, 5, 1)) -- --Object.defineProperty(F.prototype, _str, {value: "ok"}); ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + + Object.defineProperty(F.prototype, _str, {value: "ok"}); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->F.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5)) -->value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport6.js, 7, 42)) -- --Object.defineProperty(F.prototype, _sym, {value: "ok"}); ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5)) + >value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport6.js, 7, 42)) + + Object.defineProperty(F.prototype, _sym, {value: "ok"}); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->F.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) -->value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport6.js, 8, 42)) -- --const inst = new F(); -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport6.js, 9, 5)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) -- --const _y = inst[_str]; -->_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport6.js, 10, 5)) -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport6.js, 9, 5)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5)) -- --const _z = inst[_sym]; -->_z : Symbol(_z, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 5)) -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport6.js, 9, 5)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) -- --module.exports.F = F; -->module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) + >value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport6.js, 8, 42)) + +@@= skipped -41, +40 lines =@@ + + module.exports.F = F; + >module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) ->module.exports : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) -- --module.exports.S = _sym; -->module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) + + module.exports.S = _sym; + >module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) ->module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) -->S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) + >S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.types b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.types index d59bee28f5..011fe06265 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.types +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.types @@ -2,17 +2,17 @@ === usage.js === const x = require("./lateBoundAssignmentDeclarationSupport6.js"); ->x : any ->require("./lateBoundAssignmentDeclarationSupport6.js") : any +>x : typeof x +>require("./lateBoundAssignmentDeclarationSupport6.js") : typeof x >require : any >"./lateBoundAssignmentDeclarationSupport6.js" : "./lateBoundAssignmentDeclarationSupport6.js" const inst = new x.F(); >inst : any >new x.F() : any ->x.F : any ->x : any ->F : any +>x.F : () => void +>x : typeof x +>F : () => void const y = inst["my-fake-sym"]; >y : any @@ -24,7 +24,91 @@ const z = inst[x.S]; >z : any >inst[x.S] : any >inst : any ->x.S : any ->x : any ->S : any +>x.S : unique symbol +>x : typeof x +>S : unique symbol + +=== lateBoundAssignmentDeclarationSupport6.js === +// currently unsupported +const _sym = Symbol(); +>_sym : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const _str = "my-fake-sym"; +>_str : "my-fake-sym" +>"my-fake-sym" : "my-fake-sym" + +function F() { +>F : () => void +} +F.prototype.defsAClass = true; +>F.prototype.defsAClass = true : true +>F.prototype.defsAClass : any +>F.prototype : any +>F : () => void +>prototype : any +>defsAClass : any +>true : true + +Object.defineProperty(F.prototype, _str, {value: "ok"}); +>Object.defineProperty(F.prototype, _str, {value: "ok"}) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>F.prototype : any +>F : () => void +>prototype : any +>_str : "my-fake-sym" +>{value: "ok"} : { value: string; } +>value : string +>"ok" : "ok" + +Object.defineProperty(F.prototype, _sym, {value: "ok"}); +>Object.defineProperty(F.prototype, _sym, {value: "ok"}) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>F.prototype : any +>F : () => void +>prototype : any +>_sym : unique symbol +>{value: "ok"} : { value: string; } +>value : string +>"ok" : "ok" + +const inst = new F(); +>inst : any +>new F() : any +>F : () => void + +const _y = inst[_str]; +>_y : any +>inst[_str] : any +>inst : any +>_str : "my-fake-sym" + +const _z = inst[_sym]; +>_z : any +>inst[_sym] : any +>inst : any +>_sym : unique symbol + +module.exports.F = F; +>module.exports.F = F : () => void +>module.exports.F : () => void +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport6") +>module : { "\"lateBoundAssignmentDeclarationSupport6\"": typeof import("./lateBoundAssignmentDeclarationSupport6"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport6") +>F : () => void +>F : () => void + +module.exports.S = _sym; +>module.exports.S = _sym : unique symbol +>module.exports.S : unique symbol +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport6") +>module : { "\"lateBoundAssignmentDeclarationSupport6\"": typeof import("./lateBoundAssignmentDeclarationSupport6"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport6") +>S : unique symbol +>_sym : unique symbol diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.errors.txt b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.errors.txt deleted file mode 100644 index acaa5d43eb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport7.js'. 'lateBoundAssignmentDeclarationSupport7.js' implicitly has an 'any' type. - - -==== usage.js (1 errors) ==== - const x = require("./lateBoundAssignmentDeclarationSupport7.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport7.js'. 'lateBoundAssignmentDeclarationSupport7.js' implicitly has an 'any' type. - const y = x.F["my-fake-sym"]; - const z = x.F[x.S]; - -==== lateBoundAssignmentDeclarationSupport7.js (0 errors) ==== - const _sym = Symbol(); - const _str = "my-fake-sym"; - - function F() { - } - F[_sym] = "ok"; - F[_str] = "ok"; - module.exports.F = F; - module.exports.S = _sym; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols index 91ccf436fb..c240506a8e 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols @@ -4,13 +4,56 @@ const x = require("./lateBoundAssignmentDeclarationSupport7.js"); >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) +>"./lateBoundAssignmentDeclarationSupport7.js" : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) const y = x.F["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) +>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) +>"my-fake-sym" : Symbol(F[_str], Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15)) const z = x.F[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) +>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) +>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) + +=== lateBoundAssignmentDeclarationSupport7.js === +const _sym = Symbol(); +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const _str = "my-fake-sym"; +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 5)) + +function F() { +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) +} +F[_sym] = "ok"; +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) + +F[_str] = "ok"; +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 5)) + +module.exports.F = F; +>module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) + +module.exports.S = _sym; +>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols.diff b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols.diff index d89e300c18..607ea8926c 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols.diff @@ -5,13 +5,17 @@ >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) ->"./lateBoundAssignmentDeclarationSupport7.js" : Symbol(x, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) ++>"./lateBoundAssignmentDeclarationSupport7.js" : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) const y = x.F["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) ->x.F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ++>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ->"my-fake-sym" : Symbol(x.F.F[_str], Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ++>"my-fake-sym" : Symbol(F[_str], Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15)) const z = x.F[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) @@ -21,40 +25,51 @@ ->x.S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) ->x : Symbol(x, Decl(usage.js, 0, 5)) ->S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) -- --=== lateBoundAssignmentDeclarationSupport7.js === --const _sym = Symbol(); -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) -->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -- --const _str = "my-fake-sym"; -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 5)) -- --function F() { ++>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ++>x : Symbol(x, Decl(usage.js, 0, 5)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ++>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) ++>x : Symbol(x, Decl(usage.js, 0, 5)) ++>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) + + === lateBoundAssignmentDeclarationSupport7.js === + const _sym = Symbol(); +@@= skipped -27, +27 lines =@@ + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 5)) + + function F() { ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27), Decl(lateBoundAssignmentDeclarationSupport7.js, 4, 1), Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15)) --} --F[_sym] = "ok"; ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) + } + F[_sym] = "ok"; ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27), Decl(lateBoundAssignmentDeclarationSupport7.js, 4, 1), Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) -- --F[_str] = "ok"; ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) + + F[_str] = "ok"; ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27), Decl(lateBoundAssignmentDeclarationSupport7.js, 4, 1), Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 5)) -- --module.exports.F = F; -->module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 5)) + + module.exports.F = F; + >module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ->module.exports : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27), Decl(lateBoundAssignmentDeclarationSupport7.js, 4, 1), Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15)) -- --module.exports.S = _sym; -->module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) + + module.exports.S = _sym; + >module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) ->module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) -->S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) -+>x : Symbol(x, Decl(usage.js, 0, 5)) -+>x : Symbol(x, Decl(usage.js, 0, 5)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) + >S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.types b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.types index 450a5a61c7..7c3a480473 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.types +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.types @@ -2,26 +2,71 @@ === usage.js === const x = require("./lateBoundAssignmentDeclarationSupport7.js"); ->x : any ->require("./lateBoundAssignmentDeclarationSupport7.js") : any +>x : typeof x +>require("./lateBoundAssignmentDeclarationSupport7.js") : typeof x >require : any >"./lateBoundAssignmentDeclarationSupport7.js" : "./lateBoundAssignmentDeclarationSupport7.js" const y = x.F["my-fake-sym"]; ->y : any ->x.F["my-fake-sym"] : any ->x.F : any ->x : any ->F : any +>y : string +>x.F["my-fake-sym"] : string +>x.F : { (): void; [_sym]: string; "my-fake-sym": string; } +>x : typeof x +>F : { (): void; [_sym]: string; "my-fake-sym": string; } >"my-fake-sym" : "my-fake-sym" const z = x.F[x.S]; ->z : any ->x.F[x.S] : any ->x.F : any ->x : any ->F : any ->x.S : any ->x : any ->S : any +>z : string +>x.F[x.S] : string +>x.F : { (): void; [_sym]: string; "my-fake-sym": string; } +>x : typeof x +>F : { (): void; [_sym]: string; "my-fake-sym": string; } +>x.S : unique symbol +>x : typeof x +>S : unique symbol + +=== lateBoundAssignmentDeclarationSupport7.js === +const _sym = Symbol(); +>_sym : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const _str = "my-fake-sym"; +>_str : "my-fake-sym" +>"my-fake-sym" : "my-fake-sym" + +function F() { +>F : { (): void; [_sym]: string; "my-fake-sym": string; } +} +F[_sym] = "ok"; +>F[_sym] = "ok" : "ok" +>F[_sym] : string +>F : { (): void; [_sym]: string; "my-fake-sym": string; } +>_sym : unique symbol +>"ok" : "ok" + +F[_str] = "ok"; +>F[_str] = "ok" : "ok" +>F[_str] : string +>F : { (): void; [_sym]: string; "my-fake-sym": string; } +>_str : "my-fake-sym" +>"ok" : "ok" + +module.exports.F = F; +>module.exports.F = F : { (): void; [_sym]: string; "my-fake-sym": string; } +>module.exports.F : { (): void; [_sym]: string; "my-fake-sym": string; } +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport7") +>module : { "\"lateBoundAssignmentDeclarationSupport7\"": typeof import("./lateBoundAssignmentDeclarationSupport7"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport7") +>F : { (): void; [_sym]: string; "my-fake-sym": string; } +>F : { (): void; [_sym]: string; "my-fake-sym": string; } + +module.exports.S = _sym; +>module.exports.S = _sym : unique symbol +>module.exports.S : unique symbol +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport7") +>module : { "\"lateBoundAssignmentDeclarationSupport7\"": typeof import("./lateBoundAssignmentDeclarationSupport7"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport7") +>S : unique symbol +>_sym : unique symbol diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.errors.txt new file mode 100644 index 0000000000..5722991ad9 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.errors.txt @@ -0,0 +1,30 @@ +index.js(4,13): error TS2351: This expression is not constructable. + Type 'typeof import("semver")' has no construct signatures. +semver.js(2,1): error TS2631: Cannot assign to '"semver"' because it is a namespace. +semver.js(2,11): error TS2322: Type '() => void' is not assignable to type 'typeof import("semver")'. + + +==== index.js (1 errors) ==== + /// + const C = require("./semver") + var two = C.f(1) + var c = new C + ~ +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'typeof import("semver")' has no construct signatures. + +==== node.d.ts (0 errors) ==== + declare function require(name: string): any; + declare var exports: any; + declare var module: { exports: any }; +==== semver.js (2 errors) ==== + /// + exports = module.exports = C + ~~~~~~~ +!!! error TS2631: Cannot assign to '"semver"' because it is a namespace. + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => void' is not assignable to type 'typeof import("semver")'. + exports.f = n => n + 1 + function C() { + this.p = 1 + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols index 3d87d7dd5c..e185fa60f0 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols @@ -5,10 +5,13 @@ const C = require("./semver") >C : Symbol(C, Decl(index.js, 1, 5)) >require : Symbol(require, Decl(node.d.ts, 0, 0)) +>"./semver" : Symbol("semver", Decl(semver.js, 0, 0)) var two = C.f(1) >two : Symbol(two, Decl(index.js, 2, 3)) +>C.f : Symbol(f, Decl(semver.js, 1, 28)) >C : Symbol(C, Decl(index.js, 1, 5)) +>f : Symbol(f, Decl(semver.js, 1, 28)) var c = new C >c : Symbol(c, Decl(index.js, 3, 3)) @@ -26,3 +29,24 @@ declare var module: { exports: any }; >module : Symbol(module, Decl(node.d.ts, 2, 11)) >exports : Symbol(exports, Decl(node.d.ts, 2, 21)) +=== semver.js === +/// +exports = module.exports = C +>exports : Symbol("semver", Decl(semver.js, 0, 0)) +>module.exports : Symbol("semver", Decl(semver.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("semver", Decl(semver.js, 0, 0)) +>C : Symbol(C, Decl(semver.js, 2, 22)) + +exports.f = n => n + 1 +>exports.f : Symbol(f, Decl(semver.js, 1, 28)) +>exports : Symbol("semver", Decl(semver.js, 0, 0)) +>f : Symbol(f, Decl(semver.js, 1, 28)) +>n : Symbol(n, Decl(semver.js, 2, 11)) +>n : Symbol(n, Decl(semver.js, 2, 11)) + +function C() { +>C : Symbol(C, Decl(semver.js, 2, 22)) + + this.p = 1 +} diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols.diff index 1474a9199b..b00ecd13da 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols.diff @@ -1,44 +1,41 @@ --- old.moduleExportAlias2.symbols +++ new.moduleExportAlias2.symbols -@@= skipped -4, +4 lines =@@ - const C = require("./semver") - >C : Symbol(C, Decl(index.js, 1, 5)) - >require : Symbol(require, Decl(node.d.ts, 0, 0)) -->"./semver" : Symbol("semver", Decl(semver.js, 0, 0)) +@@= skipped -8, +8 lines =@@ var two = C.f(1) >two : Symbol(two, Decl(index.js, 2, 3)) ->C.f : Symbol(C.f, Decl(semver.js, 1, 28)) ++>C.f : Symbol(f, Decl(semver.js, 1, 28)) >C : Symbol(C, Decl(index.js, 1, 5)) ->f : Symbol(C.f, Decl(semver.js, 1, 28)) ++>f : Symbol(f, Decl(semver.js, 1, 28)) var c = new C >c : Symbol(c, Decl(index.js, 3, 3)) -@@= skipped -24, +21 lines =@@ - >module : Symbol(module, Decl(node.d.ts, 2, 11)) - >exports : Symbol(exports, Decl(node.d.ts, 2, 21)) - --=== semver.js === --/// --exports = module.exports = C -->exports : Symbol("semver", Decl(semver.js, 0, 0)) +@@= skipped -24, +24 lines =@@ + /// + exports = module.exports = C + >exports : Symbol("semver", Decl(semver.js, 0, 0)) ->module.exports : Symbol(module.exports, Decl(semver.js, 0, 0)) ->module : Symbol(export=, Decl(semver.js, 1, 9)) ->exports : Symbol(export=, Decl(semver.js, 1, 9)) -->C : Symbol(C, Decl(semver.js, 2, 22)) -- --exports.f = n => n + 1 -->exports.f : Symbol(f, Decl(semver.js, 1, 28)) ++>module.exports : Symbol("semver", Decl(semver.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("semver", Decl(semver.js, 0, 0)) + >C : Symbol(C, Decl(semver.js, 2, 22)) + + exports.f = n => n + 1 + >exports.f : Symbol(f, Decl(semver.js, 1, 28)) ->exports : Symbol(f, Decl(semver.js, 1, 28)) -->f : Symbol(f, Decl(semver.js, 1, 28)) -->n : Symbol(n, Decl(semver.js, 2, 11)) -->n : Symbol(n, Decl(semver.js, 2, 11)) -- --function C() { -->C : Symbol(C, Decl(semver.js, 2, 22)) -- -- this.p = 1 ++>exports : Symbol("semver", Decl(semver.js, 0, 0)) + >f : Symbol(f, Decl(semver.js, 1, 28)) + >n : Symbol(n, Decl(semver.js, 2, 11)) + >n : Symbol(n, Decl(semver.js, 2, 11)) +@@= skipped -16, +16 lines =@@ + >C : Symbol(C, Decl(semver.js, 2, 22)) + + this.p = 1 ->this.p : Symbol(C.p, Decl(semver.js, 3, 14)) ->this : Symbol(C, Decl(semver.js, 2, 22)) ->p : Symbol(C.p, Decl(semver.js, 3, 14)) --} \ No newline at end of file + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.types b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.types index d244428cea..8ec634b4d0 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.types @@ -3,23 +3,23 @@ === index.js === /// const C = require("./semver") ->C : any ->require("./semver") : any +>C : typeof C +>require("./semver") : typeof C >require : (name: string) => any >"./semver" : "./semver" var two = C.f(1) >two : any >C.f(1) : any ->C.f : any ->C : any ->f : any +>C.f : (n: any) => any +>C : typeof C +>f : (n: any) => any >1 : 1 var c = new C >c : any >new C : any ->C : any +>C : typeof C === node.d.ts === declare function require(name: string): any; @@ -33,3 +33,35 @@ declare var module: { exports: any }; >module : { exports: any; } >exports : any +=== semver.js === +/// +exports = module.exports = C +>exports = module.exports = C : () => void +>exports : any +>module.exports = C : () => void +>module.exports : typeof import("./semver") +>module : { "\"semver\"": typeof import("./semver"); } +>exports : typeof import("./semver") +>C : () => void + +exports.f = n => n + 1 +>exports.f = n => n + 1 : (n: any) => any +>exports.f : (n: any) => any +>exports : typeof import("./semver") +>f : (n: any) => any +>n => n + 1 : (n: any) => any +>n : any +>n + 1 : any +>n : any +>1 : 1 + +function C() { +>C : () => void + + this.p = 1 +>this.p = 1 : 1 +>this.p : any +>this : any +>p : any +>1 : 1 +} diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.errors.txt new file mode 100644 index 0000000000..8472709b9b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.errors.txt @@ -0,0 +1,44 @@ +npmlog.js(5,14): error TS2741: Property 'y' is missing in type 'EE' but required in type 'typeof import("npmlog")'. +npmlog.js(8,16): error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. +npmlog.js(10,8): error TS2339: Property 'x' does not exist on type 'EE'. +npmlog.js(12,8): error TS2339: Property 'y' does not exist on type 'EE'. +npmlog.js(13,16): error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. +use.js(2,8): error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. +use.js(3,8): error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. + + +==== use.js (2 errors) ==== + var npmlog = require('./npmlog') + npmlog.x + ~ +!!! error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. + npmlog.on + ~~ +!!! error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. + +==== npmlog.js (5 errors) ==== + class EE { + /** @param {string} s */ + on(s) { } + } + var npmlog = module.exports = new EE() + ~~~~~~~~~~~~~~ +!!! error TS2741: Property 'y' is missing in type 'EE' but required in type 'typeof import("npmlog")'. +!!! related TS2728 npmlog.js:11:1: 'y' is declared here. + + npmlog.on('hi') // both references should see EE.on + module.exports.on('hi') // here too + ~~ +!!! error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. + + npmlog.x = 1 + ~ +!!! error TS2339: Property 'x' does not exist on type 'EE'. + module.exports.y = 2 + npmlog.y + ~ +!!! error TS2339: Property 'y' does not exist on type 'EE'. + module.exports.x + ~ +!!! error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols index dce06dcac9..30d662f4bb 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols @@ -4,6 +4,7 @@ var npmlog = require('./npmlog') >npmlog : Symbol(npmlog, Decl(use.js, 0, 3)) >require : Symbol(require) +>'./npmlog' : Symbol("npmlog", Decl(npmlog.js, 0, 0)) npmlog.x >npmlog : Symbol(npmlog, Decl(use.js, 0, 3)) @@ -11,3 +12,47 @@ npmlog.x npmlog.on >npmlog : Symbol(npmlog, Decl(use.js, 0, 3)) +=== npmlog.js === +class EE { +>EE : Symbol(EE, Decl(npmlog.js, 0, 0)) + + /** @param {string} s */ + on(s) { } +>on : Symbol(on, Decl(npmlog.js, 0, 10)) +>s : Symbol(s, Decl(npmlog.js, 2, 7)) +} +var npmlog = module.exports = new EE() +>npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) +>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) +>EE : Symbol(EE, Decl(npmlog.js, 0, 0)) + +npmlog.on('hi') // both references should see EE.on +>npmlog.on : Symbol(on, Decl(npmlog.js, 0, 10)) +>npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) +>on : Symbol(on, Decl(npmlog.js, 0, 10)) + +module.exports.on('hi') // here too +>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) + +npmlog.x = 1 +>npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) + +module.exports.y = 2 +>module.exports.y : Symbol(y, Decl(npmlog.js, 9, 12)) +>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) +>y : Symbol(y, Decl(npmlog.js, 9, 12)) + +npmlog.y +>npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) + +module.exports.x +>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols.diff index 5400f170be..7b555ee6d6 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols.diff @@ -1,10 +1,7 @@ --- old.moduleExportAssignment.symbols +++ new.moduleExportAssignment.symbols -@@= skipped -3, +3 lines =@@ - var npmlog = require('./npmlog') - >npmlog : Symbol(npmlog, Decl(use.js, 0, 3)) - >require : Symbol(require) -->'./npmlog' : Symbol("npmlog", Decl(npmlog.js, 0, 0)) +@@= skipped -6, +6 lines =@@ + >'./npmlog' : Symbol("npmlog", Decl(npmlog.js, 0, 0)) npmlog.x ->npmlog.x : Symbol(npmlog.x, Decl(npmlog.js, 7, 23)) @@ -15,55 +12,70 @@ ->npmlog.on : Symbol(EE.on, Decl(npmlog.js, 0, 10)) >npmlog : Symbol(npmlog, Decl(use.js, 0, 3)) ->on : Symbol(EE.on, Decl(npmlog.js, 0, 10)) -- --=== npmlog.js === --class EE { -->EE : Symbol(EE, Decl(npmlog.js, 0, 0)) -- -- /** @param {string} s */ -- on(s) { } + + === npmlog.js === + class EE { +@@= skipped -15, +11 lines =@@ + + /** @param {string} s */ + on(s) { } ->on : Symbol(EE.on, Decl(npmlog.js, 0, 10)) -->s : Symbol(s, Decl(npmlog.js, 2, 7)) --} --var npmlog = module.exports = new EE() -->npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) ++>on : Symbol(on, Decl(npmlog.js, 0, 10)) + >s : Symbol(s, Decl(npmlog.js, 2, 7)) + } + var npmlog = module.exports = new EE() + >npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) ->module.exports : Symbol(module.exports, Decl(npmlog.js, 0, 0)) ->module : Symbol(npmlog, Decl(npmlog.js, 4, 12)) ->exports : Symbol(npmlog, Decl(npmlog.js, 4, 12)) -->EE : Symbol(EE, Decl(npmlog.js, 0, 0)) -- --npmlog.on('hi') // both references should see EE.on ++>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) + >EE : Symbol(EE, Decl(npmlog.js, 0, 0)) + + npmlog.on('hi') // both references should see EE.on ->npmlog.on : Symbol(EE.on, Decl(npmlog.js, 0, 10)) -->npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) ++>npmlog.on : Symbol(on, Decl(npmlog.js, 0, 10)) + >npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) ->on : Symbol(EE.on, Decl(npmlog.js, 0, 10)) -- --module.exports.on('hi') // here too ++>on : Symbol(on, Decl(npmlog.js, 0, 10)) + + module.exports.on('hi') // here too ->module.exports.on : Symbol(EE.on, Decl(npmlog.js, 0, 10)) ->module.exports : Symbol(module.exports, Decl(npmlog.js, 0, 0)) ->module : Symbol(module, Decl(npmlog.js, 4, 12)) ->exports : Symbol(module.exports, Decl(npmlog.js, 0, 0)) ->on : Symbol(EE.on, Decl(npmlog.js, 0, 10)) -- --npmlog.x = 1 ++>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) + + npmlog.x = 1 ->npmlog.x : Symbol(x, Decl(npmlog.js, 7, 23)) -->npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) + >npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) ->x : Symbol(x, Decl(npmlog.js, 7, 23)) -- --module.exports.y = 2 -->module.exports.y : Symbol(y, Decl(npmlog.js, 9, 12)) + + module.exports.y = 2 + >module.exports.y : Symbol(y, Decl(npmlog.js, 9, 12)) ->module.exports : Symbol(y, Decl(npmlog.js, 9, 12)) ->module : Symbol(module, Decl(npmlog.js, 4, 12)) ->exports : Symbol(module.exports, Decl(npmlog.js, 0, 0)) -->y : Symbol(y, Decl(npmlog.js, 9, 12)) -- --npmlog.y ++>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) + >y : Symbol(y, Decl(npmlog.js, 9, 12)) + + npmlog.y ->npmlog.y : Symbol(y, Decl(npmlog.js, 9, 12)) -->npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) + >npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) ->y : Symbol(y, Decl(npmlog.js, 9, 12)) -- --module.exports.x + + module.exports.x ->module.exports.x : Symbol(x, Decl(npmlog.js, 7, 23)) ->module.exports : Symbol(module.exports, Decl(npmlog.js, 0, 0)) ->module : Symbol(module, Decl(npmlog.js, 4, 12)) ->exports : Symbol(module.exports, Decl(npmlog.js, 0, 0)) ->x : Symbol(x, Decl(npmlog.js, 7, 23)) ++>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.types index 052763ea5d..9c6bdfc605 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.types @@ -2,18 +2,80 @@ === use.js === var npmlog = require('./npmlog') ->npmlog : any ->require('./npmlog') : any +>npmlog : typeof npmlog +>require('./npmlog') : typeof npmlog >require : any >'./npmlog' : "./npmlog" npmlog.x >npmlog.x : any ->npmlog : any +>npmlog : typeof npmlog >x : any npmlog.on >npmlog.on : any ->npmlog : any +>npmlog : typeof npmlog >on : any +=== npmlog.js === +class EE { +>EE : EE + + /** @param {string} s */ + on(s) { } +>on : (s: string) => void +>s : string +} +var npmlog = module.exports = new EE() +>npmlog : EE +>module.exports = new EE() : EE +>module.exports : typeof import("./npmlog") +>module : { "\"npmlog\"": typeof import("./npmlog"); } +>exports : typeof import("./npmlog") +>new EE() : EE +>EE : typeof EE + +npmlog.on('hi') // both references should see EE.on +>npmlog.on('hi') : void +>npmlog.on : (s: string) => void +>npmlog : EE +>on : (s: string) => void +>'hi' : "hi" + +module.exports.on('hi') // here too +>module.exports.on('hi') : any +>module.exports.on : any +>module.exports : typeof import("./npmlog") +>module : { "\"npmlog\"": typeof import("./npmlog"); } +>exports : typeof import("./npmlog") +>on : any +>'hi' : "hi" + +npmlog.x = 1 +>npmlog.x = 1 : 1 +>npmlog.x : any +>npmlog : EE +>x : any +>1 : 1 + +module.exports.y = 2 +>module.exports.y = 2 : 2 +>module.exports.y : 2 +>module.exports : typeof import("./npmlog") +>module : { "\"npmlog\"": typeof import("./npmlog"); } +>exports : typeof import("./npmlog") +>y : 2 +>2 : 2 + +npmlog.y +>npmlog.y : any +>npmlog : EE +>y : any + +module.exports.x +>module.exports.x : any +>module.exports : typeof import("./npmlog") +>module : { "\"npmlog\"": typeof import("./npmlog"); } +>exports : typeof import("./npmlog") +>x : any + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols index b1bfa5de45..6c48dba82f 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols @@ -4,7 +4,20 @@ var mod = require('./mod') >mod : Symbol(mod, Decl(npm.js, 0, 3)) >require : Symbol(require) +>'./mod' : Symbol("mod", Decl(mod.js, 0, 0)) mod() // should be callable from here too >mod : Symbol(mod, Decl(npm.js, 0, 3)) +=== mod.js === +module.exports = function x() { } +>module.exports : Symbol(export=, Decl(mod.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod.js, 0, 0)) +>x : Symbol(x, Decl(mod.js, 0, 16)) + +module.exports() // should be callable +>module.exports : Symbol(export=, Decl(mod.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols.diff index 3ff285b58a..8f69b075c9 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols.diff @@ -1,22 +1,20 @@ --- old.moduleExportAssignment3.symbols +++ new.moduleExportAssignment3.symbols -@@= skipped -3, +3 lines =@@ - var mod = require('./mod') - >mod : Symbol(mod, Decl(npm.js, 0, 3)) - >require : Symbol(require) -->'./mod' : Symbol("mod", Decl(mod.js, 0, 0)) +@@= skipped -10, +10 lines =@@ - mod() // should be callable from here too - >mod : Symbol(mod, Decl(npm.js, 0, 3)) -- --=== mod.js === --module.exports = function x() { } + === mod.js === + module.exports = function x() { } ->module.exports : Symbol(module.exports, Decl(mod.js, 0, 0)) ->module : Symbol(export=, Decl(mod.js, 0, 0)) -->exports : Symbol(export=, Decl(mod.js, 0, 0)) -->x : Symbol(x, Decl(mod.js, 0, 16)) -- --module.exports() // should be callable ++>module.exports : Symbol(export=, Decl(mod.js, 0, 0)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(mod.js, 0, 0)) + >x : Symbol(x, Decl(mod.js, 0, 16)) + + module.exports() // should be callable ->module.exports : Symbol(module.exports, Decl(mod.js, 0, 0)) ->module : Symbol(module, Decl(mod.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod.js, 0, 0)) ++>module.exports : Symbol(export=, Decl(mod.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.types index 1bcd664346..c65733a126 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.types @@ -2,12 +2,27 @@ === npm.js === var mod = require('./mod') ->mod : any ->require('./mod') : any +>mod : () => void +>require('./mod') : () => void >require : any >'./mod' : "./mod" mod() // should be callable from here too ->mod() : any ->mod : any +>mod() : void +>mod : () => void + +=== mod.js === +module.exports = function x() { } +>module.exports = function x() { } : () => void +>module.exports : () => void +>module : { "export=": () => void; } +>exports : () => void +>function x() { } : () => void +>x : () => void + +module.exports() // should be callable +>module.exports() : void +>module.exports : () => void +>module : { "export=": () => void; } +>exports : () => void diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.errors.txt index c04c7d2d59..255fc59d83 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.errors.txt @@ -1,16 +1,31 @@ -test.js(1,27): error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. +moduleExportAliasDuplicateAlias.js(1,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(3,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. +moduleExportAliasDuplicateAlias.js(4,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. +moduleExportAliasDuplicateAlias.js(4,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(5,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. +test.js(2,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. ==== test.js (1 errors) ==== const { apply } = require('./moduleExportAliasDuplicateAlias') - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. apply() + ~~~~~ +!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. -==== moduleExportAliasDuplicateAlias.js (0 errors) ==== +==== moduleExportAliasDuplicateAlias.js (5 errors) ==== exports.apply = undefined; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. function a() { } exports.apply() + ~~~~~~~~~~~~~ +!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. exports.apply = a; + ~~~~~~~~~~~~~ +!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. + ~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. exports.apply() + ~~~~~~~~~~~~~ +!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols index 437998041f..330ee93fa9 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols @@ -4,7 +4,34 @@ const { apply } = require('./moduleExportAliasDuplicateAlias') >apply : Symbol(apply, Decl(test.js, 0, 7)) >require : Symbol(require) +>'./moduleExportAliasDuplicateAlias' : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) apply() >apply : Symbol(apply, Decl(test.js, 0, 7)) +=== moduleExportAliasDuplicateAlias.js === +exports.apply = undefined; +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) +>undefined : Symbol(undefined) + +function a() { } +>a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 26)) + +exports.apply() +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) + +exports.apply = a; +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) +>a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 26)) + +exports.apply() +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols.diff index 2c13010298..dbca3c343a 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols.diff @@ -1,36 +1,19 @@ --- old.moduleExportDuplicateAlias.symbols +++ new.moduleExportDuplicateAlias.symbols -@@= skipped -3, +3 lines =@@ - const { apply } = require('./moduleExportAliasDuplicateAlias') - >apply : Symbol(apply, Decl(test.js, 0, 7)) - >require : Symbol(require) -->'./moduleExportAliasDuplicateAlias' : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) - - apply() - >apply : Symbol(apply, Decl(test.js, 0, 7)) -- --=== moduleExportAliasDuplicateAlias.js === --exports.apply = undefined; -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) +@@= skipped -11, +11 lines =@@ + === moduleExportAliasDuplicateAlias.js === + exports.apply = undefined; + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) ->exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) -->undefined : Symbol(undefined) -- --function a() { } -->a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 26)) -- --exports.apply() -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) -->exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) -- --exports.apply = a; -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) + >undefined : Symbol(undefined) + +@@= skipped -14, +14 lines =@@ + + exports.apply = a; + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) ->exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) -->a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 26)) -- --exports.apply() -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) -->exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) + >a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 26)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.types b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.types index 0f5bbd9ace..ea268466c5 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.types @@ -2,12 +2,42 @@ === test.js === const { apply } = require('./moduleExportAliasDuplicateAlias') ->apply : any ->require('./moduleExportAliasDuplicateAlias') : any +>apply : undefined +>require('./moduleExportAliasDuplicateAlias') : typeof import("./moduleExportAliasDuplicateAlias") >require : any >'./moduleExportAliasDuplicateAlias' : "./moduleExportAliasDuplicateAlias" apply() >apply() : any ->apply : any +>apply : undefined + +=== moduleExportAliasDuplicateAlias.js === +exports.apply = undefined; +>exports.apply = undefined : undefined +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>undefined : undefined + +function a() { } +>a : () => void + +exports.apply() +>exports.apply() : any +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined + +exports.apply = a; +>exports.apply = a : () => void +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>a : () => void + +exports.apply() +>exports.apply() : any +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.errors.txt index e5f740a3c9..f9fd9f7140 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.errors.txt @@ -1,16 +1,34 @@ -test.js(1,27): error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. +moduleExportAliasDuplicateAlias.js(1,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(3,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. +moduleExportAliasDuplicateAlias.js(3,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(4,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. +moduleExportAliasDuplicateAlias.js(4,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(5,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. +test.js(2,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. ==== test.js (1 errors) ==== const { apply } = require('./moduleExportAliasDuplicateAlias') - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. apply() + ~~~~~ +!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. -==== moduleExportAliasDuplicateAlias.js (0 errors) ==== +==== moduleExportAliasDuplicateAlias.js (6 errors) ==== module.exports.apply = undefined; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. function a() { } module.exports.apply = a; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. module.exports.apply = a; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. module.exports.apply() + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols index 1e416b02d9..6441cf72c8 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols @@ -4,7 +4,43 @@ const { apply } = require('./moduleExportAliasDuplicateAlias') >apply : Symbol(apply, Decl(test.js, 0, 7)) >require : Symbol(require) +>'./moduleExportAliasDuplicateAlias' : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) apply() >apply : Symbol(apply, Decl(test.js, 0, 7)) +=== moduleExportAliasDuplicateAlias.js === +module.exports.apply = undefined; +>module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +>undefined : Symbol(undefined) + +function a() { } +>a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) + +module.exports.apply = a; +>module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +>a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) + +module.exports.apply = a; +>module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +>a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) + +module.exports.apply() +>module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols.diff index a779841c00..265c5d3763 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols.diff @@ -1,45 +1,48 @@ --- old.moduleExportDuplicateAlias2.symbols +++ new.moduleExportDuplicateAlias2.symbols -@@= skipped -3, +3 lines =@@ - const { apply } = require('./moduleExportAliasDuplicateAlias') - >apply : Symbol(apply, Decl(test.js, 0, 7)) - >require : Symbol(require) -->'./moduleExportAliasDuplicateAlias' : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) - - apply() - >apply : Symbol(apply, Decl(test.js, 0, 7)) -- --=== moduleExportAliasDuplicateAlias.js === --module.exports.apply = undefined; -->module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +@@= skipped -11, +11 lines =@@ + === moduleExportAliasDuplicateAlias.js === + module.exports.apply = undefined; + >module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ->module.exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ->module : Symbol(module, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ->exports : Symbol(module.exports, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) -->undefined : Symbol(undefined) -- --function a() { } -->a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) -- --module.exports.apply = a; -->module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ++>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) + >undefined : Symbol(undefined) + +@@= skipped -11, +11 lines =@@ + + module.exports.apply = a; + >module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ->module.exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ->module : Symbol(module, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ->exports : Symbol(module.exports, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) -->a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) -- --module.exports.apply = a; -->module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ++>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) + >a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) + + module.exports.apply = a; + >module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ->module.exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ->module : Symbol(module, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ->exports : Symbol(module.exports, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) -->a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) -- --module.exports.apply() -->module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ++>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) + >a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) + + module.exports.apply() + >module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ->module.exports : Symbol(module.exports, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ->module : Symbol(module, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ->exports : Symbol(module.exports, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ++>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.types b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.types index 5c02030b04..ff8d430fea 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.types @@ -2,12 +2,51 @@ === test.js === const { apply } = require('./moduleExportAliasDuplicateAlias') ->apply : any ->require('./moduleExportAliasDuplicateAlias') : any +>apply : undefined +>require('./moduleExportAliasDuplicateAlias') : typeof import("./moduleExportAliasDuplicateAlias") >require : any >'./moduleExportAliasDuplicateAlias' : "./moduleExportAliasDuplicateAlias" apply() >apply() : any ->apply : any +>apply : undefined + +=== moduleExportAliasDuplicateAlias.js === +module.exports.apply = undefined; +>module.exports.apply = undefined : undefined +>module.exports.apply : undefined +>module.exports : typeof import("./moduleExportAliasDuplicateAlias") +>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>undefined : undefined + +function a() { } +>a : () => void + +module.exports.apply = a; +>module.exports.apply = a : () => void +>module.exports.apply : undefined +>module.exports : typeof import("./moduleExportAliasDuplicateAlias") +>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>a : () => void + +module.exports.apply = a; +>module.exports.apply = a : () => void +>module.exports.apply : undefined +>module.exports : typeof import("./moduleExportAliasDuplicateAlias") +>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>a : () => void + +module.exports.apply() +>module.exports.apply() : any +>module.exports.apply : undefined +>module.exports : typeof import("./moduleExportAliasDuplicateAlias") +>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.errors.txt index d50d647cff..f6d8b7f341 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.errors.txt @@ -1,19 +1,49 @@ -test.js(1,27): error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. +moduleExportAliasDuplicateAlias.js(1,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(2,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(4,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. +moduleExportAliasDuplicateAlias.js(4,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(5,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. +moduleExportAliasDuplicateAlias.js(6,1): error TS2322: Type '"ok"' is not assignable to type 'undefined'. +moduleExportAliasDuplicateAlias.js(6,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(7,10): error TS18048: 'exports.apply' is possibly 'undefined'. +moduleExportAliasDuplicateAlias.js(8,1): error TS2322: Type '1' is not assignable to type 'undefined'. +moduleExportAliasDuplicateAlias.js(8,1): error TS2323: Cannot redeclare exported variable 'apply'. +test.js(2,16): error TS18048: 'apply' is possibly 'undefined'. ==== test.js (1 errors) ==== const { apply } = require('./moduleExportAliasDuplicateAlias') - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. const result = apply.toFixed() + ~~~~~ +!!! error TS18048: 'apply' is possibly 'undefined'. -==== moduleExportAliasDuplicateAlias.js (0 errors) ==== +==== moduleExportAliasDuplicateAlias.js (10 errors) ==== exports.apply = undefined; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. exports.apply = undefined; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. function a() { } exports.apply = a; + ~~~~~~~~~~~~~ +!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. + ~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. exports.apply() + ~~~~~~~~~~~~~ +!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. exports.apply = 'ok' + ~~~~~~~~~~~~~ +!!! error TS2322: Type '"ok"' is not assignable to type 'undefined'. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. var OK = exports.apply.toUpperCase() + ~~~~~~~~~~~~~ +!!! error TS18048: 'exports.apply' is possibly 'undefined'. exports.apply = 1 + ~~~~~~~~~~~~~ +!!! error TS2322: Type '1' is not assignable to type 'undefined'. + ~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols index f56e947274..8fb360fee5 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols @@ -4,8 +4,52 @@ const { apply } = require('./moduleExportAliasDuplicateAlias') >apply : Symbol(apply, Decl(test.js, 0, 7)) >require : Symbol(require) +>'./moduleExportAliasDuplicateAlias' : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) const result = apply.toFixed() >result : Symbol(result, Decl(test.js, 1, 5)) >apply : Symbol(apply, Decl(test.js, 0, 7)) +=== moduleExportAliasDuplicateAlias.js === +exports.apply = undefined; +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>undefined : Symbol(undefined) + +exports.apply = undefined; +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>undefined : Symbol(undefined) + +function a() { } +>a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 1, 26)) + +exports.apply = a; +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 1, 26)) + +exports.apply() +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + +exports.apply = 'ok' +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + +var OK = exports.apply.toUpperCase() +>OK : Symbol(OK, Decl(moduleExportAliasDuplicateAlias.js, 6, 3)) +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + +exports.apply = 1 +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols.diff index 627e9464a1..5e155e298c 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols.diff @@ -1,58 +1,55 @@ --- old.moduleExportDuplicateAlias3.symbols +++ new.moduleExportDuplicateAlias3.symbols -@@= skipped -3, +3 lines =@@ - const { apply } = require('./moduleExportAliasDuplicateAlias') - >apply : Symbol(apply, Decl(test.js, 0, 7)) - >require : Symbol(require) -->'./moduleExportAliasDuplicateAlias' : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +@@= skipped -7, +7 lines =@@ const result = apply.toFixed() >result : Symbol(result, Decl(test.js, 1, 5)) ->apply.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) >apply : Symbol(apply, Decl(test.js, 0, 7)) ->toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) -- --=== moduleExportAliasDuplicateAlias.js === --exports.apply = undefined; -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + + === moduleExportAliasDuplicateAlias.js === + exports.apply = undefined; + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ->exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->undefined : Symbol(undefined) -- --exports.apply = undefined; -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + >undefined : Symbol(undefined) + + exports.apply = undefined; + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ->exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->undefined : Symbol(undefined) -- --function a() { } -->a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 1, 26)) -- --exports.apply = a; -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + >undefined : Symbol(undefined) + +@@= skipped -22, +20 lines =@@ + + exports.apply = a; + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ->exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 1, 26)) -- --exports.apply() -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -- --exports.apply = 'ok' -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + >a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 1, 26)) + +@@= skipped -11, +11 lines =@@ + + exports.apply = 'ok' + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ->exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -- --var OK = exports.apply.toUpperCase() -->OK : Symbol(OK, Decl(moduleExportAliasDuplicateAlias.js, 6, 3)) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + + var OK = exports.apply.toUpperCase() + >OK : Symbol(OK, Decl(moduleExportAliasDuplicateAlias.js, 6, 3)) ->exports.apply.toUpperCase : Symbol(String.toUpperCase, Decl(lib.es5.d.ts, --, --)) -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + >exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ->toUpperCase : Symbol(String.toUpperCase, Decl(lib.es5.d.ts, --, --)) -- --exports.apply = 1 -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + + exports.apply = 1 + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ->exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.types b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.types index b85f61eb37..614318ae51 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.types @@ -2,8 +2,8 @@ === test.js === const { apply } = require('./moduleExportAliasDuplicateAlias') ->apply : any ->require('./moduleExportAliasDuplicateAlias') : any +>apply : undefined +>require('./moduleExportAliasDuplicateAlias') : typeof import("./moduleExportAliasDuplicateAlias") >require : any >'./moduleExportAliasDuplicateAlias' : "./moduleExportAliasDuplicateAlias" @@ -11,6 +11,60 @@ const result = apply.toFixed() >result : any >apply.toFixed() : any >apply.toFixed : any ->apply : any +>apply : undefined >toFixed : any +=== moduleExportAliasDuplicateAlias.js === +exports.apply = undefined; +>exports.apply = undefined : undefined +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>undefined : undefined + +exports.apply = undefined; +>exports.apply = undefined : undefined +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>undefined : undefined + +function a() { } +>a : () => void + +exports.apply = a; +>exports.apply = a : () => void +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>a : () => void + +exports.apply() +>exports.apply() : any +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined + +exports.apply = 'ok' +>exports.apply = 'ok' : "ok" +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>'ok' : "ok" + +var OK = exports.apply.toUpperCase() +>OK : any +>exports.apply.toUpperCase() : any +>exports.apply.toUpperCase : any +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>toUpperCase : any + +exports.apply = 1 +>exports.apply = 1 : 1 +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>1 : 1 + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.errors.txt new file mode 100644 index 0000000000..c062fa89da --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.errors.txt @@ -0,0 +1,26 @@ +a.js(4,6): error TS2339: Property 'f' does not exist on type '() => void'. +mod1.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +mod1.js(4,16): error TS2339: Property 'f' does not exist on type '() => void'. + + +==== a.js (1 errors) ==== + /// + var mod1 = require('./mod1') + mod1() + mod1.f() // error, not enough arguments + ~ +!!! error TS2339: Property 'f' does not exist on type '() => void'. + +==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; + declare function require(name: string): any; +==== mod1.js (2 errors) ==== + /// + module.exports = function () { } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + /** @param {number} a */ + module.exports.f = function (a) { } + ~ +!!! error TS2339: Property 'f' does not exist on type '() => void'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols index e4165dbfd3..72949ef09f 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols @@ -5,6 +5,7 @@ var mod1 = require('./mod1') >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) >require : Symbol(require, Decl(requires.d.ts, 0, 37)) +>'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1() >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) @@ -21,3 +22,17 @@ declare function require(name: string): any; >require : Symbol(require, Decl(requires.d.ts, 0, 37)) >name : Symbol(name, Decl(requires.d.ts, 1, 25)) +=== mod1.js === +/// +module.exports = function () { } +>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 0, 0)) + +/** @param {number} a */ +module.exports.f = function (a) { } +>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>a : Symbol(a, Decl(mod1.js, 3, 29)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff index 162efce033..1f47a437b4 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff @@ -1,12 +1,6 @@ --- old.moduleExportWithExportPropertyAssignment.symbols +++ new.moduleExportWithExportPropertyAssignment.symbols -@@= skipped -4, +4 lines =@@ - var mod1 = require('./mod1') - >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) -->'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) - - mod1() +@@= skipped -10, +10 lines =@@ >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) mod1.f() // error, not enough arguments @@ -16,23 +10,24 @@ === requires.d.ts === declare var module: { exports: any }; -@@= skipped -18, +15 lines =@@ - declare function require(name: string): any; - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) - >name : Symbol(name, Decl(requires.d.ts, 1, 25)) -- --=== mod1.js === --/// --module.exports = function () { } +@@= skipped -16, +14 lines =@@ + === mod1.js === + /// + module.exports = function () { } ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 0, 0)) -->exports : Symbol(export=, Decl(mod1.js, 0, 0)) -- --/** @param {number} a */ --module.exports.f = function (a) { } ++>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(mod1.js, 0, 0)) + + /** @param {number} a */ + module.exports.f = function (a) { } ->module.exports.f : Symbol(f, Decl(mod1.js, 1, 32)) ->module.exports : Symbol(f, Decl(mod1.js, 1, 32)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->f : Symbol(f, Decl(mod1.js, 1, 32)) -->a : Symbol(a, Decl(mod1.js, 3, 29)) ++>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod1.js, 0, 0)) + >a : Symbol(a, Decl(mod1.js, 3, 29)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types index 7b6a08b939..ee42485873 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types @@ -3,19 +3,19 @@ === a.js === /// var mod1 = require('./mod1') ->mod1 : any ->require('./mod1') : any +>mod1 : () => void +>require('./mod1') : () => void >require : (name: string) => any >'./mod1' : "./mod1" mod1() ->mod1() : any ->mod1 : any +>mod1() : void +>mod1 : () => void mod1.f() // error, not enough arguments >mod1.f() : any >mod1.f : any ->mod1 : any +>mod1 : () => void >f : any === requires.d.ts === @@ -27,3 +27,23 @@ declare function require(name: string): any; >require : (name: string) => any >name : string +=== mod1.js === +/// +module.exports = function () { } +>module.exports = function () { } : () => void +>module.exports : () => void +>module : { "export=": () => void; } +>exports : () => void +>function () { } : () => void + +/** @param {number} a */ +module.exports.f = function (a) { } +>module.exports.f = function (a) { } : (a: any) => void +>module.exports.f : any +>module.exports : () => void +>module : { "export=": () => void; } +>exports : () => void +>f : any +>function (a) { } : (a: any) => void +>a : any + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.errors.txt new file mode 100644 index 0000000000..7d5e2c2c91 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.errors.txt @@ -0,0 +1,25 @@ +a.js(4,6): error TS2339: Property 'f' does not exist on type '1'. +mod1.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +mod1.js(3,16): error TS2339: Property 'f' does not exist on type '1'. + + +==== a.js (1 errors) ==== + /// + var mod1 = require('./mod1') + mod1.toFixed(12) + mod1.f() // error, 'f' is not a property on 'number' + ~ +!!! error TS2339: Property 'f' does not exist on type '1'. + +==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; + declare function require(name: string): any; +==== mod1.js (2 errors) ==== + /// + module.exports = 1 + ~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.f = function () { } + ~ +!!! error TS2339: Property 'f' does not exist on type '1'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols index ba7038b6c4..ab4d96a505 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols @@ -5,9 +5,12 @@ var mod1 = require('./mod1') >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) >require : Symbol(require, Decl(requires.d.ts, 0, 37)) +>'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.toFixed(12) +>mod1.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.f() // error, 'f' is not a property on 'number' >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) @@ -21,3 +24,15 @@ declare function require(name: string): any; >require : Symbol(require, Decl(requires.d.ts, 0, 37)) >name : Symbol(name, Decl(requires.d.ts, 1, 25)) +=== mod1.js === +/// +module.exports = 1 +>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 0, 0)) + +module.exports.f = function () { } +>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff index 97f96d0b7f..3f7dac72aa 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff @@ -1,32 +1,32 @@ --- old.moduleExportWithExportPropertyAssignment2.symbols +++ new.moduleExportWithExportPropertyAssignment2.symbols -@@= skipped -4, +4 lines =@@ - var mod1 = require('./mod1') - >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) -->'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) +@@= skipped -7, +7 lines =@@ + >'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.toFixed(12) ->mod1.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) ++>mod1.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.f() // error, 'f' is not a property on 'number' >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) -@@= skipped -18, +15 lines =@@ - declare function require(name: string): any; - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) - >name : Symbol(name, Decl(requires.d.ts, 1, 25)) -- --=== mod1.js === --/// --module.exports = 1 +@@= skipped -19, +19 lines =@@ + === mod1.js === + /// + module.exports = 1 ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 0, 0)) -->exports : Symbol(export=, Decl(mod1.js, 0, 0)) -- --module.exports.f = function () { } ++>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(mod1.js, 0, 0)) + + module.exports.f = function () { } ->module.exports : Symbol(f, Decl(mod1.js, 1, 18)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->f : Symbol(f, Decl(mod1.js, 1, 18)) ++>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod1.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types index 9ad71ecd6b..8c1b21c209 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types @@ -3,22 +3,22 @@ === a.js === /// var mod1 = require('./mod1') ->mod1 : any ->require('./mod1') : any +>mod1 : 1 +>require('./mod1') : 1 >require : (name: string) => any >'./mod1' : "./mod1" mod1.toFixed(12) ->mod1.toFixed(12) : any ->mod1.toFixed : any ->mod1 : any ->toFixed : any +>mod1.toFixed(12) : string +>mod1.toFixed : (fractionDigits?: number) => string +>mod1 : 1 +>toFixed : (fractionDigits?: number) => string >12 : 12 mod1.f() // error, 'f' is not a property on 'number' >mod1.f() : any >mod1.f : any ->mod1 : any +>mod1 : 1 >f : any === requires.d.ts === @@ -30,3 +30,21 @@ declare function require(name: string): any; >require : (name: string) => any >name : string +=== mod1.js === +/// +module.exports = 1 +>module.exports = 1 : 1 +>module.exports : 1 +>module : { "export=": 1; } +>exports : 1 +>1 : 1 + +module.exports.f = function () { } +>module.exports.f = function () { } : () => void +>module.exports.f : any +>module.exports : 1 +>module : { "export=": 1; } +>exports : 1 +>f : any +>function () { } : () => void + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.errors.txt new file mode 100644 index 0000000000..0048e20c35 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.errors.txt @@ -0,0 +1,43 @@ +a.js(6,6): error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. +mod1.js(2,1): error TS2322: Type 'string' is not assignable to type 'number'. +mod1.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +mod1.js(8,1): error TS2322: Type 'string' is not assignable to type 'number'. +mod1.js(9,16): error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. + + +==== a.js (1 errors) ==== + /// + var mod1 = require('./mod1') + mod1.justExport.toFixed() + mod1.bothBefore.toFixed() // error, 'toFixed' not on 'string | number' + mod1.bothAfter.toFixed() // error, 'toFixed' not on 'string | number' + mod1.justProperty.length + ~~~~~~~~~~~~ +!!! error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. + +==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; + declare function require(name: string): any; +==== mod1.js (4 errors) ==== + /// + module.exports.bothBefore = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + module.exports = { + ~~~~~~~~~~~~~~~~~~ + justExport: 1, + ~~~~~~~~~~~~~~~~~~ + bothBefore: 2, + ~~~~~~~~~~~~~~~~~~ + bothAfter: 3, + ~~~~~~~~~~~~~~~~~ + } + ~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.bothAfter = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + module.exports.justProperty = 'string' + ~~~~~~~~~~~~ +!!! error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols index 3ec55b9f3d..98651fb010 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols @@ -5,15 +5,28 @@ var mod1 = require('./mod1') >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) >require : Symbol(require, Decl(requires.d.ts, 0, 37)) +>'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.justExport.toFixed() +>mod1.justExport.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>mod1.justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) +>justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothBefore.toFixed() // error, 'toFixed' not on 'string | number' +>mod1.bothBefore.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothAfter.toFixed() // error, 'toFixed' not on 'string | number' +>mod1.bothAfter.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.justProperty.length >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) @@ -27,3 +40,38 @@ declare function require(name: string): any; >require : Symbol(require, Decl(requires.d.ts, 0, 37)) >name : Symbol(name, Decl(requires.d.ts, 1, 25)) +=== mod1.js === +/// +module.exports.bothBefore = 'string' +>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) +>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) + +module.exports = { +>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 1, 36)) + + justExport: 1, +>justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) + + bothBefore: 2, +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) + + bothAfter: 3, +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) +} +module.exports.bothAfter = 'string' +>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) +>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) + +module.exports.justProperty = 'string' +>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 1, 36)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff index df2b309725..197654e3e3 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff @@ -1,27 +1,34 @@ --- old.moduleExportWithExportPropertyAssignment3.symbols +++ new.moduleExportWithExportPropertyAssignment3.symbols -@@= skipped -4, +4 lines =@@ - var mod1 = require('./mod1') - >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) -->'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) +@@= skipped -7, +7 lines =@@ + >'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.justExport.toFixed() ->mod1.justExport.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) -->mod1.justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) ++>mod1.justExport.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) + >mod1.justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) -->justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) + >justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) ->toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothBefore.toFixed() // error, 'toFixed' not on 'string | number' ->mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18), Decl(mod1.js, 0, 0)) ++>mod1.bothBefore.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ++>mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18), Decl(mod1.js, 0, 0)) ++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothAfter.toFixed() // error, 'toFixed' not on 'string | number' ->mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18), Decl(mod1.js, 6, 1)) ++>mod1.bothAfter.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ++>mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18), Decl(mod1.js, 6, 1)) ++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.justProperty.length ->mod1.justProperty.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) @@ -32,44 +39,50 @@ === requires.d.ts === declare var module: { exports: any }; -@@= skipped -34, +21 lines =@@ - declare function require(name: string): any; - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) - >name : Symbol(name, Decl(requires.d.ts, 1, 25)) -- --=== mod1.js === --/// --module.exports.bothBefore = 'string' +@@= skipped -35, +35 lines =@@ + === mod1.js === + /// + module.exports.bothBefore = 'string' ->module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18), Decl(mod1.js, 0, 0)) ->module.exports : Symbol(bothBefore, Decl(mod1.js, 0, 0)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) -- --module.exports = { ++>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) ++>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod1.js, 1, 36)) ++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) + + module.exports = { ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 1, 36)) -->exports : Symbol(export=, Decl(mod1.js, 1, 36)) -- -- justExport: 1, -->justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) -- -- bothBefore: 2, -->bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) -- -- bothAfter: 3, -->bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) --} --module.exports.bothAfter = 'string' ++>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(mod1.js, 1, 36)) + + justExport: 1, +@@= skipped -21, +21 lines =@@ + >bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) + } + module.exports.bothAfter = 'string' ->module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18), Decl(mod1.js, 6, 1)) ->module.exports : Symbol(bothAfter, Decl(mod1.js, 6, 1)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 6, 1)) -- --module.exports.justProperty = 'string' ++>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) ++>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod1.js, 1, 36)) ++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) + + module.exports.justProperty = 'string' ->module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35)) ->module.exports : Symbol(justProperty, Decl(mod1.js, 7, 35)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35)) ++>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod1.js, 1, 36)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types index 0e664abaaa..f3b476d806 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types @@ -3,39 +3,39 @@ === a.js === /// var mod1 = require('./mod1') ->mod1 : any ->require('./mod1') : any +>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } +>require('./mod1') : { justExport: number; bothBefore: number; bothAfter: number; } >require : (name: string) => any >'./mod1' : "./mod1" mod1.justExport.toFixed() ->mod1.justExport.toFixed() : any ->mod1.justExport.toFixed : any ->mod1.justExport : any ->mod1 : any ->justExport : any ->toFixed : any +>mod1.justExport.toFixed() : string +>mod1.justExport.toFixed : (fractionDigits?: number) => string +>mod1.justExport : number +>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } +>justExport : number +>toFixed : (fractionDigits?: number) => string mod1.bothBefore.toFixed() // error, 'toFixed' not on 'string | number' ->mod1.bothBefore.toFixed() : any ->mod1.bothBefore.toFixed : any ->mod1.bothBefore : any ->mod1 : any ->bothBefore : any ->toFixed : any +>mod1.bothBefore.toFixed() : string +>mod1.bothBefore.toFixed : (fractionDigits?: number) => string +>mod1.bothBefore : number +>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } +>bothBefore : number +>toFixed : (fractionDigits?: number) => string mod1.bothAfter.toFixed() // error, 'toFixed' not on 'string | number' ->mod1.bothAfter.toFixed() : any ->mod1.bothAfter.toFixed : any ->mod1.bothAfter : any ->mod1 : any ->bothAfter : any ->toFixed : any +>mod1.bothAfter.toFixed() : string +>mod1.bothAfter.toFixed : (fractionDigits?: number) => string +>mod1.bothAfter : number +>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } +>bothAfter : number +>toFixed : (fractionDigits?: number) => string mod1.justProperty.length >mod1.justProperty.length : any >mod1.justProperty : any ->mod1 : any +>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } >justProperty : any >length : any @@ -48,3 +48,51 @@ declare function require(name: string): any; >require : (name: string) => any >name : string +=== mod1.js === +/// +module.exports.bothBefore = 'string' +>module.exports.bothBefore = 'string' : "string" +>module.exports.bothBefore : number +>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } +>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { justExport: number; bothBefore: number; bothAfter: number; } +>bothBefore : number +>'string' : "string" + +module.exports = { +>module.exports = { justExport: 1, bothBefore: 2, bothAfter: 3,} : { justExport: number; bothBefore: number; bothAfter: number; } +>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } +>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { justExport: number; bothBefore: number; bothAfter: number; } +>{ justExport: 1, bothBefore: 2, bothAfter: 3,} : { justExport: number; bothBefore: number; bothAfter: number; } + + justExport: 1, +>justExport : number +>1 : 1 + + bothBefore: 2, +>bothBefore : number +>2 : 2 + + bothAfter: 3, +>bothAfter : number +>3 : 3 +} +module.exports.bothAfter = 'string' +>module.exports.bothAfter = 'string' : "string" +>module.exports.bothAfter : number +>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } +>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { justExport: number; bothBefore: number; bothAfter: number; } +>bothAfter : number +>'string' : "string" + +module.exports.justProperty = 'string' +>module.exports.justProperty = 'string' : "string" +>module.exports.justProperty : any +>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } +>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { justExport: number; bothBefore: number; bothAfter: number; } +>justProperty : any +>'string' : "string" + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt new file mode 100644 index 0000000000..040e68925d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt @@ -0,0 +1,41 @@ +a.js(6,6): error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. +mod1.js(2,1): error TS2322: Type 'string' is not assignable to type 'number'. +mod1.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +mod1.js(10,1): error TS2322: Type 'string' is not assignable to type 'number'. +mod1.js(11,16): error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. + + +==== a.js (1 errors) ==== + /// + var mod1 = require('./mod1') + mod1.justExport.toFixed() + mod1.bothBefore.toFixed() // error + mod1.bothAfter.toFixed() + mod1.justProperty.length + ~~~~~~~~~~~~ +!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. + +==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; + declare function require(name: string): any; +==== mod1.js (4 errors) ==== + /// + module.exports.bothBefore = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + A.justExport = 4 + A.bothBefore = 2 + A.bothAfter = 3 + module.exports = A + ~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + function A() { + this.p = 1 + } + module.exports.bothAfter = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + module.exports.justProperty = 'string' + ~~~~~~~~~~~~ +!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols index 0c8025b781..b236c055da 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols @@ -5,15 +5,28 @@ var mod1 = require('./mod1') >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) >require : Symbol(require, Decl(requires.d.ts, 0, 37)) +>'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.justExport.toFixed() +>mod1.justExport.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>mod1.justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) +>justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothBefore.toFixed() // error +>mod1.bothBefore.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothAfter.toFixed() +>mod1.bothAfter.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.justProperty.length >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) @@ -27,3 +40,50 @@ declare function require(name: string): any; >require : Symbol(require, Decl(requires.d.ts, 0, 37)) >name : Symbol(name, Decl(requires.d.ts, 1, 25)) +=== mod1.js === +/// +module.exports.bothBefore = 'string' +>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) +>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module : Symbol(module.exports) +>exports : Symbol(A, Decl(mod1.js, 5, 18)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) + +A.justExport = 4 +>A.justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) +>A : Symbol(A, Decl(mod1.js, 5, 18)) +>justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) + +A.bothBefore = 2 +>A.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) +>A : Symbol(A, Decl(mod1.js, 5, 18)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) + +A.bothAfter = 3 +>A.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) +>A : Symbol(A, Decl(mod1.js, 5, 18)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) + +module.exports = A +>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module : Symbol(module.exports) +>exports : Symbol(A, Decl(mod1.js, 5, 18)) +>A : Symbol(A, Decl(mod1.js, 5, 18)) + +function A() { +>A : Symbol(A, Decl(mod1.js, 5, 18)) + + this.p = 1 +} +module.exports.bothAfter = 'string' +>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) +>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module : Symbol(module.exports) +>exports : Symbol(A, Decl(mod1.js, 5, 18)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) + +module.exports.justProperty = 'string' +>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module : Symbol(module.exports) +>exports : Symbol(A, Decl(mod1.js, 5, 18)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff index 6fd4e98816..1c0d1c740e 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff @@ -1,27 +1,36 @@ --- old.moduleExportWithExportPropertyAssignment4.symbols +++ new.moduleExportWithExportPropertyAssignment4.symbols -@@= skipped -4, +4 lines =@@ - var mod1 = require('./mod1') - >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) -->'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) +@@= skipped -7, +7 lines =@@ + >'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.justExport.toFixed() ->mod1.justExport.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) ->mod1.justExport : Symbol(mod1.justExport, Decl(mod1.js, 1, 36)) ++>mod1.justExport.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ++>mod1.justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->justExport : Symbol(mod1.justExport, Decl(mod1.js, 1, 36)) ->toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) ++>justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothBefore.toFixed() // error ->mod1.bothBefore : Symbol(mod1.bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) ++>mod1.bothBefore.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ++>mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothBefore : Symbol(mod1.bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) ++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothAfter.toFixed() ->mod1.bothAfter : Symbol(mod1.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) ++>mod1.bothAfter.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ++>mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothAfter : Symbol(mod1.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) ++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.justProperty.length ->mod1.justProperty.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) @@ -32,59 +41,82 @@ === requires.d.ts === declare var module: { exports: any }; -@@= skipped -34, +21 lines =@@ - declare function require(name: string): any; - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) - >name : Symbol(name, Decl(requires.d.ts, 1, 25)) -- --=== mod1.js === --/// --module.exports.bothBefore = 'string' +@@= skipped -35, +35 lines =@@ + === mod1.js === + /// + module.exports.bothBefore = 'string' ->module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) ->module.exports : Symbol(bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) -- --A.justExport = 4 ++>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) ++>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>module : Symbol(module.exports) ++>exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) + + A.justExport = 4 ->A.justExport : Symbol(A.justExport, Decl(mod1.js, 1, 36)) ->A : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16)) ->justExport : Symbol(A.justExport, Decl(mod1.js, 1, 36)) -- --A.bothBefore = 2 ++>A.justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) ++>A : Symbol(A, Decl(mod1.js, 5, 18)) ++>justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) + + A.bothBefore = 2 ->A.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) ->A : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) -- --A.bothAfter = 3 ++>A.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) ++>A : Symbol(A, Decl(mod1.js, 5, 18)) ++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) + + A.bothAfter = 3 ->A.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) ->A : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) -- --module.exports = A ++>A.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) ++>A : Symbol(A, Decl(mod1.js, 5, 18)) ++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) + + module.exports = A ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 4, 15)) ->exports : Symbol(export=, Decl(mod1.js, 4, 15)) ->A : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16)) -- --function A() { ++>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>module : Symbol(module.exports) ++>exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>A : Symbol(A, Decl(mod1.js, 5, 18)) + + function A() { ->A : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16)) -- -- this.p = 1 ++>A : Symbol(A, Decl(mod1.js, 5, 18)) + + this.p = 1 ->this.p : Symbol(A.p, Decl(mod1.js, 6, 14)) ->this : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16)) ->p : Symbol(A.p, Decl(mod1.js, 6, 14)) --} --module.exports.bothAfter = 'string' + } + module.exports.bothAfter = 'string' ->module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) ->module.exports : Symbol(bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) -- --module.exports.justProperty = 'string' ++>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) ++>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>module : Symbol(module.exports) ++>exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) + + module.exports.justProperty = 'string' ->module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) ->module.exports : Symbol(justProperty, Decl(mod1.js, 9, 35)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) ++>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>module : Symbol(module.exports) ++>exports : Symbol(A, Decl(mod1.js, 5, 18)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types index 7dc08c6e6c..48e342babc 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types @@ -3,39 +3,39 @@ === a.js === /// var mod1 = require('./mod1') ->mod1 : any ->require('./mod1') : any +>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>require('./mod1') : { (): void; justExport: number; bothBefore: number; bothAfter: number; } >require : (name: string) => any >'./mod1' : "./mod1" mod1.justExport.toFixed() ->mod1.justExport.toFixed() : any ->mod1.justExport.toFixed : any ->mod1.justExport : any ->mod1 : any ->justExport : any ->toFixed : any +>mod1.justExport.toFixed() : string +>mod1.justExport.toFixed : (fractionDigits?: number) => string +>mod1.justExport : number +>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>justExport : number +>toFixed : (fractionDigits?: number) => string mod1.bothBefore.toFixed() // error ->mod1.bothBefore.toFixed() : any ->mod1.bothBefore.toFixed : any ->mod1.bothBefore : any ->mod1 : any ->bothBefore : any ->toFixed : any +>mod1.bothBefore.toFixed() : string +>mod1.bothBefore.toFixed : (fractionDigits?: number) => string +>mod1.bothBefore : number +>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothBefore : number +>toFixed : (fractionDigits?: number) => string mod1.bothAfter.toFixed() ->mod1.bothAfter.toFixed() : any ->mod1.bothAfter.toFixed : any ->mod1.bothAfter : any ->mod1 : any ->bothAfter : any ->toFixed : any +>mod1.bothAfter.toFixed() : string +>mod1.bothAfter.toFixed : (fractionDigits?: number) => string +>mod1.bothAfter : number +>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothAfter : number +>toFixed : (fractionDigits?: number) => string mod1.justProperty.length >mod1.justProperty.length : any >mod1.justProperty : any ->mod1 : any +>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } >justProperty : any >length : any @@ -48,3 +48,70 @@ declare function require(name: string): any; >require : (name: string) => any >name : string +=== mod1.js === +/// +module.exports.bothBefore = 'string' +>module.exports.bothBefore = 'string' : "string" +>module.exports.bothBefore : number +>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothBefore : number +>'string' : "string" + +A.justExport = 4 +>A.justExport = 4 : 4 +>A.justExport : number +>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>justExport : number +>4 : 4 + +A.bothBefore = 2 +>A.bothBefore = 2 : 2 +>A.bothBefore : number +>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothBefore : number +>2 : 2 + +A.bothAfter = 3 +>A.bothAfter = 3 : 3 +>A.bothAfter : number +>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothAfter : number +>3 : 3 + +module.exports = A +>module.exports = A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } + +function A() { +>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } + + this.p = 1 +>this.p = 1 : 1 +>this.p : any +>this : any +>p : any +>1 : 1 +} +module.exports.bothAfter = 'string' +>module.exports.bothAfter = 'string' : "string" +>module.exports.bothAfter : number +>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothAfter : number +>'string' : "string" + +module.exports.justProperty = 'string' +>module.exports.justProperty = 'string' : "string" +>module.exports.justProperty : any +>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>justProperty : any +>'string' : "string" + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.errors.txt index 41ca304157..da9dd12010 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.errors.txt @@ -1,21 +1,24 @@ -mod2.js(1,22): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. +mod1.js(6,24): error TS2339: Property 'e' does not exist on type '{}'. +mod2.js(6,8): error TS2339: Property 'e' does not exist on type '{}'. ==== mod2.js (1 errors) ==== const mod1 = require("./mod1"); - ~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. mod1.a; mod1.b; mod1.c; mod1.d; mod1.d.e; + ~ +!!! error TS2339: Property 'e' does not exist on type '{}'. mod1.default; -==== mod1.js (0 errors) ==== +==== mod1.js (1 errors) ==== exports.a = { x: "x" }; exports["b"] = { x: "x" }; exports["default"] = { x: "x" }; module.exports["c"] = { x: "x" }; module["exports"]["d"] = {}; module["exports"]["d"].e = 0; + ~ +!!! error TS2339: Property 'e' does not exist on type '{}'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols index c397e855b0..491743d1ac 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols @@ -4,22 +4,69 @@ const mod1 = require("./mod1"); >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) >require : Symbol(require) +>"./mod1" : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.a; +>mod1.a : Symbol(a, Decl(mod1.js, 0, 0)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) +>a : Symbol(a, Decl(mod1.js, 0, 0)) mod1.b; +>mod1.b : Symbol("b", Decl(mod1.js, 0, 23)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) +>b : Symbol("b", Decl(mod1.js, 0, 23)) mod1.c; +>mod1.c : Symbol("c", Decl(mod1.js, 2, 32)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) +>c : Symbol("c", Decl(mod1.js, 2, 32)) mod1.d; +>mod1.d : Symbol("d", Decl(mod1.js, 3, 33)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) +>d : Symbol("d", Decl(mod1.js, 3, 33)) mod1.d.e; +>mod1.d : Symbol("d", Decl(mod1.js, 3, 33)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) +>d : Symbol("d", Decl(mod1.js, 3, 33)) mod1.default; +>mod1.default : Symbol("default", Decl(mod1.js, 1, 26)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) +>default : Symbol("default", Decl(mod1.js, 1, 26)) + +=== mod1.js === +exports.a = { x: "x" }; +>exports.a : Symbol(a, Decl(mod1.js, 0, 0)) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>a : Symbol(a, Decl(mod1.js, 0, 0)) +>x : Symbol(x, Decl(mod1.js, 0, 13)) + +exports["b"] = { x: "x" }; +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>"b" : Symbol("b", Decl(mod1.js, 0, 23)) +>x : Symbol(x, Decl(mod1.js, 1, 16)) + +exports["default"] = { x: "x" }; +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>"default" : Symbol("default", Decl(mod1.js, 1, 26)) +>x : Symbol(x, Decl(mod1.js, 2, 22)) + +module.exports["c"] = { x: "x" }; +>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>"c" : Symbol("c", Decl(mod1.js, 2, 32)) +>x : Symbol(x, Decl(mod1.js, 3, 23)) + +module["exports"]["d"] = {}; +>module : Symbol(module.exports) +>"exports" : Symbol("mod1", Decl(mod1.js, 0, 0)) +>"d" : Symbol("d", Decl(mod1.js, 3, 33)) + +module["exports"]["d"].e = 0; +>module : Symbol(module.exports) +>"exports" : Symbol("mod1", Decl(mod1.js, 0, 0)) +>"d" : Symbol("d", Decl(mod1.js, 3, 33)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols.diff index ff51af1291..914178f445 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols.diff @@ -5,71 +5,87 @@ >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) >require : Symbol(require) ->"./mod1" : Symbol(mod1, Decl(mod1.js, 0, 0)) ++>"./mod1" : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.a; ->mod1.a : Symbol(mod1.a, Decl(mod1.js, 0, 0)) ++>mod1.a : Symbol(a, Decl(mod1.js, 0, 0)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) ->a : Symbol(mod1.a, Decl(mod1.js, 0, 0)) ++>a : Symbol(a, Decl(mod1.js, 0, 0)) mod1.b; ->mod1.b : Symbol(mod1["b"], Decl(mod1.js, 0, 23)) ++>mod1.b : Symbol("b", Decl(mod1.js, 0, 23)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) ->b : Symbol(mod1["b"], Decl(mod1.js, 0, 23)) ++>b : Symbol("b", Decl(mod1.js, 0, 23)) mod1.c; ->mod1.c : Symbol(mod1["c"], Decl(mod1.js, 2, 32)) ++>mod1.c : Symbol("c", Decl(mod1.js, 2, 32)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) ->c : Symbol(mod1["c"], Decl(mod1.js, 2, 32)) ++>c : Symbol("c", Decl(mod1.js, 2, 32)) mod1.d; ->mod1.d : Symbol(mod1["d"], Decl(mod1.js, 3, 33), Decl(mod1.js, 5, 18)) ++>mod1.d : Symbol("d", Decl(mod1.js, 3, 33)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) ->d : Symbol(mod1["d"], Decl(mod1.js, 3, 33), Decl(mod1.js, 5, 18)) ++>d : Symbol("d", Decl(mod1.js, 3, 33)) mod1.d.e; ->mod1.d.e : Symbol(mod1["d"].e, Decl(mod1.js, 4, 28)) ->mod1.d : Symbol(mod1["d"], Decl(mod1.js, 3, 33), Decl(mod1.js, 5, 18)) ++>mod1.d : Symbol("d", Decl(mod1.js, 3, 33)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) ->d : Symbol(mod1["d"], Decl(mod1.js, 3, 33), Decl(mod1.js, 5, 18)) ->e : Symbol(mod1["d"].e, Decl(mod1.js, 4, 28)) ++>d : Symbol("d", Decl(mod1.js, 3, 33)) mod1.default; ->mod1.default : Symbol(mod1.default, Decl(mod1.js, 1, 26)) ++>mod1.default : Symbol("default", Decl(mod1.js, 1, 26)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) ->default : Symbol(mod1.default, Decl(mod1.js, 1, 26)) -- --=== mod1.js === --exports.a = { x: "x" }; -->exports.a : Symbol(a, Decl(mod1.js, 0, 0)) ++>default : Symbol("default", Decl(mod1.js, 1, 26)) + + === mod1.js === + exports.a = { x: "x" }; + >exports.a : Symbol(a, Decl(mod1.js, 0, 0)) ->exports : Symbol(a, Decl(mod1.js, 0, 0)) -->a : Symbol(a, Decl(mod1.js, 0, 0)) -->x : Symbol(x, Decl(mod1.js, 0, 13)) -- --exports["b"] = { x: "x" }; -->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) -->"b" : Symbol("b", Decl(mod1.js, 0, 23)) -->x : Symbol(x, Decl(mod1.js, 1, 16)) -- --exports["default"] = { x: "x" }; -->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) -->"default" : Symbol("default", Decl(mod1.js, 1, 26)) -->x : Symbol(x, Decl(mod1.js, 2, 22)) -- --module.exports["c"] = { x: "x" }; ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) + >a : Symbol(a, Decl(mod1.js, 0, 0)) + >x : Symbol(x, Decl(mod1.js, 0, 13)) + +@@= skipped -52, +50 lines =@@ + >x : Symbol(x, Decl(mod1.js, 2, 22)) + + module.exports["c"] = { x: "x" }; ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(module, Decl(mod1.js, 2, 32)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) -->"c" : Symbol("c", Decl(mod1.js, 2, 32)) -->x : Symbol(x, Decl(mod1.js, 3, 23)) -- --module["exports"]["d"] = {}; ++>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) + >"c" : Symbol("c", Decl(mod1.js, 2, 32)) + >x : Symbol(x, Decl(mod1.js, 3, 23)) + + module["exports"]["d"] = {}; ->module : Symbol(module, Decl(mod1.js, 2, 32)) ->"exports" : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->"d" : Symbol("d", Decl(mod1.js, 3, 33), Decl(mod1.js, 5, 18)) -- --module["exports"]["d"].e = 0; ++>module : Symbol(module.exports) ++>"exports" : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>"d" : Symbol("d", Decl(mod1.js, 3, 33)) + + module["exports"]["d"].e = 0; ->module["exports"]["d"].e : Symbol("d".e, Decl(mod1.js, 4, 28)) ->module : Symbol(module, Decl(mod1.js, 2, 32)) ->"exports" : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->"d" : Symbol("d", Decl(mod1.js, 3, 33), Decl(mod1.js, 5, 18)) ->e : Symbol("d".e, Decl(mod1.js, 4, 28)) ++>module : Symbol(module.exports) ++>"exports" : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>"d" : Symbol("d", Decl(mod1.js, 3, 33)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types index 0ab897d93a..c84643db7c 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types @@ -2,40 +2,99 @@ === mod2.js === const mod1 = require("./mod1"); ->mod1 : any ->require("./mod1") : any +>mod1 : typeof mod1 +>require("./mod1") : typeof mod1 >require : any >"./mod1" : "./mod1" mod1.a; ->mod1.a : any ->mod1 : any ->a : any +>mod1.a : { x: string; } +>mod1 : typeof mod1 +>a : { x: string; } mod1.b; ->mod1.b : any ->mod1 : any ->b : any +>mod1.b : { x: string; } +>mod1 : typeof mod1 +>b : { x: string; } mod1.c; ->mod1.c : any ->mod1 : any ->c : any +>mod1.c : { x: string; } +>mod1 : typeof mod1 +>c : { x: string; } mod1.d; ->mod1.d : any ->mod1 : any ->d : any +>mod1.d : {} +>mod1 : typeof mod1 +>d : {} mod1.d.e; >mod1.d.e : any ->mod1.d : any ->mod1 : any ->d : any +>mod1.d : {} +>mod1 : typeof mod1 +>d : {} >e : any mod1.default; ->mod1.default : any ->mod1 : any ->default : any +>mod1.default : { x: string; } +>mod1 : typeof mod1 +>default : { x: string; } + +=== mod1.js === +exports.a = { x: "x" }; +>exports.a = { x: "x" } : { x: string; } +>exports.a : { x: string; } +>exports : typeof import("./mod1") +>a : { x: string; } +>{ x: "x" } : { x: string; } +>x : string +>"x" : "x" + +exports["b"] = { x: "x" }; +>exports["b"] = { x: "x" } : { x: string; } +>exports["b"] : { x: string; } +>exports : typeof import("./mod1") +>"b" : "b" +>{ x: "x" } : { x: string; } +>x : string +>"x" : "x" + +exports["default"] = { x: "x" }; +>exports["default"] = { x: "x" } : { x: string; } +>exports["default"] : { x: string; } +>exports : typeof import("./mod1") +>"default" : "default" +>{ x: "x" } : { x: string; } +>x : string +>"x" : "x" + +module.exports["c"] = { x: "x" }; +>module.exports["c"] = { x: "x" } : { x: string; } +>module.exports["c"] : { x: string; } +>module.exports : typeof import("./mod1") +>module : { "\"mod1\"": typeof import("./mod1"); } +>exports : typeof import("./mod1") +>"c" : "c" +>{ x: "x" } : { x: string; } +>x : string +>"x" : "x" + +module["exports"]["d"] = {}; +>module["exports"]["d"] = {} : {} +>module["exports"]["d"] : {} +>module["exports"] : typeof import("./mod1") +>module : { "\"mod1\"": typeof import("./mod1"); } +>"exports" : "exports" +>"d" : "d" +>{} : {} + +module["exports"]["d"].e = 0; +>module["exports"]["d"].e = 0 : 0 +>module["exports"]["d"].e : any +>module["exports"]["d"] : {} +>module["exports"] : typeof import("./mod1") +>module : { "\"mod1\"": typeof import("./mod1"); } +>"exports" : "exports" +>"d" : "d" +>e : any +>0 : 0 diff --git a/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols b/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols index 9f0bf2c87b..3a19abbb9b 100644 --- a/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols +++ b/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols @@ -3,13 +3,31 @@ === main.js === const { chalk: { grey } +>chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) >grey : Symbol(grey, Decl(main.js, 1, 12)) } = require('./mod1'); >require : Symbol(require) +>'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) grey >grey : Symbol(grey, Decl(main.js, 1, 12)) chalk +=== mod1.js === +const chalk = { +>chalk : Symbol(chalk, Decl(mod1.js, 0, 5)) + + grey: {} +>grey : Symbol(grey, Decl(mod1.js, 0, 15)) + +}; +module.exports.chalk = chalk +>module.exports.chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) +>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) +>chalk : Symbol(chalk, Decl(mod1.js, 0, 5)) + diff --git a/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols.diff b/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols.diff index 827c8303f6..63b4392e35 100644 --- a/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols.diff @@ -1,33 +1,14 @@ --- old.nestedDestructuringOfRequire.symbols +++ new.nestedDestructuringOfRequire.symbols -@@= skipped -2, +2 lines =@@ - === main.js === - const { - chalk: { grey } -->chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) - >grey : Symbol(grey, Decl(main.js, 1, 12)) - - } = require('./mod1'); - >require : Symbol(require) -->'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) - - grey - >grey : Symbol(grey, Decl(main.js, 1, 12)) - - chalk -- --=== mod1.js === --const chalk = { -->chalk : Symbol(chalk, Decl(mod1.js, 0, 5)) -- -- grey: {} -->grey : Symbol(grey, Decl(mod1.js, 0, 15)) -- --}; --module.exports.chalk = chalk -->module.exports.chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) +@@= skipped -24, +24 lines =@@ + }; + module.exports.chalk = chalk + >module.exports.chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) ->module.exports : Symbol(chalk, Decl(mod1.js, 2, 2)) ->module : Symbol(module, Decl(mod1.js, 2, 2)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) -->chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) -->chalk : Symbol(chalk, Decl(mod1.js, 0, 5)) ++>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) + >chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) + >chalk : Symbol(chalk, Decl(mod1.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.types b/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.types index 400756f8b4..a5b0356940 100644 --- a/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.types +++ b/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.types @@ -4,16 +4,35 @@ const { chalk: { grey } >chalk : any ->grey : any +>grey : {} } = require('./mod1'); ->require('./mod1') : any +>require('./mod1') : typeof import("./mod1") >require : any >'./mod1' : "./mod1" grey ->grey : any +>grey : {} chalk >chalk : any +=== mod1.js === +const chalk = { +>chalk : { grey: {}; } +>{ grey: {}} : { grey: {}; } + + grey: {} +>grey : {} +>{} : {} + +}; +module.exports.chalk = chalk +>module.exports.chalk = chalk : { grey: {}; } +>module.exports.chalk : { grey: {}; } +>module.exports : typeof import("./mod1") +>module : { "\"mod1\"": typeof import("./mod1"); } +>exports : typeof import("./mod1") +>chalk : { grey: {}; } +>chalk : { grey: {}; } + diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols index 011dc2dbeb..27794910c7 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols +++ b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols @@ -4,8 +4,23 @@ var f = require('./first'); >f : Symbol(f, Decl(main.js, 0, 3)) >require : Symbol(require) +>'./first' : Symbol("first", Decl(first.js, 0, 0)) f(1, n => { }) >f : Symbol(f, Decl(main.js, 0, 3)) >n : Symbol(n, Decl(main.js, 1, 4)) +=== first.js === +/** @template T + * @param {T} x + * @param {(t: T) => void} k + */ +module.exports = function (x, k) { return k(x) } +>module.exports : Symbol(export=, Decl(first.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(first.js, 0, 0)) +>x : Symbol(x, Decl(first.js, 4, 27)) +>k : Symbol(k, Decl(first.js, 4, 29)) +>k : Symbol(k, Decl(first.js, 4, 29)) +>x : Symbol(x, Decl(first.js, 4, 27)) + diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols.diff b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols.diff index 36c6092bbe..6752d4cbb7 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols.diff @@ -1,25 +1,13 @@ --- old.paramTagTypeResolution.symbols +++ new.paramTagTypeResolution.symbols -@@= skipped -3, +3 lines =@@ - var f = require('./first'); - >f : Symbol(f, Decl(main.js, 0, 3)) - >require : Symbol(require) -->'./first' : Symbol("first", Decl(first.js, 0, 0)) - - f(1, n => { }) - >f : Symbol(f, Decl(main.js, 0, 3)) - >n : Symbol(n, Decl(main.js, 1, 4)) -- --=== first.js === --/** @template T -- * @param {T} x -- * @param {(t: T) => void} k -- */ --module.exports = function (x, k) { return k(x) } +@@= skipped -15, +15 lines =@@ + * @param {(t: T) => void} k + */ + module.exports = function (x, k) { return k(x) } ->module.exports : Symbol(module.exports, Decl(first.js, 0, 0)) ->module : Symbol(export=, Decl(first.js, 0, 0)) -->exports : Symbol(export=, Decl(first.js, 0, 0)) -->x : Symbol(x, Decl(first.js, 4, 27)) -->k : Symbol(k, Decl(first.js, 4, 29)) -->k : Symbol(k, Decl(first.js, 4, 29)) -->x : Symbol(x, Decl(first.js, 4, 27)) ++>module.exports : Symbol(export=, Decl(first.js, 0, 0)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(first.js, 0, 0)) + >x : Symbol(x, Decl(first.js, 4, 27)) + >k : Symbol(k, Decl(first.js, 4, 29)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types index b70d3476dd..9d2cd3f0d4 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types +++ b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types @@ -2,15 +2,32 @@ === main.js === var f = require('./first'); ->f : any ->require('./first') : any +>f : (x: any, k: any) => any +>require('./first') : (x: any, k: any) => any >require : any >'./first' : "./first" f(1, n => { }) >f(1, n => { }) : any ->f : any +>f : (x: any, k: any) => any >1 : 1 >n => { } : (n: any) => void >n : any +=== first.js === +/** @template T + * @param {T} x + * @param {(t: T) => void} k + */ +module.exports = function (x, k) { return k(x) } +>module.exports = function (x, k) { return k(x) } : (x: any, k: any) => any +>module.exports : (x: any, k: any) => any +>module : { "export=": (x: any, k: any) => any; } +>exports : (x: any, k: any) => any +>function (x, k) { return k(x) } : (x: any, k: any) => any +>x : any +>k : any +>k(x) : any +>k : any +>x : any + diff --git a/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols b/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols index 0e78faea9c..a4890727e6 100644 --- a/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols +++ b/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols @@ -3,7 +3,11 @@ === requireTwoPropertyAccesses.js === const value = require("./mod").x.y >value : Symbol(value, Decl(requireTwoPropertyAccesses.js, 0, 5)) +>require("./mod").x.y : Symbol(y, Decl(mod.js, 1, 8)) +>require("./mod").x : Symbol(x, Decl(mod.js, 0, 18)) >require : Symbol(require) +>x : Symbol(x, Decl(mod.js, 0, 18)) +>y : Symbol(y, Decl(mod.js, 1, 8)) console.log(value) >console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) @@ -11,3 +15,16 @@ console.log(value) >log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >value : Symbol(value, Decl(requireTwoPropertyAccesses.js, 0, 5)) +=== mod.js === +module.exports = { +>module.exports : Symbol(export=, Decl(mod.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod.js, 0, 0)) + + x: { +>x : Symbol(x, Decl(mod.js, 0, 18)) + + y: "value" +>y : Symbol(y, Decl(mod.js, 1, 8)) + } +} diff --git a/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols.diff b/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols.diff index 1736bb1ba8..d53af0671e 100644 --- a/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols.diff @@ -1,15 +1,12 @@ --- old.requireTwoPropertyAccesses.symbols +++ new.requireTwoPropertyAccesses.symbols -@@= skipped -2, +2 lines =@@ - === requireTwoPropertyAccesses.js === - const value = require("./mod").x.y - >value : Symbol(value, Decl(requireTwoPropertyAccesses.js, 0, 5)) -->require("./mod").x.y : Symbol(y, Decl(mod.js, 1, 8)) -->require("./mod").x : Symbol(x, Decl(mod.js, 0, 18)) +@@= skipped -5, +5 lines =@@ + >require("./mod").x.y : Symbol(y, Decl(mod.js, 1, 8)) + >require("./mod").x : Symbol(x, Decl(mod.js, 0, 18)) >require : Symbol(require) ->"./mod" : Symbol("mod", Decl(mod.js, 0, 0)) -->x : Symbol(x, Decl(mod.js, 0, 18)) -->y : Symbol(y, Decl(mod.js, 1, 8)) + >x : Symbol(x, Decl(mod.js, 0, 18)) + >y : Symbol(y, Decl(mod.js, 1, 8)) console.log(value) ->console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) @@ -19,16 +16,12 @@ +>log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >value : Symbol(value, Decl(requireTwoPropertyAccesses.js, 0, 5)) --=== mod.js === --module.exports = { + === mod.js === + module.exports = { ->module.exports : Symbol(module.exports, Decl(mod.js, 0, 0)) ->module : Symbol(export=, Decl(mod.js, 0, 0)) -->exports : Symbol(export=, Decl(mod.js, 0, 0)) -- -- x: { -->x : Symbol(x, Decl(mod.js, 0, 18)) -- -- y: "value" -->y : Symbol(y, Decl(mod.js, 1, 8)) -- } --} \ No newline at end of file ++>module.exports : Symbol(export=, Decl(mod.js, 0, 0)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(mod.js, 0, 0)) + + x: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.types b/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.types index ab5891fac6..c3dcda46bd 100644 --- a/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.types +++ b/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.types @@ -2,19 +2,36 @@ === requireTwoPropertyAccesses.js === const value = require("./mod").x.y ->value : any ->require("./mod").x.y : any ->require("./mod").x : any ->require("./mod") : any +>value : string +>require("./mod").x.y : string +>require("./mod").x : { y: string; } +>require("./mod") : { x: { y: string; }; } >require : any >"./mod" : "./mod" ->x : any ->y : any +>x : { y: string; } +>y : string console.log(value) >console.log(value) : void >console.log : (...data: any[]) => void >console : Console >log : (...data: any[]) => void ->value : any +>value : string +=== mod.js === +module.exports = { +>module.exports = { x: { y: "value" }} : { x: { y: string; }; } +>module.exports : { x: { y: string; }; } +>module : { "export=": { x: { y: string; }; }; } +>exports : { x: { y: string; }; } +>{ x: { y: "value" }} : { x: { y: string; }; } + + x: { +>x : { y: string; } +>{ y: "value" } : { y: string; } + + y: "value" +>y : string +>"value" : "value" + } +} diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt new file mode 100644 index 0000000000..c367fd4d66 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt @@ -0,0 +1,35 @@ +use.js(3,8): error TS2554: Expected 1 arguments, but got 0. + + +==== use.js (1 errors) ==== + /// + var mini = require('./minimatch') + mini.M.defaults() + ~~~~~~~~ +!!! error TS2554: Expected 1 arguments, but got 0. +!!! related TS6210 minimatch.js:10:24: An argument for 'def' was not provided. + var m = new mini.M() + m.m() + mini.filter() + +==== types.d.ts (0 errors) ==== + declare var require: any; + declare var module: any; +==== minimatch.js (0 errors) ==== + /// + module.exports = minimatch + minimatch.M = M + minimatch.filter = filter + function filter() { + return minimatch() + } + function minimatch() { + } + M.defaults = function (def) { + return def + } + M.prototype.m = function () { + } + function M() { + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols index 3b2433b08b..5a1120117c 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols @@ -5,19 +5,28 @@ var mini = require('./minimatch') >mini : Symbol(mini, Decl(use.js, 1, 3)) >require : Symbol(require, Decl(types.d.ts, 0, 11)) +>'./minimatch' : Symbol("minimatch", Decl(minimatch.js, 0, 0)) mini.M.defaults() +>mini.M.defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) +>mini.M : Symbol(M, Decl(minimatch.js, 1, 26)) >mini : Symbol(mini, Decl(use.js, 1, 3)) +>M : Symbol(M, Decl(minimatch.js, 1, 26)) +>defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) var m = new mini.M() >m : Symbol(m, Decl(use.js, 3, 3)) +>mini.M : Symbol(M, Decl(minimatch.js, 1, 26)) >mini : Symbol(mini, Decl(use.js, 1, 3)) +>M : Symbol(M, Decl(minimatch.js, 1, 26)) m.m() >m : Symbol(m, Decl(use.js, 3, 3)) mini.filter() +>mini.filter : Symbol(filter, Decl(minimatch.js, 2, 15)) >mini : Symbol(mini, Decl(use.js, 1, 3)) +>filter : Symbol(filter, Decl(minimatch.js, 2, 15)) === types.d.ts === declare var require: any; @@ -26,3 +35,50 @@ declare var require: any; declare var module: any; >module : Symbol(module, Decl(types.d.ts, 1, 11)) +=== minimatch.js === +/// +module.exports = minimatch +>module.exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +>module : Symbol(module.exports) +>exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) + +minimatch.M = M +>minimatch.M : Symbol(M, Decl(minimatch.js, 1, 26)) +>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +>M : Symbol(M, Decl(minimatch.js, 1, 26)) +>M : Symbol(M, Decl(minimatch.js, 13, 1)) + +minimatch.filter = filter +>minimatch.filter : Symbol(filter, Decl(minimatch.js, 2, 15)) +>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +>filter : Symbol(filter, Decl(minimatch.js, 2, 15)) +>filter : Symbol(filter, Decl(minimatch.js, 3, 25)) + +function filter() { +>filter : Symbol(filter, Decl(minimatch.js, 3, 25)) + + return minimatch() +>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +} +function minimatch() { +>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +} +M.defaults = function (def) { +>M.defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) +>M : Symbol(M, Decl(minimatch.js, 13, 1)) +>defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) +>def : Symbol(def, Decl(minimatch.js, 9, 23)) + + return def +>def : Symbol(def, Decl(minimatch.js, 9, 23)) +} +M.prototype.m = function () { +>M.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>M : Symbol(M, Decl(minimatch.js, 13, 1)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +} +function M() { +>M : Symbol(M, Decl(minimatch.js, 13, 1)) +} + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff index c7ffcba567..0c2b43bbff 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff @@ -1,23 +1,26 @@ --- old.typeFromPropertyAssignment17.symbols +++ new.typeFromPropertyAssignment17.symbols -@@= skipped -4, +4 lines =@@ - var mini = require('./minimatch') - >mini : Symbol(mini, Decl(use.js, 1, 3)) - >require : Symbol(require, Decl(types.d.ts, 0, 11)) -->'./minimatch' : Symbol("minimatch", Decl(minimatch.js, 0, 0)) +@@= skipped -7, +7 lines =@@ + >'./minimatch' : Symbol("minimatch", Decl(minimatch.js, 0, 0)) mini.M.defaults() ->mini.M.defaults : Symbol(M.defaults, Decl(minimatch.js, 8, 1)) ->mini.M : Symbol(mini.M, Decl(minimatch.js, 1, 26)) ++>mini.M.defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) ++>mini.M : Symbol(M, Decl(minimatch.js, 1, 26)) >mini : Symbol(mini, Decl(use.js, 1, 3)) ->M : Symbol(mini.M, Decl(minimatch.js, 1, 26)) ->defaults : Symbol(M.defaults, Decl(minimatch.js, 8, 1)) ++>M : Symbol(M, Decl(minimatch.js, 1, 26)) ++>defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) var m = new mini.M() >m : Symbol(m, Decl(use.js, 3, 3)) ->mini.M : Symbol(mini.M, Decl(minimatch.js, 1, 26)) ++>mini.M : Symbol(M, Decl(minimatch.js, 1, 26)) >mini : Symbol(mini, Decl(use.js, 1, 3)) ->M : Symbol(mini.M, Decl(minimatch.js, 1, 26)) ++>M : Symbol(M, Decl(minimatch.js, 1, 26)) m.m() ->m.m : Symbol(M.m, Decl(minimatch.js, 11, 1)) @@ -26,60 +29,78 @@ mini.filter() ->mini.filter : Symbol(mini.filter, Decl(minimatch.js, 2, 15)) ++>mini.filter : Symbol(filter, Decl(minimatch.js, 2, 15)) >mini : Symbol(mini, Decl(use.js, 1, 3)) ->filter : Symbol(mini.filter, Decl(minimatch.js, 2, 15)) ++>filter : Symbol(filter, Decl(minimatch.js, 2, 15)) === types.d.ts === declare var require: any; -@@= skipped -31, +20 lines =@@ - - declare var module: any; - >module : Symbol(module, Decl(types.d.ts, 1, 11)) -- --=== minimatch.js === --/// --module.exports = minimatch +@@= skipped -32, +30 lines =@@ + === minimatch.js === + /// + module.exports = minimatch ->module.exports : Symbol(module.exports, Decl(minimatch.js, 0, 0)) ->module : Symbol(export=, Decl(minimatch.js, 0, 0)) ->exports : Symbol(export=, Decl(minimatch.js, 0, 0)) ->minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1), Decl(minimatch.js, 1, 26), Decl(minimatch.js, 2, 15)) -- --minimatch.M = M ++>module.exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) ++>module : Symbol(module.exports) ++>exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) ++>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) + + minimatch.M = M ->minimatch.M : Symbol(minimatch.M, Decl(minimatch.js, 1, 26)) ->minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1), Decl(minimatch.js, 1, 26), Decl(minimatch.js, 2, 15)) ->M : Symbol(minimatch.M, Decl(minimatch.js, 1, 26)) ->M : Symbol(M, Decl(minimatch.js, 13, 1), Decl(minimatch.js, 8, 1)) -- --minimatch.filter = filter ++>minimatch.M : Symbol(M, Decl(minimatch.js, 1, 26)) ++>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) ++>M : Symbol(M, Decl(minimatch.js, 1, 26)) ++>M : Symbol(M, Decl(minimatch.js, 13, 1)) + + minimatch.filter = filter ->minimatch.filter : Symbol(minimatch.filter, Decl(minimatch.js, 2, 15)) ->minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1), Decl(minimatch.js, 1, 26), Decl(minimatch.js, 2, 15)) ->filter : Symbol(minimatch.filter, Decl(minimatch.js, 2, 15)) -->filter : Symbol(filter, Decl(minimatch.js, 3, 25)) -- --function filter() { -->filter : Symbol(filter, Decl(minimatch.js, 3, 25)) -- -- return minimatch() ++>minimatch.filter : Symbol(filter, Decl(minimatch.js, 2, 15)) ++>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) ++>filter : Symbol(filter, Decl(minimatch.js, 2, 15)) + >filter : Symbol(filter, Decl(minimatch.js, 3, 25)) + + function filter() { + >filter : Symbol(filter, Decl(minimatch.js, 3, 25)) + + return minimatch() ->minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1), Decl(minimatch.js, 1, 26), Decl(minimatch.js, 2, 15)) --} --function minimatch() { ++>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) + } + function minimatch() { ->minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1), Decl(minimatch.js, 1, 26), Decl(minimatch.js, 2, 15)) --} --M.defaults = function (def) { ++>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) + } + M.defaults = function (def) { ->M.defaults : Symbol(M.defaults, Decl(minimatch.js, 8, 1)) ->M : Symbol(M, Decl(minimatch.js, 13, 1), Decl(minimatch.js, 8, 1)) ->defaults : Symbol(M.defaults, Decl(minimatch.js, 8, 1)) -->def : Symbol(def, Decl(minimatch.js, 9, 23)) -- -- return def -->def : Symbol(def, Decl(minimatch.js, 9, 23)) --} --M.prototype.m = function () { ++>M.defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) ++>M : Symbol(M, Decl(minimatch.js, 13, 1)) ++>defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) + >def : Symbol(def, Decl(minimatch.js, 9, 23)) + + return def + >def : Symbol(def, Decl(minimatch.js, 9, 23)) + } + M.prototype.m = function () { ->M.prototype : Symbol(M.m, Decl(minimatch.js, 11, 1)) ->M : Symbol(M, Decl(minimatch.js, 13, 1), Decl(minimatch.js, 8, 1)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->m : Symbol(M.m, Decl(minimatch.js, 11, 1)) --} --function M() { ++>M.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) ++>M : Symbol(M, Decl(minimatch.js, 13, 1)) ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + } + function M() { ->M : Symbol(M, Decl(minimatch.js, 13, 1), Decl(minimatch.js, 8, 1)) --} ++>M : Symbol(M, Decl(minimatch.js, 13, 1)) + } diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types index 50f2ba670c..20ccb10834 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types @@ -3,25 +3,25 @@ === use.js === /// var mini = require('./minimatch') ->mini : any ->require('./minimatch') : any +>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>require('./minimatch') : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } >require : any >'./minimatch' : "./minimatch" mini.M.defaults() >mini.M.defaults() : any ->mini.M.defaults : any ->mini.M : any ->mini : any ->M : any ->defaults : any +>mini.M.defaults : (def: any) => any +>mini.M : { (): void; defaults: (def: any) => any; } +>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>M : { (): void; defaults: (def: any) => any; } +>defaults : (def: any) => any var m = new mini.M() >m : any >new mini.M() : any ->mini.M : any ->mini : any ->M : any +>mini.M : { (): void; defaults: (def: any) => any; } +>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>M : { (): void; defaults: (def: any) => any; } m.m() >m.m() : any @@ -30,10 +30,10 @@ m.m() >m : any mini.filter() ->mini.filter() : any ->mini.filter : any ->mini : any ->filter : any +>mini.filter() : void +>mini.filter : () => void +>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>filter : () => void === types.d.ts === declare var require: any; @@ -42,3 +42,60 @@ declare var require: any; declare var module: any; >module : any +=== minimatch.js === +/// +module.exports = minimatch +>module.exports = minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>module.exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>module : { minimatch: { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; }; } +>exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } + +minimatch.M = M +>minimatch.M = M : { (): void; defaults: (def: any) => any; } +>minimatch.M : { (): void; defaults: (def: any) => any; } +>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>M : { (): void; defaults: (def: any) => any; } +>M : { (): void; defaults: (def: any) => any; } + +minimatch.filter = filter +>minimatch.filter = filter : () => void +>minimatch.filter : () => void +>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>filter : () => void +>filter : () => void + +function filter() { +>filter : () => void + + return minimatch() +>minimatch() : void +>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +} +function minimatch() { +>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +} +M.defaults = function (def) { +>M.defaults = function (def) { return def} : (def: any) => any +>M.defaults : (def: any) => any +>M : { (): void; defaults: (def: any) => any; } +>defaults : (def: any) => any +>function (def) { return def} : (def: any) => any +>def : any + + return def +>def : any +} +M.prototype.m = function () { +>M.prototype.m = function () {} : () => void +>M.prototype.m : any +>M.prototype : any +>M : { (): void; defaults: (def: any) => any; } +>prototype : any +>m : any +>function () {} : () => void +} +function M() { +>M : { (): void; defaults: (def: any) => any; } +} + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.errors.txt new file mode 100644 index 0000000000..ae7c3d1962 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.errors.txt @@ -0,0 +1,23 @@ +index.js(2,19): error TS2306: File 'semver.js' is not a module. +semver.js(2,1): error TS2304: Cannot find name 'exports'. + + +==== index.js (1 errors) ==== + /// + const C = require("./semver") + ~~~~~~~~~~ +!!! error TS2306: File 'semver.js' is not a module. + var two = C.f(1) + +==== types.d.ts (0 errors) ==== + declare var require: any; + declare var module: any; +==== semver.js (1 errors) ==== + /// + exports = module.exports = C + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. + C.f = n => n + 1 + function C() { + this.p = 1 + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols index b642887626..9523fb3bf3 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols @@ -17,3 +17,21 @@ declare var require: any; declare var module: any; >module : Symbol(module, Decl(types.d.ts, 1, 11)) +=== semver.js === +/// +exports = module.exports = C +>module : Symbol(module, Decl(types.d.ts, 1, 11)) +>C : Symbol(C, Decl(semver.js, 2, 16)) + +C.f = n => n + 1 +>C.f : Symbol(f, Decl(semver.js, 1, 28)) +>C : Symbol(C, Decl(semver.js, 2, 16)) +>f : Symbol(f, Decl(semver.js, 1, 28)) +>n : Symbol(n, Decl(semver.js, 2, 5)) +>n : Symbol(n, Decl(semver.js, 2, 5)) + +function C() { +>C : Symbol(C, Decl(semver.js, 2, 16)) + + this.p = 1 +} diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols.diff index 85ecf52811..4336eaa349 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols.diff @@ -14,31 +14,34 @@ === types.d.ts === declare var require: any; -@@= skipped -15, +12 lines =@@ - declare var module: any; - >module : Symbol(module, Decl(types.d.ts, 1, 11)) - --=== semver.js === --/// --exports = module.exports = C +@@= skipped -18, +15 lines =@@ + === semver.js === + /// + exports = module.exports = C ->exports : Symbol("semver", Decl(semver.js, 0, 0)) ->module.exports : Symbol(module.exports, Decl(semver.js, 0, 0)) ->module : Symbol(export=, Decl(semver.js, 1, 9)) ->exports : Symbol(export=, Decl(semver.js, 1, 9)) ->C : Symbol(C, Decl(semver.js, 2, 16), Decl(semver.js, 1, 28)) -- --C.f = n => n + 1 ++>module : Symbol(module, Decl(types.d.ts, 1, 11)) ++>C : Symbol(C, Decl(semver.js, 2, 16)) + + C.f = n => n + 1 ->C.f : Symbol(C.f, Decl(semver.js, 1, 28)) ->C : Symbol(C, Decl(semver.js, 2, 16), Decl(semver.js, 1, 28)) ->f : Symbol(C.f, Decl(semver.js, 1, 28)) -->n : Symbol(n, Decl(semver.js, 2, 5)) -->n : Symbol(n, Decl(semver.js, 2, 5)) -- --function C() { ++>C.f : Symbol(f, Decl(semver.js, 1, 28)) ++>C : Symbol(C, Decl(semver.js, 2, 16)) ++>f : Symbol(f, Decl(semver.js, 1, 28)) + >n : Symbol(n, Decl(semver.js, 2, 5)) + >n : Symbol(n, Decl(semver.js, 2, 5)) + + function C() { ->C : Symbol(C, Decl(semver.js, 2, 16), Decl(semver.js, 1, 28)) -- -- this.p = 1 ++>C : Symbol(C, Decl(semver.js, 2, 16)) + + this.p = 1 ->this.p : Symbol(C.p, Decl(semver.js, 3, 14)) ->this : Symbol(C, Decl(semver.js, 2, 16), Decl(semver.js, 1, 28)) ->p : Symbol(C.p, Decl(semver.js, 3, 14)) --} \ No newline at end of file + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.types index 88801b3e16..4a10207ef1 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.types @@ -23,3 +23,35 @@ declare var require: any; declare var module: any; >module : any +=== semver.js === +/// +exports = module.exports = C +>exports = module.exports = C : { (): void; f: (n: any) => any; } +>exports : any +>module.exports = C : { (): void; f: (n: any) => any; } +>module.exports : any +>module : any +>exports : any +>C : { (): void; f: (n: any) => any; } + +C.f = n => n + 1 +>C.f = n => n + 1 : (n: any) => any +>C.f : (n: any) => any +>C : { (): void; f: (n: any) => any; } +>f : (n: any) => any +>n => n + 1 : (n: any) => any +>n : any +>n + 1 : any +>n : any +>1 : 1 + +function C() { +>C : { (): void; f: (n: any) => any; } + + this.p = 1 +>this.p = 1 : 1 +>this.p : any +>this : any +>p : any +>1 : 1 +} diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.errors.txt new file mode 100644 index 0000000000..a8a549a4f4 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.errors.txt @@ -0,0 +1,27 @@ +mod.js(1,14): error TS2304: Cannot find name 'exports'. +mod.js(1,24): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +mod.js(3,10): error TS2339: Property 'existy' does not exist on type '{}'. +use.js(1,22): error TS2306: File 'mod.js' is not a module. + + +==== use.js (1 errors) ==== + const util = require('./mod') + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. + function n() { + util.existy // no error + } + util.existy // no error + +==== mod.js (3 errors) ==== + const util = exports = module.exports = {} + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + if (!!false) { + util.existy = function () { } + ~~~~~~ +!!! error TS2339: Property 'existy' does not exist on type '{}'. + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols index 866e4094e0..218408dd07 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols @@ -14,3 +14,12 @@ function n() { util.existy // no error >util : Symbol(util, Decl(use.js, 0, 5)) +=== mod.js === +const util = exports = module.exports = {} +>util : Symbol(util, Decl(mod.js, 0, 5)) + +if (!!false) { + util.existy = function () { } +>util : Symbol(util, Decl(mod.js, 0, 5)) +} + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols.diff index f1c5e684b5..c82a4373a0 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols.diff @@ -18,18 +18,18 @@ ->util.existy : Symbol(util.existy, Decl(mod.js, 1, 14)) >util : Symbol(util, Decl(use.js, 0, 5)) ->existy : Symbol(util.existy, Decl(mod.js, 1, 14)) -- --=== mod.js === --const util = exports = module.exports = {} -->util : Symbol(util, Decl(mod.js, 0, 5)) + + === mod.js === + const util = exports = module.exports = {} + >util : Symbol(util, Decl(mod.js, 0, 5)) ->exports : Symbol("mod", Decl(mod.js, 0, 0)) ->module.exports : Symbol(module.exports, Decl(mod.js, 0, 0)) ->module : Symbol(module, Decl(mod.js, 0, 22)) ->exports : Symbol(module.exports, Decl(mod.js, 0, 0)) -- --if (!!false) { -- util.existy = function () { } + + if (!!false) { + util.existy = function () { } ->util.existy : Symbol(existy, Decl(mod.js, 1, 14)) -->util : Symbol(util, Decl(mod.js, 0, 5)) + >util : Symbol(util, Decl(mod.js, 0, 5)) ->existy : Symbol(existy, Decl(mod.js, 1, 14)) --} + } diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.types index 291336ab14..6dbb6c85d9 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.types @@ -20,3 +20,27 @@ util.existy // no error >util : any >existy : any +=== mod.js === +const util = exports = module.exports = {} +>util : {} +>exports = module.exports = {} : {} +>exports : any +>module.exports = {} : {} +>module.exports : any +>module : any +>exports : any +>{} : {} + +if (!!false) { +>!!false : boolean +>!false : true +>false : false + + util.existy = function () { } +>util.existy = function () { } : () => void +>util.existy : any +>util : {} +>existy : any +>function () { } : () => void +} + diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt new file mode 100644 index 0000000000..d48c75aeb1 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt @@ -0,0 +1,73 @@ +mod1.js(3,23): error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. +mod1.js(4,7): error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. +mod1.js(7,9): error TS2339: Property 'Bar' does not exist on type 'typeof import("mod1")'. +mod1.js(10,1): error TS2300: Duplicate identifier 'export='. +mod1.js(10,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +mod1.js(20,9): error TS2339: Property 'Quid' does not exist on type 'typeof import("mod1")'. +mod1.js(23,1): error TS2300: Duplicate identifier 'export='. +mod1.js(24,5): error TS2353: Object literal may only specify known properties, and 'Quack' does not exist in type '{ Baz: typeof Baz; }'. +use.js(2,32): error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. +use.js(4,12): error TS2503: Cannot find namespace 'mod'. + + +==== use.js (2 errors) ==== + var mod = require('./mod1.js'); + /** @type {import("./mod1.js").Baz} */ + ~~~ +!!! error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. + var b; + /** @type {mod.Baz} */ + ~~~ +!!! error TS2503: Cannot find namespace 'mod'. + var bb; + var bbb = new mod.Baz(); + +==== mod1.js (8 errors) ==== + // error + + /** @typedef {number} Foo */ + ~~~ +!!! error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. + class Foo { } // should error + ~~~ +!!! error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. + + /** @typedef {number} Bar */ + exports.Bar = class { } + ~~~ +!!! error TS2339: Property 'Bar' does not exist on type 'typeof import("mod1")'. + + /** @typedef {number} Baz */ + module.exports = { + ~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~ + Baz: class { } + ~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~ + } + ~ +!!! error TS2300: Duplicate identifier 'export='. + ~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + + // ok + + /** @typedef {number} Qux */ + var Qux = 2; + + /** @typedef {number} Quid */ + exports.Quid = 2; + ~~~~ +!!! error TS2339: Property 'Quid' does not exist on type 'typeof import("mod1")'. + + /** @typedef {number} Quack */ + module.exports = { + ~~~~~~~~~~~~~~~~~~ + Quack: 2 + ~~~~~~~~~~~~ + ~~~~~ +!!! error TS2353: Object literal may only specify known properties, and 'Quack' does not exist in type '{ Baz: typeof Baz; }'. + } + ~ +!!! error TS2300: Duplicate identifier 'export='. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols index 535d93955c..2104a285c8 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols @@ -4,6 +4,7 @@ var mod = require('./mod1.js'); >mod : Symbol(mod, Decl(use.js, 0, 3)) >require : Symbol(require) +>'./mod1.js' : Symbol("mod1", Decl(mod1.js, 0, 0)) /** @type {import("./mod1.js").Baz} */ var b; @@ -15,5 +16,48 @@ var bb; var bbb = new mod.Baz(); >bbb : Symbol(bbb, Decl(use.js, 5, 3)) +>mod.Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) >mod : Symbol(mod, Decl(use.js, 0, 3)) +>Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) + +=== mod1.js === +// error + +/** @typedef {number} Foo */ +class Foo { } // should error +>Foo : Symbol(Foo, Decl(mod1.js, 2, 4), Decl(mod1.js, 0, 0)) + +/** @typedef {number} Bar */ +exports.Bar = class { } +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) + +/** @typedef {number} Baz */ +module.exports = { +>module.exports : Symbol(export=, Decl(mod1.js, 6, 23)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 6, 23)) + + Baz: class { } +>Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) +} + +// ok + +/** @typedef {number} Qux */ +var Qux = 2; +>Qux : Symbol(Qux, Decl(mod1.js, 15, 4), Decl(mod1.js, 16, 3)) + +/** @typedef {number} Quid */ +exports.Quid = 2; +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) + +/** @typedef {number} Quack */ +module.exports = { +>module.exports : Symbol(export=, Decl(mod1.js, 6, 23)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 6, 23)) + + Quack: 2 +>Quack : Symbol(Quack, Decl(mod1.js, 22, 18)) +} diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff index 9c3a161b93..b01cc9dce5 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff @@ -1,62 +1,63 @@ --- old.typedefCrossModule2.symbols +++ new.typedefCrossModule2.symbols -@@= skipped -3, +3 lines =@@ - var mod = require('./mod1.js'); - >mod : Symbol(mod, Decl(use.js, 0, 3)) - >require : Symbol(require) -->'./mod1.js' : Symbol("mod1", Decl(mod1.js, 0, 0)) - - /** @type {import("./mod1.js").Baz} */ - var b; -@@= skipped -12, +11 lines =@@ +@@= skipped -15, +15 lines =@@ var bbb = new mod.Baz(); >bbb : Symbol(bbb, Decl(use.js, 5, 3)) ->mod.Baz : Symbol(Baz, Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18), Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18)) ++>mod.Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) >mod : Symbol(mod, Decl(use.js, 0, 3)) ->Baz : Symbol(Baz, Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18), Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18)) -- --=== mod1.js === --// error -- --/** @typedef {number} Foo */ --class Foo { } // should error ++>Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) + + === mod1.js === + // error + + /** @typedef {number} Foo */ + class Foo { } // should error ->Foo : Symbol(Foo, Decl(mod1.js, 0, 0)) -- --/** @typedef {number} Bar */ --exports.Bar = class { } ++>Foo : Symbol(Foo, Decl(mod1.js, 2, 4), Decl(mod1.js, 0, 0)) + + /** @typedef {number} Bar */ + exports.Bar = class { } ->exports.Bar : Symbol(Bar, Decl(mod1.js, 3, 13), Decl(mod1.js, 5, 4)) ->exports : Symbol(Bar, Decl(mod1.js, 3, 13), Decl(mod1.js, 5, 4)) ->Bar : Symbol(Bar, Decl(mod1.js, 3, 13), Decl(mod1.js, 5, 4)) -- --/** @typedef {number} Baz */ --module.exports = { ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) + + /** @typedef {number} Baz */ + module.exports = { ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17)) ->exports : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17)) -- -- Baz: class { } -->Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) --} -- --// ok -- --/** @typedef {number} Qux */ --var Qux = 2; ++>module.exports : Symbol(export=, Decl(mod1.js, 6, 23)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod1.js, 6, 23)) + + Baz: class { } + >Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) +@@= skipped -31, +29 lines =@@ + + /** @typedef {number} Qux */ + var Qux = 2; ->Qux : Symbol(Qux, Decl(mod1.js, 16, 3), Decl(mod1.js, 15, 4)) -- --/** @typedef {number} Quid */ --exports.Quid = 2; ++>Qux : Symbol(Qux, Decl(mod1.js, 15, 4), Decl(mod1.js, 16, 3)) + + /** @typedef {number} Quid */ + exports.Quid = 2; ->exports.Quid : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4)) ->exports : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4)) ->Quid : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4)) -- --/** @typedef {number} Quack */ --module.exports = { ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) + + /** @typedef {number} Quack */ + module.exports = { ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17)) ->exports : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17)) -- -- Quack: 2 -->Quack : Symbol(Quack, Decl(mod1.js, 22, 18)) --} ++>module.exports : Symbol(export=, Decl(mod1.js, 6, 23)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod1.js, 6, 23)) + + Quack: 2 + >Quack : Symbol(Quack, Decl(mod1.js, 22, 18)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types index 41ab60f04e..e597356b31 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types @@ -2,8 +2,8 @@ === use.js === var mod = require('./mod1.js'); ->mod : any ->require('./mod1.js') : any +>mod : { Baz: typeof Baz; } +>require('./mod1.js') : { Baz: typeof Baz; } >require : any >'./mod1.js' : "./mod1.js" @@ -13,12 +13,68 @@ var b; /** @type {mod.Baz} */ var bb; ->bb : error +>bb : mod.Baz var bbb = new mod.Baz(); ->bbb : any ->new mod.Baz() : any ->mod.Baz : any ->mod : any ->Baz : any +>bbb : Baz +>new mod.Baz() : Baz +>mod.Baz : typeof Baz +>mod : { Baz: typeof Baz; } +>Baz : typeof Baz + +=== mod1.js === +// error + +/** @typedef {number} Foo */ +class Foo { } // should error +>Foo : Foo + +/** @typedef {number} Bar */ +exports.Bar = class { } +>exports.Bar = class { } : typeof Bar +>exports.Bar : any +>exports : typeof import("./mod1") +>Bar : any +>class { } : typeof Bar + +/** @typedef {number} Baz */ +module.exports = { +>module.exports = { Baz: class { }} : { Baz: typeof Baz; } +>module.exports : { Baz: typeof Baz; } +>module : { "export=": { Baz: typeof Baz; }; } +>exports : { Baz: typeof Baz; } +>{ Baz: class { }} : { Baz: typeof Baz; } + + Baz: class { } +>Baz : typeof Baz +>class { } : typeof Baz +} + +// ok + +/** @typedef {number} Qux */ +var Qux = 2; +>Qux : number +>2 : 2 + +/** @typedef {number} Quid */ +exports.Quid = 2; +>exports.Quid = 2 : 2 +>exports.Quid : any +>exports : typeof import("./mod1") +>Quid : any +>2 : 2 + +/** @typedef {number} Quack */ +module.exports = { +>module.exports = { Quack: 2} : { Quack: number; } +>module.exports : { Baz: typeof Baz; } +>module : { "export=": { Baz: typeof Baz; }; } +>exports : { Baz: typeof Baz; } +>{ Quack: 2} : { Quack: number; } + + Quack: 2 +>Quack : number +>2 : 2 +} diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols index 5ea4acb1be..6493017cb5 100644 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols +++ b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols @@ -5,5 +5,14 @@ import foo from "foo"; >foo : Symbol(foo, Decl(a.ts, 0, 6)) foo.bar(); +>foo.bar : Symbol(bar, Decl(index.js, 0, 19)) >foo : Symbol(foo, Decl(a.ts, 0, 6)) +>bar : Symbol(bar, Decl(index.js, 0, 19)) + +=== /node_modules/foo/index.js === +exports.default = { bar() { return 0; } } +>exports.default : Symbol(default, Decl(index.js, 0, 0)) +>exports : Symbol("/node_modules/foo/index", Decl(index.js, 0, 0)) +>default : Symbol(default, Decl(index.js, 0, 0)) +>bar : Symbol(bar, Decl(index.js, 0, 19)) diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff index 287bfadbab..b8241f1ff0 100644 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff @@ -1,16 +1,10 @@ --- old.untypedModuleImport_allowJs.symbols +++ new.untypedModuleImport_allowJs.symbols -@@= skipped -4, +4 lines =@@ - >foo : Symbol(foo, Decl(a.ts, 0, 6)) - - foo.bar(); -->foo.bar : Symbol(bar, Decl(index.js, 0, 19)) - >foo : Symbol(foo, Decl(a.ts, 0, 6)) -->bar : Symbol(bar, Decl(index.js, 0, 19)) -- --=== /node_modules/foo/index.js === --exports.default = { bar() { return 0; } } -->exports.default : Symbol(default, Decl(index.js, 0, 0)) +@@= skipped -11, +11 lines =@@ + === /node_modules/foo/index.js === + exports.default = { bar() { return 0; } } + >exports.default : Symbol(default, Decl(index.js, 0, 0)) ->exports : Symbol(default, Decl(index.js, 0, 0)) -->default : Symbol(default, Decl(index.js, 0, 0)) -->bar : Symbol(bar, Decl(index.js, 0, 19)) ++>exports : Symbol("/node_modules/foo/index", Decl(index.js, 0, 0)) + >default : Symbol(default, Decl(index.js, 0, 0)) + >bar : Symbol(bar, Decl(index.js, 0, 19)) diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types index 097d7fa7f1..0dbb57e504 100644 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types +++ b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types @@ -2,11 +2,21 @@ === /a.ts === import foo from "foo"; ->foo : any +>foo : { bar(): number; } foo.bar(); ->foo.bar() : any ->foo.bar : any ->foo : any ->bar : any +>foo.bar() : number +>foo.bar : () => number +>foo : { bar(): number; } +>bar : () => number + +=== /node_modules/foo/index.js === +exports.default = { bar() { return 0; } } +>exports.default = { bar() { return 0; } } : { bar(): number; } +>exports.default : { bar(): number; } +>exports : typeof import("foo") +>default : { bar(): number; } +>{ bar() { return 0; } } : { bar(): number; } +>bar : () => number +>0 : 0 diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types.diff b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types.diff deleted file mode 100644 index 2cc89eac90..0000000000 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.untypedModuleImport_allowJs.types -+++ new.untypedModuleImport_allowJs.types -@@= skipped -1, +1 lines =@@ - - === /a.ts === - import foo from "foo"; -->foo : { bar(): number; } -+>foo : any - - foo.bar(); -->foo.bar() : number -->foo.bar : () => number -->foo : { bar(): number; } -->bar : () => number -- --=== /node_modules/foo/index.js === --exports.default = { bar() { return 0; } } -->exports.default = { bar() { return 0; } } : { bar(): number; } -->exports.default : { bar(): number; } -->exports : typeof import("/node_modules/foo/index") -->default : { bar(): number; } -->{ bar() { return 0; } } : { bar(): number; } -->bar : () => number -->0 : 0 -+>foo.bar() : any -+>foo.bar : any -+>foo : any -+>bar : any diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt deleted file mode 100644 index b70c00d167..0000000000 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -use.js(1,18): error TS7016: Could not find a declaration file for module './ex'. 'ex.js' implicitly has an 'any' type. - - -==== use.js (1 errors) ==== - var ex = require('./ex') - ~~~~~~ -!!! error TS7016: Could not find a declaration file for module './ex'. 'ex.js' implicitly has an 'any' type. - - // values work - var crunch = new ex.Crunch(1); - crunch.n - - - // types work - /** - * @param {ex.Crunch} wrap - */ - function f(wrap) { - wrap.n - } - -==== ex.js (0 errors) ==== - export class Crunch { - /** @param {number} n */ - constructor(n) { - this.n = n - } - m() { - return this.n - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols index 78f0125a3f..5bd7b88632 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols @@ -4,14 +4,19 @@ var ex = require('./ex') >ex : Symbol(ex, Decl(use.js, 0, 3)) >require : Symbol(require) +>'./ex' : Symbol("ex", Decl(ex.js, 0, 0)) // values work var crunch = new ex.Crunch(1); >crunch : Symbol(crunch, Decl(use.js, 3, 3)) +>ex.Crunch : Symbol(Crunch, Decl(ex.js, 0, 0)) >ex : Symbol(ex, Decl(use.js, 0, 3)) +>Crunch : Symbol(Crunch, Decl(ex.js, 0, 0)) crunch.n +>crunch.n : Symbol(n, Decl(ex.js, 2, 20)) >crunch : Symbol(crunch, Decl(use.js, 3, 3)) +>n : Symbol(n, Decl(ex.js, 2, 20)) // types work @@ -23,6 +28,32 @@ function f(wrap) { >wrap : Symbol(wrap, Decl(use.js, 11, 11)) wrap.n +>wrap.n : Symbol(n, Decl(ex.js, 2, 20)) >wrap : Symbol(wrap, Decl(use.js, 11, 11)) +>n : Symbol(n, Decl(ex.js, 2, 20)) +} + +=== ex.js === +export class Crunch { +>Crunch : Symbol(Crunch, Decl(ex.js, 0, 0)) + + /** @param {number} n */ + constructor(n) { +>n : Symbol(n, Decl(ex.js, 2, 16)) + + this.n = n +>this.n : Symbol(n, Decl(ex.js, 2, 20)) +>this : Symbol(Crunch, Decl(ex.js, 0, 0)) +>n : Symbol(n, Decl(ex.js, 2, 20)) +>n : Symbol(n, Decl(ex.js, 2, 16)) + } + m() { +>m : Symbol(m, Decl(ex.js, 4, 5)) + + return this.n +>this.n : Symbol(n, Decl(ex.js, 2, 20)) +>this : Symbol(Crunch, Decl(ex.js, 0, 0)) +>n : Symbol(n, Decl(ex.js, 2, 20)) + } } diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols.diff b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols.diff index f50187c503..1a5c6f6d64 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols.diff @@ -5,50 +5,58 @@ >ex : Symbol(ex, Decl(use.js, 0, 3)) >require : Symbol(require) ->'./ex' : Symbol(ex, Decl(ex.js, 0, 0)) ++>'./ex' : Symbol("ex", Decl(ex.js, 0, 0)) // values work var crunch = new ex.Crunch(1); >crunch : Symbol(crunch, Decl(use.js, 3, 3)) ->ex.Crunch : Symbol(ex.Crunch, Decl(ex.js, 0, 0)) ++>ex.Crunch : Symbol(Crunch, Decl(ex.js, 0, 0)) >ex : Symbol(ex, Decl(use.js, 0, 3)) ->Crunch : Symbol(ex.Crunch, Decl(ex.js, 0, 0)) ++>Crunch : Symbol(Crunch, Decl(ex.js, 0, 0)) crunch.n ->crunch.n : Symbol(ex.Crunch.n, Decl(ex.js, 2, 20)) ++>crunch.n : Symbol(n, Decl(ex.js, 2, 20)) >crunch : Symbol(crunch, Decl(use.js, 3, 3)) ->n : Symbol(ex.Crunch.n, Decl(ex.js, 2, 20)) ++>n : Symbol(n, Decl(ex.js, 2, 20)) // types work -@@= skipped -24, +19 lines =@@ +@@= skipped -24, +24 lines =@@ >wrap : Symbol(wrap, Decl(use.js, 11, 11)) wrap.n ->wrap.n : Symbol(ex.Crunch.n, Decl(ex.js, 2, 20)) ++>wrap.n : Symbol(n, Decl(ex.js, 2, 20)) >wrap : Symbol(wrap, Decl(use.js, 11, 11)) ->n : Symbol(ex.Crunch.n, Decl(ex.js, 2, 20)) --} -- --=== ex.js === --export class Crunch { -->Crunch : Symbol(Crunch, Decl(ex.js, 0, 0)) -- -- /** @param {number} n */ -- constructor(n) { -->n : Symbol(n, Decl(ex.js, 2, 16)) -- -- this.n = n ++>n : Symbol(n, Decl(ex.js, 2, 20)) + } + + === ex.js === +@@= skipped -14, +14 lines =@@ + >n : Symbol(n, Decl(ex.js, 2, 16)) + + this.n = n ->this.n : Symbol(Crunch.n, Decl(ex.js, 2, 20)) -->this : Symbol(Crunch, Decl(ex.js, 0, 0)) ++>this.n : Symbol(n, Decl(ex.js, 2, 20)) + >this : Symbol(Crunch, Decl(ex.js, 0, 0)) ->n : Symbol(Crunch.n, Decl(ex.js, 2, 20)) -->n : Symbol(n, Decl(ex.js, 2, 16)) -- } -- m() { ++>n : Symbol(n, Decl(ex.js, 2, 20)) + >n : Symbol(n, Decl(ex.js, 2, 16)) + } + m() { ->m : Symbol(Crunch.m, Decl(ex.js, 4, 5)) -- -- return this.n ++>m : Symbol(m, Decl(ex.js, 4, 5)) + + return this.n ->this.n : Symbol(Crunch.n, Decl(ex.js, 2, 20)) -->this : Symbol(Crunch, Decl(ex.js, 0, 0)) ++>this.n : Symbol(n, Decl(ex.js, 2, 20)) + >this : Symbol(Crunch, Decl(ex.js, 0, 0)) ->n : Symbol(Crunch.n, Decl(ex.js, 2, 20)) -- } ++>n : Symbol(n, Decl(ex.js, 2, 20)) + } } diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.types b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.types index cc1971a387..7ce58f2f6a 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.types +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.types @@ -2,24 +2,24 @@ === use.js === var ex = require('./ex') ->ex : any ->require('./ex') : any +>ex : typeof ex +>require('./ex') : typeof ex >require : any >'./ex' : "./ex" // values work var crunch = new ex.Crunch(1); ->crunch : any ->new ex.Crunch(1) : any ->ex.Crunch : any ->ex : any ->Crunch : any +>crunch : ex.Crunch +>new ex.Crunch(1) : ex.Crunch +>ex.Crunch : typeof ex.Crunch +>ex : typeof ex +>Crunch : typeof ex.Crunch >1 : 1 crunch.n ->crunch.n : any ->crunch : any ->n : any +>crunch.n : number +>crunch : ex.Crunch +>n : number // types work @@ -31,8 +31,33 @@ function f(wrap) { >wrap : ex.Crunch wrap.n ->wrap.n : any +>wrap.n : number >wrap : ex.Crunch ->n : any +>n : number +} + +=== ex.js === +export class Crunch { +>Crunch : Crunch + + /** @param {number} n */ + constructor(n) { +>n : number + + this.n = n +>this.n = n : number +>this.n : number +>this : this +>n : number +>n : number + } + m() { +>m : () => number + + return this.n +>this.n : number +>this : this +>n : number + } } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff index 2345abc46d..684cecfc56 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff @@ -6,8 +6,8 @@ const _item = require("./namespacer"); ->_item : typeof _item ->require("./namespacer") : typeof _item -+>_item : any -+>require("./namespacer") : any ++>_item : { NS: { bar: typeof Q; }; } ++>require("./namespacer") : { NS: { bar: typeof Q; }; } >require : any >"./namespacer" : "./namespacer" @@ -33,58 +33,79 @@ >"exports" : "exports" >{ value: "oh no" } : { value: string; } >value : string - >"oh no" : "oh no" -- --=== namespacey.js === --const A = {} +@@= skipped -25, +25 lines =@@ + + === namespacey.js === + const A = {} ->A : typeof A ->{} : {} -- --A.bar = class Q {} -->A.bar = class Q {} : typeof Q -->A.bar : typeof Q ++>A : { bar: typeof Q; } ++>{} : { bar: typeof Q; } + + A.bar = class Q {} + >A.bar = class Q {} : typeof Q + >A.bar : typeof Q ->A : typeof A -->bar : typeof Q -->class Q {} : typeof Q -->Q : typeof Q -- --module.exports = A; ++>A : { bar: typeof Q; } + >bar : typeof Q + >class Q {} : typeof Q + >Q : typeof Q + + module.exports = A; ->module.exports = A : typeof A ->module.exports : typeof A ->module : { exports: typeof A; } ->exports : typeof A ->A : typeof A -- --=== namespacer.js === --const B = {} ++>module.exports = A : { bar: typeof Q; } ++>module.exports : { bar: typeof Q; } ++>module : { readonly A: { bar: typeof Q; }; } ++>exports : { bar: typeof Q; } ++>A : { bar: typeof Q; } + + === namespacer.js === + const B = {} ->B : typeof B ->{} : {} -- --B.NS = require("./namespacey"); ++>B : { NS: { bar: typeof Q; }; } ++>{} : { NS: { bar: typeof Q; }; } + + B.NS = require("./namespacey"); ->B.NS = require("./namespacey") : typeof A ->B.NS : string | typeof A ->B : typeof B ->NS : string | typeof A ->require("./namespacey") : typeof A -->require : any -->"./namespacey" : "./namespacey" -- --Object.defineProperty(B, "NS", { value: "why though", writable: true }); ++>B.NS = require("./namespacey") : { bar: typeof Q; } ++>B.NS : { bar: typeof Q; } ++>B : { NS: { bar: typeof Q; }; } ++>NS : { bar: typeof Q; } ++>require("./namespacey") : { bar: typeof Q; } + >require : any + >"./namespacey" : "./namespacey" + + Object.defineProperty(B, "NS", { value: "why though", writable: true }); ->Object.defineProperty(B, "NS", { value: "why though", writable: true }) : typeof B -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(B, "NS", { value: "why though", writable: true }) : { NS: { bar: typeof Q; }; } + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->B : typeof B -->"NS" : "NS" -->{ value: "why though", writable: true } : { value: string; writable: true; } -->value : string -->"why though" : "why though" -->writable : true -->true : true -- --module.exports = B; ++>B : { NS: { bar: typeof Q; }; } + >"NS" : "NS" + >{ value: "why though", writable: true } : { value: string; writable: true; } + >value : string +@@= skipped -46, +46 lines =@@ + >true : true + + module.exports = B; ->module.exports = B : typeof B ->module.exports : typeof B ->module : { exports: typeof B; } ->exports : typeof B ->B : typeof B ++>module.exports = B : { NS: { bar: typeof Q; }; } ++>module.exports : { NS: { bar: typeof Q; }; } ++>module : { readonly B: { NS: { bar: typeof Q; }; }; } ++>exports : { NS: { bar: typeof Q; }; } ++>B : { NS: { bar: typeof Q; }; } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.errors.txt.diff new file mode 100644 index 0000000000..708fd18a67 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.errors.txt.diff @@ -0,0 +1,54 @@ +--- old.jsEnumTagOnObjectFrozen.errors.txt ++++ new.jsEnumTagOnObjectFrozen.errors.txt +@@= skipped -0, +0 lines =@@ +- ++index.js(10,12): error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? ++index.js(17,16): error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? ++ ++ ++==== usage.js (0 errors) ==== ++ const { Thing, useThing, cbThing } = require("./index"); ++ ++ useThing(Thing.a); ++ ++ /** ++ * @typedef {Object} LogEntry ++ * @property {string} type ++ * @property {number} time ++ */ ++ ++ cbThing(type => { ++ /** @type {LogEntry} */ ++ const logEntry = { ++ time: Date.now(), ++ type, ++ }; ++ }); ++ ++==== index.js (2 errors) ==== ++ /** @enum {string} */ ++ const Thing = Object.freeze({ ++ a: "thing", ++ b: "chill" ++ }); ++ ++ exports.Thing = Thing; ++ ++ /** ++ * @param {Thing} x ++ ~~~~~ ++!!! error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? ++ */ ++ function useThing(x) {} ++ ++ exports.useThing = useThing; ++ ++ /** ++ * @param {(x: Thing) => void} x ++ ~~~~~ ++!!! error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? ++ */ ++ function cbThing(x) {} ++ ++ exports.cbThing = cbThing; ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff index 5fdb418e13..8ba89ee226 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff @@ -1,116 +1,81 @@ --- old.jsEnumTagOnObjectFrozen.types +++ new.jsEnumTagOnObjectFrozen.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const { Thing, useThing, cbThing } = require("./index"); -->Thing : Readonly<{ a: "thing"; b: "chill"; }> -->useThing : (x: Thing) => void -->cbThing : (x: (x: Thing) => void) => void +@@= skipped -4, +4 lines =@@ + >Thing : Readonly<{ a: "thing"; b: "chill"; }> + >useThing : (x: Thing) => void + >cbThing : (x: (x: Thing) => void) => void ->require("./index") : typeof import("index") -+>Thing : any -+>useThing : any -+>cbThing : any -+>require("./index") : any ++>require("./index") : typeof import("./index") >require : any >"./index" : "./index" - useThing(Thing.a); -->useThing(Thing.a) : void -->useThing : (x: Thing) => void -->Thing.a : "thing" -->Thing : Readonly<{ a: "thing"; b: "chill"; }> -->a : "thing" -+>useThing(Thing.a) : any -+>useThing : any -+>Thing.a : any -+>Thing : any -+>a : any - - /** - * @typedef {Object} LogEntry -@@= skipped -21, +21 lines =@@ - */ - +@@= skipped -20, +20 lines =@@ cbThing(type => { -->cbThing(type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };}) : void -->cbThing : (x: (x: Thing) => void) => void + >cbThing(type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };}) : void + >cbThing : (x: (x: Thing) => void) => void ->type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };} : (type: string) => void ->type : string -+>cbThing(type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };}) : any -+>cbThing : any -+>type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };} : (type: any) => void -+>type : any ++>type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };} : (type: Thing) => void ++>type : Thing /** @type {LogEntry} */ const logEntry = { >logEntry : LogEntry ->{ time: Date.now(), type, } : { time: number; type: string; } -+>{ time: Date.now(), type, } : { time: number; type: any; } ++>{ time: Date.now(), type, } : { time: number; type: Thing; } time: Date.now(), >time : number -@@= skipped -18, +18 lines =@@ +@@= skipped -16, +16 lines =@@ >now : () => number type, ->type : string -+>type : any ++>type : Thing }; }); -- --=== index.js === --/** @enum {string} */ --const Thing = Object.freeze({ -->Thing : Readonly<{ a: "thing"; b: "chill"; }> -->Object.freeze({ a: "thing", b: "chill"}) : Readonly<{ a: "thing"; b: "chill"; }> +@@= skipped -10, +10 lines =@@ + const Thing = Object.freeze({ + >Thing : Readonly<{ a: "thing"; b: "chill"; }> + >Object.freeze({ a: "thing", b: "chill"}) : Readonly<{ a: "thing"; b: "chill"; }> ->Object.freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } -->Object : ObjectConstructor ++>Object.freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } + >Object : ObjectConstructor ->freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } -->{ a: "thing", b: "chill"} : { a: "thing"; b: "chill"; } -- -- a: "thing", -->a : "thing" -->"thing" : "thing" -- -- b: "chill" -->b : "chill" -->"chill" : "chill" -- --}); -- --exports.Thing = Thing; -->exports.Thing = Thing : Readonly<{ a: "thing"; b: "chill"; }> -->exports.Thing : Readonly<{ a: "thing"; b: "chill"; }> ++>freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } + >{ a: "thing", b: "chill"} : { a: "thing"; b: "chill"; } + + a: "thing", +@@= skipped -18, +18 lines =@@ + exports.Thing = Thing; + >exports.Thing = Thing : Readonly<{ a: "thing"; b: "chill"; }> + >exports.Thing : Readonly<{ a: "thing"; b: "chill"; }> ->exports : typeof import("index") -->Thing : Readonly<{ a: "thing"; b: "chill"; }> -->Thing : Readonly<{ a: "thing"; b: "chill"; }> -- --/** -- * @param {Thing} x -- */ --function useThing(x) {} -->useThing : (x: Thing) => void ++>exports : typeof import(".") + >Thing : Readonly<{ a: "thing"; b: "chill"; }> + >Thing : Readonly<{ a: "thing"; b: "chill"; }> + +@@= skipped -9, +9 lines =@@ + */ + function useThing(x) {} + >useThing : (x: Thing) => void ->x : string -- --exports.useThing = useThing; -->exports.useThing = useThing : (x: Thing) => void -->exports.useThing : (x: Thing) => void ++>x : Thing + + exports.useThing = useThing; + >exports.useThing = useThing : (x: Thing) => void + >exports.useThing : (x: Thing) => void ->exports : typeof import("index") -->useThing : (x: Thing) => void -->useThing : (x: Thing) => void -- --/** -- * @param {(x: Thing) => void} x -- */ --function cbThing(x) {} -->cbThing : (x: (x: Thing) => void) => void -->x : (x: Thing) => void -- --exports.cbThing = cbThing; -->exports.cbThing = cbThing : (x: (x: Thing) => void) => void -->exports.cbThing : (x: (x: Thing) => void) => void ++>exports : typeof import(".") + >useThing : (x: Thing) => void + >useThing : (x: Thing) => void + +@@= skipped -19, +19 lines =@@ + exports.cbThing = cbThing; + >exports.cbThing = cbThing : (x: (x: Thing) => void) => void + >exports.cbThing : (x: (x: Thing) => void) => void ->exports : typeof import("index") -->cbThing : (x: (x: Thing) => void) => void -->cbThing : (x: (x: Thing) => void) => void ++>exports : typeof import(".") + >cbThing : (x: (x: Thing) => void) => void + >cbThing : (x: (x: Thing) => void) => void diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff index 114c264911..fe7011b1d5 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff @@ -2,17 +2,13 @@ +++ new.moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt @@= skipped -0, +0 lines =@@ - -+eslint.config.js(1,29): error TS7016: Could not find a declaration file for module './eslint-plugin-react.js'. 'eslint-plugin-react.js' implicitly has an 'any' type. -+eslint.config.js(2,26): error TS7016: Could not find a declaration file for module './typescript-eslint.js'. 'typescript-eslint.js' implicitly has an 'any' type. ++typescript-eslint.js(12,17): error TS7019: Rest parameter 'configs' implicitly has an 'any[]' type. ++typescript-eslint.js(14,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== eslint.config.js (2 errors) ==== ++==== eslint.config.js (0 errors) ==== + const eslintReact = require('./eslint-plugin-react.js'); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './eslint-plugin-react.js'. 'eslint-plugin-react.js' implicitly has an 'any' type. + const tseslint = require('./typescript-eslint.js'); -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './typescript-eslint.js'. 'typescript-eslint.js' implicitly has an 'any' type. + + tseslint.config(eslintReact) + @@ -34,7 +30,7 @@ + }, + }; + -+==== typescript-eslint.js (0 errors) ==== ++==== typescript-eslint.js (2 errors) ==== + /** + * @typedef {{ rules: Record }} Plugin + */ @@ -47,6 +43,10 @@ + * @type {(...configs: Config[]) => void} + */ + function config(...configs) { } ++ ~~~~~~~~~~ ++!!! error TS7019: Rest parameter 'configs' implicitly has an 'any[]' type. + + module.exports = { config }; ++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types.diff index 471376b418..215c288fd9 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types.diff @@ -6,96 +6,100 @@ const eslintReact = require('./eslint-plugin-react.js'); ->eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } ->require('./eslint-plugin-react.js') : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } -+>eslintReact : any -+>require('./eslint-plugin-react.js') : any ++>eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } ++>require('./eslint-plugin-react.js') : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } >require : any >'./eslint-plugin-react.js' : "./eslint-plugin-react.js" const tseslint = require('./typescript-eslint.js'); ->tseslint : typeof tseslint ->require('./typescript-eslint.js') : typeof tseslint -+>tseslint : any -+>require('./typescript-eslint.js') : any ++>tseslint : { config: (...configs: any[]) => void; } ++>require('./typescript-eslint.js') : { config: (...configs: any[]) => void; } >require : any >'./typescript-eslint.js' : "./typescript-eslint.js" tseslint.config(eslintReact) -->tseslint.config(eslintReact) : void + >tseslint.config(eslintReact) : void ->tseslint.config : (...configs: Config[]) => void ->tseslint : typeof tseslint ->config : (...configs: Config[]) => void ->eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } -- --=== eslint-plugin-react.js === --const deprecatedRules = { -->deprecatedRules : { "jsx-sort-default-props": boolean; } -->{ "jsx-sort-default-props": true} : { "jsx-sort-default-props": boolean; } -- -- "jsx-sort-default-props": true -->"jsx-sort-default-props" : boolean -->true : true --} -- --const allRules = { ++>tseslint.config : (...configs: any[]) => void ++>tseslint : { config: (...configs: any[]) => void; } ++>config : (...configs: any[]) => void ++>eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } + + === eslint-plugin-react.js === + const deprecatedRules = { +@@= skipped -29, +29 lines =@@ + } + + const allRules = { ->allRules : { 'no-unsafe': boolean; } ->{ 'no-unsafe': true} : { 'no-unsafe': boolean; } -- -- 'no-unsafe': true -->'no-unsafe' : boolean -->true : true --} -- --module.exports = { ++>allRules : { "no-unsafe": boolean; } ++>{ 'no-unsafe': true} : { "no-unsafe": boolean; } + + 'no-unsafe': true + >'no-unsafe' : boolean +@@= skipped -9, +9 lines =@@ + } + + module.exports = { ->module.exports = { plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } ->module.exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } ->module : { exports: { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; }; } ->exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } ->{ plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } -- -- plugins: { ++>module.exports = { plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } ++>module.exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } ++>module : { "export=": { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; }; } ++>exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } ++>{ plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } + + plugins: { ->plugins : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; } ->{ react: { deprecatedRules, rules: allRules, }, } : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; } -- -- react: { ++>plugins : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; } ++>{ react: { deprecatedRules, rules: allRules, }, } : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; } + + react: { ->react : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; } ->{ deprecatedRules, rules: allRules, } : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; } -- -- deprecatedRules, -->deprecatedRules : { "jsx-sort-default-props": boolean; } -- -- rules: allRules, ++>react : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; } ++>{ deprecatedRules, rules: allRules, } : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; } + + deprecatedRules, + >deprecatedRules : { "jsx-sort-default-props": boolean; } + + rules: allRules, ->rules : { 'no-unsafe': boolean; } ->allRules : { 'no-unsafe': boolean; } -- -- }, -- }, --}; -- --=== typescript-eslint.js === --/** -- * @typedef {{ rules: Record }} Plugin -- */ -- --/** -- * @typedef {{ plugins: Record }} Config -- */ -- --/** -- * @type {(...configs: Config[]) => void} -- */ --function config(...configs) { } ++>rules : { "no-unsafe": boolean; } ++>allRules : { "no-unsafe": boolean; } + + }, + }, +@@= skipped -38, +38 lines =@@ + * @type {(...configs: Config[]) => void} + */ + function config(...configs) { } ->config : (...configs: Config[]) => void ->configs : Config[] -- --module.exports = { config }; ++>config : (...configs: any[]) => void ++>configs : any[] + + module.exports = { config }; ->module.exports = { config } : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->{ config } : { config: (...configs: Config[]) => void; } ->config : (...configs: Config[]) => void -+>tseslint.config(eslintReact) : any -+>tseslint.config : any -+>tseslint : any -+>config : any -+>eslintReact : any ++>module.exports = { config } : { config: (...configs: any[]) => void; } ++>module.exports : { config: (...configs: any[]) => void; } ++>module : { "export=": { config: (...configs: any[]) => void; }; } ++>exports : { config: (...configs: any[]) => void; } ++>{ config } : { config: (...configs: any[]) => void; } ++>config : (...configs: any[]) => void diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_explicitNodeModulesImport.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_explicitNodeModulesImport.types.diff new file mode 100644 index 0000000000..fb8b338167 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_explicitNodeModulesImport.types.diff @@ -0,0 +1,10 @@ +--- old.moduleResolution_explicitNodeModulesImport.types ++++ new.moduleResolution_explicitNodeModulesImport.types +@@= skipped -7, +7 lines =@@ + exports.x = 0; + >exports.x = 0 : 0 + >exports.x : 0 +->exports : typeof import("/node_modules/foo/index") ++>exports : typeof import("foo") + >x : 0 + >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.errors.txt.diff deleted file mode 100644 index 590534a253..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.requireOfJsonFileInJsFile.errors.txt -+++ new.requireOfJsonFileInJsFile.errors.txt -@@= skipped -0, +0 lines =@@ - /user.js(2,7): error TS2339: Property 'b' does not exist on type '{ a: number; }'. - /user.js(5,7): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: number; }'. -+/user.js(8,21): error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. - /user.js(9,7): error TS2339: Property 'b' does not exist on type '{ a: number; }'. --/user.js(12,7): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: number; }'. -- -- --==== /user.js (4 errors) ==== -+/user.js(12,21): error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. -+ -+ -+==== /user.js (5 errors) ==== - const json0 = require("./json.json"); - json0.b; // Error (good) - ~ -@@= skipped -17, +18 lines =@@ - json1.b; // No error (OK since that's the type annotation) - - const js0 = require("./js.js"); -+ ~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. - json0.b; // Error (good) - ~ - !!! error TS2339: Property 'b' does not exist on type '{ a: number; }'. - - /** @type {{ b: number }} */ - const js1 = require("./js.js"); // Error (good) -- ~~~ --!!! error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: number; }'. --!!! related TS2728 /user.js:11:14: 'b' is declared here. -+ ~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. - js1.b; - ==== /json.json (0 errors) ==== - { "a": 0 } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.types.diff index d9bb934eb9..e15d915b06 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.types.diff @@ -1,37 +1,11 @@ --- old.requireOfJsonFileInJsFile.types +++ new.requireOfJsonFileInJsFile.types -@@= skipped -24, +24 lines =@@ - >b : number - - const js0 = require("./js.js"); -->js0 : { a: number; } -->require("./js.js") : { a: number; } -+>js0 : any -+>require("./js.js") : any - >require : any - >"./js.js" : "./js.js" - -@@= skipped -13, +13 lines =@@ - /** @type {{ b: number }} */ - const js1 = require("./js.js"); // Error (good) - >js1 : { b: number; } -->require("./js.js") : { a: number; } -+>require("./js.js") : any - >require : any - >"./js.js" : "./js.js" - -@@= skipped -13, +13 lines =@@ - { "a": 0 } - >{ "a": 0 } : { a: number; } - >"a" : number -->0 : 0 -- --=== /js.js === --module.exports = { a: 0 }; -->module.exports = { a: 0 } : { a: number; } -->module.exports : { a: number; } +@@= skipped -56, +56 lines =@@ + module.exports = { a: 0 }; + >module.exports = { a: 0 } : { a: number; } + >module.exports : { a: number; } ->module : { exports: { a: number; }; } -->exports : { a: number; } -->{ a: 0 } : { a: number; } -->a : number - >0 : 0 ++>module : { "export=": { a: number; }; } + >exports : { a: number; } + >{ a: 0 } : { a: number; } + >a : number \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.errors.txt.diff index 0215265570..a22e977b2c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.errors.txt.diff @@ -3,19 +3,19 @@ @@= skipped -0, +0 lines =@@ -use.js(5,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -use.js(6,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -- -- --==== use.js (2 errors) ==== -+use.js(2,19): error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. -+ -+ -+==== use.js (1 errors) ==== ++use.js(3,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ++use.js(4,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. + + + ==== use.js (2 errors) ==== /// var mod = require('./mod'); -+ ~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. var a = new mod.A() ++ ~~~~~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. var b = new mod.B() ++ ~~~~~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. a.m('nope') - ~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.types.diff index 56f0b6cfa1..850f92019d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.types.diff @@ -1,39 +1,29 @@ --- old.chainedPrototypeAssignment.types +++ new.chainedPrototypeAssignment.types -@@= skipped -2, +2 lines =@@ - === use.js === - /// - var mod = require('./mod'); -->mod : typeof mod -->require('./mod') : typeof mod -+>mod : any -+>require('./mod') : any - >require : (name: string) => any +@@= skipped -8, +8 lines =@@ >'./mod' : "./mod" var a = new mod.A() ->a : A ->new mod.A() : A ->mod.A : typeof A -->mod : typeof mod -->A : typeof A +>a : any +>new mod.A() : any -+>mod.A : any -+>mod : any -+>A : any ++>mod.A : { (): void; prototype: { m(n: number): number; }; } + >mod : typeof mod +->A : typeof A ++>A : { (): void; prototype: { m(n: number): number; }; } var b = new mod.B() ->b : B ->new mod.B() : B ->mod.B : typeof B -->mod : typeof mod -->B : typeof B +>b : any +>new mod.B() : any -+>mod.B : any -+>mod : any -+>B : any ++>mod.B : { (): void; prototype: { m(n: number): number; }; } + >mod : typeof mod +->B : typeof B ++>B : { (): void; prototype: { m(n: number): number; }; } a.m('nope') ->a.m('nope') : number @@ -58,70 +48,74 @@ >'not really' : "not really" === types.d.ts === -@@= skipped -40, +40 lines =@@ - - declare var exports: any; - >exports : any -- --=== mod.js === --/// --var A = function A() { +@@= skipped -38, +38 lines =@@ + === mod.js === + /// + var A = function A() { ->A : typeof A ->function A() { this.a = 1} : typeof A ->A : typeof A -- -- this.a = 1 -->this.a = 1 : 1 -->this.a : any ++>A : { (): void; prototype: { m(n: number): number; }; } ++>function A() { this.a = 1} : { (): void; prototype: { m(n: number): number; }; } ++>A : { (): void; prototype: { m(n: number): number; }; } + + this.a = 1 + >this.a = 1 : 1 + >this.a : any ->this : this -->a : any -->1 : 1 --} --var B = function B() { ++>this : any + >a : any + >1 : 1 + } + var B = function B() { ->B : typeof B ->function B() { this.b = 2} : typeof B ->B : typeof B -- -- this.b = 2 -->this.b = 2 : 2 -->this.b : any ++>B : { (): void; prototype: { m(n: number): number; }; } ++>function B() { this.b = 2} : { (): void; prototype: { m(n: number): number; }; } ++>B : { (): void; prototype: { m(n: number): number; }; } + + this.b = 2 + >this.b = 2 : 2 + >this.b : any ->this : this -->b : any -->2 : 2 --} --exports.A = A ++>this : any + >b : any + >2 : 2 + } + exports.A = A ->exports.A = A : typeof A ->exports.A : typeof A ->exports : typeof import("mod") ->A : typeof A ->A : typeof A -- --exports.B = B ++>exports.A = A : { (): void; prototype: { m(n: number): number; }; } ++>exports.A : { (): void; prototype: { m(n: number): number; }; } ++>exports : typeof import("./mod") ++>A : { (): void; prototype: { m(n: number): number; }; } ++>A : { (): void; prototype: { m(n: number): number; }; } + + exports.B = B ->exports.B = B : typeof B ->exports.B : typeof B ->exports : typeof import("mod") ->B : typeof B ->B : typeof B -- --A.prototype = B.prototype = { -->A.prototype = B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } -->A.prototype : { m(n: number): number; } ++>exports.B = B : { (): void; prototype: { m(n: number): number; }; } ++>exports.B : { (): void; prototype: { m(n: number): number; }; } ++>exports : typeof import("./mod") ++>B : { (): void; prototype: { m(n: number): number; }; } ++>B : { (): void; prototype: { m(n: number): number; }; } + + A.prototype = B.prototype = { + >A.prototype = B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } + >A.prototype : { m(n: number): number; } ->A : typeof A -->prototype : { m(n: number): number; } -->B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } -->B.prototype : { m(n: number): number; } ++>A : { (): void; prototype: { m(n: number): number; }; } + >prototype : { m(n: number): number; } + >B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } + >B.prototype : { m(n: number): number; } ->B : typeof B -->prototype : { m(n: number): number; } -->{ /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } -- -- /** @param {number} n */ -- m(n) { -->m : (n: number) => number -->n : number -- -- return n + 1 -->n + 1 : number -->n : number -->1 : 1 -- } --} ++>B : { (): void; prototype: { m(n: number): number; }; } + >prototype : { m(n: number): number; } + >{ /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignProperty.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignProperty.errors.txt.diff new file mode 100644 index 0000000000..4d70a6774c --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignProperty.errors.txt.diff @@ -0,0 +1,147 @@ +--- old.checkExportsObjectAssignProperty.errors.txt ++++ new.checkExportsObjectAssignProperty.errors.txt +@@= skipped -0, +0 lines =@@ +-validator.ts(17,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. +-validator.ts(18,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. +-validator.ts(19,1): error TS2322: Type 'string' is not assignable to type 'number'. +-validator.ts(20,1): error TS2322: Type 'string' is not assignable to type 'number'. +-validator.ts(21,1): error TS2322: Type 'number' is not assignable to type 'string'. +-validator.ts(37,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. +-validator.ts(38,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. +-validator.ts(39,1): error TS2322: Type 'number' is not assignable to type 'string'. +-validator.ts(40,1): error TS2322: Type 'string' is not assignable to type 'number'. +-validator.ts(41,1): error TS2322: Type 'number' is not assignable to type 'string'. +- +- +-==== validator.ts (10 errors) ==== ++index.js(4,19): error TS2306: File 'mod1.js' is not a module. ++index.js(9,19): error TS2306: File 'mod2.js' is not a module. ++mod1.js(1,23): error TS2304: Cannot find name 'exports'. ++mod1.js(2,23): error TS2304: Cannot find name 'exports'. ++mod1.js(3,23): error TS2304: Cannot find name 'exports'. ++mod1.js(4,23): error TS2304: Cannot find name 'exports'. ++mod1.js(5,23): error TS2304: Cannot find name 'exports'. ++mod2.js(1,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++mod2.js(2,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++mod2.js(3,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++mod2.js(4,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++mod2.js(5,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++validator.ts(3,21): error TS2306: File 'mod1.js' is not a module. ++validator.ts(23,21): error TS2306: File 'mod2.js' is not a module. ++ ++ ++==== validator.ts (2 errors) ==== + import "./"; + + import m1 = require("./mod1"); ++ ~~~~~~~~ ++!!! error TS2306: File 'mod1.js' is not a module. + + m1.thing; + m1.readonlyProp; +@@= skipped -27, +33 lines =@@ + + // disallowed assignments + m1.readonlyProp = "name"; +- ~~~~~~~~~~~~ +-!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. + m1.readonlyAccessor = 12; +- ~~~~~~~~~~~~~~~~ +-!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. + m1.thing = "no"; +- ~~~~~~~~ +-!!! error TS2322: Type 'string' is not assignable to type 'number'. + m1.rwAccessors = "no"; +- ~~~~~~~~~~~~~~ +-!!! error TS2322: Type 'string' is not assignable to type 'number'. + m1.setonlyAccessor = 0; +- ~~~~~~~~~~~~~~~~~~ +-!!! error TS2322: Type 'number' is not assignable to type 'string'. + + import m2 = require("./mod2"); ++ ~~~~~~~~ ++!!! error TS2306: File 'mod2.js' is not a module. + + m2.thing; + m2.readonlyProp; +@@= skipped -30, +22 lines =@@ + + // disallowed assignments + m2.readonlyProp = "name"; +- ~~~~~~~~~~~~ +-!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. + m2.readonlyAccessor = 12; +- ~~~~~~~~~~~~~~~~ +-!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. + m2.thing = 0; +- ~~~~~~~~ +-!!! error TS2322: Type 'number' is not assignable to type 'string'. + m2.rwAccessors = "no"; +- ~~~~~~~~~~~~~~ +-!!! error TS2322: Type 'string' is not assignable to type 'number'. + m2.setonlyAccessor = 0; +- ~~~~~~~~~~~~~~~~~~ +-!!! error TS2322: Type 'number' is not assignable to type 'string'. + +-==== mod1.js (0 errors) ==== ++==== mod1.js (5 errors) ==== + Object.defineProperty(exports, "thing", { value: 42, writable: true }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + Object.defineProperty(exports, "setonlyAccessor", { ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + /** @param {string} str */ + set(str) { + this.rwAccessors = Number(str) + } + }); + +-==== mod2.js (0 errors) ==== ++==== mod2.js (5 errors) ==== + Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + Object.defineProperty(module.exports, "setonlyAccessor", { ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** @param {string} str */ + set(str) { + this.rwAccessors = Number(str) + } + }); + +-==== index.js (0 errors) ==== ++==== index.js (2 errors) ==== + /** + * @type {number} + */ + const q = require("./mod1").thing; ++ ~~~~~~~~ ++!!! error TS2306: File 'mod1.js' is not a module. + + /** + * @type {string} + */ + const u = require("./mod2").thing; ++ ~~~~~~~~ ++!!! error TS2306: File 'mod2.js' is not a module. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignProperty.types.diff similarity index 59% rename from testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.types.diff rename to testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignProperty.types.diff index da18dc7591..fa0ceaf4d7 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignProperty.types.diff @@ -246,188 +246,186 @@ +>m2 : any +>setonlyAccessor : any >0 : 0 -- --=== mod1.js === --Object.defineProperty(exports, "thing", { value: 42, writable: true }); + + === mod1.js === + Object.defineProperty(exports, "thing", { value: 42, writable: true }); ->Object.defineProperty(exports, "thing", { value: 42, writable: true }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "thing", { value: 42, writable: true }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"thing" : "thing" -->{ value: 42, writable: true } : { value: number; writable: true; } -->value : number -->42 : 42 -->writable : true -->true : true -- --Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); ++>exports : any + >"thing" : "thing" + >{ value: 42, writable: true } : { value: number; writable: true; } + >value : number +@@= skipped -186, +186 lines =@@ + >true : true + + Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); ->Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"readonlyProp" : "readonlyProp" -->{ value: "Smith", writable: false } : { value: string; writable: false; } -->value : string -->"Smith" : "Smith" -->writable : false -->false : false -- --Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++>exports : any + >"readonlyProp" : "readonlyProp" + >{ value: "Smith", writable: false } : { value: string; writable: false; } + >value : string +@@= skipped -13, +13 lines =@@ + >false : false + + Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ->Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"rwAccessors" : "rwAccessors" -->{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } -->get : () => number -->98122 : 98122 -->set : (_: any) => void -->_ : any -- --Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); ++>exports : any + >"rwAccessors" : "rwAccessors" + >{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } + >get : () => number +@@= skipped -13, +13 lines =@@ + >_ : any + + Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); ->Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"readonlyAccessor" : "readonlyAccessor" -->{ get() { return 21.75 } } : { get(): number; } -->get : () => number -->21.75 : 21.75 -- --Object.defineProperty(exports, "setonlyAccessor", { ++>exports : any + >"readonlyAccessor" : "readonlyAccessor" + >{ get() { return 21.75 } } : { get(): number; } + >get : () => number + >21.75 : 21.75 + + Object.defineProperty(exports, "setonlyAccessor", { ->Object.defineProperty(exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"setonlyAccessor" : "setonlyAccessor" -->{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } -- -- /** @param {string} str */ -- set(str) { -->set : (str: string) => void -->str : string -- -- this.rwAccessors = Number(str) -->this.rwAccessors = Number(str) : number -->this.rwAccessors : any -->this : any -->rwAccessors : any -->Number(str) : number -->Number : NumberConstructor -->str : string -- } --}); -- --=== mod2.js === --Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); ++>exports : any + >"setonlyAccessor" : "setonlyAccessor" + >{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } + +@@= skipped -37, +37 lines =@@ + + === mod2.js === + Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); ->Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }) : typeof module.exports -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->"thing" : "thing" -->{ value: "yes", writable: true } : { value: string; writable: true; } -->value : string -->"yes" : "yes" -->writable : true -->true : true -- --Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); ++>module.exports : any ++>module : any ++>exports : any + >"thing" : "thing" + >{ value: "yes", writable: true } : { value: string; writable: true; } + >value : string +@@= skipped -15, +15 lines =@@ + >true : true + + Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); ->Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }) : typeof module.exports -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->"readonlyProp" : "readonlyProp" -->{ value: "Smith", writable: false } : { value: string; writable: false; } -->value : string -->"Smith" : "Smith" -->writable : false -->false : false -- --Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++>module.exports : any ++>module : any ++>exports : any + >"readonlyProp" : "readonlyProp" + >{ value: "Smith", writable: false } : { value: string; writable: false; } + >value : string +@@= skipped -15, +15 lines =@@ + >false : false + + Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ->Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : typeof module.exports -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->"rwAccessors" : "rwAccessors" -->{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } -->get : () => number -->98122 : 98122 -->set : (_: any) => void -->_ : any -- --Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); ++>module.exports : any ++>module : any ++>exports : any + >"rwAccessors" : "rwAccessors" + >{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } + >get : () => number +@@= skipped -15, +15 lines =@@ + >_ : any + + Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); ->Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }) : typeof module.exports -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->"readonlyAccessor" : "readonlyAccessor" -->{ get() { return 21.75 } } : { get(): number; } -->get : () => number -->21.75 : 21.75 -- --Object.defineProperty(module.exports, "setonlyAccessor", { ++>module.exports : any ++>module : any ++>exports : any + >"readonlyAccessor" : "readonlyAccessor" + >{ get() { return 21.75 } } : { get(): number; } + >get : () => number + >21.75 : 21.75 + + Object.defineProperty(module.exports, "setonlyAccessor", { ->Object.defineProperty(module.exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : typeof module.exports -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(module.exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->"setonlyAccessor" : "setonlyAccessor" -->{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } -- -- /** @param {string} str */ -- set(str) { -->set : (str: string) => void -->str : string -- -- this.rwAccessors = Number(str) -->this.rwAccessors = Number(str) : number -->this.rwAccessors : any -->this : any -->rwAccessors : any -->Number(str) : number -->Number : NumberConstructor -->str : string -- } --}); -- --=== index.js === --/** -- * @type {number} -- */ --const q = require("./mod1").thing; -->q : number ++>module.exports : any ++>module : any ++>exports : any + >"setonlyAccessor" : "setonlyAccessor" + >{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } + +@@= skipped -45, +45 lines =@@ + */ + const q = require("./mod1").thing; + >q : number ->require("./mod1").thing : number ->require("./mod1") : typeof import("mod1") -->require : any -->"./mod1" : "./mod1" ++>require("./mod1").thing : any ++>require("./mod1") : any + >require : any + >"./mod1" : "./mod1" ->thing : number -- --/** -- * @type {string} -- */ --const u = require("./mod2").thing; -->u : string ++>thing : any + + /** + * @type {string} + */ + const u = require("./mod2").thing; + >u : string ->require("./mod2").thing : string ->require("./mod2") : typeof import("mod2") -->require : any -->"./mod2" : "./mod2" ++>require("./mod2").thing : any ++>require("./mod2") : any + >require : any + >"./mod2" : "./mod2" ->thing : string ++>thing : any diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt.diff similarity index 63% rename from testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt.diff rename to testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt.diff index 79793c3f2c..e79888a53e 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt.diff @@ -9,19 +9,22 @@ - - -==== validator.ts (5 errors) ==== -+validator.ts(3,25): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. ++mod1.js(6,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. ++validator.ts(5,12): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. + + +==== validator.ts (1 errors) ==== import "./"; import Person = require("./mod1"); -+ ~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. const m1 = new Person("Name") ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -@@= skipped -24, +22 lines =@@ + m1.thing; + m1.readonlyProp; +@@= skipped -24, +23 lines =@@ // disallowed assignments m1.readonlyProp = "name"; @@ -39,6 +42,20 @@ m1.setonlyAccessor = 0; - ~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - - - ==== mod1.js (0 errors) ==== \ No newline at end of file +- +- +-==== mod1.js (0 errors) ==== ++ ++ ++==== mod1.js (1 errors) ==== + /** + * @constructor + * @param {string} name + */ + function Person(name) { + this.name = name; ++ ~~~~ ++!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + } + Person.prototype.describe = function () { + return "Person called " + this.name; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.types.diff new file mode 100644 index 0000000000..987939191c --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.types.diff @@ -0,0 +1,246 @@ +--- old.checkExportsObjectAssignPrototypeProperty.types ++++ new.checkExportsObjectAssignPrototypeProperty.types +@@= skipped -3, +3 lines =@@ + import "./"; + + import Person = require("./mod1"); +->Person : typeof Person ++>Person : (name: string) => void + + const m1 = new Person("Name") +->m1 : Person +->new Person("Name") : Person +->Person : typeof Person ++>m1 : any ++>new Person("Name") : any ++>Person : (name: string) => void + >"Name" : "Name" + + m1.thing; +->m1.thing : number +->m1 : Person +->thing : number ++>m1.thing : any ++>m1 : any ++>thing : any + + m1.readonlyProp; +->m1.readonlyProp : string +->m1 : Person +->readonlyProp : string ++>m1.readonlyProp : any ++>m1 : any ++>readonlyProp : any + + m1.rwAccessors; +->m1.rwAccessors : number +->m1 : Person +->rwAccessors : number ++>m1.rwAccessors : any ++>m1 : any ++>rwAccessors : any + + m1.readonlyAccessor; +->m1.readonlyAccessor : number +->m1 : Person +->readonlyAccessor : number ++>m1.readonlyAccessor : any ++>m1 : any ++>readonlyAccessor : any + + m1.setonlyAccessor; +->m1.setonlyAccessor : string +->m1 : Person +->setonlyAccessor : string ++>m1.setonlyAccessor : any ++>m1 : any ++>setonlyAccessor : any + + // allowed assignments + m1.thing = 10; + >m1.thing = 10 : 10 +->m1.thing : number +->m1 : Person +->thing : number ++>m1.thing : any ++>m1 : any ++>thing : any + >10 : 10 + + m1.rwAccessors = 11; + >m1.rwAccessors = 11 : 11 +->m1.rwAccessors : number +->m1 : Person +->rwAccessors : number ++>m1.rwAccessors : any ++>m1 : any ++>rwAccessors : any + >11 : 11 + + m1.setonlyAccessor = "yes"; + >m1.setonlyAccessor = "yes" : "yes" +->m1.setonlyAccessor : string +->m1 : Person +->setonlyAccessor : string ++>m1.setonlyAccessor : any ++>m1 : any ++>setonlyAccessor : any + >"yes" : "yes" + + // disallowed assignments + m1.readonlyProp = "name"; + >m1.readonlyProp = "name" : "name" + >m1.readonlyProp : any +->m1 : Person ++>m1 : any + >readonlyProp : any + >"name" : "name" + + m1.readonlyAccessor = 12; + >m1.readonlyAccessor = 12 : 12 + >m1.readonlyAccessor : any +->m1 : Person ++>m1 : any + >readonlyAccessor : any + >12 : 12 + + m1.thing = "no"; + >m1.thing = "no" : "no" +->m1.thing : number +->m1 : Person +->thing : number ++>m1.thing : any ++>m1 : any ++>thing : any + >"no" : "no" + + m1.rwAccessors = "no"; + >m1.rwAccessors = "no" : "no" +->m1.rwAccessors : number +->m1 : Person +->rwAccessors : number ++>m1.rwAccessors : any ++>m1 : any ++>rwAccessors : any + >"no" : "no" + + m1.setonlyAccessor = 0; + >m1.setonlyAccessor = 0 : 0 +->m1.setonlyAccessor : string +->m1 : Person +->setonlyAccessor : string ++>m1.setonlyAccessor : any ++>m1 : any ++>setonlyAccessor : any + >0 : 0 + + +@@= skipped -98, +98 lines =@@ + * @param {string} name + */ + function Person(name) { +->Person : typeof Person ++>Person : (name: string) => void + >name : string + + this.name = name; + >this.name = name : string + >this.name : any +->this : this ++>this : any + >name : any + >name : string + } +@@= skipped -14, +14 lines =@@ + >Person.prototype.describe = function () { return "Person called " + this.name;} : () => string + >Person.prototype.describe : any + >Person.prototype : any +->Person : typeof Person ++>Person : (name: string) => void + >prototype : any + >describe : any + >function () { return "Person called " + this.name;} : () => string +@@= skipped -8, +8 lines =@@ + return "Person called " + this.name; + >"Person called " + this.name : string + >"Person called " : "Person called " +->this.name : string +->this : this +->name : string ++>this.name : any ++>this : any ++>name : any + + }; + Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); +@@= skipped -11, +11 lines =@@ + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Person.prototype : any +->Person : typeof Person ++>Person : (name: string) => void + >prototype : any + >"thing" : "thing" + >{ value: 42, writable: true } : { value: number; writable: true; } +@@= skipped -15, +15 lines =@@ + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Person.prototype : any +->Person : typeof Person ++>Person : (name: string) => void + >prototype : any + >"readonlyProp" : "readonlyProp" + >{ value: "Smith", writable: false } : { value: string; writable: false; } +@@= skipped -15, +15 lines =@@ + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Person.prototype : any +->Person : typeof Person ++>Person : (name: string) => void + >prototype : any + >"rwAccessors" : "rwAccessors" + >{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } +@@= skipped -15, +15 lines =@@ + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Person.prototype : any +->Person : typeof Person ++>Person : (name: string) => void + >prototype : any + >"readonlyAccessor" : "readonlyAccessor" + >{ get() { return 21.75 } } : { get(): number; } +@@= skipped -13, +13 lines =@@ + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Person.prototype : any +->Person : typeof Person ++>Person : (name: string) => void + >prototype : any + >"setonlyAccessor" : "setonlyAccessor" + >{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } +@@= skipped -12, +12 lines =@@ + + this.rwAccessors = Number(str) + >this.rwAccessors = Number(str) : number +->this.rwAccessors : number +->this : this +->rwAccessors : number ++>this.rwAccessors : any ++>this : any ++>rwAccessors : any + >Number(str) : number + >Number : NumberConstructor + >str : string + } + }); + module.exports = Person; +->module.exports = Person : typeof Person +->module.exports : typeof Person +->module : { exports: typeof Person; } +->exports : typeof Person +->Person : typeof Person ++>module.exports = Person : (name: string) => void ++>module.exports : (name: string) => void ++>module : { Person(name: string): void; } ++>exports : (name: string) => void ++>Person : (name: string) => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.errors.txt.diff new file mode 100644 index 0000000000..a3a773a7c6 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.errors.txt.diff @@ -0,0 +1,106 @@ +--- old.checkObjectDefineProperty.errors.txt ++++ new.checkObjectDefineProperty.errors.txt +@@= skipped -0, +0 lines =@@ +-validate.ts(14,3): error TS2540: Cannot assign to 'lastName' because it is a read-only property. +-validate.ts(15,3): error TS2540: Cannot assign to 'houseNumber' because it is a read-only property. +-validate.ts(16,1): error TS2322: Type 'number' is not assignable to type 'string'. +-validate.ts(17,3): error TS2540: Cannot assign to 'middleInit' because it is a read-only property. +- +- +-==== validate.ts (4 errors) ==== ++index.js(19,10): error TS2741: Property 'name' is missing in type '{}' but required in type '{ name: string; }'. ++index.js(23,11): error TS2339: Property 'zip' does not exist on type '{}'. ++index.js(28,11): error TS2339: Property 'houseNumber' does not exist on type '{}'. ++validate.ts(3,3): error TS2339: Property 'name' does not exist on type '{}'. ++validate.ts(4,3): error TS2339: Property 'middleInit' does not exist on type '{}'. ++validate.ts(5,3): error TS2339: Property 'lastName' does not exist on type '{}'. ++validate.ts(6,3): error TS2339: Property 'zip' does not exist on type '{}'. ++validate.ts(7,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. ++validate.ts(8,3): error TS2339: Property 'zipStr' does not exist on type '{}'. ++validate.ts(10,3): error TS2339: Property 'name' does not exist on type '{}'. ++validate.ts(11,3): error TS2339: Property 'zip' does not exist on type '{}'. ++validate.ts(12,3): error TS2339: Property 'zipStr' does not exist on type '{}'. ++validate.ts(14,3): error TS2339: Property 'lastName' does not exist on type '{}'. ++validate.ts(15,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. ++validate.ts(16,3): error TS2339: Property 'zipStr' does not exist on type '{}'. ++validate.ts(17,3): error TS2339: Property 'middleInit' does not exist on type '{}'. ++ ++ ++==== validate.ts (13 errors) ==== + // Validate in TS as simple validations would usually be interpreted as more special assignments + import x = require("./"); + x.name; ++ ~~~~ ++!!! error TS2339: Property 'name' does not exist on type '{}'. + x.middleInit; ++ ~~~~~~~~~~ ++!!! error TS2339: Property 'middleInit' does not exist on type '{}'. + x.lastName; ++ ~~~~~~~~ ++!!! error TS2339: Property 'lastName' does not exist on type '{}'. + x.zip; ++ ~~~ ++!!! error TS2339: Property 'zip' does not exist on type '{}'. + x.houseNumber; ++ ~~~~~~~~~~~ ++!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. + x.zipStr; ++ ~~~~~~ ++!!! error TS2339: Property 'zipStr' does not exist on type '{}'. + + x.name = "Another"; ++ ~~~~ ++!!! error TS2339: Property 'name' does not exist on type '{}'. + x.zip = 98123; ++ ~~~ ++!!! error TS2339: Property 'zip' does not exist on type '{}'. + x.zipStr = "OK"; ++ ~~~~~~ ++!!! error TS2339: Property 'zipStr' does not exist on type '{}'. + + x.lastName = "should fail"; + ~~~~~~~~ +-!!! error TS2540: Cannot assign to 'lastName' because it is a read-only property. ++!!! error TS2339: Property 'lastName' does not exist on type '{}'. + x.houseNumber = 12; // should also fail + ~~~~~~~~~~~ +-!!! error TS2540: Cannot assign to 'houseNumber' because it is a read-only property. ++!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. + x.zipStr = 12; // should fail +- ~~~~~~~~ +-!!! error TS2322: Type 'number' is not assignable to type 'string'. ++ ~~~~~~ ++!!! error TS2339: Property 'zipStr' does not exist on type '{}'. + x.middleInit = "R"; // should also fail + ~~~~~~~~~~ +-!!! error TS2540: Cannot assign to 'middleInit' because it is a read-only property. ++!!! error TS2339: Property 'middleInit' does not exist on type '{}'. + +-==== index.js (0 errors) ==== ++==== index.js (3 errors) ==== + const x = {}; + Object.defineProperty(x, "name", { value: "Charles", writable: true }); + Object.defineProperty(x, "middleInit", { value: "H" }); +@@= skipped -50, +80 lines =@@ + function takeName(named) { return named.name; } + + takeName(x); ++ ~ ++!!! error TS2741: Property 'name' is missing in type '{}' but required in type '{ name: string; }'. ++!!! related TS2728 index.js:15:13: 'name' is declared here. + /** + * @type {number} + */ + var a = x.zip; ++ ~~~ ++!!! error TS2339: Property 'zip' does not exist on type '{}'. + + /** + * @type {number} + */ + var b = x.houseNumber; ++ ~~~~~~~~~~~ ++!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. + + const returnExemplar = () => x; + const needsExemplar = (_ = x) => void 0; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.types.diff new file mode 100644 index 0000000000..5b03a1f204 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.types.diff @@ -0,0 +1,293 @@ +--- old.checkObjectDefineProperty.types ++++ new.checkObjectDefineProperty.types +@@= skipped -2, +2 lines =@@ + === validate.ts === + // Validate in TS as simple validations would usually be interpreted as more special assignments + import x = require("./"); +->x : typeof x ++>x : {} + + x.name; +->x.name : string +->x : typeof x +->name : string ++>x.name : any ++>x : {} ++>name : any + + x.middleInit; +->x.middleInit : string +->x : typeof x +->middleInit : string ++>x.middleInit : any ++>x : {} ++>middleInit : any + + x.lastName; +->x.lastName : string +->x : typeof x +->lastName : string ++>x.lastName : any ++>x : {} ++>lastName : any + + x.zip; +->x.zip : number +->x : typeof x +->zip : number ++>x.zip : any ++>x : {} ++>zip : any + + x.houseNumber; +->x.houseNumber : number +->x : typeof x +->houseNumber : number ++>x.houseNumber : any ++>x : {} ++>houseNumber : any + + x.zipStr; +->x.zipStr : string +->x : typeof x +->zipStr : string ++>x.zipStr : any ++>x : {} ++>zipStr : any + + x.name = "Another"; + >x.name = "Another" : "Another" +->x.name : string +->x : typeof x +->name : string ++>x.name : any ++>x : {} ++>name : any + >"Another" : "Another" + + x.zip = 98123; + >x.zip = 98123 : 98123 +->x.zip : number +->x : typeof x +->zip : number ++>x.zip : any ++>x : {} ++>zip : any + >98123 : 98123 + + x.zipStr = "OK"; + >x.zipStr = "OK" : "OK" +->x.zipStr : string +->x : typeof x +->zipStr : string ++>x.zipStr : any ++>x : {} ++>zipStr : any + >"OK" : "OK" + + x.lastName = "should fail"; + >x.lastName = "should fail" : "should fail" + >x.lastName : any +->x : typeof x ++>x : {} + >lastName : any + >"should fail" : "should fail" + + x.houseNumber = 12; // should also fail + >x.houseNumber = 12 : 12 + >x.houseNumber : any +->x : typeof x ++>x : {} + >houseNumber : any + >12 : 12 + + x.zipStr = 12; // should fail + >x.zipStr = 12 : 12 +->x.zipStr : string +->x : typeof x +->zipStr : string ++>x.zipStr : any ++>x : {} ++>zipStr : any + >12 : 12 + + x.middleInit = "R"; // should also fail + >x.middleInit = "R" : "R" + >x.middleInit : any +->x : typeof x ++>x : {} + >middleInit : any + >"R" : "R" + + === index.js === + const x = {}; +->x : typeof x ++>x : {} + >{} : {} + + Object.defineProperty(x, "name", { value: "Charles", writable: true }); +->Object.defineProperty(x, "name", { value: "Charles", writable: true }) : typeof x ++>Object.defineProperty(x, "name", { value: "Charles", writable: true }) : {} + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +->x : typeof x ++>x : {} + >"name" : "name" + >{ value: "Charles", writable: true } : { value: string; writable: true; } + >value : string +@@= skipped -100, +100 lines =@@ + >true : true + + Object.defineProperty(x, "middleInit", { value: "H" }); +->Object.defineProperty(x, "middleInit", { value: "H" }) : typeof x ++>Object.defineProperty(x, "middleInit", { value: "H" }) : {} + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +->x : typeof x ++>x : {} + >"middleInit" : "middleInit" + >{ value: "H" } : { value: string; } + >value : string + >"H" : "H" + + Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); +->Object.defineProperty(x, "lastName", { value: "Smith", writable: false }) : typeof x ++>Object.defineProperty(x, "lastName", { value: "Smith", writable: false }) : {} + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +->x : typeof x ++>x : {} + >"lastName" : "lastName" + >{ value: "Smith", writable: false } : { value: string; writable: false; } + >value : string +@@= skipped -24, +24 lines =@@ + >false : false + + Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }); +->Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }) : typeof x ++>Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }) : {} + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +->x : typeof x ++>x : {} + >"zip" : "zip" + >{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } + >get : () => number +@@= skipped -13, +13 lines =@@ + >_ : any + + Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); +->Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }) : typeof x ++>Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }) : {} + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +->x : typeof x ++>x : {} + >"houseNumber" : "houseNumber" + >{ get() { return 21.75 } } : { get(): number; } + >get : () => number + >21.75 : 21.75 + + Object.defineProperty(x, "zipStr", { +->Object.defineProperty(x, "zipStr", { /** @param {string} str */ set(str) { this.zip = Number(str) }}) : typeof x ++>Object.defineProperty(x, "zipStr", { /** @param {string} str */ set(str) { this.zip = Number(str) }}) : {} + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +->x : typeof x ++>x : {} + >"zipStr" : "zipStr" + >{ /** @param {string} str */ set(str) { this.zip = Number(str) }} : { set(str: string): void; } + +@@= skipped -48, +48 lines =@@ + takeName(x); + >takeName(x) : string + >takeName : (named: { name: string; }) => string +->x : typeof x ++>x : {} + + /** + * @type {number} + */ + var a = x.zip; + >a : number +->x.zip : number +->x : typeof x +->zip : number ++>x.zip : any ++>x : {} ++>zip : any + + /** + * @type {number} + */ + var b = x.houseNumber; + >b : number +->x.houseNumber : number +->x : typeof x +->houseNumber : number ++>x.houseNumber : any ++>x : {} ++>houseNumber : any + + const returnExemplar = () => x; +->returnExemplar : () => typeof x +->() => x : () => typeof x +->x : typeof x ++>returnExemplar : () => {} ++>() => x : () => {} ++>x : {} + + const needsExemplar = (_ = x) => void 0; +->needsExemplar : (_?: typeof x) => undefined +->(_ = x) => void 0 : (_?: typeof x) => undefined +->_ : typeof x +->x : typeof x ++>needsExemplar : (_?: {}) => undefined ++>(_ = x) => void 0 : (_?: {}) => undefined ++>_ : {} ++>x : {} + >void 0 : undefined + >0 : 0 + +@@= skipped -44, +44 lines =@@ + * @param {typeof needsExemplar} b + */ + function match(a, b) {} +->match : (a: typeof returnExemplar, b: typeof needsExemplar) => void +->a : () => typeof x +->b : (_?: typeof x) => undefined ++>match : (a: () => {}, b: (_?: {}) => undefined) => void ++>a : () => {} ++>b : (_?: {}) => undefined + + match(() => expected, (x = expected) => void 0); + >match(() => expected, (x = expected) => void 0) : void +->match : (a: typeof returnExemplar, b: typeof needsExemplar) => void ++>match : (a: () => {}, b: (_?: {}) => undefined) => void + >() => expected : () => { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } + >expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } +->(x = expected) => void 0 : (x?: typeof x | undefined) => undefined +->x : typeof x | undefined ++>(x = expected) => void 0 : (x?: {} | undefined) => undefined ++>x : {} | undefined + >expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } + >void 0 : undefined + >0 : 0 + + module.exports = x; +->module.exports = x : typeof x +->module.exports : typeof x +->module : { exports: typeof x; } +->exports : typeof x +->x : typeof x ++>module.exports = x : {} ++>module.exports : {} ++>module : { readonly x: {}; } ++>exports : {} ++>x : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.errors.txt.diff index 9ac8e78746..2ef436de9d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.errors.txt.diff @@ -11,13 +11,19 @@ - - -==== importer.js (7 errors) ==== -+importer.js(1,21): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. ++importer.js(1,21): error TS2306: File 'mod1.js' is not a module. ++mod1.js(2,23): error TS2304: Cannot find name 'exports'. ++mod1.js(8,23): error TS2304: Cannot find name 'exports'. ++mod1.js(11,23): error TS2304: Cannot find name 'exports'. ++mod1.js(14,23): error TS2304: Cannot find name 'exports'. ++mod1.js(15,23): error TS2304: Cannot find name 'exports'. ++mod1.js(16,23): error TS2304: Cannot find name 'exports'. + + +==== importer.js (1 errors) ==== const mod = require("./mod1"); + ~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. ++!!! error TS2306: File 'mod1.js' is not a module. mod.thing; mod.other; - ~~~~~ @@ -28,7 +34,7 @@ mod.bad1; mod.bad2; mod.bad3; -@@= skipped -22, +14 lines =@@ +@@= skipped -22, +20 lines =@@ mod.thing = 0; mod.other = 0; @@ -47,5 +53,34 @@ - ~~~~ -!!! error TS2540: Cannot assign to 'bad3' because it is a read-only property. - ==== mod1.js (0 errors) ==== - const obj = { value: 42, writable: true }; \ No newline at end of file +-==== mod1.js (0 errors) ==== ++==== mod1.js (6 errors) ==== + const obj = { value: 42, writable: true }; + Object.defineProperty(exports, "thing", obj); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + + /** + * @type {string} + */ + let str = /** @type {string} */("other"); + Object.defineProperty(exports, str, { value: 42, writable: true }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + + const propName = "prop" + Object.defineProperty(exports, propName, { value: 42, writable: true }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + + + Object.defineProperty(exports, "bad1", { }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + Object.defineProperty(exports, "bad3", { writable: true }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.types.diff index b40bb0b226..b905bf5251 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.types.diff @@ -101,93 +101,85 @@ +>mod : any >bad3 : any >0 : 0 -- --=== mod1.js === --const obj = { value: 42, writable: true }; -->obj : { value: number; writable: boolean; } -->{ value: 42, writable: true } : { value: number; writable: boolean; } -->value : number -->42 : 42 -->writable : boolean -->true : true -- --Object.defineProperty(exports, "thing", obj); + +@@= skipped -88, +88 lines =@@ + >true : true + + Object.defineProperty(exports, "thing", obj); ->Object.defineProperty(exports, "thing", obj) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "thing", obj) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"thing" : "thing" -->obj : { value: number; writable: boolean; } -- --/** -- * @type {string} -- */ --let str = /** @type {string} */("other"); -->str : string -->("other") : string -->"other" : "other" -- --Object.defineProperty(exports, str, { value: 42, writable: true }); ++>exports : any + >"thing" : "thing" + >obj : { value: number; writable: boolean; } + +@@= skipped -17, +17 lines =@@ + >"other" : "other" + + Object.defineProperty(exports, str, { value: 42, writable: true }); ->Object.defineProperty(exports, str, { value: 42, writable: true }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, str, { value: 42, writable: true }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->str : string -->{ value: 42, writable: true } : { value: number; writable: true; } -->value : number -->42 : 42 -->writable : true -->true : true -- --const propName = "prop" -->propName : "prop" -->"prop" : "prop" -- --Object.defineProperty(exports, propName, { value: 42, writable: true }); ++>exports : any + >str : string + >{ value: 42, writable: true } : { value: number; writable: true; } + >value : number +@@= skipped -17, +17 lines =@@ + >"prop" : "prop" + + Object.defineProperty(exports, propName, { value: 42, writable: true }); ->Object.defineProperty(exports, propName, { value: 42, writable: true }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, propName, { value: 42, writable: true }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->propName : "prop" -->{ value: 42, writable: true } : { value: number; writable: true; } -->value : number -->42 : 42 -->writable : true -->true : true -- -- --Object.defineProperty(exports, "bad1", { }); ++>exports : any + >propName : "prop" + >{ value: 42, writable: true } : { value: number; writable: true; } + >value : number +@@= skipped -14, +14 lines =@@ + + + Object.defineProperty(exports, "bad1", { }); ->Object.defineProperty(exports, "bad1", { }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "bad1", { }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"bad1" : "bad1" -->{ } : {} -- --Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); ++>exports : any + >"bad1" : "bad1" + >{ } : {} + + Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); ->Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"bad2" : "bad2" -->{ get() { return 12 }, value: "no" } : { get(): number; value: string; } -->get : () => number -->12 : 12 -->value : string -->"no" : "no" -- --Object.defineProperty(exports, "bad3", { writable: true }); ++>exports : any + >"bad2" : "bad2" + >{ get() { return 12 }, value: "no" } : { get(): number; value: string; } + >get : () => number +@@= skipped -22, +22 lines =@@ + >"no" : "no" + + Object.defineProperty(exports, "bad3", { writable: true }); ->Object.defineProperty(exports, "bad3", { writable: true }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "bad3", { writable: true }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"bad3" : "bad3" -->{ writable: true } : { writable: true; } -->writable : true -->true : true ++>exports : any + >"bad3" : "bad3" + >{ writable: true } : { writable: true; } + >writable : true \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.errors.txt.diff new file mode 100644 index 0000000000..18e8e7a09d --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.errors.txt.diff @@ -0,0 +1,31 @@ +--- old.commonJSAliasedExport.errors.txt ++++ new.commonJSAliasedExport.errors.txt +@@= skipped -0, +0 lines =@@ +- ++bug43713.js(1,9): error TS2305: Module '"./commonJSAliasedExport"' has no exported member 'funky'. ++commonJSAliasedExport.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++commonJSAliasedExport.js(7,16): error TS2339: Property 'funky' does not exist on type '(ast: any) => any'. ++ ++ ++==== bug43713.js (1 errors) ==== ++ const { funky } = require('./commonJSAliasedExport'); ++ ~~~~~ ++!!! error TS2305: Module '"./commonJSAliasedExport"' has no exported member 'funky'. ++ /** @type {boolean} */ ++ var diddy ++ var diddy = funky(1) ++ ++ ++==== commonJSAliasedExport.js (2 errors) ==== ++ const donkey = (ast) => ast; ++ ++ function funky(declaration) { ++ return false; ++ } ++ module.exports = donkey; ++ ~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ++ module.exports.funky = funky; ++ ~~~~~ ++!!! error TS2339: Property 'funky' does not exist on type '(ast: any) => any'. ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff index d93407dc34..77a534523c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff @@ -5,12 +5,10 @@ === bug43713.js === const { funky } = require('./commonJSAliasedExport'); ->funky : (declaration: any) => boolean -->require('./commonJSAliasedExport') : (ast: any) => any +>funky : any -+>require('./commonJSAliasedExport') : any + >require('./commonJSAliasedExport') : (ast: any) => any >require : any >'./commonJSAliasedExport' : "./commonJSAliasedExport" - @@= skipped -11, +11 lines =@@ var diddy = funky(1) @@ -21,33 +19,31 @@ +>funky : any >1 : 1 -- --=== commonJSAliasedExport.js === --const donkey = (ast) => ast; -->donkey : (ast: any) => any -->(ast) => ast : (ast: any) => any -->ast : any -->ast : any -- --function funky(declaration) { -->funky : (declaration: any) => boolean -->declaration : any -- -- return false; -->false : false --} --module.exports = donkey; + +@@= skipped -20, +20 lines =@@ + >false : false + } + module.exports = donkey; ->module.exports = donkey : { (ast: any): any; funky: (declaration: any) => boolean; } ->module.exports : { (ast: any): any; funky: (declaration: any) => boolean; } ->module : { exports: { (ast: any): any; funky: (declaration: any) => boolean; }; } ->exports : { (ast: any): any; funky: (declaration: any) => boolean; } -->donkey : (ast: any) => any -- --module.exports.funky = funky; -->module.exports.funky = funky : (declaration: any) => boolean ++>module.exports = donkey : (ast: any) => any ++>module.exports : (ast: any) => any ++>module : { readonly donkey: (ast: any) => any; } ++>exports : (ast: any) => any + >donkey : (ast: any) => any + + module.exports.funky = funky; + >module.exports.funky = funky : (declaration: any) => boolean ->module.exports.funky : (declaration: any) => boolean ->module.exports : { (ast: any): any; funky: (declaration: any) => boolean; } ->module : { exports: { (ast: any): any; funky: (declaration: any) => boolean; }; } ->exports : { (ast: any): any; funky: (declaration: any) => boolean; } ->funky : (declaration: any) => boolean -->funky : (declaration: any) => boolean ++>module.exports.funky : any ++>module.exports : (ast: any) => any ++>module : { readonly donkey: (ast: any) => any; } ++>exports : (ast: any) => any ++>funky : any + >funky : (declaration: any) => boolean diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSReexport.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSReexport.types.diff index 856ade0f5e..715a57c3bc 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSReexport.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSReexport.types.diff @@ -1,55 +1,54 @@ --- old.commonJSReexport.types +++ new.commonJSReexport.types -@@= skipped -1, +1 lines =@@ - +@@= skipped -2, +2 lines =@@ === main.js === const { hardline } = require('./second').nested; -->hardline : { type: string; } + >hardline : { type: string; } ->require('./second').nested : typeof import("first") ->require('./second') : { nested: typeof import("first"); } -+>hardline : any -+>require('./second').nested : any -+>require('./second') : any ++>require('./second').nested : { hardline: { type: string; }; } ++>require('./second') : { nested: { hardline: { type: string; }; }; } >require : any >'./second' : "./second" ->nested : typeof import("first") -+>nested : any ++>nested : { hardline: { type: string; }; } hardline -->hardline : { type: string; } -- --=== first.js === --const hardline = { type: "hard" } -->hardline : { type: string; } -->{ type: "hard" } : { type: string; } -->type : string -->"hard" : "hard" -- --module.exports = { + >hardline : { type: string; } +@@= skipped -17, +17 lines =@@ + >"hard" : "hard" + + module.exports = { ->module.exports = { hardline} : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ hardline} : { hardline: { type: string; }; } -- -- hardline -->hardline : { type: string; } --} -- -- --=== second.js === --module.exports = { ++>module.exports = { hardline} : { hardline: { type: string; }; } ++>module.exports : { hardline: { type: string; }; } ++>module : { "export=": { hardline: { type: string; }; }; } ++>exports : { hardline: { type: string; }; } + >{ hardline} : { hardline: { type: string; }; } + + hardline +@@= skipped -13, +13 lines =@@ + + === second.js === + module.exports = { ->module.exports = { nested: require('./first')} : { nested: typeof import("first"); } ->module.exports : { nested: typeof import("first"); } ->module : { exports: { nested: typeof import("first"); }; } ->exports : { nested: typeof import("first"); } ->{ nested: require('./first')} : { nested: typeof import("first"); } -- -- nested: require('./first') ++>module.exports = { nested: require('./first')} : { nested: { hardline: { type: string; }; }; } ++>module.exports : { nested: { hardline: { type: string; }; }; } ++>module : { "export=": { nested: { hardline: { type: string; }; }; }; } ++>exports : { nested: { hardline: { type: string; }; }; } ++>{ nested: require('./first')} : { nested: { hardline: { type: string; }; }; } + + nested: require('./first') ->nested : typeof import("first") ->require('./first') : typeof import("first") -->require : any -->'./first' : "./first" -- --}; -+>hardline : any ++>nested : { hardline: { type: string; }; } ++>require('./first') : { hardline: { type: string; }; } + >require : any + >'./first' : "./first" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff index 53a8688d1c..90fb3fbf2c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff @@ -1,23 +1,6 @@ --- old.jsDeclarationsClassExtendsVisibility.types +++ new.jsDeclarationsClassExtendsVisibility.types -@@= skipped -1, +1 lines =@@ - - === cls.js === - const Bar = require("./bar"); -->Bar : typeof Bar -->require("./bar") : typeof Bar -+>Bar : any -+>require("./bar") : any - >require : any - >"./bar" : "./bar" - -@@= skipped -20, +20 lines =@@ - }; - class Foo extends Bar {} - >Foo : Foo -->Bar : Bar -+>Bar : any - +@@= skipped -26, +26 lines =@@ module.exports = Foo; >module.exports = Foo : typeof Foo >module.exports : typeof Foo @@ -35,17 +18,15 @@ +>module : { Foo: typeof Foo; } >exports : typeof Foo ->Strings : { a: string; b: string; } -->Strings : { a: string; b: string; } -- --=== bar.js === --class Bar {} -->Bar : Bar -- --module.exports = Bar; -->module.exports = Bar : typeof Bar -->module.exports : typeof Bar -->module : { exports: typeof Bar; } -->exports : typeof Bar -->Bar : typeof Bar +>Strings : any -+>Strings : { a: string; b: string; } + >Strings : { a: string; b: string; } + + === bar.js === +@@= skipped -20, +20 lines =@@ + module.exports = Bar; + >module.exports = Bar : typeof Bar + >module.exports : typeof Bar +->module : { exports: typeof Bar; } ++>module : { Bar: typeof Bar; } + >exports : typeof Bar + >Bar : typeof Bar diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCommonjsRelativePath.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCommonjsRelativePath.types.diff index fde8dbbe09..25ad7bbe79 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCommonjsRelativePath.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCommonjsRelativePath.types.diff @@ -1,47 +1,38 @@ --- old.jsDeclarationsCommonjsRelativePath.types +++ new.jsDeclarationsCommonjsRelativePath.types -@@= skipped -4, +4 lines =@@ - >'use strict' : "use strict" - +@@= skipped -6, +6 lines =@@ const Thing = require('./thing').Thing -->Thing : typeof Thing -->require('./thing').Thing : typeof Thing + >Thing : typeof Thing + >require('./thing').Thing : typeof Thing ->require('./thing') : typeof import("thing") -+>Thing : any -+>require('./thing').Thing : any -+>require('./thing') : any ++>require('./thing') : { Thing: typeof Thing; } >require : any >'./thing' : "./thing" -->Thing : typeof Thing -- --module.exports = { Thing } + >Thing : typeof Thing + + module.exports = { Thing } ->module.exports = { Thing } : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ Thing } : { Thing: typeof Thing; } -->Thing : typeof Thing -- --=== thing.js === --'use strict'; -->'use strict' : "use strict" -- --class Thing {} -->Thing : Thing -- --module.exports = { Thing } ++>module.exports = { Thing } : { Thing: typeof Thing; } ++>module.exports : { Thing: typeof Thing; } ++>module : { "export=": { Thing: typeof Thing; }; } ++>exports : { Thing: typeof Thing; } + >{ Thing } : { Thing: typeof Thing; } + >Thing : typeof Thing + +@@= skipped -21, +21 lines =@@ + >Thing : Thing + + module.exports = { Thing } ->module.exports = { Thing } : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ Thing } : { Thing: typeof Thing; } -->Thing : typeof Thing -+>Thing : any -+ -+module.exports = { Thing } -+>module.exports = { Thing } : { Thing: any; } -+>module.exports : { Thing: any; } -+>module : { "export=": { Thing: any; }; } -+>exports : { Thing: any; } -+>{ Thing } : { Thing: any; } -+>Thing : any ++>module.exports = { Thing } : { Thing: typeof Thing; } ++>module.exports : { Thing: typeof Thing; } ++>module : { "export=": { Thing: typeof Thing; }; } ++>exports : { Thing: typeof Thing; } + >{ Thing } : { Thing: typeof Thing; } + >Thing : typeof Thing diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff index 076b43195d..b47289a907 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff @@ -1,32 +1,18 @@ --- old.jsDeclarationsExportAssignedVisibility.types +++ new.jsDeclarationsExportAssignedVisibility.types -@@= skipped -1, +1 lines =@@ - - === index.js === - const Obj = require("./obj"); -->Obj : typeof Obj -->require("./obj") : typeof Obj -+>Obj : any -+>require("./obj") : any - >require : any - >"./obj" : "./obj" - -@@= skipped -10, +10 lines =@@ - +@@= skipped -12, +12 lines =@@ constructor() { this.usage = new Obj(); -->this.usage = new Obj() : Obj -+>this.usage = new Obj() : any - >this.usage : any + >this.usage = new Obj() : Obj +->this.usage : any ++>this.usage : Obj >this : this - >usage : any -->new Obj() : Obj -->Obj : typeof Obj -+>new Obj() : any -+>Obj : any +->usage : any ++>usage : Obj + >new Obj() : Obj + >Obj : typeof Obj } - } - +@@= skipped -11, +11 lines =@@ module.exports = Container; >module.exports = Container : typeof Container >module.exports : typeof Container @@ -35,21 +21,29 @@ >exports : typeof Container >Container : typeof Container --=== obj.js === --module.exports = class Obj { + === obj.js === + module.exports = class Obj { ->module.exports = class Obj { constructor() { this.x = 12; }} : typeof import("obj") ->module.exports : typeof import("obj") ->module : { exports: typeof import("obj"); } ->exports : typeof import("obj") ->class Obj { constructor() { this.x = 12; }} : typeof import("obj") ->Obj : typeof import("obj") -- -- constructor() { -- this.x = 12; -->this.x = 12 : 12 ++>module.exports = class Obj { constructor() { this.x = 12; }} : typeof import("./obj") ++>module.exports : typeof import("./obj") ++>module : { Obj: typeof import("./obj"); } ++>exports : typeof import("./obj") ++>class Obj { constructor() { this.x = 12; }} : typeof import("./obj") ++>Obj : typeof import("./obj") + + constructor() { + this.x = 12; + >this.x = 12 : 12 ->this.x : any -->this : this ++>this.x : number + >this : this ->x : any -->12 : 12 -- } --} \ No newline at end of file ++>x : number + >12 : 12 + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportedClassAliases.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportedClassAliases.types.diff index 124e7e394d..5413cbe7a4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportedClassAliases.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportedClassAliases.types.diff @@ -6,8 +6,8 @@ const errors = require("./errors"); ->errors : typeof errors ->require("./errors") : typeof errors -+>errors : any -+>require("./errors") : any ++>errors : { FancyError: typeof FancyError; } ++>require("./errors") : { FancyError: typeof FancyError; } >require : any >"./errors" : "./errors" @@ -17,44 +17,30 @@ ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->{ errors} : { errors: typeof errors; } -+>module.exports = { errors} : { errors: any; } -+>module.exports : { errors: any; } -+>module : { "export=": { errors: any; }; } -+>exports : { errors: any; } -+>{ errors} : { errors: any; } ++>module.exports = { errors} : { errors: { FancyError: typeof FancyError; }; } ++>module.exports : { errors: { FancyError: typeof FancyError; }; } ++>module : { "export=": { errors: { FancyError: typeof FancyError; }; }; } ++>exports : { errors: { FancyError: typeof FancyError; }; } ++>{ errors} : { errors: { FancyError: typeof FancyError; }; } errors ->errors : typeof errors -- --}; --=== utils/errors.js === --class FancyError extends Error { -->FancyError : FancyError -->Error : Error -- -- constructor(status) { -->status : any -- -- super(`error with status ${status}`); -->super(`error with status ${status}`) : void -->super : ErrorConstructor -->`error with status ${status}` : string -->status : any -- } --} -- --module.exports = { ++>errors : { FancyError: typeof FancyError; } + + }; + === utils/errors.js === +@@= skipped -33, +33 lines =@@ + } + + module.exports = { ->module.exports = { FancyError} : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ FancyError} : { FancyError: typeof FancyError; } -- -- FancyError -->FancyError : typeof FancyError -- --}; -- -+>errors : any -+ -+}; \ No newline at end of file ++>module.exports = { FancyError} : { FancyError: typeof FancyError; } ++>module.exports : { FancyError: typeof FancyError; } ++>module : { "export=": { FancyError: typeof FancyError; }; } ++>exports : { FancyError: typeof FancyError; } + >{ FancyError} : { FancyError: typeof FancyError; } + + FancyError \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff index e93da6ef2a..feefca22a3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff @@ -2,12 +2,18 @@ +++ new.jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt @@= skipped -0, +0 lines =@@ - ++file.js(4,11): error TS2315: Type 'Object' is not generic. ++file.js(10,51): error TS2300: Duplicate identifier 'myTypes'. ++file.js(13,13): error TS2300: Duplicate identifier 'myTypes'. ++file.js(18,15): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. ++file.js(18,39): error TS2300: Duplicate identifier 'myTypes'. +file2.js(6,11): error TS2315: Type 'Object' is not generic. ++file2.js(12,23): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. +file2.js(17,12): error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. +file2.js(28,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== file2.js (3 errors) ==== ++==== file2.js (4 errors) ==== + const {myTypes} = require('./file.js'); + + /** @@ -22,6 +28,8 @@ + }; + + /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ++ ~~~~~~~ ++!!! error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. + + /** + * @function testFn @@ -42,24 +50,34 @@ + module.exports = {testFn, testFnTypes}; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+==== file.js (0 errors) ==== ++==== file.js (5 errors) ==== + /** + * @namespace myTypes + * @global + * @type {Object} ++ ~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. + */ + const myTypes = { + // SOME PROPS HERE + }; + + /** @typedef {string|RegExp|Array} myTypes.typeA */ ++ ~~~~~~~ ++!!! error TS2300: Duplicate identifier 'myTypes'. + + /** + * @typedef myTypes.typeB ++ ~~~~~~~ ++!!! error TS2300: Duplicate identifier 'myTypes'. + * @property {myTypes.typeA} prop1 - Prop 1. + * @property {string} prop2 - Prop 2. + */ + + /** @typedef {myTypes.typeB|Function} myTypes.typeC */ ++ ~~~~~~~ ++!!! error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. ++ ~~~~~~~ ++!!! error TS2300: Duplicate identifier 'myTypes'. + + exports.myTypes = myTypes; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff index 11c2853bd6..281a6739e3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff @@ -7,7 +7,7 @@ ->myTypes : { [x: string]: any; } ->require('./file.js') : typeof import("file") +>myTypes : any -+>require('./file.js') : any ++>require('./file.js') : typeof import("./file.js") >require : any >'./file.js' : "./file.js" @@ -55,36 +55,6 @@ ->{testFn, testFnTypes} : { testFn: (input: testFnTypes.input) => number | null; testFnTypes: { [x: string]: any; }; } ->testFn : (input: testFnTypes.input) => number | null ->testFnTypes : { [x: string]: any; } -- --=== file.js === --/** -- * @namespace myTypes -- * @global -- * @type {Object} -- */ --const myTypes = { -->myTypes : { [x: string]: any; } -->{ // SOME PROPS HERE} : {} -- -- // SOME PROPS HERE --}; -- --/** @typedef {string|RegExp|Array} myTypes.typeA */ -- --/** -- * @typedef myTypes.typeB -- * @property {myTypes.typeA} prop1 - Prop 1. -- * @property {string} prop2 - Prop 2. -- */ -- --/** @typedef {myTypes.typeB|Function} myTypes.typeC */ -- --exports.myTypes = myTypes; -->exports.myTypes = myTypes : { [x: string]: any; } -->exports.myTypes : { [x: string]: any; } -->exports : typeof import("file") -->myTypes : { [x: string]: any; } -->myTypes : { [x: string]: any; } +>module.exports = {testFn, testFnTypes} : { testFn: (input: testFnTypes.input) => number; testFnTypes: any; } +>module.exports : { testFn: (input: testFnTypes.input) => number; testFnTypes: any; } +>module : { "export=": { testFn: (input: testFnTypes.input) => number; testFnTypes: any; }; } @@ -92,3 +62,29 @@ +>{testFn, testFnTypes} : { testFn: (input: testFnTypes.input) => number; testFnTypes: any; } +>testFn : (input: testFnTypes.input) => number +>testFnTypes : any + + === file.js === + /** +@@= skipped -15, +15 lines =@@ + * @type {Object} + */ + const myTypes = { +->myTypes : { [x: string]: any; } ++>myTypes : any + >{ // SOME PROPS HERE} : {} + + // SOME PROPS HERE +@@= skipped -17, +17 lines =@@ + /** @typedef {myTypes.typeB|Function} myTypes.typeC */ + + exports.myTypes = myTypes; +->exports.myTypes = myTypes : { [x: string]: any; } +->exports.myTypes : { [x: string]: any; } +->exports : typeof import("file") +->myTypes : { [x: string]: any; } +->myTypes : { [x: string]: any; } ++>exports.myTypes = myTypes : any ++>exports.myTypes : any ++>exports : typeof import("./file") ++>myTypes : any ++>myTypes : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportedCjsAlias.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportedCjsAlias.types.diff index 05d602eca0..9aa9eb8797 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportedCjsAlias.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportedCjsAlias.types.diff @@ -1,17 +1,11 @@ --- old.jsDeclarationsReexportedCjsAlias.types +++ new.jsDeclarationsReexportedCjsAlias.types -@@= skipped -1, +1 lines =@@ - - === main.js === - const { SomeClass, SomeClass: Another } = require('./lib'); -->SomeClass : typeof SomeClass -->SomeClass : any -->Another : typeof SomeClass +@@= skipped -4, +4 lines =@@ + >SomeClass : typeof SomeClass + >SomeClass : any + >Another : typeof SomeClass ->require('./lib') : typeof import("lib") -+>SomeClass : any -+>SomeClass : any -+>Another : any -+>require('./lib') : any ++>require('./lib') : { bar: (a: string) => string; SomeClass: typeof SomeClass; } >require : any >'./lib' : "./lib" @@ -20,56 +14,25 @@ ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ SomeClass, Another} : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } -+>module.exports = { SomeClass, Another} : { SomeClass: any; Another: any; } -+>module.exports : { SomeClass: any; Another: any; } -+>module : { "export=": { SomeClass: any; Another: any; }; } -+>exports : { SomeClass: any; Another: any; } -+>{ SomeClass, Another} : { SomeClass: any; Another: any; } ++>module.exports = { SomeClass, Another} : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } ++>module.exports : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } ++>module : { "export=": { SomeClass: typeof SomeClass; Another: typeof SomeClass; }; } ++>exports : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } + >{ SomeClass, Another} : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } SomeClass, -->SomeClass : typeof SomeClass -+>SomeClass : any +@@= skipped -43, +43 lines =@@ + } - Another -->Another : typeof SomeClass --} --=== lib.js === --/** -- * @param {string} a -- */ --function bar(a) { -->bar : (a: string) => string -->a : string -- -- return a + a; -->a + a : string -->a : string -->a : string --} -- --class SomeClass { -->SomeClass : SomeClass -- -- a() { -->a : () => number -- -- return 1; -->1 : 1 -- } --} -- --module.exports = { + module.exports = { ->module.exports = { bar, SomeClass} : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ bar, SomeClass} : { bar: (a: string) => string; SomeClass: typeof SomeClass; } -- -- bar, -->bar : (a: string) => string -- -- SomeClass -->SomeClass : typeof SomeClass -+>Another : any - } \ No newline at end of file ++>module.exports = { bar, SomeClass} : { bar: (a: string) => string; SomeClass: typeof SomeClass; } ++>module.exports : { bar: (a: string) => string; SomeClass: typeof SomeClass; } ++>module : { "export=": { bar: (a: string) => string; SomeClass: typeof SomeClass; }; } ++>exports : { bar: (a: string) => string; SomeClass: typeof SomeClass; } + >{ bar, SomeClass} : { bar: (a: string) => string; SomeClass: typeof SomeClass; } + + bar, \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt.diff new file mode 100644 index 0000000000..a4400a9598 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt.diff @@ -0,0 +1,50 @@ +--- old.jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt ++++ new.jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt +@@= skipped -0, +0 lines =@@ +- ++index.js(7,19): error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? ++index.js(14,18): error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? ++ ++ ++==== test.js (0 errors) ==== ++ const {Render} = require("./index"); ++ let render = new Render(); ++ ++ render.addRectangle(); ++ console.log("Objects", render.objects); ++==== rectangle.js (0 errors) ==== ++ class Rectangle { ++ constructor() { ++ console.log("I'm a rectangle!"); ++ } ++ } ++ ++ module.exports = { Rectangle }; ++==== index.js (2 errors) ==== ++ const {Rectangle} = require('./rectangle'); ++ ++ class Render { ++ constructor() { ++ /** ++ * Object list ++ * @type {Rectangle[]} ++ ~~~~~~~~~ ++!!! error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? ++ */ ++ this.objects = []; ++ } ++ /** ++ * Adds a rectangle ++ * ++ * @returns {Rectangle} the rect ++ ~~~~~~~~~ ++!!! error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? ++ */ ++ addRectangle() { ++ const obj = new Rectangle(); ++ this.objects.push(obj); ++ return obj; ++ } ++ } ++ ++ module.exports = { Render }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff index d2a09d0ebb..a7a6a40dcd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff @@ -1,122 +1,74 @@ --- old.jsDeclarationsReferenceToClassInstanceCrossFile.types +++ new.jsDeclarationsReferenceToClassInstanceCrossFile.types -@@= skipped -1, +1 lines =@@ - +@@= skipped -2, +2 lines =@@ === test.js === const {Render} = require("./index"); -->Render : typeof Render + >Render : typeof Render ->require("./index") : typeof import("index") -+>Render : any -+>require("./index") : any ++>require("./index") : { Render: typeof Render; } >require : any >"./index" : "./index" - let render = new Render(); -->render : Render -->new Render() : Render -->Render : typeof Render -+>render : any -+>new Render() : any -+>Render : any +@@= skipped -10, +10 lines =@@ + >Render : typeof Render render.addRectangle(); ->render.addRectangle() : import("rectangle").Rectangle ->render.addRectangle : () => import("rectangle").Rectangle -->render : Render ++>render.addRectangle() : Rectangle ++>render.addRectangle : () => Rectangle + >render : Render ->addRectangle : () => import("rectangle").Rectangle -+>render.addRectangle() : any -+>render.addRectangle : any -+>render : any -+>addRectangle : any ++>addRectangle : () => Rectangle console.log("Objects", render.objects); >console.log("Objects", render.objects) : void -@@= skipped -22, +22 lines =@@ +@@= skipped -11, +11 lines =@@ >console : Console >log : (...data: any[]) => void >"Objects" : "Objects" ->render.objects : import("rectangle").Rectangle[] -->render : Render ++>render.objects : Rectangle[] + >render : Render ->objects : import("rectangle").Rectangle[] -- --=== rectangle.js === --class Rectangle { -->Rectangle : Rectangle -- -- constructor() { -- console.log("I'm a rectangle!"); -->console.log("I'm a rectangle!") : void -->console.log : (...data: any[]) => void -->console : Console -->log : (...data: any[]) => void -->"I'm a rectangle!" : "I'm a rectangle!" -- } --} -- --module.exports = { Rectangle }; ++>objects : Rectangle[] + + === rectangle.js === + class Rectangle { +@@= skipped -19, +19 lines =@@ + } + + module.exports = { Rectangle }; ->module.exports = { Rectangle } : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ Rectangle } : { Rectangle: typeof Rectangle; } -->Rectangle : typeof Rectangle -- --=== index.js === --const {Rectangle} = require('./rectangle'); -->Rectangle : typeof Rectangle ++>module.exports = { Rectangle } : { Rectangle: typeof Rectangle; } ++>module.exports : { Rectangle: typeof Rectangle; } ++>module : { "export=": { Rectangle: typeof Rectangle; }; } ++>exports : { Rectangle: typeof Rectangle; } + >{ Rectangle } : { Rectangle: typeof Rectangle; } + >Rectangle : typeof Rectangle + + === index.js === + const {Rectangle} = require('./rectangle'); + >Rectangle : typeof Rectangle ->require('./rectangle') : typeof import("rectangle") -->require : any -->'./rectangle' : "./rectangle" -- --class Render { -->Render : Render -- -- constructor() { -- /** -- * Object list -- * @type {Rectangle[]} -- */ -- this.objects = []; -->this.objects = [] : undefined[] -->this.objects : Rectangle[] -->this : this -->objects : Rectangle[] -->[] : undefined[] -- } -- /** -- * Adds a rectangle -- * -- * @returns {Rectangle} the rect -- */ -- addRectangle() { -->addRectangle : () => Rectangle -- -- const obj = new Rectangle(); -->obj : Rectangle -->new Rectangle() : Rectangle -->Rectangle : typeof Rectangle -- -- this.objects.push(obj); -->this.objects.push(obj) : number -->this.objects.push : (...items: Rectangle[]) => number -->this.objects : Rectangle[] -->this : this -->objects : Rectangle[] -->push : (...items: Rectangle[]) => number -->obj : Rectangle -- -- return obj; -->obj : Rectangle -- } --} -- --module.exports = { Render }; ++>require('./rectangle') : { Rectangle: typeof Rectangle; } + >require : any + >'./rectangle' : "./rectangle" + +@@= skipped -57, +57 lines =@@ + } + + module.exports = { Render }; ->module.exports = { Render } : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ Render } : { Render: typeof Render; } -->Render : typeof Render -+>render.objects : any -+>render : any -+>objects : any ++>module.exports = { Render } : { Render: typeof Render; } ++>module.exports : { Render: typeof Render; } ++>module : { "export=": { Render: typeof Render; }; } ++>exports : { Render: typeof Render; } + >{ Render } : { Render: typeof Render; } + >Render : typeof Render diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff index 67abbae8a5..a95ad05e93 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff @@ -2,13 +2,18 @@ +++ new.jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt @@= skipped -0, +0 lines =@@ - ++index.js(3,37): error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. +index.js(21,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++module.js(24,12): error TS2315: Type 'Object' is not generic. ++module.js(27,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== index.js (1 errors) ==== ++==== index.js (2 errors) ==== + const {taskGroups, taskNameToGroup} = require('./module.js'); + + /** @typedef {import('./module.js').TaskGroup} TaskGroup */ ++ ~~~~~~~~~ ++!!! error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. + + /** + * @typedef TaskNode @@ -29,7 +34,7 @@ + module.exports = MainThreadTasks; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+==== module.js (0 errors) ==== ++==== module.js (2 errors) ==== + /** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ + + /** @@ -54,9 +59,16 @@ + } + + /** @type {Object} */ ++ ~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. + const taskNameToGroup = {}; + + module.exports = { ++ ~~~~~~~~~~~~~~~~~~ + taskGroups, ++ ~~~~~~~~~~~~~~~ + taskNameToGroup, -+ }; \ No newline at end of file ++ ~~~~~~~~~~~~~~~~~~~~ ++ }; ++ ~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff index d9a36ba666..811f187d26 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff @@ -1,19 +1,17 @@ --- old.jsDeclarationsTypedefPropertyAndExportAssignment.types +++ new.jsDeclarationsTypedefPropertyAndExportAssignment.types -@@= skipped -1, +1 lines =@@ - +@@= skipped -2, +2 lines =@@ === index.js === const {taskGroups, taskNameToGroup} = require('./module.js'); -->taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } + >taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } ->taskNameToGroup : { [x: string]: import("module").TaskGroup; } ->require('./module.js') : typeof import("module") -+>taskGroups : any +>taskNameToGroup : any -+>require('./module.js') : any ++>require('./module.js') : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } >require : any >'./module.js' : "./module.js" -@@= skipped -24, +24 lines =@@ +@@= skipped -23, +23 lines =@@ * @param {TaskNode} y */ constructor(x, y){} @@ -30,67 +28,31 @@ >exports : typeof MainThreadTasks >MainThreadTasks : typeof MainThreadTasks --=== module.js === --/** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ -- --/** -- * @typedef TaskGroup -- * @property {TaskGroupIds} id -- * @property {string} label -- * @property {string[]} traceEventNames -- */ -- --/** -- * @type {{[P in TaskGroupIds]: {id: P, label: string}}} -- */ --const taskGroups = { -->taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } -->{ parseHTML: { id: 'parseHTML', label: 'Parse HTML & CSS' }, styleLayout: { id: 'styleLayout', label: 'Style & Layout' },} : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } -- -- parseHTML: { -->parseHTML : { id: "parseHTML"; label: string; } -->{ id: 'parseHTML', label: 'Parse HTML & CSS' } : { id: "parseHTML"; label: string; } -- -- id: 'parseHTML', -->id : "parseHTML" -->'parseHTML' : "parseHTML" -- -- label: 'Parse HTML & CSS' -->label : string -->'Parse HTML & CSS' : "Parse HTML & CSS" -- -- }, -- styleLayout: { -->styleLayout : { id: "styleLayout"; label: string; } -->{ id: 'styleLayout', label: 'Style & Layout' } : { id: "styleLayout"; label: string; } -- -- id: 'styleLayout', -->id : "styleLayout" -->'styleLayout' : "styleLayout" -- -- label: 'Style & Layout' -->label : string -->'Style & Layout' : "Style & Layout" -- -- }, --} -- --/** @type {Object} */ --const taskNameToGroup = {}; +@@= skipped -58, +58 lines =@@ + + /** @type {Object} */ + const taskNameToGroup = {}; ->taskNameToGroup : { [x: string]: TaskGroup; } -->{} : {} -- --module.exports = { ++>taskNameToGroup : any + >{} : {} + + module.exports = { ->module.exports = { taskGroups, taskNameToGroup,} : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->{ taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: { [x: string]: TaskGroup; }; } -- -- taskGroups, -->taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } -- -- taskNameToGroup, ++>module.exports = { taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } ++>module.exports : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } ++>module : { "export=": { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; }; } ++>exports : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } ++>{ taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } + + taskGroups, + >taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } + + taskNameToGroup, ->taskNameToGroup : { [x: string]: TaskGroup; } -- --}; \ No newline at end of file ++>taskNameToGroup : any + + }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff index 44e0dfe7eb..c70a75cf5f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff @@ -1,64 +1,21 @@ --- old.jsdocImportType.types +++ new.jsdocImportType.types -@@= skipped -4, +4 lines =@@ - /** @typedef {import("./mod1")} C - * @type {C} */ - var c; -->c : D -+>c : any - - c.chunk; -->c.chunk : number -->c : D -->chunk : number -+>c.chunk : any -+>c : any -+>chunk : any - - const D = require("./mod1"); -->D : typeof D -->require("./mod1") : typeof D -+>D : any -+>require("./mod1") : any - >require : (name: string) => any - >"./mod1" : "./mod1" - - /** @type {D} */ - var d; -->d : D -+>d : error - - d.chunk; -->d.chunk : number -+>d.chunk : any - >d : D -->chunk : number -+>chunk : any - - === types.d.ts === - declare function require(name: string): any; -@@= skipped -33, +33 lines =@@ - declare var module: { exports: any }; - >module : { exports: any; } - >exports : any -- --=== mod1.js === --/// --class Chunk { -->Chunk : Chunk -- -- constructor() { -- this.chunk = 1; -->this.chunk = 1 : 1 +@@= skipped -46, +46 lines =@@ + constructor() { + this.chunk = 1; + >this.chunk = 1 : 1 ->this.chunk : any -->this : this ++>this.chunk : number + >this : this ->chunk : any -->1 : 1 -- } --} --module.exports = Chunk; -->module.exports = Chunk : typeof Chunk -->module.exports : typeof Chunk ++>chunk : number + >1 : 1 + } + } + module.exports = Chunk; + >module.exports = Chunk : typeof Chunk + >module.exports : typeof Chunk ->module : { exports: typeof Chunk; } -->exports : typeof Chunk -->Chunk : typeof Chunk ++>module : { Chunk: typeof Chunk; } + >exports : typeof Chunk + >Chunk : typeof Chunk diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff index 7d9f2149eb..2146881d0b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff @@ -1,63 +1,30 @@ --- old.jsdocImportType2.types +++ new.jsdocImportType2.types -@@= skipped -4, +4 lines =@@ - /** @typedef {import("./mod1")} C - * @type {C} */ - var c; -->c : D -+>c : any - - c.chunk; -->c.chunk : number -->c : D -->chunk : number -+>c.chunk : any -+>c : any -+>chunk : any - - const D = require("./mod1"); -->D : typeof D -->require("./mod1") : typeof D -+>D : any -+>require("./mod1") : any - >require : (name: string) => any - >"./mod1" : "./mod1" - - /** @type {D} */ - var d; -->d : D -+>d : error - - d.chunk; -->d.chunk : number -+>d.chunk : any - >d : D -->chunk : number -+>chunk : any - - === types.d.ts === - declare function require(name: string): any; -@@= skipped -33, +33 lines =@@ - declare var module: { exports: any }; - >module : { exports: any; } - >exports : any -- --=== mod1.js === --/// --module.exports = class Chunk { +@@= skipped -41, +41 lines =@@ + === mod1.js === + /// + module.exports = class Chunk { ->module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof import("mod1") ->module.exports : typeof import("mod1") ->module : { exports: typeof import("mod1"); } ->exports : typeof import("mod1") ->class Chunk { constructor() { this.chunk = 1; }} : typeof import("mod1") ->Chunk : typeof import("mod1") -- -- constructor() { -- this.chunk = 1; -->this.chunk = 1 : 1 ++>module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof import("./mod1") ++>module.exports : typeof import("./mod1") ++>module : { Chunk: typeof import("./mod1"); } ++>exports : typeof import("./mod1") ++>class Chunk { constructor() { this.chunk = 1; }} : typeof import("./mod1") ++>Chunk : typeof import("./mod1") + + constructor() { + this.chunk = 1; + >this.chunk = 1 : 1 ->this.chunk : any -->this : this ++>this.chunk : number + >this : this ->chunk : any -->1 : 1 -- } --} ++>chunk : number + >1 : 1 + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.errors.txt.diff index fd93dd30cc..f17383b1e4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.errors.txt.diff @@ -8,25 +8,49 @@ - - -==== use.js (4 errors) ==== -+use.js(1,19): error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. ++mod.js(2,21): error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. ++mod.js(2,37): error TS7006: Parameter 'n' implicitly has an 'any' type. ++mod.js(6,35): error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. ++mod.js(6,51): error TS7006: Parameter 'mom' implicitly has an 'any' type. ++use.js(3,5): error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. ++use.js(5,5): error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. + + -+==== use.js (1 errors) ==== ++==== use.js (2 errors) ==== var mod = require('./mod'); -+ ~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. mod.f('no') - ~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. mod.g('also no') - ~~~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ++ ~ ++!!! error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. mod.h(0) - ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. mod.i(1) - ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ++ ~ ++!!! error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. - ==== mod.js (0 errors) ==== - /** @param {number} n */ \ No newline at end of file +-==== mod.js (0 errors) ==== ++==== mod.js (4 errors) ==== + /** @param {number} n */ + exports.f = exports.g = function fg(n) { ++ ~ ++!!! error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. ++ ~ ++!!! error TS7006: Parameter 'n' implicitly has an 'any' type. + return n + 1 + } + /** @param {string} mom */ + module.exports.h = module.exports.i = function hi(mom) { ++ ~ ++!!! error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. ++ ~~~ ++!!! error TS7006: Parameter 'mom' implicitly has an 'any' type. + return `hi, ${mom}!`; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.types.diff index aafbc2150b..620d7eacf8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.types.diff @@ -1,59 +1,50 @@ --- old.jsdocTypeFromChainedAssignment2.types +++ new.jsdocTypeFromChainedAssignment2.types -@@= skipped -1, +1 lines =@@ - - === use.js === - var mod = require('./mod'); -->mod : typeof mod -->require('./mod') : typeof mod -+>mod : any -+>require('./mod') : any - >require : any +@@= skipped -7, +7 lines =@@ >'./mod' : "./mod" mod.f('no') ->mod.f('no') : number ->mod.f : (n: number) => number -->mod : typeof mod -->f : (n: number) => number +>mod.f('no') : any -+>mod.f : any -+>mod : any -+>f : any ++>mod.f : (n: any) => any + >mod : typeof mod +->f : (n: number) => number ++>f : (n: any) => any >'no' : "no" mod.g('also no') ->mod.g('also no') : number ->mod.g : (n: number) => number -->mod : typeof mod -->g : (n: number) => number +>mod.g('also no') : any +>mod.g : any -+>mod : any + >mod : typeof mod +->g : (n: number) => number +>g : any >'also no' : "also no" mod.h(0) -->mod.h(0) : string + >mod.h(0) : string ->mod.h : (mom: string) => string -->mod : typeof mod ++>mod.h : (mom: any) => string + >mod : typeof mod ->h : (mom: string) => string -+>mod.h(0) : any -+>mod.h : any -+>mod : any -+>h : any ++>h : (mom: any) => string >0 : 0 mod.i(1) ->mod.i(1) : string ->mod.i : (mom: string) => string -->mod : typeof mod ++>mod.i(1) : any ++>mod.i : any + >mod : typeof mod ->i : (mom: string) => string -->1 : 1 -- --=== mod.js === --/** @param {number} n */ --exports.f = exports.g = function fg(n) { ++>i : any + >1 : 1 + + === mod.js === + /** @param {number} n */ + exports.f = exports.g = function fg(n) { ->exports.f = exports.g = function fg(n) { return n + 1} : (n: number) => number ->exports.f : (n: number) => number ->exports : typeof import("mod") @@ -65,14 +56,27 @@ ->function fg(n) { return n + 1} : (n: number) => number ->fg : (n: number) => number ->n : number -- -- return n + 1 ++>exports.f = exports.g = function fg(n) { return n + 1} : (n: any) => any ++>exports.f : (n: any) => any ++>exports : typeof import("./mod") ++>f : (n: any) => any ++>exports.g = function fg(n) { return n + 1} : (n: any) => any ++>exports.g : any ++>exports : typeof import("./mod") ++>g : any ++>function fg(n) { return n + 1} : (n: any) => any ++>fg : (n: any) => any ++>n : any + + return n + 1 ->n + 1 : number ->n : number -->1 : 1 --} --/** @param {string} mom */ --module.exports.h = module.exports.i = function hi(mom) { ++>n + 1 : any ++>n : any + >1 : 1 + } + /** @param {string} mom */ + module.exports.h = module.exports.i = function hi(mom) { ->module.exports.h = module.exports.i = function hi(mom) { return `hi, ${mom}!`;} : (mom: string) => string ->module.exports.h : (mom: string) => string ->module.exports : typeof module.exports @@ -88,13 +92,24 @@ ->function hi(mom) { return `hi, ${mom}!`;} : (mom: string) => string ->hi : (mom: string) => string ->mom : string -- -- return `hi, ${mom}!`; -->`hi, ${mom}!` : string -->mom : string --} -+>mod.i(1) : any -+>mod.i : any -+>mod : any ++>module.exports.h = module.exports.i = function hi(mom) { return `hi, ${mom}!`;} : (mom: any) => string ++>module.exports.h : (mom: any) => string ++>module.exports : typeof import("./mod") ++>module : { "\"mod\"": typeof import("./mod"); } ++>exports : typeof import("./mod") ++>h : (mom: any) => string ++>module.exports.i = function hi(mom) { return `hi, ${mom}!`;} : (mom: any) => string ++>module.exports.i : any ++>module.exports : typeof import("./mod") ++>module : { "\"mod\"": typeof import("./mod"); } ++>exports : typeof import("./mod") +>i : any -+>1 : 1 ++>function hi(mom) { return `hi, ${mom}!`;} : (mom: any) => string ++>hi : (mom: any) => string ++>mom : any + + return `hi, ${mom}!`; + >`hi, ${mom}!` : string +->mom : string ++>mom : any + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff index 9ca705c2ea..9e66ced279 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff @@ -3,6 +3,7 @@ @@= skipped -0, +0 lines =@@ - +MC.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + +==== MC.js (1 errors) ==== @@ -22,7 +23,7 @@ + ~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + -+==== MW.js (0 errors) ==== ++==== MW.js (1 errors) ==== + /** @typedef {import("./MC")} MC */ + + class MW { @@ -35,4 +36,6 @@ + } + + module.exports = MW; ++ ~~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff index a188cf8a94..23c7215e5f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff @@ -1,16 +1,6 @@ --- old.jsdocTypeReferenceToImportOfClassExpression.types +++ new.jsdocTypeReferenceToImportOfClassExpression.types -@@= skipped -1, +1 lines =@@ - - === MC.js === - const MW = require("./MW"); -->MW : typeof MW -->require("./MW") : typeof MW -+>MW : any -+>require("./MW") : any - >require : any - >"./MW" : "./MW" - +@@= skipped -9, +9 lines =@@ /** @typedef {number} Cictema */ module.exports = class MC { @@ -28,42 +18,31 @@ +>MC : typeof import("./MC") watch() { -->watch : () => MW -+>watch : () => any - - return new MW(this); -->new MW(this) : MW -->MW : typeof MW -+>new MW(this) : any -+>MW : any - >this : this - } - }; -- --=== MW.js === --/** @typedef {import("./MC")} MC */ -- --class MW { -->MW : MW -- -- /** -- * @param {MC} compiler the compiler -- */ -- constructor(compiler) { + >watch : () => MW +@@= skipped -27, +27 lines =@@ + * @param {MC} compiler the compiler + */ + constructor(compiler) { ->compiler : import("MC") -- -- this.compiler = compiler; ++>compiler : import("./MC") + + this.compiler = compiler; ->this.compiler = compiler : import("MC") ->this.compiler : any -->this : this ++>this.compiler = compiler : import("./MC") ++>this.compiler : import("./MC") + >this : this ->compiler : any ->compiler : import("MC") -- } --} -- --module.exports = MW; -->module.exports = MW : typeof MW -->module.exports : typeof MW ++>compiler : import("./MC") ++>compiler : import("./MC") + } + } + + module.exports = MW; + >module.exports = MW : typeof MW + >module.exports : typeof MW ->module : { exports: typeof MW; } -->exports : typeof MW -->MW : typeof MW ++>module : { MW: typeof MW; } + >exports : typeof MW + >MW : typeof MW diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff index f54eb6f5ba..b9969a5cd3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff @@ -3,6 +3,8 @@ @@= skipped -0, +0 lines =@@ - +MC.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++MW.js(1,15): error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? ++MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + +==== MC.js (1 errors) ==== @@ -23,8 +25,10 @@ + ~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + -+==== MW.js (0 errors) ==== ++==== MW.js (2 errors) ==== + /** @typedef {import("./MC")} MC */ ++ ~~~~~~~~~~~~~~ ++!!! error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? + + class MW { + /** @@ -36,4 +40,6 @@ + } + + module.exports = MW; ++ ~~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff index e93ade3079..78a7b1659f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff @@ -1,17 +1,6 @@ --- old.jsdocTypeReferenceToImportOfFunctionExpression.types +++ new.jsdocTypeReferenceToImportOfFunctionExpression.types -@@= skipped -1, +1 lines =@@ - - === MC.js === - const MW = require("./MW"); -->MW : typeof MW -->require("./MW") : typeof MW -+>MW : any -+>require("./MW") : any - >require : any - >"./MW" : "./MW" - -@@= skipped -9, +9 lines =@@ +@@= skipped -10, +10 lines =@@ /** @class */ module.exports = function MC() { @@ -21,51 +10,37 @@ ->exports : { (): MW; new (): MC; } ->function MC() { /** @type {any} */ var x = {} return new MW(x);} : typeof MC ->MC : typeof MC -+>module.exports = function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => any -+>module.exports : () => any -+>module : { "export=": () => any; } -+>exports : () => any -+>function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => any -+>MC : () => any ++>module.exports = function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => MW ++>module.exports : () => MW ++>module : { "export=": () => MW; } ++>exports : () => MW ++>function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => MW ++>MC : () => MW /** @type {any} */ var x = {} -@@= skipped -13, +13 lines =@@ - >{} : {} - - return new MW(x); -->new MW(x) : MW -->MW : typeof MW -+>new MW(x) : any -+>MW : any - >x : any - - }; -- --=== MW.js === --/** @typedef {import("./MC")} MC */ -- --class MW { -->MW : MW -- -- /** -- * @param {MC} compiler the compiler -- */ -- constructor(compiler) { +@@= skipped -29, +29 lines =@@ + * @param {MC} compiler the compiler + */ + constructor(compiler) { ->compiler : { (): MW; new (): MC; } -- -- this.compiler = compiler; ++>compiler : any + + this.compiler = compiler; ->this.compiler = compiler : { (): MW; new (): MC; } -->this.compiler : any -->this : this -->compiler : any ++>this.compiler = compiler : any + >this.compiler : any + >this : this + >compiler : any ->compiler : { (): MW; new (): MC; } -- } --} -- --module.exports = MW; -->module.exports = MW : typeof MW -->module.exports : typeof MW ++>compiler : any + } + } + + module.exports = MW; + >module.exports = MW : typeof MW + >module.exports : typeof MW ->module : { exports: typeof MW; } -->exports : typeof MW -->MW : typeof MW ++>module : { MW: typeof MW; } + >exports : typeof MW + >MW : typeof MW diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport1.errors.txt.diff deleted file mode 100644 index 2c86b96c9c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport1.errors.txt.diff +++ /dev/null @@ -1,45 +0,0 @@ ---- old.lateBoundAssignmentDeclarationSupport1.errors.txt -+++ new.lateBoundAssignmentDeclarationSupport1.errors.txt -@@= skipped -0, +0 lines =@@ --lateBoundAssignmentDeclarationSupport1.js(5,1): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. -- Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. --lateBoundAssignmentDeclarationSupport1.js(6,1): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. -- Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. --usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. -- Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. --usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. -- Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. -- -- --==== usage.js (2 errors) ==== -+usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport1.js'. 'lateBoundAssignmentDeclarationSupport1.js' implicitly has an 'any' type. -+ -+ -+==== usage.js (1 errors) ==== - const x = require("./lateBoundAssignmentDeclarationSupport1.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport1.js'. 'lateBoundAssignmentDeclarationSupport1.js' implicitly has an 'any' type. - const y = x["my-fake-sym"]; -- ~~~~~~~~~~~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. --!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. - const z = x[x.S]; -- ~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. --!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. - --==== lateBoundAssignmentDeclarationSupport1.js (2 errors) ==== -+==== lateBoundAssignmentDeclarationSupport1.js (0 errors) ==== - // currently unsupported - const _sym = Symbol(); - const _str = "my-fake-sym"; - - exports[_sym] = "ok"; -- ~~~~~~~~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. --!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. - exports[_str] = "ok"; -- ~~~~~~~~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. --!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. - exports.S = _sym; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport1.types.diff index 45cbf9009c..c48f3cd217 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport1.types.diff @@ -1,63 +1,26 @@ --- old.lateBoundAssignmentDeclarationSupport1.types +++ new.lateBoundAssignmentDeclarationSupport1.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const x = require("./lateBoundAssignmentDeclarationSupport1.js"); -->x : typeof x -->require("./lateBoundAssignmentDeclarationSupport1.js") : typeof x -+>x : any -+>require("./lateBoundAssignmentDeclarationSupport1.js") : any - >require : any - >"./lateBoundAssignmentDeclarationSupport1.js" : "./lateBoundAssignmentDeclarationSupport1.js" - - const y = x["my-fake-sym"]; - >y : any - >x["my-fake-sym"] : any -->x : typeof x -+>x : any - >"my-fake-sym" : "my-fake-sym" - - const z = x[x.S]; - >z : any - >x[x.S] : any -->x : typeof x -->x.S : unique symbol -->x : typeof x -->S : unique symbol -- --=== lateBoundAssignmentDeclarationSupport1.js === --// currently unsupported --const _sym = Symbol(); -->_sym : unique symbol -->Symbol() : unique symbol -->Symbol : SymbolConstructor -- --const _str = "my-fake-sym"; -->_str : "my-fake-sym" -->"my-fake-sym" : "my-fake-sym" -- --exports[_sym] = "ok"; -->exports[_sym] = "ok" : "ok" -->exports[_sym] : any +@@= skipped -34, +34 lines =@@ + exports[_sym] = "ok"; + >exports[_sym] = "ok" : "ok" + >exports[_sym] : any ->exports : typeof import("lateBoundAssignmentDeclarationSupport1") -->_sym : unique symbol -->"ok" : "ok" -- --exports[_str] = "ok"; -->exports[_str] = "ok" : "ok" -->exports[_str] : any ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport1") + >_sym : unique symbol + >"ok" : "ok" + + exports[_str] = "ok"; + >exports[_str] = "ok" : "ok" + >exports[_str] : any ->exports : typeof import("lateBoundAssignmentDeclarationSupport1") -->_str : "my-fake-sym" -->"ok" : "ok" -- --exports.S = _sym; -->exports.S = _sym : unique symbol -->exports.S : unique symbol ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport1") + >_str : "my-fake-sym" + >"ok" : "ok" + + exports.S = _sym; + >exports.S = _sym : unique symbol + >exports.S : unique symbol ->exports : typeof import("lateBoundAssignmentDeclarationSupport1") -->S : unique symbol -->_sym : unique symbol -+>x : any -+>x.S : any -+>x : any -+>S : any ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport1") + >S : unique symbol + >_sym : unique symbol diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt.diff index a2f6ae520e..5df9ea7909 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt.diff @@ -5,41 +5,25 @@ - Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2.js")'. -lateBoundAssignmentDeclarationSupport2.js(6,1): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2.js")'. - Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2.js")'. --usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. -- Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. --usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. -- Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. -- -- --==== usage.js (2 errors) ==== -+usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport2.js'. 'lateBoundAssignmentDeclarationSupport2.js' implicitly has an 'any' type. -+ -+ -+==== usage.js (1 errors) ==== - const x = require("./lateBoundAssignmentDeclarationSupport2.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport2.js'. 'lateBoundAssignmentDeclarationSupport2.js' implicitly has an 'any' type. - const y = x["my-fake-sym"]; -- ~~~~~~~~~~~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. --!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. - const z = x[x.S]; -- ~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. --!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. - --==== lateBoundAssignmentDeclarationSupport2.js (2 errors) ==== -+==== lateBoundAssignmentDeclarationSupport2.js (0 errors) ==== - // currently unsupported - const _sym = Symbol(); - const _str = "my-fake-sym"; ++lateBoundAssignmentDeclarationSupport2.js(5,1): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. ++ Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. ++lateBoundAssignmentDeclarationSupport2.js(6,1): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. ++ Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. + usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. + Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. + usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +@@= skipped -25, +25 lines =@@ module.exports[_sym] = "ok"; -- ~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2.js")'. -!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2.js")'. ++!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. ++!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. module.exports[_str] = "ok"; -- ~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2.js")'. -!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2.js")'. ++!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. ++!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. module.exports.S = _sym; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.types.diff index 10987101e7..c27c28f17a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.types.diff @@ -1,69 +1,38 @@ --- old.lateBoundAssignmentDeclarationSupport2.types +++ new.lateBoundAssignmentDeclarationSupport2.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const x = require("./lateBoundAssignmentDeclarationSupport2.js"); -->x : typeof x -->require("./lateBoundAssignmentDeclarationSupport2.js") : typeof x -+>x : any -+>require("./lateBoundAssignmentDeclarationSupport2.js") : any - >require : any - >"./lateBoundAssignmentDeclarationSupport2.js" : "./lateBoundAssignmentDeclarationSupport2.js" - - const y = x["my-fake-sym"]; - >y : any - >x["my-fake-sym"] : any -->x : typeof x -+>x : any - >"my-fake-sym" : "my-fake-sym" - - const z = x[x.S]; - >z : any - >x[x.S] : any -->x : typeof x -->x.S : unique symbol -->x : typeof x -->S : unique symbol -- --=== lateBoundAssignmentDeclarationSupport2.js === --// currently unsupported --const _sym = Symbol(); -->_sym : unique symbol -->Symbol() : unique symbol -->Symbol : SymbolConstructor -- --const _str = "my-fake-sym"; -->_str : "my-fake-sym" -->"my-fake-sym" : "my-fake-sym" -- --module.exports[_sym] = "ok"; -->module.exports[_sym] = "ok" : "ok" -->module.exports[_sym] : any +@@= skipped -34, +34 lines =@@ + module.exports[_sym] = "ok"; + >module.exports[_sym] = "ok" : "ok" + >module.exports[_sym] : any ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->_sym : unique symbol -->"ok" : "ok" -- --module.exports[_str] = "ok"; -->module.exports[_str] = "ok" : "ok" -->module.exports[_str] : any ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport2") ++>module : { "\"lateBoundAssignmentDeclarationSupport2\"": typeof import("./lateBoundAssignmentDeclarationSupport2"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport2") + >_sym : unique symbol + >"ok" : "ok" + + module.exports[_str] = "ok"; + >module.exports[_str] = "ok" : "ok" + >module.exports[_str] : any ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->_str : "my-fake-sym" -->"ok" : "ok" -- --module.exports.S = _sym; -->module.exports.S = _sym : unique symbol -->module.exports.S : unique symbol ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport2") ++>module : { "\"lateBoundAssignmentDeclarationSupport2\"": typeof import("./lateBoundAssignmentDeclarationSupport2"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport2") + >_str : "my-fake-sym" + >"ok" : "ok" + + module.exports.S = _sym; + >module.exports.S = _sym : unique symbol + >module.exports.S : unique symbol ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->S : unique symbol -->_sym : unique symbol -+>x : any -+>x.S : any -+>x : any -+>S : any ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport2") ++>module : { "\"lateBoundAssignmentDeclarationSupport2\"": typeof import("./lateBoundAssignmentDeclarationSupport2"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport2") + >S : unique symbol + >_sym : unique symbol diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport3.errors.txt.diff deleted file mode 100644 index 044deceeb9..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport3.errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.lateBoundAssignmentDeclarationSupport3.errors.txt -+++ new.lateBoundAssignmentDeclarationSupport3.errors.txt -@@= skipped -0, +0 lines =@@ --usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. -- Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. --usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. -- Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. -- -- --==== usage.js (2 errors) ==== -+usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport3.js'. 'lateBoundAssignmentDeclarationSupport3.js' implicitly has an 'any' type. -+ -+ -+==== usage.js (1 errors) ==== - const x = require("./lateBoundAssignmentDeclarationSupport3.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport3.js'. 'lateBoundAssignmentDeclarationSupport3.js' implicitly has an 'any' type. - const y = x["my-fake-sym"]; -- ~~~~~~~~~~~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. --!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. - const z = x[x.S]; -- ~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. --!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. - - ==== lateBoundAssignmentDeclarationSupport3.js (0 errors) ==== - // currently unsupported \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport3.types.diff index d731b99fc2..fb61885123 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport3.types.diff @@ -1,77 +1,49 @@ --- old.lateBoundAssignmentDeclarationSupport3.types +++ new.lateBoundAssignmentDeclarationSupport3.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const x = require("./lateBoundAssignmentDeclarationSupport3.js"); -->x : typeof x -->require("./lateBoundAssignmentDeclarationSupport3.js") : typeof x -+>x : any -+>require("./lateBoundAssignmentDeclarationSupport3.js") : any - >require : any - >"./lateBoundAssignmentDeclarationSupport3.js" : "./lateBoundAssignmentDeclarationSupport3.js" - - const y = x["my-fake-sym"]; - >y : any - >x["my-fake-sym"] : any -->x : typeof x -+>x : any +@@= skipped -32, +32 lines =@@ >"my-fake-sym" : "my-fake-sym" - const z = x[x.S]; - >z : any - >x[x.S] : any -->x : typeof x -->x.S : unique symbol -->x : typeof x -->S : unique symbol -- --=== lateBoundAssignmentDeclarationSupport3.js === --// currently unsupported --const _sym = Symbol(); -->_sym : unique symbol -->Symbol() : unique symbol -->Symbol : SymbolConstructor -- --const _str = "my-fake-sym"; -->_str : "my-fake-sym" -->"my-fake-sym" : "my-fake-sym" -- --Object.defineProperty(module.exports, _sym, { value: "ok" }); + Object.defineProperty(module.exports, _sym, { value: "ok" }); ->Object.defineProperty(module.exports, _sym, { value: "ok" }) : typeof module.exports -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(module.exports, _sym, { value: "ok" }) : typeof import("./lateBoundAssignmentDeclarationSupport3") + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->_sym : unique symbol -->{ value: "ok" } : { value: string; } -->value : string -->"ok" : "ok" -- --Object.defineProperty(module.exports, _str, { value: "ok" }); ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport3") ++>module : { "\"lateBoundAssignmentDeclarationSupport3\"": typeof import("./lateBoundAssignmentDeclarationSupport3"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport3") + >_sym : unique symbol + >{ value: "ok" } : { value: string; } + >value : string + >"ok" : "ok" + + Object.defineProperty(module.exports, _str, { value: "ok" }); ->Object.defineProperty(module.exports, _str, { value: "ok" }) : typeof module.exports -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(module.exports, _str, { value: "ok" }) : typeof import("./lateBoundAssignmentDeclarationSupport3") + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->_str : "my-fake-sym" -->{ value: "ok" } : { value: string; } -->value : string -->"ok" : "ok" -- --module.exports.S = _sym; -->module.exports.S = _sym : unique symbol -->module.exports.S : unique symbol ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport3") ++>module : { "\"lateBoundAssignmentDeclarationSupport3\"": typeof import("./lateBoundAssignmentDeclarationSupport3"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport3") + >_str : "my-fake-sym" + >{ value: "ok" } : { value: string; } + >value : string +@@= skipped -28, +28 lines =@@ + module.exports.S = _sym; + >module.exports.S = _sym : unique symbol + >module.exports.S : unique symbol ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->S : unique symbol -->_sym : unique symbol -+>x : any -+>x.S : any -+>x : any -+>S : any ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport3") ++>module : { "\"lateBoundAssignmentDeclarationSupport3\"": typeof import("./lateBoundAssignmentDeclarationSupport3"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport3") + >S : unique symbol + >_sym : unique symbol diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt.diff index 62470a0eee..dd1e65248a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt.diff @@ -12,14 +12,15 @@ - - -==== usage.js (2 errors) ==== -+usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport4.js'. 'lateBoundAssignmentDeclarationSupport4.js' implicitly has an 'any' type. ++lateBoundAssignmentDeclarationSupport4.js(9,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ++usage.js(2,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. + + +==== usage.js (1 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport4.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport4.js'. 'lateBoundAssignmentDeclarationSupport4.js' implicitly has an 'any' type. const inst = new x.F(); ++ ~~~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const y = inst["my-fake-sym"]; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'. @@ -30,13 +31,16 @@ -!!! error TS7053: Property '[_sym]' does not exist on type 'F'. -==== lateBoundAssignmentDeclarationSupport4.js (2 errors) ==== -+==== lateBoundAssignmentDeclarationSupport4.js (0 errors) ==== ++==== lateBoundAssignmentDeclarationSupport4.js (1 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; -@@= skipped -30, +19 lines =@@ +@@= skipped -29, +19 lines =@@ + F.prototype[_sym] = "ok"; F.prototype[_str] = "ok"; const inst = new F(); ++ ~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const _y = inst[_str]; - ~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.types.diff index bcc4219bd4..4b11dd68f3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.types.diff @@ -1,27 +1,18 @@ --- old.lateBoundAssignmentDeclarationSupport4.types +++ new.lateBoundAssignmentDeclarationSupport4.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const x = require("./lateBoundAssignmentDeclarationSupport4.js"); -->x : typeof x -->require("./lateBoundAssignmentDeclarationSupport4.js") : typeof x -+>x : any -+>require("./lateBoundAssignmentDeclarationSupport4.js") : any - >require : any +@@= skipped -7, +7 lines =@@ >"./lateBoundAssignmentDeclarationSupport4.js" : "./lateBoundAssignmentDeclarationSupport4.js" const inst = new x.F(); ->inst : x.F ->new x.F() : x.F ->x.F : typeof x.F -->x : typeof x -->F : typeof x.F +>inst : any +>new x.F() : any -+>x.F : any -+>x : any -+>F : any ++>x.F : () => void + >x : typeof x +->F : typeof x.F ++>F : () => void const y = inst["my-fake-sym"]; >y : any @@ -34,60 +25,59 @@ >z : any >inst[x.S] : any ->inst : x.F -->x.S : unique symbol -->x : typeof x -->S : unique symbol -- --=== lateBoundAssignmentDeclarationSupport4.js === --// currently unsupported --const _sym = Symbol(); -->_sym : unique symbol -->Symbol() : unique symbol -->Symbol : SymbolConstructor -- --const _str = "my-fake-sym"; -->_str : "my-fake-sym" -->"my-fake-sym" : "my-fake-sym" -- --function F() { ++>inst : any + >x.S : unique symbol + >x : typeof x + >S : unique symbol +@@= skipped -32, +32 lines =@@ + >"my-fake-sym" : "my-fake-sym" + + function F() { ->F : typeof F --} --F.prototype[_sym] = "ok"; -->F.prototype[_sym] = "ok" : "ok" -->F.prototype[_sym] : any -->F.prototype : any ++>F : () => void + } + F.prototype[_sym] = "ok"; + >F.prototype[_sym] = "ok" : "ok" + >F.prototype[_sym] : any + >F.prototype : any ->F : typeof F -->prototype : any -->_sym : unique symbol -->"ok" : "ok" -- --F.prototype[_str] = "ok"; -->F.prototype[_str] = "ok" : "ok" -->F.prototype[_str] : any -->F.prototype : any ++>F : () => void + >prototype : any + >_sym : unique symbol + >"ok" : "ok" +@@= skipped -15, +15 lines =@@ + >F.prototype[_str] = "ok" : "ok" + >F.prototype[_str] : any + >F.prototype : any ->F : typeof F -->prototype : any -->_str : "my-fake-sym" -->"ok" : "ok" -- --const inst = new F(); ++>F : () => void + >prototype : any + >_str : "my-fake-sym" + >"ok" : "ok" + + const inst = new F(); ->inst : F ->new F() : F ->F : typeof F -- --const _y = inst[_str]; -->_y : any -->inst[_str] : any ++>inst : any ++>new F() : any ++>F : () => void + + const _y = inst[_str]; + >_y : any + >inst[_str] : any ->inst : F -->_str : "my-fake-sym" -- --const _z = inst[_sym]; -->_z : any -->inst[_sym] : any ++>inst : any + >_str : "my-fake-sym" + + const _z = inst[_sym]; + >_z : any + >inst[_sym] : any ->inst : F -->_sym : unique symbol -- --module.exports.F = F; ++>inst : any + >_sym : unique symbol + + module.exports.F = F; ->module.exports.F = F : typeof F ->module.exports.F : typeof F ->module.exports : typeof module.exports @@ -95,16 +85,22 @@ ->exports : typeof module.exports ->F : typeof F ->F : typeof F -- --module.exports.S = _sym; -->module.exports.S = _sym : unique symbol -->module.exports.S : unique symbol ++>module.exports.F = F : () => void ++>module.exports.F : () => void ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport4") ++>module : { "\"lateBoundAssignmentDeclarationSupport4\"": typeof import("./lateBoundAssignmentDeclarationSupport4"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport4") ++>F : () => void ++>F : () => void + + module.exports.S = _sym; + >module.exports.S = _sym : unique symbol + >module.exports.S : unique symbol ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->S : unique symbol -->_sym : unique symbol -+>inst : any -+>x.S : any -+>x : any -+>S : any ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport4") ++>module : { "\"lateBoundAssignmentDeclarationSupport4\"": typeof import("./lateBoundAssignmentDeclarationSupport4"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport4") + >S : unique symbol + >_sym : unique symbol diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt.diff index d90baf0500..ce391004a9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt.diff @@ -12,14 +12,15 @@ - - -==== usage.js (2 errors) ==== -+usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport5.js'. 'lateBoundAssignmentDeclarationSupport5.js' implicitly has an 'any' type. ++lateBoundAssignmentDeclarationSupport5.js(11,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ++usage.js(2,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. + + +==== usage.js (1 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport5.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport5.js'. 'lateBoundAssignmentDeclarationSupport5.js' implicitly has an 'any' type. const inst = new x.F(); ++ ~~~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const y = inst["my-fake-sym"]; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'. @@ -30,13 +31,16 @@ -!!! error TS7053: Property '[_sym]' does not exist on type 'F'. -==== lateBoundAssignmentDeclarationSupport5.js (2 errors) ==== -+==== lateBoundAssignmentDeclarationSupport5.js (0 errors) ==== ++==== lateBoundAssignmentDeclarationSupport5.js (1 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; -@@= skipped -32, +21 lines =@@ +@@= skipped -31, +21 lines =@@ + [_str]: "ok" } const inst = new F(); ++ ~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const _y = inst[_str]; - ~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.types.diff index 1a36d60671..f7d165b11d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.types.diff @@ -1,27 +1,18 @@ --- old.lateBoundAssignmentDeclarationSupport5.types +++ new.lateBoundAssignmentDeclarationSupport5.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const x = require("./lateBoundAssignmentDeclarationSupport5.js"); -->x : typeof x -->require("./lateBoundAssignmentDeclarationSupport5.js") : typeof x -+>x : any -+>require("./lateBoundAssignmentDeclarationSupport5.js") : any - >require : any +@@= skipped -7, +7 lines =@@ >"./lateBoundAssignmentDeclarationSupport5.js" : "./lateBoundAssignmentDeclarationSupport5.js" const inst = new x.F(); ->inst : x.F ->new x.F() : x.F ->x.F : typeof x.F -->x : typeof x -->F : typeof x.F +>inst : any +>new x.F() : any -+>x.F : any -+>x : any -+>F : any ++>x.F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } + >x : typeof x +->F : typeof x.F ++>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } const y = inst["my-fake-sym"]; >y : any @@ -34,59 +25,51 @@ >z : any >inst[x.S] : any ->inst : x.F -->x.S : unique symbol -->x : typeof x -->S : unique symbol -- --=== lateBoundAssignmentDeclarationSupport5.js === --// currently unsupported --const _sym = Symbol(); -->_sym : unique symbol -->Symbol() : unique symbol -->Symbol : SymbolConstructor -- --const _str = "my-fake-sym"; -->_str : "my-fake-sym" -->"my-fake-sym" : "my-fake-sym" -- --function F() { ++>inst : any + >x.S : unique symbol + >x : typeof x + >S : unique symbol +@@= skipped -32, +32 lines =@@ + >"my-fake-sym" : "my-fake-sym" + + function F() { ->F : typeof F --} --F.prototype = { -->F.prototype = { [_sym]: "ok", [_str]: "ok"} : { [_sym]: string; "my-fake-sym": string; } -->F.prototype : { [_sym]: string; "my-fake-sym": string; } ++>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } + } + F.prototype = { + >F.prototype = { [_sym]: "ok", [_str]: "ok"} : { [_sym]: string; "my-fake-sym": string; } + >F.prototype : { [_sym]: string; "my-fake-sym": string; } ->F : typeof F -->prototype : { [_sym]: string; "my-fake-sym": string; } -->{ [_sym]: "ok", [_str]: "ok"} : { [_sym]: string; "my-fake-sym": string; } -- -- [_sym]: "ok", -->[_sym] : string -->_sym : unique symbol -->"ok" : "ok" -- -- [_str]: "ok" -->[_str] : string -->_str : "my-fake-sym" -->"ok" : "ok" --} --const inst = new F(); ++>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } + >prototype : { [_sym]: string; "my-fake-sym": string; } + >{ [_sym]: "ok", [_str]: "ok"} : { [_sym]: string; "my-fake-sym": string; } + +@@= skipped -20, +20 lines =@@ + >"ok" : "ok" + } + const inst = new F(); ->inst : F ->new F() : F ->F : typeof F -- --const _y = inst[_str]; -->_y : any -->inst[_str] : any ++>inst : any ++>new F() : any ++>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } + + const _y = inst[_str]; + >_y : any + >inst[_str] : any ->inst : F -->_str : "my-fake-sym" -- --const _z = inst[_sym]; -->_z : any -->inst[_sym] : any ++>inst : any + >_str : "my-fake-sym" + + const _z = inst[_sym]; + >_z : any + >inst[_sym] : any ->inst : F -->_sym : unique symbol -- --module.exports.F = F; ++>inst : any + >_sym : unique symbol + + module.exports.F = F; ->module.exports.F = F : typeof F ->module.exports.F : typeof F ->module.exports : typeof module.exports @@ -94,16 +77,22 @@ ->exports : typeof module.exports ->F : typeof F ->F : typeof F -- --module.exports.S = _sym; -->module.exports.S = _sym : unique symbol -->module.exports.S : unique symbol ++>module.exports.F = F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } ++>module.exports.F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport5") ++>module : { "\"lateBoundAssignmentDeclarationSupport5\"": typeof import("./lateBoundAssignmentDeclarationSupport5"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport5") ++>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } ++>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } + + module.exports.S = _sym; + >module.exports.S = _sym : unique symbol + >module.exports.S : unique symbol ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->S : unique symbol -->_sym : unique symbol -+>inst : any -+>x.S : any -+>x : any -+>S : any ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport5") ++>module : { "\"lateBoundAssignmentDeclarationSupport5\"": typeof import("./lateBoundAssignmentDeclarationSupport5"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport5") + >S : unique symbol + >_sym : unique symbol diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt.diff index 0dcd53e959..acc021e6d2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt.diff @@ -12,14 +12,15 @@ - - -==== usage.js (2 errors) ==== -+usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport6.js'. 'lateBoundAssignmentDeclarationSupport6.js' implicitly has an 'any' type. ++lateBoundAssignmentDeclarationSupport6.js(10,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ++usage.js(2,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. + + +==== usage.js (1 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport6.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport6.js'. 'lateBoundAssignmentDeclarationSupport6.js' implicitly has an 'any' type. const inst = new x.F(); ++ ~~~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const y = inst["my-fake-sym"]; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'. @@ -30,13 +31,16 @@ -!!! error TS7053: Property '[_sym]' does not exist on type 'F'. -==== lateBoundAssignmentDeclarationSupport6.js (2 errors) ==== -+==== lateBoundAssignmentDeclarationSupport6.js (0 errors) ==== ++==== lateBoundAssignmentDeclarationSupport6.js (1 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; -@@= skipped -31, +20 lines =@@ +@@= skipped -30, +20 lines =@@ + Object.defineProperty(F.prototype, _str, {value: "ok"}); Object.defineProperty(F.prototype, _sym, {value: "ok"}); const inst = new F(); ++ ~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const _y = inst[_str]; - ~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.types.diff index bff7d4f99f..214cb6462d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.types.diff @@ -1,27 +1,18 @@ --- old.lateBoundAssignmentDeclarationSupport6.types +++ new.lateBoundAssignmentDeclarationSupport6.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const x = require("./lateBoundAssignmentDeclarationSupport6.js"); -->x : typeof x -->require("./lateBoundAssignmentDeclarationSupport6.js") : typeof x -+>x : any -+>require("./lateBoundAssignmentDeclarationSupport6.js") : any - >require : any +@@= skipped -7, +7 lines =@@ >"./lateBoundAssignmentDeclarationSupport6.js" : "./lateBoundAssignmentDeclarationSupport6.js" const inst = new x.F(); ->inst : x.F ->new x.F() : x.F ->x.F : typeof x.F -->x : typeof x -->F : typeof x.F +>inst : any +>new x.F() : any -+>x.F : any -+>x : any -+>F : any ++>x.F : () => void + >x : typeof x +->F : typeof x.F ++>F : () => void const y = inst["my-fake-sym"]; >y : any @@ -34,77 +25,70 @@ >z : any >inst[x.S] : any ->inst : x.F -->x.S : unique symbol -->x : typeof x -->S : unique symbol -- --=== lateBoundAssignmentDeclarationSupport6.js === --// currently unsupported --const _sym = Symbol(); -->_sym : unique symbol -->Symbol() : unique symbol -->Symbol : SymbolConstructor -- --const _str = "my-fake-sym"; -->_str : "my-fake-sym" -->"my-fake-sym" : "my-fake-sym" -- --function F() { ++>inst : any + >x.S : unique symbol + >x : typeof x + >S : unique symbol +@@= skipped -32, +32 lines =@@ + >"my-fake-sym" : "my-fake-sym" + + function F() { ->F : typeof F --} --F.prototype.defsAClass = true; -->F.prototype.defsAClass = true : true -->F.prototype.defsAClass : any -->F.prototype : any ++>F : () => void + } + F.prototype.defsAClass = true; + >F.prototype.defsAClass = true : true + >F.prototype.defsAClass : any + >F.prototype : any ->F : typeof F -->prototype : any -->defsAClass : any -->true : true -- --Object.defineProperty(F.prototype, _str, {value: "ok"}); -->Object.defineProperty(F.prototype, _str, {value: "ok"}) : any -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->F.prototype : any ++>F : () => void + >prototype : any + >defsAClass : any + >true : true +@@= skipped -17, +17 lines =@@ + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >F.prototype : any ->F : typeof F -->prototype : any -->_str : "my-fake-sym" -->{value: "ok"} : { value: string; } -->value : string -->"ok" : "ok" -- --Object.defineProperty(F.prototype, _sym, {value: "ok"}); -->Object.defineProperty(F.prototype, _sym, {value: "ok"}) : any -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->F.prototype : any ++>F : () => void + >prototype : any + >_str : "my-fake-sym" + >{value: "ok"} : { value: string; } +@@= skipped -13, +13 lines =@@ + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >F.prototype : any ->F : typeof F -->prototype : any -->_sym : unique symbol -->{value: "ok"} : { value: string; } -->value : string -->"ok" : "ok" -- --const inst = new F(); ++>F : () => void + >prototype : any + >_sym : unique symbol + >{value: "ok"} : { value: string; } +@@= skipped -8, +8 lines =@@ + >"ok" : "ok" + + const inst = new F(); ->inst : F ->new F() : F ->F : typeof F -- --const _y = inst[_str]; -->_y : any -->inst[_str] : any ++>inst : any ++>new F() : any ++>F : () => void + + const _y = inst[_str]; + >_y : any + >inst[_str] : any ->inst : F -->_str : "my-fake-sym" -- --const _z = inst[_sym]; -->_z : any -->inst[_sym] : any ++>inst : any + >_str : "my-fake-sym" + + const _z = inst[_sym]; + >_z : any + >inst[_sym] : any ->inst : F -->_sym : unique symbol -- --module.exports.F = F; ++>inst : any + >_sym : unique symbol + + module.exports.F = F; ->module.exports.F = F : typeof F ->module.exports.F : typeof F ->module.exports : typeof module.exports @@ -112,16 +96,22 @@ ->exports : typeof module.exports ->F : typeof F ->F : typeof F -- --module.exports.S = _sym; -->module.exports.S = _sym : unique symbol -->module.exports.S : unique symbol ++>module.exports.F = F : () => void ++>module.exports.F : () => void ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport6") ++>module : { "\"lateBoundAssignmentDeclarationSupport6\"": typeof import("./lateBoundAssignmentDeclarationSupport6"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport6") ++>F : () => void ++>F : () => void + + module.exports.S = _sym; + >module.exports.S = _sym : unique symbol + >module.exports.S : unique symbol ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->S : unique symbol -->_sym : unique symbol -+>inst : any -+>x.S : any -+>x : any -+>S : any ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport6") ++>module : { "\"lateBoundAssignmentDeclarationSupport6\"": typeof import("./lateBoundAssignmentDeclarationSupport6"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport6") + >S : unique symbol + >_sym : unique symbol diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport7.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport7.errors.txt.diff deleted file mode 100644 index 27c7b9fd5b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport7.errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.lateBoundAssignmentDeclarationSupport7.errors.txt -+++ new.lateBoundAssignmentDeclarationSupport7.errors.txt -@@= skipped -0, +0 lines =@@ -- -+usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport7.js'. 'lateBoundAssignmentDeclarationSupport7.js' implicitly has an 'any' type. -+ -+ -+==== usage.js (1 errors) ==== -+ const x = require("./lateBoundAssignmentDeclarationSupport7.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport7.js'. 'lateBoundAssignmentDeclarationSupport7.js' implicitly has an 'any' type. -+ const y = x.F["my-fake-sym"]; -+ const z = x.F[x.S]; -+ -+==== lateBoundAssignmentDeclarationSupport7.js (0 errors) ==== -+ const _sym = Symbol(); -+ const _str = "my-fake-sym"; -+ -+ function F() { -+ } -+ F[_sym] = "ok"; -+ F[_str] = "ok"; -+ module.exports.F = F; -+ module.exports.S = _sym; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport7.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport7.types.diff index c8b83e609d..9d99d6490f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport7.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport7.types.diff @@ -1,67 +1,51 @@ --- old.lateBoundAssignmentDeclarationSupport7.types +++ new.lateBoundAssignmentDeclarationSupport7.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const x = require("./lateBoundAssignmentDeclarationSupport7.js"); -->x : typeof x -->require("./lateBoundAssignmentDeclarationSupport7.js") : typeof x -+>x : any -+>require("./lateBoundAssignmentDeclarationSupport7.js") : any - >require : any - >"./lateBoundAssignmentDeclarationSupport7.js" : "./lateBoundAssignmentDeclarationSupport7.js" - +@@= skipped -9, +9 lines =@@ const y = x.F["my-fake-sym"]; -->y : string -->x.F["my-fake-sym"] : string + >y : string + >x.F["my-fake-sym"] : string ->x.F : typeof x.F -->x : typeof x ++>x.F : { (): void; [_sym]: string; "my-fake-sym": string; } + >x : typeof x ->F : typeof x.F -+>y : any -+>x.F["my-fake-sym"] : any -+>x.F : any -+>x : any -+>F : any ++>F : { (): void; [_sym]: string; "my-fake-sym": string; } >"my-fake-sym" : "my-fake-sym" const z = x.F[x.S]; -->z : string -->x.F[x.S] : string + >z : string + >x.F[x.S] : string ->x.F : typeof x.F -->x : typeof x ++>x.F : { (): void; [_sym]: string; "my-fake-sym": string; } + >x : typeof x ->F : typeof x.F -->x.S : unique symbol -->x : typeof x -->S : unique symbol -- --=== lateBoundAssignmentDeclarationSupport7.js === --const _sym = Symbol(); -->_sym : unique symbol -->Symbol() : unique symbol -->Symbol : SymbolConstructor -- --const _str = "my-fake-sym"; -->_str : "my-fake-sym" -->"my-fake-sym" : "my-fake-sym" -- --function F() { ++>F : { (): void; [_sym]: string; "my-fake-sym": string; } + >x.S : unique symbol + >x : typeof x + >S : unique symbol +@@= skipped -26, +26 lines =@@ + >"my-fake-sym" : "my-fake-sym" + + function F() { ->F : typeof F --} --F[_sym] = "ok"; -->F[_sym] = "ok" : "ok" -->F[_sym] : string ++>F : { (): void; [_sym]: string; "my-fake-sym": string; } + } + F[_sym] = "ok"; + >F[_sym] = "ok" : "ok" + >F[_sym] : string ->F : typeof F -->_sym : unique symbol -->"ok" : "ok" -- --F[_str] = "ok"; -->F[_str] = "ok" : "ok" -->F[_str] : string ++>F : { (): void; [_sym]: string; "my-fake-sym": string; } + >_sym : unique symbol + >"ok" : "ok" + + F[_str] = "ok"; + >F[_str] = "ok" : "ok" + >F[_str] : string ->F : typeof F -->_str : "my-fake-sym" -->"ok" : "ok" -- --module.exports.F = F; ++>F : { (): void; [_sym]: string; "my-fake-sym": string; } + >_str : "my-fake-sym" + >"ok" : "ok" + + module.exports.F = F; ->module.exports.F = F : typeof F ->module.exports.F : typeof F ->module.exports : typeof module.exports @@ -69,20 +53,22 @@ ->exports : typeof module.exports ->F : typeof F ->F : typeof F -- --module.exports.S = _sym; -->module.exports.S = _sym : unique symbol -->module.exports.S : unique symbol ++>module.exports.F = F : { (): void; [_sym]: string; "my-fake-sym": string; } ++>module.exports.F : { (): void; [_sym]: string; "my-fake-sym": string; } ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport7") ++>module : { "\"lateBoundAssignmentDeclarationSupport7\"": typeof import("./lateBoundAssignmentDeclarationSupport7"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport7") ++>F : { (): void; [_sym]: string; "my-fake-sym": string; } ++>F : { (): void; [_sym]: string; "my-fake-sym": string; } + + module.exports.S = _sym; + >module.exports.S = _sym : unique symbol + >module.exports.S : unique symbol ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->S : unique symbol -->_sym : unique symbol -+>z : any -+>x.F[x.S] : any -+>x.F : any -+>x : any -+>F : any -+>x.S : any -+>x : any -+>S : any ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport7") ++>module : { "\"lateBoundAssignmentDeclarationSupport7\"": typeof import("./lateBoundAssignmentDeclarationSupport7"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport7") + >S : unique symbol + >_sym : unique symbol diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.errors.txt.diff new file mode 100644 index 0000000000..9153651bd2 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.errors.txt.diff @@ -0,0 +1,34 @@ +--- old.moduleExportAlias2.errors.txt ++++ new.moduleExportAlias2.errors.txt +@@= skipped -0, +0 lines =@@ +- ++index.js(4,13): error TS2351: This expression is not constructable. ++ Type 'typeof import("semver")' has no construct signatures. ++semver.js(2,1): error TS2631: Cannot assign to '"semver"' because it is a namespace. ++semver.js(2,11): error TS2322: Type '() => void' is not assignable to type 'typeof import("semver")'. ++ ++ ++==== index.js (1 errors) ==== ++ /// ++ const C = require("./semver") ++ var two = C.f(1) ++ var c = new C ++ ~ ++!!! error TS2351: This expression is not constructable. ++!!! error TS2351: Type 'typeof import("semver")' has no construct signatures. ++ ++==== node.d.ts (0 errors) ==== ++ declare function require(name: string): any; ++ declare var exports: any; ++ declare var module: { exports: any }; ++==== semver.js (2 errors) ==== ++ /// ++ exports = module.exports = C ++ ~~~~~~~ ++!!! error TS2631: Cannot assign to '"semver"' because it is a namespace. ++ ~~~~~~~~~~~~~~ ++!!! error TS2322: Type '() => void' is not assignable to type 'typeof import("semver")'. ++ exports.f = n => n + 1 ++ function C() { ++ this.p = 1 ++ } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.types.diff index a5e4170584..4784001b51 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.types.diff @@ -1,44 +1,20 @@ --- old.moduleExportAlias2.types +++ new.moduleExportAlias2.types -@@= skipped -2, +2 lines =@@ - === index.js === - /// - const C = require("./semver") -->C : typeof C -->require("./semver") : typeof C -+>C : any -+>require("./semver") : any - >require : (name: string) => any - >"./semver" : "./semver" - - var two = C.f(1) - >two : any - >C.f(1) : any -->C.f : (n: any) => any -->C : typeof C -->f : (n: any) => any -+>C.f : any -+>C : any -+>f : any +@@= skipped -16, +16 lines =@@ >1 : 1 var c = new C ->c : C ->new C : C -->C : typeof C +>c : any +>new C : any -+>C : any + >C : typeof C === node.d.ts === - declare function require(name: string): any; -@@= skipped -30, +30 lines =@@ - >module : { exports: any; } - >exports : any - --=== semver.js === --/// --exports = module.exports = C +@@= skipped -19, +19 lines =@@ + === semver.js === + /// + exports = module.exports = C ->exports = module.exports = C : typeof C ->exports : typeof C ->module.exports = C : typeof C @@ -46,25 +22,34 @@ ->module : { exports: typeof C; } ->exports : typeof C ->C : typeof C -- --exports.f = n => n + 1 -->exports.f = n => n + 1 : (n: any) => any -->exports.f : (n: any) => any ++>exports = module.exports = C : () => void ++>exports : any ++>module.exports = C : () => void ++>module.exports : typeof import("./semver") ++>module : { "\"semver\"": typeof import("./semver"); } ++>exports : typeof import("./semver") ++>C : () => void + + exports.f = n => n + 1 + >exports.f = n => n + 1 : (n: any) => any + >exports.f : (n: any) => any ->exports : typeof C -->f : (n: any) => any -->n => n + 1 : (n: any) => any -->n : any -->n + 1 : any -->n : any -->1 : 1 -- --function C() { ++>exports : typeof import("./semver") + >f : (n: any) => any + >n => n + 1 : (n: any) => any + >n : any +@@= skipped -20, +20 lines =@@ + >1 : 1 + + function C() { ->C : typeof C -- -- this.p = 1 -->this.p = 1 : 1 -->this.p : any ++>C : () => void + + this.p = 1 + >this.p = 1 : 1 + >this.p : any ->this : this -->p : any -->1 : 1 --} \ No newline at end of file ++>this : any + >p : any + >1 : 1 + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment.errors.txt.diff new file mode 100644 index 0000000000..9b02b363c3 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment.errors.txt.diff @@ -0,0 +1,48 @@ +--- old.moduleExportAssignment.errors.txt ++++ new.moduleExportAssignment.errors.txt +@@= skipped -0, +0 lines =@@ +- ++npmlog.js(5,14): error TS2741: Property 'y' is missing in type 'EE' but required in type 'typeof import("npmlog")'. ++npmlog.js(8,16): error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. ++npmlog.js(10,8): error TS2339: Property 'x' does not exist on type 'EE'. ++npmlog.js(12,8): error TS2339: Property 'y' does not exist on type 'EE'. ++npmlog.js(13,16): error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. ++use.js(2,8): error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. ++use.js(3,8): error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. ++ ++ ++==== use.js (2 errors) ==== ++ var npmlog = require('./npmlog') ++ npmlog.x ++ ~ ++!!! error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. ++ npmlog.on ++ ~~ ++!!! error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. ++ ++==== npmlog.js (5 errors) ==== ++ class EE { ++ /** @param {string} s */ ++ on(s) { } ++ } ++ var npmlog = module.exports = new EE() ++ ~~~~~~~~~~~~~~ ++!!! error TS2741: Property 'y' is missing in type 'EE' but required in type 'typeof import("npmlog")'. ++!!! related TS2728 npmlog.js:11:1: 'y' is declared here. ++ ++ npmlog.on('hi') // both references should see EE.on ++ module.exports.on('hi') // here too ++ ~~ ++!!! error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. ++ ++ npmlog.x = 1 ++ ~ ++!!! error TS2339: Property 'x' does not exist on type 'EE'. ++ module.exports.y = 2 ++ npmlog.y ++ ~ ++!!! error TS2339: Property 'y' does not exist on type 'EE'. ++ module.exports.x ++ ~ ++!!! error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment.types.diff index d43b301909..2518a28793 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment.types.diff @@ -6,8 +6,8 @@ var npmlog = require('./npmlog') ->npmlog : { on(s: string): void; x: number; y: 2; } ->require('./npmlog') : { on(s: string): void; x: number; y: 2; } -+>npmlog : any -+>require('./npmlog') : any ++>npmlog : typeof npmlog ++>require('./npmlog') : typeof npmlog >require : any >'./npmlog' : "./npmlog" @@ -16,75 +16,97 @@ ->npmlog : { on(s: string): void; x: number; y: 2; } ->x : number +>npmlog.x : any -+>npmlog : any ++>npmlog : typeof npmlog +>x : any npmlog.on ->npmlog.on : (s: string) => void ->npmlog : { on(s: string): void; x: number; y: 2; } ->on : (s: string) => void -- --=== npmlog.js === --class EE { -->EE : EE -- -- /** @param {string} s */ -- on(s) { } -->on : (s: string) => void -->s : string --} --var npmlog = module.exports = new EE() ++>npmlog.on : any ++>npmlog : typeof npmlog ++>on : any + + === npmlog.js === + class EE { +@@= skipped -25, +25 lines =@@ + >s : string + } + var npmlog = module.exports = new EE() ->npmlog : { on(s: string): void; x: number; y: 2; } ->module.exports = new EE() : { on(s: string): void; x: number; y: 2; } ->module.exports : { on(s: string): void; x: number; y: 2; } ->module : { exports: { on(s: string): void; x: number; y: 2; }; } ->exports : { on(s: string): void; x: number; y: 2; } -->new EE() : EE -->EE : typeof EE -- --npmlog.on('hi') // both references should see EE.on -->npmlog.on('hi') : void -->npmlog.on : (s: string) => void ++>npmlog : EE ++>module.exports = new EE() : EE ++>module.exports : typeof import("./npmlog") ++>module : { "\"npmlog\"": typeof import("./npmlog"); } ++>exports : typeof import("./npmlog") + >new EE() : EE + >EE : typeof EE + + npmlog.on('hi') // both references should see EE.on + >npmlog.on('hi') : void + >npmlog.on : (s: string) => void ->npmlog : { on(s: string): void; x: number; y: 2; } -->on : (s: string) => void -->'hi' : "hi" -- --module.exports.on('hi') // here too ++>npmlog : EE + >on : (s: string) => void + >'hi' : "hi" + + module.exports.on('hi') // here too ->module.exports.on('hi') : void ->module.exports.on : (s: string) => void ->module.exports : { on(s: string): void; x: number; y: 2; } ->module : { exports: { on(s: string): void; x: number; y: 2; }; } ->exports : { on(s: string): void; x: number; y: 2; } ->on : (s: string) => void -->'hi' : "hi" -- --npmlog.x = 1 -->npmlog.x = 1 : 1 ++>module.exports.on('hi') : any ++>module.exports.on : any ++>module.exports : typeof import("./npmlog") ++>module : { "\"npmlog\"": typeof import("./npmlog"); } ++>exports : typeof import("./npmlog") ++>on : any + >'hi' : "hi" + + npmlog.x = 1 + >npmlog.x = 1 : 1 ->npmlog.x : number ->npmlog : { on(s: string): void; x: number; y: 2; } ->x : number -->1 : 1 -- --module.exports.y = 2 -->module.exports.y = 2 : 2 -->module.exports.y : 2 ++>npmlog.x : any ++>npmlog : EE ++>x : any + >1 : 1 + + module.exports.y = 2 + >module.exports.y = 2 : 2 + >module.exports.y : 2 ->module.exports : { on(s: string): void; x: number; y: 2; } ->module : { exports: { on(s: string): void; x: number; y: 2; }; } ->exports : { on(s: string): void; x: number; y: 2; } -->y : 2 -->2 : 2 -- --npmlog.y ++>module.exports : typeof import("./npmlog") ++>module : { "\"npmlog\"": typeof import("./npmlog"); } ++>exports : typeof import("./npmlog") + >y : 2 + >2 : 2 + + npmlog.y ->npmlog.y : 2 ->npmlog : { on(s: string): void; x: number; y: 2; } ->y : 2 -- --module.exports.x ++>npmlog.y : any ++>npmlog : EE ++>y : any + + module.exports.x ->module.exports.x : number ->module.exports : { on(s: string): void; x: number; y: 2; } ->module : { exports: { on(s: string): void; x: number; y: 2; }; } ->exports : { on(s: string): void; x: number; y: 2; } ->x : number -+>npmlog.on : any -+>npmlog : any -+>on : any ++>module.exports.x : any ++>module.exports : typeof import("./npmlog") ++>module : { "\"npmlog\"": typeof import("./npmlog"); } ++>exports : typeof import("./npmlog") ++>x : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment3.types.diff index cb4bd5968a..e0a756302f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment3.types.diff @@ -1,33 +1,18 @@ --- old.moduleExportAssignment3.types +++ new.moduleExportAssignment3.types -@@= skipped -1, +1 lines =@@ - - === npm.js === - var mod = require('./mod') -->mod : () => void -->require('./mod') : () => void -+>mod : any -+>require('./mod') : any - >require : any - >'./mod' : "./mod" - - mod() // should be callable from here too -->mod() : void -->mod : () => void -- --=== mod.js === --module.exports = function x() { } -->module.exports = function x() { } : () => void -->module.exports : () => void +@@= skipped -14, +14 lines =@@ + module.exports = function x() { } + >module.exports = function x() { } : () => void + >module.exports : () => void ->module : { exports: () => void; } -->exports : () => void -->function x() { } : () => void -->x : () => void -- --module.exports() // should be callable -->module.exports() : void -->module.exports : () => void ++>module : { "export=": () => void; } + >exports : () => void + >function x() { } : () => void + >x : () => void +@@= skipped -8, +8 lines =@@ + module.exports() // should be callable + >module.exports() : void + >module.exports : () => void ->module : { exports: () => void; } -->exports : () => void -+>mod() : any -+>mod : any ++>module : { "export=": () => void; } + >exports : () => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.errors.txt.diff index b450df1f67..ca6d1709ce 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.errors.txt.diff @@ -1,26 +1,38 @@ --- old.moduleExportDuplicateAlias.errors.txt +++ new.moduleExportDuplicateAlias.errors.txt @@= skipped -0, +0 lines =@@ --moduleExportAliasDuplicateAlias.js(3,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. ++moduleExportAliasDuplicateAlias.js(1,1): error TS2323: Cannot redeclare exported variable 'apply'. + moduleExportAliasDuplicateAlias.js(3,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. - - -==== test.js (0 errors) ==== -+test.js(1,27): error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. ++moduleExportAliasDuplicateAlias.js(4,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. ++moduleExportAliasDuplicateAlias.js(4,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(5,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. ++test.js(2,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. + + +==== test.js (1 errors) ==== const { apply } = require('./moduleExportAliasDuplicateAlias') -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. apply() ++ ~~~~~ ++!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. -==== moduleExportAliasDuplicateAlias.js (1 errors) ==== -+==== moduleExportAliasDuplicateAlias.js (0 errors) ==== ++==== moduleExportAliasDuplicateAlias.js (5 errors) ==== exports.apply = undefined; ++ ~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. function a() { } exports.apply() -- ~~~~~~~~~~~~~ --!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. + ~~~~~~~~~~~~~ + !!! error TS2722: Cannot invoke an object which is possibly 'undefined'. exports.apply = a; ++ ~~~~~~~~~~~~~ ++!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. ++ ~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. exports.apply() ++ ~~~~~~~~~~~~~ ++!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.types.diff index 2e28c658f8..f25149178b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.types.diff @@ -6,43 +6,53 @@ const { apply } = require('./moduleExportAliasDuplicateAlias') ->apply : () => void ->require('./moduleExportAliasDuplicateAlias') : typeof import("moduleExportAliasDuplicateAlias") -+>apply : any -+>require('./moduleExportAliasDuplicateAlias') : any ++>apply : undefined ++>require('./moduleExportAliasDuplicateAlias') : typeof import("./moduleExportAliasDuplicateAlias") >require : any >'./moduleExportAliasDuplicateAlias' : "./moduleExportAliasDuplicateAlias" apply() ->apply() : void ->apply : () => void -- --=== moduleExportAliasDuplicateAlias.js === --exports.apply = undefined; -->exports.apply = undefined : undefined ++>apply() : any ++>apply : undefined + + === moduleExportAliasDuplicateAlias.js === + exports.apply = undefined; + >exports.apply = undefined : undefined ->exports.apply : any ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : any -->undefined : undefined -- --function a() { } -->a : () => void -- --exports.apply() -->exports.apply() : any -->exports.apply : undefined ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >undefined : undefined + + function a() { } +@@= skipped -23, +23 lines =@@ + exports.apply() + >exports.apply() : any + >exports.apply : undefined ->exports : typeof import("moduleExportAliasDuplicateAlias") -->apply : undefined -- --exports.apply = a; -->exports.apply = a : () => void ++>exports : typeof import("./moduleExportAliasDuplicateAlias") + >apply : undefined + + exports.apply = a; + >exports.apply = a : () => void ->exports.apply : any ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : any -->a : () => void -- --exports.apply() ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >a : () => void + + exports.apply() ->exports.apply() : void ->exports.apply : () => void ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : () => void -+>apply() : any -+>apply : any ++>exports.apply() : any ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.errors.txt.diff index f201ad418a..fc0269d365 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.errors.txt.diff @@ -2,19 +2,37 @@ +++ new.moduleExportDuplicateAlias2.errors.txt @@= skipped -0, +0 lines =@@ - -+test.js(1,27): error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. ++moduleExportAliasDuplicateAlias.js(1,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(3,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. ++moduleExportAliasDuplicateAlias.js(3,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(4,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. ++moduleExportAliasDuplicateAlias.js(4,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(5,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. ++test.js(2,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. + + +==== test.js (1 errors) ==== + const { apply } = require('./moduleExportAliasDuplicateAlias') -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. + apply() ++ ~~~~~ ++!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. + -+==== moduleExportAliasDuplicateAlias.js (0 errors) ==== ++==== moduleExportAliasDuplicateAlias.js (6 errors) ==== + module.exports.apply = undefined; ++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + function a() { } + module.exports.apply = a; ++ ~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + module.exports.apply = a; ++ ~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + module.exports.apply() ++ ~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.types.diff index 1cac7d593f..537ce0e91b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.types.diff @@ -6,52 +6,73 @@ const { apply } = require('./moduleExportAliasDuplicateAlias') ->apply : () => void ->require('./moduleExportAliasDuplicateAlias') : typeof import("moduleExportAliasDuplicateAlias") -+>apply : any -+>require('./moduleExportAliasDuplicateAlias') : any ++>apply : undefined ++>require('./moduleExportAliasDuplicateAlias') : typeof import("./moduleExportAliasDuplicateAlias") >require : any >'./moduleExportAliasDuplicateAlias' : "./moduleExportAliasDuplicateAlias" apply() ->apply() : void ->apply : () => void -- --=== moduleExportAliasDuplicateAlias.js === --module.exports.apply = undefined; -->module.exports.apply = undefined : undefined ++>apply() : any ++>apply : undefined + + === moduleExportAliasDuplicateAlias.js === + module.exports.apply = undefined; + >module.exports.apply = undefined : undefined ->module.exports.apply : any ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->apply : any -->undefined : undefined -- --function a() { } -->a : () => void -- --module.exports.apply = a; -->module.exports.apply = a : () => void ++>module.exports.apply : undefined ++>module.exports : typeof import("./moduleExportAliasDuplicateAlias") ++>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >undefined : undefined + + function a() { } +@@= skipped -24, +24 lines =@@ + + module.exports.apply = a; + >module.exports.apply = a : () => void ->module.exports.apply : any ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->apply : any -->a : () => void -- --module.exports.apply = a; -->module.exports.apply = a : () => void ++>module.exports.apply : undefined ++>module.exports : typeof import("./moduleExportAliasDuplicateAlias") ++>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >a : () => void + + module.exports.apply = a; + >module.exports.apply = a : () => void ->module.exports.apply : any ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->apply : any -->a : () => void -- --module.exports.apply() ++>module.exports.apply : undefined ++>module.exports : typeof import("./moduleExportAliasDuplicateAlias") ++>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >a : () => void + + module.exports.apply() ->module.exports.apply() : void ->module.exports.apply : () => void ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->apply : () => void -+>apply() : any -+>apply : any ++>module.exports.apply() : any ++>module.exports.apply : undefined ++>module.exports : typeof import("./moduleExportAliasDuplicateAlias") ++>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.errors.txt.diff index 2ef6951e1a..1a3b4d0e59 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.errors.txt.diff @@ -2,22 +2,52 @@ +++ new.moduleExportDuplicateAlias3.errors.txt @@= skipped -0, +0 lines =@@ - -+test.js(1,27): error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. ++moduleExportAliasDuplicateAlias.js(1,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(2,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(4,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. ++moduleExportAliasDuplicateAlias.js(4,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(5,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. ++moduleExportAliasDuplicateAlias.js(6,1): error TS2322: Type '"ok"' is not assignable to type 'undefined'. ++moduleExportAliasDuplicateAlias.js(6,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(7,10): error TS18048: 'exports.apply' is possibly 'undefined'. ++moduleExportAliasDuplicateAlias.js(8,1): error TS2322: Type '1' is not assignable to type 'undefined'. ++moduleExportAliasDuplicateAlias.js(8,1): error TS2323: Cannot redeclare exported variable 'apply'. ++test.js(2,16): error TS18048: 'apply' is possibly 'undefined'. + + +==== test.js (1 errors) ==== + const { apply } = require('./moduleExportAliasDuplicateAlias') -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. + const result = apply.toFixed() ++ ~~~~~ ++!!! error TS18048: 'apply' is possibly 'undefined'. + -+==== moduleExportAliasDuplicateAlias.js (0 errors) ==== ++==== moduleExportAliasDuplicateAlias.js (10 errors) ==== + exports.apply = undefined; ++ ~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + exports.apply = undefined; ++ ~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + function a() { } + exports.apply = a; ++ ~~~~~~~~~~~~~ ++!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. ++ ~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + exports.apply() ++ ~~~~~~~~~~~~~ ++!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. + exports.apply = 'ok' ++ ~~~~~~~~~~~~~ ++!!! error TS2322: Type '"ok"' is not assignable to type 'undefined'. ++ ~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + var OK = exports.apply.toUpperCase() ++ ~~~~~~~~~~~~~ ++!!! error TS18048: 'exports.apply' is possibly 'undefined'. + exports.apply = 1 ++ ~~~~~~~~~~~~~ ++!!! error TS2322: Type '1' is not assignable to type 'undefined'. ++ ~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.types.diff index 5202272a64..eaf355aace 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.types.diff @@ -6,8 +6,8 @@ const { apply } = require('./moduleExportAliasDuplicateAlias') ->apply : number ->require('./moduleExportAliasDuplicateAlias') : typeof import("moduleExportAliasDuplicateAlias") -+>apply : any -+>require('./moduleExportAliasDuplicateAlias') : any ++>apply : undefined ++>require('./moduleExportAliasDuplicateAlias') : typeof import("./moduleExportAliasDuplicateAlias") >require : any >'./moduleExportAliasDuplicateAlias' : "./moduleExportAliasDuplicateAlias" @@ -17,46 +17,67 @@ ->apply.toFixed : (fractionDigits?: number) => string ->apply : number ->toFixed : (fractionDigits?: number) => string -- --=== moduleExportAliasDuplicateAlias.js === --exports.apply = undefined; -->exports.apply = undefined : undefined ++>result : any ++>apply.toFixed() : any ++>apply.toFixed : any ++>apply : undefined ++>toFixed : any + + === moduleExportAliasDuplicateAlias.js === + exports.apply = undefined; + >exports.apply = undefined : undefined ->exports.apply : "ok" | 1 | (() => void) | undefined ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : "ok" | 1 | (() => void) | undefined -->undefined : undefined -- --exports.apply = undefined; -->exports.apply = undefined : undefined ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >undefined : undefined + + exports.apply = undefined; + >exports.apply = undefined : undefined ->exports.apply : "ok" | 1 | (() => void) | undefined ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : "ok" | 1 | (() => void) | undefined -->undefined : undefined -- --function a() { } -->a : () => void -- --exports.apply = a; -->exports.apply = a : () => void ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >undefined : undefined + + function a() { } +@@= skipped -32, +32 lines =@@ + + exports.apply = a; + >exports.apply = a : () => void ->exports.apply : "ok" | 1 | (() => void) | undefined ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : "ok" | 1 | (() => void) | undefined -->a : () => void -- --exports.apply() ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >a : () => void + + exports.apply() ->exports.apply() : void ->exports.apply : () => void ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : () => void -- --exports.apply = 'ok' -->exports.apply = 'ok' : "ok" ++>exports.apply() : any ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + + exports.apply = 'ok' + >exports.apply = 'ok' : "ok" ->exports.apply : "ok" | 1 | (() => void) | undefined ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : "ok" | 1 | (() => void) | undefined -->'ok' : "ok" -- --var OK = exports.apply.toUpperCase() ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >'ok' : "ok" + + var OK = exports.apply.toUpperCase() ->OK : string ->exports.apply.toUpperCase() : string ->exports.apply.toUpperCase : () => string @@ -64,15 +85,20 @@ ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : "ok" ->toUpperCase : () => string -- --exports.apply = 1 -->exports.apply = 1 : 1 ++>OK : any ++>exports.apply.toUpperCase() : any ++>exports.apply.toUpperCase : any ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined ++>toUpperCase : any + + exports.apply = 1 + >exports.apply = 1 : 1 ->exports.apply : "ok" | 1 | (() => void) | undefined ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : "ok" | 1 | (() => void) | undefined -->1 : 1 -+>result : any -+>apply.toFixed() : any -+>apply.toFixed : any -+>apply : any -+>toFixed : any ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >1 : 1 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.errors.txt.diff index 6759eb7325..78ce2117dc 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.errors.txt.diff @@ -2,24 +2,31 @@ +++ new.moduleExportWithExportPropertyAssignment.errors.txt @@= skipped -0, +0 lines =@@ -a.js(4,6): error TS2554: Expected 1 arguments, but got 0. -- -- --==== a.js (1 errors) ==== -- /// -- var mod1 = require('./mod1') -- mod1() -- mod1.f() // error, not enough arguments -- ~ ++a.js(4,6): error TS2339: Property 'f' does not exist on type '() => void'. ++mod1.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++mod1.js(4,16): error TS2339: Property 'f' does not exist on type '() => void'. + + + ==== a.js (1 errors) ==== +@@= skipped -6, +8 lines =@@ + mod1() + mod1.f() // error, not enough arguments + ~ -!!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 mod1.js:4:30: An argument for 'a' was not provided. -- --==== requires.d.ts (0 errors) ==== -- declare var module: { exports: any }; -- declare function require(name: string): any; ++!!! error TS2339: Property 'f' does not exist on type '() => void'. + + ==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; + declare function require(name: string): any; -==== mod1.js (0 errors) ==== -- /// -- module.exports = function () { } -- /** @param {number} a */ -- module.exports.f = function (a) { } -- -+ \ No newline at end of file ++==== mod1.js (2 errors) ==== + /// + module.exports = function () { } ++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + /** @param {number} a */ + module.exports.f = function (a) { } ++ ~ ++!!! error TS2339: Property 'f' does not exist on type '() => void'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff index 663416a6e5..7179afaef8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff @@ -6,16 +6,15 @@ var mod1 = require('./mod1') ->mod1 : { (): void; f: (a: number) => void; } ->require('./mod1') : { (): void; f: (a: number) => void; } -+>mod1 : any -+>require('./mod1') : any ++>mod1 : () => void ++>require('./mod1') : () => void >require : (name: string) => any >'./mod1' : "./mod1" mod1() -->mod1() : void + >mod1() : void ->mod1 : { (): void; f: (a: number) => void; } -+>mod1() : any -+>mod1 : any ++>mod1 : () => void mod1.f() // error, not enough arguments ->mod1.f() : void @@ -24,27 +23,27 @@ ->f : (a: number) => void +>mod1.f() : any +>mod1.f : any -+>mod1 : any ++>mod1 : () => void +>f : any === requires.d.ts === declare var module: { exports: any }; -@@= skipped -23, +23 lines =@@ - declare function require(name: string): any; - >require : (name: string) => any - >name : string -- --=== mod1.js === --/// --module.exports = function () { } +@@= skipped -27, +27 lines =@@ + === mod1.js === + /// + module.exports = function () { } ->module.exports = function () { } : { (): void; f: (a: number) => void; } ->module.exports : { (): void; f: (a: number) => void; } ->module : { exports: { (): void; f: (a: number) => void; }; } ->exports : { (): void; f: (a: number) => void; } -->function () { } : () => void -- --/** @param {number} a */ --module.exports.f = function (a) { } ++>module.exports = function () { } : () => void ++>module.exports : () => void ++>module : { "export=": () => void; } ++>exports : () => void + >function () { } : () => void + + /** @param {number} a */ + module.exports.f = function (a) { } ->module.exports.f = function (a) { } : (a: number) => void ->module.exports.f : (a: number) => void ->module.exports : { (): void; f: (a: number) => void; } @@ -53,3 +52,11 @@ ->f : (a: number) => void ->function (a) { } : (a: number) => void ->a : number ++>module.exports.f = function (a) { } : (a: any) => void ++>module.exports.f : any ++>module.exports : () => void ++>module : { "export=": () => void; } ++>exports : () => void ++>f : any ++>function (a) { } : (a: any) => void ++>a : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.errors.txt.diff index d0388eecad..fe3efec848 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.errors.txt.diff @@ -3,24 +3,30 @@ @@= skipped -0, +0 lines =@@ -a.js(4,6): error TS2339: Property 'f' does not exist on type 'number'. -mod1.js(3,16): error TS2339: Property 'f' does not exist on type 'number'. -- -- --==== a.js (1 errors) ==== -- /// -- var mod1 = require('./mod1') -- mod1.toFixed(12) -- mod1.f() // error, 'f' is not a property on 'number' -- ~ ++a.js(4,6): error TS2339: Property 'f' does not exist on type '1'. ++mod1.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++mod1.js(3,16): error TS2339: Property 'f' does not exist on type '1'. + + + ==== a.js (1 errors) ==== +@@= skipped -7, +8 lines =@@ + mod1.toFixed(12) + mod1.f() // error, 'f' is not a property on 'number' + ~ -!!! error TS2339: Property 'f' does not exist on type 'number'. -- --==== requires.d.ts (0 errors) ==== -- declare var module: { exports: any }; -- declare function require(name: string): any; ++!!! error TS2339: Property 'f' does not exist on type '1'. + + ==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; + declare function require(name: string): any; -==== mod1.js (1 errors) ==== -- /// -- module.exports = 1 -- module.exports.f = function () { } -- ~ ++==== mod1.js (2 errors) ==== + /// + module.exports = 1 ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.f = function () { } + ~ -!!! error TS2339: Property 'f' does not exist on type 'number'. -- -+ \ No newline at end of file ++!!! error TS2339: Property 'f' does not exist on type '1'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff index e2f347adbe..9bbc38b930 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff @@ -6,49 +6,49 @@ var mod1 = require('./mod1') ->mod1 : number ->require('./mod1') : number -+>mod1 : any -+>require('./mod1') : any ++>mod1 : 1 ++>require('./mod1') : 1 >require : (name: string) => any >'./mod1' : "./mod1" mod1.toFixed(12) -->mod1.toFixed(12) : string -->mod1.toFixed : (fractionDigits?: number) => string + >mod1.toFixed(12) : string + >mod1.toFixed : (fractionDigits?: number) => string ->mod1 : number -->toFixed : (fractionDigits?: number) => string -+>mod1.toFixed(12) : any -+>mod1.toFixed : any -+>mod1 : any -+>toFixed : any ++>mod1 : 1 + >toFixed : (fractionDigits?: number) => string >12 : 12 mod1.f() // error, 'f' is not a property on 'number' >mod1.f() : any >mod1.f : any ->mod1 : number -+>mod1 : any ++>mod1 : 1 >f : any === requires.d.ts === -@@= skipped -26, +26 lines =@@ - declare function require(name: string): any; - >require : (name: string) => any - >name : string -- --=== mod1.js === --/// --module.exports = 1 +@@= skipped -30, +30 lines =@@ + === mod1.js === + /// + module.exports = 1 ->module.exports = 1 : number ->module.exports : number ->module : { exports: number; } ->exports : number -->1 : 1 -- --module.exports.f = function () { } -->module.exports.f = function () { } : () => void -->module.exports.f : any ++>module.exports = 1 : 1 ++>module.exports : 1 ++>module : { "export=": 1; } ++>exports : 1 + >1 : 1 + + module.exports.f = function () { } + >module.exports.f = function () { } : () => void + >module.exports.f : any ->module.exports : number ->module : { exports: number; } ->exports : number -->f : any -->function () { } : () => void ++>module.exports : 1 ++>module : { "export=": 1; } ++>exports : 1 + >f : any + >function () { } : () => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.errors.txt.diff index 3a74bd677f..6982a01c04 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.errors.txt.diff @@ -8,31 +8,53 @@ - - -==== a.js (2 errors) ==== -- /// -- var mod1 = require('./mod1') -- mod1.justExport.toFixed() -- mod1.bothBefore.toFixed() // error, 'toFixed' not on 'string | number' ++a.js(6,6): error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. ++mod1.js(2,1): error TS2322: Type 'string' is not assignable to type 'number'. ++mod1.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++mod1.js(8,1): error TS2322: Type 'string' is not assignable to type 'number'. ++mod1.js(9,16): error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. ++ ++ ++==== a.js (1 errors) ==== + /// + var mod1 = require('./mod1') + mod1.justExport.toFixed() + mod1.bothBefore.toFixed() // error, 'toFixed' not on 'string | number' - ~~~~~~~ -!!! error TS2339: Property 'toFixed' does not exist on type 'number | "string"'. -!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. -- mod1.bothAfter.toFixed() // error, 'toFixed' not on 'string | number' + mod1.bothAfter.toFixed() // error, 'toFixed' not on 'string | number' - ~~~~~~~ -!!! error TS2339: Property 'toFixed' does not exist on type 'number | "string"'. -!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. -- mod1.justProperty.length -- --==== requires.d.ts (0 errors) ==== -- declare var module: { exports: any }; -- declare function require(name: string): any; + mod1.justProperty.length ++ ~~~~~~~~~~~~ ++!!! error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. + + ==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; + declare function require(name: string): any; -==== mod1.js (0 errors) ==== -- /// -- module.exports.bothBefore = 'string' -- module.exports = { -- justExport: 1, -- bothBefore: 2, -- bothAfter: 3, -- } -- module.exports.bothAfter = 'string' -- module.exports.justProperty = 'string' -- -+ \ No newline at end of file ++==== mod1.js (4 errors) ==== + /// + module.exports.bothBefore = 'string' ++ ~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2322: Type 'string' is not assignable to type 'number'. + module.exports = { ++ ~~~~~~~~~~~~~~~~~~ + justExport: 1, ++ ~~~~~~~~~~~~~~~~~~ + bothBefore: 2, ++ ~~~~~~~~~~~~~~~~~~ + bothAfter: 3, ++ ~~~~~~~~~~~~~~~~~ + } ++ ~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.bothAfter = 'string' ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2322: Type 'string' is not assignable to type 'number'. + module.exports.justProperty = 'string' ++ ~~~~~~~~~~~~ ++!!! error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff index 947afb30b8..2db4d6cc09 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff @@ -6,46 +6,47 @@ var mod1 = require('./mod1') ->mod1 : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->require('./mod1') : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } -+>mod1 : any -+>require('./mod1') : any ++>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } ++>require('./mod1') : { justExport: number; bothBefore: number; bothAfter: number; } >require : (name: string) => any >'./mod1' : "./mod1" - mod1.justExport.toFixed() -->mod1.justExport.toFixed() : string -->mod1.justExport.toFixed : (fractionDigits?: number) => string -->mod1.justExport : number +@@= skipped -9, +9 lines =@@ + >mod1.justExport.toFixed() : string + >mod1.justExport.toFixed : (fractionDigits?: number) => string + >mod1.justExport : number ->mod1 : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } -->justExport : number -->toFixed : (fractionDigits?: number) => string -+>mod1.justExport.toFixed() : any -+>mod1.justExport.toFixed : any -+>mod1.justExport : any -+>mod1 : any -+>justExport : any -+>toFixed : any ++>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } + >justExport : number + >toFixed : (fractionDigits?: number) => string mod1.bothBefore.toFixed() // error, 'toFixed' not on 'string | number' - >mod1.bothBefore.toFixed() : any - >mod1.bothBefore.toFixed : any +->mod1.bothBefore.toFixed() : any +->mod1.bothBefore.toFixed : any ->mod1.bothBefore : number | "string" ->mod1 : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->bothBefore : number | "string" -+>mod1.bothBefore : any -+>mod1 : any -+>bothBefore : any - >toFixed : any +->toFixed : any ++>mod1.bothBefore.toFixed() : string ++>mod1.bothBefore.toFixed : (fractionDigits?: number) => string ++>mod1.bothBefore : number ++>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } ++>bothBefore : number ++>toFixed : (fractionDigits?: number) => string mod1.bothAfter.toFixed() // error, 'toFixed' not on 'string | number' - >mod1.bothAfter.toFixed() : any - >mod1.bothAfter.toFixed : any +->mod1.bothAfter.toFixed() : any +->mod1.bothAfter.toFixed : any ->mod1.bothAfter : number | "string" ->mod1 : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->bothAfter : number | "string" -+>mod1.bothAfter : any -+>mod1 : any -+>bothAfter : any - >toFixed : any +->toFixed : any ++>mod1.bothAfter.toFixed() : string ++>mod1.bothAfter.toFixed : (fractionDigits?: number) => string ++>mod1.bothAfter : number ++>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } ++>bothAfter : number ++>toFixed : (fractionDigits?: number) => string mod1.justProperty.length ->mod1.justProperty.length : number @@ -55,61 +56,66 @@ ->length : number +>mod1.justProperty.length : any +>mod1.justProperty : any -+>mod1 : any ++>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } +>justProperty : any +>length : any === requires.d.ts === declare var module: { exports: any }; -@@= skipped -44, +44 lines =@@ - declare function require(name: string): any; - >require : (name: string) => any - >name : string -- --=== mod1.js === --/// --module.exports.bothBefore = 'string' -->module.exports.bothBefore = 'string' : "string" +@@= skipped -40, +40 lines =@@ + /// + module.exports.bothBefore = 'string' + >module.exports.bothBefore = 'string' : "string" ->module.exports.bothBefore : number | "string" ->module.exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->module : { exports: { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; }; } ->exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->bothBefore : number | "string" -->'string' : "string" -- --module.exports = { ++>module.exports.bothBefore : number ++>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } ++>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { justExport: number; bothBefore: number; bothAfter: number; } ++>bothBefore : number + >'string' : "string" + + module.exports = { ->module.exports = { justExport: 1, bothBefore: 2, bothAfter: 3,} : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->module.exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->module : { exports: { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; }; } ->exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } -->{ justExport: 1, bothBefore: 2, bothAfter: 3,} : { justExport: number; bothBefore: number; bothAfter: number; } -- -- justExport: 1, -->justExport : number -->1 : 1 -- -- bothBefore: 2, -->bothBefore : number -->2 : 2 -- -- bothAfter: 3, -->bothAfter : number -->3 : 3 --} --module.exports.bothAfter = 'string' -->module.exports.bothAfter = 'string' : "string" ++>module.exports = { justExport: 1, bothBefore: 2, bothAfter: 3,} : { justExport: number; bothBefore: number; bothAfter: number; } ++>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } ++>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { justExport: number; bothBefore: number; bothAfter: number; } + >{ justExport: 1, bothBefore: 2, bothAfter: 3,} : { justExport: number; bothBefore: number; bothAfter: number; } + + justExport: 1, +@@= skipped -28, +28 lines =@@ + } + module.exports.bothAfter = 'string' + >module.exports.bothAfter = 'string' : "string" ->module.exports.bothAfter : number | "string" ->module.exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->module : { exports: { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; }; } ->exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->bothAfter : number | "string" -->'string' : "string" -- --module.exports.justProperty = 'string' -->module.exports.justProperty = 'string' : "string" ++>module.exports.bothAfter : number ++>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } ++>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { justExport: number; bothBefore: number; bothAfter: number; } ++>bothAfter : number + >'string' : "string" + + module.exports.justProperty = 'string' + >module.exports.justProperty = 'string' : "string" ->module.exports.justProperty : "string" ->module.exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->module : { exports: { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; }; } ->exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->justProperty : "string" -->'string' : "string" ++>module.exports.justProperty : any ++>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } ++>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { justExport: number; bothBefore: number; bothAfter: number; } ++>justProperty : any + >'string' : "string" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff index 361827ad25..57078c0343 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff @@ -12,41 +12,55 @@ - - -==== a.js (2 errors) ==== -- /// -- var mod1 = require('./mod1') -- mod1.justExport.toFixed() -- mod1.bothBefore.toFixed() // error ++a.js(6,6): error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. ++mod1.js(2,1): error TS2322: Type 'string' is not assignable to type 'number'. ++mod1.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++mod1.js(10,1): error TS2322: Type 'string' is not assignable to type 'number'. ++mod1.js(11,16): error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. ++ ++ ++==== a.js (1 errors) ==== + /// + var mod1 = require('./mod1') + mod1.justExport.toFixed() + mod1.bothBefore.toFixed() // error - ~~~~~~~ -!!! error TS2339: Property 'toFixed' does not exist on type 'number | "string"'. -!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. -- mod1.bothAfter.toFixed() + mod1.bothAfter.toFixed() - ~~~~~~~ -!!! error TS2339: Property 'toFixed' does not exist on type 'number | "string"'. -!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. -- mod1.justProperty.length -- --==== requires.d.ts (0 errors) ==== -- declare var module: { exports: any }; -- declare function require(name: string): any; --==== mod1.js (4 errors) ==== -- /// -- module.exports.bothBefore = 'string' -- ~~~~~~~~~~~~~~~~~~~~~~~~~ + mod1.justProperty.length ++ ~~~~~~~~~~~~ ++!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. + + ==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; +@@= skipped -28, +21 lines =@@ + /// + module.exports.bothBefore = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'bothBefore'. -- A.justExport = 4 -- A.bothBefore = 2 ++!!! error TS2322: Type 'string' is not assignable to type 'number'. + A.justExport = 4 + A.bothBefore = 2 - ~~~~~~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'bothBefore'. -- A.bothAfter = 3 + A.bothAfter = 3 - ~~~~~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'bothAfter'. -- module.exports = A -- function A() { -- this.p = 1 -- } -- module.exports.bothAfter = 'string' -- ~~~~~~~~~~~~~~~~~~~~~~~~ + module.exports = A ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + function A() { + this.p = 1 + } + module.exports.bothAfter = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'bothAfter'. -- module.exports.justProperty = 'string' -- -+ \ No newline at end of file ++!!! error TS2322: Type 'string' is not assignable to type 'number'. + module.exports.justProperty = 'string' ++ ~~~~~~~~~~~~ ++!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff index 2b31285acb..ad7a4d3685 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff @@ -6,46 +6,47 @@ var mod1 = require('./mod1') ->mod1 : typeof mod1 ->require('./mod1') : typeof mod1 -+>mod1 : any -+>require('./mod1') : any ++>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>require('./mod1') : { (): void; justExport: number; bothBefore: number; bothAfter: number; } >require : (name: string) => any >'./mod1' : "./mod1" - mod1.justExport.toFixed() -->mod1.justExport.toFixed() : string -->mod1.justExport.toFixed : (fractionDigits?: number) => string -->mod1.justExport : number +@@= skipped -9, +9 lines =@@ + >mod1.justExport.toFixed() : string + >mod1.justExport.toFixed : (fractionDigits?: number) => string + >mod1.justExport : number ->mod1 : typeof mod1 -->justExport : number -->toFixed : (fractionDigits?: number) => string -+>mod1.justExport.toFixed() : any -+>mod1.justExport.toFixed : any -+>mod1.justExport : any -+>mod1 : any -+>justExport : any -+>toFixed : any ++>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } + >justExport : number + >toFixed : (fractionDigits?: number) => string mod1.bothBefore.toFixed() // error - >mod1.bothBefore.toFixed() : any - >mod1.bothBefore.toFixed : any +->mod1.bothBefore.toFixed() : any +->mod1.bothBefore.toFixed : any ->mod1.bothBefore : number | "string" ->mod1 : typeof mod1 ->bothBefore : number | "string" -+>mod1.bothBefore : any -+>mod1 : any -+>bothBefore : any - >toFixed : any +->toFixed : any ++>mod1.bothBefore.toFixed() : string ++>mod1.bothBefore.toFixed : (fractionDigits?: number) => string ++>mod1.bothBefore : number ++>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothBefore : number ++>toFixed : (fractionDigits?: number) => string mod1.bothAfter.toFixed() - >mod1.bothAfter.toFixed() : any - >mod1.bothAfter.toFixed : any +->mod1.bothAfter.toFixed() : any +->mod1.bothAfter.toFixed : any ->mod1.bothAfter : number | "string" ->mod1 : typeof mod1 ->bothAfter : number | "string" -+>mod1.bothAfter : any -+>mod1 : any -+>bothAfter : any - >toFixed : any +->toFixed : any ++>mod1.bothAfter.toFixed() : string ++>mod1.bothAfter.toFixed : (fractionDigits?: number) => string ++>mod1.bothAfter : number ++>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothAfter : number ++>toFixed : (fractionDigits?: number) => string mod1.justProperty.length ->mod1.justProperty.length : number @@ -55,80 +56,104 @@ ->length : number +>mod1.justProperty.length : any +>mod1.justProperty : any -+>mod1 : any ++>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>justProperty : any +>length : any === requires.d.ts === declare var module: { exports: any }; -@@= skipped -44, +44 lines =@@ - declare function require(name: string): any; - >require : (name: string) => any - >name : string -- --=== mod1.js === --/// --module.exports.bothBefore = 'string' -->module.exports.bothBefore = 'string' : "string" +@@= skipped -40, +40 lines =@@ + /// + module.exports.bothBefore = 'string' + >module.exports.bothBefore = 'string' : "string" ->module.exports.bothBefore : number | "string" ->module.exports : typeof A ->module : { exports: typeof A; } ->exports : typeof A ->bothBefore : number | "string" -->'string' : "string" -- --A.justExport = 4 -->A.justExport = 4 : 4 -->A.justExport : number ++>module.exports.bothBefore : number ++>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothBefore : number + >'string' : "string" + + A.justExport = 4 + >A.justExport = 4 : 4 + >A.justExport : number ->A : typeof A -->justExport : number -->4 : 4 -- --A.bothBefore = 2 -->A.bothBefore = 2 : 2 ++>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } + >justExport : number + >4 : 4 + + A.bothBefore = 2 + >A.bothBefore = 2 : 2 ->A.bothBefore : number | "string" ->A : typeof A ->bothBefore : number | "string" -->2 : 2 -- --A.bothAfter = 3 -->A.bothAfter = 3 : 3 ++>A.bothBefore : number ++>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothBefore : number + >2 : 2 + + A.bothAfter = 3 + >A.bothAfter = 3 : 3 ->A.bothAfter : number | "string" ->A : typeof A ->bothAfter : number | "string" -->3 : 3 -- --module.exports = A ++>A.bothAfter : number ++>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothAfter : number + >3 : 3 + + module.exports = A ->module.exports = A : typeof A ->module.exports : typeof A ->module : { exports: typeof A; } ->exports : typeof A ->A : typeof A -- --function A() { ++>module.exports = A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } + + function A() { ->A : typeof A -- -- this.p = 1 -->this.p = 1 : 1 -->this.p : any ++>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } + + this.p = 1 + >this.p = 1 : 1 + >this.p : any ->this : this -->p : any -->1 : 1 --} --module.exports.bothAfter = 'string' -->module.exports.bothAfter = 'string' : "string" ++>this : any + >p : any + >1 : 1 + } + module.exports.bothAfter = 'string' + >module.exports.bothAfter = 'string' : "string" ->module.exports.bothAfter : number | "string" ->module.exports : typeof A ->module : { exports: typeof A; } ->exports : typeof A ->bothAfter : number | "string" -->'string' : "string" -- --module.exports.justProperty = 'string' -->module.exports.justProperty = 'string' : "string" ++>module.exports.bothAfter : number ++>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothAfter : number + >'string' : "string" + + module.exports.justProperty = 'string' + >module.exports.justProperty = 'string' : "string" ->module.exports.justProperty : "string" ->module.exports : typeof A ->module : { exports: typeof A; } ->exports : typeof A ->justProperty : "string" -->'string' : "string" ++>module.exports.justProperty : any ++>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>justProperty : any + >'string' : "string" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.errors.txt.diff index 58e9a4a9cf..42b332e921 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.errors.txt.diff @@ -2,24 +2,27 @@ +++ new.moduleExportsElementAccessAssignment.errors.txt @@= skipped -0, +0 lines =@@ - -+mod2.js(1,22): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. ++mod1.js(6,24): error TS2339: Property 'e' does not exist on type '{}'. ++mod2.js(6,8): error TS2339: Property 'e' does not exist on type '{}'. + + +==== mod2.js (1 errors) ==== + const mod1 = require("./mod1"); -+ ~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. + mod1.a; + mod1.b; + mod1.c; + mod1.d; + mod1.d.e; ++ ~ ++!!! error TS2339: Property 'e' does not exist on type '{}'. + mod1.default; -+==== mod1.js (0 errors) ==== ++==== mod1.js (1 errors) ==== + exports.a = { x: "x" }; + exports["b"] = { x: "x" }; + exports["default"] = { x: "x" }; + module.exports["c"] = { x: "x" }; + module["exports"]["d"] = {}; + module["exports"]["d"].e = 0; ++ ~ ++!!! error TS2339: Property 'e' does not exist on type '{}'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff index 1621e3b757..af3ced87ac 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff @@ -1,123 +1,95 @@ --- old.moduleExportsElementAccessAssignment.types +++ new.moduleExportsElementAccessAssignment.types -@@= skipped -1, +1 lines =@@ - - === mod2.js === - const mod1 = require("./mod1"); -->mod1 : typeof mod1 -->require("./mod1") : typeof mod1 -+>mod1 : any -+>require("./mod1") : any - >require : any - >"./mod1" : "./mod1" - - mod1.a; -->mod1.a : { x: string; } -->mod1 : typeof mod1 -->a : { x: string; } -+>mod1.a : any -+>mod1 : any -+>a : any - - mod1.b; -->mod1.b : { x: string; } -->mod1 : typeof mod1 -->b : { x: string; } -+>mod1.b : any -+>mod1 : any -+>b : any - - mod1.c; -->mod1.c : { x: string; } -->mod1 : typeof mod1 -->c : { x: string; } -+>mod1.c : any -+>mod1 : any -+>c : any +@@= skipped -22, +22 lines =@@ + >c : { x: string; } mod1.d; ->mod1.d : typeof mod1."d" -->mod1 : typeof mod1 ++>mod1.d : {} + >mod1 : typeof mod1 ->d : typeof mod1."d" -+>mod1.d : any -+>mod1 : any -+>d : any ++>d : {} mod1.d.e; ->mod1.d.e : number ->mod1.d : typeof mod1."d" -->mod1 : typeof mod1 ++>mod1.d.e : any ++>mod1.d : {} + >mod1 : typeof mod1 ->d : typeof mod1."d" ->e : number -+>mod1.d.e : any -+>mod1.d : any -+>mod1 : any -+>d : any ++>d : {} +>e : any mod1.default; -->mod1.default : { x: string; } -->mod1 : typeof mod1 -->default : { x: string; } -- --=== mod1.js === --exports.a = { x: "x" }; -->exports.a = { x: "x" } : { x: string; } -->exports.a : { x: string; } + >mod1.default : { x: string; } +@@= skipped -20, +20 lines =@@ + exports.a = { x: "x" }; + >exports.a = { x: "x" } : { x: string; } + >exports.a : { x: string; } ->exports : typeof import("mod1") -->a : { x: string; } -->{ x: "x" } : { x: string; } -->x : string -->"x" : "x" -- --exports["b"] = { x: "x" }; -->exports["b"] = { x: "x" } : { x: string; } -->exports["b"] : { x: string; } ++>exports : typeof import("./mod1") + >a : { x: string; } + >{ x: "x" } : { x: string; } + >x : string +@@= skipped -9, +9 lines =@@ + exports["b"] = { x: "x" }; + >exports["b"] = { x: "x" } : { x: string; } + >exports["b"] : { x: string; } ->exports : typeof import("mod1") -->"b" : "b" -->{ x: "x" } : { x: string; } -->x : string -->"x" : "x" -- --exports["default"] = { x: "x" }; -->exports["default"] = { x: "x" } : { x: string; } -->exports["default"] : { x: string; } ++>exports : typeof import("./mod1") + >"b" : "b" + >{ x: "x" } : { x: string; } + >x : string +@@= skipped -9, +9 lines =@@ + exports["default"] = { x: "x" }; + >exports["default"] = { x: "x" } : { x: string; } + >exports["default"] : { x: string; } ->exports : typeof import("mod1") -->"default" : "default" -->{ x: "x" } : { x: string; } -->x : string -->"x" : "x" -- --module.exports["c"] = { x: "x" }; -->module.exports["c"] = { x: "x" } : { x: string; } -->module.exports["c"] : { x: string; } ++>exports : typeof import("./mod1") + >"default" : "default" + >{ x: "x" } : { x: string; } + >x : string +@@= skipped -9, +9 lines =@@ + module.exports["c"] = { x: "x" }; + >module.exports["c"] = { x: "x" } : { x: string; } + >module.exports["c"] : { x: string; } ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->"c" : "c" -->{ x: "x" } : { x: string; } -->x : string -->"x" : "x" -- --module["exports"]["d"] = {}; ++>module.exports : typeof import("./mod1") ++>module : { "\"mod1\"": typeof import("./mod1"); } ++>exports : typeof import("./mod1") + >"c" : "c" + >{ x: "x" } : { x: string; } + >x : string + >"x" : "x" + + module["exports"]["d"] = {}; ->module["exports"]["d"] = {} : typeof "d" ->module["exports"]["d"] : typeof "d" ->module["exports"] : typeof module.exports ->module : { exports: typeof module.exports; } -->"exports" : "exports" -->"d" : "d" -->{} : {} -- --module["exports"]["d"].e = 0; -->module["exports"]["d"].e = 0 : 0 ++>module["exports"]["d"] = {} : {} ++>module["exports"]["d"] : {} ++>module["exports"] : typeof import("./mod1") ++>module : { "\"mod1\"": typeof import("./mod1"); } + >"exports" : "exports" + >"d" : "d" + >{} : {} + + module["exports"]["d"].e = 0; + >module["exports"]["d"].e = 0 : 0 ->module["exports"]["d"].e : number ->module["exports"]["d"] : typeof "d" ->module["exports"] : typeof module.exports ->module : { exports: typeof module.exports; } -->"exports" : "exports" -->"d" : "d" ++>module["exports"]["d"].e : any ++>module["exports"]["d"] : {} ++>module["exports"] : typeof import("./mod1") ++>module : { "\"mod1\"": typeof import("./mod1"); } + >"exports" : "exports" + >"d" : "d" ->e : number -->0 : 0 -+>mod1.default : any -+>mod1 : any -+>default : any ++>e : any + >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nestedDestructuringOfRequire.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nestedDestructuringOfRequire.types.diff index 99932aefa6..7ba795acec 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nestedDestructuringOfRequire.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nestedDestructuringOfRequire.types.diff @@ -1,40 +1,23 @@ --- old.nestedDestructuringOfRequire.types +++ new.nestedDestructuringOfRequire.types -@@= skipped -3, +3 lines =@@ - const { - chalk: { grey } - >chalk : any -->grey : {} -+>grey : any +@@= skipped -6, +6 lines =@@ + >grey : {} } = require('./mod1'); ->require('./mod1') : typeof import("mod1") -+>require('./mod1') : any ++>require('./mod1') : typeof import("./mod1") >require : any >'./mod1' : "./mod1" - grey -->grey : {} -+>grey : any - - chalk - >chalk : any -- --=== mod1.js === --const chalk = { -->chalk : { grey: {}; } -->{ grey: {}} : { grey: {}; } -- -- grey: {} -->grey : {} -->{} : {} -- --}; --module.exports.chalk = chalk -->module.exports.chalk = chalk : { grey: {}; } -->module.exports.chalk : { grey: {}; } +@@= skipped -23, +23 lines =@@ + module.exports.chalk = chalk + >module.exports.chalk = chalk : { grey: {}; } + >module.exports.chalk : { grey: {}; } ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->chalk : { grey: {}; } -->chalk : { grey: {}; } ++>module.exports : typeof import("./mod1") ++>module : { "\"mod1\"": typeof import("./mod1"); } ++>exports : typeof import("./mod1") + >chalk : { grey: {}; } + >chalk : { grey: {}; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution.types.diff index 6cba4a81fe..6e059f16d1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution.types.diff @@ -6,8 +6,8 @@ var f = require('./first'); ->f : (x: T, k: (t: T) => void) => void ->require('./first') : (x: T, k: (t: T) => void) => void -+>f : any -+>require('./first') : any ++>f : (x: any, k: any) => any ++>require('./first') : (x: any, k: any) => any >require : any >'./first' : "./first" @@ -15,17 +15,19 @@ ->f(1, n => { }) : void ->f : (x: T, k: (t: T) => void) => void +>f(1, n => { }) : any -+>f : any ++>f : (x: any, k: any) => any >1 : 1 ->n => { } : (n: number) => void ->n : number -- --=== first.js === --/** @template T -- * @param {T} x -- * @param {(t: T) => void} k -- */ --module.exports = function (x, k) { return k(x) } ++>n => { } : (n: any) => void ++>n : any + + === first.js === + /** @template T +@@= skipped -18, +18 lines =@@ + * @param {(t: T) => void} k + */ + module.exports = function (x, k) { return k(x) } ->module.exports = function (x, k) { return k(x) } : (x: T, k: (t: T) => void) => void ->module.exports : (x: T, k: (t: T) => void) => void ->module : { exports: (x: T, k: (t: T) => void) => void; } @@ -36,5 +38,13 @@ ->k(x) : void ->k : (t: T) => void ->x : T -+>n => { } : (n: any) => void -+>n : any ++>module.exports = function (x, k) { return k(x) } : (x: any, k: any) => any ++>module.exports : (x: any, k: any) => any ++>module : { "export=": (x: any, k: any) => any; } ++>exports : (x: any, k: any) => any ++>function (x, k) { return k(x) } : (x: any, k: any) => any ++>x : any ++>k : any ++>k(x) : any ++>k : any ++>x : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/requireTwoPropertyAccesses.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/requireTwoPropertyAccesses.types.diff index ca727e72a7..c4569297be 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/requireTwoPropertyAccesses.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/requireTwoPropertyAccesses.types.diff @@ -5,43 +5,22 @@ === requireTwoPropertyAccesses.js === const value = require("./mod").x.y ->value : error -->require("./mod").x.y : string -->require("./mod").x : { y: string; } -->require("./mod") : { x: { y: string; }; } -+>value : any -+>require("./mod").x.y : any -+>require("./mod").x : any -+>require("./mod") : any - >require : any - >"./mod" : "./mod" -->x : { y: string; } -->y : string -+>x : any -+>y : any - - console.log(value) - >console.log(value) : void ++>value : string + >require("./mod").x.y : string + >require("./mod").x : { y: string; } + >require("./mod") : { x: { y: string; }; } +@@= skipped -14, +14 lines =@@ >console.log : (...data: any[]) => void >console : Console >log : (...data: any[]) => void ->value : error -- --=== mod.js === --module.exports = { -->module.exports = { x: { y: "value" }} : { x: { y: string; }; } -->module.exports : { x: { y: string; }; } ++>value : string + + === mod.js === + module.exports = { + >module.exports = { x: { y: "value" }} : { x: { y: string; }; } + >module.exports : { x: { y: string; }; } ->module : { exports: { x: { y: string; }; }; } -->exports : { x: { y: string; }; } -->{ x: { y: "value" }} : { x: { y: string; }; } -- -- x: { -->x : { y: string; } -->{ y: "value" } : { y: string; } -- -- y: "value" -->y : string -->"value" : "value" -- } --} -+>value : any -+ \ No newline at end of file ++>module : { "export=": { x: { y: string; }; }; } + >exports : { x: { y: string; }; } + >{ x: { y: "value" }} : { x: { y: string; }; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.errors.txt.diff new file mode 100644 index 0000000000..5f966384cc --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.errors.txt.diff @@ -0,0 +1,39 @@ +--- old.typeFromPropertyAssignment17.errors.txt ++++ new.typeFromPropertyAssignment17.errors.txt +@@= skipped -0, +0 lines =@@ +- ++use.js(3,8): error TS2554: Expected 1 arguments, but got 0. ++ ++ ++==== use.js (1 errors) ==== ++ /// ++ var mini = require('./minimatch') ++ mini.M.defaults() ++ ~~~~~~~~ ++!!! error TS2554: Expected 1 arguments, but got 0. ++!!! related TS6210 minimatch.js:10:24: An argument for 'def' was not provided. ++ var m = new mini.M() ++ m.m() ++ mini.filter() ++ ++==== types.d.ts (0 errors) ==== ++ declare var require: any; ++ declare var module: any; ++==== minimatch.js (0 errors) ==== ++ /// ++ module.exports = minimatch ++ minimatch.M = M ++ minimatch.filter = filter ++ function filter() { ++ return minimatch() ++ } ++ function minimatch() { ++ } ++ M.defaults = function (def) { ++ return def ++ } ++ M.prototype.m = function () { ++ } ++ function M() { ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff index ed75ccf902..fbcd2a1ad6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff @@ -6,23 +6,21 @@ var mini = require('./minimatch') ->mini : typeof mini ->require('./minimatch') : typeof mini -+>mini : any -+>require('./minimatch') : any ++>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>require('./minimatch') : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } >require : any >'./minimatch' : "./minimatch" mini.M.defaults() >mini.M.defaults() : any -->mini.M.defaults : (def: any) => any + >mini.M.defaults : (def: any) => any ->mini.M : typeof M ->mini : typeof mini ->M : typeof M -->defaults : (def: any) => any -+>mini.M.defaults : any -+>mini.M : any -+>mini : any -+>M : any -+>defaults : any ++>mini.M : { (): void; defaults: (def: any) => any; } ++>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>M : { (): void; defaults: (def: any) => any; } + >defaults : (def: any) => any var m = new mini.M() ->m : M @@ -32,9 +30,9 @@ ->M : typeof M +>m : any +>new mini.M() : any -+>mini.M : any -+>mini : any -+>M : any ++>mini.M : { (): void; defaults: (def: any) => any; } ++>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>M : { (): void; defaults: (def: any) => any; } m.m() ->m.m() : void @@ -47,75 +45,78 @@ +>m : any mini.filter() -->mini.filter() : void -->mini.filter : () => void + >mini.filter() : void + >mini.filter : () => void ->mini : typeof mini -->filter : () => void -+>mini.filter() : any -+>mini.filter : any -+>mini : any -+>filter : any ++>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } + >filter : () => void === types.d.ts === - declare var require: any; -@@= skipped -38, +38 lines =@@ - - declare var module: any; - >module : any -- --=== minimatch.js === --/// --module.exports = minimatch +@@= skipped -42, +42 lines =@@ + === minimatch.js === + /// + module.exports = minimatch ->module.exports = minimatch : typeof minimatch ->module.exports : typeof minimatch ->module : { exports: typeof minimatch; } ->exports : typeof minimatch ->minimatch : typeof minimatch -- --minimatch.M = M ++>module.exports = minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>module.exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>module : { minimatch: { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; }; } ++>exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } + + minimatch.M = M ->minimatch.M = M : typeof M ->minimatch.M : typeof M ->minimatch : typeof minimatch ->M : typeof M ->M : typeof M -- --minimatch.filter = filter -->minimatch.filter = filter : () => void -->minimatch.filter : () => void ++>minimatch.M = M : { (): void; defaults: (def: any) => any; } ++>minimatch.M : { (): void; defaults: (def: any) => any; } ++>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>M : { (): void; defaults: (def: any) => any; } ++>M : { (): void; defaults: (def: any) => any; } + + minimatch.filter = filter + >minimatch.filter = filter : () => void + >minimatch.filter : () => void ->minimatch : typeof minimatch -->filter : () => void -->filter : () => void -- --function filter() { -->filter : () => void -- -- return minimatch() -->minimatch() : void ++>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } + >filter : () => void + >filter : () => void + +@@= skipped -25, +25 lines =@@ + + return minimatch() + >minimatch() : void ->minimatch : typeof minimatch --} --function minimatch() { ++>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } + } + function minimatch() { ->minimatch : typeof minimatch --} --M.defaults = function (def) { -->M.defaults = function (def) { return def} : (def: any) => any -->M.defaults : (def: any) => any ++>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } + } + M.defaults = function (def) { + >M.defaults = function (def) { return def} : (def: any) => any + >M.defaults : (def: any) => any ->M : typeof M -->defaults : (def: any) => any -->function (def) { return def} : (def: any) => any -->def : any -- -- return def -->def : any --} --M.prototype.m = function () { -->M.prototype.m = function () {} : () => void -->M.prototype.m : any -->M.prototype : any ++>M : { (): void; defaults: (def: any) => any; } + >defaults : (def: any) => any + >function (def) { return def} : (def: any) => any + >def : any +@@= skipped -20, +20 lines =@@ + >M.prototype.m = function () {} : () => void + >M.prototype.m : any + >M.prototype : any ->M : typeof M -->prototype : any -->m : any -->function () {} : () => void --} --function M() { ++>M : { (): void; defaults: (def: any) => any; } + >prototype : any + >m : any + >function () {} : () => void + } + function M() { ->M : typeof M --} ++>M : { (): void; defaults: (def: any) => any; } + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment19.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment19.errors.txt.diff new file mode 100644 index 0000000000..861990632b --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment19.errors.txt.diff @@ -0,0 +1,27 @@ +--- old.typeFromPropertyAssignment19.errors.txt ++++ new.typeFromPropertyAssignment19.errors.txt +@@= skipped -0, +0 lines =@@ +- ++index.js(2,19): error TS2306: File 'semver.js' is not a module. ++semver.js(2,1): error TS2304: Cannot find name 'exports'. ++ ++ ++==== index.js (1 errors) ==== ++ /// ++ const C = require("./semver") ++ ~~~~~~~~~~ ++!!! error TS2306: File 'semver.js' is not a module. ++ var two = C.f(1) ++ ++==== types.d.ts (0 errors) ==== ++ declare var require: any; ++ declare var module: any; ++==== semver.js (1 errors) ==== ++ /// ++ exports = module.exports = C ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. ++ C.f = n => n + 1 ++ function C() { ++ this.p = 1 ++ } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment19.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment19.types.diff index 4ea70b9eb7..9e4b30cdaa 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment19.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment19.types.diff @@ -23,13 +23,10 @@ >1 : 1 === types.d.ts === -@@= skipped -20, +20 lines =@@ - declare var module: any; - >module : any - --=== semver.js === --/// --exports = module.exports = C +@@= skipped -23, +23 lines =@@ + === semver.js === + /// + exports = module.exports = C ->exports = module.exports = C : typeof C ->exports : typeof C ->module.exports = C : typeof C @@ -37,25 +34,34 @@ ->module : { exports: typeof C; } ->exports : typeof C ->C : typeof C -- --C.f = n => n + 1 -->C.f = n => n + 1 : (n: any) => any -->C.f : (n: any) => any ++>exports = module.exports = C : { (): void; f: (n: any) => any; } ++>exports : any ++>module.exports = C : { (): void; f: (n: any) => any; } ++>module.exports : any ++>module : any ++>exports : any ++>C : { (): void; f: (n: any) => any; } + + C.f = n => n + 1 + >C.f = n => n + 1 : (n: any) => any + >C.f : (n: any) => any ->C : typeof C -->f : (n: any) => any -->n => n + 1 : (n: any) => any -->n : any -->n + 1 : any -->n : any -->1 : 1 -- --function C() { ++>C : { (): void; f: (n: any) => any; } + >f : (n: any) => any + >n => n + 1 : (n: any) => any + >n : any +@@= skipped -20, +20 lines =@@ + >1 : 1 + + function C() { ->C : typeof C -- -- this.p = 1 -->this.p = 1 : 1 -->this.p : any ++>C : { (): void; f: (n: any) => any; } + + this.p = 1 + >this.p = 1 : 1 + >this.p : any ->this : this -->p : any -->1 : 1 --} \ No newline at end of file ++>this : any + >p : any + >1 : 1 + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment37.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment37.errors.txt.diff new file mode 100644 index 0000000000..500a5ce5d3 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment37.errors.txt.diff @@ -0,0 +1,31 @@ +--- old.typeFromPropertyAssignment37.errors.txt ++++ new.typeFromPropertyAssignment37.errors.txt +@@= skipped -0, +0 lines =@@ +- ++mod.js(1,14): error TS2304: Cannot find name 'exports'. ++mod.js(1,24): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++mod.js(3,10): error TS2339: Property 'existy' does not exist on type '{}'. ++use.js(1,22): error TS2306: File 'mod.js' is not a module. ++ ++ ++==== use.js (1 errors) ==== ++ const util = require('./mod') ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. ++ function n() { ++ util.existy // no error ++ } ++ util.existy // no error ++ ++==== mod.js (3 errors) ==== ++ const util = exports = module.exports = {} ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++ if (!!false) { ++ util.existy = function () { } ++ ~~~~~~ ++!!! error TS2339: Property 'existy' does not exist on type '{}'. ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment37.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment37.types.diff index 8b5456b8b0..32ea4c53c1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment37.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment37.types.diff @@ -26,9 +26,12 @@ ->util.existy : () => void ->util : typeof util ->existy : () => void -- --=== mod.js === --const util = exports = module.exports = {} ++>util.existy : any ++>util : any ++>existy : any + + === mod.js === + const util = exports = module.exports = {} ->util : typeof module.exports ->exports = module.exports = {} : typeof module.exports ->exports : typeof import("mod") @@ -36,20 +39,25 @@ ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{} : {} -- --if (!!false) { -->!!false : boolean -->!false : true -->false : false -- -- util.existy = function () { } -->util.existy = function () { } : () => void ++>util : {} ++>exports = module.exports = {} : {} ++>exports : any ++>module.exports = {} : {} ++>module.exports : any ++>module : any ++>exports : any + >{} : {} + + if (!!false) { +@@= skipped -27, +27 lines =@@ + + util.existy = function () { } + >util.existy = function () { } : () => void ->util.existy : () => void ->util : typeof module.exports ->existy : () => void -->function () { } : () => void --} +>util.existy : any -+>util : any ++>util : {} +>existy : any + >function () { } : () => void + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff index b78e86ee38..0a4e1b8385 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff @@ -8,48 +8,84 @@ - - -==== use.js (0 errors) ==== -- var mod = require('./mod1.js'); -- /** @type {import("./mod1.js").Baz} */ -- var b; -- /** @type {mod.Baz} */ -- var bb; -- var bbb = new mod.Baz(); -- ++mod1.js(3,23): error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. ++mod1.js(4,7): error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. ++mod1.js(7,9): error TS2339: Property 'Bar' does not exist on type 'typeof import("mod1")'. ++mod1.js(10,1): error TS2300: Duplicate identifier 'export='. ++mod1.js(10,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++mod1.js(20,9): error TS2339: Property 'Quid' does not exist on type 'typeof import("mod1")'. ++mod1.js(23,1): error TS2300: Duplicate identifier 'export='. ++mod1.js(24,5): error TS2353: Object literal may only specify known properties, and 'Quack' does not exist in type '{ Baz: typeof Baz; }'. ++use.js(2,32): error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. ++use.js(4,12): error TS2503: Cannot find namespace 'mod'. ++ ++ ++==== use.js (2 errors) ==== + var mod = require('./mod1.js'); + /** @type {import("./mod1.js").Baz} */ ++ ~~~ ++!!! error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. + var b; + /** @type {mod.Baz} */ ++ ~~~ ++!!! error TS2503: Cannot find namespace 'mod'. + var bb; + var bbb = new mod.Baz(); + -==== mod1.js (4 errors) ==== -- // error -- -- /** @typedef {number} Foo */ -- ~~~ ++==== mod1.js (8 errors) ==== + // error + + /** @typedef {number} Foo */ + ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -- class Foo { } // should error -- ~~~ ++!!! error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. + class Foo { } // should error + ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -- -- /** @typedef {number} Bar */ -- exports.Bar = class { } -- -- /** @typedef {number} Baz */ ++!!! error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. + + /** @typedef {number} Bar */ + exports.Bar = class { } ++ ~~~ ++!!! error TS2339: Property 'Bar' does not exist on type 'typeof import("mod1")'. + + /** @typedef {number} Baz */ - ~~~ -!!! error TS2300: Duplicate identifier 'Baz'. -!!! related TS6203 mod1.js:11:5: 'Baz' was also declared here. -- module.exports = { -- Baz: class { } + module.exports = { ++ ~~~~~~~~~~~~~~~~~~ ++ ~~~~~~~~~~~~~~~~~~ + Baz: class { } - ~~~ -!!! error TS2300: Duplicate identifier 'Baz'. -!!! related TS6203 mod1.js:9:23: 'Baz' was also declared here. -- } -- -- // ok -- -- /** @typedef {number} Qux */ -- var Qux = 2; -- -- /** @typedef {number} Quid */ -- exports.Quid = 2; -- -- /** @typedef {number} Quack */ -- module.exports = { -- Quack: 2 -- } -- -+ \ No newline at end of file ++ ~~~~~~~~~~~~~~~~~~ ++ ~~~~~~~~~~~~~~~~~~ + } ++ ~ ++!!! error TS2300: Duplicate identifier 'export='. ++ ~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + + // ok + +@@= skipped -42, +56 lines =@@ + + /** @typedef {number} Quid */ + exports.Quid = 2; ++ ~~~~ ++!!! error TS2339: Property 'Quid' does not exist on type 'typeof import("mod1")'. + + /** @typedef {number} Quack */ + module.exports = { ++ ~~~~~~~~~~~~~~~~~~ + Quack: 2 ++ ~~~~~~~~~~~~ ++ ~~~~~ ++!!! error TS2353: Object literal may only specify known properties, and 'Quack' does not exist in type '{ Baz: typeof Baz; }'. + } ++ ~ ++!!! error TS2300: Duplicate identifier 'export='. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff index 0a1418e7be..f33a595b97 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff @@ -6,8 +6,8 @@ var mod = require('./mod1.js'); ->mod : { Bar: typeof mod.Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof mod.Bar; Baz?: undefined; Quid: 2; Quack: number; } ->require('./mod1.js') : { Bar: typeof mod.Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof mod.Bar; Baz?: undefined; Quid: 2; Quack: number; } -+>mod : any -+>require('./mod1.js') : any ++>mod : { Baz: typeof Baz; } ++>require('./mod1.js') : { Baz: typeof Baz; } >require : any >'./mod1.js' : "./mod1.js" @@ -19,72 +19,64 @@ /** @type {mod.Baz} */ var bb; ->bb : number -+>bb : error ++>bb : mod.Baz var bbb = new mod.Baz(); -->bbb : Baz -->new mod.Baz() : Baz -->mod.Baz : typeof Baz + >bbb : Baz + >new mod.Baz() : Baz + >mod.Baz : typeof Baz ->mod : { Bar: typeof mod.Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof mod.Bar; Baz?: undefined; Quid: 2; Quack: number; } -->Baz : typeof Baz -- --=== mod1.js === --// error -- --/** @typedef {number} Foo */ --class Foo { } // should error -->Foo : Foo -- --/** @typedef {number} Bar */ --exports.Bar = class { } -->exports.Bar = class { } : typeof Bar ++>mod : { Baz: typeof Baz; } + >Baz : typeof Baz + + === mod1.js === +@@= skipped -30, +30 lines =@@ + /** @typedef {number} Bar */ + exports.Bar = class { } + >exports.Bar = class { } : typeof Bar ->exports.Bar : typeof Bar ->exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } ->Bar : typeof Bar -->class { } : typeof Bar -- --/** @typedef {number} Baz */ --module.exports = { ++>exports.Bar : any ++>exports : typeof import("./mod1") ++>Bar : any + >class { } : typeof Bar + + /** @typedef {number} Baz */ + module.exports = { ->module.exports = { Baz: class { }} : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } ->module.exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } ->module : { exports: { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; }; } ->exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } -->{ Baz: class { }} : { Baz: typeof Baz; } -- -- Baz: class { } -->Baz : typeof Baz -->class { } : typeof Baz --} -- --// ok -- --/** @typedef {number} Qux */ --var Qux = 2; -->Qux : number -->2 : 2 -- --/** @typedef {number} Quid */ --exports.Quid = 2; -->exports.Quid = 2 : 2 ++>module.exports = { Baz: class { }} : { Baz: typeof Baz; } ++>module.exports : { Baz: typeof Baz; } ++>module : { "export=": { Baz: typeof Baz; }; } ++>exports : { Baz: typeof Baz; } + >{ Baz: class { }} : { Baz: typeof Baz; } + + Baz: class { } +@@= skipped -28, +28 lines =@@ + /** @typedef {number} Quid */ + exports.Quid = 2; + >exports.Quid = 2 : 2 ->exports.Quid : 2 ->exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } ->Quid : 2 -->2 : 2 -- --/** @typedef {number} Quack */ --module.exports = { ++>exports.Quid : any ++>exports : typeof import("./mod1") ++>Quid : any + >2 : 2 + + /** @typedef {number} Quack */ + module.exports = { ->module.exports = { Quack: 2} : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } ->module.exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } ->module : { exports: { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; }; } ->exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } -->{ Quack: 2} : { Quack: number; } -- -- Quack: 2 -->Quack : number -->2 : 2 --} -+>bbb : any -+>new mod.Baz() : any -+>mod.Baz : any -+>mod : any -+>Baz : any ++>module.exports = { Quack: 2} : { Quack: number; } ++>module.exports : { Baz: typeof Baz; } ++>module : { "export=": { Baz: typeof Baz; }; } ++>exports : { Baz: typeof Baz; } + >{ Quack: 2} : { Quack: number; } + + Quack: 2 \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.types.diff new file mode 100644 index 0000000000..24172272bd --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.types.diff @@ -0,0 +1,11 @@ +--- old.untypedModuleImport_allowJs.types ++++ new.untypedModuleImport_allowJs.types +@@= skipped -13, +13 lines =@@ + exports.default = { bar() { return 0; } } + >exports.default = { bar() { return 0; } } : { bar(): number; } + >exports.default : { bar(): number; } +->exports : typeof import("/node_modules/foo/index") ++>exports : typeof import("foo") + >default : { bar(): number; } + >{ bar() { return 0; } } : { bar(): number; } + >bar : () => number \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.errors.txt.diff deleted file mode 100644 index 3800b1ceac..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.errors.txt.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.varRequireFromJavascript.errors.txt -+++ new.varRequireFromJavascript.errors.txt -@@= skipped -0, +0 lines =@@ -- -+use.js(1,18): error TS7016: Could not find a declaration file for module './ex'. 'ex.js' implicitly has an 'any' type. -+ -+ -+==== use.js (1 errors) ==== -+ var ex = require('./ex') -+ ~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './ex'. 'ex.js' implicitly has an 'any' type. -+ -+ // values work -+ var crunch = new ex.Crunch(1); -+ crunch.n -+ -+ -+ // types work -+ /** -+ * @param {ex.Crunch} wrap -+ */ -+ function f(wrap) { -+ wrap.n -+ } -+ -+==== ex.js (0 errors) ==== -+ export class Crunch { -+ /** @param {number} n */ -+ constructor(n) { -+ this.n = n -+ } -+ m() { -+ return this.n -+ } -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.types.diff index 8a0d20b5bc..2b7ca5fdd7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.types.diff @@ -1,71 +1,14 @@ --- old.varRequireFromJavascript.types +++ new.varRequireFromJavascript.types -@@= skipped -1, +1 lines =@@ +@@= skipped -45, +45 lines =@@ - === use.js === - var ex = require('./ex') -->ex : typeof ex -->require('./ex') : typeof ex -+>ex : any -+>require('./ex') : any - >require : any - >'./ex' : "./ex" - - // values work - var crunch = new ex.Crunch(1); -->crunch : ex.Crunch -->new ex.Crunch(1) : ex.Crunch -->ex.Crunch : typeof ex.Crunch -->ex : typeof ex -->Crunch : typeof ex.Crunch -+>crunch : any -+>new ex.Crunch(1) : any -+>ex.Crunch : any -+>ex : any -+>Crunch : any - >1 : 1 - - crunch.n -->crunch.n : number -->crunch : ex.Crunch -->n : number -+>crunch.n : any -+>crunch : any -+>n : any - - - // types work -@@= skipped -29, +29 lines =@@ - >wrap : ex.Crunch - - wrap.n -->wrap.n : number -+>wrap.n : any - >wrap : ex.Crunch -->n : number --} -- --=== ex.js === --export class Crunch { -->Crunch : Crunch -- -- /** @param {number} n */ -- constructor(n) { -->n : number -- -- this.n = n -->this.n = n : number + this.n = n + >this.n = n : number ->this.n : any -->this : this - >n : any -->n : number -- } -- m() { -->m : () => number -- -- return this.n -->this.n : number -->this : this -->n : number -- } - } ++>this.n : number + >this : this +->n : any ++>n : number + >n : number + } + m() { \ No newline at end of file From e78bf35b4263488dfa82c22a2c4589c04a89eaf1 Mon Sep 17 00:00:00 2001 From: Max schwenk Date: Tue, 17 Jun 2025 15:27:01 -0600 Subject: [PATCH 9/9] Fix nested dist when referenced package has ts file --- internal/compiler/fileloader.go | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/internal/compiler/fileloader.go b/internal/compiler/fileloader.go index 1751edc63e..0219d1f45c 100644 --- a/internal/compiler/fileloader.go +++ b/internal/compiler/fileloader.go @@ -331,6 +331,26 @@ func (p *fileLoader) resolveTypeReferenceDirectives(file *ast.SourceFile, meta a const externalHelpersModuleNameText = "tslib" // TODO(jakebailey): dedupe +// findPackageRoot walks up the directory tree to find the nearest package.json file +// and returns the directory containing it, or empty string if not found +func (p *fileLoader) findPackageRoot(startDir string) string { + current := startDir + for { + packageJsonPath := tspath.CombinePaths(current, "package.json") + if p.opts.Host.FS().FileExists(packageJsonPath) { + return current + } + + parent := tspath.GetDirectoryPath(current) + if parent == current { + // Reached root directory + break + } + current = parent + } + return "" +} + func (p *fileLoader) resolveImportsAndModuleAugmentations(file *ast.SourceFile, meta ast.SourceFileMetaData) ( toParse []resolvedRef, resolutionsInFile module.ModeAwareCache[*module.ResolvedModule], @@ -401,13 +421,41 @@ func (p *fileLoader) resolveImportsAndModuleAugmentations(file *ast.SourceFile, // - noResolve is falsy // - module name comes from the list of imports // - it's not a top level JavaScript module that exceeded the search max + // - it's not a TypeScript source file from an external dependency (which would cause nested output directories) importIndex := index - importsStart + // Check if this is a TypeScript source file from an external dependency + // External dependencies should only contribute declaration files (.d.ts) and JavaScript files (.js/.jsx) + // not TypeScript source files (.ts/.tsx) which would be included in compilation + isExternalDependency := resolvedModule.IsExternalLibraryImport + + // In monorepo setups, also check if this is a cross-package import (package name import that resolves outside current package) + if !isExternalDependency && !tspath.IsExternalModuleNameRelative(moduleName) { + // This is a package name import (e.g., "@tsgo-repros/my-package-b") + // Check if the resolved file is outside the current package directory + currentPackageDir := tspath.GetDirectoryPath(file.FileName()) + resolvedPackageDir := tspath.GetDirectoryPath(resolvedModule.ResolvedFileName) + + // Find the root of the current package (look for package.json) + currentPackageRoot := p.findPackageRoot(currentPackageDir) + resolvedPackageRoot := p.findPackageRoot(resolvedPackageDir) + + // If they have different package roots, this is a cross-package dependency + if currentPackageRoot != "" && resolvedPackageRoot != "" && currentPackageRoot != resolvedPackageRoot { + isExternalDependency = true + } + } + + isTypeScriptSourceFromExternalDep := isExternalDependency && + (resolvedModule.Extension == tspath.ExtensionTs || resolvedModule.Extension == tspath.ExtensionTsx || + resolvedModule.Extension == tspath.ExtensionMts || resolvedModule.Extension == tspath.ExtensionCts) + shouldAddFile := moduleName != "" && getResolutionDiagnostic(optionsForFile, resolvedModule, file) == nil && !optionsForFile.NoResolve.IsTrue() && !(isJsFile && !optionsForFile.GetAllowJS()) && + !isTypeScriptSourceFromExternalDep && (importIndex < 0 || (importIndex < len(file.Imports()) && (ast.IsInJSFile(file.Imports()[importIndex]) || file.Imports()[importIndex].Flags&ast.NodeFlagsJSDoc == 0))) if shouldAddFile {