Merge branch 'main' into turn-off-web-server

This commit is contained in:
Nathan Shively-Sanders
2022-10-24 09:00:55 -07:00
69 changed files with 1605 additions and 250 deletions
+150 -134
View File
@@ -74,9 +74,9 @@
}
},
"node_modules/@es-joy/jsdoccomment": {
"version": "0.31.0",
"resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.31.0.tgz",
"integrity": "sha512-tc1/iuQcnaiSIUVad72PBierDFpsxdUHtEF/OrfqvM1CBAsIoMP51j52jTMb3dXriwhieTo289InzZj72jL3EQ==",
"version": "0.33.0",
"resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.33.0.tgz",
"integrity": "sha512-bkxMGTlHPE4vfarXt1L1fOm81O18jTRFNgh3Fm4iPKctfWxcpJw4cpth5BhLkGZy4HFzGn/KfD/zGks/J+ZIIw==",
"dev": true,
"dependencies": {
"comment-parser": "1.3.1",
@@ -84,7 +84,7 @@
"jsdoc-type-pratt-parser": "~3.1.0"
},
"engines": {
"node": "^14 || ^16 || ^17 || ^18"
"node": "^14 || ^16 || ^17 || ^18 || ^19"
}
},
"node_modules/@eslint/eslintrc": {
@@ -174,9 +174,9 @@
}
},
"node_modules/@humanwhocodes/config-array": {
"version": "0.10.7",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.7.tgz",
"integrity": "sha512-MDl6D6sBsaV452/QSdX+4CXIjZhIcI0PELsxUjk4U828yd58vk3bTIvk/6w5FY+4hIy9sLW0sfrV7K7Kc++j/w==",
"version": "0.11.6",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.6.tgz",
"integrity": "sha512-jJr+hPTJYKyDILJfhNSHsjiwXYf26Flsz8DvNndOsHs5pwSnpGUEy8yzF0JYhCEvTDdV2vuOK5tt8BVhwO5/hg==",
"dev": true,
"dependencies": {
"@humanwhocodes/object-schema": "^1.2.1",
@@ -286,9 +286,9 @@
}
},
"node_modules/@octokit/graphql": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-5.0.3.tgz",
"integrity": "sha512-VjhqOu2CHo2hwank1y2k8YcqF83zJW6upyP1+0l3wegvpq+4H31zOA5Rkyx76uJBUdJooUR5UnFyclBptzl86Q==",
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-5.0.4.tgz",
"integrity": "sha512-amO1M5QUQgYQo09aStR/XO7KAl13xpigcy/kI8/N1PnZYSS69fgte+xA4+c2DISKqUZfsh0wwjc2FaCt99L41A==",
"dev": true,
"dependencies": {
"@octokit/request": "^6.0.0",
@@ -577,9 +577,15 @@
"dev": true
},
"node_modules/@types/node": {
"version": "18.11.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.0.tgz",
"integrity": "sha512-IOXCvVRToe7e0ny7HpT/X9Rb2RYtElG1a+VshjwT00HxrM2dWBApHQoqsI6WiY7Q03vdf2bCrIGzVrkF/5t10w==",
"version": "18.11.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.4.tgz",
"integrity": "sha512-BxcJpBu8D3kv/GZkx/gSMz6VnTJREBj/4lbzYOQueUOELkt8WrO6zAcSPmp9uRPEW/d+lUO8QK0W2xnS1hEU0A==",
"dev": true
},
"node_modules/@types/semver": {
"version": "7.3.12",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.12.tgz",
"integrity": "sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==",
"dev": true
},
"node_modules/@types/source-map-support": {
@@ -645,14 +651,14 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.0.tgz",
"integrity": "sha512-FIBZgS3DVJgqPwJzvZTuH4HNsZhHMa9SjxTKAZTlMsPw/UzpEjcf9f4dfgDJEHjK+HboUJo123Eshl6niwEm/Q==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.1.tgz",
"integrity": "sha512-FsWboKkWdytGiXT5O1/R9j37YgcjO8MKHSUmWnIEjVaz0krHkplPnYi7mwdb+5+cs0toFNQb0HIrN7zONdIEWg==",
"dev": true,
"dependencies": {
"@typescript-eslint/scope-manager": "5.40.0",
"@typescript-eslint/type-utils": "5.40.0",
"@typescript-eslint/utils": "5.40.0",
"@typescript-eslint/scope-manager": "5.40.1",
"@typescript-eslint/type-utils": "5.40.1",
"@typescript-eslint/utils": "5.40.1",
"debug": "^4.3.4",
"ignore": "^5.2.0",
"regexpp": "^3.2.0",
@@ -677,14 +683,14 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.40.0.tgz",
"integrity": "sha512-Ah5gqyX2ySkiuYeOIDg7ap51/b63QgWZA7w6AHtFrag7aH0lRQPbLzUjk0c9o5/KZ6JRkTTDKShL4AUrQa6/hw==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.40.1.tgz",
"integrity": "sha512-IK6x55va5w4YvXd4b3VrXQPldV9vQTxi5ov+g4pMANsXPTXOcfjx08CRR1Dfrcc51syPtXHF5bgLlMHYFrvQtg==",
"dev": true,
"dependencies": {
"@typescript-eslint/scope-manager": "5.40.0",
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/typescript-estree": "5.40.0",
"@typescript-eslint/scope-manager": "5.40.1",
"@typescript-eslint/types": "5.40.1",
"@typescript-eslint/typescript-estree": "5.40.1",
"debug": "^4.3.4"
},
"engines": {
@@ -704,13 +710,13 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.0.tgz",
"integrity": "sha512-d3nPmjUeZtEWRvyReMI4I1MwPGC63E8pDoHy0BnrYjnJgilBD3hv7XOiETKLY/zTwI7kCnBDf2vWTRUVpYw0Uw==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.1.tgz",
"integrity": "sha512-jkn4xsJiUQucI16OLCXrLRXDZ3afKhOIqXs4R3O+M00hdQLKR58WuyXPZZjhKLFCEP2g+TXdBRtLQ33UfAdRUg==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/visitor-keys": "5.40.0"
"@typescript-eslint/types": "5.40.1",
"@typescript-eslint/visitor-keys": "5.40.1"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -721,13 +727,13 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.40.0.tgz",
"integrity": "sha512-nfuSdKEZY2TpnPz5covjJqav+g5qeBqwSHKBvz7Vm1SAfy93SwKk/JeSTymruDGItTwNijSsno5LhOHRS1pcfw==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.40.1.tgz",
"integrity": "sha512-DLAs+AHQOe6n5LRraXiv27IYPhleF0ldEmx6yBqBgBLaNRKTkffhV1RPsjoJBhVup2zHxfaRtan8/YRBgYhU9Q==",
"dev": true,
"dependencies": {
"@typescript-eslint/typescript-estree": "5.40.0",
"@typescript-eslint/utils": "5.40.0",
"@typescript-eslint/typescript-estree": "5.40.1",
"@typescript-eslint/utils": "5.40.1",
"debug": "^4.3.4",
"tsutils": "^3.21.0"
},
@@ -748,9 +754,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz",
"integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.1.tgz",
"integrity": "sha512-Icg9kiuVJSwdzSQvtdGspOlWNjVDnF3qVIKXdJ103o36yRprdl3Ge5cABQx+csx960nuMF21v8qvO31v9t3OHw==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -761,13 +767,13 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.0.tgz",
"integrity": "sha512-b0GYlDj8TLTOqwX7EGbw2gL5EXS2CPEWhF9nGJiGmEcmlpNBjyHsTwbqpyIEPVpl6br4UcBOYlcI2FJVtJkYhg==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.1.tgz",
"integrity": "sha512-5QTP/nW5+60jBcEPfXy/EZL01qrl9GZtbgDZtDPlfW5zj/zjNrdI2B5zMUHmOsfvOr2cWqwVdWjobCiHcedmQA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/visitor-keys": "5.40.0",
"@typescript-eslint/types": "5.40.1",
"@typescript-eslint/visitor-keys": "5.40.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -788,15 +794,16 @@
}
},
"node_modules/@typescript-eslint/utils": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.40.0.tgz",
"integrity": "sha512-MO0y3T5BQ5+tkkuYZJBjePewsY+cQnfkYeRqS6tPh28niiIwPnQ1t59CSRcs1ZwJJNOdWw7rv9pF8aP58IMihA==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.40.1.tgz",
"integrity": "sha512-a2TAVScoX9fjryNrW6BZRnreDUszxqm9eQ9Esv8n5nXApMW0zeANUYlwh/DED04SC/ifuBvXgZpIK5xeJHQ3aw==",
"dev": true,
"dependencies": {
"@types/json-schema": "^7.0.9",
"@typescript-eslint/scope-manager": "5.40.0",
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/typescript-estree": "5.40.0",
"@types/semver": "^7.3.12",
"@typescript-eslint/scope-manager": "5.40.1",
"@typescript-eslint/types": "5.40.1",
"@typescript-eslint/typescript-estree": "5.40.1",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0",
"semver": "^7.3.7"
@@ -813,12 +820,12 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz",
"integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.1.tgz",
"integrity": "sha512-A2DGmeZ+FMja0geX5rww+DpvILpwo1OsiQs0M+joPWJYsiEFBLsH0y1oFymPNul6Z5okSmHpP4ivkc2N0Cgfkw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/types": "5.40.1",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
@@ -2280,14 +2287,15 @@
}
},
"node_modules/eslint": {
"version": "8.25.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.25.0.tgz",
"integrity": "sha512-DVlJOZ4Pn50zcKW5bYH7GQK/9MsoQG2d5eDH0ebEkE8PbgzTTmtt/VTH9GGJ4BfeZCpBLqFfvsjX35UacUL83A==",
"version": "8.26.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.26.0.tgz",
"integrity": "sha512-kzJkpaw1Bfwheq4VXUezFriD1GxszX6dUekM7Z3aC2o4hju+tsR/XyTC3RcoSD7jmy9VkPU3+N6YjVU2e96Oyg==",
"dev": true,
"dependencies": {
"@eslint/eslintrc": "^1.3.3",
"@humanwhocodes/config-array": "^0.10.5",
"@humanwhocodes/config-array": "^0.11.6",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
@@ -2303,14 +2311,14 @@
"fast-deep-equal": "^3.1.3",
"file-entry-cache": "^6.0.1",
"find-up": "^5.0.0",
"glob-parent": "^6.0.1",
"glob-parent": "^6.0.2",
"globals": "^13.15.0",
"globby": "^11.1.0",
"grapheme-splitter": "^1.0.4",
"ignore": "^5.2.0",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
"is-path-inside": "^3.0.3",
"js-sdsl": "^4.1.4",
"js-yaml": "^4.1.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
@@ -2450,21 +2458,21 @@
"dev": true
},
"node_modules/eslint-plugin-jsdoc": {
"version": "39.3.6",
"resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-39.3.6.tgz",
"integrity": "sha512-R6dZ4t83qPdMhIOGr7g2QII2pwCjYyKP+z0tPOfO1bbAbQyKC20Y2Rd6z1te86Lq3T7uM8bNo+VD9YFpE8HU/g==",
"version": "39.3.23",
"resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-39.3.23.tgz",
"integrity": "sha512-ZwutuEmsdz8sj9fCXz4r/4x3uZ4qrB6+ca3rIyH3HHEEj5t6xgOSBWIj8IkxZkBUKvoadWHM6iCPzkmXgPHpsA==",
"dev": true,
"dependencies": {
"@es-joy/jsdoccomment": "~0.31.0",
"@es-joy/jsdoccomment": "~0.33.0",
"comment-parser": "1.3.1",
"debug": "^4.3.4",
"escape-string-regexp": "^4.0.0",
"esquery": "^1.4.0",
"semver": "^7.3.7",
"semver": "^7.3.8",
"spdx-expression-parse": "^3.0.1"
},
"engines": {
"node": "^14 || ^16 || ^17 || ^18"
"node": "^14 || ^16 || ^17 || ^18 || ^19"
},
"peerDependencies": {
"eslint": "^7.0.0 || ^8.0.0"
@@ -4580,9 +4588,9 @@
}
},
"node_modules/is-core-module": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz",
"integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==",
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz",
"integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==",
"dev": true,
"dependencies": {
"has": "^1.0.3"
@@ -8661,9 +8669,9 @@
},
"dependencies": {
"@es-joy/jsdoccomment": {
"version": "0.31.0",
"resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.31.0.tgz",
"integrity": "sha512-tc1/iuQcnaiSIUVad72PBierDFpsxdUHtEF/OrfqvM1CBAsIoMP51j52jTMb3dXriwhieTo289InzZj72jL3EQ==",
"version": "0.33.0",
"resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.33.0.tgz",
"integrity": "sha512-bkxMGTlHPE4vfarXt1L1fOm81O18jTRFNgh3Fm4iPKctfWxcpJw4cpth5BhLkGZy4HFzGn/KfD/zGks/J+ZIIw==",
"dev": true,
"requires": {
"comment-parser": "1.3.1",
@@ -8741,9 +8749,9 @@
}
},
"@humanwhocodes/config-array": {
"version": "0.10.7",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.7.tgz",
"integrity": "sha512-MDl6D6sBsaV452/QSdX+4CXIjZhIcI0PELsxUjk4U828yd58vk3bTIvk/6w5FY+4hIy9sLW0sfrV7K7Kc++j/w==",
"version": "0.11.6",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.6.tgz",
"integrity": "sha512-jJr+hPTJYKyDILJfhNSHsjiwXYf26Flsz8DvNndOsHs5pwSnpGUEy8yzF0JYhCEvTDdV2vuOK5tt8BVhwO5/hg==",
"dev": true,
"requires": {
"@humanwhocodes/object-schema": "^1.2.1",
@@ -8825,9 +8833,9 @@
}
},
"@octokit/graphql": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-5.0.3.tgz",
"integrity": "sha512-VjhqOu2CHo2hwank1y2k8YcqF83zJW6upyP1+0l3wegvpq+4H31zOA5Rkyx76uJBUdJooUR5UnFyclBptzl86Q==",
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-5.0.4.tgz",
"integrity": "sha512-amO1M5QUQgYQo09aStR/XO7KAl13xpigcy/kI8/N1PnZYSS69fgte+xA4+c2DISKqUZfsh0wwjc2FaCt99L41A==",
"dev": true,
"requires": {
"@octokit/request": "^6.0.0",
@@ -9081,9 +9089,15 @@
"dev": true
},
"@types/node": {
"version": "18.11.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.0.tgz",
"integrity": "sha512-IOXCvVRToe7e0ny7HpT/X9Rb2RYtElG1a+VshjwT00HxrM2dWBApHQoqsI6WiY7Q03vdf2bCrIGzVrkF/5t10w==",
"version": "18.11.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.4.tgz",
"integrity": "sha512-BxcJpBu8D3kv/GZkx/gSMz6VnTJREBj/4lbzYOQueUOELkt8WrO6zAcSPmp9uRPEW/d+lUO8QK0W2xnS1hEU0A==",
"dev": true
},
"@types/semver": {
"version": "7.3.12",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.12.tgz",
"integrity": "sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==",
"dev": true
},
"@types/source-map-support": {
@@ -9149,14 +9163,14 @@
}
},
"@typescript-eslint/eslint-plugin": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.0.tgz",
"integrity": "sha512-FIBZgS3DVJgqPwJzvZTuH4HNsZhHMa9SjxTKAZTlMsPw/UzpEjcf9f4dfgDJEHjK+HboUJo123Eshl6niwEm/Q==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.1.tgz",
"integrity": "sha512-FsWboKkWdytGiXT5O1/R9j37YgcjO8MKHSUmWnIEjVaz0krHkplPnYi7mwdb+5+cs0toFNQb0HIrN7zONdIEWg==",
"dev": true,
"requires": {
"@typescript-eslint/scope-manager": "5.40.0",
"@typescript-eslint/type-utils": "5.40.0",
"@typescript-eslint/utils": "5.40.0",
"@typescript-eslint/scope-manager": "5.40.1",
"@typescript-eslint/type-utils": "5.40.1",
"@typescript-eslint/utils": "5.40.1",
"debug": "^4.3.4",
"ignore": "^5.2.0",
"regexpp": "^3.2.0",
@@ -9165,53 +9179,53 @@
}
},
"@typescript-eslint/parser": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.40.0.tgz",
"integrity": "sha512-Ah5gqyX2ySkiuYeOIDg7ap51/b63QgWZA7w6AHtFrag7aH0lRQPbLzUjk0c9o5/KZ6JRkTTDKShL4AUrQa6/hw==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.40.1.tgz",
"integrity": "sha512-IK6x55va5w4YvXd4b3VrXQPldV9vQTxi5ov+g4pMANsXPTXOcfjx08CRR1Dfrcc51syPtXHF5bgLlMHYFrvQtg==",
"dev": true,
"requires": {
"@typescript-eslint/scope-manager": "5.40.0",
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/typescript-estree": "5.40.0",
"@typescript-eslint/scope-manager": "5.40.1",
"@typescript-eslint/types": "5.40.1",
"@typescript-eslint/typescript-estree": "5.40.1",
"debug": "^4.3.4"
}
},
"@typescript-eslint/scope-manager": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.0.tgz",
"integrity": "sha512-d3nPmjUeZtEWRvyReMI4I1MwPGC63E8pDoHy0BnrYjnJgilBD3hv7XOiETKLY/zTwI7kCnBDf2vWTRUVpYw0Uw==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.1.tgz",
"integrity": "sha512-jkn4xsJiUQucI16OLCXrLRXDZ3afKhOIqXs4R3O+M00hdQLKR58WuyXPZZjhKLFCEP2g+TXdBRtLQ33UfAdRUg==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/visitor-keys": "5.40.0"
"@typescript-eslint/types": "5.40.1",
"@typescript-eslint/visitor-keys": "5.40.1"
}
},
"@typescript-eslint/type-utils": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.40.0.tgz",
"integrity": "sha512-nfuSdKEZY2TpnPz5covjJqav+g5qeBqwSHKBvz7Vm1SAfy93SwKk/JeSTymruDGItTwNijSsno5LhOHRS1pcfw==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.40.1.tgz",
"integrity": "sha512-DLAs+AHQOe6n5LRraXiv27IYPhleF0ldEmx6yBqBgBLaNRKTkffhV1RPsjoJBhVup2zHxfaRtan8/YRBgYhU9Q==",
"dev": true,
"requires": {
"@typescript-eslint/typescript-estree": "5.40.0",
"@typescript-eslint/utils": "5.40.0",
"@typescript-eslint/typescript-estree": "5.40.1",
"@typescript-eslint/utils": "5.40.1",
"debug": "^4.3.4",
"tsutils": "^3.21.0"
}
},
"@typescript-eslint/types": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz",
"integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.1.tgz",
"integrity": "sha512-Icg9kiuVJSwdzSQvtdGspOlWNjVDnF3qVIKXdJ103o36yRprdl3Ge5cABQx+csx960nuMF21v8qvO31v9t3OHw==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.0.tgz",
"integrity": "sha512-b0GYlDj8TLTOqwX7EGbw2gL5EXS2CPEWhF9nGJiGmEcmlpNBjyHsTwbqpyIEPVpl6br4UcBOYlcI2FJVtJkYhg==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.1.tgz",
"integrity": "sha512-5QTP/nW5+60jBcEPfXy/EZL01qrl9GZtbgDZtDPlfW5zj/zjNrdI2B5zMUHmOsfvOr2cWqwVdWjobCiHcedmQA==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/visitor-keys": "5.40.0",
"@typescript-eslint/types": "5.40.1",
"@typescript-eslint/visitor-keys": "5.40.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -9220,27 +9234,28 @@
}
},
"@typescript-eslint/utils": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.40.0.tgz",
"integrity": "sha512-MO0y3T5BQ5+tkkuYZJBjePewsY+cQnfkYeRqS6tPh28niiIwPnQ1t59CSRcs1ZwJJNOdWw7rv9pF8aP58IMihA==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.40.1.tgz",
"integrity": "sha512-a2TAVScoX9fjryNrW6BZRnreDUszxqm9eQ9Esv8n5nXApMW0zeANUYlwh/DED04SC/ifuBvXgZpIK5xeJHQ3aw==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.9",
"@typescript-eslint/scope-manager": "5.40.0",
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/typescript-estree": "5.40.0",
"@types/semver": "^7.3.12",
"@typescript-eslint/scope-manager": "5.40.1",
"@typescript-eslint/types": "5.40.1",
"@typescript-eslint/typescript-estree": "5.40.1",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0",
"semver": "^7.3.7"
}
},
"@typescript-eslint/visitor-keys": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz",
"integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==",
"version": "5.40.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.1.tgz",
"integrity": "sha512-A2DGmeZ+FMja0geX5rww+DpvILpwo1OsiQs0M+joPWJYsiEFBLsH0y1oFymPNul6Z5okSmHpP4ivkc2N0Cgfkw==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/types": "5.40.1",
"eslint-visitor-keys": "^3.3.0"
}
},
@@ -10394,14 +10409,15 @@
"dev": true
},
"eslint": {
"version": "8.25.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.25.0.tgz",
"integrity": "sha512-DVlJOZ4Pn50zcKW5bYH7GQK/9MsoQG2d5eDH0ebEkE8PbgzTTmtt/VTH9GGJ4BfeZCpBLqFfvsjX35UacUL83A==",
"version": "8.26.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.26.0.tgz",
"integrity": "sha512-kzJkpaw1Bfwheq4VXUezFriD1GxszX6dUekM7Z3aC2o4hju+tsR/XyTC3RcoSD7jmy9VkPU3+N6YjVU2e96Oyg==",
"dev": true,
"requires": {
"@eslint/eslintrc": "^1.3.3",
"@humanwhocodes/config-array": "^0.10.5",
"@humanwhocodes/config-array": "^0.11.6",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
@@ -10417,14 +10433,14 @@
"fast-deep-equal": "^3.1.3",
"file-entry-cache": "^6.0.1",
"find-up": "^5.0.0",
"glob-parent": "^6.0.1",
"glob-parent": "^6.0.2",
"globals": "^13.15.0",
"globby": "^11.1.0",
"grapheme-splitter": "^1.0.4",
"ignore": "^5.2.0",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
"is-path-inside": "^3.0.3",
"js-sdsl": "^4.1.4",
"js-yaml": "^4.1.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
@@ -10565,17 +10581,17 @@
}
},
"eslint-plugin-jsdoc": {
"version": "39.3.6",
"resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-39.3.6.tgz",
"integrity": "sha512-R6dZ4t83qPdMhIOGr7g2QII2pwCjYyKP+z0tPOfO1bbAbQyKC20Y2Rd6z1te86Lq3T7uM8bNo+VD9YFpE8HU/g==",
"version": "39.3.23",
"resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-39.3.23.tgz",
"integrity": "sha512-ZwutuEmsdz8sj9fCXz4r/4x3uZ4qrB6+ca3rIyH3HHEEj5t6xgOSBWIj8IkxZkBUKvoadWHM6iCPzkmXgPHpsA==",
"dev": true,
"requires": {
"@es-joy/jsdoccomment": "~0.31.0",
"@es-joy/jsdoccomment": "~0.33.0",
"comment-parser": "1.3.1",
"debug": "^4.3.4",
"escape-string-regexp": "^4.0.0",
"esquery": "^1.4.0",
"semver": "^7.3.7",
"semver": "^7.3.8",
"spdx-expression-parse": "^3.0.1"
}
},
@@ -12221,9 +12237,9 @@
"dev": true
},
"is-core-module": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz",
"integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==",
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz",
"integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==",
"dev": true,
"requires": {
"has": "^1.0.3"
+26 -29
View File
@@ -15709,7 +15709,7 @@ namespace ts {
type.flags & TypeFlags.TemplateLiteral ? getTemplateLiteralType(...applyTemplateStringMapping(symbol, (type as TemplateLiteralType).texts, (type as TemplateLiteralType).types)) :
// Mapping<Mapping<T>> === Mapping<T>
type.flags & TypeFlags.StringMapping && symbol === type.symbol ? type :
type.flags & (TypeFlags.Any | TypeFlags.String || type.flags & TypeFlags.StringMapping) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
type.flags & (TypeFlags.Any | TypeFlags.String | TypeFlags.StringMapping) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
// This handles Mapping<`${number}`> and Mapping<`${bigint}`>
isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) :
type;
@@ -19663,7 +19663,7 @@ namespace ts {
// For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
if (!result && (source.flags & TypeFlags.Intersection || source.flags & TypeFlags.TypeParameter && target.flags & TypeFlags.Union)) {
const constraint = getEffectiveConstraintOfIntersection(source.flags & TypeFlags.Intersection ? (source as IntersectionType).types: [source], !!(target.flags & TypeFlags.Union));
if (constraint && !(constraint.flags & TypeFlags.Never) && everyType(constraint, c => c !== source)) { // Skip comparison if expansion contains the source itself
if (constraint && everyType(constraint, c => c !== source)) { // Skip comparison if expansion contains the source itself
// TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
result = isRelatedTo(constraint, target, RecursionFlags.Source, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
}
@@ -21630,8 +21630,7 @@ namespace ts {
}
function isUnitLikeType(type: Type): boolean {
return type.flags & TypeFlags.Intersection ? some((type as IntersectionType).types, isUnitType) :
!!(type.flags & TypeFlags.Unit);
return isUnitType(getBaseConstraintOrType(type));
}
function extractUnitType(type: Type) {
@@ -25037,7 +25036,7 @@ namespace ts {
type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
}
else if (expr.kind === SyntaxKind.TypeOfExpression && isMatchingReference(reference, (expr as TypeOfExpression).expression)) {
type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
}
else {
if (strictNullChecks) {
@@ -25329,7 +25328,7 @@ namespace ts {
!!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
}
function narrowByInKeyword(type: Type, nameType: StringLiteralType | NumberLiteralType | UniqueESSymbolType, assumeTrue: boolean) {
function narrowTypeByInKeyword(type: Type, nameType: StringLiteralType | NumberLiteralType | UniqueESSymbolType, assumeTrue: boolean) {
const name = getPropertyNameFromType(nameType);
const isKnownProperty = someType(type, t => isTypePresencePossible(t, name, /*assumeTrue*/ true));
if (isKnownProperty) {
@@ -25411,7 +25410,7 @@ namespace ts {
return getTypeWithFacts(type, assumeTrue ? TypeFacts.NEUndefined : TypeFacts.EQUndefined);
}
if (isMatchingReference(reference, target)) {
return narrowByInKeyword(type, leftType as StringLiteralType | NumberLiteralType | UniqueESSymbolType, assumeTrue);
return narrowTypeByInKeyword(type, leftType as StringLiteralType | NumberLiteralType | UniqueESSymbolType, assumeTrue);
}
}
break;
@@ -25611,7 +25610,7 @@ namespace ts {
neverType);
}
function narrowBySwitchOnTypeOf(type: Type, switchStatement: SwitchStatement, clauseStart: number, clauseEnd: number): Type {
function narrowTypeBySwitchOnTypeOf(type: Type, switchStatement: SwitchStatement, clauseStart: number, clauseEnd: number): Type {
const witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
if (!witnesses) {
return type;
@@ -26035,13 +26034,13 @@ namespace ts {
function markAliasReferenced(symbol: Symbol, location: Node) {
if (isNonLocalAlias(symbol, /*excludes*/ SymbolFlags.Value) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, SymbolFlags.Value)) {
const target = resolveAlias(symbol);
if (getAllSymbolFlags(target) & SymbolFlags.Value) {
if (getAllSymbolFlags(target) & (SymbolFlags.Value | SymbolFlags.ExportValue)) {
// An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled
// (because the const enum value will not be inlined), or if (2) the alias is an export
// of a const enum declaration that will be preserved.
if (compilerOptions.isolatedModules ||
shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) ||
!isConstEnumOrConstEnumOnlyModule(target)
!isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))
) {
markAliasSymbolAsReferenced(symbol);
}
@@ -26290,7 +26289,7 @@ namespace ts {
// We only look for uninitialized variables in strict null checking mode, and only when we can analyze
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
// declaration container are the same).
const assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isBindingElement(declaration) ||
const assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) ||
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (TypeFlags.AnyOrUnknown | TypeFlags.Void)) !== 0 ||
isInTypeQuery(node) || node.parent.kind === SyntaxKind.ExportSpecifier) ||
node.parent.kind === SyntaxKind.NonNullExpression ||
@@ -26320,6 +26319,13 @@ namespace ts {
return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
}
function isSameScopedBindingElement(node: Identifier, declaration: Declaration) {
if (isBindingElement(declaration)) {
const bindingElement = findAncestor(node, isBindingElement);
return bindingElement && getRootDeclaration(bindingElement) === getRootDeclaration(declaration);
}
}
function shouldMarkIdentifierAliasReferenced(node: Identifier): boolean {
const parent = node.parent;
if (parent) {
@@ -26700,13 +26706,16 @@ namespace ts {
const immediateContainer = getSuperContainer(node, /*stopOnFunctions*/ true);
let container = immediateContainer;
let needToCaptureLexicalThis = false;
let inAsyncFunction = false;
// adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting
if (!isCallExpression) {
while (container && container.kind === SyntaxKind.ArrowFunction) {
if (hasSyntacticModifier(container, ModifierFlags.Async)) inAsyncFunction = true;
container = getSuperContainer(container, /*stopOnFunctions*/ true);
needToCaptureLexicalThis = languageVersion < ScriptTarget.ES2015;
}
if (container && hasSyntacticModifier(container, ModifierFlags.Async)) inAsyncFunction = true;
}
const canUseSuperExpression = isLegalUsageOfSuperExpression(container);
@@ -26818,12 +26827,12 @@ namespace ts {
// as a call expression cannot be used as the target of a destructuring assignment while a property access can.
//
// For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations.
if (container.kind === SyntaxKind.MethodDeclaration && hasSyntacticModifier(container, ModifierFlags.Async)) {
if (container.kind === SyntaxKind.MethodDeclaration && inAsyncFunction) {
if (isSuperProperty(node.parent) && isAssignmentTarget(node.parent)) {
getNodeLinks(container).flags |= NodeCheckFlags.AsyncMethodWithSuperBinding;
getNodeLinks(container).flags |= NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync;
}
else {
getNodeLinks(container).flags |= NodeCheckFlags.AsyncMethodWithSuper;
getNodeLinks(container).flags |= NodeCheckFlags.MethodWithSuperPropertyAccessInAsync;
}
}
@@ -36985,7 +36994,7 @@ namespace ts {
}
// primitives with a `{ then() }` won't be unwrapped/adopted.
if (allTypesAssignableToKind(type, TypeFlags.Primitive | TypeFlags.Never)) {
if (allTypesAssignableToKind(getBaseConstraintOrType(type), TypeFlags.Primitive | TypeFlags.Never)) {
return undefined;
}
@@ -37060,7 +37069,7 @@ namespace ts {
* Determines whether a type is an object with a callable `then` member.
*/
function isThenableType(type: Type): boolean {
if (allTypesAssignableToKind(type, TypeFlags.Primitive | TypeFlags.Never)) {
if (allTypesAssignableToKind(getBaseConstraintOrType(type), TypeFlags.Primitive | TypeFlags.Never)) {
// primitive types cannot be considered "thenable" since they are not objects.
return false;
}
@@ -37104,7 +37113,7 @@ namespace ts {
// We only need `Awaited<T>` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
// or is promise-like.
if (baseConstraint ?
baseConstraint.flags & TypeFlags.AnyOrUnknown || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) :
baseConstraint.flags & TypeFlags.AnyOrUnknown || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) :
maybeTypeOfKind(type, TypeFlags.TypeVariable)) {
return true;
}
@@ -41414,18 +41423,6 @@ namespace ts {
if (isGlobalAugmentation) {
return;
}
const symbol = getSymbolOfNode(node);
if (symbol) {
// module augmentations cannot introduce new names on the top level scope of the module
// this is done it two steps
// 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error
// 2. main check - report error if value declaration of the parent symbol is module augmentation)
let reportError = !(symbol.flags & SymbolFlags.Transient);
if (!reportError) {
// symbol should not originate in augmentation
reportError = !!symbol.parent?.declarations && isExternalModuleAugmentation(symbol.parent.declarations[0]);
}
}
break;
}
}
+14 -5
View File
@@ -2582,12 +2582,21 @@ namespace ts {
function writeConfigurations() {
// Filter applicable options to place in the file
const categorizedOptions = createMultiMap<CommandLineOption>();
const categorizedOptions = new Map<DiagnosticMessage, CommandLineOption[]>();
// Set allowed categories in order
categorizedOptions.set(Diagnostics.Projects, []);
categorizedOptions.set(Diagnostics.Language_and_Environment, []);
categorizedOptions.set(Diagnostics.Modules, []);
categorizedOptions.set(Diagnostics.JavaScript_Support, []);
categorizedOptions.set(Diagnostics.Emit, []);
categorizedOptions.set(Diagnostics.Interop_Constraints, []);
categorizedOptions.set(Diagnostics.Type_Checking, []);
categorizedOptions.set(Diagnostics.Completeness, []);
for (const option of optionDeclarations) {
const { category } = option;
if (isAllowedOptionForOutput(option)) {
categorizedOptions.add(getLocaleSpecificMessage(category!), option);
let listForCategory = categorizedOptions.get(option.category!);
if (!listForCategory) categorizedOptions.set(option.category!, listForCategory = []);
listForCategory.push(option);
}
}
@@ -2599,7 +2608,7 @@ namespace ts {
if (entries.length !== 0) {
entries.push({ value: "" });
}
entries.push({ value: `/* ${category} */` });
entries.push({ value: `/* ${getLocaleSpecificMessage(category)} */` });
for (const option of options) {
let optionName;
if (compilerOptionsMap.has(option.name)) {
+4 -2
View File
@@ -1937,8 +1937,10 @@ namespace ts {
return compareValues(a?.start, b?.start) || compareValues(a?.length, b?.length);
}
export function min<T>(a: T, b: T, compare: Comparer<T>): T {
return compare(a, b) === Comparison.LessThan ? a : b;
export function min<T>(items: readonly [T, ...T[]], compare: Comparer<T>): T;
export function min<T>(items: readonly T[], compare: Comparer<T>): T | undefined;
export function min<T>(items: readonly T[], compare: Comparer<T>): T | undefined {
return reduceLeft(items, (x, y) => compare(x, y) === Comparison.LessThan ? x : y);
}
/**
+1 -3
View File
@@ -17,13 +17,11 @@ namespace ts {
* Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator.
*/
export function createBaseNodeFactory(): BaseNodeFactory {
// tslint:disable variable-name
let NodeConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node;
let TokenConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node;
let IdentifierConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node;
let PrivateIdentifierConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node;
let SourceFileConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node;
// tslint:enable variable-name
return {
createBaseSourceFileNode,
@@ -53,4 +51,4 @@ namespace ts {
return new (NodeConstructor || (NodeConstructor = objectAllocator.getNodeConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
}
}
}
}
-3
View File
@@ -6407,11 +6407,9 @@ namespace ts {
rawTextScanner.setText("`" + rawText + "`");
break;
case SyntaxKind.TemplateHead:
// tslint:disable-next-line no-invalid-template-strings
rawTextScanner.setText("`" + rawText + "${");
break;
case SyntaxKind.TemplateMiddle:
// tslint:disable-next-line no-invalid-template-strings
rawTextScanner.setText("}" + rawText + "${");
break;
case SyntaxKind.TemplateTail:
@@ -6840,7 +6838,6 @@ namespace ts {
return node;
}
// tslint:disable-next-line variable-name
let SourceMapSource: new (fileName: string, text: string, skipTrivia?: (pos: number) => number) => SourceMapSource;
/**
+15 -8
View File
@@ -726,16 +726,23 @@ namespace ts.moduleSpecifiers {
}
function tryGetModuleNameFromRootDirs(rootDirs: readonly string[], moduleFileName: string, sourceDirectory: string, getCanonicalFileName: (file: string) => string, ending: Ending, compilerOptions: CompilerOptions): string | undefined {
const normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
if (normalizedTargetPath === undefined) {
const normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
if (normalizedTargetPaths === undefined) {
return undefined;
}
const normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
const relativePaths = flatMap(normalizedSourcePaths, sourcePath => {
return map(normalizedTargetPaths, targetPath => ensurePathIsNonModuleName(getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)));
});
const shortest = min(relativePaths, compareNumberOfDirectorySeparators);
if (!shortest) {
return undefined;
}
const normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
const relativePath = normalizedSourcePath !== undefined ? ensurePathIsNonModuleName(getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
return getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeJs
? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
: removeFileExtension(relativePath);
? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions)
: removeFileExtension(shortest);
}
function tryGetModuleNameAsNodeModule({ path, isRedirect }: ModulePath, { getCanonicalFileName, sourceDirectory }: Info, importingSourceFile: SourceFile , host: ModuleSpecifierResolutionHost, options: CompilerOptions, userPreferences: UserPreferences, packageNameOnly?: boolean, overrideMode?: ModuleKind.ESNext | ModuleKind.CommonJS): string | undefined {
@@ -882,8 +889,8 @@ namespace ts.moduleSpecifiers {
}
}
function getPathRelativeToRootDirs(path: string, rootDirs: readonly string[], getCanonicalFileName: GetCanonicalFileName): string | undefined {
return firstDefined(rootDirs, rootDir => {
function getPathsRelativeToRootDirs(path: string, rootDirs: readonly string[], getCanonicalFileName: GetCanonicalFileName): string[] | undefined {
return mapDefined(rootDirs, rootDir => {
const relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
});
-2
View File
@@ -1027,13 +1027,11 @@ namespace ts {
const disallowInAndDecoratorContext = NodeFlags.DisallowInContext | NodeFlags.DecoratorContext;
// capture constructors in 'initializeState' to avoid null checks
// tslint:disable variable-name
let NodeConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
let TokenConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
let IdentifierConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
let PrivateIdentifierConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
let SourceFileConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
// tslint:enable variable-name
function countNode(node: Node) {
nodeCount++;
+1 -1
View File
@@ -127,7 +127,7 @@ namespace ts {
const isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== CharacterCodes.slash;
if (isNonDirectorySeparatorRoot &&
dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths
pathPartForUserCheck.search(/[a-zA-z]\$\//) === 0) { // Dos style nextPart
pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { // Dos style nextPart
nextDirectorySeparator = dirPath.indexOf(directorySeparator, nextDirectorySeparator + 1);
if (nextDirectorySeparator === -1) {
// ignore "//vda1cs4850/c$/folderAtRoot"
+84 -7
View File
@@ -140,8 +140,11 @@ namespace ts {
return visitEachChild(node, visitor, context);
case SyntaxKind.GetAccessor:
return doWithContext(ContextFlags.NonTopLevel | ContextFlags.HasLexicalThis, visitGetAccessorDeclaration, node as GetAccessorDeclaration);
case SyntaxKind.SetAccessor:
return doWithContext(ContextFlags.NonTopLevel | ContextFlags.HasLexicalThis, visitSetAccessorDeclaration, node as SetAccessorDeclaration);
case SyntaxKind.Constructor:
return doWithContext(ContextFlags.NonTopLevel | ContextFlags.HasLexicalThis, visitConstructorDeclaration, node as ConstructorDeclaration);
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ClassExpression:
return doWithContext(ContextFlags.NonTopLevel | ContextFlags.HasLexicalThis, visitDefault, node);
@@ -278,6 +281,15 @@ namespace ts {
);
}
function visitConstructorDeclaration(node: ConstructorDeclaration) {
return factory.updateConstructorDeclaration(
node,
visitNodes(node.modifiers, visitor, isModifierLike),
visitParameterList(node.parameters, visitor, context),
transformMethodBody(node)
);
}
/**
* Visits a MethodDeclaration node.
*
@@ -298,7 +310,28 @@ namespace ts {
/*type*/ undefined,
getFunctionFlags(node) & FunctionFlags.Async
? transformAsyncFunctionBody(node)
: visitFunctionBody(node.body, visitor, context)
: transformMethodBody(node)
);
}
function visitGetAccessorDeclaration(node: GetAccessorDeclaration) {
return factory.updateGetAccessorDeclaration(
node,
visitNodes(node.modifiers, visitor, isModifierLike),
node.name,
visitParameterList(node.parameters, visitor, context),
/*type*/ undefined,
transformMethodBody(node)
);
}
function visitSetAccessorDeclaration(node: SetAccessorDeclaration) {
return factory.updateSetAccessorDeclaration(
node,
visitNodes(node.modifiers, visitor, isModifierLike),
node.name,
visitParameterList(node.parameters, visitor, context),
transformMethodBody(node)
);
}
@@ -446,6 +479,50 @@ namespace ts {
return false;
}
function transformMethodBody(node: MethodDeclaration | AccessorDeclaration | ConstructorDeclaration): FunctionBody | undefined {
Debug.assertIsDefined(node.body);
const savedCapturedSuperProperties = capturedSuperProperties;
const savedHasSuperElementAccess = hasSuperElementAccess;
capturedSuperProperties = new Set();
hasSuperElementAccess = false;
let updated = visitFunctionBody(node.body, visitor, context);
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
const originalMethod = getOriginalNode(node, isFunctionLikeDeclaration);
const emitSuperHelpers = languageVersion >= ScriptTarget.ES2015 &&
resolver.getNodeCheckFlags(node) & (NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync | NodeCheckFlags.MethodWithSuperPropertyAccessInAsync) &&
(getFunctionFlags(originalMethod) & FunctionFlags.AsyncGenerator) !== FunctionFlags.AsyncGenerator;
if (emitSuperHelpers) {
enableSubstitutionForAsyncMethodsWithSuper();
if (capturedSuperProperties.size) {
const variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
substitutedSuperAccessors[getNodeId(variableStatement)] = true;
const statements = updated.statements.slice();
insertStatementsAfterStandardPrologue(statements, [variableStatement]);
updated = factory.updateBlock(updated, statements);
}
if (hasSuperElementAccess) {
// Emit helpers for super element access expressions (`super[x]`).
if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync) {
addEmitHelper(updated, advancedAsyncSuperHelper);
}
else if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.MethodWithSuperPropertyAccessInAsync) {
addEmitHelper(updated, asyncSuperHelper);
}
}
}
capturedSuperProperties = savedCapturedSuperProperties;
hasSuperElementAccess = savedHasSuperElementAccess;
return updated;
}
function transformAsyncFunctionBody(node: MethodDeclaration | AccessorDeclaration | FunctionDeclaration | FunctionExpression): FunctionBody;
function transformAsyncFunctionBody(node: ArrowFunction): ConciseBody;
function transformAsyncFunctionBody(node: FunctionLikeDeclaration): ConciseBody {
@@ -495,7 +572,7 @@ namespace ts {
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
const emitSuperHelpers = languageVersion >= ScriptTarget.ES2015 && resolver.getNodeCheckFlags(node) & (NodeCheckFlags.AsyncMethodWithSuperBinding | NodeCheckFlags.AsyncMethodWithSuper);
const emitSuperHelpers = languageVersion >= ScriptTarget.ES2015 && resolver.getNodeCheckFlags(node) & (NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync | NodeCheckFlags.MethodWithSuperPropertyAccessInAsync);
if (emitSuperHelpers) {
enableSubstitutionForAsyncMethodsWithSuper();
@@ -511,10 +588,10 @@ namespace ts {
if (emitSuperHelpers && hasSuperElementAccess) {
// Emit helpers for super element access expressions (`super[x]`).
if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuperBinding) {
if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync) {
addEmitHelper(block, advancedAsyncSuperHelper);
}
else if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuper) {
else if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.MethodWithSuperPropertyAccessInAsync) {
addEmitHelper(block, asyncSuperHelper);
}
}
@@ -601,7 +678,7 @@ namespace ts {
// If we need to support substitutions for `super` in an async method,
// we should track it here.
if (enabledSubstitutions & ES2017SubstitutionFlags.AsyncMethodsWithSuper && isSuperContainer(node)) {
const superContainerFlags = resolver.getNodeCheckFlags(node) & (NodeCheckFlags.AsyncMethodWithSuper | NodeCheckFlags.AsyncMethodWithSuperBinding);
const superContainerFlags = resolver.getNodeCheckFlags(node) & (NodeCheckFlags.MethodWithSuperPropertyAccessInAsync | NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync);
if (superContainerFlags !== enclosingSuperContainerFlags) {
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
enclosingSuperContainerFlags = superContainerFlags;
@@ -698,7 +775,7 @@ namespace ts {
}
function createSuperElementAccessInAsyncMethod(argumentExpression: Expression, location: TextRange): LeftHandSideExpression {
if (enclosingSuperContainerFlags & NodeCheckFlags.AsyncMethodWithSuperBinding) {
if (enclosingSuperContainerFlags & NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync) {
return setTextRange(
factory.createPropertyAccessExpression(
factory.createCallExpression(
@@ -728,7 +805,7 @@ namespace ts {
export function createSuperAccessVariableStatement(factory: NodeFactory, resolver: EmitResolver, node: FunctionLikeDeclaration, names: Set<__String>) {
// Create a variable declaration with a getter/setter (if binding) definition for each name:
// const _super = Object.create(null, { x: { get: () => super.x, set: (v) => super.x = v }, ... });
const hasBinding = (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuperBinding) !== 0;
const hasBinding = (resolver.getNodeCheckFlags(node) & NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync) !== 0;
const accessors: PropertyAssignment[] = [];
names.forEach((_, key) => {
const name = unescapeLeadingUnderscores(key);
+5 -5
View File
@@ -1013,7 +1013,7 @@ namespace ts {
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
const emitSuperHelpers = languageVersion >= ScriptTarget.ES2015 && resolver.getNodeCheckFlags(node) & (NodeCheckFlags.AsyncMethodWithSuperBinding | NodeCheckFlags.AsyncMethodWithSuper);
const emitSuperHelpers = languageVersion >= ScriptTarget.ES2015 && resolver.getNodeCheckFlags(node) & (NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync | NodeCheckFlags.MethodWithSuperPropertyAccessInAsync);
if (emitSuperHelpers) {
enableSubstitutionForAsyncMethodsWithSuper();
@@ -1028,10 +1028,10 @@ namespace ts {
const block = factory.updateBlock(node.body!, statements);
if (emitSuperHelpers && hasSuperElementAccess) {
if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuperBinding) {
if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync) {
addEmitHelper(block, advancedAsyncSuperHelper);
}
else if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuper) {
else if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.MethodWithSuperPropertyAccessInAsync) {
addEmitHelper(block, asyncSuperHelper);
}
}
@@ -1185,7 +1185,7 @@ namespace ts {
// If we need to support substitutions for `super` in an async method,
// we should track it here.
if (enabledSubstitutions & ESNextSubstitutionFlags.AsyncMethodsWithSuper && isSuperContainer(node)) {
const superContainerFlags = resolver.getNodeCheckFlags(node) & (NodeCheckFlags.AsyncMethodWithSuper | NodeCheckFlags.AsyncMethodWithSuperBinding);
const superContainerFlags = resolver.getNodeCheckFlags(node) & (NodeCheckFlags.MethodWithSuperPropertyAccessInAsync | NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync);
if (superContainerFlags !== enclosingSuperContainerFlags) {
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
enclosingSuperContainerFlags = superContainerFlags;
@@ -1282,7 +1282,7 @@ namespace ts {
}
function createSuperElementAccessInAsyncMethod(argumentExpression: Expression, location: TextRange): LeftHandSideExpression {
if (enclosingSuperContainerFlags & NodeCheckFlags.AsyncMethodWithSuperBinding) {
if (enclosingSuperContainerFlags & NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync) {
return setTextRange(
factory.createPropertyAccessExpression(
factory.createCallExpression(
+22 -16
View File
@@ -721,7 +721,7 @@ namespace ts {
return createImportCallExpressionUMD(argument ?? factory.createVoidZero(), containsLexicalThis);
case ModuleKind.CommonJS:
default:
return createImportCallExpressionCommonJS(argument, containsLexicalThis);
return createImportCallExpressionCommonJS(argument);
}
}
@@ -745,7 +745,7 @@ namespace ts {
return factory.createConditionalExpression(
/*condition*/ factory.createIdentifier("__syncRequire"),
/*questionToken*/ undefined,
/*whenTrue*/ createImportCallExpressionCommonJS(arg, containsLexicalThis),
/*whenTrue*/ createImportCallExpressionCommonJS(arg),
/*colonToken*/ undefined,
/*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis)
);
@@ -755,7 +755,7 @@ namespace ts {
return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(
/*condition*/ factory.createIdentifier("__syncRequire"),
/*questionToken*/ undefined,
/*whenTrue*/ createImportCallExpressionCommonJS(temp, containsLexicalThis),
/*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true),
/*colonToken*/ undefined,
/*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis)
));
@@ -820,14 +820,25 @@ namespace ts {
return promise;
}
function createImportCallExpressionCommonJS(arg: Expression | undefined, containsLexicalThis: boolean): Expression {
// import("./blah")
function createImportCallExpressionCommonJS(arg: Expression | undefined, isInlineable?: boolean): Expression {
// import(x)
// emit as
// Promise.resolve().then(function () { return require(x); }) /*CommonJs Require*/
// var _a;
// (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/
// We have to wrap require in then callback so that require is done in asynchronously
// if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately
const promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []);
let requireCall: Expression = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
// If the arg is not inlineable, we have to evaluate it in the current scope with a temp var
const temp = arg && !isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined;
const promiseResolveCall = factory.createCallExpression(
factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"),
/*typeArguments*/ undefined,
/*argumentsArray*/ [],
);
let requireCall: Expression = factory.createCallExpression(
factory.createIdentifier("require"),
/*typeArguments*/ undefined,
temp ? [temp] : arg ? [arg] : [],
);
if (getESModuleInterop(compilerOptions)) {
requireCall = emitHelpers().createImportStarHelper(requireCall);
}
@@ -851,16 +862,11 @@ namespace ts {
/*parameters*/ [],
/*type*/ undefined,
factory.createBlock([factory.createReturnStatement(requireCall)]));
// if there is a lexical 'this' in the import call arguments, ensure we indicate
// that this new function expression indicates it captures 'this' so that the
// es2015 transformer will properly substitute 'this' with '_this'.
if (containsLexicalThis) {
setEmitFlags(func, EmitFlags.CapturesThis);
}
}
return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
const downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg!), downleveledImport]);
}
function getHelperExpressionForExport(node: ExportDeclaration, innerExpr: Expression) {
+2 -2
View File
@@ -5527,8 +5527,8 @@ namespace ts {
SuperInstance = 0x00000100, // Instance 'super' reference
SuperStatic = 0x00000200, // Static 'super' reference
ContextChecked = 0x00000400, // Contextual types have been assigned
AsyncMethodWithSuper = 0x00000800, // An async method that reads a value from a member of 'super'.
AsyncMethodWithSuperBinding = 0x00001000, // An async method that assigns a value to a member of 'super'.
MethodWithSuperPropertyAccessInAsync = 0x00000800, // A method that contains a SuperProperty access in an async context.
MethodWithSuperPropertyAssignmentInAsync = 0x00001000, // A method that contains a SuperProperty assignment in an async context.
CaptureArguments = 0x00002000, // Lexical 'arguments' used in body
EnumValuesComputed = 0x00004000, // Values for enum members have been computed, and any errors have been reported for them.
LexicalModuleMergesWithClass = 0x00008000, // Instantiated lexical module declaration is merged with a previous class declaration.
+3 -2
View File
@@ -764,7 +764,7 @@ namespace ts.Completions {
if (preferences.includeCompletionsWithClassMemberSnippets &&
preferences.includeCompletionsWithInsertText &&
completionKind === CompletionKind.MemberLike &&
isClassLikeMemberCompletion(symbol, location)) {
isClassLikeMemberCompletion(symbol, location, sourceFile)) {
let importAdder;
({ insertText, isSnippet, importAdder, replacementSpan } = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext));
sortText = SortText.ClassMemberSnippets; // sortText has to be lower priority than the sortText for keywords. See #47852.
@@ -846,7 +846,7 @@ namespace ts.Completions {
};
}
function isClassLikeMemberCompletion(symbol: Symbol, location: Node): boolean {
function isClassLikeMemberCompletion(symbol: Symbol, location: Node, sourceFile: SourceFile): boolean {
// TODO: support JS files.
if (isInJSFile(location)) {
return false;
@@ -884,6 +884,7 @@ namespace ts.Completions {
location.parent.parent &&
isClassElement(location.parent) &&
location === location.parent.name &&
location.parent.getLastToken(sourceFile) === location.parent.name &&
isClassLike(location.parent.parent)
) ||
(
+6
View File
@@ -26,6 +26,12 @@ namespace ts.GoToDefinition {
return label ? [createDefinitionInfoFromName(typeChecker, label, ScriptElementKind.label, node.text, /*containerName*/ undefined!)] : undefined; // TODO: GH#18217
}
if (node.kind === SyntaxKind.ReturnKeyword) {
const functionDeclaration = findAncestor(node.parent, n =>
isClassStaticBlockDeclaration(n) ? "quit" : isFunctionLikeDeclaration(n)) as FunctionLikeDeclaration | undefined;
return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : undefined;
}
if (isStaticModifier(node) && isClassStaticBlockDeclaration(node.parent)) {
const classDecl = node.parent.parent;
const { symbol, failedAliasResolution } = getSymbol(classDecl, typeChecker, stopAtAlias);
+8 -2
View File
@@ -439,12 +439,18 @@ namespace ts.JsDoc {
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.PropertySignature:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.EnumMember:
case SyntaxKind.TypeAliasDeclaration:
return { commentOwner };
case SyntaxKind.PropertySignature: {
const host = commentOwner as PropertySignature;
return host.type && isFunctionTypeNode(host.type)
? { commentOwner, parameters: host.type.parameters, hasReturn: hasReturn(host.type, options) }
: { commentOwner };
}
case SyntaxKind.VariableStatement: {
const varStatement = commentOwner as VariableStatement;
const varDeclarations = varStatement.declarationList.declarations;
@@ -486,7 +492,7 @@ namespace ts.JsDoc {
function hasReturn(node: Node, options: DocCommentTemplateOptions | undefined) {
return !!options?.generateReturnInDocTemplate &&
(isArrowFunction(node) && isExpression(node.body)
(isFunctionTypeNode(node) || isArrowFunction(node) && isExpression(node.body)
|| isFunctionLikeDeclaration(node) && node.body && isBlock(node.body) && !!forEachReturnStatement(node.body, n => n));
}
+1 -1
View File
@@ -259,7 +259,7 @@ namespace ts {
}
function betterMatch(a: PatternMatch | undefined, b: PatternMatch | undefined): PatternMatch | undefined {
return min(a, b, compareMatches);
return min([a, b], compareMatches);
}
function compareMatches(a: PatternMatch | undefined, b: PatternMatch | undefined): Comparison {
return a === undefined ? Comparison.GreaterThan : b === undefined ? Comparison.LessThan
@@ -0,0 +1,11 @@
//// [asyncFunctionReturnType.2.ts]
// https://github.com/microsoft/TypeScript/issues/47291
class X {
f = async (): Promise<this> => this;
}
//// [asyncFunctionReturnType.2.js]
// https://github.com/microsoft/TypeScript/issues/47291
class X {
f = async () => this;
}
@@ -0,0 +1,10 @@
=== tests/cases/compiler/asyncFunctionReturnType.2.ts ===
// https://github.com/microsoft/TypeScript/issues/47291
class X {
>X : Symbol(X, Decl(asyncFunctionReturnType.2.ts, 0, 0))
f = async (): Promise<this> => this;
>f : Symbol(X.f, Decl(asyncFunctionReturnType.2.ts, 1, 9))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
>this : Symbol(X, Decl(asyncFunctionReturnType.2.ts, 0, 0))
}
@@ -0,0 +1,10 @@
=== tests/cases/compiler/asyncFunctionReturnType.2.ts ===
// https://github.com/microsoft/TypeScript/issues/47291
class X {
>X : X
f = async (): Promise<this> => this;
>f : () => Promise<this>
>async (): Promise<this> => this : () => Promise<this>
>this : this
}
@@ -46,12 +46,13 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
function foo() {
return __asyncGenerator(this, arguments, function foo_1() {
return __generator(this, function (_a) {
var _b, _c;
switch (_a.label) {
case 0: return [4 /*yield*/, __await("foo")];
case 1: return [4 /*yield*/, _a.sent()];
case 2: return [4 /*yield*/, __await.apply(void 0, [Promise.resolve().then(function () { return require(_a.sent()); })])];
case 2: return [4 /*yield*/, __await.apply(void 0, [(_b = _a.sent(), Promise.resolve().then(function () { return require(_b); }))])];
case 3:
Promise.resolve().then(function () { return require((_a.sent())["default"]); });
_c = (_a.sent())["default"], Promise.resolve().then(function () { return require(_c); });
return [2 /*return*/];
}
});
@@ -185,6 +185,32 @@ class B extends A {
(async () => super["x"] = f);
}
}
// https://github.com/microsoft/TypeScript/issues/46828
class Base {
set setter(x: any) {}
get getter(): any { return; }
method(x: string): any {}
static set setter(x: any) {}
static get getter(): any { return; }
static method(x: string): any {}
}
class Derived extends Base {
a() { return async () => super.method('') }
b() { return async () => super.getter }
c() { return async () => super.setter = '' }
d() { return async () => super["method"]('') }
e() { return async () => super["getter"] }
f() { return async () => super["setter"] = '' }
static a() { return async () => super.method('') }
static b() { return async () => super.getter }
static c() { return async () => super.setter = '' }
static d() { return async () => super["method"]('') }
static e() { return async () => super["getter"] }
static f() { return async () => super["setter"] = '' }
}
//// [asyncMethodWithSuper_es6.js]
@@ -377,3 +403,62 @@ class B extends A {
});
}
}
// https://github.com/microsoft/TypeScript/issues/46828
class Base {
set setter(x) { }
get getter() { return; }
method(x) { }
static set setter(x) { }
static get getter() { return; }
static method(x) { }
}
class Derived extends Base {
a() { const _super = Object.create(null, {
method: { get: () => super.method }
}); return () => __awaiter(this, void 0, void 0, function* () { return _super.method.call(this, ''); }); }
b() { const _super = Object.create(null, {
getter: { get: () => super.getter }
}); return () => __awaiter(this, void 0, void 0, function* () { return _super.getter; }); }
c() { const _super = Object.create(null, {
setter: { get: () => super.setter, set: v => super.setter = v }
}); return () => __awaiter(this, void 0, void 0, function* () { return _super.setter = ''; }); }
d() {
const _superIndex = name => super[name];
return () => __awaiter(this, void 0, void 0, function* () { return _superIndex("method").call(this, ''); });
}
e() {
const _superIndex = name => super[name];
return () => __awaiter(this, void 0, void 0, function* () { return _superIndex("getter"); });
}
f() {
const _superIndex = (function (geti, seti) {
const cache = Object.create(null);
return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });
})(name => super[name], (name, value) => super[name] = value);
return () => __awaiter(this, void 0, void 0, function* () { return _superIndex("setter").value = ''; });
}
static a() { const _super = Object.create(null, {
method: { get: () => super.method }
}); return () => __awaiter(this, void 0, void 0, function* () { return _super.method.call(this, ''); }); }
static b() { const _super = Object.create(null, {
getter: { get: () => super.getter }
}); return () => __awaiter(this, void 0, void 0, function* () { return _super.getter; }); }
static c() { const _super = Object.create(null, {
setter: { get: () => super.setter, set: v => super.setter = v }
}); return () => __awaiter(this, void 0, void 0, function* () { return _super.setter = ''; }); }
static d() {
const _superIndex = name => super[name];
return () => __awaiter(this, void 0, void 0, function* () { return _superIndex("method").call(this, ''); });
}
static e() {
const _superIndex = name => super[name];
return () => __awaiter(this, void 0, void 0, function* () { return _superIndex("getter"); });
}
static f() {
const _superIndex = (function (geti, seti) {
const cache = Object.create(null);
return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });
})(name => super[name], (name, value) => super[name] = value);
return () => __awaiter(this, void 0, void 0, function* () { return _superIndex("setter").value = ''; });
}
}
@@ -376,3 +376,101 @@ class B extends A {
}
}
// https://github.com/microsoft/TypeScript/issues/46828
class Base {
>Base : Symbol(Base, Decl(asyncMethodWithSuper_es6.ts, 185, 1))
set setter(x: any) {}
>setter : Symbol(Base.setter, Decl(asyncMethodWithSuper_es6.ts, 188, 12))
>x : Symbol(x, Decl(asyncMethodWithSuper_es6.ts, 189, 15))
get getter(): any { return; }
>getter : Symbol(Base.getter, Decl(asyncMethodWithSuper_es6.ts, 189, 25))
method(x: string): any {}
>method : Symbol(Base.method, Decl(asyncMethodWithSuper_es6.ts, 190, 33))
>x : Symbol(x, Decl(asyncMethodWithSuper_es6.ts, 191, 11))
static set setter(x: any) {}
>setter : Symbol(Base.setter, Decl(asyncMethodWithSuper_es6.ts, 191, 29))
>x : Symbol(x, Decl(asyncMethodWithSuper_es6.ts, 193, 22))
static get getter(): any { return; }
>getter : Symbol(Base.getter, Decl(asyncMethodWithSuper_es6.ts, 193, 32))
static method(x: string): any {}
>method : Symbol(Base.method, Decl(asyncMethodWithSuper_es6.ts, 194, 40))
>x : Symbol(x, Decl(asyncMethodWithSuper_es6.ts, 195, 18))
}
class Derived extends Base {
>Derived : Symbol(Derived, Decl(asyncMethodWithSuper_es6.ts, 196, 1))
>Base : Symbol(Base, Decl(asyncMethodWithSuper_es6.ts, 185, 1))
a() { return async () => super.method('') }
>a : Symbol(Derived.a, Decl(asyncMethodWithSuper_es6.ts, 198, 28))
>super.method : Symbol(Base.method, Decl(asyncMethodWithSuper_es6.ts, 190, 33))
>super : Symbol(Base, Decl(asyncMethodWithSuper_es6.ts, 185, 1))
>method : Symbol(Base.method, Decl(asyncMethodWithSuper_es6.ts, 190, 33))
b() { return async () => super.getter }
>b : Symbol(Derived.b, Decl(asyncMethodWithSuper_es6.ts, 199, 47))
>super.getter : Symbol(Base.getter, Decl(asyncMethodWithSuper_es6.ts, 189, 25))
>super : Symbol(Base, Decl(asyncMethodWithSuper_es6.ts, 185, 1))
>getter : Symbol(Base.getter, Decl(asyncMethodWithSuper_es6.ts, 189, 25))
c() { return async () => super.setter = '' }
>c : Symbol(Derived.c, Decl(asyncMethodWithSuper_es6.ts, 200, 43))
>super.setter : Symbol(Base.setter, Decl(asyncMethodWithSuper_es6.ts, 188, 12))
>super : Symbol(Base, Decl(asyncMethodWithSuper_es6.ts, 185, 1))
>setter : Symbol(Base.setter, Decl(asyncMethodWithSuper_es6.ts, 188, 12))
d() { return async () => super["method"]('') }
>d : Symbol(Derived.d, Decl(asyncMethodWithSuper_es6.ts, 201, 48))
>super : Symbol(Base, Decl(asyncMethodWithSuper_es6.ts, 185, 1))
>"method" : Symbol(Base.method, Decl(asyncMethodWithSuper_es6.ts, 190, 33))
e() { return async () => super["getter"] }
>e : Symbol(Derived.e, Decl(asyncMethodWithSuper_es6.ts, 202, 50))
>super : Symbol(Base, Decl(asyncMethodWithSuper_es6.ts, 185, 1))
>"getter" : Symbol(Base.getter, Decl(asyncMethodWithSuper_es6.ts, 189, 25))
f() { return async () => super["setter"] = '' }
>f : Symbol(Derived.f, Decl(asyncMethodWithSuper_es6.ts, 203, 46))
>super : Symbol(Base, Decl(asyncMethodWithSuper_es6.ts, 185, 1))
>"setter" : Symbol(Base.setter, Decl(asyncMethodWithSuper_es6.ts, 188, 12))
static a() { return async () => super.method('') }
>a : Symbol(Derived.a, Decl(asyncMethodWithSuper_es6.ts, 204, 51))
>super.method : Symbol(Base.method, Decl(asyncMethodWithSuper_es6.ts, 194, 40))
>super : Symbol(Base, Decl(asyncMethodWithSuper_es6.ts, 185, 1))
>method : Symbol(Base.method, Decl(asyncMethodWithSuper_es6.ts, 194, 40))
static b() { return async () => super.getter }
>b : Symbol(Derived.b, Decl(asyncMethodWithSuper_es6.ts, 205, 54))
>super.getter : Symbol(Base.getter, Decl(asyncMethodWithSuper_es6.ts, 193, 32))
>super : Symbol(Base, Decl(asyncMethodWithSuper_es6.ts, 185, 1))
>getter : Symbol(Base.getter, Decl(asyncMethodWithSuper_es6.ts, 193, 32))
static c() { return async () => super.setter = '' }
>c : Symbol(Derived.c, Decl(asyncMethodWithSuper_es6.ts, 206, 50))
>super.setter : Symbol(Base.setter, Decl(asyncMethodWithSuper_es6.ts, 191, 29))
>super : Symbol(Base, Decl(asyncMethodWithSuper_es6.ts, 185, 1))
>setter : Symbol(Base.setter, Decl(asyncMethodWithSuper_es6.ts, 191, 29))
static d() { return async () => super["method"]('') }
>d : Symbol(Derived.d, Decl(asyncMethodWithSuper_es6.ts, 207, 55))
>super : Symbol(Base, Decl(asyncMethodWithSuper_es6.ts, 185, 1))
>"method" : Symbol(Base.method, Decl(asyncMethodWithSuper_es6.ts, 194, 40))
static e() { return async () => super["getter"] }
>e : Symbol(Derived.e, Decl(asyncMethodWithSuper_es6.ts, 208, 57))
>super : Symbol(Base, Decl(asyncMethodWithSuper_es6.ts, 185, 1))
>"getter" : Symbol(Base.getter, Decl(asyncMethodWithSuper_es6.ts, 193, 32))
static f() { return async () => super["setter"] = '' }
>f : Symbol(Derived.f, Decl(asyncMethodWithSuper_es6.ts, 209, 53))
>super : Symbol(Base, Decl(asyncMethodWithSuper_es6.ts, 185, 1))
>"setter" : Symbol(Base.setter, Decl(asyncMethodWithSuper_es6.ts, 191, 29))
}
@@ -504,3 +504,135 @@ class B extends A {
}
}
// https://github.com/microsoft/TypeScript/issues/46828
class Base {
>Base : Base
set setter(x: any) {}
>setter : any
>x : any
get getter(): any { return; }
>getter : any
method(x: string): any {}
>method : (x: string) => any
>x : string
static set setter(x: any) {}
>setter : any
>x : any
static get getter(): any { return; }
>getter : any
static method(x: string): any {}
>method : (x: string) => any
>x : string
}
class Derived extends Base {
>Derived : Derived
>Base : Base
a() { return async () => super.method('') }
>a : () => () => Promise<any>
>async () => super.method('') : () => Promise<any>
>super.method('') : any
>super.method : (x: string) => any
>super : Base
>method : (x: string) => any
>'' : ""
b() { return async () => super.getter }
>b : () => () => Promise<any>
>async () => super.getter : () => Promise<any>
>super.getter : any
>super : Base
>getter : any
c() { return async () => super.setter = '' }
>c : () => () => Promise<string>
>async () => super.setter = '' : () => Promise<string>
>super.setter = '' : ""
>super.setter : any
>super : Base
>setter : any
>'' : ""
d() { return async () => super["method"]('') }
>d : () => () => Promise<any>
>async () => super["method"]('') : () => Promise<any>
>super["method"]('') : any
>super["method"] : (x: string) => any
>super : Base
>"method" : "method"
>'' : ""
e() { return async () => super["getter"] }
>e : () => () => Promise<any>
>async () => super["getter"] : () => Promise<any>
>super["getter"] : any
>super : Base
>"getter" : "getter"
f() { return async () => super["setter"] = '' }
>f : () => () => Promise<string>
>async () => super["setter"] = '' : () => Promise<string>
>super["setter"] = '' : ""
>super["setter"] : any
>super : Base
>"setter" : "setter"
>'' : ""
static a() { return async () => super.method('') }
>a : () => () => Promise<any>
>async () => super.method('') : () => Promise<any>
>super.method('') : any
>super.method : (x: string) => any
>super : typeof Base
>method : (x: string) => any
>'' : ""
static b() { return async () => super.getter }
>b : () => () => Promise<any>
>async () => super.getter : () => Promise<any>
>super.getter : any
>super : typeof Base
>getter : any
static c() { return async () => super.setter = '' }
>c : () => () => Promise<string>
>async () => super.setter = '' : () => Promise<string>
>super.setter = '' : ""
>super.setter : any
>super : typeof Base
>setter : any
>'' : ""
static d() { return async () => super["method"]('') }
>d : () => () => Promise<any>
>async () => super["method"]('') : () => Promise<any>
>super["method"]('') : any
>super["method"] : (x: string) => any
>super : typeof Base
>"method" : "method"
>'' : ""
static e() { return async () => super["getter"] }
>e : () => () => Promise<any>
>async () => super["getter"] : () => Promise<any>
>super["getter"] : any
>super : typeof Base
>"getter" : "getter"
static f() { return async () => super["setter"] = '' }
>f : () => () => Promise<string>
>async () => super["setter"] = '' : () => Promise<string>
>super["setter"] = '' : ""
>super["setter"] : any
>super : typeof Base
>"setter" : "setter"
>'' : ""
}
@@ -0,0 +1,39 @@
tests/cases/compiler/controlFlowDestructuringVariablesInTryCatch.ts(16,1): error TS2454: Variable 'a' is used before being assigned.
tests/cases/compiler/controlFlowDestructuringVariablesInTryCatch.ts(17,1): error TS2454: Variable 'b' is used before being assigned.
tests/cases/compiler/controlFlowDestructuringVariablesInTryCatch.ts(18,1): error TS2454: Variable 'c' is used before being assigned.
tests/cases/compiler/controlFlowDestructuringVariablesInTryCatch.ts(19,1): error TS2454: Variable 'd' is used before being assigned.
tests/cases/compiler/controlFlowDestructuringVariablesInTryCatch.ts(20,1): error TS2454: Variable 'e' is used before being assigned.
==== tests/cases/compiler/controlFlowDestructuringVariablesInTryCatch.ts (5 errors) ====
declare function f1(): string;
declare function f2(): [b: string];
declare function f3(): { c: string };
try {
var a = f1();
var [b] = f2();
var { c } = f3();
var [d = 1] = [];
var { e = 1 } = { };
} catch {
console.error("error");
}
a;
~
!!! error TS2454: Variable 'a' is used before being assigned.
b;
~
!!! error TS2454: Variable 'b' is used before being assigned.
c;
~
!!! error TS2454: Variable 'c' is used before being assigned.
d;
~
!!! error TS2454: Variable 'd' is used before being assigned.
e;
~
!!! error TS2454: Variable 'e' is used before being assigned.
@@ -0,0 +1,40 @@
//// [controlFlowDestructuringVariablesInTryCatch.ts]
declare function f1(): string;
declare function f2(): [b: string];
declare function f3(): { c: string };
try {
var a = f1();
var [b] = f2();
var { c } = f3();
var [d = 1] = [];
var { e = 1 } = { };
} catch {
console.error("error");
}
a;
b;
c;
d;
e;
//// [controlFlowDestructuringVariablesInTryCatch.js]
"use strict";
try {
var a = f1();
var b = f2()[0];
var c = f3().c;
var _a = [][0], d = _a === void 0 ? 1 : _a;
var _b = {}.e, e = _b === void 0 ? 1 : _b;
}
catch (_c) {
console.error("error");
}
a;
b;
c;
d;
e;
@@ -0,0 +1,52 @@
=== tests/cases/compiler/controlFlowDestructuringVariablesInTryCatch.ts ===
declare function f1(): string;
>f1 : Symbol(f1, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 0, 0))
declare function f2(): [b: string];
>f2 : Symbol(f2, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 0, 30))
declare function f3(): { c: string };
>f3 : Symbol(f3, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 1, 35))
>c : Symbol(c, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 2, 24))
try {
var a = f1();
>a : Symbol(a, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 5, 7))
>f1 : Symbol(f1, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 0, 0))
var [b] = f2();
>b : Symbol(b, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 6, 9))
>f2 : Symbol(f2, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 0, 30))
var { c } = f3();
>c : Symbol(c, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 7, 9))
>f3 : Symbol(f3, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 1, 35))
var [d = 1] = [];
>d : Symbol(d, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 9, 9))
var { e = 1 } = { };
>e : Symbol(e, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 10, 9))
} catch {
console.error("error");
>console.error : Symbol(Console.error, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>error : Symbol(Console.error, Decl(lib.dom.d.ts, --, --))
}
a;
>a : Symbol(a, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 5, 7))
b;
>b : Symbol(b, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 6, 9))
c;
>c : Symbol(c, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 7, 9))
d;
>d : Symbol(d, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 9, 9))
e;
>e : Symbol(e, Decl(controlFlowDestructuringVariablesInTryCatch.ts, 10, 9))
@@ -0,0 +1,61 @@
=== tests/cases/compiler/controlFlowDestructuringVariablesInTryCatch.ts ===
declare function f1(): string;
>f1 : () => string
declare function f2(): [b: string];
>f2 : () => [b: string]
declare function f3(): { c: string };
>f3 : () => { c: string; }
>c : string
try {
var a = f1();
>a : string
>f1() : string
>f1 : () => string
var [b] = f2();
>b : string
>f2() : [b: string]
>f2 : () => [b: string]
var { c } = f3();
>c : string
>f3() : { c: string; }
>f3 : () => { c: string; }
var [d = 1] = [];
>d : number
>1 : 1
>[] : []
var { e = 1 } = { };
>e : number
>1 : 1
>{ } : { e?: number | undefined; }
} catch {
console.error("error");
>console.error("error") : void
>console.error : (...data: any[]) => void
>console : Console
>error : (...data: any[]) => void
>"error" : "error"
}
a;
>a : string
b;
>b : string
c;
>c : string
d;
>d : number
e;
>e : number
@@ -0,0 +1,11 @@
//// [controlFlowInitializedDestructuringVariables.ts]
declare const obj: { a?: string, b?: number };
const {
a = "0",
b = +a,
} = obj;
//// [controlFlowInitializedDestructuringVariables.js]
"use strict";
var _a = obj.a, a = _a === void 0 ? "0" : _a, _b = obj.b, b = _b === void 0 ? +a : _b;
@@ -0,0 +1,17 @@
=== tests/cases/compiler/controlFlowInitializedDestructuringVariables.ts ===
declare const obj: { a?: string, b?: number };
>obj : Symbol(obj, Decl(controlFlowInitializedDestructuringVariables.ts, 0, 13))
>a : Symbol(a, Decl(controlFlowInitializedDestructuringVariables.ts, 0, 20))
>b : Symbol(b, Decl(controlFlowInitializedDestructuringVariables.ts, 0, 32))
const {
a = "0",
>a : Symbol(a, Decl(controlFlowInitializedDestructuringVariables.ts, 1, 7))
b = +a,
>b : Symbol(b, Decl(controlFlowInitializedDestructuringVariables.ts, 2, 12))
>a : Symbol(a, Decl(controlFlowInitializedDestructuringVariables.ts, 1, 7))
} = obj;
>obj : Symbol(obj, Decl(controlFlowInitializedDestructuringVariables.ts, 0, 13))
@@ -0,0 +1,19 @@
=== tests/cases/compiler/controlFlowInitializedDestructuringVariables.ts ===
declare const obj: { a?: string, b?: number };
>obj : { a?: string | undefined; b?: number | undefined; }
>a : string | undefined
>b : number | undefined
const {
a = "0",
>a : string
>"0" : "0"
b = +a,
>b : number
>+a : number
>a : string
} = obj;
>obj : { a?: string | undefined; b?: number | undefined; }
@@ -0,0 +1,31 @@
//// [dynamicImportEvaluateSpecifier.ts]
// https://github.com/microsoft/TypeScript/issues/48285
let i = 0;
import(String(i++));
import(String(i++));
const getPath = async () => {
/* in reality this would do some async FS operation, or a web request */
return "/root/my/cool/path";
};
const someFunction = async () => {
const result = await import(await getPath());
};
//// [dynamicImportEvaluateSpecifier.js]
var _a, _b;
// https://github.com/microsoft/TypeScript/issues/48285
let i = 0;
_a = String(i++), Promise.resolve().then(() => require(_a));
_b = String(i++), Promise.resolve().then(() => require(_b));
const getPath = async () => {
/* in reality this would do some async FS operation, or a web request */
return "/root/my/cool/path";
};
const someFunction = async () => {
var _a;
const result = await (_a = await getPath(), Promise.resolve().then(() => require(_a)));
};
@@ -0,0 +1,29 @@
=== tests/cases/compiler/dynamicImportEvaluateSpecifier.ts ===
// https://github.com/microsoft/TypeScript/issues/48285
let i = 0;
>i : Symbol(i, Decl(dynamicImportEvaluateSpecifier.ts, 1, 3))
import(String(i++));
>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 3 more)
>i : Symbol(i, Decl(dynamicImportEvaluateSpecifier.ts, 1, 3))
import(String(i++));
>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 3 more)
>i : Symbol(i, Decl(dynamicImportEvaluateSpecifier.ts, 1, 3))
const getPath = async () => {
>getPath : Symbol(getPath, Decl(dynamicImportEvaluateSpecifier.ts, 6, 5))
/* in reality this would do some async FS operation, or a web request */
return "/root/my/cool/path";
};
const someFunction = async () => {
>someFunction : Symbol(someFunction, Decl(dynamicImportEvaluateSpecifier.ts, 11, 5))
const result = await import(await getPath());
>result : Symbol(result, Decl(dynamicImportEvaluateSpecifier.ts, 12, 6))
>getPath : Symbol(getPath, Decl(dynamicImportEvaluateSpecifier.ts, 6, 5))
};
@@ -0,0 +1,44 @@
=== tests/cases/compiler/dynamicImportEvaluateSpecifier.ts ===
// https://github.com/microsoft/TypeScript/issues/48285
let i = 0;
>i : number
>0 : 0
import(String(i++));
>import(String(i++)) : Promise<any>
>String(i++) : string
>String : StringConstructor
>i++ : number
>i : number
import(String(i++));
>import(String(i++)) : Promise<any>
>String(i++) : string
>String : StringConstructor
>i++ : number
>i : number
const getPath = async () => {
>getPath : () => Promise<string>
>async () => { /* in reality this would do some async FS operation, or a web request */ return "/root/my/cool/path";} : () => Promise<string>
/* in reality this would do some async FS operation, or a web request */
return "/root/my/cool/path";
>"/root/my/cool/path" : "/root/my/cool/path"
};
const someFunction = async () => {
>someFunction : () => Promise<void>
>async () => { const result = await import(await getPath());} : () => Promise<void>
const result = await import(await getPath());
>result : any
>await import(await getPath()) : any
>import(await getPath()) : Promise<any>
>await getPath() : string
>getPath() : Promise<string>
>getPath : () => Promise<string>
};
@@ -3,5 +3,6 @@ const path = './foo';
import(path,);
//// [dynamicImportTrailingComma.js]
var _a;
var path = './foo';
Promise.resolve().then(function () { return require(path); });
_a = path, Promise.resolve().then(function () { return require(_a); });
@@ -15,12 +15,14 @@ function returnDynamicLoad(path: string) {
}
//// [importCallExpressionDeclarationEmit1.js]
Promise.resolve().then(() => require(getSpecifier()));
var p0 = Promise.resolve().then(() => require(`${directory}\\${moduleFile}`));
var p1 = Promise.resolve().then(() => require(getSpecifier()));
const p2 = Promise.resolve().then(() => require(whatToLoad ? getSpecifier() : "defaulPath"));
var _a, _b, _c, _d;
_a = getSpecifier(), Promise.resolve().then(() => require(_a));
var p0 = (_b = `${directory}\\${moduleFile}`, Promise.resolve().then(() => require(_b)));
var p1 = (_c = getSpecifier(), Promise.resolve().then(() => require(_c)));
const p2 = (_d = whatToLoad ? getSpecifier() : "defaulPath", Promise.resolve().then(() => require(_d)));
function returnDynamicLoad(path) {
return Promise.resolve().then(() => require(path));
var _a;
return _a = path, Promise.resolve().then(() => require(_a));
}
@@ -10,8 +10,9 @@ const p2 = import();
const p4 = import("pathToModule", "secondModule");
//// [importCallExpressionGrammarError.js]
var _a, _b;
var a = ["./0"];
Promise.resolve().then(() => require(...["PathModule"]));
var p1 = Promise.resolve().then(() => require(...a));
_a = (...["PathModule"]), Promise.resolve().then(() => require(_a));
var p1 = (_b = (...a), Promise.resolve().then(() => require(_b)));
const p2 = Promise.resolve().then(() => require());
const p4 = Promise.resolve().then(() => require("pathToModule"));
@@ -24,6 +24,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
function foo() {
return __awaiter(this, void 0, void 0, function* () {
return yield Promise.resolve().then(() => require((yield Promise.resolve().then(() => require("./foo"))).default));
var _a;
return yield (_a = (yield Promise.resolve().then(() => require("./foo"))).default, Promise.resolve().then(() => require(_a)));
});
}
@@ -52,9 +52,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
function foo() {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
var _b;
switch (_a.label) {
case 0: return [4 /*yield*/, Promise.resolve().then(function () { return require("./foo"); })];
case 1: return [4 /*yield*/, Promise.resolve().then(function () { return require((_a.sent()).default); })];
case 1: return [4 /*yield*/, (_b = (_a.sent()).default, Promise.resolve().then(function () { return require(_b); }))];
case 2: return [2 /*return*/, _a.sent()];
}
});
@@ -42,21 +42,23 @@ class C {
exports.C = C;
//// [1.js]
"use strict";
var _a, _b, _c, _d, _e, _f, _g;
Object.defineProperty(exports, "__esModule", { value: true });
Promise.resolve().then(() => require(`${directory}\\${moduleFile}`));
Promise.resolve().then(() => require(getSpecifier()));
var p1 = Promise.resolve().then(() => require(ValidSomeCondition() ? "./0" : "externalModule"));
var p1 = Promise.resolve().then(() => require(getSpecifier()));
var p11 = Promise.resolve().then(() => require(getSpecifier()));
const p2 = Promise.resolve().then(() => require(whatToLoad ? getSpecifier() : "defaulPath"));
_a = `${directory}\\${moduleFile}`, Promise.resolve().then(() => require(_a));
_b = getSpecifier(), Promise.resolve().then(() => require(_b));
var p1 = (_c = ValidSomeCondition() ? "./0" : "externalModule", Promise.resolve().then(() => require(_c)));
var p1 = (_d = getSpecifier(), Promise.resolve().then(() => require(_d)));
var p11 = (_e = getSpecifier(), Promise.resolve().then(() => require(_e)));
const p2 = (_f = whatToLoad ? getSpecifier() : "defaulPath", Promise.resolve().then(() => require(_f)));
p1.then(zero => {
return zero.foo(); // ok, zero is any
});
let j;
var p3 = Promise.resolve().then(() => require(j = getSpecifier()));
var p3 = (_g = j = getSpecifier(), Promise.resolve().then(() => require(_g)));
function* loadModule(directories) {
var _a;
for (const directory of directories) {
const path = `${directory}\\moduleFile`;
Promise.resolve().then(() => require(yield path));
_a = yield path, Promise.resolve().then(() => require(_a));
}
}
@@ -14,12 +14,13 @@ var p3 = import(["path1", "path2"]);
var p4 = import(()=>"PathToModule");
//// [importCallExpressionSpecifierNotStringTypeError.js]
var _a, _b, _c, _d, _e;
// Error specifier is not assignable to string
Promise.resolve().then(() => require(getSpecifier()));
var p1 = Promise.resolve().then(() => require(getSpecifier()));
const p2 = Promise.resolve().then(() => require(whatToLoad ? getSpecifier() : "defaulPath"));
_a = getSpecifier(), Promise.resolve().then(() => require(_a));
var p1 = (_b = getSpecifier(), Promise.resolve().then(() => require(_b)));
const p2 = (_c = whatToLoad ? getSpecifier() : "defaulPath", Promise.resolve().then(() => require(_c)));
p1.then(zero => {
return zero.foo(); // ok, zero is any
});
var p3 = Promise.resolve().then(() => require(["path1", "path2"]));
var p4 = Promise.resolve().then(() => require(() => "PathToModule"));
var p3 = (_d = ["path1", "path2"], Promise.resolve().then(() => require(_d)));
var p4 = (_e = () => "PathToModule", Promise.resolve().then(() => require(_e)));
@@ -0,0 +1,20 @@
//// [tests/cases/compiler/importElisionExportNonExportAndDefault.ts] ////
//// [main.ts]
import MyFunction from "./MyComponent";
MyFunction({msg: "Hello World"});
//// [MyComponent.ts]
interface MyFunction { msg: string; }
export const MyFunction = ({ msg }: MyFunction) => console.log(`Got message "${msg}"`);
export default MyFunction;
//// [MyComponent.js]
export const MyFunction = ({ msg }) => console.log(`Got message "${msg}"`);
export default MyFunction;
//// [main.js]
import MyFunction from "./MyComponent";
MyFunction({ msg: "Hello World" });
@@ -0,0 +1,25 @@
=== tests/cases/compiler/main.ts ===
import MyFunction from "./MyComponent";
>MyFunction : Symbol(MyFunction, Decl(main.ts, 0, 6))
MyFunction({msg: "Hello World"});
>msg : Symbol(msg, Decl(main.ts, 2, 12))
=== tests/cases/compiler/MyComponent.ts ===
interface MyFunction { msg: string; }
>MyFunction : Symbol(MyFunction, Decl(MyComponent.ts, 0, 0), Decl(MyComponent.ts, 2, 12))
>msg : Symbol(MyFunction.msg, Decl(MyComponent.ts, 0, 22))
export const MyFunction = ({ msg }: MyFunction) => console.log(`Got message "${msg}"`);
>MyFunction : Symbol(MyFunction, Decl(MyComponent.ts, 2, 12))
>msg : Symbol(msg, Decl(MyComponent.ts, 2, 28))
>MyFunction : Symbol(MyFunction, Decl(MyComponent.ts, 0, 0), Decl(MyComponent.ts, 2, 12))
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>msg : Symbol(msg, Decl(MyComponent.ts, 2, 28))
export default MyFunction;
>MyFunction : Symbol(MyFunction, Decl(MyComponent.ts, 0, 0), Decl(MyComponent.ts, 2, 12))
@@ -0,0 +1,30 @@
=== tests/cases/compiler/main.ts ===
import MyFunction from "./MyComponent";
>MyFunction : any
MyFunction({msg: "Hello World"});
>MyFunction({msg: "Hello World"}) : error
>MyFunction : error
>{msg: "Hello World"} : { msg: string; }
>msg : string
>"Hello World" : "Hello World"
=== tests/cases/compiler/MyComponent.ts ===
interface MyFunction { msg: string; }
>msg : string
export const MyFunction = ({ msg }: MyFunction) => console.log(`Got message "${msg}"`);
>MyFunction : ({ msg }: MyFunction) => void
>({ msg }: MyFunction) => console.log(`Got message "${msg}"`) : ({ msg }: MyFunction) => void
>msg : string
>console.log(`Got message "${msg}"`) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
>`Got message "${msg}"` : string
>msg : string
export default MyFunction;
>MyFunction : MyFunction
@@ -58,6 +58,7 @@ var v = import(String());
//// [jsdocInTypeScript.js]
var _a;
var T = /** @class */ (function () {
function T() {
}
@@ -92,4 +93,4 @@ var E = {};
E[""];
// make sure import types in JSDoc are not resolved
/** @type {import("should-not-be-resolved").Type} */
var v = Promise.resolve().then(function () { return require(String()); });
var v = (_a = String(), Promise.resolve().then(function () { return require(_a); }));
@@ -417,4 +417,31 @@ tests/cases/conformance/types/unknown/unknownControlFlow.ts(293,5): error TS2345
value;
}
}
// Repro from #51009
type TypeA = {
A: 'A',
B: 'B',
}
type TypeB = {
A: 'A',
B: 'B',
C: 'C',
}
type R<T extends keyof TypeA> =
T extends keyof TypeB ? [TypeA[T], TypeB[T]] : never;
type R2<T extends PropertyKey> =
T extends keyof TypeA ? T extends keyof TypeB ? [TypeA[T], TypeB[T]] : never : never;
// Repro from #51041
type AB = "A" | "B";
function x<T_AB extends AB>(x: T_AB & undefined, y: any) {
let r2: never = y as T_AB & undefined;
}
@@ -400,6 +400,33 @@ function doSomething2(value: unknown): void {
value;
}
}
// Repro from #51009
type TypeA = {
A: 'A',
B: 'B',
}
type TypeB = {
A: 'A',
B: 'B',
C: 'C',
}
type R<T extends keyof TypeA> =
T extends keyof TypeB ? [TypeA[T], TypeB[T]] : never;
type R2<T extends PropertyKey> =
T extends keyof TypeA ? T extends keyof TypeB ? [TypeA[T], TypeB[T]] : never : never;
// Repro from #51041
type AB = "A" | "B";
function x<T_AB extends AB>(x: T_AB & undefined, y: any) {
let r2: never = y as T_AB & undefined;
}
//// [unknownControlFlow.js]
@@ -742,6 +769,9 @@ function doSomething2(value) {
value;
}
}
function x(x, y) {
var r2 = y;
}
//// [unknownControlFlow.d.ts]
@@ -801,3 +831,16 @@ declare function fx10(x: string | number, y: number): void;
declare function SendBlob(encoding: unknown): void;
declare function doSomething1<T extends unknown>(value: T): T;
declare function doSomething2(value: unknown): void;
type TypeA = {
A: 'A';
B: 'B';
};
type TypeB = {
A: 'A';
B: 'B';
C: 'C';
};
type R<T extends keyof TypeA> = T extends keyof TypeB ? [TypeA[T], TypeB[T]] : never;
type R2<T extends PropertyKey> = T extends keyof TypeA ? T extends keyof TypeB ? [TypeA[T], TypeB[T]] : never : never;
type AB = "A" | "B";
declare function x<T_AB extends AB>(x: T_AB & undefined, y: any): void;
@@ -923,3 +923,75 @@ function doSomething2(value: unknown): void {
}
}
// Repro from #51009
type TypeA = {
>TypeA : Symbol(TypeA, Decl(unknownControlFlow.ts, 400, 1))
A: 'A',
>A : Symbol(A, Decl(unknownControlFlow.ts, 404, 14))
B: 'B',
>B : Symbol(B, Decl(unknownControlFlow.ts, 405, 11))
}
type TypeB = {
>TypeB : Symbol(TypeB, Decl(unknownControlFlow.ts, 407, 1))
A: 'A',
>A : Symbol(A, Decl(unknownControlFlow.ts, 409, 14))
B: 'B',
>B : Symbol(B, Decl(unknownControlFlow.ts, 410, 11))
C: 'C',
>C : Symbol(C, Decl(unknownControlFlow.ts, 411, 11))
}
type R<T extends keyof TypeA> =
>R : Symbol(R, Decl(unknownControlFlow.ts, 413, 1))
>T : Symbol(T, Decl(unknownControlFlow.ts, 415, 7))
>TypeA : Symbol(TypeA, Decl(unknownControlFlow.ts, 400, 1))
T extends keyof TypeB ? [TypeA[T], TypeB[T]] : never;
>T : Symbol(T, Decl(unknownControlFlow.ts, 415, 7))
>TypeB : Symbol(TypeB, Decl(unknownControlFlow.ts, 407, 1))
>TypeA : Symbol(TypeA, Decl(unknownControlFlow.ts, 400, 1))
>T : Symbol(T, Decl(unknownControlFlow.ts, 415, 7))
>TypeB : Symbol(TypeB, Decl(unknownControlFlow.ts, 407, 1))
>T : Symbol(T, Decl(unknownControlFlow.ts, 415, 7))
type R2<T extends PropertyKey> =
>R2 : Symbol(R2, Decl(unknownControlFlow.ts, 416, 57))
>T : Symbol(T, Decl(unknownControlFlow.ts, 418, 8))
>PropertyKey : Symbol(PropertyKey, Decl(lib.es5.d.ts, --, --))
T extends keyof TypeA ? T extends keyof TypeB ? [TypeA[T], TypeB[T]] : never : never;
>T : Symbol(T, Decl(unknownControlFlow.ts, 418, 8))
>TypeA : Symbol(TypeA, Decl(unknownControlFlow.ts, 400, 1))
>T : Symbol(T, Decl(unknownControlFlow.ts, 418, 8))
>TypeB : Symbol(TypeB, Decl(unknownControlFlow.ts, 407, 1))
>TypeA : Symbol(TypeA, Decl(unknownControlFlow.ts, 400, 1))
>T : Symbol(T, Decl(unknownControlFlow.ts, 418, 8))
>TypeB : Symbol(TypeB, Decl(unknownControlFlow.ts, 407, 1))
>T : Symbol(T, Decl(unknownControlFlow.ts, 418, 8))
// Repro from #51041
type AB = "A" | "B";
>AB : Symbol(AB, Decl(unknownControlFlow.ts, 419, 89))
function x<T_AB extends AB>(x: T_AB & undefined, y: any) {
>x : Symbol(x, Decl(unknownControlFlow.ts, 423, 20))
>T_AB : Symbol(T_AB, Decl(unknownControlFlow.ts, 425, 11))
>AB : Symbol(AB, Decl(unknownControlFlow.ts, 419, 89))
>x : Symbol(x, Decl(unknownControlFlow.ts, 425, 28))
>T_AB : Symbol(T_AB, Decl(unknownControlFlow.ts, 425, 11))
>y : Symbol(y, Decl(unknownControlFlow.ts, 425, 48))
let r2: never = y as T_AB & undefined;
>r2 : Symbol(r2, Decl(unknownControlFlow.ts, 426, 7))
>y : Symbol(y, Decl(unknownControlFlow.ts, 425, 48))
>T_AB : Symbol(T_AB, Decl(unknownControlFlow.ts, 425, 11))
}
@@ -853,7 +853,7 @@ function fx2<T extends {}>(value: T & ({} | null)) {
>42 : 42
value; // T & {}
>value : T & {}
>value : T & ({} | null)
}
else {
value; // T & ({} | null)
@@ -872,7 +872,7 @@ function fx3<T extends {} | undefined>(value: T & ({} | null)) {
>42 : 42
value; // T & {}
>value : T & {}
>value : T & ({} | null)
}
else {
value; // T & ({} | null)
@@ -1025,3 +1025,54 @@ function doSomething2(value: unknown): void {
}
}
// Repro from #51009
type TypeA = {
>TypeA : { A: 'A'; B: 'B'; }
A: 'A',
>A : "A"
B: 'B',
>B : "B"
}
type TypeB = {
>TypeB : { A: 'A'; B: 'B'; C: 'C'; }
A: 'A',
>A : "A"
B: 'B',
>B : "B"
C: 'C',
>C : "C"
}
type R<T extends keyof TypeA> =
>R : R<T>
T extends keyof TypeB ? [TypeA[T], TypeB[T]] : never;
type R2<T extends PropertyKey> =
>R2 : R2<T>
T extends keyof TypeA ? T extends keyof TypeB ? [TypeA[T], TypeB[T]] : never : never;
// Repro from #51041
type AB = "A" | "B";
>AB : "A" | "B"
function x<T_AB extends AB>(x: T_AB & undefined, y: any) {
>x : <T_AB extends AB>(x: T_AB & undefined, y: any) => void
>x : T_AB & undefined
>y : any
let r2: never = y as T_AB & undefined;
>r2 : never
>y as T_AB & undefined : T_AB & undefined
>y : any
}
@@ -0,0 +1,6 @@
// @target: esnext
// https://github.com/microsoft/TypeScript/issues/47291
class X {
f = async (): Promise<this> => this;
}
@@ -0,0 +1,22 @@
// @strict: true
declare function f1(): string;
declare function f2(): [b: string];
declare function f3(): { c: string };
try {
var a = f1();
var [b] = f2();
var { c } = f3();
var [d = 1] = [];
var { e = 1 } = { };
} catch {
console.error("error");
}
a;
b;
c;
d;
e;
@@ -0,0 +1,7 @@
// @strict: true
declare const obj: { a?: string, b?: number };
const {
a = "0",
b = +a,
} = obj;
@@ -0,0 +1,17 @@
// @lib: es2019
// @target: es2019
// @module: commonjs
// https://github.com/microsoft/TypeScript/issues/48285
let i = 0;
import(String(i++));
import(String(i++));
const getPath = async () => {
/* in reality this would do some async FS operation, or a web request */
return "/root/my/cool/path";
};
const someFunction = async () => {
const result = await import(await getPath());
};
@@ -0,0 +1,13 @@
// @target: esnext
// @module: esnext
// @filename: main.ts
import MyFunction from "./MyComponent";
MyFunction({msg: "Hello World"});
// @filename: MyComponent.ts
interface MyFunction { msg: string; }
export const MyFunction = ({ msg }: MyFunction) => console.log(`Got message "${msg}"`);
export default MyFunction;
@@ -187,3 +187,29 @@ class B extends A {
(async () => super["x"] = f);
}
}
// https://github.com/microsoft/TypeScript/issues/46828
class Base {
set setter(x: any) {}
get getter(): any { return; }
method(x: string): any {}
static set setter(x: any) {}
static get getter(): any { return; }
static method(x: string): any {}
}
class Derived extends Base {
a() { return async () => super.method('') }
b() { return async () => super.getter }
c() { return async () => super.setter = '' }
d() { return async () => super["method"]('') }
e() { return async () => super["getter"] }
f() { return async () => super["setter"] = '' }
static a() { return async () => super.method('') }
static b() { return async () => super.getter }
static c() { return async () => super.setter = '' }
static d() { return async () => super["method"]('') }
static e() { return async () => super["getter"] }
static f() { return async () => super["setter"] = '' }
}
@@ -402,3 +402,30 @@ function doSomething2(value: unknown): void {
value;
}
}
// Repro from #51009
type TypeA = {
A: 'A',
B: 'B',
}
type TypeB = {
A: 'A',
B: 'B',
C: 'C',
}
type R<T extends keyof TypeA> =
T extends keyof TypeB ? [TypeA[T], TypeB[T]] : never;
type R2<T extends PropertyKey> =
T extends keyof TypeA ? T extends keyof TypeB ? [TypeA[T], TypeB[T]] : never : never;
// Repro from #51041
type AB = "A" | "B";
function x<T_AB extends AB>(x: T_AB & undefined, y: any) {
let r2: never = y as T_AB & undefined;
}
@@ -0,0 +1,17 @@
/// <reference path="fourslash.ts" />
// @Filename: /tsconfig.json
//// {
//// "compilerOptions": {
//// "module": "commonjs",
//// "rootDirs": [".", "./some/other/root"]
//// }
//// }
// @Filename: /some/other/root/types.ts
//// export type Something = {};
// @Filename: /index.ts
//// const s: Something/**/
verify.importFixModuleSpecifiers("", ["./types"]);
@@ -0,0 +1,12 @@
/// <reference path="fourslash.ts" />
// @target: esnext
//// async function fn1(a: Promise<void> | void) {
//// await a;
//// }
////
//// async function fn2<T extends Promise<void> | void>(a: T) {
//// await a;
//// }
verify.getSuggestionDiagnostics([]);
@@ -0,0 +1,21 @@
/// <reference path="fourslash.ts" />
////interface I {
//// prop: string;
////}
////class C implements I {
//// public pr/**/: string = 'foo';
////}
verify.completions({
marker: "",
includes: [
{ name: "prop", isSnippet: undefined, insertText: undefined }
],
isNewIdentifierLocation: true,
preferences: {
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: true,
includeCompletionsWithClassMemberSnippets: true,
}
});
@@ -0,0 +1,21 @@
/// <reference path="fourslash.ts" />
////interface I {
//// prop: string;
////}
////class C implements I {
//// public pr/**/: string | number;
////}
verify.completions({
marker: "",
includes: [
{ name: "prop", isSnippet: undefined, insertText: undefined }
],
isNewIdentifierLocation: true,
preferences: {
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: true,
includeCompletionsWithClassMemberSnippets: true,
}
});
@@ -0,0 +1,21 @@
/// <reference path="fourslash.ts" />
////interface I {
//// /**/
//// foo: (a: number, b: string) => void;
////}
verify.docCommentTemplateAt("", 12,
`/**
*
* @param a
* @param b
* @returns
*/`);
verify.docCommentTemplateAt("", 12,
`/**
*
* @param a
* @param b
*/`, { generateReturnInDocTemplate: false });
@@ -0,0 +1,7 @@
/// <reference path="fourslash.ts" />
////function /*end*/foo() {
//// [|/*start*/return|] 10;
////}
verify.goToDefinition("start", "end");
@@ -0,0 +1,9 @@
/// <reference path="fourslash.ts" />
////function foo() {
//// return /*end*/() => {
//// [|/*start*/return|] 10;
//// }
////}
verify.goToDefinition("start", "end");
@@ -0,0 +1,9 @@
/// <reference path="fourslash.ts" />
////class C {
//// /*end*/m() {
//// [|/*start*/return|] 1;
//// }
////}
verify.goToDefinition("start", "end");
@@ -0,0 +1,5 @@
/// <reference path="fourslash.ts" />
////[|/*start*/return|];
verify.goToDefinition("start", []);
@@ -0,0 +1,9 @@
/// <reference path="fourslash.ts" />
////function foo() {
//// class Foo {
//// static { [|/*start*/return|]; }
//// }
////}
verify.goToDefinition("start", []);
@@ -0,0 +1,9 @@
/// <reference path="fourslash.ts" />
////function foo() {
//// return /*end*/function () {
//// [|/*start*/return|] 10;
//// }
////}
verify.goToDefinition("start", "end");
@@ -0,0 +1,9 @@
/// <reference path="fourslash.ts" />
////function foo(a: string, b: string): string;
////function foo(a: number, b: number): number;
////function /*end*/foo(a: any, b: any): any {
//// [|/*start*/return|] a + b;
////}
verify.goToDefinition("start", "end");