typescript 4.8.0-dev.20220606 → 4.8.0-dev.20220608
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es2022.d.ts +1 -0
- package/lib/lib.es2022.sharedmemory.d.ts +27 -0
- package/lib/tsc.js +41 -15
- package/lib/tsserver.js +57 -18
- package/lib/tsserverlibrary.js +57 -18
- package/lib/typescript.js +57 -18
- package/lib/typescriptServices.js +57 -18
- package/lib/typingsInstaller.js +41 -15
- package/package.json +1 -1
- package/test.js +0 -9
- package/test.ts +0 -4
package/lib/lib.es2022.d.ts
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
5
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
8
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
9
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
10
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
11
|
+
|
|
12
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
|
+
and limitations under the License.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/// <reference no-default-lib="true"/>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
interface Atomics {
|
|
22
|
+
/**
|
|
23
|
+
* A non-blocking, asynchronous version of wait which is usable on the main thread.
|
|
24
|
+
* Waits asynchronously on a shared memory location and returns a Promise
|
|
25
|
+
*/
|
|
26
|
+
waitAsync(typedArray: BigInt64Array | Int32Array, index: number, value: bigint, timeout?: number): { async: false, value: "ok" | "not-equal" | "timed-out" } | { async: true, value: Promise<"ok" | "not-equal" | "timed-out"> };
|
|
27
|
+
}
|
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220608";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -31542,6 +31542,7 @@ var ts;
|
|
|
31542
31542
|
["es2022.error", "lib.es2022.error.d.ts"],
|
|
31543
31543
|
["es2022.intl", "lib.es2022.intl.d.ts"],
|
|
31544
31544
|
["es2022.object", "lib.es2022.object.d.ts"],
|
|
31545
|
+
["es2022.sharedmemory", "lib.es2022.sharedmemory.d.ts"],
|
|
31545
31546
|
["es2022.string", "lib.es2022.string.d.ts"],
|
|
31546
31547
|
["esnext.array", "lib.es2022.array.d.ts"],
|
|
31547
31548
|
["esnext.symbol", "lib.es2019.symbol.d.ts"],
|
|
@@ -53619,6 +53620,9 @@ var ts;
|
|
|
53619
53620
|
}
|
|
53620
53621
|
return false;
|
|
53621
53622
|
}
|
|
53623
|
+
function containsUndefinedType(type) {
|
|
53624
|
+
return !!((type.flags & 1048576 ? type.types[0] : type).flags & 32768);
|
|
53625
|
+
}
|
|
53622
53626
|
function isStringIndexSignatureOnlyType(type) {
|
|
53623
53627
|
return type.flags & 524288 && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
|
|
53624
53628
|
type.flags & 3145728 && ts.every(type.types, isStringIndexSignatureOnlyType) ||
|
|
@@ -59947,7 +59951,7 @@ var ts;
|
|
|
59947
59951
|
return convertAutoToAny(flowType);
|
|
59948
59952
|
}
|
|
59949
59953
|
}
|
|
59950
|
-
else if (!assumeInitialized && !(
|
|
59954
|
+
else if (!assumeInitialized && !containsUndefinedType(type) && containsUndefinedType(flowType)) {
|
|
59951
59955
|
error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
59952
59956
|
return type;
|
|
59953
59957
|
}
|
|
@@ -62479,7 +62483,7 @@ var ts;
|
|
|
62479
62483
|
assumeUninitialized = true;
|
|
62480
62484
|
}
|
|
62481
62485
|
var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
62482
|
-
if (assumeUninitialized && !(
|
|
62486
|
+
if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) {
|
|
62483
62487
|
error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop));
|
|
62484
62488
|
return propType;
|
|
62485
62489
|
}
|
|
@@ -68590,6 +68594,11 @@ var ts;
|
|
|
68590
68594
|
function checkJSDocTypeTag(node) {
|
|
68591
68595
|
checkSourceElement(node.typeExpression);
|
|
68592
68596
|
}
|
|
68597
|
+
function checkJSDocLinkLikeTag(node) {
|
|
68598
|
+
if (node.name) {
|
|
68599
|
+
resolveJSDocMemberName(node.name, true);
|
|
68600
|
+
}
|
|
68601
|
+
}
|
|
68593
68602
|
function checkJSDocParameterTag(node) {
|
|
68594
68603
|
checkSourceElement(node.typeExpression);
|
|
68595
68604
|
}
|
|
@@ -70900,7 +70909,7 @@ var ts;
|
|
|
70900
70909
|
var propName = member.name;
|
|
70901
70910
|
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
70902
70911
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
70903
|
-
if (!(type.flags & 3 ||
|
|
70912
|
+
if (!(type.flags & 3 || containsUndefinedType(type))) {
|
|
70904
70913
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
70905
70914
|
error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
|
|
70906
70915
|
}
|
|
@@ -70924,7 +70933,7 @@ var ts;
|
|
|
70924
70933
|
ts.setParent(reference, staticBlock);
|
|
70925
70934
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
70926
70935
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
70927
|
-
if (!(
|
|
70936
|
+
if (!containsUndefinedType(flowType)) {
|
|
70928
70937
|
return true;
|
|
70929
70938
|
}
|
|
70930
70939
|
}
|
|
@@ -70939,7 +70948,7 @@ var ts;
|
|
|
70939
70948
|
ts.setParent(reference, constructor);
|
|
70940
70949
|
reference.flowNode = constructor.returnFlowNode;
|
|
70941
70950
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
70942
|
-
return !(
|
|
70951
|
+
return !containsUndefinedType(flowType);
|
|
70943
70952
|
}
|
|
70944
70953
|
function checkInterfaceDeclaration(node) {
|
|
70945
70954
|
if (!checkGrammarDecoratorsAndModifiers(node))
|
|
@@ -71839,12 +71848,16 @@ var ts;
|
|
|
71839
71848
|
}
|
|
71840
71849
|
}
|
|
71841
71850
|
function checkSourceElementWorker(node) {
|
|
71842
|
-
|
|
71843
|
-
|
|
71844
|
-
|
|
71845
|
-
|
|
71851
|
+
ts.forEach(node.jsDoc, function (_a) {
|
|
71852
|
+
var comment = _a.comment, tags = _a.tags;
|
|
71853
|
+
checkJSDocCommentWorker(comment);
|
|
71854
|
+
ts.forEach(tags, function (tag) {
|
|
71855
|
+
checkJSDocCommentWorker(tag.comment);
|
|
71856
|
+
if (ts.isInJSFile(node)) {
|
|
71857
|
+
checkSourceElement(tag);
|
|
71858
|
+
}
|
|
71846
71859
|
});
|
|
71847
|
-
}
|
|
71860
|
+
});
|
|
71848
71861
|
var kind = node.kind;
|
|
71849
71862
|
if (cancellationToken) {
|
|
71850
71863
|
switch (kind) {
|
|
@@ -71928,6 +71941,10 @@ var ts;
|
|
|
71928
71941
|
return checkJSDocTemplateTag(node);
|
|
71929
71942
|
case 343:
|
|
71930
71943
|
return checkJSDocTypeTag(node);
|
|
71944
|
+
case 324:
|
|
71945
|
+
case 325:
|
|
71946
|
+
case 326:
|
|
71947
|
+
return checkJSDocLinkLikeTag(node);
|
|
71931
71948
|
case 340:
|
|
71932
71949
|
return checkJSDocParameterTag(node);
|
|
71933
71950
|
case 347:
|
|
@@ -72021,6 +72038,15 @@ var ts;
|
|
|
72021
72038
|
return checkMissingDeclaration(node);
|
|
72022
72039
|
}
|
|
72023
72040
|
}
|
|
72041
|
+
function checkJSDocCommentWorker(node) {
|
|
72042
|
+
if (ts.isArray(node)) {
|
|
72043
|
+
ts.forEach(node, function (tag) {
|
|
72044
|
+
if (ts.isJSDocLinkLike(tag)) {
|
|
72045
|
+
checkSourceElement(tag);
|
|
72046
|
+
}
|
|
72047
|
+
});
|
|
72048
|
+
}
|
|
72049
|
+
}
|
|
72024
72050
|
function checkJSDocTypeIsInJsFile(node) {
|
|
72025
72051
|
if (!ts.isInJSFile(node)) {
|
|
72026
72052
|
grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
|
|
@@ -72504,7 +72530,7 @@ var ts;
|
|
|
72504
72530
|
if (!result && isJSDoc_1) {
|
|
72505
72531
|
var container = ts.findAncestor(name, ts.or(ts.isClassLike, ts.isInterfaceDeclaration));
|
|
72506
72532
|
if (container) {
|
|
72507
|
-
return resolveJSDocMemberName(name, getSymbolOfNode(container));
|
|
72533
|
+
return resolveJSDocMemberName(name, false, getSymbolOfNode(container));
|
|
72508
72534
|
}
|
|
72509
72535
|
}
|
|
72510
72536
|
return result;
|
|
@@ -72542,10 +72568,10 @@ var ts;
|
|
|
72542
72568
|
}
|
|
72543
72569
|
return undefined;
|
|
72544
72570
|
}
|
|
72545
|
-
function resolveJSDocMemberName(name, container) {
|
|
72571
|
+
function resolveJSDocMemberName(name, ignoreErrors, container) {
|
|
72546
72572
|
if (ts.isEntityName(name)) {
|
|
72547
72573
|
var meaning = 788968 | 1920 | 111551;
|
|
72548
|
-
var symbol = resolveEntityName(name, meaning,
|
|
72574
|
+
var symbol = resolveEntityName(name, meaning, ignoreErrors, true, ts.getHostSignatureFromJSDoc(name));
|
|
72549
72575
|
if (!symbol && ts.isIdentifier(name) && container) {
|
|
72550
72576
|
symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(container), name.escapedText, meaning));
|
|
72551
72577
|
}
|
|
@@ -72553,7 +72579,7 @@ var ts;
|
|
|
72553
72579
|
return symbol;
|
|
72554
72580
|
}
|
|
72555
72581
|
}
|
|
72556
|
-
var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left);
|
|
72582
|
+
var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left, ignoreErrors, container);
|
|
72557
72583
|
var right = ts.isIdentifier(name) ? name.escapedText : name.right.escapedText;
|
|
72558
72584
|
if (left) {
|
|
72559
72585
|
var proto = left.flags & 111551 && getPropertyOfType(getTypeOfSymbol(left), "prototype");
|
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220608";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -39044,6 +39044,7 @@ var ts;
|
|
|
39044
39044
|
["es2022.error", "lib.es2022.error.d.ts"],
|
|
39045
39045
|
["es2022.intl", "lib.es2022.intl.d.ts"],
|
|
39046
39046
|
["es2022.object", "lib.es2022.object.d.ts"],
|
|
39047
|
+
["es2022.sharedmemory", "lib.es2022.sharedmemory.d.ts"],
|
|
39047
39048
|
["es2022.string", "lib.es2022.string.d.ts"],
|
|
39048
39049
|
["esnext.array", "lib.es2022.array.d.ts"],
|
|
39049
39050
|
["esnext.symbol", "lib.es2019.symbol.d.ts"],
|
|
@@ -64427,6 +64428,9 @@ var ts;
|
|
|
64427
64428
|
}
|
|
64428
64429
|
return false;
|
|
64429
64430
|
}
|
|
64431
|
+
function containsUndefinedType(type) {
|
|
64432
|
+
return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 32768 /* Undefined */);
|
|
64433
|
+
}
|
|
64430
64434
|
function isStringIndexSignatureOnlyType(type) {
|
|
64431
64435
|
return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
|
|
64432
64436
|
type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
|
|
@@ -71811,7 +71815,7 @@ var ts;
|
|
|
71811
71815
|
return convertAutoToAny(flowType);
|
|
71812
71816
|
}
|
|
71813
71817
|
}
|
|
71814
|
-
else if (!assumeInitialized && !(
|
|
71818
|
+
else if (!assumeInitialized && !containsUndefinedType(type) && containsUndefinedType(flowType)) {
|
|
71815
71819
|
error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
71816
71820
|
// Return the declared type to reduce follow-on errors
|
|
71817
71821
|
return type;
|
|
@@ -74822,7 +74826,7 @@ var ts;
|
|
|
74822
74826
|
assumeUninitialized = true;
|
|
74823
74827
|
}
|
|
74824
74828
|
var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
74825
|
-
if (assumeUninitialized && !(
|
|
74829
|
+
if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) {
|
|
74826
74830
|
error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); // TODO: GH#18217
|
|
74827
74831
|
// Return the declared type to reduce follow-on errors
|
|
74828
74832
|
return propType;
|
|
@@ -81901,6 +81905,11 @@ var ts;
|
|
|
81901
81905
|
function checkJSDocTypeTag(node) {
|
|
81902
81906
|
checkSourceElement(node.typeExpression);
|
|
81903
81907
|
}
|
|
81908
|
+
function checkJSDocLinkLikeTag(node) {
|
|
81909
|
+
if (node.name) {
|
|
81910
|
+
resolveJSDocMemberName(node.name, /*ignoreErrors*/ true);
|
|
81911
|
+
}
|
|
81912
|
+
}
|
|
81904
81913
|
function checkJSDocParameterTag(node) {
|
|
81905
81914
|
checkSourceElement(node.typeExpression);
|
|
81906
81915
|
}
|
|
@@ -84672,7 +84681,7 @@ var ts;
|
|
|
84672
84681
|
var propName = member.name;
|
|
84673
84682
|
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
84674
84683
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
84675
|
-
if (!(type.flags & 3 /* AnyOrUnknown */ ||
|
|
84684
|
+
if (!(type.flags & 3 /* AnyOrUnknown */ || containsUndefinedType(type))) {
|
|
84676
84685
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
84677
84686
|
error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
|
|
84678
84687
|
}
|
|
@@ -84697,7 +84706,7 @@ var ts;
|
|
|
84697
84706
|
ts.setParent(reference, staticBlock);
|
|
84698
84707
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
84699
84708
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84700
|
-
if (!(
|
|
84709
|
+
if (!containsUndefinedType(flowType)) {
|
|
84701
84710
|
return true;
|
|
84702
84711
|
}
|
|
84703
84712
|
}
|
|
@@ -84712,7 +84721,7 @@ var ts;
|
|
|
84712
84721
|
ts.setParent(reference, constructor);
|
|
84713
84722
|
reference.flowNode = constructor.returnFlowNode;
|
|
84714
84723
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84715
|
-
return !(
|
|
84724
|
+
return !containsUndefinedType(flowType);
|
|
84716
84725
|
}
|
|
84717
84726
|
function checkInterfaceDeclaration(node) {
|
|
84718
84727
|
// Grammar checking
|
|
@@ -85695,12 +85704,16 @@ var ts;
|
|
|
85695
85704
|
}
|
|
85696
85705
|
}
|
|
85697
85706
|
function checkSourceElementWorker(node) {
|
|
85698
|
-
|
|
85699
|
-
|
|
85700
|
-
|
|
85701
|
-
|
|
85707
|
+
ts.forEach(node.jsDoc, function (_a) {
|
|
85708
|
+
var comment = _a.comment, tags = _a.tags;
|
|
85709
|
+
checkJSDocCommentWorker(comment);
|
|
85710
|
+
ts.forEach(tags, function (tag) {
|
|
85711
|
+
checkJSDocCommentWorker(tag.comment);
|
|
85712
|
+
if (ts.isInJSFile(node)) {
|
|
85713
|
+
checkSourceElement(tag);
|
|
85714
|
+
}
|
|
85702
85715
|
});
|
|
85703
|
-
}
|
|
85716
|
+
});
|
|
85704
85717
|
var kind = node.kind;
|
|
85705
85718
|
if (cancellationToken) {
|
|
85706
85719
|
// Only bother checking on a few construct kinds. We don't want to be excessively
|
|
@@ -85786,6 +85799,10 @@ var ts;
|
|
|
85786
85799
|
return checkJSDocTemplateTag(node);
|
|
85787
85800
|
case 343 /* JSDocTypeTag */:
|
|
85788
85801
|
return checkJSDocTypeTag(node);
|
|
85802
|
+
case 324 /* JSDocLink */:
|
|
85803
|
+
case 325 /* JSDocLinkCode */:
|
|
85804
|
+
case 326 /* JSDocLinkPlain */:
|
|
85805
|
+
return checkJSDocLinkLikeTag(node);
|
|
85789
85806
|
case 340 /* JSDocParameterTag */:
|
|
85790
85807
|
return checkJSDocParameterTag(node);
|
|
85791
85808
|
case 347 /* JSDocPropertyTag */:
|
|
@@ -85880,6 +85897,15 @@ var ts;
|
|
|
85880
85897
|
return checkMissingDeclaration(node);
|
|
85881
85898
|
}
|
|
85882
85899
|
}
|
|
85900
|
+
function checkJSDocCommentWorker(node) {
|
|
85901
|
+
if (ts.isArray(node)) {
|
|
85902
|
+
ts.forEach(node, function (tag) {
|
|
85903
|
+
if (ts.isJSDocLinkLike(tag)) {
|
|
85904
|
+
checkSourceElement(tag);
|
|
85905
|
+
}
|
|
85906
|
+
});
|
|
85907
|
+
}
|
|
85908
|
+
}
|
|
85883
85909
|
function checkJSDocTypeIsInJsFile(node) {
|
|
85884
85910
|
if (!ts.isInJSFile(node)) {
|
|
85885
85911
|
grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
|
|
@@ -86435,7 +86461,7 @@ var ts;
|
|
|
86435
86461
|
if (!result && isJSDoc_1) {
|
|
86436
86462
|
var container = ts.findAncestor(name, ts.or(ts.isClassLike, ts.isInterfaceDeclaration));
|
|
86437
86463
|
if (container) {
|
|
86438
|
-
return resolveJSDocMemberName(name, getSymbolOfNode(container));
|
|
86464
|
+
return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container));
|
|
86439
86465
|
}
|
|
86440
86466
|
}
|
|
86441
86467
|
return result;
|
|
@@ -86481,11 +86507,11 @@ var ts;
|
|
|
86481
86507
|
*
|
|
86482
86508
|
* For unqualified names, a container K may be provided as a second argument.
|
|
86483
86509
|
*/
|
|
86484
|
-
function resolveJSDocMemberName(name, container) {
|
|
86510
|
+
function resolveJSDocMemberName(name, ignoreErrors, container) {
|
|
86485
86511
|
if (ts.isEntityName(name)) {
|
|
86486
86512
|
// resolve static values first
|
|
86487
86513
|
var meaning = 788968 /* Type */ | 1920 /* Namespace */ | 111551 /* Value */;
|
|
86488
|
-
var symbol = resolveEntityName(name, meaning,
|
|
86514
|
+
var symbol = resolveEntityName(name, meaning, ignoreErrors, /*dontResolveAlias*/ true, ts.getHostSignatureFromJSDoc(name));
|
|
86489
86515
|
if (!symbol && ts.isIdentifier(name) && container) {
|
|
86490
86516
|
symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(container), name.escapedText, meaning));
|
|
86491
86517
|
}
|
|
@@ -86493,7 +86519,7 @@ var ts;
|
|
|
86493
86519
|
return symbol;
|
|
86494
86520
|
}
|
|
86495
86521
|
}
|
|
86496
|
-
var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left);
|
|
86522
|
+
var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left, ignoreErrors, container);
|
|
86497
86523
|
var right = ts.isIdentifier(name) ? name.escapedText : name.right.escapedText;
|
|
86498
86524
|
if (left) {
|
|
86499
86525
|
var proto = left.flags & 111551 /* Value */ && getPropertyOfType(getTypeOfSymbol(left), "prototype");
|
|
@@ -136368,7 +136394,7 @@ var ts;
|
|
|
136368
136394
|
}
|
|
136369
136395
|
var str = "{";
|
|
136370
136396
|
for (var key in value) {
|
|
136371
|
-
if (ts.
|
|
136397
|
+
if (ts.hasProperty(value, key)) {
|
|
136372
136398
|
str += key + ": " + compilerOptionValueToString(value[key]);
|
|
136373
136399
|
}
|
|
136374
136400
|
}
|
|
@@ -159296,14 +159322,14 @@ var ts;
|
|
|
159296
159322
|
if (!exportNode || (!ts.isSourceFile(exportNode.parent) && !(ts.isModuleBlock(exportNode.parent) && ts.isAmbientModule(exportNode.parent.parent)))) {
|
|
159297
159323
|
return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_export_statement) };
|
|
159298
159324
|
}
|
|
159299
|
-
var
|
|
159325
|
+
var checker = program.getTypeChecker();
|
|
159326
|
+
var exportingModuleSymbol = getExportingModuleSymbol(exportNode, checker);
|
|
159300
159327
|
var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 513 /* ExportDefault */ : 0 /* None */);
|
|
159301
159328
|
var wasDefault = !!(flags & 512 /* Default */);
|
|
159302
159329
|
// If source file already has a default export, don't offer refactor.
|
|
159303
159330
|
if (!(flags & 1 /* Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* Default */)) {
|
|
159304
159331
|
return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.This_file_already_has_a_default_export) };
|
|
159305
159332
|
}
|
|
159306
|
-
var checker = program.getTypeChecker();
|
|
159307
159333
|
var noSymbolError = function (id) {
|
|
159308
159334
|
return (ts.isIdentifier(id) && checker.getSymbolAtLocation(id)) ? undefined
|
|
159309
159335
|
: { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_named_export) };
|
|
@@ -159395,6 +159421,8 @@ var ts;
|
|
|
159395
159421
|
var checker = program.getTypeChecker();
|
|
159396
159422
|
var exportSymbol = ts.Debug.checkDefined(checker.getSymbolAtLocation(exportName), "Export name should resolve to a symbol");
|
|
159397
159423
|
ts.FindAllReferences.Core.eachExportReference(program.getSourceFiles(), checker, cancellationToken, exportSymbol, exportingModuleSymbol, exportName.text, wasDefault, function (ref) {
|
|
159424
|
+
if (exportName === ref)
|
|
159425
|
+
return;
|
|
159398
159426
|
var importingSourceFile = ref.getSourceFile();
|
|
159399
159427
|
if (wasDefault) {
|
|
159400
159428
|
changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName.text);
|
|
@@ -159487,6 +159515,17 @@ var ts;
|
|
|
159487
159515
|
function makeExportSpecifier(propertyName, name) {
|
|
159488
159516
|
return ts.factory.createExportSpecifier(/*isTypeOnly*/ false, propertyName === name ? undefined : ts.factory.createIdentifier(propertyName), ts.factory.createIdentifier(name));
|
|
159489
159517
|
}
|
|
159518
|
+
function getExportingModuleSymbol(node, checker) {
|
|
159519
|
+
var parent = node.parent;
|
|
159520
|
+
if (ts.isSourceFile(parent)) {
|
|
159521
|
+
return parent.symbol;
|
|
159522
|
+
}
|
|
159523
|
+
var symbol = parent.parent.symbol;
|
|
159524
|
+
if (symbol.valueDeclaration && ts.isExternalModuleAugmentation(symbol.valueDeclaration)) {
|
|
159525
|
+
return checker.getMergedSymbol(symbol);
|
|
159526
|
+
}
|
|
159527
|
+
return symbol;
|
|
159528
|
+
}
|
|
159490
159529
|
})(refactor = ts.refactor || (ts.refactor = {}));
|
|
159491
159530
|
})(ts || (ts = {}));
|
|
159492
159531
|
/* @internal */
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220608";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -39238,6 +39238,7 @@ var ts;
|
|
|
39238
39238
|
["es2022.error", "lib.es2022.error.d.ts"],
|
|
39239
39239
|
["es2022.intl", "lib.es2022.intl.d.ts"],
|
|
39240
39240
|
["es2022.object", "lib.es2022.object.d.ts"],
|
|
39241
|
+
["es2022.sharedmemory", "lib.es2022.sharedmemory.d.ts"],
|
|
39241
39242
|
["es2022.string", "lib.es2022.string.d.ts"],
|
|
39242
39243
|
["esnext.array", "lib.es2022.array.d.ts"],
|
|
39243
39244
|
["esnext.symbol", "lib.es2019.symbol.d.ts"],
|
|
@@ -64621,6 +64622,9 @@ var ts;
|
|
|
64621
64622
|
}
|
|
64622
64623
|
return false;
|
|
64623
64624
|
}
|
|
64625
|
+
function containsUndefinedType(type) {
|
|
64626
|
+
return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 32768 /* Undefined */);
|
|
64627
|
+
}
|
|
64624
64628
|
function isStringIndexSignatureOnlyType(type) {
|
|
64625
64629
|
return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
|
|
64626
64630
|
type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
|
|
@@ -72005,7 +72009,7 @@ var ts;
|
|
|
72005
72009
|
return convertAutoToAny(flowType);
|
|
72006
72010
|
}
|
|
72007
72011
|
}
|
|
72008
|
-
else if (!assumeInitialized && !(
|
|
72012
|
+
else if (!assumeInitialized && !containsUndefinedType(type) && containsUndefinedType(flowType)) {
|
|
72009
72013
|
error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
72010
72014
|
// Return the declared type to reduce follow-on errors
|
|
72011
72015
|
return type;
|
|
@@ -75016,7 +75020,7 @@ var ts;
|
|
|
75016
75020
|
assumeUninitialized = true;
|
|
75017
75021
|
}
|
|
75018
75022
|
var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
75019
|
-
if (assumeUninitialized && !(
|
|
75023
|
+
if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) {
|
|
75020
75024
|
error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); // TODO: GH#18217
|
|
75021
75025
|
// Return the declared type to reduce follow-on errors
|
|
75022
75026
|
return propType;
|
|
@@ -82095,6 +82099,11 @@ var ts;
|
|
|
82095
82099
|
function checkJSDocTypeTag(node) {
|
|
82096
82100
|
checkSourceElement(node.typeExpression);
|
|
82097
82101
|
}
|
|
82102
|
+
function checkJSDocLinkLikeTag(node) {
|
|
82103
|
+
if (node.name) {
|
|
82104
|
+
resolveJSDocMemberName(node.name, /*ignoreErrors*/ true);
|
|
82105
|
+
}
|
|
82106
|
+
}
|
|
82098
82107
|
function checkJSDocParameterTag(node) {
|
|
82099
82108
|
checkSourceElement(node.typeExpression);
|
|
82100
82109
|
}
|
|
@@ -84866,7 +84875,7 @@ var ts;
|
|
|
84866
84875
|
var propName = member.name;
|
|
84867
84876
|
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
84868
84877
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
84869
|
-
if (!(type.flags & 3 /* AnyOrUnknown */ ||
|
|
84878
|
+
if (!(type.flags & 3 /* AnyOrUnknown */ || containsUndefinedType(type))) {
|
|
84870
84879
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
84871
84880
|
error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
|
|
84872
84881
|
}
|
|
@@ -84891,7 +84900,7 @@ var ts;
|
|
|
84891
84900
|
ts.setParent(reference, staticBlock);
|
|
84892
84901
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
84893
84902
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84894
|
-
if (!(
|
|
84903
|
+
if (!containsUndefinedType(flowType)) {
|
|
84895
84904
|
return true;
|
|
84896
84905
|
}
|
|
84897
84906
|
}
|
|
@@ -84906,7 +84915,7 @@ var ts;
|
|
|
84906
84915
|
ts.setParent(reference, constructor);
|
|
84907
84916
|
reference.flowNode = constructor.returnFlowNode;
|
|
84908
84917
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84909
|
-
return !(
|
|
84918
|
+
return !containsUndefinedType(flowType);
|
|
84910
84919
|
}
|
|
84911
84920
|
function checkInterfaceDeclaration(node) {
|
|
84912
84921
|
// Grammar checking
|
|
@@ -85889,12 +85898,16 @@ var ts;
|
|
|
85889
85898
|
}
|
|
85890
85899
|
}
|
|
85891
85900
|
function checkSourceElementWorker(node) {
|
|
85892
|
-
|
|
85893
|
-
|
|
85894
|
-
|
|
85895
|
-
|
|
85901
|
+
ts.forEach(node.jsDoc, function (_a) {
|
|
85902
|
+
var comment = _a.comment, tags = _a.tags;
|
|
85903
|
+
checkJSDocCommentWorker(comment);
|
|
85904
|
+
ts.forEach(tags, function (tag) {
|
|
85905
|
+
checkJSDocCommentWorker(tag.comment);
|
|
85906
|
+
if (ts.isInJSFile(node)) {
|
|
85907
|
+
checkSourceElement(tag);
|
|
85908
|
+
}
|
|
85896
85909
|
});
|
|
85897
|
-
}
|
|
85910
|
+
});
|
|
85898
85911
|
var kind = node.kind;
|
|
85899
85912
|
if (cancellationToken) {
|
|
85900
85913
|
// Only bother checking on a few construct kinds. We don't want to be excessively
|
|
@@ -85980,6 +85993,10 @@ var ts;
|
|
|
85980
85993
|
return checkJSDocTemplateTag(node);
|
|
85981
85994
|
case 343 /* JSDocTypeTag */:
|
|
85982
85995
|
return checkJSDocTypeTag(node);
|
|
85996
|
+
case 324 /* JSDocLink */:
|
|
85997
|
+
case 325 /* JSDocLinkCode */:
|
|
85998
|
+
case 326 /* JSDocLinkPlain */:
|
|
85999
|
+
return checkJSDocLinkLikeTag(node);
|
|
85983
86000
|
case 340 /* JSDocParameterTag */:
|
|
85984
86001
|
return checkJSDocParameterTag(node);
|
|
85985
86002
|
case 347 /* JSDocPropertyTag */:
|
|
@@ -86074,6 +86091,15 @@ var ts;
|
|
|
86074
86091
|
return checkMissingDeclaration(node);
|
|
86075
86092
|
}
|
|
86076
86093
|
}
|
|
86094
|
+
function checkJSDocCommentWorker(node) {
|
|
86095
|
+
if (ts.isArray(node)) {
|
|
86096
|
+
ts.forEach(node, function (tag) {
|
|
86097
|
+
if (ts.isJSDocLinkLike(tag)) {
|
|
86098
|
+
checkSourceElement(tag);
|
|
86099
|
+
}
|
|
86100
|
+
});
|
|
86101
|
+
}
|
|
86102
|
+
}
|
|
86077
86103
|
function checkJSDocTypeIsInJsFile(node) {
|
|
86078
86104
|
if (!ts.isInJSFile(node)) {
|
|
86079
86105
|
grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
|
|
@@ -86629,7 +86655,7 @@ var ts;
|
|
|
86629
86655
|
if (!result && isJSDoc_1) {
|
|
86630
86656
|
var container = ts.findAncestor(name, ts.or(ts.isClassLike, ts.isInterfaceDeclaration));
|
|
86631
86657
|
if (container) {
|
|
86632
|
-
return resolveJSDocMemberName(name, getSymbolOfNode(container));
|
|
86658
|
+
return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container));
|
|
86633
86659
|
}
|
|
86634
86660
|
}
|
|
86635
86661
|
return result;
|
|
@@ -86675,11 +86701,11 @@ var ts;
|
|
|
86675
86701
|
*
|
|
86676
86702
|
* For unqualified names, a container K may be provided as a second argument.
|
|
86677
86703
|
*/
|
|
86678
|
-
function resolveJSDocMemberName(name, container) {
|
|
86704
|
+
function resolveJSDocMemberName(name, ignoreErrors, container) {
|
|
86679
86705
|
if (ts.isEntityName(name)) {
|
|
86680
86706
|
// resolve static values first
|
|
86681
86707
|
var meaning = 788968 /* Type */ | 1920 /* Namespace */ | 111551 /* Value */;
|
|
86682
|
-
var symbol = resolveEntityName(name, meaning,
|
|
86708
|
+
var symbol = resolveEntityName(name, meaning, ignoreErrors, /*dontResolveAlias*/ true, ts.getHostSignatureFromJSDoc(name));
|
|
86683
86709
|
if (!symbol && ts.isIdentifier(name) && container) {
|
|
86684
86710
|
symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(container), name.escapedText, meaning));
|
|
86685
86711
|
}
|
|
@@ -86687,7 +86713,7 @@ var ts;
|
|
|
86687
86713
|
return symbol;
|
|
86688
86714
|
}
|
|
86689
86715
|
}
|
|
86690
|
-
var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left);
|
|
86716
|
+
var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left, ignoreErrors, container);
|
|
86691
86717
|
var right = ts.isIdentifier(name) ? name.escapedText : name.right.escapedText;
|
|
86692
86718
|
if (left) {
|
|
86693
86719
|
var proto = left.flags & 111551 /* Value */ && getPropertyOfType(getTypeOfSymbol(left), "prototype");
|
|
@@ -136981,7 +137007,7 @@ var ts;
|
|
|
136981
137007
|
}
|
|
136982
137008
|
var str = "{";
|
|
136983
137009
|
for (var key in value) {
|
|
136984
|
-
if (ts.
|
|
137010
|
+
if (ts.hasProperty(value, key)) {
|
|
136985
137011
|
str += key + ": " + compilerOptionValueToString(value[key]);
|
|
136986
137012
|
}
|
|
136987
137013
|
}
|
|
@@ -159909,14 +159935,14 @@ var ts;
|
|
|
159909
159935
|
if (!exportNode || (!ts.isSourceFile(exportNode.parent) && !(ts.isModuleBlock(exportNode.parent) && ts.isAmbientModule(exportNode.parent.parent)))) {
|
|
159910
159936
|
return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_export_statement) };
|
|
159911
159937
|
}
|
|
159912
|
-
var
|
|
159938
|
+
var checker = program.getTypeChecker();
|
|
159939
|
+
var exportingModuleSymbol = getExportingModuleSymbol(exportNode, checker);
|
|
159913
159940
|
var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 513 /* ExportDefault */ : 0 /* None */);
|
|
159914
159941
|
var wasDefault = !!(flags & 512 /* Default */);
|
|
159915
159942
|
// If source file already has a default export, don't offer refactor.
|
|
159916
159943
|
if (!(flags & 1 /* Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* Default */)) {
|
|
159917
159944
|
return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.This_file_already_has_a_default_export) };
|
|
159918
159945
|
}
|
|
159919
|
-
var checker = program.getTypeChecker();
|
|
159920
159946
|
var noSymbolError = function (id) {
|
|
159921
159947
|
return (ts.isIdentifier(id) && checker.getSymbolAtLocation(id)) ? undefined
|
|
159922
159948
|
: { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_named_export) };
|
|
@@ -160008,6 +160034,8 @@ var ts;
|
|
|
160008
160034
|
var checker = program.getTypeChecker();
|
|
160009
160035
|
var exportSymbol = ts.Debug.checkDefined(checker.getSymbolAtLocation(exportName), "Export name should resolve to a symbol");
|
|
160010
160036
|
ts.FindAllReferences.Core.eachExportReference(program.getSourceFiles(), checker, cancellationToken, exportSymbol, exportingModuleSymbol, exportName.text, wasDefault, function (ref) {
|
|
160037
|
+
if (exportName === ref)
|
|
160038
|
+
return;
|
|
160011
160039
|
var importingSourceFile = ref.getSourceFile();
|
|
160012
160040
|
if (wasDefault) {
|
|
160013
160041
|
changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName.text);
|
|
@@ -160100,6 +160128,17 @@ var ts;
|
|
|
160100
160128
|
function makeExportSpecifier(propertyName, name) {
|
|
160101
160129
|
return ts.factory.createExportSpecifier(/*isTypeOnly*/ false, propertyName === name ? undefined : ts.factory.createIdentifier(propertyName), ts.factory.createIdentifier(name));
|
|
160102
160130
|
}
|
|
160131
|
+
function getExportingModuleSymbol(node, checker) {
|
|
160132
|
+
var parent = node.parent;
|
|
160133
|
+
if (ts.isSourceFile(parent)) {
|
|
160134
|
+
return parent.symbol;
|
|
160135
|
+
}
|
|
160136
|
+
var symbol = parent.parent.symbol;
|
|
160137
|
+
if (symbol.valueDeclaration && ts.isExternalModuleAugmentation(symbol.valueDeclaration)) {
|
|
160138
|
+
return checker.getMergedSymbol(symbol);
|
|
160139
|
+
}
|
|
160140
|
+
return symbol;
|
|
160141
|
+
}
|
|
160103
160142
|
})(refactor = ts.refactor || (ts.refactor = {}));
|
|
160104
160143
|
})(ts || (ts = {}));
|
|
160105
160144
|
/* @internal */
|
package/lib/typescript.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220608";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -39238,6 +39238,7 @@ var ts;
|
|
|
39238
39238
|
["es2022.error", "lib.es2022.error.d.ts"],
|
|
39239
39239
|
["es2022.intl", "lib.es2022.intl.d.ts"],
|
|
39240
39240
|
["es2022.object", "lib.es2022.object.d.ts"],
|
|
39241
|
+
["es2022.sharedmemory", "lib.es2022.sharedmemory.d.ts"],
|
|
39241
39242
|
["es2022.string", "lib.es2022.string.d.ts"],
|
|
39242
39243
|
["esnext.array", "lib.es2022.array.d.ts"],
|
|
39243
39244
|
["esnext.symbol", "lib.es2019.symbol.d.ts"],
|
|
@@ -64621,6 +64622,9 @@ var ts;
|
|
|
64621
64622
|
}
|
|
64622
64623
|
return false;
|
|
64623
64624
|
}
|
|
64625
|
+
function containsUndefinedType(type) {
|
|
64626
|
+
return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 32768 /* Undefined */);
|
|
64627
|
+
}
|
|
64624
64628
|
function isStringIndexSignatureOnlyType(type) {
|
|
64625
64629
|
return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
|
|
64626
64630
|
type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
|
|
@@ -72005,7 +72009,7 @@ var ts;
|
|
|
72005
72009
|
return convertAutoToAny(flowType);
|
|
72006
72010
|
}
|
|
72007
72011
|
}
|
|
72008
|
-
else if (!assumeInitialized && !(
|
|
72012
|
+
else if (!assumeInitialized && !containsUndefinedType(type) && containsUndefinedType(flowType)) {
|
|
72009
72013
|
error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
72010
72014
|
// Return the declared type to reduce follow-on errors
|
|
72011
72015
|
return type;
|
|
@@ -75016,7 +75020,7 @@ var ts;
|
|
|
75016
75020
|
assumeUninitialized = true;
|
|
75017
75021
|
}
|
|
75018
75022
|
var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
75019
|
-
if (assumeUninitialized && !(
|
|
75023
|
+
if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) {
|
|
75020
75024
|
error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); // TODO: GH#18217
|
|
75021
75025
|
// Return the declared type to reduce follow-on errors
|
|
75022
75026
|
return propType;
|
|
@@ -82095,6 +82099,11 @@ var ts;
|
|
|
82095
82099
|
function checkJSDocTypeTag(node) {
|
|
82096
82100
|
checkSourceElement(node.typeExpression);
|
|
82097
82101
|
}
|
|
82102
|
+
function checkJSDocLinkLikeTag(node) {
|
|
82103
|
+
if (node.name) {
|
|
82104
|
+
resolveJSDocMemberName(node.name, /*ignoreErrors*/ true);
|
|
82105
|
+
}
|
|
82106
|
+
}
|
|
82098
82107
|
function checkJSDocParameterTag(node) {
|
|
82099
82108
|
checkSourceElement(node.typeExpression);
|
|
82100
82109
|
}
|
|
@@ -84866,7 +84875,7 @@ var ts;
|
|
|
84866
84875
|
var propName = member.name;
|
|
84867
84876
|
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
84868
84877
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
84869
|
-
if (!(type.flags & 3 /* AnyOrUnknown */ ||
|
|
84878
|
+
if (!(type.flags & 3 /* AnyOrUnknown */ || containsUndefinedType(type))) {
|
|
84870
84879
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
84871
84880
|
error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
|
|
84872
84881
|
}
|
|
@@ -84891,7 +84900,7 @@ var ts;
|
|
|
84891
84900
|
ts.setParent(reference, staticBlock);
|
|
84892
84901
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
84893
84902
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84894
|
-
if (!(
|
|
84903
|
+
if (!containsUndefinedType(flowType)) {
|
|
84895
84904
|
return true;
|
|
84896
84905
|
}
|
|
84897
84906
|
}
|
|
@@ -84906,7 +84915,7 @@ var ts;
|
|
|
84906
84915
|
ts.setParent(reference, constructor);
|
|
84907
84916
|
reference.flowNode = constructor.returnFlowNode;
|
|
84908
84917
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84909
|
-
return !(
|
|
84918
|
+
return !containsUndefinedType(flowType);
|
|
84910
84919
|
}
|
|
84911
84920
|
function checkInterfaceDeclaration(node) {
|
|
84912
84921
|
// Grammar checking
|
|
@@ -85889,12 +85898,16 @@ var ts;
|
|
|
85889
85898
|
}
|
|
85890
85899
|
}
|
|
85891
85900
|
function checkSourceElementWorker(node) {
|
|
85892
|
-
|
|
85893
|
-
|
|
85894
|
-
|
|
85895
|
-
|
|
85901
|
+
ts.forEach(node.jsDoc, function (_a) {
|
|
85902
|
+
var comment = _a.comment, tags = _a.tags;
|
|
85903
|
+
checkJSDocCommentWorker(comment);
|
|
85904
|
+
ts.forEach(tags, function (tag) {
|
|
85905
|
+
checkJSDocCommentWorker(tag.comment);
|
|
85906
|
+
if (ts.isInJSFile(node)) {
|
|
85907
|
+
checkSourceElement(tag);
|
|
85908
|
+
}
|
|
85896
85909
|
});
|
|
85897
|
-
}
|
|
85910
|
+
});
|
|
85898
85911
|
var kind = node.kind;
|
|
85899
85912
|
if (cancellationToken) {
|
|
85900
85913
|
// Only bother checking on a few construct kinds. We don't want to be excessively
|
|
@@ -85980,6 +85993,10 @@ var ts;
|
|
|
85980
85993
|
return checkJSDocTemplateTag(node);
|
|
85981
85994
|
case 343 /* JSDocTypeTag */:
|
|
85982
85995
|
return checkJSDocTypeTag(node);
|
|
85996
|
+
case 324 /* JSDocLink */:
|
|
85997
|
+
case 325 /* JSDocLinkCode */:
|
|
85998
|
+
case 326 /* JSDocLinkPlain */:
|
|
85999
|
+
return checkJSDocLinkLikeTag(node);
|
|
85983
86000
|
case 340 /* JSDocParameterTag */:
|
|
85984
86001
|
return checkJSDocParameterTag(node);
|
|
85985
86002
|
case 347 /* JSDocPropertyTag */:
|
|
@@ -86074,6 +86091,15 @@ var ts;
|
|
|
86074
86091
|
return checkMissingDeclaration(node);
|
|
86075
86092
|
}
|
|
86076
86093
|
}
|
|
86094
|
+
function checkJSDocCommentWorker(node) {
|
|
86095
|
+
if (ts.isArray(node)) {
|
|
86096
|
+
ts.forEach(node, function (tag) {
|
|
86097
|
+
if (ts.isJSDocLinkLike(tag)) {
|
|
86098
|
+
checkSourceElement(tag);
|
|
86099
|
+
}
|
|
86100
|
+
});
|
|
86101
|
+
}
|
|
86102
|
+
}
|
|
86077
86103
|
function checkJSDocTypeIsInJsFile(node) {
|
|
86078
86104
|
if (!ts.isInJSFile(node)) {
|
|
86079
86105
|
grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
|
|
@@ -86629,7 +86655,7 @@ var ts;
|
|
|
86629
86655
|
if (!result && isJSDoc_1) {
|
|
86630
86656
|
var container = ts.findAncestor(name, ts.or(ts.isClassLike, ts.isInterfaceDeclaration));
|
|
86631
86657
|
if (container) {
|
|
86632
|
-
return resolveJSDocMemberName(name, getSymbolOfNode(container));
|
|
86658
|
+
return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container));
|
|
86633
86659
|
}
|
|
86634
86660
|
}
|
|
86635
86661
|
return result;
|
|
@@ -86675,11 +86701,11 @@ var ts;
|
|
|
86675
86701
|
*
|
|
86676
86702
|
* For unqualified names, a container K may be provided as a second argument.
|
|
86677
86703
|
*/
|
|
86678
|
-
function resolveJSDocMemberName(name, container) {
|
|
86704
|
+
function resolveJSDocMemberName(name, ignoreErrors, container) {
|
|
86679
86705
|
if (ts.isEntityName(name)) {
|
|
86680
86706
|
// resolve static values first
|
|
86681
86707
|
var meaning = 788968 /* Type */ | 1920 /* Namespace */ | 111551 /* Value */;
|
|
86682
|
-
var symbol = resolveEntityName(name, meaning,
|
|
86708
|
+
var symbol = resolveEntityName(name, meaning, ignoreErrors, /*dontResolveAlias*/ true, ts.getHostSignatureFromJSDoc(name));
|
|
86683
86709
|
if (!symbol && ts.isIdentifier(name) && container) {
|
|
86684
86710
|
symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(container), name.escapedText, meaning));
|
|
86685
86711
|
}
|
|
@@ -86687,7 +86713,7 @@ var ts;
|
|
|
86687
86713
|
return symbol;
|
|
86688
86714
|
}
|
|
86689
86715
|
}
|
|
86690
|
-
var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left);
|
|
86716
|
+
var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left, ignoreErrors, container);
|
|
86691
86717
|
var right = ts.isIdentifier(name) ? name.escapedText : name.right.escapedText;
|
|
86692
86718
|
if (left) {
|
|
86693
86719
|
var proto = left.flags & 111551 /* Value */ && getPropertyOfType(getTypeOfSymbol(left), "prototype");
|
|
@@ -136981,7 +137007,7 @@ var ts;
|
|
|
136981
137007
|
}
|
|
136982
137008
|
var str = "{";
|
|
136983
137009
|
for (var key in value) {
|
|
136984
|
-
if (ts.
|
|
137010
|
+
if (ts.hasProperty(value, key)) {
|
|
136985
137011
|
str += key + ": " + compilerOptionValueToString(value[key]);
|
|
136986
137012
|
}
|
|
136987
137013
|
}
|
|
@@ -159909,14 +159935,14 @@ var ts;
|
|
|
159909
159935
|
if (!exportNode || (!ts.isSourceFile(exportNode.parent) && !(ts.isModuleBlock(exportNode.parent) && ts.isAmbientModule(exportNode.parent.parent)))) {
|
|
159910
159936
|
return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_export_statement) };
|
|
159911
159937
|
}
|
|
159912
|
-
var
|
|
159938
|
+
var checker = program.getTypeChecker();
|
|
159939
|
+
var exportingModuleSymbol = getExportingModuleSymbol(exportNode, checker);
|
|
159913
159940
|
var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 513 /* ExportDefault */ : 0 /* None */);
|
|
159914
159941
|
var wasDefault = !!(flags & 512 /* Default */);
|
|
159915
159942
|
// If source file already has a default export, don't offer refactor.
|
|
159916
159943
|
if (!(flags & 1 /* Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* Default */)) {
|
|
159917
159944
|
return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.This_file_already_has_a_default_export) };
|
|
159918
159945
|
}
|
|
159919
|
-
var checker = program.getTypeChecker();
|
|
159920
159946
|
var noSymbolError = function (id) {
|
|
159921
159947
|
return (ts.isIdentifier(id) && checker.getSymbolAtLocation(id)) ? undefined
|
|
159922
159948
|
: { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_named_export) };
|
|
@@ -160008,6 +160034,8 @@ var ts;
|
|
|
160008
160034
|
var checker = program.getTypeChecker();
|
|
160009
160035
|
var exportSymbol = ts.Debug.checkDefined(checker.getSymbolAtLocation(exportName), "Export name should resolve to a symbol");
|
|
160010
160036
|
ts.FindAllReferences.Core.eachExportReference(program.getSourceFiles(), checker, cancellationToken, exportSymbol, exportingModuleSymbol, exportName.text, wasDefault, function (ref) {
|
|
160037
|
+
if (exportName === ref)
|
|
160038
|
+
return;
|
|
160011
160039
|
var importingSourceFile = ref.getSourceFile();
|
|
160012
160040
|
if (wasDefault) {
|
|
160013
160041
|
changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName.text);
|
|
@@ -160100,6 +160128,17 @@ var ts;
|
|
|
160100
160128
|
function makeExportSpecifier(propertyName, name) {
|
|
160101
160129
|
return ts.factory.createExportSpecifier(/*isTypeOnly*/ false, propertyName === name ? undefined : ts.factory.createIdentifier(propertyName), ts.factory.createIdentifier(name));
|
|
160102
160130
|
}
|
|
160131
|
+
function getExportingModuleSymbol(node, checker) {
|
|
160132
|
+
var parent = node.parent;
|
|
160133
|
+
if (ts.isSourceFile(parent)) {
|
|
160134
|
+
return parent.symbol;
|
|
160135
|
+
}
|
|
160136
|
+
var symbol = parent.parent.symbol;
|
|
160137
|
+
if (symbol.valueDeclaration && ts.isExternalModuleAugmentation(symbol.valueDeclaration)) {
|
|
160138
|
+
return checker.getMergedSymbol(symbol);
|
|
160139
|
+
}
|
|
160140
|
+
return symbol;
|
|
160141
|
+
}
|
|
160103
160142
|
})(refactor = ts.refactor || (ts.refactor = {}));
|
|
160104
160143
|
})(ts || (ts = {}));
|
|
160105
160144
|
/* @internal */
|
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220608";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -39238,6 +39238,7 @@ var ts;
|
|
|
39238
39238
|
["es2022.error", "lib.es2022.error.d.ts"],
|
|
39239
39239
|
["es2022.intl", "lib.es2022.intl.d.ts"],
|
|
39240
39240
|
["es2022.object", "lib.es2022.object.d.ts"],
|
|
39241
|
+
["es2022.sharedmemory", "lib.es2022.sharedmemory.d.ts"],
|
|
39241
39242
|
["es2022.string", "lib.es2022.string.d.ts"],
|
|
39242
39243
|
["esnext.array", "lib.es2022.array.d.ts"],
|
|
39243
39244
|
["esnext.symbol", "lib.es2019.symbol.d.ts"],
|
|
@@ -64621,6 +64622,9 @@ var ts;
|
|
|
64621
64622
|
}
|
|
64622
64623
|
return false;
|
|
64623
64624
|
}
|
|
64625
|
+
function containsUndefinedType(type) {
|
|
64626
|
+
return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 32768 /* Undefined */);
|
|
64627
|
+
}
|
|
64624
64628
|
function isStringIndexSignatureOnlyType(type) {
|
|
64625
64629
|
return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
|
|
64626
64630
|
type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
|
|
@@ -72005,7 +72009,7 @@ var ts;
|
|
|
72005
72009
|
return convertAutoToAny(flowType);
|
|
72006
72010
|
}
|
|
72007
72011
|
}
|
|
72008
|
-
else if (!assumeInitialized && !(
|
|
72012
|
+
else if (!assumeInitialized && !containsUndefinedType(type) && containsUndefinedType(flowType)) {
|
|
72009
72013
|
error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
72010
72014
|
// Return the declared type to reduce follow-on errors
|
|
72011
72015
|
return type;
|
|
@@ -75016,7 +75020,7 @@ var ts;
|
|
|
75016
75020
|
assumeUninitialized = true;
|
|
75017
75021
|
}
|
|
75018
75022
|
var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
75019
|
-
if (assumeUninitialized && !(
|
|
75023
|
+
if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) {
|
|
75020
75024
|
error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); // TODO: GH#18217
|
|
75021
75025
|
// Return the declared type to reduce follow-on errors
|
|
75022
75026
|
return propType;
|
|
@@ -82095,6 +82099,11 @@ var ts;
|
|
|
82095
82099
|
function checkJSDocTypeTag(node) {
|
|
82096
82100
|
checkSourceElement(node.typeExpression);
|
|
82097
82101
|
}
|
|
82102
|
+
function checkJSDocLinkLikeTag(node) {
|
|
82103
|
+
if (node.name) {
|
|
82104
|
+
resolveJSDocMemberName(node.name, /*ignoreErrors*/ true);
|
|
82105
|
+
}
|
|
82106
|
+
}
|
|
82098
82107
|
function checkJSDocParameterTag(node) {
|
|
82099
82108
|
checkSourceElement(node.typeExpression);
|
|
82100
82109
|
}
|
|
@@ -84866,7 +84875,7 @@ var ts;
|
|
|
84866
84875
|
var propName = member.name;
|
|
84867
84876
|
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
84868
84877
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
84869
|
-
if (!(type.flags & 3 /* AnyOrUnknown */ ||
|
|
84878
|
+
if (!(type.flags & 3 /* AnyOrUnknown */ || containsUndefinedType(type))) {
|
|
84870
84879
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
84871
84880
|
error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
|
|
84872
84881
|
}
|
|
@@ -84891,7 +84900,7 @@ var ts;
|
|
|
84891
84900
|
ts.setParent(reference, staticBlock);
|
|
84892
84901
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
84893
84902
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84894
|
-
if (!(
|
|
84903
|
+
if (!containsUndefinedType(flowType)) {
|
|
84895
84904
|
return true;
|
|
84896
84905
|
}
|
|
84897
84906
|
}
|
|
@@ -84906,7 +84915,7 @@ var ts;
|
|
|
84906
84915
|
ts.setParent(reference, constructor);
|
|
84907
84916
|
reference.flowNode = constructor.returnFlowNode;
|
|
84908
84917
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84909
|
-
return !(
|
|
84918
|
+
return !containsUndefinedType(flowType);
|
|
84910
84919
|
}
|
|
84911
84920
|
function checkInterfaceDeclaration(node) {
|
|
84912
84921
|
// Grammar checking
|
|
@@ -85889,12 +85898,16 @@ var ts;
|
|
|
85889
85898
|
}
|
|
85890
85899
|
}
|
|
85891
85900
|
function checkSourceElementWorker(node) {
|
|
85892
|
-
|
|
85893
|
-
|
|
85894
|
-
|
|
85895
|
-
|
|
85901
|
+
ts.forEach(node.jsDoc, function (_a) {
|
|
85902
|
+
var comment = _a.comment, tags = _a.tags;
|
|
85903
|
+
checkJSDocCommentWorker(comment);
|
|
85904
|
+
ts.forEach(tags, function (tag) {
|
|
85905
|
+
checkJSDocCommentWorker(tag.comment);
|
|
85906
|
+
if (ts.isInJSFile(node)) {
|
|
85907
|
+
checkSourceElement(tag);
|
|
85908
|
+
}
|
|
85896
85909
|
});
|
|
85897
|
-
}
|
|
85910
|
+
});
|
|
85898
85911
|
var kind = node.kind;
|
|
85899
85912
|
if (cancellationToken) {
|
|
85900
85913
|
// Only bother checking on a few construct kinds. We don't want to be excessively
|
|
@@ -85980,6 +85993,10 @@ var ts;
|
|
|
85980
85993
|
return checkJSDocTemplateTag(node);
|
|
85981
85994
|
case 343 /* JSDocTypeTag */:
|
|
85982
85995
|
return checkJSDocTypeTag(node);
|
|
85996
|
+
case 324 /* JSDocLink */:
|
|
85997
|
+
case 325 /* JSDocLinkCode */:
|
|
85998
|
+
case 326 /* JSDocLinkPlain */:
|
|
85999
|
+
return checkJSDocLinkLikeTag(node);
|
|
85983
86000
|
case 340 /* JSDocParameterTag */:
|
|
85984
86001
|
return checkJSDocParameterTag(node);
|
|
85985
86002
|
case 347 /* JSDocPropertyTag */:
|
|
@@ -86074,6 +86091,15 @@ var ts;
|
|
|
86074
86091
|
return checkMissingDeclaration(node);
|
|
86075
86092
|
}
|
|
86076
86093
|
}
|
|
86094
|
+
function checkJSDocCommentWorker(node) {
|
|
86095
|
+
if (ts.isArray(node)) {
|
|
86096
|
+
ts.forEach(node, function (tag) {
|
|
86097
|
+
if (ts.isJSDocLinkLike(tag)) {
|
|
86098
|
+
checkSourceElement(tag);
|
|
86099
|
+
}
|
|
86100
|
+
});
|
|
86101
|
+
}
|
|
86102
|
+
}
|
|
86077
86103
|
function checkJSDocTypeIsInJsFile(node) {
|
|
86078
86104
|
if (!ts.isInJSFile(node)) {
|
|
86079
86105
|
grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
|
|
@@ -86629,7 +86655,7 @@ var ts;
|
|
|
86629
86655
|
if (!result && isJSDoc_1) {
|
|
86630
86656
|
var container = ts.findAncestor(name, ts.or(ts.isClassLike, ts.isInterfaceDeclaration));
|
|
86631
86657
|
if (container) {
|
|
86632
|
-
return resolveJSDocMemberName(name, getSymbolOfNode(container));
|
|
86658
|
+
return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container));
|
|
86633
86659
|
}
|
|
86634
86660
|
}
|
|
86635
86661
|
return result;
|
|
@@ -86675,11 +86701,11 @@ var ts;
|
|
|
86675
86701
|
*
|
|
86676
86702
|
* For unqualified names, a container K may be provided as a second argument.
|
|
86677
86703
|
*/
|
|
86678
|
-
function resolveJSDocMemberName(name, container) {
|
|
86704
|
+
function resolveJSDocMemberName(name, ignoreErrors, container) {
|
|
86679
86705
|
if (ts.isEntityName(name)) {
|
|
86680
86706
|
// resolve static values first
|
|
86681
86707
|
var meaning = 788968 /* Type */ | 1920 /* Namespace */ | 111551 /* Value */;
|
|
86682
|
-
var symbol = resolveEntityName(name, meaning,
|
|
86708
|
+
var symbol = resolveEntityName(name, meaning, ignoreErrors, /*dontResolveAlias*/ true, ts.getHostSignatureFromJSDoc(name));
|
|
86683
86709
|
if (!symbol && ts.isIdentifier(name) && container) {
|
|
86684
86710
|
symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(container), name.escapedText, meaning));
|
|
86685
86711
|
}
|
|
@@ -86687,7 +86713,7 @@ var ts;
|
|
|
86687
86713
|
return symbol;
|
|
86688
86714
|
}
|
|
86689
86715
|
}
|
|
86690
|
-
var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left);
|
|
86716
|
+
var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left, ignoreErrors, container);
|
|
86691
86717
|
var right = ts.isIdentifier(name) ? name.escapedText : name.right.escapedText;
|
|
86692
86718
|
if (left) {
|
|
86693
86719
|
var proto = left.flags & 111551 /* Value */ && getPropertyOfType(getTypeOfSymbol(left), "prototype");
|
|
@@ -136981,7 +137007,7 @@ var ts;
|
|
|
136981
137007
|
}
|
|
136982
137008
|
var str = "{";
|
|
136983
137009
|
for (var key in value) {
|
|
136984
|
-
if (ts.
|
|
137010
|
+
if (ts.hasProperty(value, key)) {
|
|
136985
137011
|
str += key + ": " + compilerOptionValueToString(value[key]);
|
|
136986
137012
|
}
|
|
136987
137013
|
}
|
|
@@ -159909,14 +159935,14 @@ var ts;
|
|
|
159909
159935
|
if (!exportNode || (!ts.isSourceFile(exportNode.parent) && !(ts.isModuleBlock(exportNode.parent) && ts.isAmbientModule(exportNode.parent.parent)))) {
|
|
159910
159936
|
return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_export_statement) };
|
|
159911
159937
|
}
|
|
159912
|
-
var
|
|
159938
|
+
var checker = program.getTypeChecker();
|
|
159939
|
+
var exportingModuleSymbol = getExportingModuleSymbol(exportNode, checker);
|
|
159913
159940
|
var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 513 /* ExportDefault */ : 0 /* None */);
|
|
159914
159941
|
var wasDefault = !!(flags & 512 /* Default */);
|
|
159915
159942
|
// If source file already has a default export, don't offer refactor.
|
|
159916
159943
|
if (!(flags & 1 /* Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* Default */)) {
|
|
159917
159944
|
return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.This_file_already_has_a_default_export) };
|
|
159918
159945
|
}
|
|
159919
|
-
var checker = program.getTypeChecker();
|
|
159920
159946
|
var noSymbolError = function (id) {
|
|
159921
159947
|
return (ts.isIdentifier(id) && checker.getSymbolAtLocation(id)) ? undefined
|
|
159922
159948
|
: { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_named_export) };
|
|
@@ -160008,6 +160034,8 @@ var ts;
|
|
|
160008
160034
|
var checker = program.getTypeChecker();
|
|
160009
160035
|
var exportSymbol = ts.Debug.checkDefined(checker.getSymbolAtLocation(exportName), "Export name should resolve to a symbol");
|
|
160010
160036
|
ts.FindAllReferences.Core.eachExportReference(program.getSourceFiles(), checker, cancellationToken, exportSymbol, exportingModuleSymbol, exportName.text, wasDefault, function (ref) {
|
|
160037
|
+
if (exportName === ref)
|
|
160038
|
+
return;
|
|
160011
160039
|
var importingSourceFile = ref.getSourceFile();
|
|
160012
160040
|
if (wasDefault) {
|
|
160013
160041
|
changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName.text);
|
|
@@ -160100,6 +160128,17 @@ var ts;
|
|
|
160100
160128
|
function makeExportSpecifier(propertyName, name) {
|
|
160101
160129
|
return ts.factory.createExportSpecifier(/*isTypeOnly*/ false, propertyName === name ? undefined : ts.factory.createIdentifier(propertyName), ts.factory.createIdentifier(name));
|
|
160102
160130
|
}
|
|
160131
|
+
function getExportingModuleSymbol(node, checker) {
|
|
160132
|
+
var parent = node.parent;
|
|
160133
|
+
if (ts.isSourceFile(parent)) {
|
|
160134
|
+
return parent.symbol;
|
|
160135
|
+
}
|
|
160136
|
+
var symbol = parent.parent.symbol;
|
|
160137
|
+
if (symbol.valueDeclaration && ts.isExternalModuleAugmentation(symbol.valueDeclaration)) {
|
|
160138
|
+
return checker.getMergedSymbol(symbol);
|
|
160139
|
+
}
|
|
160140
|
+
return symbol;
|
|
160141
|
+
}
|
|
160103
160142
|
})(refactor = ts.refactor || (ts.refactor = {}));
|
|
160104
160143
|
})(ts || (ts = {}));
|
|
160105
160144
|
/* @internal */
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220608";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -39033,6 +39033,7 @@ var ts;
|
|
|
39033
39033
|
["es2022.error", "lib.es2022.error.d.ts"],
|
|
39034
39034
|
["es2022.intl", "lib.es2022.intl.d.ts"],
|
|
39035
39035
|
["es2022.object", "lib.es2022.object.d.ts"],
|
|
39036
|
+
["es2022.sharedmemory", "lib.es2022.sharedmemory.d.ts"],
|
|
39036
39037
|
["es2022.string", "lib.es2022.string.d.ts"],
|
|
39037
39038
|
["esnext.array", "lib.es2022.array.d.ts"],
|
|
39038
39039
|
["esnext.symbol", "lib.es2019.symbol.d.ts"],
|
|
@@ -64416,6 +64417,9 @@ var ts;
|
|
|
64416
64417
|
}
|
|
64417
64418
|
return false;
|
|
64418
64419
|
}
|
|
64420
|
+
function containsUndefinedType(type) {
|
|
64421
|
+
return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 32768 /* Undefined */);
|
|
64422
|
+
}
|
|
64419
64423
|
function isStringIndexSignatureOnlyType(type) {
|
|
64420
64424
|
return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
|
|
64421
64425
|
type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
|
|
@@ -71800,7 +71804,7 @@ var ts;
|
|
|
71800
71804
|
return convertAutoToAny(flowType);
|
|
71801
71805
|
}
|
|
71802
71806
|
}
|
|
71803
|
-
else if (!assumeInitialized && !(
|
|
71807
|
+
else if (!assumeInitialized && !containsUndefinedType(type) && containsUndefinedType(flowType)) {
|
|
71804
71808
|
error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
71805
71809
|
// Return the declared type to reduce follow-on errors
|
|
71806
71810
|
return type;
|
|
@@ -74811,7 +74815,7 @@ var ts;
|
|
|
74811
74815
|
assumeUninitialized = true;
|
|
74812
74816
|
}
|
|
74813
74817
|
var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
74814
|
-
if (assumeUninitialized && !(
|
|
74818
|
+
if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) {
|
|
74815
74819
|
error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); // TODO: GH#18217
|
|
74816
74820
|
// Return the declared type to reduce follow-on errors
|
|
74817
74821
|
return propType;
|
|
@@ -81890,6 +81894,11 @@ var ts;
|
|
|
81890
81894
|
function checkJSDocTypeTag(node) {
|
|
81891
81895
|
checkSourceElement(node.typeExpression);
|
|
81892
81896
|
}
|
|
81897
|
+
function checkJSDocLinkLikeTag(node) {
|
|
81898
|
+
if (node.name) {
|
|
81899
|
+
resolveJSDocMemberName(node.name, /*ignoreErrors*/ true);
|
|
81900
|
+
}
|
|
81901
|
+
}
|
|
81893
81902
|
function checkJSDocParameterTag(node) {
|
|
81894
81903
|
checkSourceElement(node.typeExpression);
|
|
81895
81904
|
}
|
|
@@ -84661,7 +84670,7 @@ var ts;
|
|
|
84661
84670
|
var propName = member.name;
|
|
84662
84671
|
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
84663
84672
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
84664
|
-
if (!(type.flags & 3 /* AnyOrUnknown */ ||
|
|
84673
|
+
if (!(type.flags & 3 /* AnyOrUnknown */ || containsUndefinedType(type))) {
|
|
84665
84674
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
84666
84675
|
error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
|
|
84667
84676
|
}
|
|
@@ -84686,7 +84695,7 @@ var ts;
|
|
|
84686
84695
|
ts.setParent(reference, staticBlock);
|
|
84687
84696
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
84688
84697
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84689
|
-
if (!(
|
|
84698
|
+
if (!containsUndefinedType(flowType)) {
|
|
84690
84699
|
return true;
|
|
84691
84700
|
}
|
|
84692
84701
|
}
|
|
@@ -84701,7 +84710,7 @@ var ts;
|
|
|
84701
84710
|
ts.setParent(reference, constructor);
|
|
84702
84711
|
reference.flowNode = constructor.returnFlowNode;
|
|
84703
84712
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84704
|
-
return !(
|
|
84713
|
+
return !containsUndefinedType(flowType);
|
|
84705
84714
|
}
|
|
84706
84715
|
function checkInterfaceDeclaration(node) {
|
|
84707
84716
|
// Grammar checking
|
|
@@ -85684,12 +85693,16 @@ var ts;
|
|
|
85684
85693
|
}
|
|
85685
85694
|
}
|
|
85686
85695
|
function checkSourceElementWorker(node) {
|
|
85687
|
-
|
|
85688
|
-
|
|
85689
|
-
|
|
85690
|
-
|
|
85696
|
+
ts.forEach(node.jsDoc, function (_a) {
|
|
85697
|
+
var comment = _a.comment, tags = _a.tags;
|
|
85698
|
+
checkJSDocCommentWorker(comment);
|
|
85699
|
+
ts.forEach(tags, function (tag) {
|
|
85700
|
+
checkJSDocCommentWorker(tag.comment);
|
|
85701
|
+
if (ts.isInJSFile(node)) {
|
|
85702
|
+
checkSourceElement(tag);
|
|
85703
|
+
}
|
|
85691
85704
|
});
|
|
85692
|
-
}
|
|
85705
|
+
});
|
|
85693
85706
|
var kind = node.kind;
|
|
85694
85707
|
if (cancellationToken) {
|
|
85695
85708
|
// Only bother checking on a few construct kinds. We don't want to be excessively
|
|
@@ -85775,6 +85788,10 @@ var ts;
|
|
|
85775
85788
|
return checkJSDocTemplateTag(node);
|
|
85776
85789
|
case 343 /* JSDocTypeTag */:
|
|
85777
85790
|
return checkJSDocTypeTag(node);
|
|
85791
|
+
case 324 /* JSDocLink */:
|
|
85792
|
+
case 325 /* JSDocLinkCode */:
|
|
85793
|
+
case 326 /* JSDocLinkPlain */:
|
|
85794
|
+
return checkJSDocLinkLikeTag(node);
|
|
85778
85795
|
case 340 /* JSDocParameterTag */:
|
|
85779
85796
|
return checkJSDocParameterTag(node);
|
|
85780
85797
|
case 347 /* JSDocPropertyTag */:
|
|
@@ -85869,6 +85886,15 @@ var ts;
|
|
|
85869
85886
|
return checkMissingDeclaration(node);
|
|
85870
85887
|
}
|
|
85871
85888
|
}
|
|
85889
|
+
function checkJSDocCommentWorker(node) {
|
|
85890
|
+
if (ts.isArray(node)) {
|
|
85891
|
+
ts.forEach(node, function (tag) {
|
|
85892
|
+
if (ts.isJSDocLinkLike(tag)) {
|
|
85893
|
+
checkSourceElement(tag);
|
|
85894
|
+
}
|
|
85895
|
+
});
|
|
85896
|
+
}
|
|
85897
|
+
}
|
|
85872
85898
|
function checkJSDocTypeIsInJsFile(node) {
|
|
85873
85899
|
if (!ts.isInJSFile(node)) {
|
|
85874
85900
|
grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
|
|
@@ -86424,7 +86450,7 @@ var ts;
|
|
|
86424
86450
|
if (!result && isJSDoc_1) {
|
|
86425
86451
|
var container = ts.findAncestor(name, ts.or(ts.isClassLike, ts.isInterfaceDeclaration));
|
|
86426
86452
|
if (container) {
|
|
86427
|
-
return resolveJSDocMemberName(name, getSymbolOfNode(container));
|
|
86453
|
+
return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container));
|
|
86428
86454
|
}
|
|
86429
86455
|
}
|
|
86430
86456
|
return result;
|
|
@@ -86470,11 +86496,11 @@ var ts;
|
|
|
86470
86496
|
*
|
|
86471
86497
|
* For unqualified names, a container K may be provided as a second argument.
|
|
86472
86498
|
*/
|
|
86473
|
-
function resolveJSDocMemberName(name, container) {
|
|
86499
|
+
function resolveJSDocMemberName(name, ignoreErrors, container) {
|
|
86474
86500
|
if (ts.isEntityName(name)) {
|
|
86475
86501
|
// resolve static values first
|
|
86476
86502
|
var meaning = 788968 /* Type */ | 1920 /* Namespace */ | 111551 /* Value */;
|
|
86477
|
-
var symbol = resolveEntityName(name, meaning,
|
|
86503
|
+
var symbol = resolveEntityName(name, meaning, ignoreErrors, /*dontResolveAlias*/ true, ts.getHostSignatureFromJSDoc(name));
|
|
86478
86504
|
if (!symbol && ts.isIdentifier(name) && container) {
|
|
86479
86505
|
symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(container), name.escapedText, meaning));
|
|
86480
86506
|
}
|
|
@@ -86482,7 +86508,7 @@ var ts;
|
|
|
86482
86508
|
return symbol;
|
|
86483
86509
|
}
|
|
86484
86510
|
}
|
|
86485
|
-
var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left);
|
|
86511
|
+
var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left, ignoreErrors, container);
|
|
86486
86512
|
var right = ts.isIdentifier(name) ? name.escapedText : name.right.escapedText;
|
|
86487
86513
|
if (left) {
|
|
86488
86514
|
var proto = left.flags & 111551 /* Value */ && getPropertyOfType(getTypeOfSymbol(left), "prototype");
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.8.0-dev.
|
|
5
|
+
"version": "4.8.0-dev.20220608",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
package/test.js
DELETED
package/test.ts
DELETED