typescript 5.3.0-dev.20230815 → 5.3.0-dev.20230817
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.decorators.d.ts +3 -6
- package/lib/lib.es2015.collection.d.ts +1 -2
- package/lib/lib.es2015.core.d.ts +1 -1
- package/lib/lib.es2015.iterable.d.ts +4 -5
- package/lib/lib.es2015.promise.d.ts +1 -1
- package/lib/lib.es2015.symbol.d.ts +1 -1
- package/lib/lib.es2016.array.include.d.ts +1 -1
- package/lib/lib.es2016.d.ts +1 -1
- package/lib/lib.es2016.full.d.ts +1 -1
- package/lib/lib.es2017.full.d.ts +1 -1
- package/lib/lib.es2017.intl.d.ts +11 -12
- package/lib/lib.es2017.object.d.ts +3 -3
- package/lib/lib.es2018.asynciterable.d.ts +1 -1
- package/lib/lib.es2018.full.d.ts +1 -1
- package/lib/lib.es2018.intl.d.ts +1 -2
- package/lib/lib.es2018.promise.d.ts +1 -1
- package/lib/lib.es2018.regexp.d.ts +5 -5
- package/lib/lib.es2019.array.d.ts +14 -18
- package/lib/lib.es2019.intl.d.ts +1 -1
- package/lib/lib.es2019.object.d.ts +1 -1
- package/lib/lib.es2020.bigint.d.ts +7 -7
- package/lib/lib.es2020.date.d.ts +1 -1
- package/lib/lib.es2020.intl.d.ts +11 -13
- package/lib/lib.es2020.promise.d.ts +1 -1
- package/lib/lib.es2021.intl.d.ts +5 -6
- package/lib/lib.es2021.promise.d.ts +3 -3
- package/lib/lib.es2021.weakref.d.ts +2 -2
- package/lib/lib.es2022.error.d.ts +2 -2
- package/lib/lib.es2022.intl.d.ts +1 -2
- package/lib/lib.es2022.sharedmemory.d.ts +2 -2
- package/lib/lib.es2023.array.d.ts +61 -61
- package/lib/lib.es5.d.ts +74 -88
- package/lib/lib.esnext.disposable.d.ts +10 -10
- package/lib/lib.esnext.full.d.ts +1 -1
- package/lib/lib.esnext.intl.d.ts +7 -7
- package/lib/lib.scripthost.d.ts +1 -4
- package/lib/lib.webworker.importscripts.d.ts +0 -1
- package/lib/tsc.js +1330 -1433
- package/lib/tsserver.js +1878 -2053
- package/lib/typescript.d.ts +339 -117
- package/lib/typescript.js +1876 -2053
- package/lib/typingsInstaller.js +134 -124
- package/package.json +4 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.3";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230817`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -1739,17 +1739,21 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1739
1739
|
return `${flowHeader}${remainingFlags ? ` (${formatFlowFlags(remainingFlags)})` : ""}`;
|
|
1740
1740
|
}
|
|
1741
1741
|
},
|
|
1742
|
-
__debugFlowFlags: {
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1742
|
+
__debugFlowFlags: {
|
|
1743
|
+
get() {
|
|
1744
|
+
return formatEnum(
|
|
1745
|
+
this.flags,
|
|
1746
|
+
FlowFlags,
|
|
1747
|
+
/*isFlags*/
|
|
1748
|
+
true
|
|
1749
|
+
);
|
|
1750
|
+
}
|
|
1751
|
+
},
|
|
1752
|
+
__debugToString: {
|
|
1753
|
+
value() {
|
|
1754
|
+
return formatControlFlowGraph(this);
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1753
1757
|
});
|
|
1754
1758
|
}
|
|
1755
1759
|
}
|
|
@@ -1808,9 +1812,11 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1808
1812
|
return `${symbolHeader} '${symbolName(this)}'${remainingSymbolFlags ? ` (${formatSymbolFlags(remainingSymbolFlags)})` : ""}`;
|
|
1809
1813
|
}
|
|
1810
1814
|
},
|
|
1811
|
-
__debugFlags: {
|
|
1812
|
-
|
|
1813
|
-
|
|
1815
|
+
__debugFlags: {
|
|
1816
|
+
get() {
|
|
1817
|
+
return formatSymbolFlags(this.flags);
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1814
1820
|
});
|
|
1815
1821
|
Object.defineProperties(objectAllocator.getTypeConstructor().prototype, {
|
|
1816
1822
|
// for use with vscode-js-debug's new customDescriptionGenerator in launch.json
|
|
@@ -1821,12 +1827,16 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1821
1827
|
return `${typeHeader}${this.symbol ? ` '${symbolName(this.symbol)}'` : ""}${remainingObjectFlags ? ` (${formatObjectFlags(remainingObjectFlags)})` : ""}`;
|
|
1822
1828
|
}
|
|
1823
1829
|
},
|
|
1824
|
-
__debugFlags: {
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
+
__debugFlags: {
|
|
1831
|
+
get() {
|
|
1832
|
+
return formatTypeFlags(this.flags);
|
|
1833
|
+
}
|
|
1834
|
+
},
|
|
1835
|
+
__debugObjectFlags: {
|
|
1836
|
+
get() {
|
|
1837
|
+
return this.flags & 524288 /* Object */ ? formatObjectFlags(this.objectFlags) : "";
|
|
1838
|
+
}
|
|
1839
|
+
},
|
|
1830
1840
|
__debugTypeToString: {
|
|
1831
1841
|
value() {
|
|
1832
1842
|
let text = weakTypeTextMap.get(this);
|
|
@@ -1839,13 +1849,17 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1839
1849
|
}
|
|
1840
1850
|
});
|
|
1841
1851
|
Object.defineProperties(objectAllocator.getSignatureConstructor().prototype, {
|
|
1842
|
-
__debugFlags: {
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1852
|
+
__debugFlags: {
|
|
1853
|
+
get() {
|
|
1854
|
+
return formatSignatureFlags(this.flags);
|
|
1855
|
+
}
|
|
1856
|
+
},
|
|
1857
|
+
__debugSignatureToString: {
|
|
1858
|
+
value() {
|
|
1859
|
+
var _a;
|
|
1860
|
+
return (_a = this.checker) == null ? void 0 : _a.signatureToString(this);
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1849
1863
|
});
|
|
1850
1864
|
const nodeConstructors = [
|
|
1851
1865
|
objectAllocator.getNodeConstructor(),
|
|
@@ -1863,24 +1877,36 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1863
1877
|
return `${nodeHeader}${this.flags ? ` (${formatNodeFlags(this.flags)})` : ""}`;
|
|
1864
1878
|
}
|
|
1865
1879
|
},
|
|
1866
|
-
__debugKind: {
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1880
|
+
__debugKind: {
|
|
1881
|
+
get() {
|
|
1882
|
+
return formatSyntaxKind(this.kind);
|
|
1883
|
+
}
|
|
1884
|
+
},
|
|
1885
|
+
__debugNodeFlags: {
|
|
1886
|
+
get() {
|
|
1887
|
+
return formatNodeFlags(this.flags);
|
|
1888
|
+
}
|
|
1889
|
+
},
|
|
1890
|
+
__debugModifierFlags: {
|
|
1891
|
+
get() {
|
|
1892
|
+
return formatModifierFlags(getEffectiveModifierFlagsNoCache(this));
|
|
1893
|
+
}
|
|
1894
|
+
},
|
|
1895
|
+
__debugTransformFlags: {
|
|
1896
|
+
get() {
|
|
1897
|
+
return formatTransformFlags(this.transformFlags);
|
|
1898
|
+
}
|
|
1899
|
+
},
|
|
1900
|
+
__debugIsParseTreeNode: {
|
|
1901
|
+
get() {
|
|
1902
|
+
return isParseTreeNode(this);
|
|
1903
|
+
}
|
|
1904
|
+
},
|
|
1905
|
+
__debugEmitFlags: {
|
|
1906
|
+
get() {
|
|
1907
|
+
return formatEmitFlags(getEmitFlags(this));
|
|
1908
|
+
}
|
|
1909
|
+
},
|
|
1884
1910
|
__debugGetText: {
|
|
1885
1911
|
value(includeTrivia) {
|
|
1886
1912
|
if (nodeIsSynthesized(this))
|
|
@@ -2520,15 +2546,21 @@ function parseComparator(operator, text, comparators) {
|
|
|
2520
2546
|
switch (operator) {
|
|
2521
2547
|
case "~":
|
|
2522
2548
|
comparators.push(createComparator(">=", version2));
|
|
2523
|
-
comparators.push(createComparator(
|
|
2524
|
-
|
|
2525
|
-
|
|
2549
|
+
comparators.push(createComparator(
|
|
2550
|
+
"<",
|
|
2551
|
+
version2.increment(
|
|
2552
|
+
isWildcard(minor) ? "major" : "minor"
|
|
2553
|
+
)
|
|
2554
|
+
));
|
|
2526
2555
|
break;
|
|
2527
2556
|
case "^":
|
|
2528
2557
|
comparators.push(createComparator(">=", version2));
|
|
2529
|
-
comparators.push(createComparator(
|
|
2530
|
-
|
|
2531
|
-
|
|
2558
|
+
comparators.push(createComparator(
|
|
2559
|
+
"<",
|
|
2560
|
+
version2.increment(
|
|
2561
|
+
version2.major > 0 || isWildcard(minor) ? "major" : version2.minor > 0 || isWildcard(patch) ? "minor" : "patch"
|
|
2562
|
+
)
|
|
2563
|
+
));
|
|
2532
2564
|
break;
|
|
2533
2565
|
case "<":
|
|
2534
2566
|
case ">=":
|
|
@@ -2807,11 +2839,7 @@ var tracingEnabled;
|
|
|
2807
2839
|
const meta = { cat: "__metadata", ph: "M", ts: 1e3 * timestamp(), pid: 1, tid: 1 };
|
|
2808
2840
|
fs.writeSync(
|
|
2809
2841
|
traceFd,
|
|
2810
|
-
"[\n" + [
|
|
2811
|
-
{ name: "process_name", args: { name: "tsc" }, ...meta },
|
|
2812
|
-
{ name: "thread_name", args: { name: "Main" }, ...meta },
|
|
2813
|
-
{ name: "TracingStartedInBrowser", ...meta, cat: "disabled-by-default-devtools.timeline" }
|
|
2814
|
-
].map((v) => JSON.stringify(v)).join(",\n")
|
|
2842
|
+
"[\n" + [{ name: "process_name", args: { name: "tsc" }, ...meta }, { name: "thread_name", args: { name: "Main" }, ...meta }, { name: "TracingStartedInBrowser", ...meta, cat: "disabled-by-default-devtools.timeline" }].map((v) => JSON.stringify(v)).join(",\n")
|
|
2815
2843
|
);
|
|
2816
2844
|
}
|
|
2817
2845
|
tracingEnabled2.startTracing = startTracing2;
|
|
@@ -5297,7 +5325,9 @@ var sys = (() => {
|
|
|
5297
5325
|
})();
|
|
5298
5326
|
if (sys && sys.getEnvironmentVariable) {
|
|
5299
5327
|
setCustomPollingValues(sys);
|
|
5300
|
-
Debug.setAssertionLevel(
|
|
5328
|
+
Debug.setAssertionLevel(
|
|
5329
|
+
/^development$/i.test(sys.getEnvironmentVariable("NODE_ENV")) ? 1 /* Normal */ : 0 /* None */
|
|
5330
|
+
);
|
|
5301
5331
|
}
|
|
5302
5332
|
if (sys && sys.debugMode) {
|
|
5303
5333
|
Debug.isDebugging = true;
|
|
@@ -12422,16 +12452,14 @@ function createDiagnosticForNodeArrayFromMessageChain(sourceFile, nodes, message
|
|
|
12422
12452
|
const start = skipTrivia(sourceFile.text, nodes.pos);
|
|
12423
12453
|
return createFileDiagnosticFromMessageChain(sourceFile, start, nodes.end - start, messageChain, relatedInformation);
|
|
12424
12454
|
}
|
|
12425
|
-
function assertDiagnosticLocation(
|
|
12455
|
+
function assertDiagnosticLocation(sourceText, start, length2) {
|
|
12426
12456
|
Debug.assertGreaterThanOrEqual(start, 0);
|
|
12427
12457
|
Debug.assertGreaterThanOrEqual(length2, 0);
|
|
12428
|
-
|
|
12429
|
-
|
|
12430
|
-
Debug.assertLessThanOrEqual(start + length2, file.text.length);
|
|
12431
|
-
}
|
|
12458
|
+
Debug.assertLessThanOrEqual(start, sourceText.length);
|
|
12459
|
+
Debug.assertLessThanOrEqual(start + length2, sourceText.length);
|
|
12432
12460
|
}
|
|
12433
12461
|
function createFileDiagnosticFromMessageChain(file, start, length2, messageChain, relatedInformation) {
|
|
12434
|
-
assertDiagnosticLocation(file, start, length2);
|
|
12462
|
+
assertDiagnosticLocation(file.text, start, length2);
|
|
12435
12463
|
return {
|
|
12436
12464
|
file,
|
|
12437
12465
|
start,
|
|
@@ -12675,10 +12703,7 @@ function isPartOfTypeNode(node) {
|
|
|
12675
12703
|
} else if (node.parent.kind === 211 /* PropertyAccessExpression */ && node.parent.name === node) {
|
|
12676
12704
|
node = node.parent;
|
|
12677
12705
|
}
|
|
12678
|
-
Debug.assert(
|
|
12679
|
-
node.kind === 80 /* Identifier */ || node.kind === 166 /* QualifiedName */ || node.kind === 211 /* PropertyAccessExpression */,
|
|
12680
|
-
"'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."
|
|
12681
|
-
);
|
|
12706
|
+
Debug.assert(node.kind === 80 /* Identifier */ || node.kind === 166 /* QualifiedName */ || node.kind === 211 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
|
|
12682
12707
|
case 166 /* QualifiedName */:
|
|
12683
12708
|
case 211 /* PropertyAccessExpression */:
|
|
12684
12709
|
case 110 /* ThisKeyword */: {
|
|
@@ -12881,11 +12906,7 @@ function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
|
|
|
12881
12906
|
});
|
|
12882
12907
|
}
|
|
12883
12908
|
function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
|
|
12884
|
-
return forEachPropertyAssignment(
|
|
12885
|
-
objectLiteral,
|
|
12886
|
-
propKey,
|
|
12887
|
-
(property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0
|
|
12888
|
-
);
|
|
12909
|
+
return forEachPropertyAssignment(objectLiteral, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
|
|
12889
12910
|
}
|
|
12890
12911
|
function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
|
|
12891
12912
|
if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
|
|
@@ -13288,8 +13309,8 @@ function isInExpressionContext(node) {
|
|
|
13288
13309
|
return forStatement.initializer === node && forStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forStatement.condition === node || forStatement.incrementor === node;
|
|
13289
13310
|
case 249 /* ForInStatement */:
|
|
13290
13311
|
case 250 /* ForOfStatement */:
|
|
13291
|
-
const
|
|
13292
|
-
return
|
|
13312
|
+
const forInOrOfStatement = parent;
|
|
13313
|
+
return forInOrOfStatement.initializer === node && forInOrOfStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forInOrOfStatement.expression === node;
|
|
13293
13314
|
case 216 /* TypeAssertionExpression */:
|
|
13294
13315
|
case 234 /* AsExpression */:
|
|
13295
13316
|
return node === parent.expression;
|
|
@@ -13950,20 +13971,23 @@ function getTypeParameterFromJsDoc(node) {
|
|
|
13950
13971
|
const { typeParameters } = node.parent.parent.parent;
|
|
13951
13972
|
return typeParameters && find(typeParameters, (p) => p.name.escapedText === name);
|
|
13952
13973
|
}
|
|
13953
|
-
function
|
|
13974
|
+
function getAssignmentTarget(node) {
|
|
13954
13975
|
let parent = node.parent;
|
|
13955
13976
|
while (true) {
|
|
13956
13977
|
switch (parent.kind) {
|
|
13957
13978
|
case 226 /* BinaryExpression */:
|
|
13958
|
-
const
|
|
13959
|
-
|
|
13979
|
+
const binaryExpression = parent;
|
|
13980
|
+
const binaryOperator = binaryExpression.operatorToken.kind;
|
|
13981
|
+
return isAssignmentOperator(binaryOperator) && binaryExpression.left === node ? binaryExpression : void 0;
|
|
13960
13982
|
case 224 /* PrefixUnaryExpression */:
|
|
13961
13983
|
case 225 /* PostfixUnaryExpression */:
|
|
13962
|
-
const
|
|
13963
|
-
|
|
13984
|
+
const unaryExpression = parent;
|
|
13985
|
+
const unaryOperator = unaryExpression.operator;
|
|
13986
|
+
return unaryOperator === 46 /* PlusPlusToken */ || unaryOperator === 47 /* MinusMinusToken */ ? unaryExpression : void 0;
|
|
13964
13987
|
case 249 /* ForInStatement */:
|
|
13965
13988
|
case 250 /* ForOfStatement */:
|
|
13966
|
-
|
|
13989
|
+
const forInOrOfStatement = parent;
|
|
13990
|
+
return forInOrOfStatement.initializer === node ? forInOrOfStatement : void 0;
|
|
13967
13991
|
case 217 /* ParenthesizedExpression */:
|
|
13968
13992
|
case 209 /* ArrayLiteralExpression */:
|
|
13969
13993
|
case 230 /* SpreadElement */:
|
|
@@ -13975,24 +13999,53 @@ function getAssignmentTargetKind(node) {
|
|
|
13975
13999
|
break;
|
|
13976
14000
|
case 304 /* ShorthandPropertyAssignment */:
|
|
13977
14001
|
if (parent.name !== node) {
|
|
13978
|
-
return 0
|
|
14002
|
+
return void 0;
|
|
13979
14003
|
}
|
|
13980
14004
|
node = parent.parent;
|
|
13981
14005
|
break;
|
|
13982
14006
|
case 303 /* PropertyAssignment */:
|
|
13983
14007
|
if (parent.name === node) {
|
|
13984
|
-
return 0
|
|
14008
|
+
return void 0;
|
|
13985
14009
|
}
|
|
13986
14010
|
node = parent.parent;
|
|
13987
14011
|
break;
|
|
13988
14012
|
default:
|
|
13989
|
-
return 0
|
|
14013
|
+
return void 0;
|
|
13990
14014
|
}
|
|
13991
14015
|
parent = node.parent;
|
|
13992
14016
|
}
|
|
13993
14017
|
}
|
|
14018
|
+
function getAssignmentTargetKind(node) {
|
|
14019
|
+
const target = getAssignmentTarget(node);
|
|
14020
|
+
if (!target) {
|
|
14021
|
+
return 0 /* None */;
|
|
14022
|
+
}
|
|
14023
|
+
switch (target.kind) {
|
|
14024
|
+
case 226 /* BinaryExpression */:
|
|
14025
|
+
const binaryOperator = target.operatorToken.kind;
|
|
14026
|
+
return binaryOperator === 64 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */;
|
|
14027
|
+
case 224 /* PrefixUnaryExpression */:
|
|
14028
|
+
case 225 /* PostfixUnaryExpression */:
|
|
14029
|
+
return 2 /* Compound */;
|
|
14030
|
+
case 249 /* ForInStatement */:
|
|
14031
|
+
case 250 /* ForOfStatement */:
|
|
14032
|
+
return 1 /* Definite */;
|
|
14033
|
+
}
|
|
14034
|
+
}
|
|
13994
14035
|
function isAssignmentTarget(node) {
|
|
13995
|
-
return
|
|
14036
|
+
return !!getAssignmentTarget(node);
|
|
14037
|
+
}
|
|
14038
|
+
function isCompoundLikeAssignment(assignment) {
|
|
14039
|
+
const right = skipParentheses(assignment.right);
|
|
14040
|
+
return right.kind === 226 /* BinaryExpression */ && isShiftOperatorOrHigher(right.operatorToken.kind);
|
|
14041
|
+
}
|
|
14042
|
+
function isInCompoundLikeAssignment(node) {
|
|
14043
|
+
const target = getAssignmentTarget(node);
|
|
14044
|
+
return !!target && isAssignmentExpression(
|
|
14045
|
+
target,
|
|
14046
|
+
/*excludeCompoundAssignment*/
|
|
14047
|
+
true
|
|
14048
|
+
) && isCompoundLikeAssignment(target);
|
|
13996
14049
|
}
|
|
13997
14050
|
function isNodeWithPossibleHoistedDeclaration(node) {
|
|
13998
14051
|
switch (node.kind) {
|
|
@@ -15019,9 +15072,16 @@ function getSourceFilePathInNewDirWorker(fileName, newDirPath, currentDirectory,
|
|
|
15019
15072
|
return combinePaths(newDirPath, sourceFilePath);
|
|
15020
15073
|
}
|
|
15021
15074
|
function writeFile(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
|
|
15022
|
-
host.writeFile(
|
|
15023
|
-
|
|
15024
|
-
|
|
15075
|
+
host.writeFile(
|
|
15076
|
+
fileName,
|
|
15077
|
+
text,
|
|
15078
|
+
writeByteOrderMark,
|
|
15079
|
+
(hostErrorMessage) => {
|
|
15080
|
+
diagnostics.add(createCompilerDiagnostic(Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
|
|
15081
|
+
},
|
|
15082
|
+
sourceFiles,
|
|
15083
|
+
data
|
|
15084
|
+
);
|
|
15025
15085
|
}
|
|
15026
15086
|
function ensureDirectoriesExist(directoryPath, createDirectory, directoryExists) {
|
|
15027
15087
|
if (directoryPath.length > getRootLength(directoryPath) && !directoryExists(directoryPath)) {
|
|
@@ -15891,21 +15951,17 @@ function isUMDExportSymbol(symbol) {
|
|
|
15891
15951
|
}
|
|
15892
15952
|
function getLastChild(node) {
|
|
15893
15953
|
let lastChild;
|
|
15894
|
-
forEachChild(
|
|
15895
|
-
|
|
15896
|
-
|
|
15897
|
-
|
|
15898
|
-
|
|
15899
|
-
|
|
15900
|
-
|
|
15901
|
-
|
|
15902
|
-
if (nodeIsPresent(children[i])) {
|
|
15903
|
-
lastChild = children[i];
|
|
15904
|
-
break;
|
|
15905
|
-
}
|
|
15954
|
+
forEachChild(node, (child) => {
|
|
15955
|
+
if (nodeIsPresent(child))
|
|
15956
|
+
lastChild = child;
|
|
15957
|
+
}, (children) => {
|
|
15958
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
15959
|
+
if (nodeIsPresent(children[i])) {
|
|
15960
|
+
lastChild = children[i];
|
|
15961
|
+
break;
|
|
15906
15962
|
}
|
|
15907
15963
|
}
|
|
15908
|
-
);
|
|
15964
|
+
});
|
|
15909
15965
|
return lastChild;
|
|
15910
15966
|
}
|
|
15911
15967
|
function isTypeNodeKind(kind) {
|
|
@@ -16047,13 +16103,11 @@ function setLocalizedDiagnosticMessages(messages) {
|
|
|
16047
16103
|
function getLocaleSpecificMessage(message) {
|
|
16048
16104
|
return localizedDiagnosticMessages && localizedDiagnosticMessages[message.key] || message.message;
|
|
16049
16105
|
}
|
|
16050
|
-
function createDetachedDiagnostic(fileName, start, length2, message, ...args) {
|
|
16051
|
-
|
|
16052
|
-
|
|
16053
|
-
|
|
16054
|
-
|
|
16055
|
-
length2
|
|
16056
|
-
);
|
|
16106
|
+
function createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args) {
|
|
16107
|
+
if (start + length2 > sourceText.length) {
|
|
16108
|
+
length2 = sourceText.length - start;
|
|
16109
|
+
}
|
|
16110
|
+
assertDiagnosticLocation(sourceText, start, length2);
|
|
16057
16111
|
let text = getLocaleSpecificMessage(message);
|
|
16058
16112
|
if (some(args)) {
|
|
16059
16113
|
text = formatStringFromArgs(text, args);
|
|
@@ -16109,7 +16163,7 @@ function attachFileToDiagnostics(diagnostics, file) {
|
|
|
16109
16163
|
return diagnosticsWithLocation;
|
|
16110
16164
|
}
|
|
16111
16165
|
function createFileDiagnostic(file, start, length2, message, ...args) {
|
|
16112
|
-
assertDiagnosticLocation(file, start, length2);
|
|
16166
|
+
assertDiagnosticLocation(file.text, start, length2);
|
|
16113
16167
|
let text = getLocaleSpecificMessage(message);
|
|
16114
16168
|
if (some(args)) {
|
|
16115
16169
|
text = formatStringFromArgs(text, args);
|
|
@@ -25040,21 +25094,18 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
|
|
|
25040
25094
|
if (some(helperNames)) {
|
|
25041
25095
|
helperNames.sort(compareStringsCaseSensitive);
|
|
25042
25096
|
namedBindings = nodeFactory.createNamedImports(
|
|
25043
|
-
map(
|
|
25044
|
-
|
|
25045
|
-
|
|
25046
|
-
|
|
25047
|
-
|
|
25048
|
-
|
|
25049
|
-
|
|
25050
|
-
|
|
25051
|
-
|
|
25052
|
-
|
|
25053
|
-
|
|
25054
|
-
|
|
25055
|
-
helperFactory.getUnscopedHelperName(name)
|
|
25056
|
-
)
|
|
25057
|
-
)
|
|
25097
|
+
map(helperNames, (name) => isFileLevelUniqueName(sourceFile, name) ? nodeFactory.createImportSpecifier(
|
|
25098
|
+
/*isTypeOnly*/
|
|
25099
|
+
false,
|
|
25100
|
+
/*propertyName*/
|
|
25101
|
+
void 0,
|
|
25102
|
+
nodeFactory.createIdentifier(name)
|
|
25103
|
+
) : nodeFactory.createImportSpecifier(
|
|
25104
|
+
/*isTypeOnly*/
|
|
25105
|
+
false,
|
|
25106
|
+
nodeFactory.createIdentifier(name),
|
|
25107
|
+
helperFactory.getUnscopedHelperName(name)
|
|
25108
|
+
))
|
|
25058
25109
|
);
|
|
25059
25110
|
const parseNode = getOriginalNode(sourceFile, isSourceFile);
|
|
25060
25111
|
const emitNode = getOrCreateEmitNode(parseNode);
|
|
@@ -26639,7 +26690,7 @@ var Parser;
|
|
|
26639
26690
|
}
|
|
26640
26691
|
return sourceFile;
|
|
26641
26692
|
function reportPragmaDiagnostic(pos, end, diagnostic) {
|
|
26642
|
-
parseDiagnostics.push(createDetachedDiagnostic(fileName, pos, end, diagnostic));
|
|
26693
|
+
parseDiagnostics.push(createDetachedDiagnostic(fileName, sourceText, pos, end, diagnostic));
|
|
26643
26694
|
}
|
|
26644
26695
|
}
|
|
26645
26696
|
let hasDeprecatedTag = false;
|
|
@@ -26879,7 +26930,7 @@ var Parser;
|
|
|
26879
26930
|
const lastError = lastOrUndefined(parseDiagnostics);
|
|
26880
26931
|
let result;
|
|
26881
26932
|
if (!lastError || start !== lastError.start) {
|
|
26882
|
-
result = createDetachedDiagnostic(fileName, start, length2, message, ...args);
|
|
26933
|
+
result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
|
|
26883
26934
|
parseDiagnostics.push(result);
|
|
26884
26935
|
}
|
|
26885
26936
|
parseErrorBeforeNextFinishedNode = true;
|
|
@@ -27107,7 +27158,7 @@ var Parser;
|
|
|
27107
27158
|
if (lastError) {
|
|
27108
27159
|
addRelatedInfo(
|
|
27109
27160
|
lastError,
|
|
27110
|
-
createDetachedDiagnostic(fileName, openPosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, tokenToString(openKind), tokenToString(closeKind))
|
|
27161
|
+
createDetachedDiagnostic(fileName, sourceText, openPosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, tokenToString(openKind), tokenToString(closeKind))
|
|
27111
27162
|
);
|
|
27112
27163
|
}
|
|
27113
27164
|
}
|
|
@@ -28706,7 +28757,7 @@ var Parser;
|
|
|
28706
28757
|
if (lastError && lastError.code === Diagnostics._0_expected.code) {
|
|
28707
28758
|
addRelatedInfo(
|
|
28708
28759
|
lastError,
|
|
28709
|
-
createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
|
|
28760
|
+
createDetachedDiagnostic(fileName, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
|
|
28710
28761
|
);
|
|
28711
28762
|
}
|
|
28712
28763
|
}
|
|
@@ -31823,7 +31874,7 @@ var Parser;
|
|
|
31823
31874
|
if (lastError && lastError.code === Diagnostics._0_expected.code) {
|
|
31824
31875
|
addRelatedInfo(
|
|
31825
31876
|
lastError,
|
|
31826
|
-
createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
|
|
31877
|
+
createDetachedDiagnostic(fileName, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
|
|
31827
31878
|
);
|
|
31828
31879
|
}
|
|
31829
31880
|
}
|
|
@@ -32802,7 +32853,7 @@ var Parser;
|
|
|
32802
32853
|
if (childTypeTag) {
|
|
32803
32854
|
const lastError = parseErrorAtCurrentToken(Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
|
|
32804
32855
|
if (lastError) {
|
|
32805
|
-
addRelatedInfo(lastError, createDetachedDiagnostic(fileName, 0, 0, Diagnostics.The_tag_was_first_specified_here));
|
|
32856
|
+
addRelatedInfo(lastError, createDetachedDiagnostic(fileName, sourceText, 0, 0, Diagnostics.The_tag_was_first_specified_here));
|
|
32806
32857
|
}
|
|
32807
32858
|
break;
|
|
32808
32859
|
} else {
|
|
@@ -33097,16 +33148,7 @@ var IncrementalParser;
|
|
|
33097
33148
|
Debug.assert(textSpanEnd(changeRange.span) === textSpanEnd(textChangeRange.span));
|
|
33098
33149
|
Debug.assert(textSpanEnd(textChangeRangeNewSpan(changeRange)) === textSpanEnd(textChangeRangeNewSpan(textChangeRange)));
|
|
33099
33150
|
const delta = textChangeRangeNewSpan(changeRange).length - changeRange.span.length;
|
|
33100
|
-
updateTokenPositionsAndMarkElements(
|
|
33101
|
-
incrementalSourceFile,
|
|
33102
|
-
changeRange.span.start,
|
|
33103
|
-
textSpanEnd(changeRange.span),
|
|
33104
|
-
textSpanEnd(textChangeRangeNewSpan(changeRange)),
|
|
33105
|
-
delta,
|
|
33106
|
-
oldText,
|
|
33107
|
-
newText,
|
|
33108
|
-
aggressiveChecks
|
|
33109
|
-
);
|
|
33151
|
+
updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, textSpanEnd(changeRange.span), textSpanEnd(textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks);
|
|
33110
33152
|
const result = Parser.parseSourceFile(
|
|
33111
33153
|
sourceFile.fileName,
|
|
33112
33154
|
newText,
|
|
@@ -36260,14 +36302,17 @@ function getExtendsConfigPathOrArray(value, host, basePath, configFileName, erro
|
|
|
36260
36302
|
for (let index = 0; index < value.length; index++) {
|
|
36261
36303
|
const fileName = value[index];
|
|
36262
36304
|
if (isString(fileName)) {
|
|
36263
|
-
extendedConfigPath = append(
|
|
36264
|
-
|
|
36265
|
-
|
|
36266
|
-
|
|
36267
|
-
|
|
36268
|
-
|
|
36269
|
-
|
|
36270
|
-
|
|
36305
|
+
extendedConfigPath = append(
|
|
36306
|
+
extendedConfigPath,
|
|
36307
|
+
getExtendsConfigPath(
|
|
36308
|
+
fileName,
|
|
36309
|
+
host,
|
|
36310
|
+
newBase,
|
|
36311
|
+
errors,
|
|
36312
|
+
valueExpression == null ? void 0 : valueExpression.elements[index],
|
|
36313
|
+
sourceFile
|
|
36314
|
+
)
|
|
36315
|
+
);
|
|
36271
36316
|
} else {
|
|
36272
36317
|
convertJsonOption(extendsOptionDeclaration.element, value, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile);
|
|
36273
36318
|
}
|
|
@@ -37112,12 +37157,7 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
37112
37157
|
}
|
|
37113
37158
|
}
|
|
37114
37159
|
return resolvedTypeScriptOnly(
|
|
37115
|
-
loadNodeModuleFromDirectory(
|
|
37116
|
-
4 /* Declaration */,
|
|
37117
|
-
candidate,
|
|
37118
|
-
!directoryExists,
|
|
37119
|
-
moduleResolutionState
|
|
37120
|
-
)
|
|
37160
|
+
loadNodeModuleFromDirectory(4 /* Declaration */, candidate, !directoryExists, moduleResolutionState)
|
|
37121
37161
|
);
|
|
37122
37162
|
});
|
|
37123
37163
|
} else {
|
|
@@ -38593,13 +38633,15 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38593
38633
|
false,
|
|
38594
38634
|
redirectedReference
|
|
38595
38635
|
);
|
|
38596
|
-
return toSearchResult(
|
|
38597
|
-
|
|
38598
|
-
|
|
38599
|
-
|
|
38600
|
-
|
|
38601
|
-
|
|
38602
|
-
|
|
38636
|
+
return toSearchResult(
|
|
38637
|
+
result.resolvedModule ? {
|
|
38638
|
+
path: result.resolvedModule.resolvedFileName,
|
|
38639
|
+
extension: result.resolvedModule.extension,
|
|
38640
|
+
packageId: result.resolvedModule.packageId,
|
|
38641
|
+
originalPath: result.resolvedModule.originalPath,
|
|
38642
|
+
resolvedUsingTsExtension: result.resolvedModule.resolvedUsingTsExtension
|
|
38643
|
+
} : void 0
|
|
38644
|
+
);
|
|
38603
38645
|
}
|
|
38604
38646
|
if (state.traceEnabled) {
|
|
38605
38647
|
trace(state.host, Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
@@ -38632,13 +38674,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38632
38674
|
);
|
|
38633
38675
|
}
|
|
38634
38676
|
if (state.traceEnabled) {
|
|
38635
|
-
trace(
|
|
38636
|
-
state.host,
|
|
38637
|
-
Diagnostics.Using_0_subpath_1_with_target_2,
|
|
38638
|
-
isImports ? "imports" : "exports",
|
|
38639
|
-
key,
|
|
38640
|
-
pattern ? target.replace(/\*/g, subpath) : target + subpath
|
|
38641
|
-
);
|
|
38677
|
+
trace(state.host, Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath);
|
|
38642
38678
|
}
|
|
38643
38679
|
const finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
|
|
38644
38680
|
const inputLink = tryLoadInputFileForPath(finalPath, subpath, combinePaths(scope.packageDirectory, "package.json"), isImports);
|
|
@@ -40861,31 +40897,15 @@ function createBinder() {
|
|
|
40861
40897
|
return;
|
|
40862
40898
|
}
|
|
40863
40899
|
if (inStrictMode && originalKeywordKind >= 119 /* FirstFutureReservedWord */ && originalKeywordKind <= 127 /* LastFutureReservedWord */) {
|
|
40864
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(
|
|
40865
|
-
node,
|
|
40866
|
-
getStrictModeIdentifierMessage(node),
|
|
40867
|
-
declarationNameToString(node)
|
|
40868
|
-
));
|
|
40900
|
+
file.bindDiagnostics.push(createDiagnosticForNode2(node, getStrictModeIdentifierMessage(node), declarationNameToString(node)));
|
|
40869
40901
|
} else if (originalKeywordKind === 135 /* AwaitKeyword */) {
|
|
40870
40902
|
if (isExternalModule(file) && isInTopLevelContext(node)) {
|
|
40871
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(
|
|
40872
|
-
node,
|
|
40873
|
-
Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module,
|
|
40874
|
-
declarationNameToString(node)
|
|
40875
|
-
));
|
|
40903
|
+
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, declarationNameToString(node)));
|
|
40876
40904
|
} else if (node.flags & 65536 /* AwaitContext */) {
|
|
40877
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(
|
|
40878
|
-
node,
|
|
40879
|
-
Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here,
|
|
40880
|
-
declarationNameToString(node)
|
|
40881
|
-
));
|
|
40905
|
+
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
|
|
40882
40906
|
}
|
|
40883
40907
|
} else if (originalKeywordKind === 127 /* YieldKeyword */ && node.flags & 16384 /* YieldContext */) {
|
|
40884
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(
|
|
40885
|
-
node,
|
|
40886
|
-
Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here,
|
|
40887
|
-
declarationNameToString(node)
|
|
40888
|
-
));
|
|
40908
|
+
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
|
|
40889
40909
|
}
|
|
40890
40910
|
}
|
|
40891
40911
|
}
|
|
@@ -40901,11 +40921,7 @@ function createBinder() {
|
|
|
40901
40921
|
function checkPrivateIdentifier(node) {
|
|
40902
40922
|
if (node.escapedText === "#constructor") {
|
|
40903
40923
|
if (!file.parseDiagnostics.length) {
|
|
40904
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(
|
|
40905
|
-
node,
|
|
40906
|
-
Diagnostics.constructor_is_a_reserved_word,
|
|
40907
|
-
declarationNameToString(node)
|
|
40908
|
-
));
|
|
40924
|
+
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.constructor_is_a_reserved_word, declarationNameToString(node)));
|
|
40909
40925
|
}
|
|
40910
40926
|
}
|
|
40911
40927
|
}
|
|
@@ -40933,13 +40949,7 @@ function createBinder() {
|
|
|
40933
40949
|
const identifier = name;
|
|
40934
40950
|
if (isEvalOrArgumentsIdentifier(identifier)) {
|
|
40935
40951
|
const span = getErrorSpanForNode(file, name);
|
|
40936
|
-
file.bindDiagnostics.push(createFileDiagnostic(
|
|
40937
|
-
file,
|
|
40938
|
-
span.start,
|
|
40939
|
-
span.length,
|
|
40940
|
-
getStrictModeEvalOrArgumentsMessage(contextNode),
|
|
40941
|
-
idText(identifier)
|
|
40942
|
-
));
|
|
40952
|
+
file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, getStrictModeEvalOrArgumentsMessage(contextNode), idText(identifier)));
|
|
40943
40953
|
}
|
|
40944
40954
|
}
|
|
40945
40955
|
}
|
|
@@ -40970,12 +40980,7 @@ function createBinder() {
|
|
|
40970
40980
|
if (languageVersion < 2 /* ES2015 */) {
|
|
40971
40981
|
if (blockScopeContainer.kind !== 312 /* SourceFile */ && blockScopeContainer.kind !== 267 /* ModuleDeclaration */ && !isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) {
|
|
40972
40982
|
const errorSpan = getErrorSpanForNode(file, node);
|
|
40973
|
-
file.bindDiagnostics.push(createFileDiagnostic(
|
|
40974
|
-
file,
|
|
40975
|
-
errorSpan.start,
|
|
40976
|
-
errorSpan.length,
|
|
40977
|
-
getStrictModeBlockScopeFunctionDeclarationMessage(node)
|
|
40978
|
-
));
|
|
40983
|
+
file.bindDiagnostics.push(createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node)));
|
|
40979
40984
|
}
|
|
40980
40985
|
}
|
|
40981
40986
|
}
|
|
@@ -41206,11 +41211,7 @@ function createBinder() {
|
|
|
41206
41211
|
return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */);
|
|
41207
41212
|
case 174 /* MethodDeclaration */:
|
|
41208
41213
|
case 173 /* MethodSignature */:
|
|
41209
|
-
return bindPropertyOrMethodOrAccessor(
|
|
41210
|
-
node,
|
|
41211
|
-
8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */),
|
|
41212
|
-
isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 103359 /* MethodExcludes */
|
|
41213
|
-
);
|
|
41214
|
+
return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 103359 /* MethodExcludes */);
|
|
41214
41215
|
case 262 /* FunctionDeclaration */:
|
|
41215
41216
|
return bindFunctionDeclaration(node);
|
|
41216
41217
|
case 176 /* Constructor */:
|
|
@@ -42547,32 +42548,29 @@ function tryGetModuleNameFromAmbientModule(moduleSymbol, checker) {
|
|
|
42547
42548
|
if (decl) {
|
|
42548
42549
|
return decl.name.text;
|
|
42549
42550
|
}
|
|
42550
|
-
const ambientModuleDeclareCandidates = mapDefined(
|
|
42551
|
-
|
|
42552
|
-
(d)
|
|
42553
|
-
|
|
42554
|
-
|
|
42555
|
-
|
|
42556
|
-
|
|
42557
|
-
|
|
42558
|
-
|
|
42559
|
-
|
|
42560
|
-
|
|
42561
|
-
|
|
42562
|
-
|
|
42563
|
-
|
|
42564
|
-
|
|
42565
|
-
|
|
42566
|
-
|
|
42567
|
-
|
|
42568
|
-
|
|
42569
|
-
while (namespaceDeclaration.flags & 8 /* NestedNamespace */) {
|
|
42570
|
-
namespaceDeclaration = namespaceDeclaration.parent;
|
|
42571
|
-
}
|
|
42572
|
-
return namespaceDeclaration;
|
|
42551
|
+
const ambientModuleDeclareCandidates = mapDefined(moduleSymbol.declarations, (d) => {
|
|
42552
|
+
var _a2, _b, _c, _d;
|
|
42553
|
+
if (!isModuleDeclaration(d))
|
|
42554
|
+
return;
|
|
42555
|
+
const topNamespace = getTopNamespace(d);
|
|
42556
|
+
if (!(((_a2 = topNamespace == null ? void 0 : topNamespace.parent) == null ? void 0 : _a2.parent) && isModuleBlock(topNamespace.parent) && isAmbientModule(topNamespace.parent.parent) && isSourceFile(topNamespace.parent.parent.parent)))
|
|
42557
|
+
return;
|
|
42558
|
+
const exportAssignment = (_d = (_c = (_b = topNamespace.parent.parent.symbol.exports) == null ? void 0 : _b.get("export=")) == null ? void 0 : _c.valueDeclaration) == null ? void 0 : _d.expression;
|
|
42559
|
+
if (!exportAssignment)
|
|
42560
|
+
return;
|
|
42561
|
+
const exportSymbol = checker.getSymbolAtLocation(exportAssignment);
|
|
42562
|
+
if (!exportSymbol)
|
|
42563
|
+
return;
|
|
42564
|
+
const originalExportSymbol = (exportSymbol == null ? void 0 : exportSymbol.flags) & 2097152 /* Alias */ ? checker.getAliasedSymbol(exportSymbol) : exportSymbol;
|
|
42565
|
+
if (originalExportSymbol === d.symbol)
|
|
42566
|
+
return topNamespace.parent.parent;
|
|
42567
|
+
function getTopNamespace(namespaceDeclaration) {
|
|
42568
|
+
while (namespaceDeclaration.flags & 8 /* NestedNamespace */) {
|
|
42569
|
+
namespaceDeclaration = namespaceDeclaration.parent;
|
|
42573
42570
|
}
|
|
42571
|
+
return namespaceDeclaration;
|
|
42574
42572
|
}
|
|
42575
|
-
);
|
|
42573
|
+
});
|
|
42576
42574
|
const ambientModuleDeclare = ambientModuleDeclareCandidates[0];
|
|
42577
42575
|
if (ambientModuleDeclare) {
|
|
42578
42576
|
return ambientModuleDeclare.name.text;
|
|
@@ -45260,10 +45258,7 @@ function createTypeChecker(host) {
|
|
|
45260
45258
|
diagnosticMessage = error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName);
|
|
45261
45259
|
}
|
|
45262
45260
|
if (diagnosticMessage) {
|
|
45263
|
-
addRelatedInfo(
|
|
45264
|
-
diagnosticMessage,
|
|
45265
|
-
createDiagnosticForNode(declaration, Diagnostics._0_is_declared_here, declarationName)
|
|
45266
|
-
);
|
|
45261
|
+
addRelatedInfo(diagnosticMessage, createDiagnosticForNode(declaration, Diagnostics._0_is_declared_here, declarationName));
|
|
45267
45262
|
}
|
|
45268
45263
|
}
|
|
45269
45264
|
}
|
|
@@ -45439,11 +45434,14 @@ function createTypeChecker(host) {
|
|
|
45439
45434
|
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
45440
45435
|
const err = error(node.name, Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
|
|
45441
45436
|
if (exportAssignment) {
|
|
45442
|
-
addRelatedInfo(
|
|
45443
|
-
|
|
45444
|
-
|
|
45445
|
-
|
|
45446
|
-
|
|
45437
|
+
addRelatedInfo(
|
|
45438
|
+
err,
|
|
45439
|
+
createDiagnosticForNode(
|
|
45440
|
+
exportAssignment,
|
|
45441
|
+
Diagnostics.This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag,
|
|
45442
|
+
compilerOptionName
|
|
45443
|
+
)
|
|
45444
|
+
);
|
|
45447
45445
|
}
|
|
45448
45446
|
} else if (isImportClause(node)) {
|
|
45449
45447
|
reportNonDefaultExport(moduleSymbol, node);
|
|
@@ -45500,10 +45498,12 @@ function createTypeChecker(host) {
|
|
|
45500
45498
|
const diagnostic = error(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
|
|
45501
45499
|
const exportStar = (_b = moduleSymbol.exports) == null ? void 0 : _b.get("__export" /* ExportStar */);
|
|
45502
45500
|
if (exportStar) {
|
|
45503
|
-
const defaultExport = (_c = exportStar.declarations) == null ? void 0 : _c.find(
|
|
45504
|
-
|
|
45505
|
-
|
|
45506
|
-
|
|
45501
|
+
const defaultExport = (_c = exportStar.declarations) == null ? void 0 : _c.find(
|
|
45502
|
+
(decl) => {
|
|
45503
|
+
var _a2, _b2;
|
|
45504
|
+
return !!(isExportDeclaration(decl) && decl.moduleSpecifier && ((_b2 = (_a2 = resolveExternalModuleName(decl, decl.moduleSpecifier)) == null ? void 0 : _a2.exports) == null ? void 0 : _b2.has("default" /* Default */)));
|
|
45505
|
+
}
|
|
45506
|
+
);
|
|
45507
45507
|
if (defaultExport) {
|
|
45508
45508
|
addRelatedInfo(diagnostic, createDiagnosticForNode(defaultExport, Diagnostics.export_Asterisk_does_not_re_export_a_default));
|
|
45509
45509
|
}
|
|
@@ -45650,10 +45650,7 @@ function createTypeChecker(host) {
|
|
|
45650
45650
|
const suggestionName = symbolToString(suggestion);
|
|
45651
45651
|
const diagnostic = error(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
|
45652
45652
|
if (suggestion.valueDeclaration) {
|
|
45653
|
-
addRelatedInfo(
|
|
45654
|
-
diagnostic,
|
|
45655
|
-
createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName)
|
|
45656
|
-
);
|
|
45653
|
+
addRelatedInfo(diagnostic, createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName));
|
|
45657
45654
|
}
|
|
45658
45655
|
} else {
|
|
45659
45656
|
if ((_a = moduleSymbol.exports) == null ? void 0 : _a.has("default" /* Default */)) {
|
|
@@ -45680,10 +45677,7 @@ function createTypeChecker(host) {
|
|
|
45680
45677
|
const exportedSymbol = exports ? find(symbolsToArray(exports), (symbol) => !!getSymbolIfSameReference(symbol, localSymbol)) : void 0;
|
|
45681
45678
|
const diagnostic = exportedSymbol ? error(name, Diagnostics.Module_0_declares_1_locally_but_it_is_exported_as_2, moduleName, declarationName, symbolToString(exportedSymbol)) : error(name, Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported, moduleName, declarationName);
|
|
45682
45679
|
if (localSymbol.declarations) {
|
|
45683
|
-
addRelatedInfo(
|
|
45684
|
-
diagnostic,
|
|
45685
|
-
...map(localSymbol.declarations, (decl, index) => createDiagnosticForNode(decl, index === 0 ? Diagnostics._0_is_declared_here : Diagnostics.and_here, declarationName))
|
|
45686
|
-
);
|
|
45680
|
+
addRelatedInfo(diagnostic, ...map(localSymbol.declarations, (decl, index) => createDiagnosticForNode(decl, index === 0 ? Diagnostics._0_is_declared_here : Diagnostics.and_here, declarationName)));
|
|
45687
45681
|
}
|
|
45688
45682
|
}
|
|
45689
45683
|
} else {
|
|
@@ -46348,11 +46342,15 @@ function createTypeChecker(host) {
|
|
|
46348
46342
|
}
|
|
46349
46343
|
}
|
|
46350
46344
|
}
|
|
46351
|
-
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
46352
|
-
|
|
46353
|
-
|
|
46354
|
-
|
|
46355
|
-
|
|
46345
|
+
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
46346
|
+
getSourceFileOfNode(errorNode),
|
|
46347
|
+
errorNode,
|
|
46348
|
+
chainDiagnosticMessages(
|
|
46349
|
+
diagnosticDetails,
|
|
46350
|
+
Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead,
|
|
46351
|
+
moduleReference
|
|
46352
|
+
)
|
|
46353
|
+
));
|
|
46356
46354
|
}
|
|
46357
46355
|
}
|
|
46358
46356
|
}
|
|
@@ -46409,11 +46407,7 @@ function createTypeChecker(host) {
|
|
|
46409
46407
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
46410
46408
|
const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
|
|
46411
46409
|
if (suggestedExt) {
|
|
46412
|
-
error(
|
|
46413
|
-
errorNode,
|
|
46414
|
-
Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0,
|
|
46415
|
-
moduleReference + suggestedExt
|
|
46416
|
-
);
|
|
46410
|
+
error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
46417
46411
|
} else {
|
|
46418
46412
|
error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
46419
46413
|
}
|
|
@@ -46438,12 +46432,16 @@ function createTypeChecker(host) {
|
|
|
46438
46432
|
if (!isExternalModuleNameRelative(moduleReference) && packageId) {
|
|
46439
46433
|
errorInfo = createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageId.name);
|
|
46440
46434
|
}
|
|
46441
|
-
errorOrSuggestion(
|
|
46442
|
-
|
|
46443
|
-
|
|
46444
|
-
|
|
46445
|
-
|
|
46446
|
-
|
|
46435
|
+
errorOrSuggestion(
|
|
46436
|
+
isError,
|
|
46437
|
+
errorNode,
|
|
46438
|
+
chainDiagnosticMessages(
|
|
46439
|
+
errorInfo,
|
|
46440
|
+
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type,
|
|
46441
|
+
moduleReference,
|
|
46442
|
+
resolvedFileName
|
|
46443
|
+
)
|
|
46444
|
+
);
|
|
46447
46445
|
}
|
|
46448
46446
|
function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) {
|
|
46449
46447
|
if (moduleSymbol == null ? void 0 : moduleSymbol.exports) {
|
|
@@ -46680,10 +46678,12 @@ function createTypeChecker(host) {
|
|
|
46680
46678
|
}
|
|
46681
46679
|
if (exportStar == null ? void 0 : exportStar.isTypeOnly) {
|
|
46682
46680
|
typeOnlyExportStarMap ?? (typeOnlyExportStarMap = /* @__PURE__ */ new Map());
|
|
46683
|
-
symbols.forEach(
|
|
46684
|
-
escapedName
|
|
46685
|
-
|
|
46686
|
-
|
|
46681
|
+
symbols.forEach(
|
|
46682
|
+
(_, escapedName) => typeOnlyExportStarMap.set(
|
|
46683
|
+
escapedName,
|
|
46684
|
+
exportStar
|
|
46685
|
+
)
|
|
46686
|
+
);
|
|
46687
46687
|
}
|
|
46688
46688
|
return symbols;
|
|
46689
46689
|
}
|
|
@@ -46919,13 +46919,7 @@ function createTypeChecker(host) {
|
|
|
46919
46919
|
return resolved;
|
|
46920
46920
|
}
|
|
46921
46921
|
function createAnonymousType(symbol, members, callSignatures, constructSignatures, indexInfos) {
|
|
46922
|
-
return setStructuredTypeMembers(
|
|
46923
|
-
createObjectType(16 /* Anonymous */, symbol),
|
|
46924
|
-
members,
|
|
46925
|
-
callSignatures,
|
|
46926
|
-
constructSignatures,
|
|
46927
|
-
indexInfos
|
|
46928
|
-
);
|
|
46922
|
+
return setStructuredTypeMembers(createObjectType(16 /* Anonymous */, symbol), members, callSignatures, constructSignatures, indexInfos);
|
|
46929
46923
|
}
|
|
46930
46924
|
function getResolvedTypeWithoutAbstractConstructSignatures(type) {
|
|
46931
46925
|
if (type.constructSignatures.length === 0)
|
|
@@ -48155,11 +48149,7 @@ function createTypeChecker(host) {
|
|
|
48155
48149
|
}
|
|
48156
48150
|
} else {
|
|
48157
48151
|
if (typeArguments !== getIdentifierTypeArguments(qualifier.right)) {
|
|
48158
|
-
qualifier = factory.updateQualifiedName(
|
|
48159
|
-
qualifier,
|
|
48160
|
-
qualifier.left,
|
|
48161
|
-
setIdentifierTypeArguments(factory.cloneNode(qualifier.right), typeArguments)
|
|
48162
|
-
);
|
|
48152
|
+
qualifier = factory.updateQualifiedName(qualifier, qualifier.left, setIdentifierTypeArguments(factory.cloneNode(qualifier.right), typeArguments));
|
|
48163
48153
|
}
|
|
48164
48154
|
}
|
|
48165
48155
|
}
|
|
@@ -48185,11 +48175,7 @@ function createTypeChecker(host) {
|
|
|
48185
48175
|
}
|
|
48186
48176
|
} else {
|
|
48187
48177
|
if (typeArguments !== getIdentifierTypeArguments(typeName.right)) {
|
|
48188
|
-
typeName = factory.updateQualifiedName(
|
|
48189
|
-
typeName,
|
|
48190
|
-
typeName.left,
|
|
48191
|
-
setIdentifierTypeArguments(factory.cloneNode(typeName.right), typeArguments)
|
|
48192
|
-
);
|
|
48178
|
+
typeName = factory.updateQualifiedName(typeName, typeName.left, setIdentifierTypeArguments(factory.cloneNode(typeName.right), typeArguments));
|
|
48193
48179
|
}
|
|
48194
48180
|
}
|
|
48195
48181
|
typeArguments = ref.typeArguments;
|
|
@@ -48746,7 +48732,9 @@ function createTypeChecker(host) {
|
|
|
48746
48732
|
if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], context.enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning2 : getQualifiedLeftMeaning(meaning2))) {
|
|
48747
48733
|
const parents = getContainersOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol2, context.enclosingDeclaration, meaning2);
|
|
48748
48734
|
if (length(parents)) {
|
|
48749
|
-
parentSpecifiers = parents.map(
|
|
48735
|
+
parentSpecifiers = parents.map(
|
|
48736
|
+
(symbol3) => some(symbol3.declarations, hasNonGlobalAugmentationExternalModuleSymbol) ? getSpecifierForModuleSymbol(symbol3, context) : void 0
|
|
48737
|
+
);
|
|
48750
48738
|
const indices = parents.map((_, i) => i);
|
|
48751
48739
|
indices.sort(sortByBestName);
|
|
48752
48740
|
const sortedParents = indices.map((i) => parents[i]);
|
|
@@ -49527,7 +49515,11 @@ function createTypeChecker(host) {
|
|
|
49527
49515
|
if (accessibleResult.accessibility === 0 /* Accessible */) {
|
|
49528
49516
|
const chain = lookupSymbolChainWorker(sym, context, meaning);
|
|
49529
49517
|
if (!(sym.flags & 4 /* Property */)) {
|
|
49530
|
-
|
|
49518
|
+
const root = chain[0];
|
|
49519
|
+
const contextFile = getSourceFileOfNode(oldcontext.enclosingDeclaration);
|
|
49520
|
+
if (some(root.declarations, (d) => getSourceFileOfNode(d) === contextFile)) {
|
|
49521
|
+
includePrivateSymbol(root);
|
|
49522
|
+
}
|
|
49531
49523
|
}
|
|
49532
49524
|
} else if ((_a = oldcontext.tracker.inner) == null ? void 0 : _a.trackSymbol) {
|
|
49533
49525
|
return oldcontext.tracker.inner.trackSymbol(sym, decl, meaning);
|
|
@@ -49572,21 +49564,24 @@ function createTypeChecker(host) {
|
|
|
49572
49564
|
ns.name,
|
|
49573
49565
|
body = factory.updateModuleBlock(
|
|
49574
49566
|
body,
|
|
49575
|
-
factory.createNodeArray([
|
|
49576
|
-
|
|
49577
|
-
|
|
49578
|
-
|
|
49579
|
-
|
|
49580
|
-
factory.createNamedExports(map(flatMap(excessExports, (e) => getNamesOfDeclaration(e)), (id) => factory.createExportSpecifier(
|
|
49567
|
+
factory.createNodeArray([
|
|
49568
|
+
...ns.body.statements,
|
|
49569
|
+
factory.createExportDeclaration(
|
|
49570
|
+
/*modifiers*/
|
|
49571
|
+
void 0,
|
|
49581
49572
|
/*isTypeOnly*/
|
|
49582
49573
|
false,
|
|
49583
|
-
|
|
49584
|
-
|
|
49585
|
-
|
|
49586
|
-
|
|
49587
|
-
|
|
49588
|
-
|
|
49589
|
-
|
|
49574
|
+
factory.createNamedExports(map(flatMap(excessExports, (e) => getNamesOfDeclaration(e)), (id) => factory.createExportSpecifier(
|
|
49575
|
+
/*isTypeOnly*/
|
|
49576
|
+
false,
|
|
49577
|
+
/*propertyName*/
|
|
49578
|
+
void 0,
|
|
49579
|
+
id
|
|
49580
|
+
))),
|
|
49581
|
+
/*moduleSpecifier*/
|
|
49582
|
+
void 0
|
|
49583
|
+
)
|
|
49584
|
+
])
|
|
49590
49585
|
)
|
|
49591
49586
|
);
|
|
49592
49587
|
statements = [...statements.slice(0, nsIndex), ns, ...statements.slice(nsIndex + 1)];
|
|
@@ -49606,15 +49601,18 @@ function createTypeChecker(host) {
|
|
|
49606
49601
|
const exports = filter(statements, (d) => isExportDeclaration(d) && !d.moduleSpecifier && !!d.exportClause && isNamedExports(d.exportClause));
|
|
49607
49602
|
if (length(exports) > 1) {
|
|
49608
49603
|
const nonExports = filter(statements, (d) => !isExportDeclaration(d) || !!d.moduleSpecifier || !d.exportClause);
|
|
49609
|
-
statements = [
|
|
49610
|
-
|
|
49611
|
-
|
|
49612
|
-
|
|
49613
|
-
|
|
49614
|
-
|
|
49615
|
-
|
|
49616
|
-
|
|
49617
|
-
|
|
49604
|
+
statements = [
|
|
49605
|
+
...nonExports,
|
|
49606
|
+
factory.createExportDeclaration(
|
|
49607
|
+
/*modifiers*/
|
|
49608
|
+
void 0,
|
|
49609
|
+
/*isTypeOnly*/
|
|
49610
|
+
false,
|
|
49611
|
+
factory.createNamedExports(flatMap(exports, (e) => cast(e.exportClause, isNamedExports).elements)),
|
|
49612
|
+
/*moduleSpecifier*/
|
|
49613
|
+
void 0
|
|
49614
|
+
)
|
|
49615
|
+
];
|
|
49618
49616
|
}
|
|
49619
49617
|
const reexports = filter(statements, (d) => isExportDeclaration(d) && !!d.moduleSpecifier && !!d.exportClause && isNamedExports(d.exportClause));
|
|
49620
49618
|
if (length(reexports) > 1) {
|
|
@@ -49793,18 +49791,21 @@ function createTypeChecker(host) {
|
|
|
49793
49791
|
);
|
|
49794
49792
|
context.tracker.trackSymbol(type.symbol, context.enclosingDeclaration, 111551 /* Value */);
|
|
49795
49793
|
} else {
|
|
49796
|
-
const statement = setTextRange(
|
|
49797
|
-
|
|
49798
|
-
|
|
49799
|
-
|
|
49800
|
-
factory.
|
|
49801
|
-
|
|
49802
|
-
|
|
49803
|
-
|
|
49804
|
-
|
|
49805
|
-
|
|
49806
|
-
|
|
49807
|
-
|
|
49794
|
+
const statement = setTextRange(
|
|
49795
|
+
factory.createVariableStatement(
|
|
49796
|
+
/*modifiers*/
|
|
49797
|
+
void 0,
|
|
49798
|
+
factory.createVariableDeclarationList([
|
|
49799
|
+
factory.createVariableDeclaration(
|
|
49800
|
+
name,
|
|
49801
|
+
/*exclamationToken*/
|
|
49802
|
+
void 0,
|
|
49803
|
+
serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled)
|
|
49804
|
+
)
|
|
49805
|
+
], flags)
|
|
49806
|
+
),
|
|
49807
|
+
textRange
|
|
49808
|
+
);
|
|
49808
49809
|
addResult(statement, name !== localName ? modifierFlags & ~1 /* Export */ : modifierFlags);
|
|
49809
49810
|
if (name !== localName && !isPrivate) {
|
|
49810
49811
|
addResult(
|
|
@@ -49878,18 +49879,21 @@ function createTypeChecker(host) {
|
|
|
49878
49879
|
factory.createIdentifier(getInternalSymbolName(symbol, symbolName2))
|
|
49879
49880
|
), 0 /* None */);
|
|
49880
49881
|
} else if (needsExportDeclaration) {
|
|
49881
|
-
addResult(
|
|
49882
|
-
|
|
49883
|
-
|
|
49884
|
-
|
|
49885
|
-
false,
|
|
49886
|
-
factory.createNamedExports([factory.createExportSpecifier(
|
|
49882
|
+
addResult(
|
|
49883
|
+
factory.createExportDeclaration(
|
|
49884
|
+
/*modifiers*/
|
|
49885
|
+
void 0,
|
|
49887
49886
|
/*isTypeOnly*/
|
|
49888
49887
|
false,
|
|
49889
|
-
|
|
49890
|
-
|
|
49891
|
-
|
|
49892
|
-
|
|
49888
|
+
factory.createNamedExports([factory.createExportSpecifier(
|
|
49889
|
+
/*isTypeOnly*/
|
|
49890
|
+
false,
|
|
49891
|
+
getInternalSymbolName(symbol, symbolName2),
|
|
49892
|
+
symbolName2
|
|
49893
|
+
)])
|
|
49894
|
+
),
|
|
49895
|
+
0 /* None */
|
|
49896
|
+
);
|
|
49893
49897
|
}
|
|
49894
49898
|
}
|
|
49895
49899
|
function includePrivateSymbol(symbol) {
|
|
@@ -49897,10 +49901,7 @@ function createTypeChecker(host) {
|
|
|
49897
49901
|
return;
|
|
49898
49902
|
Debug.assertIsDefined(deferredPrivatesStack[deferredPrivatesStack.length - 1]);
|
|
49899
49903
|
getUnusedName(unescapeLeadingUnderscores(symbol.escapedName), symbol);
|
|
49900
|
-
const isExternalImportAlias = !!(symbol.flags & 2097152 /* Alias */) && !some(
|
|
49901
|
-
symbol.declarations,
|
|
49902
|
-
(d) => !!findAncestor(d, isExportDeclaration) || isNamespaceExport(d) || isImportEqualsDeclaration(d) && !isExternalModuleReference(d.moduleReference)
|
|
49903
|
-
);
|
|
49904
|
+
const isExternalImportAlias = !!(symbol.flags & 2097152 /* Alias */) && !some(symbol.declarations, (d) => !!findAncestor(d, isExportDeclaration) || isNamespaceExport(d) || isImportEqualsDeclaration(d) && !isExternalModuleReference(d.moduleReference));
|
|
49904
49905
|
deferredPrivatesStack[isExternalImportAlias ? 0 : deferredPrivatesStack.length - 1].set(getSymbolId(symbol), symbol);
|
|
49905
49906
|
}
|
|
49906
49907
|
function isExportingScope(enclosingDeclaration2) {
|
|
@@ -49937,16 +49938,19 @@ function createTypeChecker(host) {
|
|
|
49937
49938
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
49938
49939
|
context.enclosingDeclaration = jsdocAliasDecl;
|
|
49939
49940
|
const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && serializeExistingTypeNode(context, jsdocAliasDecl.typeExpression.type, includePrivateSymbol, bundled) || typeToTypeNodeHelper(aliasType, context);
|
|
49940
|
-
addResult(
|
|
49941
|
-
|
|
49942
|
-
|
|
49943
|
-
|
|
49944
|
-
|
|
49945
|
-
|
|
49946
|
-
|
|
49941
|
+
addResult(
|
|
49942
|
+
setSyntheticLeadingComments(
|
|
49943
|
+
factory.createTypeAliasDeclaration(
|
|
49944
|
+
/*modifiers*/
|
|
49945
|
+
void 0,
|
|
49946
|
+
getInternalSymbolName(symbol, symbolName2),
|
|
49947
|
+
typeParamDecls,
|
|
49948
|
+
typeNode
|
|
49949
|
+
),
|
|
49950
|
+
!commentText ? [] : [{ kind: 3 /* MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]
|
|
49947
49951
|
),
|
|
49948
|
-
|
|
49949
|
-
)
|
|
49952
|
+
modifierFlags
|
|
49953
|
+
);
|
|
49950
49954
|
context.flags = oldFlags;
|
|
49951
49955
|
context.enclosingDeclaration = oldEnclosingDecl;
|
|
49952
49956
|
}
|
|
@@ -49961,14 +49965,17 @@ function createTypeChecker(host) {
|
|
|
49961
49965
|
const constructSignatures = serializeSignatures(1 /* Construct */, interfaceType, baseType, 180 /* ConstructSignature */);
|
|
49962
49966
|
const indexSignatures = serializeIndexSignatures(interfaceType, baseType);
|
|
49963
49967
|
const heritageClauses = !length(baseTypes) ? void 0 : [factory.createHeritageClause(96 /* ExtendsKeyword */, mapDefined(baseTypes, (b) => trySerializeAsTypeReference(b, 111551 /* Value */)))];
|
|
49964
|
-
addResult(
|
|
49965
|
-
|
|
49966
|
-
|
|
49967
|
-
|
|
49968
|
-
|
|
49969
|
-
|
|
49970
|
-
|
|
49971
|
-
|
|
49968
|
+
addResult(
|
|
49969
|
+
factory.createInterfaceDeclaration(
|
|
49970
|
+
/*modifiers*/
|
|
49971
|
+
void 0,
|
|
49972
|
+
getInternalSymbolName(symbol, symbolName2),
|
|
49973
|
+
typeParamDecls,
|
|
49974
|
+
heritageClauses,
|
|
49975
|
+
[...indexSignatures, ...constructSignatures, ...callSignatures, ...members]
|
|
49976
|
+
),
|
|
49977
|
+
modifierFlags
|
|
49978
|
+
);
|
|
49972
49979
|
}
|
|
49973
49980
|
function getNamespaceMembersForSerialization(symbol) {
|
|
49974
49981
|
const exports = getExportsOfSymbol(symbol);
|
|
@@ -50018,24 +50025,33 @@ function createTypeChecker(host) {
|
|
|
50018
50025
|
);
|
|
50019
50026
|
}))
|
|
50020
50027
|
)]);
|
|
50021
|
-
addResult(
|
|
50022
|
-
|
|
50023
|
-
|
|
50024
|
-
|
|
50025
|
-
|
|
50026
|
-
|
|
50027
|
-
|
|
50028
|
+
addResult(
|
|
50029
|
+
factory.createModuleDeclaration(
|
|
50030
|
+
/*modifiers*/
|
|
50031
|
+
void 0,
|
|
50032
|
+
factory.createIdentifier(localName),
|
|
50033
|
+
nsBody,
|
|
50034
|
+
32 /* Namespace */
|
|
50035
|
+
),
|
|
50036
|
+
0 /* None */
|
|
50037
|
+
);
|
|
50028
50038
|
}
|
|
50029
50039
|
}
|
|
50030
50040
|
function serializeEnum(symbol, symbolName2, modifierFlags) {
|
|
50031
|
-
addResult(
|
|
50032
|
-
factory.
|
|
50033
|
-
|
|
50034
|
-
|
|
50035
|
-
|
|
50036
|
-
|
|
50037
|
-
|
|
50038
|
-
|
|
50041
|
+
addResult(
|
|
50042
|
+
factory.createEnumDeclaration(
|
|
50043
|
+
factory.createModifiersFromModifierFlags(isConstEnumSymbol(symbol) ? 2048 /* Const */ : 0),
|
|
50044
|
+
getInternalSymbolName(symbol, symbolName2),
|
|
50045
|
+
map(filter(getPropertiesOfType(getTypeOfSymbol(symbol)), (p) => !!(p.flags & 8 /* EnumMember */)), (p) => {
|
|
50046
|
+
const initializedValue = p.declarations && p.declarations[0] && isEnumMember(p.declarations[0]) ? getConstantValue2(p.declarations[0]) : void 0;
|
|
50047
|
+
return factory.createEnumMember(
|
|
50048
|
+
unescapeLeadingUnderscores(p.escapedName),
|
|
50049
|
+
initializedValue === void 0 ? void 0 : typeof initializedValue === "string" ? factory.createStringLiteral(initializedValue) : factory.createNumericLiteral(initializedValue)
|
|
50050
|
+
);
|
|
50051
|
+
})
|
|
50052
|
+
),
|
|
50053
|
+
modifierFlags
|
|
50054
|
+
);
|
|
50039
50055
|
}
|
|
50040
50056
|
function serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags) {
|
|
50041
50057
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
|
@@ -50067,13 +50083,7 @@ function createTypeChecker(host) {
|
|
|
50067
50083
|
}
|
|
50068
50084
|
function serializeAsNamespaceDeclaration(props, localName, modifierFlags, suppressNewPrivateContext) {
|
|
50069
50085
|
if (length(props)) {
|
|
50070
|
-
const localVsRemoteMap = arrayToMultiMap(
|
|
50071
|
-
props,
|
|
50072
|
-
(p) => !length(p.declarations) || some(
|
|
50073
|
-
p.declarations,
|
|
50074
|
-
(d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)
|
|
50075
|
-
) ? "local" : "remote"
|
|
50076
|
-
);
|
|
50086
|
+
const localVsRemoteMap = arrayToMultiMap(props, (p) => !length(p.declarations) || some(p.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)) ? "local" : "remote");
|
|
50077
50087
|
const localProps = localVsRemoteMap.get("local") || emptyArray;
|
|
50078
50088
|
let fakespace = parseNodeFactory.createModuleDeclaration(
|
|
50079
50089
|
/*modifiers*/
|
|
@@ -50150,10 +50160,7 @@ function createTypeChecker(host) {
|
|
|
50150
50160
|
}
|
|
50151
50161
|
return cleanup(factory.createExpressionWithTypeArguments(
|
|
50152
50162
|
expr,
|
|
50153
|
-
map(
|
|
50154
|
-
e.typeArguments,
|
|
50155
|
-
(a) => serializeExistingTypeNode(context, a, includePrivateSymbol, bundled) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context)
|
|
50156
|
-
)
|
|
50163
|
+
map(e.typeArguments, (a) => serializeExistingTypeNode(context, a, includePrivateSymbol, bundled) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
|
|
50157
50164
|
));
|
|
50158
50165
|
function cleanup(result2) {
|
|
50159
50166
|
context.enclosingDeclaration = oldEnclosing;
|
|
@@ -50227,14 +50234,20 @@ function createTypeChecker(host) {
|
|
|
50227
50234
|
)] : serializeSignatures(1 /* Construct */, staticType, staticBaseType, 176 /* Constructor */);
|
|
50228
50235
|
const indexSignatures = serializeIndexSignatures(classType, baseTypes[0]);
|
|
50229
50236
|
context.enclosingDeclaration = oldEnclosing;
|
|
50230
|
-
addResult(
|
|
50231
|
-
|
|
50232
|
-
|
|
50233
|
-
|
|
50234
|
-
|
|
50235
|
-
|
|
50236
|
-
|
|
50237
|
-
|
|
50237
|
+
addResult(
|
|
50238
|
+
setTextRange(
|
|
50239
|
+
factory.createClassDeclaration(
|
|
50240
|
+
/*modifiers*/
|
|
50241
|
+
void 0,
|
|
50242
|
+
localName,
|
|
50243
|
+
typeParamDecls,
|
|
50244
|
+
heritageClauses,
|
|
50245
|
+
[...indexSignatures, ...staticMembers, ...constructors, ...publicProperties, ...privateProperties]
|
|
50246
|
+
),
|
|
50247
|
+
symbol.declarations && filter(symbol.declarations, (d) => isClassDeclaration(d) || isClassExpression(d))[0]
|
|
50248
|
+
),
|
|
50249
|
+
modifierFlags
|
|
50250
|
+
);
|
|
50238
50251
|
}
|
|
50239
50252
|
function getSomeTargetNameFromDeclarations(declarations) {
|
|
50240
50253
|
return firstDefined(declarations, (d) => {
|
|
@@ -50280,25 +50293,28 @@ function createTypeChecker(host) {
|
|
|
50280
50293
|
if (((_b = (_a = node.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.kind) === 260 /* VariableDeclaration */) {
|
|
50281
50294
|
const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
50282
50295
|
const { propertyName } = node;
|
|
50283
|
-
addResult(
|
|
50284
|
-
|
|
50285
|
-
|
|
50286
|
-
factory.createImportClause(
|
|
50287
|
-
/*isTypeOnly*/
|
|
50288
|
-
false,
|
|
50289
|
-
/*name*/
|
|
50296
|
+
addResult(
|
|
50297
|
+
factory.createImportDeclaration(
|
|
50298
|
+
/*modifiers*/
|
|
50290
50299
|
void 0,
|
|
50291
|
-
factory.
|
|
50300
|
+
factory.createImportClause(
|
|
50292
50301
|
/*isTypeOnly*/
|
|
50293
50302
|
false,
|
|
50294
|
-
|
|
50295
|
-
|
|
50296
|
-
|
|
50303
|
+
/*name*/
|
|
50304
|
+
void 0,
|
|
50305
|
+
factory.createNamedImports([factory.createImportSpecifier(
|
|
50306
|
+
/*isTypeOnly*/
|
|
50307
|
+
false,
|
|
50308
|
+
propertyName && isIdentifier(propertyName) ? factory.createIdentifier(idText(propertyName)) : void 0,
|
|
50309
|
+
factory.createIdentifier(localName)
|
|
50310
|
+
)])
|
|
50311
|
+
),
|
|
50312
|
+
factory.createStringLiteral(specifier2),
|
|
50313
|
+
/*assertClause*/
|
|
50314
|
+
void 0
|
|
50297
50315
|
),
|
|
50298
|
-
|
|
50299
|
-
|
|
50300
|
-
void 0
|
|
50301
|
-
), 0 /* None */);
|
|
50316
|
+
0 /* None */
|
|
50317
|
+
);
|
|
50302
50318
|
break;
|
|
50303
50319
|
}
|
|
50304
50320
|
Debug.failBadSyntaxKind(((_c = node.parent) == null ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization");
|
|
@@ -50316,22 +50332,28 @@ function createTypeChecker(host) {
|
|
|
50316
50332
|
const initializer = node.initializer;
|
|
50317
50333
|
const uniqueName = factory.createUniqueName(localName);
|
|
50318
50334
|
const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
50319
|
-
addResult(
|
|
50320
|
-
|
|
50321
|
-
|
|
50322
|
-
|
|
50323
|
-
|
|
50324
|
-
|
|
50325
|
-
|
|
50326
|
-
|
|
50327
|
-
|
|
50328
|
-
/*
|
|
50329
|
-
|
|
50330
|
-
|
|
50331
|
-
|
|
50332
|
-
|
|
50333
|
-
|
|
50334
|
-
|
|
50335
|
+
addResult(
|
|
50336
|
+
factory.createImportEqualsDeclaration(
|
|
50337
|
+
/*modifiers*/
|
|
50338
|
+
void 0,
|
|
50339
|
+
/*isTypeOnly*/
|
|
50340
|
+
false,
|
|
50341
|
+
uniqueName,
|
|
50342
|
+
factory.createExternalModuleReference(factory.createStringLiteral(specifier2))
|
|
50343
|
+
),
|
|
50344
|
+
0 /* None */
|
|
50345
|
+
);
|
|
50346
|
+
addResult(
|
|
50347
|
+
factory.createImportEqualsDeclaration(
|
|
50348
|
+
/*modifiers*/
|
|
50349
|
+
void 0,
|
|
50350
|
+
/*isTypeOnly*/
|
|
50351
|
+
false,
|
|
50352
|
+
factory.createIdentifier(localName),
|
|
50353
|
+
factory.createQualifiedName(uniqueName, initializer.name)
|
|
50354
|
+
),
|
|
50355
|
+
modifierFlags
|
|
50356
|
+
);
|
|
50335
50357
|
break;
|
|
50336
50358
|
}
|
|
50337
50359
|
case 271 /* ImportEqualsDeclaration */:
|
|
@@ -50340,20 +50362,23 @@ function createTypeChecker(host) {
|
|
|
50340
50362
|
break;
|
|
50341
50363
|
}
|
|
50342
50364
|
const isLocalImport = !(target.flags & 512 /* ValueModule */) && !isVariableDeclaration(node);
|
|
50343
|
-
addResult(
|
|
50344
|
-
|
|
50345
|
-
|
|
50346
|
-
|
|
50347
|
-
|
|
50348
|
-
|
|
50349
|
-
|
|
50350
|
-
|
|
50351
|
-
|
|
50352
|
-
|
|
50353
|
-
|
|
50354
|
-
|
|
50355
|
-
|
|
50356
|
-
|
|
50365
|
+
addResult(
|
|
50366
|
+
factory.createImportEqualsDeclaration(
|
|
50367
|
+
/*modifiers*/
|
|
50368
|
+
void 0,
|
|
50369
|
+
/*isTypeOnly*/
|
|
50370
|
+
false,
|
|
50371
|
+
factory.createIdentifier(localName),
|
|
50372
|
+
isLocalImport ? symbolToName(
|
|
50373
|
+
target,
|
|
50374
|
+
context,
|
|
50375
|
+
67108863 /* All */,
|
|
50376
|
+
/*expectsIdentifier*/
|
|
50377
|
+
false
|
|
50378
|
+
) : factory.createExternalModuleReference(factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))
|
|
50379
|
+
),
|
|
50380
|
+
isLocalImport ? modifierFlags : 0 /* None */
|
|
50381
|
+
);
|
|
50357
50382
|
break;
|
|
50358
50383
|
case 270 /* NamespaceExportDeclaration */:
|
|
50359
50384
|
addResult(factory.createNamespaceExportDeclaration(idText(node.name)), 0 /* None */);
|
|
@@ -50361,72 +50386,84 @@ function createTypeChecker(host) {
|
|
|
50361
50386
|
case 273 /* ImportClause */: {
|
|
50362
50387
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
50363
50388
|
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
|
50364
|
-
addResult(
|
|
50365
|
-
|
|
50366
|
-
|
|
50367
|
-
|
|
50368
|
-
|
|
50369
|
-
|
|
50370
|
-
|
|
50371
|
-
|
|
50372
|
-
|
|
50389
|
+
addResult(
|
|
50390
|
+
factory.createImportDeclaration(
|
|
50391
|
+
/*modifiers*/
|
|
50392
|
+
void 0,
|
|
50393
|
+
factory.createImportClause(
|
|
50394
|
+
/*isTypeOnly*/
|
|
50395
|
+
false,
|
|
50396
|
+
factory.createIdentifier(localName),
|
|
50397
|
+
/*namedBindings*/
|
|
50398
|
+
void 0
|
|
50399
|
+
),
|
|
50400
|
+
specifier2,
|
|
50401
|
+
node.parent.assertClause
|
|
50373
50402
|
),
|
|
50374
|
-
|
|
50375
|
-
|
|
50376
|
-
), 0 /* None */);
|
|
50403
|
+
0 /* None */
|
|
50404
|
+
);
|
|
50377
50405
|
break;
|
|
50378
50406
|
}
|
|
50379
50407
|
case 274 /* NamespaceImport */: {
|
|
50380
50408
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
50381
50409
|
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
|
50382
|
-
addResult(
|
|
50383
|
-
|
|
50384
|
-
|
|
50385
|
-
factory.createImportClause(
|
|
50386
|
-
/*isTypeOnly*/
|
|
50387
|
-
false,
|
|
50388
|
-
/*name*/
|
|
50410
|
+
addResult(
|
|
50411
|
+
factory.createImportDeclaration(
|
|
50412
|
+
/*modifiers*/
|
|
50389
50413
|
void 0,
|
|
50390
|
-
factory.
|
|
50414
|
+
factory.createImportClause(
|
|
50415
|
+
/*isTypeOnly*/
|
|
50416
|
+
false,
|
|
50417
|
+
/*name*/
|
|
50418
|
+
void 0,
|
|
50419
|
+
factory.createNamespaceImport(factory.createIdentifier(localName))
|
|
50420
|
+
),
|
|
50421
|
+
specifier2,
|
|
50422
|
+
node.parent.parent.assertClause
|
|
50391
50423
|
),
|
|
50392
|
-
|
|
50393
|
-
|
|
50394
|
-
), 0 /* None */);
|
|
50424
|
+
0 /* None */
|
|
50425
|
+
);
|
|
50395
50426
|
break;
|
|
50396
50427
|
}
|
|
50397
50428
|
case 280 /* NamespaceExport */:
|
|
50398
|
-
addResult(
|
|
50399
|
-
|
|
50400
|
-
|
|
50401
|
-
|
|
50402
|
-
|
|
50403
|
-
|
|
50404
|
-
|
|
50405
|
-
|
|
50429
|
+
addResult(
|
|
50430
|
+
factory.createExportDeclaration(
|
|
50431
|
+
/*modifiers*/
|
|
50432
|
+
void 0,
|
|
50433
|
+
/*isTypeOnly*/
|
|
50434
|
+
false,
|
|
50435
|
+
factory.createNamespaceExport(factory.createIdentifier(localName)),
|
|
50436
|
+
factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))
|
|
50437
|
+
),
|
|
50438
|
+
0 /* None */
|
|
50439
|
+
);
|
|
50406
50440
|
break;
|
|
50407
50441
|
case 276 /* ImportSpecifier */: {
|
|
50408
50442
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
50409
50443
|
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
|
50410
|
-
addResult(
|
|
50411
|
-
|
|
50412
|
-
|
|
50413
|
-
factory.createImportClause(
|
|
50414
|
-
/*isTypeOnly*/
|
|
50415
|
-
false,
|
|
50416
|
-
/*name*/
|
|
50444
|
+
addResult(
|
|
50445
|
+
factory.createImportDeclaration(
|
|
50446
|
+
/*modifiers*/
|
|
50417
50447
|
void 0,
|
|
50418
|
-
factory.
|
|
50419
|
-
|
|
50420
|
-
|
|
50421
|
-
|
|
50422
|
-
|
|
50423
|
-
|
|
50424
|
-
|
|
50425
|
-
|
|
50448
|
+
factory.createImportClause(
|
|
50449
|
+
/*isTypeOnly*/
|
|
50450
|
+
false,
|
|
50451
|
+
/*name*/
|
|
50452
|
+
void 0,
|
|
50453
|
+
factory.createNamedImports([
|
|
50454
|
+
factory.createImportSpecifier(
|
|
50455
|
+
/*isTypeOnly*/
|
|
50456
|
+
false,
|
|
50457
|
+
localName !== verbatimTargetName ? factory.createIdentifier(verbatimTargetName) : void 0,
|
|
50458
|
+
factory.createIdentifier(localName)
|
|
50459
|
+
)
|
|
50460
|
+
])
|
|
50461
|
+
),
|
|
50462
|
+
specifier2,
|
|
50463
|
+
node.parent.parent.parent.assertClause
|
|
50426
50464
|
),
|
|
50427
|
-
|
|
50428
|
-
|
|
50429
|
-
), 0 /* None */);
|
|
50465
|
+
0 /* None */
|
|
50466
|
+
);
|
|
50430
50467
|
break;
|
|
50431
50468
|
}
|
|
50432
50469
|
case 281 /* ExportSpecifier */:
|
|
@@ -50454,19 +50491,22 @@ function createTypeChecker(host) {
|
|
|
50454
50491
|
}
|
|
50455
50492
|
}
|
|
50456
50493
|
function serializeExportSpecifier(localName, targetName, specifier) {
|
|
50457
|
-
addResult(
|
|
50458
|
-
|
|
50459
|
-
|
|
50460
|
-
|
|
50461
|
-
false,
|
|
50462
|
-
factory.createNamedExports([factory.createExportSpecifier(
|
|
50494
|
+
addResult(
|
|
50495
|
+
factory.createExportDeclaration(
|
|
50496
|
+
/*modifiers*/
|
|
50497
|
+
void 0,
|
|
50463
50498
|
/*isTypeOnly*/
|
|
50464
50499
|
false,
|
|
50465
|
-
|
|
50466
|
-
|
|
50467
|
-
|
|
50468
|
-
|
|
50469
|
-
|
|
50500
|
+
factory.createNamedExports([factory.createExportSpecifier(
|
|
50501
|
+
/*isTypeOnly*/
|
|
50502
|
+
false,
|
|
50503
|
+
localName !== targetName ? targetName : void 0,
|
|
50504
|
+
localName
|
|
50505
|
+
)]),
|
|
50506
|
+
specifier
|
|
50507
|
+
),
|
|
50508
|
+
0 /* None */
|
|
50509
|
+
);
|
|
50470
50510
|
}
|
|
50471
50511
|
function serializeMaybeAliasAssignment(symbol) {
|
|
50472
50512
|
var _a;
|
|
@@ -50514,20 +50554,23 @@ function createTypeChecker(host) {
|
|
|
50514
50554
|
serializeExportSpecifier(name, getInternalSymbolName(target, symbolName(target)));
|
|
50515
50555
|
} else {
|
|
50516
50556
|
const varName = getUnusedName(name, symbol);
|
|
50517
|
-
addResult(
|
|
50518
|
-
|
|
50519
|
-
|
|
50520
|
-
|
|
50521
|
-
|
|
50522
|
-
|
|
50523
|
-
|
|
50524
|
-
|
|
50525
|
-
|
|
50526
|
-
|
|
50527
|
-
|
|
50528
|
-
|
|
50529
|
-
|
|
50530
|
-
|
|
50557
|
+
addResult(
|
|
50558
|
+
factory.createImportEqualsDeclaration(
|
|
50559
|
+
/*modifiers*/
|
|
50560
|
+
void 0,
|
|
50561
|
+
/*isTypeOnly*/
|
|
50562
|
+
false,
|
|
50563
|
+
factory.createIdentifier(varName),
|
|
50564
|
+
symbolToName(
|
|
50565
|
+
target,
|
|
50566
|
+
context,
|
|
50567
|
+
67108863 /* All */,
|
|
50568
|
+
/*expectsIdentifier*/
|
|
50569
|
+
false
|
|
50570
|
+
)
|
|
50571
|
+
),
|
|
50572
|
+
0 /* None */
|
|
50573
|
+
);
|
|
50531
50574
|
serializeExportSpecifier(name, varName);
|
|
50532
50575
|
}
|
|
50533
50576
|
}
|
|
@@ -50594,60 +50637,72 @@ function createTypeChecker(host) {
|
|
|
50594
50637
|
if (p.flags & 98304 /* Accessor */ && useAccessors) {
|
|
50595
50638
|
const result = [];
|
|
50596
50639
|
if (p.flags & 65536 /* SetAccessor */) {
|
|
50597
|
-
result.push(setTextRange(
|
|
50598
|
-
factory.
|
|
50599
|
-
|
|
50600
|
-
|
|
50601
|
-
|
|
50602
|
-
|
|
50603
|
-
|
|
50604
|
-
|
|
50605
|
-
|
|
50606
|
-
|
|
50607
|
-
|
|
50608
|
-
|
|
50609
|
-
|
|
50610
|
-
|
|
50611
|
-
|
|
50612
|
-
|
|
50640
|
+
result.push(setTextRange(
|
|
50641
|
+
factory.createSetAccessorDeclaration(
|
|
50642
|
+
factory.createModifiersFromModifierFlags(flag),
|
|
50643
|
+
name,
|
|
50644
|
+
[factory.createParameterDeclaration(
|
|
50645
|
+
/*modifiers*/
|
|
50646
|
+
void 0,
|
|
50647
|
+
/*dotDotDotToken*/
|
|
50648
|
+
void 0,
|
|
50649
|
+
"arg",
|
|
50650
|
+
/*questionToken*/
|
|
50651
|
+
void 0,
|
|
50652
|
+
isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled)
|
|
50653
|
+
)],
|
|
50654
|
+
/*body*/
|
|
50655
|
+
void 0
|
|
50656
|
+
),
|
|
50657
|
+
((_b = p.declarations) == null ? void 0 : _b.find(isSetAccessor)) || firstPropertyLikeDecl
|
|
50658
|
+
));
|
|
50613
50659
|
}
|
|
50614
50660
|
if (p.flags & 32768 /* GetAccessor */) {
|
|
50615
50661
|
const isPrivate2 = modifierFlags & 8 /* Private */;
|
|
50616
|
-
result.push(setTextRange(
|
|
50617
|
-
factory.
|
|
50618
|
-
|
|
50619
|
-
|
|
50620
|
-
|
|
50621
|
-
|
|
50622
|
-
|
|
50623
|
-
|
|
50662
|
+
result.push(setTextRange(
|
|
50663
|
+
factory.createGetAccessorDeclaration(
|
|
50664
|
+
factory.createModifiersFromModifierFlags(flag),
|
|
50665
|
+
name,
|
|
50666
|
+
[],
|
|
50667
|
+
isPrivate2 ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled),
|
|
50668
|
+
/*body*/
|
|
50669
|
+
void 0
|
|
50670
|
+
),
|
|
50671
|
+
((_c = p.declarations) == null ? void 0 : _c.find(isGetAccessor)) || firstPropertyLikeDecl
|
|
50672
|
+
));
|
|
50624
50673
|
}
|
|
50625
50674
|
return result;
|
|
50626
50675
|
} else if (p.flags & (4 /* Property */ | 3 /* Variable */ | 98304 /* Accessor */)) {
|
|
50627
|
-
return setTextRange(
|
|
50628
|
-
|
|
50629
|
-
name,
|
|
50630
|
-
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
50631
|
-
isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled),
|
|
50632
|
-
// TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
|
|
50633
|
-
// interface members can't have initializers, however class members _can_
|
|
50634
|
-
/*initializer*/
|
|
50635
|
-
void 0
|
|
50636
|
-
), ((_d = p.declarations) == null ? void 0 : _d.find(or(isPropertyDeclaration, isVariableDeclaration))) || firstPropertyLikeDecl);
|
|
50637
|
-
}
|
|
50638
|
-
if (p.flags & (8192 /* Method */ | 16 /* Function */)) {
|
|
50639
|
-
const type = getTypeOfSymbol(p);
|
|
50640
|
-
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
|
50641
|
-
if (flag & 8 /* Private */) {
|
|
50642
|
-
return setTextRange(createProperty2(
|
|
50676
|
+
return setTextRange(
|
|
50677
|
+
createProperty2(
|
|
50643
50678
|
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* Readonly */ : 0) | flag),
|
|
50644
50679
|
name,
|
|
50645
50680
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
50646
|
-
|
|
50647
|
-
|
|
50681
|
+
isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled),
|
|
50682
|
+
// TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
|
|
50683
|
+
// interface members can't have initializers, however class members _can_
|
|
50648
50684
|
/*initializer*/
|
|
50649
50685
|
void 0
|
|
50650
|
-
),
|
|
50686
|
+
),
|
|
50687
|
+
((_d = p.declarations) == null ? void 0 : _d.find(or(isPropertyDeclaration, isVariableDeclaration))) || firstPropertyLikeDecl
|
|
50688
|
+
);
|
|
50689
|
+
}
|
|
50690
|
+
if (p.flags & (8192 /* Method */ | 16 /* Function */)) {
|
|
50691
|
+
const type = getTypeOfSymbol(p);
|
|
50692
|
+
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
|
50693
|
+
if (flag & 8 /* Private */) {
|
|
50694
|
+
return setTextRange(
|
|
50695
|
+
createProperty2(
|
|
50696
|
+
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* Readonly */ : 0) | flag),
|
|
50697
|
+
name,
|
|
50698
|
+
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
50699
|
+
/*type*/
|
|
50700
|
+
void 0,
|
|
50701
|
+
/*initializer*/
|
|
50702
|
+
void 0
|
|
50703
|
+
),
|
|
50704
|
+
((_e = p.declarations) == null ? void 0 : _e.find(isFunctionLikeDeclaration)) || signatures[0] && signatures[0].declaration || p.declarations && p.declarations[0]
|
|
50705
|
+
);
|
|
50651
50706
|
}
|
|
50652
50707
|
const results2 = [];
|
|
50653
50708
|
for (const sig of signatures) {
|
|
@@ -50718,13 +50773,16 @@ function createTypeChecker(host) {
|
|
|
50718
50773
|
}
|
|
50719
50774
|
}
|
|
50720
50775
|
if (privateProtected) {
|
|
50721
|
-
return [setTextRange(
|
|
50722
|
-
factory.
|
|
50723
|
-
|
|
50724
|
-
|
|
50725
|
-
|
|
50726
|
-
|
|
50727
|
-
|
|
50776
|
+
return [setTextRange(
|
|
50777
|
+
factory.createConstructorDeclaration(
|
|
50778
|
+
factory.createModifiersFromModifierFlags(privateProtected),
|
|
50779
|
+
/*parameters*/
|
|
50780
|
+
[],
|
|
50781
|
+
/*body*/
|
|
50782
|
+
void 0
|
|
50783
|
+
),
|
|
50784
|
+
signatures[0].declaration
|
|
50785
|
+
)];
|
|
50728
50786
|
}
|
|
50729
50787
|
}
|
|
50730
50788
|
const results2 = [];
|
|
@@ -52262,19 +52320,11 @@ function createTypeChecker(host) {
|
|
|
52262
52320
|
function reportCircularityError(symbol) {
|
|
52263
52321
|
const declaration = symbol.valueDeclaration;
|
|
52264
52322
|
if (getEffectiveTypeAnnotationNode(declaration)) {
|
|
52265
|
-
error(
|
|
52266
|
-
symbol.valueDeclaration,
|
|
52267
|
-
Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,
|
|
52268
|
-
symbolToString(symbol)
|
|
52269
|
-
);
|
|
52323
|
+
error(symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
52270
52324
|
return errorType;
|
|
52271
52325
|
}
|
|
52272
52326
|
if (noImplicitAny && (declaration.kind !== 169 /* Parameter */ || declaration.initializer)) {
|
|
52273
|
-
error(
|
|
52274
|
-
symbol.valueDeclaration,
|
|
52275
|
-
Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer,
|
|
52276
|
-
symbolToString(symbol)
|
|
52277
|
-
);
|
|
52327
|
+
error(symbol.valueDeclaration, Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
|
|
52278
52328
|
}
|
|
52279
52329
|
return anyType;
|
|
52280
52330
|
}
|
|
@@ -52302,7 +52352,7 @@ function createTypeChecker(host) {
|
|
|
52302
52352
|
return checkFlags & 2 /* SyntheticProperty */ ? checkFlags & 65536 /* DeferredType */ ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) : (
|
|
52303
52353
|
// NOTE: cast to TransientSymbol should be safe because only TransientSymbols can have CheckFlags.SyntheticProperty
|
|
52304
52354
|
symbol.links.writeType || symbol.links.type
|
|
52305
|
-
) : getTypeOfSymbol(symbol);
|
|
52355
|
+
) : removeMissingType(getTypeOfSymbol(symbol), !!(symbol.flags & 16777216 /* Optional */));
|
|
52306
52356
|
}
|
|
52307
52357
|
if (symbol.flags & 98304 /* Accessor */) {
|
|
52308
52358
|
return checkFlags & 1 /* Instantiated */ ? getWriteTypeOfInstantiatedSymbol(symbol) : getWriteTypeOfAccessors(symbol);
|
|
@@ -52485,10 +52535,7 @@ function createTypeChecker(host) {
|
|
|
52485
52535
|
function getConstructorsForTypeArguments(type, typeArgumentNodes, location) {
|
|
52486
52536
|
const typeArgCount = length(typeArgumentNodes);
|
|
52487
52537
|
const isJavascript = isInJSFile(location);
|
|
52488
|
-
return filter(
|
|
52489
|
-
getSignaturesOfType(type, 1 /* Construct */),
|
|
52490
|
-
(sig) => (isJavascript || typeArgCount >= getMinTypeArgumentCount(sig.typeParameters)) && typeArgCount <= length(sig.typeParameters)
|
|
52491
|
-
);
|
|
52538
|
+
return filter(getSignaturesOfType(type, 1 /* Construct */), (sig) => (isJavascript || typeArgCount >= getMinTypeArgumentCount(sig.typeParameters)) && typeArgCount <= length(sig.typeParameters));
|
|
52492
52539
|
}
|
|
52493
52540
|
function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes, location) {
|
|
52494
52541
|
const signatures = getConstructorsForTypeArguments(type, typeArgumentNodes, location);
|
|
@@ -52635,16 +52682,12 @@ function createTypeChecker(host) {
|
|
|
52635
52682
|
return type.resolvedBaseTypes = emptyArray;
|
|
52636
52683
|
}
|
|
52637
52684
|
if (type === reducedBaseType || hasBaseType(reducedBaseType, type)) {
|
|
52638
|
-
error(
|
|
52639
|
-
type
|
|
52640
|
-
|
|
52641
|
-
|
|
52642
|
-
|
|
52643
|
-
|
|
52644
|
-
void 0,
|
|
52645
|
-
2 /* WriteArrayAsGenericType */
|
|
52646
|
-
)
|
|
52647
|
-
);
|
|
52685
|
+
error(type.symbol.valueDeclaration, Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(
|
|
52686
|
+
type,
|
|
52687
|
+
/*enclosingDeclaration*/
|
|
52688
|
+
void 0,
|
|
52689
|
+
2 /* WriteArrayAsGenericType */
|
|
52690
|
+
));
|
|
52648
52691
|
return type.resolvedBaseTypes = emptyArray;
|
|
52649
52692
|
}
|
|
52650
52693
|
if (type.resolvedBaseTypes === resolvingEmptyArray) {
|
|
@@ -52798,7 +52841,9 @@ function createTypeChecker(host) {
|
|
|
52798
52841
|
if (hasBindableName(member)) {
|
|
52799
52842
|
const memberSymbol = getSymbolOfDeclaration(member);
|
|
52800
52843
|
const value = getEnumMemberValue(member);
|
|
52801
|
-
const memberType = getFreshTypeOfLiteralType(
|
|
52844
|
+
const memberType = getFreshTypeOfLiteralType(
|
|
52845
|
+
value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol)
|
|
52846
|
+
);
|
|
52802
52847
|
getSymbolLinks(memberSymbol).declaredType = memberType;
|
|
52803
52848
|
memberTypeList.push(getRegularTypeOfLiteralType(memberType));
|
|
52804
52849
|
}
|
|
@@ -53206,10 +53251,7 @@ function createTypeChecker(host) {
|
|
|
53206
53251
|
return signature.optionalCallSignatureCache[key] || (signature.optionalCallSignatureCache[key] = createOptionalCallSignature(signature, callChainFlags));
|
|
53207
53252
|
}
|
|
53208
53253
|
function createOptionalCallSignature(signature, callChainFlags) {
|
|
53209
|
-
Debug.assert(
|
|
53210
|
-
callChainFlags === 8 /* IsInnerCallChain */ || callChainFlags === 16 /* IsOuterCallChain */,
|
|
53211
|
-
"An optional call signature can either be for an inner call chain or an outer call chain, but not both."
|
|
53212
|
-
);
|
|
53254
|
+
Debug.assert(callChainFlags === 8 /* IsInnerCallChain */ || callChainFlags === 16 /* IsOuterCallChain */, "An optional call signature can either be for an inner call chain or an outer call chain, but not both.");
|
|
53213
53255
|
const result = cloneSignature(signature);
|
|
53214
53256
|
result.flags |= callChainFlags;
|
|
53215
53257
|
return result;
|
|
@@ -53496,11 +53538,7 @@ function createTypeChecker(host) {
|
|
|
53496
53538
|
for (const info of sourceInfos) {
|
|
53497
53539
|
const indexType = info.keyType;
|
|
53498
53540
|
if (every(types, (t) => !!getIndexInfoOfType(t, indexType))) {
|
|
53499
|
-
result.push(createIndexInfo(
|
|
53500
|
-
indexType,
|
|
53501
|
-
getUnionType(map(types, (t) => getIndexTypeOfType(t, indexType))),
|
|
53502
|
-
some(types, (t) => getIndexInfoOfType(t, indexType).isReadonly)
|
|
53503
|
-
));
|
|
53541
|
+
result.push(createIndexInfo(indexType, getUnionType(map(types, (t) => getIndexTypeOfType(t, indexType))), some(types, (t) => getIndexInfoOfType(t, indexType).isReadonly)));
|
|
53504
53542
|
}
|
|
53505
53543
|
}
|
|
53506
53544
|
return result;
|
|
@@ -53592,11 +53630,7 @@ function createTypeChecker(host) {
|
|
|
53592
53630
|
for (let i = 0; i < indexInfos.length; i++) {
|
|
53593
53631
|
const info = indexInfos[i];
|
|
53594
53632
|
if (info.keyType === newInfo.keyType) {
|
|
53595
|
-
indexInfos[i] = createIndexInfo(
|
|
53596
|
-
info.keyType,
|
|
53597
|
-
union ? getUnionType([info.type, newInfo.type]) : getIntersectionType([info.type, newInfo.type]),
|
|
53598
|
-
union ? info.isReadonly || newInfo.isReadonly : info.isReadonly && newInfo.isReadonly
|
|
53599
|
-
);
|
|
53633
|
+
indexInfos[i] = createIndexInfo(info.keyType, union ? getUnionType([info.type, newInfo.type]) : getIntersectionType([info.type, newInfo.type]), union ? info.isReadonly || newInfo.isReadonly : info.isReadonly && newInfo.isReadonly);
|
|
53600
53634
|
return indexInfos;
|
|
53601
53635
|
}
|
|
53602
53636
|
}
|
|
@@ -53676,20 +53710,23 @@ function createTypeChecker(host) {
|
|
|
53676
53710
|
const classType = getDeclaredTypeOfClassOrInterface(symbol);
|
|
53677
53711
|
let constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : emptyArray;
|
|
53678
53712
|
if (symbol.flags & 16 /* Function */) {
|
|
53679
|
-
constructSignatures = addRange(
|
|
53680
|
-
|
|
53681
|
-
(
|
|
53682
|
-
|
|
53683
|
-
sig.
|
|
53684
|
-
|
|
53685
|
-
|
|
53686
|
-
|
|
53687
|
-
|
|
53688
|
-
|
|
53689
|
-
|
|
53690
|
-
|
|
53691
|
-
|
|
53692
|
-
|
|
53713
|
+
constructSignatures = addRange(
|
|
53714
|
+
constructSignatures.slice(),
|
|
53715
|
+
mapDefined(
|
|
53716
|
+
type.callSignatures,
|
|
53717
|
+
(sig) => isJSConstructor(sig.declaration) ? createSignature(
|
|
53718
|
+
sig.declaration,
|
|
53719
|
+
sig.typeParameters,
|
|
53720
|
+
sig.thisParameter,
|
|
53721
|
+
sig.parameters,
|
|
53722
|
+
classType,
|
|
53723
|
+
/*resolvedTypePredicate*/
|
|
53724
|
+
void 0,
|
|
53725
|
+
sig.minArgumentCount,
|
|
53726
|
+
sig.flags & 167 /* PropagatingFlags */
|
|
53727
|
+
) : void 0
|
|
53728
|
+
)
|
|
53729
|
+
);
|
|
53693
53730
|
}
|
|
53694
53731
|
if (!constructSignatures.length) {
|
|
53695
53732
|
constructSignatures = getDefaultConstructSignatures(classType);
|
|
@@ -53811,11 +53848,7 @@ function createTypeChecker(host) {
|
|
|
53811
53848
|
const isReadonly = !!(templateModifiers & 1 /* IncludeReadonly */ || !(templateModifiers & 2 /* ExcludeReadonly */) && modifiersProp && isReadonlySymbol(modifiersProp));
|
|
53812
53849
|
const stripOptional = strictNullChecks && !isOptional && modifiersProp && modifiersProp.flags & 16777216 /* Optional */;
|
|
53813
53850
|
const lateFlag = modifiersProp ? getIsLateCheckFlag(modifiersProp) : 0;
|
|
53814
|
-
const prop = createSymbol(
|
|
53815
|
-
4 /* Property */ | (isOptional ? 16777216 /* Optional */ : 0),
|
|
53816
|
-
propName,
|
|
53817
|
-
lateFlag | 262144 /* Mapped */ | (isReadonly ? 8 /* Readonly */ : 0) | (stripOptional ? 524288 /* StripOptional */ : 0)
|
|
53818
|
-
);
|
|
53851
|
+
const prop = createSymbol(4 /* Property */ | (isOptional ? 16777216 /* Optional */ : 0), propName, lateFlag | 262144 /* Mapped */ | (isReadonly ? 8 /* Readonly */ : 0) | (stripOptional ? 524288 /* StripOptional */ : 0));
|
|
53819
53852
|
prop.links.mappedType = type;
|
|
53820
53853
|
prop.links.nameType = propNameType;
|
|
53821
53854
|
prop.links.keyType = keyType;
|
|
@@ -54536,31 +54569,21 @@ function createTypeChecker(host) {
|
|
|
54536
54569
|
if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) {
|
|
54537
54570
|
const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
|
|
54538
54571
|
if (neverProp) {
|
|
54539
|
-
return chainDiagnosticMessages(
|
|
54540
|
-
|
|
54541
|
-
|
|
54542
|
-
|
|
54543
|
-
|
|
54544
|
-
|
|
54545
|
-
void 0,
|
|
54546
|
-
536870912 /* NoTypeReduction */
|
|
54547
|
-
),
|
|
54548
|
-
symbolToString(neverProp)
|
|
54549
|
-
);
|
|
54572
|
+
return chainDiagnosticMessages(errorInfo, Diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents, typeToString(
|
|
54573
|
+
type,
|
|
54574
|
+
/*enclosingDeclaration*/
|
|
54575
|
+
void 0,
|
|
54576
|
+
536870912 /* NoTypeReduction */
|
|
54577
|
+
), symbolToString(neverProp));
|
|
54550
54578
|
}
|
|
54551
54579
|
const privateProp = find(getPropertiesOfUnionOrIntersectionType(type), isConflictingPrivateProperty);
|
|
54552
54580
|
if (privateProp) {
|
|
54553
|
-
return chainDiagnosticMessages(
|
|
54554
|
-
|
|
54555
|
-
|
|
54556
|
-
|
|
54557
|
-
|
|
54558
|
-
|
|
54559
|
-
void 0,
|
|
54560
|
-
536870912 /* NoTypeReduction */
|
|
54561
|
-
),
|
|
54562
|
-
symbolToString(privateProp)
|
|
54563
|
-
);
|
|
54581
|
+
return chainDiagnosticMessages(errorInfo, Diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some, typeToString(
|
|
54582
|
+
type,
|
|
54583
|
+
/*enclosingDeclaration*/
|
|
54584
|
+
void 0,
|
|
54585
|
+
536870912 /* NoTypeReduction */
|
|
54586
|
+
), symbolToString(privateProp));
|
|
54564
54587
|
}
|
|
54565
54588
|
}
|
|
54566
54589
|
return errorInfo;
|
|
@@ -54645,16 +54668,12 @@ function createTypeChecker(host) {
|
|
|
54645
54668
|
}
|
|
54646
54669
|
}
|
|
54647
54670
|
}
|
|
54648
|
-
return applicableInfos ? createIndexInfo(
|
|
54649
|
-
|
|
54650
|
-
|
|
54651
|
-
|
|
54652
|
-
|
|
54653
|
-
|
|
54654
|
-
/*initial*/
|
|
54655
|
-
true
|
|
54656
|
-
)
|
|
54657
|
-
) : applicableInfo ? applicableInfo : stringIndexInfo && isApplicableIndexType(keyType, stringType) ? stringIndexInfo : void 0;
|
|
54671
|
+
return applicableInfos ? createIndexInfo(unknownType, getIntersectionType(map(applicableInfos, (info) => info.type)), reduceLeft(
|
|
54672
|
+
applicableInfos,
|
|
54673
|
+
(isReadonly, info) => isReadonly && info.isReadonly,
|
|
54674
|
+
/*initial*/
|
|
54675
|
+
true
|
|
54676
|
+
)) : applicableInfo ? applicableInfo : stringIndexInfo && isApplicableIndexType(keyType, stringType) ? stringIndexInfo : void 0;
|
|
54658
54677
|
}
|
|
54659
54678
|
function isApplicableIndexType(source, target) {
|
|
54660
54679
|
return isTypeAssignableTo(source, target) || target === stringType && isTypeAssignableTo(source, numberType) || target === numberType && (source === numericStringType || !!(source.flags & 128 /* StringLiteral */) && isNumericLiteralName(source.value));
|
|
@@ -55006,12 +55025,7 @@ function createTypeChecker(host) {
|
|
|
55006
55025
|
/*parameterIndex*/
|
|
55007
55026
|
void 0,
|
|
55008
55027
|
type
|
|
55009
|
-
) : createTypePredicate(
|
|
55010
|
-
node.assertsModifier ? 3 /* AssertsIdentifier */ : 1 /* Identifier */,
|
|
55011
|
-
parameterName.escapedText,
|
|
55012
|
-
findIndex(signature.parameters, (p) => p.escapedName === parameterName.escapedText),
|
|
55013
|
-
type
|
|
55014
|
-
);
|
|
55028
|
+
) : createTypePredicate(node.assertsModifier ? 3 /* AssertsIdentifier */ : 1 /* Identifier */, parameterName.escapedText, findIndex(signature.parameters, (p) => p.escapedName === parameterName.escapedText), type);
|
|
55015
55029
|
}
|
|
55016
55030
|
function getUnionOrIntersectionType(types, kind, unionReduction) {
|
|
55017
55031
|
return kind !== 2097152 /* Intersection */ ? getUnionType(types, unionReduction) : getIntersectionType(types);
|
|
@@ -55206,12 +55220,7 @@ function createTypeChecker(host) {
|
|
|
55206
55220
|
if (parameter.type) {
|
|
55207
55221
|
forEachType(getTypeFromTypeNode(parameter.type), (keyType) => {
|
|
55208
55222
|
if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos, keyType)) {
|
|
55209
|
-
indexInfos.push(createIndexInfo(
|
|
55210
|
-
keyType,
|
|
55211
|
-
declaration.type ? getTypeFromTypeNode(declaration.type) : anyType,
|
|
55212
|
-
hasEffectiveModifier(declaration, 64 /* Readonly */),
|
|
55213
|
-
declaration
|
|
55214
|
-
));
|
|
55223
|
+
indexInfos.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
|
|
55215
55224
|
}
|
|
55216
55225
|
});
|
|
55217
55226
|
}
|
|
@@ -55242,9 +55251,12 @@ function createTypeChecker(host) {
|
|
|
55242
55251
|
if (index < typeParameters.length) {
|
|
55243
55252
|
const declaredConstraint = getConstraintOfTypeParameter(typeParameters[index]);
|
|
55244
55253
|
if (declaredConstraint) {
|
|
55245
|
-
const mapper = makeDeferredTypeMapper(
|
|
55246
|
-
|
|
55247
|
-
|
|
55254
|
+
const mapper = makeDeferredTypeMapper(
|
|
55255
|
+
typeParameters,
|
|
55256
|
+
typeParameters.map((_, index2) => () => {
|
|
55257
|
+
return getEffectiveTypeArgumentAtIndex(typeReference, typeParameters, index2);
|
|
55258
|
+
})
|
|
55259
|
+
);
|
|
55248
55260
|
const constraint = instantiateType(declaredConstraint, mapper);
|
|
55249
55261
|
if (constraint !== typeParameter) {
|
|
55250
55262
|
inferences = append(inferences, constraint);
|
|
@@ -55261,10 +55273,7 @@ function createTypeChecker(host) {
|
|
|
55261
55273
|
} else if (grandParent.kind === 200 /* MappedType */ && grandParent.type && skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 194 /* ConditionalType */ && grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 200 /* MappedType */ && grandParent.parent.checkType.type) {
|
|
55262
55274
|
const checkMappedType2 = grandParent.parent.checkType;
|
|
55263
55275
|
const nodeType = getTypeFromTypeNode(checkMappedType2.type);
|
|
55264
|
-
inferences = append(inferences, instantiateType(
|
|
55265
|
-
nodeType,
|
|
55266
|
-
makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(checkMappedType2.typeParameter)), checkMappedType2.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType2.typeParameter.constraint) : keyofConstraintType)
|
|
55267
|
-
));
|
|
55276
|
+
inferences = append(inferences, instantiateType(nodeType, makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(checkMappedType2.typeParameter)), checkMappedType2.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType2.typeParameter.constraint) : keyofConstraintType)));
|
|
55268
55277
|
}
|
|
55269
55278
|
}
|
|
55270
55279
|
}
|
|
@@ -55439,12 +55448,7 @@ function createTypeChecker(host) {
|
|
|
55439
55448
|
const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
55440
55449
|
let instantiation = links.instantiations.get(id);
|
|
55441
55450
|
if (!instantiation) {
|
|
55442
|
-
links.instantiations.set(id, instantiation = instantiateTypeWithAlias(
|
|
55443
|
-
type,
|
|
55444
|
-
createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters), isInJSFile(symbol.valueDeclaration))),
|
|
55445
|
-
aliasSymbol,
|
|
55446
|
-
aliasTypeArguments
|
|
55447
|
-
));
|
|
55451
|
+
links.instantiations.set(id, instantiation = instantiateTypeWithAlias(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters), isInJSFile(symbol.valueDeclaration))), aliasSymbol, aliasTypeArguments));
|
|
55448
55452
|
}
|
|
55449
55453
|
return instantiation;
|
|
55450
55454
|
}
|
|
@@ -56280,11 +56284,7 @@ function createTypeChecker(host) {
|
|
|
56280
56284
|
const flags = elementFlags[i];
|
|
56281
56285
|
combinedFlags |= flags;
|
|
56282
56286
|
if (!(combinedFlags & 12 /* Variable */)) {
|
|
56283
|
-
const property = createSymbol(
|
|
56284
|
-
4 /* Property */ | (flags & 2 /* Optional */ ? 16777216 /* Optional */ : 0),
|
|
56285
|
-
"" + i,
|
|
56286
|
-
readonly ? 8 /* Readonly */ : 0
|
|
56287
|
-
);
|
|
56287
|
+
const property = createSymbol(4 /* Property */ | (flags & 2 /* Optional */ ? 16777216 /* Optional */ : 0), "" + i, readonly ? 8 /* Readonly */ : 0);
|
|
56288
56288
|
property.links.tupleLabelDeclaration = namedMemberDeclarations == null ? void 0 : namedMemberDeclarations[i];
|
|
56289
56289
|
property.links.type = typeParameter;
|
|
56290
56290
|
properties.push(property);
|
|
@@ -56355,7 +56355,10 @@ function createTypeChecker(host) {
|
|
|
56355
56355
|
} else if (isTupleType(type)) {
|
|
56356
56356
|
const elements = getElementTypes(type);
|
|
56357
56357
|
if (elements.length + expandedTypes.length >= 1e4) {
|
|
56358
|
-
error(
|
|
56358
|
+
error(
|
|
56359
|
+
currentNode,
|
|
56360
|
+
isPartOfTypeNode(currentNode) ? Diagnostics.Type_produces_a_tuple_type_that_is_too_large_to_represent : Diagnostics.Expression_produces_a_tuple_type_that_is_too_large_to_represent
|
|
56361
|
+
);
|
|
56359
56362
|
return errorType;
|
|
56360
56363
|
}
|
|
56361
56364
|
forEach(elements, (t, n) => {
|
|
@@ -56374,10 +56377,7 @@ function createTypeChecker(host) {
|
|
|
56374
56377
|
expandedFlags[i] = 1 /* Required */;
|
|
56375
56378
|
}
|
|
56376
56379
|
if (firstRestIndex >= 0 && firstRestIndex < lastOptionalOrRestIndex) {
|
|
56377
|
-
expandedTypes[firstRestIndex] = getUnionType(sameMap(
|
|
56378
|
-
expandedTypes.slice(firstRestIndex, lastOptionalOrRestIndex + 1),
|
|
56379
|
-
(t, i) => expandedFlags[firstRestIndex + i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t
|
|
56380
|
-
));
|
|
56380
|
+
expandedTypes[firstRestIndex] = getUnionType(sameMap(expandedTypes.slice(firstRestIndex, lastOptionalOrRestIndex + 1), (t, i) => expandedFlags[firstRestIndex + i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t));
|
|
56381
56381
|
expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
56382
56382
|
expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
56383
56383
|
expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
@@ -56415,10 +56415,7 @@ function createTypeChecker(host) {
|
|
|
56415
56415
|
);
|
|
56416
56416
|
}
|
|
56417
56417
|
function getKnownKeysOfTupleType(type) {
|
|
56418
|
-
return getUnionType(append(
|
|
56419
|
-
arrayOf(type.target.fixedLength, (i) => getStringLiteralType("" + i)),
|
|
56420
|
-
getIndexType(type.target.readonly ? globalReadonlyArrayType : globalArrayType)
|
|
56421
|
-
));
|
|
56418
|
+
return getUnionType(append(arrayOf(type.target.fixedLength, (i) => getStringLiteralType("" + i)), getIndexType(type.target.readonly ? globalReadonlyArrayType : globalArrayType)));
|
|
56422
56419
|
}
|
|
56423
56420
|
function getStartElementCount(type, flags) {
|
|
56424
56421
|
const index = findIndex(type.elementFlags, (f) => !(f & flags));
|
|
@@ -56554,10 +56551,7 @@ function createTypeChecker(host) {
|
|
|
56554
56551
|
}
|
|
56555
56552
|
}
|
|
56556
56553
|
function removeStringLiteralsMatchedByTemplateLiterals(types) {
|
|
56557
|
-
const templates = filter(
|
|
56558
|
-
types,
|
|
56559
|
-
(t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types))
|
|
56560
|
-
);
|
|
56554
|
+
const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types)));
|
|
56561
56555
|
if (templates.length) {
|
|
56562
56556
|
let i = types.length;
|
|
56563
56557
|
while (i > 0) {
|
|
@@ -56727,12 +56721,7 @@ function createTypeChecker(host) {
|
|
|
56727
56721
|
const links = getNodeLinks(node);
|
|
56728
56722
|
if (!links.resolvedType) {
|
|
56729
56723
|
const aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
56730
|
-
links.resolvedType = getUnionType(
|
|
56731
|
-
map(node.types, getTypeFromTypeNode),
|
|
56732
|
-
1 /* Literal */,
|
|
56733
|
-
aliasSymbol,
|
|
56734
|
-
getTypeArgumentsForAliasSymbol(aliasSymbol)
|
|
56735
|
-
);
|
|
56724
|
+
links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNode), 1 /* Literal */, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
|
|
56736
56725
|
}
|
|
56737
56726
|
return links.resolvedType;
|
|
56738
56727
|
}
|
|
@@ -57085,11 +57074,7 @@ function createTypeChecker(host) {
|
|
|
57085
57074
|
}
|
|
57086
57075
|
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
57087
57076
|
type = getReducedType(type);
|
|
57088
|
-
return shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(
|
|
57089
|
-
type,
|
|
57090
|
-
(indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
|
|
57091
|
-
indexFlags === defaultIndexFlags
|
|
57092
|
-
);
|
|
57077
|
+
return shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(type, (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */), indexFlags === defaultIndexFlags);
|
|
57093
57078
|
}
|
|
57094
57079
|
function getExtractStringType(type) {
|
|
57095
57080
|
if (keyofStringsOnly) {
|
|
@@ -57329,13 +57314,7 @@ function createTypeChecker(host) {
|
|
|
57329
57314
|
error(indexNode, Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
|
|
57330
57315
|
return undefinedType;
|
|
57331
57316
|
}
|
|
57332
|
-
error(
|
|
57333
|
-
indexNode,
|
|
57334
|
-
Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2,
|
|
57335
|
-
typeToString(objectType),
|
|
57336
|
-
getTypeReferenceArity(objectType),
|
|
57337
|
-
unescapeLeadingUnderscores(propName)
|
|
57338
|
-
);
|
|
57317
|
+
error(indexNode, Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), unescapeLeadingUnderscores(propName));
|
|
57339
57318
|
} else {
|
|
57340
57319
|
error(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
57341
57320
|
}
|
|
@@ -58616,24 +58595,29 @@ function createTypeChecker(host) {
|
|
|
58616
58595
|
if (typeVariable) {
|
|
58617
58596
|
const mappedTypeVariable = instantiateType(typeVariable, mapper);
|
|
58618
58597
|
if (typeVariable !== mappedTypeVariable) {
|
|
58619
|
-
return mapTypeWithAlias(
|
|
58620
|
-
|
|
58621
|
-
|
|
58622
|
-
|
|
58623
|
-
if (
|
|
58624
|
-
|
|
58625
|
-
|
|
58626
|
-
|
|
58627
|
-
|
|
58628
|
-
|
|
58629
|
-
|
|
58630
|
-
|
|
58598
|
+
return mapTypeWithAlias(
|
|
58599
|
+
getReducedType(mappedTypeVariable),
|
|
58600
|
+
(t) => {
|
|
58601
|
+
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
58602
|
+
if (!type.declaration.nameType) {
|
|
58603
|
+
let constraint;
|
|
58604
|
+
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
58605
|
+
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
58606
|
+
}
|
|
58607
|
+
if (isGenericTupleType(t)) {
|
|
58608
|
+
return instantiateMappedGenericTupleType(t, type, typeVariable, mapper);
|
|
58609
|
+
}
|
|
58610
|
+
if (isTupleType(t)) {
|
|
58611
|
+
return instantiateMappedTupleType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
58612
|
+
}
|
|
58631
58613
|
}
|
|
58614
|
+
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
58632
58615
|
}
|
|
58633
|
-
return
|
|
58634
|
-
}
|
|
58635
|
-
|
|
58636
|
-
|
|
58616
|
+
return t;
|
|
58617
|
+
},
|
|
58618
|
+
aliasSymbol,
|
|
58619
|
+
aliasTypeArguments
|
|
58620
|
+
);
|
|
58637
58621
|
}
|
|
58638
58622
|
}
|
|
58639
58623
|
return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments);
|
|
@@ -59027,10 +59011,13 @@ function createTypeChecker(host) {
|
|
|
59027
59011
|
const resultObj = errorOutputContainer || {};
|
|
59028
59012
|
checkTypeAssignableTo(source, target, node, headMessage, containingMessageChain, resultObj);
|
|
59029
59013
|
const diagnostic = resultObj.errors[resultObj.errors.length - 1];
|
|
59030
|
-
addRelatedInfo(
|
|
59031
|
-
|
|
59032
|
-
|
|
59033
|
-
|
|
59014
|
+
addRelatedInfo(
|
|
59015
|
+
diagnostic,
|
|
59016
|
+
createDiagnosticForNode(
|
|
59017
|
+
node,
|
|
59018
|
+
signatures === constructSignatures ? Diagnostics.Did_you_mean_to_use_new_with_this_expression : Diagnostics.Did_you_mean_to_call_this_expression
|
|
59019
|
+
)
|
|
59020
|
+
);
|
|
59034
59021
|
return true;
|
|
59035
59022
|
}
|
|
59036
59023
|
}
|
|
@@ -59087,10 +59074,13 @@ function createTypeChecker(host) {
|
|
|
59087
59074
|
);
|
|
59088
59075
|
if (resultObj.errors) {
|
|
59089
59076
|
if (target.symbol && length(target.symbol.declarations)) {
|
|
59090
|
-
addRelatedInfo(
|
|
59091
|
-
|
|
59092
|
-
|
|
59093
|
-
|
|
59077
|
+
addRelatedInfo(
|
|
59078
|
+
resultObj.errors[resultObj.errors.length - 1],
|
|
59079
|
+
createDiagnosticForNode(
|
|
59080
|
+
target.symbol.declarations[0],
|
|
59081
|
+
Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature
|
|
59082
|
+
)
|
|
59083
|
+
);
|
|
59094
59084
|
}
|
|
59095
59085
|
if ((getFunctionFlags(node) & 2 /* Async */) === 0 && !getTypeOfPropertyOfType(sourceReturn, "then") && checkTypeRelatedTo(
|
|
59096
59086
|
createPromiseType(sourceReturn),
|
|
@@ -59099,10 +59089,13 @@ function createTypeChecker(host) {
|
|
|
59099
59089
|
/*errorNode*/
|
|
59100
59090
|
void 0
|
|
59101
59091
|
)) {
|
|
59102
|
-
addRelatedInfo(
|
|
59103
|
-
|
|
59104
|
-
|
|
59105
|
-
|
|
59092
|
+
addRelatedInfo(
|
|
59093
|
+
resultObj.errors[resultObj.errors.length - 1],
|
|
59094
|
+
createDiagnosticForNode(
|
|
59095
|
+
node,
|
|
59096
|
+
Diagnostics.Did_you_mean_to_mark_this_function_as_async
|
|
59097
|
+
)
|
|
59098
|
+
);
|
|
59106
59099
|
}
|
|
59107
59100
|
return true;
|
|
59108
59101
|
}
|
|
@@ -59197,12 +59190,15 @@ function createTypeChecker(host) {
|
|
|
59197
59190
|
if (!issuedElaboration && (targetProp && length(targetProp.declarations) || target.symbol && length(target.symbol.declarations))) {
|
|
59198
59191
|
const targetNode = targetProp && length(targetProp.declarations) ? targetProp.declarations[0] : target.symbol.declarations[0];
|
|
59199
59192
|
if (!getSourceFileOfNode(targetNode).hasNoDefaultLib) {
|
|
59200
|
-
addRelatedInfo(
|
|
59201
|
-
|
|
59202
|
-
|
|
59203
|
-
|
|
59204
|
-
|
|
59205
|
-
|
|
59193
|
+
addRelatedInfo(
|
|
59194
|
+
reportedDiag,
|
|
59195
|
+
createDiagnosticForNode(
|
|
59196
|
+
targetNode,
|
|
59197
|
+
Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1,
|
|
59198
|
+
propertyName && !(nameType.flags & 8192 /* UniqueESSymbol */) ? unescapeLeadingUnderscores(propertyName) : typeToString(nameType),
|
|
59199
|
+
typeToString(target)
|
|
59200
|
+
)
|
|
59201
|
+
);
|
|
59206
59202
|
}
|
|
59207
59203
|
}
|
|
59208
59204
|
}
|
|
@@ -59584,11 +59580,7 @@ function createTypeChecker(host) {
|
|
|
59584
59580
|
}
|
|
59585
59581
|
if (!related) {
|
|
59586
59582
|
if (reportErrors2) {
|
|
59587
|
-
errorReporter(
|
|
59588
|
-
Diagnostics.Types_of_parameters_0_and_1_are_incompatible,
|
|
59589
|
-
unescapeLeadingUnderscores(getParameterNameAtPosition(source, i)),
|
|
59590
|
-
unescapeLeadingUnderscores(getParameterNameAtPosition(target, i))
|
|
59591
|
-
);
|
|
59583
|
+
errorReporter(Diagnostics.Types_of_parameters_0_and_1_are_incompatible, unescapeLeadingUnderscores(getParameterNameAtPosition(source, i)), unescapeLeadingUnderscores(getParameterNameAtPosition(target, i)));
|
|
59592
59584
|
}
|
|
59593
59585
|
return 0 /* False */;
|
|
59594
59586
|
}
|
|
@@ -59709,16 +59701,12 @@ function createTypeChecker(host) {
|
|
|
59709
59701
|
const targetProperty = getPropertyOfType(targetEnumType, property.escapedName);
|
|
59710
59702
|
if (!targetProperty || !(targetProperty.flags & 8 /* EnumMember */)) {
|
|
59711
59703
|
if (errorReporter) {
|
|
59712
|
-
errorReporter(
|
|
59713
|
-
|
|
59714
|
-
|
|
59715
|
-
|
|
59716
|
-
|
|
59717
|
-
|
|
59718
|
-
void 0,
|
|
59719
|
-
64 /* UseFullyQualifiedType */
|
|
59720
|
-
)
|
|
59721
|
-
);
|
|
59704
|
+
errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(property), typeToString(
|
|
59705
|
+
getDeclaredTypeOfSymbol(targetSymbol),
|
|
59706
|
+
/*enclosingDeclaration*/
|
|
59707
|
+
void 0,
|
|
59708
|
+
64 /* UseFullyQualifiedType */
|
|
59709
|
+
));
|
|
59722
59710
|
enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
|
|
59723
59711
|
} else {
|
|
59724
59712
|
enumRelation.set(id, 2 /* Failed */);
|
|
@@ -60391,18 +60379,9 @@ function createTypeChecker(host) {
|
|
|
60391
60379
|
}
|
|
60392
60380
|
}
|
|
60393
60381
|
if (suggestion !== void 0) {
|
|
60394
|
-
reportParentSkippedError(
|
|
60395
|
-
Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2,
|
|
60396
|
-
symbolToString(prop),
|
|
60397
|
-
typeToString(errorTarget),
|
|
60398
|
-
suggestion
|
|
60399
|
-
);
|
|
60382
|
+
reportParentSkippedError(Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2, symbolToString(prop), typeToString(errorTarget), suggestion);
|
|
60400
60383
|
} else {
|
|
60401
|
-
reportParentSkippedError(
|
|
60402
|
-
Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
|
|
60403
|
-
symbolToString(prop),
|
|
60404
|
-
typeToString(errorTarget)
|
|
60405
|
-
);
|
|
60384
|
+
reportParentSkippedError(Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(errorTarget));
|
|
60406
60385
|
}
|
|
60407
60386
|
}
|
|
60408
60387
|
}
|
|
@@ -61604,12 +61583,7 @@ function createTypeChecker(host) {
|
|
|
61604
61583
|
if (sourcePropFlags & 8 /* Private */ && targetPropFlags & 8 /* Private */) {
|
|
61605
61584
|
reportError(Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp));
|
|
61606
61585
|
} else {
|
|
61607
|
-
reportError(
|
|
61608
|
-
Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2,
|
|
61609
|
-
symbolToString(targetProp),
|
|
61610
|
-
typeToString(sourcePropFlags & 8 /* Private */ ? source2 : target2),
|
|
61611
|
-
typeToString(sourcePropFlags & 8 /* Private */ ? target2 : source2)
|
|
61612
|
-
);
|
|
61586
|
+
reportError(Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 /* Private */ ? source2 : target2), typeToString(sourcePropFlags & 8 /* Private */ ? target2 : source2));
|
|
61613
61587
|
}
|
|
61614
61588
|
}
|
|
61615
61589
|
return 0 /* False */;
|
|
@@ -61617,23 +61591,13 @@ function createTypeChecker(host) {
|
|
|
61617
61591
|
} else if (targetPropFlags & 16 /* Protected */) {
|
|
61618
61592
|
if (!isValidOverrideOf(sourceProp, targetProp)) {
|
|
61619
61593
|
if (reportErrors2) {
|
|
61620
|
-
reportError(
|
|
61621
|
-
Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2,
|
|
61622
|
-
symbolToString(targetProp),
|
|
61623
|
-
typeToString(getDeclaringClass(sourceProp) || source2),
|
|
61624
|
-
typeToString(getDeclaringClass(targetProp) || target2)
|
|
61625
|
-
);
|
|
61594
|
+
reportError(Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(getDeclaringClass(sourceProp) || source2), typeToString(getDeclaringClass(targetProp) || target2));
|
|
61626
61595
|
}
|
|
61627
61596
|
return 0 /* False */;
|
|
61628
61597
|
}
|
|
61629
61598
|
} else if (sourcePropFlags & 16 /* Protected */) {
|
|
61630
61599
|
if (reportErrors2) {
|
|
61631
|
-
reportError(
|
|
61632
|
-
Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2,
|
|
61633
|
-
symbolToString(targetProp),
|
|
61634
|
-
typeToString(source2),
|
|
61635
|
-
typeToString(target2)
|
|
61636
|
-
);
|
|
61600
|
+
reportError(Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source2), typeToString(target2));
|
|
61637
61601
|
}
|
|
61638
61602
|
return 0 /* False */;
|
|
61639
61603
|
}
|
|
@@ -61649,12 +61613,7 @@ function createTypeChecker(host) {
|
|
|
61649
61613
|
}
|
|
61650
61614
|
if (!skipOptional && sourceProp.flags & 16777216 /* Optional */ && targetProp.flags & 106500 /* ClassMember */ && !(targetProp.flags & 16777216 /* Optional */)) {
|
|
61651
61615
|
if (reportErrors2) {
|
|
61652
|
-
reportError(
|
|
61653
|
-
Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2,
|
|
61654
|
-
symbolToString(targetProp),
|
|
61655
|
-
typeToString(source2),
|
|
61656
|
-
typeToString(target2)
|
|
61657
|
-
);
|
|
61616
|
+
reportError(Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source2), typeToString(target2));
|
|
61658
61617
|
}
|
|
61659
61618
|
return 0 /* False */;
|
|
61660
61619
|
}
|
|
@@ -61900,8 +61859,14 @@ function createTypeChecker(host) {
|
|
|
61900
61859
|
}
|
|
61901
61860
|
const sourceIsJSConstructor = source2.symbol && isJSConstructor(source2.symbol.valueDeclaration);
|
|
61902
61861
|
const targetIsJSConstructor = target2.symbol && isJSConstructor(target2.symbol.valueDeclaration);
|
|
61903
|
-
const sourceSignatures = getSignaturesOfType(
|
|
61904
|
-
|
|
61862
|
+
const sourceSignatures = getSignaturesOfType(
|
|
61863
|
+
source2,
|
|
61864
|
+
sourceIsJSConstructor && kind === 1 /* Construct */ ? 0 /* Call */ : kind
|
|
61865
|
+
);
|
|
61866
|
+
const targetSignatures = getSignaturesOfType(
|
|
61867
|
+
target2,
|
|
61868
|
+
targetIsJSConstructor && kind === 1 /* Construct */ ? 0 /* Call */ : kind
|
|
61869
|
+
);
|
|
61905
61870
|
if (kind === 1 /* Construct */ && sourceSignatures.length && targetSignatures.length) {
|
|
61906
61871
|
const sourceIsAbstract = !!(sourceSignatures[0].flags & 4 /* Abstract */);
|
|
61907
61872
|
const targetIsAbstract = !!(targetSignatures[0].flags & 4 /* Abstract */);
|
|
@@ -61975,18 +61940,14 @@ function createTypeChecker(host) {
|
|
|
61975
61940
|
shouldElaborateErrors = false;
|
|
61976
61941
|
}
|
|
61977
61942
|
if (shouldElaborateErrors) {
|
|
61978
|
-
reportError(
|
|
61979
|
-
|
|
61980
|
-
|
|
61981
|
-
|
|
61982
|
-
|
|
61983
|
-
|
|
61984
|
-
|
|
61985
|
-
|
|
61986
|
-
void 0,
|
|
61987
|
-
kind
|
|
61988
|
-
)
|
|
61989
|
-
);
|
|
61943
|
+
reportError(Diagnostics.Type_0_provides_no_match_for_the_signature_1, typeToString(source2), signatureToString(
|
|
61944
|
+
t,
|
|
61945
|
+
/*enclosingDeclaration*/
|
|
61946
|
+
void 0,
|
|
61947
|
+
/*flags*/
|
|
61948
|
+
void 0,
|
|
61949
|
+
kind
|
|
61950
|
+
));
|
|
61990
61951
|
}
|
|
61991
61952
|
return 0 /* False */;
|
|
61992
61953
|
}
|
|
@@ -62019,16 +61980,7 @@ function createTypeChecker(host) {
|
|
|
62019
61980
|
}
|
|
62020
61981
|
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
62021
61982
|
const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
|
|
62022
|
-
return compareSignaturesRelated(
|
|
62023
|
-
erase ? getErasedSignature(source2) : source2,
|
|
62024
|
-
erase ? getErasedSignature(target2) : target2,
|
|
62025
|
-
checkMode,
|
|
62026
|
-
reportErrors2,
|
|
62027
|
-
reportError,
|
|
62028
|
-
incompatibleReporter,
|
|
62029
|
-
isRelatedToWorker2,
|
|
62030
|
-
reportUnreliableMapper
|
|
62031
|
-
);
|
|
61983
|
+
return compareSignaturesRelated(erase ? getErasedSignature(source2) : source2, erase ? getErasedSignature(target2) : target2, checkMode, reportErrors2, reportError, incompatibleReporter, isRelatedToWorker2, reportUnreliableMapper);
|
|
62032
61984
|
function isRelatedToWorker2(source3, target3, reportErrors3) {
|
|
62033
61985
|
return isRelatedTo(
|
|
62034
61986
|
source3,
|
|
@@ -62937,13 +62889,7 @@ function createTypeChecker(host) {
|
|
|
62937
62889
|
}
|
|
62938
62890
|
}
|
|
62939
62891
|
}
|
|
62940
|
-
const result = createAnonymousType(
|
|
62941
|
-
type.symbol,
|
|
62942
|
-
members,
|
|
62943
|
-
emptyArray,
|
|
62944
|
-
emptyArray,
|
|
62945
|
-
sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly))
|
|
62946
|
-
);
|
|
62892
|
+
const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly)));
|
|
62947
62893
|
result.objectFlags |= getObjectFlags(type) & (4096 /* JSLiteral */ | 262144 /* NonInferrableType */);
|
|
62948
62894
|
return result;
|
|
62949
62895
|
}
|
|
@@ -63156,19 +63102,25 @@ function createTypeChecker(host) {
|
|
|
63156
63102
|
return context;
|
|
63157
63103
|
}
|
|
63158
63104
|
function makeFixingMapperForContext(context) {
|
|
63159
|
-
return makeDeferredTypeMapper(
|
|
63160
|
-
|
|
63161
|
-
|
|
63162
|
-
|
|
63163
|
-
|
|
63164
|
-
|
|
63165
|
-
|
|
63166
|
-
|
|
63105
|
+
return makeDeferredTypeMapper(
|
|
63106
|
+
map(context.inferences, (i) => i.typeParameter),
|
|
63107
|
+
map(context.inferences, (inference, i) => () => {
|
|
63108
|
+
if (!inference.isFixed) {
|
|
63109
|
+
inferFromIntraExpressionSites(context);
|
|
63110
|
+
clearCachedInferences(context.inferences);
|
|
63111
|
+
inference.isFixed = true;
|
|
63112
|
+
}
|
|
63113
|
+
return getInferredType(context, i);
|
|
63114
|
+
})
|
|
63115
|
+
);
|
|
63167
63116
|
}
|
|
63168
63117
|
function makeNonFixingMapperForContext(context) {
|
|
63169
|
-
return makeDeferredTypeMapper(
|
|
63170
|
-
|
|
63171
|
-
|
|
63118
|
+
return makeDeferredTypeMapper(
|
|
63119
|
+
map(context.inferences, (i) => i.typeParameter),
|
|
63120
|
+
map(context.inferences, (_, i) => () => {
|
|
63121
|
+
return getInferredType(context, i);
|
|
63122
|
+
})
|
|
63123
|
+
);
|
|
63172
63124
|
}
|
|
63173
63125
|
function clearCachedInferences(inferences) {
|
|
63174
63126
|
for (const inference of inferences) {
|
|
@@ -63513,7 +63465,6 @@ function createTypeChecker(host) {
|
|
|
63513
63465
|
let bivariant = false;
|
|
63514
63466
|
let propagationType;
|
|
63515
63467
|
let inferencePriority = 2048 /* MaxValue */;
|
|
63516
|
-
let allowComplexConstraintInference = true;
|
|
63517
63468
|
let visited;
|
|
63518
63469
|
let sourceStack;
|
|
63519
63470
|
let targetStack;
|
|
@@ -63668,8 +63619,7 @@ function createTypeChecker(host) {
|
|
|
63668
63619
|
source = getReducedType(source);
|
|
63669
63620
|
if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */))) {
|
|
63670
63621
|
const apparentSource = getApparentType(source);
|
|
63671
|
-
if (apparentSource !== source &&
|
|
63672
|
-
allowComplexConstraintInference = false;
|
|
63622
|
+
if (apparentSource !== source && !(apparentSource.flags & (524288 /* Object */ | 2097152 /* Intersection */))) {
|
|
63673
63623
|
return inferFromTypes(apparentSource, target);
|
|
63674
63624
|
}
|
|
63675
63625
|
source = apparentSource;
|
|
@@ -63918,11 +63868,7 @@ function createTypeChecker(host) {
|
|
|
63918
63868
|
)) {
|
|
63919
63869
|
allTypeFlags &= ~2112 /* BigIntLike */;
|
|
63920
63870
|
}
|
|
63921
|
-
const matchingType = reduceLeft(
|
|
63922
|
-
constraintTypes,
|
|
63923
|
-
(left, right) => !(right.flags & allTypeFlags) ? left : left.flags & 4 /* String */ ? left : right.flags & 4 /* String */ ? source2 : left.flags & 134217728 /* TemplateLiteral */ ? left : right.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source2, right) ? source2 : left.flags & 268435456 /* StringMapping */ ? left : right.flags & 268435456 /* StringMapping */ && str === applyStringMapping(right.symbol, str) ? source2 : left.flags & 128 /* StringLiteral */ ? left : right.flags & 128 /* StringLiteral */ && right.value === str ? right : left.flags & 8 /* Number */ ? left : right.flags & 8 /* Number */ ? getNumberLiteralType(+str) : left.flags & 32 /* Enum */ ? left : right.flags & 32 /* Enum */ ? getNumberLiteralType(+str) : left.flags & 256 /* NumberLiteral */ ? left : right.flags & 256 /* NumberLiteral */ && right.value === +str ? right : left.flags & 64 /* BigInt */ ? left : right.flags & 64 /* BigInt */ ? parseBigIntLiteralType(str) : left.flags & 2048 /* BigIntLiteral */ ? left : right.flags & 2048 /* BigIntLiteral */ && pseudoBigIntToString(right.value) === str ? right : left.flags & 16 /* Boolean */ ? left : right.flags & 16 /* Boolean */ ? str === "true" ? trueType : str === "false" ? falseType : booleanType : left.flags & 512 /* BooleanLiteral */ ? left : right.flags & 512 /* BooleanLiteral */ && right.intrinsicName === str ? right : left.flags & 32768 /* Undefined */ ? left : right.flags & 32768 /* Undefined */ && right.intrinsicName === str ? right : left.flags & 65536 /* Null */ ? left : right.flags & 65536 /* Null */ && right.intrinsicName === str ? right : left,
|
|
63924
|
-
neverType
|
|
63925
|
-
);
|
|
63871
|
+
const matchingType = reduceLeft(constraintTypes, (left, right) => !(right.flags & allTypeFlags) ? left : left.flags & 4 /* String */ ? left : right.flags & 4 /* String */ ? source2 : left.flags & 134217728 /* TemplateLiteral */ ? left : right.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source2, right) ? source2 : left.flags & 268435456 /* StringMapping */ ? left : right.flags & 268435456 /* StringMapping */ && str === applyStringMapping(right.symbol, str) ? source2 : left.flags & 128 /* StringLiteral */ ? left : right.flags & 128 /* StringLiteral */ && right.value === str ? right : left.flags & 8 /* Number */ ? left : right.flags & 8 /* Number */ ? getNumberLiteralType(+str) : left.flags & 32 /* Enum */ ? left : right.flags & 32 /* Enum */ ? getNumberLiteralType(+str) : left.flags & 256 /* NumberLiteral */ ? left : right.flags & 256 /* NumberLiteral */ && right.value === +str ? right : left.flags & 64 /* BigInt */ ? left : right.flags & 64 /* BigInt */ ? parseBigIntLiteralType(str) : left.flags & 2048 /* BigIntLiteral */ ? left : right.flags & 2048 /* BigIntLiteral */ && pseudoBigIntToString(right.value) === str ? right : left.flags & 16 /* Boolean */ ? left : right.flags & 16 /* Boolean */ ? str === "true" ? trueType : str === "false" ? falseType : booleanType : left.flags & 512 /* BooleanLiteral */ ? left : right.flags & 512 /* BooleanLiteral */ && right.intrinsicName === str ? right : left.flags & 32768 /* Undefined */ ? left : right.flags & 32768 /* Undefined */ && right.intrinsicName === str ? right : left.flags & 65536 /* Null */ ? left : right.flags & 65536 /* Null */ && right.intrinsicName === str ? right : left, neverType);
|
|
63926
63872
|
if (!(matchingType.flags & 131072 /* Never */)) {
|
|
63927
63873
|
inferFromTypes(matchingType, target2);
|
|
63928
63874
|
continue;
|
|
@@ -63968,10 +63914,7 @@ function createTypeChecker(host) {
|
|
|
63968
63914
|
return;
|
|
63969
63915
|
}
|
|
63970
63916
|
const startLength = isTupleType(source) ? Math.min(source.target.fixedLength, target.target.fixedLength) : 0;
|
|
63971
|
-
const endLength = Math.min(
|
|
63972
|
-
isTupleType(source) ? getEndElementCount(source.target, 3 /* Fixed */) : 0,
|
|
63973
|
-
target.target.hasRestElement ? getEndElementCount(target.target, 3 /* Fixed */) : 0
|
|
63974
|
-
);
|
|
63917
|
+
const endLength = Math.min(isTupleType(source) ? getEndElementCount(source.target, 3 /* Fixed */) : 0, target.target.hasRestElement ? getEndElementCount(target.target, 3 /* Fixed */) : 0);
|
|
63975
63918
|
for (let i = 0; i < startLength; i++) {
|
|
63976
63919
|
inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
|
|
63977
63920
|
}
|
|
@@ -64893,7 +64836,9 @@ function createTypeChecker(host) {
|
|
|
64893
64836
|
return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType]));
|
|
64894
64837
|
}
|
|
64895
64838
|
function createFinalArrayType(elementType) {
|
|
64896
|
-
return elementType.flags & 131072 /* Never */ ? autoArrayType : createArrayType(
|
|
64839
|
+
return elementType.flags & 131072 /* Never */ ? autoArrayType : createArrayType(
|
|
64840
|
+
elementType.flags & 1048576 /* Union */ ? getUnionType(elementType.types, 2 /* Subtype */) : elementType
|
|
64841
|
+
);
|
|
64897
64842
|
}
|
|
64898
64843
|
function getFinalArrayType(evolvingArrayType) {
|
|
64899
64844
|
return evolvingArrayType.finalArrayType || (evolvingArrayType.finalArrayType = createFinalArrayType(evolvingArrayType.elementType));
|
|
@@ -65294,7 +65239,10 @@ function createTypeChecker(host) {
|
|
|
65294
65239
|
}
|
|
65295
65240
|
function getInitialOrAssignedType(flow) {
|
|
65296
65241
|
const node = flow.node;
|
|
65297
|
-
return getNarrowableTypeForReference(
|
|
65242
|
+
return getNarrowableTypeForReference(
|
|
65243
|
+
node.kind === 260 /* VariableDeclaration */ || node.kind === 208 /* BindingElement */ ? getInitialType(node) : getAssignedType(node),
|
|
65244
|
+
reference
|
|
65245
|
+
);
|
|
65298
65246
|
}
|
|
65299
65247
|
function getTypeAtFlowAssignment(flow) {
|
|
65300
65248
|
const node = flow.node;
|
|
@@ -65313,10 +65261,11 @@ function createTypeChecker(host) {
|
|
|
65313
65261
|
const assignedType = getWidenedLiteralType(getInitialOrAssignedType(flow));
|
|
65314
65262
|
return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;
|
|
65315
65263
|
}
|
|
65316
|
-
|
|
65317
|
-
|
|
65264
|
+
const t = isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(declaredType) : declaredType;
|
|
65265
|
+
if (t.flags & 1048576 /* Union */) {
|
|
65266
|
+
return getAssignmentReducedType(t, getInitialOrAssignedType(flow));
|
|
65318
65267
|
}
|
|
65319
|
-
return
|
|
65268
|
+
return t;
|
|
65320
65269
|
}
|
|
65321
65270
|
if (containsMatchingReference(reference, node)) {
|
|
65322
65271
|
if (!isReachableFlowNode(flow)) {
|
|
@@ -65432,21 +65381,9 @@ function createTypeChecker(host) {
|
|
|
65432
65381
|
} else {
|
|
65433
65382
|
if (strictNullChecks) {
|
|
65434
65383
|
if (optionalChainContainsReference(expr, reference)) {
|
|
65435
|
-
type = narrowTypeBySwitchOptionalChainContainment(
|
|
65436
|
-
type,
|
|
65437
|
-
flow.switchStatement,
|
|
65438
|
-
flow.clauseStart,
|
|
65439
|
-
flow.clauseEnd,
|
|
65440
|
-
(t) => !(t.flags & (32768 /* Undefined */ | 131072 /* Never */))
|
|
65441
|
-
);
|
|
65384
|
+
type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, (t) => !(t.flags & (32768 /* Undefined */ | 131072 /* Never */)));
|
|
65442
65385
|
} else if (expr.kind === 221 /* TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) {
|
|
65443
|
-
type = narrowTypeBySwitchOptionalChainContainment(
|
|
65444
|
-
type,
|
|
65445
|
-
flow.switchStatement,
|
|
65446
|
-
flow.clauseStart,
|
|
65447
|
-
flow.clauseEnd,
|
|
65448
|
-
(t) => !(t.flags & 131072 /* Never */ || t.flags & 128 /* StringLiteral */ && t.value === "undefined")
|
|
65449
|
-
);
|
|
65386
|
+
type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, (t) => !(t.flags & 131072 /* Never */ || t.flags & 128 /* StringLiteral */ && t.value === "undefined"));
|
|
65450
65387
|
}
|
|
65451
65388
|
}
|
|
65452
65389
|
const access = getDiscriminantPropertyAccess(expr, type);
|
|
@@ -66069,7 +66006,10 @@ function createTypeChecker(host) {
|
|
|
66069
66006
|
const narrowedType = mapType(candidate, (c) => {
|
|
66070
66007
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
66071
66008
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
66072
|
-
const directlyRelated = mapType(
|
|
66009
|
+
const directlyRelated = mapType(
|
|
66010
|
+
matching || type,
|
|
66011
|
+
checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType
|
|
66012
|
+
);
|
|
66073
66013
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
66074
66014
|
});
|
|
66075
66015
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -66179,7 +66119,15 @@ function createTypeChecker(host) {
|
|
|
66179
66119
|
location = location.parent;
|
|
66180
66120
|
}
|
|
66181
66121
|
if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
|
|
66182
|
-
const type = removeOptionalTypeMarker(
|
|
66122
|
+
const type = removeOptionalTypeMarker(
|
|
66123
|
+
isWriteAccess(location) && location.kind === 211 /* PropertyAccessExpression */ ? checkPropertyAccessExpression(
|
|
66124
|
+
location,
|
|
66125
|
+
/*checkMode*/
|
|
66126
|
+
void 0,
|
|
66127
|
+
/*writeOnly*/
|
|
66128
|
+
true
|
|
66129
|
+
) : getTypeOfExpression(location)
|
|
66130
|
+
);
|
|
66183
66131
|
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
|
|
66184
66132
|
return type;
|
|
66185
66133
|
}
|
|
@@ -66440,7 +66388,7 @@ function createTypeChecker(host) {
|
|
|
66440
66388
|
const isAlias = localOrExportSymbol.flags & 2097152 /* Alias */;
|
|
66441
66389
|
if (localOrExportSymbol.flags & 3 /* Variable */) {
|
|
66442
66390
|
if (assignmentKind === 1 /* Definite */) {
|
|
66443
|
-
return type;
|
|
66391
|
+
return isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(type) : type;
|
|
66444
66392
|
}
|
|
66445
66393
|
} else if (isAlias) {
|
|
66446
66394
|
declaration = getDeclarationOfAliasSymbol(symbol);
|
|
@@ -67535,8 +67483,19 @@ function createTypeChecker(host) {
|
|
|
67535
67483
|
contextualType,
|
|
67536
67484
|
concatenate(
|
|
67537
67485
|
map(
|
|
67538
|
-
filter(node.properties, (p) =>
|
|
67539
|
-
|
|
67486
|
+
filter(node.properties, (p) => {
|
|
67487
|
+
if (!p.symbol) {
|
|
67488
|
+
return false;
|
|
67489
|
+
}
|
|
67490
|
+
if (p.kind === 303 /* PropertyAssignment */) {
|
|
67491
|
+
return isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName);
|
|
67492
|
+
}
|
|
67493
|
+
if (p.kind === 304 /* ShorthandPropertyAssignment */) {
|
|
67494
|
+
return isDiscriminantProperty(contextualType, p.symbol.escapedName);
|
|
67495
|
+
}
|
|
67496
|
+
return false;
|
|
67497
|
+
}),
|
|
67498
|
+
(prop) => [() => getContextFreeTypeOfExpression(prop.kind === 303 /* PropertyAssignment */ ? prop.initializer : prop.name), prop.symbol.escapedName]
|
|
67540
67499
|
),
|
|
67541
67500
|
map(
|
|
67542
67501
|
filter(getPropertiesOfType(contextualType), (s) => {
|
|
@@ -68087,7 +68046,10 @@ function createTypeChecker(host) {
|
|
|
68087
68046
|
inConstContext
|
|
68088
68047
|
));
|
|
68089
68048
|
}
|
|
68090
|
-
return createArrayLiteralType(createArrayType(
|
|
68049
|
+
return createArrayLiteralType(createArrayType(
|
|
68050
|
+
elementTypes.length ? getUnionType(sameMap(elementTypes, (t, i) => elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessTypeOrUndefined(t, numberType) || anyType : t), 2 /* Subtype */) : strictNullChecks ? implicitNeverType : undefinedWideningType,
|
|
68051
|
+
inConstContext
|
|
68052
|
+
));
|
|
68091
68053
|
}
|
|
68092
68054
|
function createArrayLiteralType(type) {
|
|
68093
68055
|
if (!(getObjectFlags(type) & 4 /* Reference */)) {
|
|
@@ -68240,12 +68202,7 @@ function createTypeChecker(host) {
|
|
|
68240
68202
|
if (impliedProp) {
|
|
68241
68203
|
prop.flags |= impliedProp.flags & 16777216 /* Optional */;
|
|
68242
68204
|
} else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, stringType)) {
|
|
68243
|
-
error(
|
|
68244
|
-
memberDecl.name,
|
|
68245
|
-
Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
|
|
68246
|
-
symbolToString(member),
|
|
68247
|
-
typeToString(contextualType)
|
|
68248
|
-
);
|
|
68205
|
+
error(memberDecl.name, Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType));
|
|
68249
68206
|
}
|
|
68250
68207
|
}
|
|
68251
68208
|
prop.declarations = member.declarations;
|
|
@@ -68315,22 +68272,13 @@ function createTypeChecker(host) {
|
|
|
68315
68272
|
}
|
|
68316
68273
|
popContextualType();
|
|
68317
68274
|
if (contextualTypeHasPattern) {
|
|
68318
|
-
const rootPatternParent = findAncestor(
|
|
68319
|
-
|
|
68320
|
-
(n) => n.kind === 260 /* VariableDeclaration */ || n.kind === 226 /* BinaryExpression */ || n.kind === 169 /* Parameter */
|
|
68321
|
-
);
|
|
68322
|
-
const spreadOrOutsideRootObject = findAncestor(
|
|
68323
|
-
node,
|
|
68324
|
-
(n) => n === rootPatternParent || n.kind === 305 /* SpreadAssignment */
|
|
68325
|
-
);
|
|
68275
|
+
const rootPatternParent = findAncestor(contextualType.pattern.parent, (n) => n.kind === 260 /* VariableDeclaration */ || n.kind === 226 /* BinaryExpression */ || n.kind === 169 /* Parameter */);
|
|
68276
|
+
const spreadOrOutsideRootObject = findAncestor(node, (n) => n === rootPatternParent || n.kind === 305 /* SpreadAssignment */);
|
|
68326
68277
|
if (spreadOrOutsideRootObject.kind !== 305 /* SpreadAssignment */) {
|
|
68327
68278
|
for (const prop of getPropertiesOfType(contextualType)) {
|
|
68328
68279
|
if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
|
|
68329
68280
|
if (!(prop.flags & 16777216 /* Optional */)) {
|
|
68330
|
-
error(
|
|
68331
|
-
prop.valueDeclaration || ((_a = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a.links.bindingElement),
|
|
68332
|
-
Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value
|
|
68333
|
-
);
|
|
68281
|
+
error(prop.valueDeclaration || ((_a = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a.links.bindingElement), Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
|
|
68334
68282
|
}
|
|
68335
68283
|
propertiesTable.set(prop.escapedName, prop);
|
|
68336
68284
|
propertiesArray.push(prop);
|
|
@@ -68402,7 +68350,10 @@ function createTypeChecker(host) {
|
|
|
68402
68350
|
checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment);
|
|
68403
68351
|
const nodeSourceFile = getSourceFileOfNode(node);
|
|
68404
68352
|
if (getJSXTransformEnabled(compilerOptions) && (compilerOptions.jsxFactory || nodeSourceFile.pragmas.has("jsx")) && !compilerOptions.jsxFragmentFactory && !nodeSourceFile.pragmas.has("jsxfrag")) {
|
|
68405
|
-
error(
|
|
68353
|
+
error(
|
|
68354
|
+
node,
|
|
68355
|
+
compilerOptions.jsxFactory ? Diagnostics.The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option : Diagnostics.An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments
|
|
68356
|
+
);
|
|
68406
68357
|
}
|
|
68407
68358
|
checkJsxChildren(node);
|
|
68408
68359
|
return getJsxElementTypeAt(node) || anyType;
|
|
@@ -68983,12 +68934,7 @@ function createTypeChecker(host) {
|
|
|
68983
68934
|
}
|
|
68984
68935
|
if (flags & 256 /* Abstract */) {
|
|
68985
68936
|
if (errorNode) {
|
|
68986
|
-
error(
|
|
68987
|
-
errorNode,
|
|
68988
|
-
Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression,
|
|
68989
|
-
symbolToString(prop),
|
|
68990
|
-
typeToString(getDeclaringClass(prop))
|
|
68991
|
-
);
|
|
68937
|
+
error(errorNode, Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(getDeclaringClass(prop)));
|
|
68992
68938
|
}
|
|
68993
68939
|
return false;
|
|
68994
68940
|
}
|
|
@@ -68997,12 +68943,7 @@ function createTypeChecker(host) {
|
|
|
68997
68943
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
68998
68944
|
if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) {
|
|
68999
68945
|
if (errorNode) {
|
|
69000
|
-
error(
|
|
69001
|
-
errorNode,
|
|
69002
|
-
Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor,
|
|
69003
|
-
symbolToString(prop),
|
|
69004
|
-
getTextOfIdentifierOrLiteral(declaringClassDeclaration.name)
|
|
69005
|
-
);
|
|
68946
|
+
error(errorNode, Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor, symbolToString(prop), getTextOfIdentifierOrLiteral(declaringClassDeclaration.name));
|
|
69006
68947
|
}
|
|
69007
68948
|
return false;
|
|
69008
68949
|
}
|
|
@@ -69014,12 +68955,7 @@ function createTypeChecker(host) {
|
|
|
69014
68955
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
69015
68956
|
if (!isNodeWithinClass(location, declaringClassDeclaration)) {
|
|
69016
68957
|
if (errorNode) {
|
|
69017
|
-
error(
|
|
69018
|
-
errorNode,
|
|
69019
|
-
Diagnostics.Property_0_is_private_and_only_accessible_within_class_1,
|
|
69020
|
-
symbolToString(prop),
|
|
69021
|
-
typeToString(getDeclaringClass(prop))
|
|
69022
|
-
);
|
|
68958
|
+
error(errorNode, Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(getDeclaringClass(prop)));
|
|
69023
68959
|
}
|
|
69024
68960
|
return false;
|
|
69025
68961
|
}
|
|
@@ -69037,12 +68973,7 @@ function createTypeChecker(host) {
|
|
|
69037
68973
|
enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
|
|
69038
68974
|
if (flags & 32 /* Static */ || !enclosingClass) {
|
|
69039
68975
|
if (errorNode) {
|
|
69040
|
-
error(
|
|
69041
|
-
errorNode,
|
|
69042
|
-
Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses,
|
|
69043
|
-
symbolToString(prop),
|
|
69044
|
-
typeToString(getDeclaringClass(prop) || containingType)
|
|
69045
|
-
);
|
|
68976
|
+
error(errorNode, Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || containingType));
|
|
69046
68977
|
}
|
|
69047
68978
|
return false;
|
|
69048
68979
|
}
|
|
@@ -69055,13 +68986,7 @@ function createTypeChecker(host) {
|
|
|
69055
68986
|
}
|
|
69056
68987
|
if (!containingType || !hasBaseType(containingType, enclosingClass)) {
|
|
69057
68988
|
if (errorNode) {
|
|
69058
|
-
error(
|
|
69059
|
-
errorNode,
|
|
69060
|
-
Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2,
|
|
69061
|
-
symbolToString(prop),
|
|
69062
|
-
typeToString(enclosingClass),
|
|
69063
|
-
typeToString(containingType)
|
|
69064
|
-
);
|
|
68989
|
+
error(errorNode, Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2, symbolToString(prop), typeToString(enclosingClass), typeToString(containingType));
|
|
69065
68990
|
}
|
|
69066
68991
|
return false;
|
|
69067
68992
|
}
|
|
@@ -69473,10 +69398,7 @@ function createTypeChecker(host) {
|
|
|
69473
69398
|
diagnosticMessage = error(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
69474
69399
|
}
|
|
69475
69400
|
if (diagnosticMessage) {
|
|
69476
|
-
addRelatedInfo(
|
|
69477
|
-
diagnosticMessage,
|
|
69478
|
-
createDiagnosticForNode(valueDeclaration, Diagnostics._0_is_declared_here, declarationName)
|
|
69479
|
-
);
|
|
69401
|
+
addRelatedInfo(diagnosticMessage, createDiagnosticForNode(valueDeclaration, Diagnostics._0_is_declared_here, declarationName));
|
|
69480
69402
|
}
|
|
69481
69403
|
}
|
|
69482
69404
|
function isInPropertyInitializerOrClassStaticBlock(node) {
|
|
@@ -70416,12 +70338,7 @@ function createTypeChecker(host) {
|
|
|
70416
70338
|
forEach(getElementTypes(spreadType), (t, i2) => {
|
|
70417
70339
|
var _a;
|
|
70418
70340
|
const flags = spreadType.target.elementFlags[i2];
|
|
70419
|
-
const syntheticArg = createSyntheticExpression(
|
|
70420
|
-
arg,
|
|
70421
|
-
flags & 4 /* Rest */ ? createArrayType(t) : t,
|
|
70422
|
-
!!(flags & 12 /* Variable */),
|
|
70423
|
-
(_a = spreadType.target.labeledElementDeclarations) == null ? void 0 : _a[i2]
|
|
70424
|
-
);
|
|
70341
|
+
const syntheticArg = createSyntheticExpression(arg, flags & 4 /* Rest */ ? createArrayType(t) : t, !!(flags & 12 /* Variable */), (_a = spreadType.target.labeledElementDeclarations) == null ? void 0 : _a[i2]);
|
|
70425
70342
|
effectiveArgs.push(syntheticArg);
|
|
70426
70343
|
});
|
|
70427
70344
|
} else {
|
|
@@ -71339,10 +71256,7 @@ function createTypeChecker(host) {
|
|
|
71339
71256
|
const sigs = getSignaturesOfType(getTypeOfSymbol(getSymbolLinks(apparentType.symbol).target), kind);
|
|
71340
71257
|
if (!sigs || !sigs.length)
|
|
71341
71258
|
return;
|
|
71342
|
-
addRelatedInfo(
|
|
71343
|
-
diagnostic,
|
|
71344
|
-
createDiagnosticForNode(importNode, Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead)
|
|
71345
|
-
);
|
|
71259
|
+
addRelatedInfo(diagnostic, createDiagnosticForNode(importNode, Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
|
|
71346
71260
|
}
|
|
71347
71261
|
}
|
|
71348
71262
|
function resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode) {
|
|
@@ -71969,12 +71883,7 @@ function createTypeChecker(host) {
|
|
|
71969
71883
|
addLazyDiagnostic(() => {
|
|
71970
71884
|
const widenedType = getWidenedType(exprType);
|
|
71971
71885
|
if (!isTypeComparableTo(targetType, widenedType)) {
|
|
71972
|
-
checkTypeComparableTo(
|
|
71973
|
-
exprType,
|
|
71974
|
-
targetType,
|
|
71975
|
-
errNode,
|
|
71976
|
-
Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first
|
|
71977
|
-
);
|
|
71886
|
+
checkTypeComparableTo(exprType, targetType, errNode, Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first);
|
|
71978
71887
|
}
|
|
71979
71888
|
});
|
|
71980
71889
|
}
|
|
@@ -72348,7 +72257,14 @@ function createTypeChecker(host) {
|
|
|
72348
72257
|
if (declaration.type) {
|
|
72349
72258
|
const typeNode = getEffectiveTypeAnnotationNode(declaration);
|
|
72350
72259
|
if (typeNode) {
|
|
72351
|
-
|
|
72260
|
+
const source = addOptionality(
|
|
72261
|
+
getTypeFromTypeNode(typeNode),
|
|
72262
|
+
/*isProperty*/
|
|
72263
|
+
false,
|
|
72264
|
+
isOptionalDeclaration(declaration)
|
|
72265
|
+
);
|
|
72266
|
+
const target = getTypeAtPosition(context, i);
|
|
72267
|
+
inferTypes(inferenceContext.inferences, source, target);
|
|
72352
72268
|
}
|
|
72353
72269
|
}
|
|
72354
72270
|
}
|
|
@@ -72691,13 +72607,19 @@ function createTypeChecker(host) {
|
|
|
72691
72607
|
function createPromiseReturnType(func, promisedType) {
|
|
72692
72608
|
const promiseType = createPromiseType(promisedType);
|
|
72693
72609
|
if (promiseType === unknownType) {
|
|
72694
|
-
error(
|
|
72610
|
+
error(
|
|
72611
|
+
func,
|
|
72612
|
+
isImportCall(func) ? Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option : Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option
|
|
72613
|
+
);
|
|
72695
72614
|
return errorType;
|
|
72696
72615
|
} else if (!getGlobalPromiseConstructorSymbol(
|
|
72697
72616
|
/*reportErrors*/
|
|
72698
72617
|
true
|
|
72699
72618
|
)) {
|
|
72700
|
-
error(
|
|
72619
|
+
error(
|
|
72620
|
+
func,
|
|
72621
|
+
isImportCall(func) ? Diagnostics.A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option : Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option
|
|
72622
|
+
);
|
|
72701
72623
|
}
|
|
72702
72624
|
return promiseType;
|
|
72703
72625
|
}
|
|
@@ -72880,7 +72802,11 @@ function createTypeChecker(host) {
|
|
|
72880
72802
|
function getYieldedTypeOfYieldExpression(node, expressionType, sentType, isAsync) {
|
|
72881
72803
|
const errorNode = node.expression || node;
|
|
72882
72804
|
const yieldedType = node.asteriskToken ? checkIteratedTypeOrElementType(isAsync ? 19 /* AsyncYieldStar */ : 17 /* YieldStar */, expressionType, sentType, errorNode) : expressionType;
|
|
72883
|
-
return !isAsync ? yieldedType : getAwaitedType(
|
|
72805
|
+
return !isAsync ? yieldedType : getAwaitedType(
|
|
72806
|
+
yieldedType,
|
|
72807
|
+
errorNode,
|
|
72808
|
+
node.asteriskToken ? Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member : Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
|
72809
|
+
);
|
|
72884
72810
|
}
|
|
72885
72811
|
function getNotEqualFactsFromTypeofSwitch(start, end, witnesses) {
|
|
72886
72812
|
let facts = 0 /* None */;
|
|
@@ -73378,11 +73304,7 @@ function createTypeChecker(host) {
|
|
|
73378
73304
|
return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
|
|
73379
73305
|
case 46 /* PlusPlusToken */:
|
|
73380
73306
|
case 47 /* MinusMinusToken */:
|
|
73381
|
-
const ok = checkArithmeticOperandType(
|
|
73382
|
-
node.operand,
|
|
73383
|
-
checkNonNullType(operandType, node.operand),
|
|
73384
|
-
Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type
|
|
73385
|
-
);
|
|
73307
|
+
const ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type);
|
|
73386
73308
|
if (ok) {
|
|
73387
73309
|
checkReferenceExpression(
|
|
73388
73310
|
node.operand,
|
|
@@ -73975,7 +73897,9 @@ function createTypeChecker(host) {
|
|
|
73975
73897
|
}
|
|
73976
73898
|
if (!resultType) {
|
|
73977
73899
|
const closeEnoughKind = 296 /* NumberLike */ | 2112 /* BigIntLike */ | 402653316 /* StringLike */ | 3 /* AnyOrUnknown */;
|
|
73978
|
-
reportOperatorError(
|
|
73900
|
+
reportOperatorError(
|
|
73901
|
+
(left2, right2) => isTypeAssignableToKind(left2, closeEnoughKind) && isTypeAssignableToKind(right2, closeEnoughKind)
|
|
73902
|
+
);
|
|
73979
73903
|
return anyType;
|
|
73980
73904
|
}
|
|
73981
73905
|
if (operator === 65 /* PlusEqualsToken */) {
|
|
@@ -74139,11 +74063,7 @@ function createTypeChecker(host) {
|
|
|
74139
74063
|
true
|
|
74140
74064
|
);
|
|
74141
74065
|
}
|
|
74142
|
-
if (checkReferenceExpression(
|
|
74143
|
-
left,
|
|
74144
|
-
Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access,
|
|
74145
|
-
Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access
|
|
74146
|
-
)) {
|
|
74066
|
+
if (checkReferenceExpression(left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access, Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access)) {
|
|
74147
74067
|
let headMessage;
|
|
74148
74068
|
if (exactOptionalPropertyTypes && isPropertyAccessExpression(left) && maybeTypeOfKind(valueType, 32768 /* Undefined */)) {
|
|
74149
74069
|
const target = getTypeOfPropertyOfType(getTypeOfExpression(left.expression), left.name.escapedText);
|
|
@@ -74225,21 +74145,13 @@ function createTypeChecker(host) {
|
|
|
74225
74145
|
const isLeftNaN = isGlobalNaN(skipParentheses(left2));
|
|
74226
74146
|
const isRightNaN = isGlobalNaN(skipParentheses(right2));
|
|
74227
74147
|
if (isLeftNaN || isRightNaN) {
|
|
74228
|
-
const err = error(
|
|
74229
|
-
errorNode2,
|
|
74230
|
-
Diagnostics.This_condition_will_always_return_0,
|
|
74231
|
-
tokenToString(operator2 === 37 /* EqualsEqualsEqualsToken */ || operator2 === 35 /* EqualsEqualsToken */ ? 97 /* FalseKeyword */ : 112 /* TrueKeyword */)
|
|
74232
|
-
);
|
|
74148
|
+
const err = error(errorNode2, Diagnostics.This_condition_will_always_return_0, tokenToString(operator2 === 37 /* EqualsEqualsEqualsToken */ || operator2 === 35 /* EqualsEqualsToken */ ? 97 /* FalseKeyword */ : 112 /* TrueKeyword */));
|
|
74233
74149
|
if (isLeftNaN && isRightNaN)
|
|
74234
74150
|
return;
|
|
74235
74151
|
const operatorString = operator2 === 38 /* ExclamationEqualsEqualsToken */ || operator2 === 36 /* ExclamationEqualsToken */ ? tokenToString(54 /* ExclamationToken */) : "";
|
|
74236
74152
|
const location = isLeftNaN ? right2 : left2;
|
|
74237
74153
|
const expression = skipParentheses(location);
|
|
74238
|
-
addRelatedInfo(err, createDiagnosticForNode(
|
|
74239
|
-
location,
|
|
74240
|
-
Diagnostics.Did_you_mean_0,
|
|
74241
|
-
`${operatorString}Number.isNaN(${isEntityNameExpression(expression) ? entityNameToString(expression) : "..."})`
|
|
74242
|
-
));
|
|
74154
|
+
addRelatedInfo(err, createDiagnosticForNode(location, Diagnostics.Did_you_mean_0, `${operatorString}Number.isNaN(${isEntityNameExpression(expression) ? entityNameToString(expression) : "..."})`));
|
|
74243
74155
|
}
|
|
74244
74156
|
}
|
|
74245
74157
|
function isGlobalNaN(expr) {
|
|
@@ -75023,11 +74935,7 @@ function createTypeChecker(host) {
|
|
|
75023
74935
|
}
|
|
75024
74936
|
const name = element.name;
|
|
75025
74937
|
if (name.kind === 80 /* Identifier */ && name.escapedText === predicateVariableName) {
|
|
75026
|
-
error(
|
|
75027
|
-
predicateVariableNode,
|
|
75028
|
-
Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern,
|
|
75029
|
-
predicateVariableName
|
|
75030
|
-
);
|
|
74938
|
+
error(predicateVariableNode, Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
|
|
75031
74939
|
return true;
|
|
75032
74940
|
} else if (name.kind === 207 /* ArrayBindingPattern */ || name.kind === 206 /* ObjectBindingPattern */) {
|
|
75033
74941
|
if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(
|
|
@@ -75427,12 +75335,7 @@ function createTypeChecker(host) {
|
|
|
75427
75335
|
return getEffectiveTypeArguments(node, typeParameters)[index];
|
|
75428
75336
|
}
|
|
75429
75337
|
function getEffectiveTypeArguments(node, typeParameters) {
|
|
75430
|
-
return fillMissingTypeArguments(
|
|
75431
|
-
map(node.typeArguments, getTypeFromTypeNode),
|
|
75432
|
-
typeParameters,
|
|
75433
|
-
getMinTypeArgumentCount(typeParameters),
|
|
75434
|
-
isInJSFile(node)
|
|
75435
|
-
);
|
|
75338
|
+
return fillMissingTypeArguments(map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), isInJSFile(node));
|
|
75436
75339
|
}
|
|
75437
75340
|
function checkTypeArgumentConstraints(node, typeParameters) {
|
|
75438
75341
|
let typeArguments;
|
|
@@ -76247,12 +76150,7 @@ function createTypeChecker(host) {
|
|
|
76247
76150
|
const rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
|
|
76248
76151
|
const collidingSymbol = getSymbol(node.locals, rootName.escapedText, 111551 /* Value */);
|
|
76249
76152
|
if (collidingSymbol) {
|
|
76250
|
-
error(
|
|
76251
|
-
collidingSymbol.valueDeclaration,
|
|
76252
|
-
Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions,
|
|
76253
|
-
idText(rootName),
|
|
76254
|
-
entityNameToString(promiseConstructorName)
|
|
76255
|
-
);
|
|
76153
|
+
error(collidingSymbol.valueDeclaration, Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, idText(rootName), entityNameToString(promiseConstructorName));
|
|
76256
76154
|
return;
|
|
76257
76155
|
}
|
|
76258
76156
|
}
|
|
@@ -76855,7 +76753,11 @@ function createTypeChecker(host) {
|
|
|
76855
76753
|
const importDecl = importClause.parent;
|
|
76856
76754
|
const nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? importClause.namedBindings.kind === 274 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length : 0);
|
|
76857
76755
|
if (nDeclarations === unuseds.length) {
|
|
76858
|
-
addDiagnostic(
|
|
76756
|
+
addDiagnostic(
|
|
76757
|
+
importDecl,
|
|
76758
|
+
0 /* Local */,
|
|
76759
|
+
unuseds.length === 1 ? createDiagnosticForNode(importDecl, Diagnostics._0_is_declared_but_its_value_is_never_read, idText(first(unuseds).name)) : createDiagnosticForNode(importDecl, Diagnostics.All_imports_in_import_declaration_are_unused)
|
|
76760
|
+
);
|
|
76859
76761
|
} else {
|
|
76860
76762
|
for (const unused of unuseds)
|
|
76861
76763
|
errorUnusedLocal(unused, idText(unused.name), addDiagnostic);
|
|
@@ -76867,7 +76769,11 @@ function createTypeChecker(host) {
|
|
|
76867
76769
|
if (bindingElements.length === 1 && bindingPattern.parent.kind === 260 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 261 /* VariableDeclarationList */) {
|
|
76868
76770
|
addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId);
|
|
76869
76771
|
} else {
|
|
76870
|
-
addDiagnostic(
|
|
76772
|
+
addDiagnostic(
|
|
76773
|
+
bindingPattern,
|
|
76774
|
+
kind,
|
|
76775
|
+
bindingElements.length === 1 ? createDiagnosticForNode(bindingPattern, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(first(bindingElements).name)) : createDiagnosticForNode(bindingPattern, Diagnostics.All_destructured_elements_are_unused)
|
|
76776
|
+
);
|
|
76871
76777
|
}
|
|
76872
76778
|
} else {
|
|
76873
76779
|
for (const e of bindingElements) {
|
|
@@ -76877,7 +76783,11 @@ function createTypeChecker(host) {
|
|
|
76877
76783
|
});
|
|
76878
76784
|
unusedVariables.forEach(([declarationList, declarations]) => {
|
|
76879
76785
|
if (declarationList.declarations.length === declarations.length) {
|
|
76880
|
-
addDiagnostic(
|
|
76786
|
+
addDiagnostic(
|
|
76787
|
+
declarationList,
|
|
76788
|
+
0 /* Local */,
|
|
76789
|
+
declarations.length === 1 ? createDiagnosticForNode(first(declarations).name, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(first(declarations).name)) : createDiagnosticForNode(declarationList.parent.kind === 243 /* VariableStatement */ ? declarationList.parent : declarationList, Diagnostics.All_variables_are_unused)
|
|
76790
|
+
);
|
|
76881
76791
|
} else {
|
|
76882
76792
|
for (const decl of declarations) {
|
|
76883
76793
|
addDiagnostic(decl, 0 /* Local */, createDiagnosticForNode(decl, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(decl.name)));
|
|
@@ -77005,13 +76915,7 @@ function createTypeChecker(host) {
|
|
|
77005
76915
|
}
|
|
77006
76916
|
const parent = getDeclarationContainer(node);
|
|
77007
76917
|
if (parent.kind === 312 /* SourceFile */ && isExternalOrCommonJsModule(parent)) {
|
|
77008
|
-
errorSkippedOn(
|
|
77009
|
-
"noEmit",
|
|
77010
|
-
name,
|
|
77011
|
-
Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module,
|
|
77012
|
-
declarationNameToString(name),
|
|
77013
|
-
declarationNameToString(name)
|
|
77014
|
-
);
|
|
76918
|
+
errorSkippedOn("noEmit", name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, declarationNameToString(name), declarationNameToString(name));
|
|
77015
76919
|
}
|
|
77016
76920
|
}
|
|
77017
76921
|
function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) {
|
|
@@ -77023,13 +76927,7 @@ function createTypeChecker(host) {
|
|
|
77023
76927
|
}
|
|
77024
76928
|
const parent = getDeclarationContainer(node);
|
|
77025
76929
|
if (parent.kind === 312 /* SourceFile */ && isExternalOrCommonJsModule(parent) && parent.flags & 4096 /* HasAsyncFunctions */) {
|
|
77026
|
-
errorSkippedOn(
|
|
77027
|
-
"noEmit",
|
|
77028
|
-
name,
|
|
77029
|
-
Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions,
|
|
77030
|
-
declarationNameToString(name),
|
|
77031
|
-
declarationNameToString(name)
|
|
77032
|
-
);
|
|
76930
|
+
errorSkippedOn("noEmit", name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, declarationNameToString(name), declarationNameToString(name));
|
|
77033
76931
|
}
|
|
77034
76932
|
}
|
|
77035
76933
|
function recordPotentialCollisionWithWeakMapSetInGeneratedCode(node, name) {
|
|
@@ -77070,13 +76968,7 @@ function createTypeChecker(host) {
|
|
|
77070
76968
|
}
|
|
77071
76969
|
if (hasCollision) {
|
|
77072
76970
|
Debug.assert(isNamedDeclaration(node) && isIdentifier(node.name), "The target of a Reflect collision check should be an identifier");
|
|
77073
|
-
errorSkippedOn(
|
|
77074
|
-
"noEmit",
|
|
77075
|
-
node,
|
|
77076
|
-
Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers,
|
|
77077
|
-
declarationNameToString(node.name),
|
|
77078
|
-
"Reflect"
|
|
77079
|
-
);
|
|
76971
|
+
errorSkippedOn("noEmit", node, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers, declarationNameToString(node.name), "Reflect");
|
|
77080
76972
|
}
|
|
77081
76973
|
}
|
|
77082
76974
|
function checkCollisionsForDeclarationName(node, name) {
|
|
@@ -77311,10 +77203,7 @@ function createTypeChecker(host) {
|
|
|
77311
77203
|
typeToString(nextType)
|
|
77312
77204
|
);
|
|
77313
77205
|
if (firstDeclaration) {
|
|
77314
|
-
addRelatedInfo(
|
|
77315
|
-
err,
|
|
77316
|
-
createDiagnosticForNode(firstDeclaration, Diagnostics._0_was_also_declared_here, declName)
|
|
77317
|
-
);
|
|
77206
|
+
addRelatedInfo(err, createDiagnosticForNode(firstDeclaration, Diagnostics._0_was_also_declared_here, declName));
|
|
77318
77207
|
}
|
|
77319
77208
|
}
|
|
77320
77209
|
function areDeclarationFlagsIdentical(left, right) {
|
|
@@ -77951,13 +77840,10 @@ function createTypeChecker(host) {
|
|
|
77951
77840
|
!!getAwaitedTypeOfPromise(type) || !allowAsyncIterables && isForOfStatement(errorNode.parent) && errorNode.parent.expression === errorNode && getGlobalAsyncIterableType(
|
|
77952
77841
|
/*reportErrors*/
|
|
77953
77842
|
false
|
|
77954
|
-
) !== emptyGenericType && isTypeAssignableTo(
|
|
77955
|
-
|
|
77956
|
-
|
|
77957
|
-
|
|
77958
|
-
false
|
|
77959
|
-
)
|
|
77960
|
-
)
|
|
77843
|
+
) !== emptyGenericType && isTypeAssignableTo(type, getGlobalAsyncIterableType(
|
|
77844
|
+
/*reportErrors*/
|
|
77845
|
+
false
|
|
77846
|
+
))
|
|
77961
77847
|
);
|
|
77962
77848
|
return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
|
|
77963
77849
|
}
|
|
@@ -78414,14 +78300,7 @@ function createTypeChecker(host) {
|
|
|
78414
78300
|
const localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfDeclaration(info.declaration)) === type.symbol ? info.declaration : void 0;
|
|
78415
78301
|
const errorNode = localPropDeclaration || localIndexDeclaration || (interfaceDeclaration && !some(getBaseTypes(type), (base) => !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType)) ? interfaceDeclaration : void 0);
|
|
78416
78302
|
if (errorNode && !isTypeAssignableTo(propType, info.type)) {
|
|
78417
|
-
const diagnostic = createError(
|
|
78418
|
-
errorNode,
|
|
78419
|
-
Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3,
|
|
78420
|
-
symbolToString(prop),
|
|
78421
|
-
typeToString(propType),
|
|
78422
|
-
typeToString(info.keyType),
|
|
78423
|
-
typeToString(info.type)
|
|
78424
|
-
);
|
|
78303
|
+
const diagnostic = createError(errorNode, Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3, symbolToString(prop), typeToString(propType), typeToString(info.keyType), typeToString(info.type));
|
|
78425
78304
|
if (propDeclaration && errorNode !== propDeclaration) {
|
|
78426
78305
|
addRelatedInfo(diagnostic, createDiagnosticForNode(propDeclaration, Diagnostics._0_is_declared_here, symbolToString(prop)));
|
|
78427
78306
|
}
|
|
@@ -78440,14 +78319,7 @@ function createTypeChecker(host) {
|
|
|
78440
78319
|
const localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfDeclaration(info.declaration)) === type.symbol ? info.declaration : void 0;
|
|
78441
78320
|
const errorNode = localCheckDeclaration || localIndexDeclaration || (interfaceDeclaration && !some(getBaseTypes(type), (base) => !!getIndexInfoOfType(base, checkInfo.keyType) && !!getIndexTypeOfType(base, info.keyType)) ? interfaceDeclaration : void 0);
|
|
78442
78321
|
if (errorNode && !isTypeAssignableTo(checkInfo.type, info.type)) {
|
|
78443
|
-
error(
|
|
78444
|
-
errorNode,
|
|
78445
|
-
Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3,
|
|
78446
|
-
typeToString(checkInfo.keyType),
|
|
78447
|
-
typeToString(checkInfo.type),
|
|
78448
|
-
typeToString(info.keyType),
|
|
78449
|
-
typeToString(info.type)
|
|
78450
|
-
);
|
|
78322
|
+
error(errorNode, Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3, typeToString(checkInfo.keyType), typeToString(checkInfo.type), typeToString(info.keyType), typeToString(info.type));
|
|
78451
78323
|
}
|
|
78452
78324
|
}
|
|
78453
78325
|
}
|
|
@@ -78728,12 +78600,7 @@ function createTypeChecker(host) {
|
|
|
78728
78600
|
)) {
|
|
78729
78601
|
issueMemberSpecificError(node, typeWithThis, baseWithThis, Diagnostics.Class_0_incorrectly_extends_base_class_1);
|
|
78730
78602
|
} else {
|
|
78731
|
-
checkTypeAssignableTo(
|
|
78732
|
-
staticType,
|
|
78733
|
-
getTypeWithoutSignatures(staticBaseType),
|
|
78734
|
-
node.name || node,
|
|
78735
|
-
Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1
|
|
78736
|
-
);
|
|
78603
|
+
checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);
|
|
78737
78604
|
}
|
|
78738
78605
|
if (baseConstructorType.flags & 8650752 /* TypeVariable */) {
|
|
78739
78606
|
if (!isMixinConstructorType(staticType)) {
|
|
@@ -79296,7 +79163,10 @@ function createTypeChecker(host) {
|
|
|
79296
79163
|
const value = evaluate(initializer, member);
|
|
79297
79164
|
if (value !== void 0) {
|
|
79298
79165
|
if (isConstEnum && typeof value === "number" && !isFinite(value)) {
|
|
79299
|
-
error(
|
|
79166
|
+
error(
|
|
79167
|
+
initializer,
|
|
79168
|
+
isNaN(value) ? Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value
|
|
79169
|
+
);
|
|
79300
79170
|
}
|
|
79301
79171
|
} else if (isConstEnum) {
|
|
79302
79172
|
error(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
|
|
@@ -79663,7 +79533,10 @@ function createTypeChecker(host) {
|
|
|
79663
79533
|
}
|
|
79664
79534
|
const inAmbientExternalModule = node.parent.kind === 268 /* ModuleBlock */ && isAmbientModule(node.parent.parent);
|
|
79665
79535
|
if (node.parent.kind !== 312 /* SourceFile */ && !inAmbientExternalModule) {
|
|
79666
|
-
error(
|
|
79536
|
+
error(
|
|
79537
|
+
moduleName,
|
|
79538
|
+
node.kind === 278 /* ExportDeclaration */ ? Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module
|
|
79539
|
+
);
|
|
79667
79540
|
return false;
|
|
79668
79541
|
}
|
|
79669
79542
|
if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) {
|
|
@@ -79699,11 +79572,14 @@ function createTypeChecker(host) {
|
|
|
79699
79572
|
if (alreadyExportedSymbol === target) {
|
|
79700
79573
|
const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
|
|
79701
79574
|
if (exportingDeclaration) {
|
|
79702
|
-
addRelatedInfo(
|
|
79703
|
-
|
|
79704
|
-
|
|
79705
|
-
|
|
79706
|
-
|
|
79575
|
+
addRelatedInfo(
|
|
79576
|
+
diag2,
|
|
79577
|
+
createDiagnosticForNode(
|
|
79578
|
+
exportingDeclaration,
|
|
79579
|
+
Diagnostics._0_is_automatically_exported_here,
|
|
79580
|
+
unescapeLeadingUnderscores(alreadyExportedSymbol.escapedName)
|
|
79581
|
+
)
|
|
79582
|
+
);
|
|
79707
79583
|
}
|
|
79708
79584
|
}
|
|
79709
79585
|
} else {
|
|
@@ -80370,9 +80246,14 @@ function createTypeChecker(host) {
|
|
|
80370
80246
|
const diagnostic = node.postfix ? Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1 : Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1;
|
|
80371
80247
|
const typeNode = node.type;
|
|
80372
80248
|
const type = getTypeFromTypeNode(typeNode);
|
|
80373
|
-
grammarErrorOnNode(
|
|
80374
|
-
|
|
80375
|
-
|
|
80249
|
+
grammarErrorOnNode(
|
|
80250
|
+
node,
|
|
80251
|
+
diagnostic,
|
|
80252
|
+
token,
|
|
80253
|
+
typeToString(
|
|
80254
|
+
isJSDocNullableType(node) && !(type === neverType || type === voidType) ? getUnionType(append([type, undefinedType], node.postfix ? void 0 : nullType)) : type
|
|
80255
|
+
)
|
|
80256
|
+
);
|
|
80376
80257
|
} else {
|
|
80377
80258
|
grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
|
|
80378
80259
|
}
|
|
@@ -83086,10 +82967,7 @@ function createTypeChecker(host) {
|
|
|
83086
82967
|
if (isInTopLevelContext(forInOrOfStatement)) {
|
|
83087
82968
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
83088
82969
|
if (!isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
83089
|
-
diagnostics.add(createDiagnosticForNode(
|
|
83090
|
-
forInOrOfStatement.awaitModifier,
|
|
83091
|
-
Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module
|
|
83092
|
-
));
|
|
82970
|
+
diagnostics.add(createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module));
|
|
83093
82971
|
}
|
|
83094
82972
|
switch (moduleKind) {
|
|
83095
82973
|
case 100 /* Node16 */:
|
|
@@ -83108,10 +82986,7 @@ function createTypeChecker(host) {
|
|
|
83108
82986
|
}
|
|
83109
82987
|
default:
|
|
83110
82988
|
diagnostics.add(
|
|
83111
|
-
createDiagnosticForNode(
|
|
83112
|
-
forInOrOfStatement.awaitModifier,
|
|
83113
|
-
Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher
|
|
83114
|
-
)
|
|
82989
|
+
createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher)
|
|
83115
82990
|
);
|
|
83116
82991
|
break;
|
|
83117
82992
|
}
|
|
@@ -86969,10 +86844,7 @@ function createTemplateCooked(factory2, template) {
|
|
|
86969
86844
|
function getRawLiteral(factory2, node, currentSourceFile) {
|
|
86970
86845
|
let text = node.rawText;
|
|
86971
86846
|
if (text === void 0) {
|
|
86972
|
-
Debug.assertIsDefined(
|
|
86973
|
-
currentSourceFile,
|
|
86974
|
-
"Template literal node is missing 'rawText' and does not have a source file. Possibly bad transform."
|
|
86975
|
-
);
|
|
86847
|
+
Debug.assertIsDefined(currentSourceFile, "Template literal node is missing 'rawText' and does not have a source file. Possibly bad transform.");
|
|
86976
86848
|
text = getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
|
|
86977
86849
|
const isLast = node.kind === 15 /* NoSubstitutionTemplateLiteral */ || node.kind === 18 /* TemplateTail */;
|
|
86978
86850
|
text = text.substring(1, text.length - (isLast ? 1 : 2));
|
|
@@ -87020,12 +86892,15 @@ function transformTypeScript(context) {
|
|
|
87020
86892
|
return transformSourceFile(node);
|
|
87021
86893
|
}
|
|
87022
86894
|
function transformBundle(node) {
|
|
87023
|
-
return factory2.createBundle(
|
|
87024
|
-
|
|
87025
|
-
|
|
87026
|
-
|
|
87027
|
-
|
|
87028
|
-
|
|
86895
|
+
return factory2.createBundle(
|
|
86896
|
+
node.sourceFiles.map(transformSourceFile),
|
|
86897
|
+
mapDefined(node.prepends, (prepend) => {
|
|
86898
|
+
if (prepend.kind === 315 /* InputFiles */) {
|
|
86899
|
+
return createUnparsedSourceFile(prepend, "js");
|
|
86900
|
+
}
|
|
86901
|
+
return prepend;
|
|
86902
|
+
})
|
|
86903
|
+
);
|
|
87029
86904
|
}
|
|
87030
86905
|
function transformSourceFile(node) {
|
|
87031
86906
|
if (node.isDeclarationFile) {
|
|
@@ -91473,16 +91348,19 @@ function transformLegacyDecorators(context) {
|
|
|
91473
91348
|
true
|
|
91474
91349
|
);
|
|
91475
91350
|
if (hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node)) {
|
|
91476
|
-
members = setTextRange(
|
|
91477
|
-
|
|
91478
|
-
|
|
91479
|
-
factory2.
|
|
91480
|
-
|
|
91481
|
-
|
|
91482
|
-
|
|
91351
|
+
members = setTextRange(
|
|
91352
|
+
factory2.createNodeArray([
|
|
91353
|
+
...members,
|
|
91354
|
+
factory2.createClassStaticBlockDeclaration(
|
|
91355
|
+
factory2.createBlock(
|
|
91356
|
+
decorationStatements,
|
|
91357
|
+
/*multiLine*/
|
|
91358
|
+
true
|
|
91359
|
+
)
|
|
91483
91360
|
)
|
|
91484
|
-
)
|
|
91485
|
-
|
|
91361
|
+
]),
|
|
91362
|
+
members
|
|
91363
|
+
);
|
|
91486
91364
|
decorationStatements = void 0;
|
|
91487
91365
|
}
|
|
91488
91366
|
return { decorationStatements, members };
|
|
@@ -91529,16 +91407,19 @@ function transformLegacyDecorators(context) {
|
|
|
91529
91407
|
({ members, decorationStatements } = transformDecoratorsOfClassElements(node, members));
|
|
91530
91408
|
const assignClassAliasInStaticBlock = languageVersion >= 9 /* ES2022 */ && !!classAlias && some(members, (member) => isPropertyDeclaration(member) && hasSyntacticModifier(member, 32 /* Static */) || isClassStaticBlockDeclaration(member));
|
|
91531
91409
|
if (assignClassAliasInStaticBlock) {
|
|
91532
|
-
members = setTextRange(
|
|
91533
|
-
factory2.
|
|
91534
|
-
factory2.
|
|
91535
|
-
factory2.
|
|
91536
|
-
factory2.
|
|
91537
|
-
|
|
91538
|
-
|
|
91539
|
-
|
|
91540
|
-
|
|
91541
|
-
|
|
91410
|
+
members = setTextRange(
|
|
91411
|
+
factory2.createNodeArray([
|
|
91412
|
+
factory2.createClassStaticBlockDeclaration(
|
|
91413
|
+
factory2.createBlock([
|
|
91414
|
+
factory2.createExpressionStatement(
|
|
91415
|
+
factory2.createAssignment(classAlias, factory2.createThis())
|
|
91416
|
+
)
|
|
91417
|
+
])
|
|
91418
|
+
),
|
|
91419
|
+
...members
|
|
91420
|
+
]),
|
|
91421
|
+
members
|
|
91422
|
+
);
|
|
91542
91423
|
}
|
|
91543
91424
|
const classExpression = factory2.createClassExpression(
|
|
91544
91425
|
modifiers,
|
|
@@ -91610,55 +91491,67 @@ function transformLegacyDecorators(context) {
|
|
|
91610
91491
|
return updated;
|
|
91611
91492
|
}
|
|
91612
91493
|
function visitMethodDeclaration(node) {
|
|
91613
|
-
return finishClassElement(
|
|
91614
|
-
|
|
91615
|
-
|
|
91616
|
-
|
|
91617
|
-
|
|
91618
|
-
|
|
91619
|
-
|
|
91620
|
-
|
|
91621
|
-
|
|
91622
|
-
|
|
91623
|
-
|
|
91624
|
-
|
|
91625
|
-
|
|
91626
|
-
|
|
91494
|
+
return finishClassElement(
|
|
91495
|
+
factory2.updateMethodDeclaration(
|
|
91496
|
+
node,
|
|
91497
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
91498
|
+
node.asteriskToken,
|
|
91499
|
+
Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
|
|
91500
|
+
/*questionToken*/
|
|
91501
|
+
void 0,
|
|
91502
|
+
/*typeParameters*/
|
|
91503
|
+
void 0,
|
|
91504
|
+
visitNodes2(node.parameters, visitor, isParameter),
|
|
91505
|
+
/*type*/
|
|
91506
|
+
void 0,
|
|
91507
|
+
visitNode(node.body, visitor, isBlock)
|
|
91508
|
+
),
|
|
91509
|
+
node
|
|
91510
|
+
);
|
|
91627
91511
|
}
|
|
91628
91512
|
function visitGetAccessorDeclaration(node) {
|
|
91629
|
-
return finishClassElement(
|
|
91630
|
-
|
|
91631
|
-
|
|
91632
|
-
|
|
91633
|
-
|
|
91634
|
-
|
|
91635
|
-
|
|
91636
|
-
|
|
91637
|
-
|
|
91513
|
+
return finishClassElement(
|
|
91514
|
+
factory2.updateGetAccessorDeclaration(
|
|
91515
|
+
node,
|
|
91516
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
91517
|
+
Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
|
|
91518
|
+
visitNodes2(node.parameters, visitor, isParameter),
|
|
91519
|
+
/*type*/
|
|
91520
|
+
void 0,
|
|
91521
|
+
visitNode(node.body, visitor, isBlock)
|
|
91522
|
+
),
|
|
91523
|
+
node
|
|
91524
|
+
);
|
|
91638
91525
|
}
|
|
91639
91526
|
function visitSetAccessorDeclaration(node) {
|
|
91640
|
-
return finishClassElement(
|
|
91641
|
-
|
|
91642
|
-
|
|
91643
|
-
|
|
91644
|
-
|
|
91645
|
-
|
|
91646
|
-
|
|
91527
|
+
return finishClassElement(
|
|
91528
|
+
factory2.updateSetAccessorDeclaration(
|
|
91529
|
+
node,
|
|
91530
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
91531
|
+
Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
|
|
91532
|
+
visitNodes2(node.parameters, visitor, isParameter),
|
|
91533
|
+
visitNode(node.body, visitor, isBlock)
|
|
91534
|
+
),
|
|
91535
|
+
node
|
|
91536
|
+
);
|
|
91647
91537
|
}
|
|
91648
91538
|
function visitPropertyDeclaration(node) {
|
|
91649
91539
|
if (node.flags & 33554432 /* Ambient */ || hasSyntacticModifier(node, 2 /* Ambient */)) {
|
|
91650
91540
|
return void 0;
|
|
91651
91541
|
}
|
|
91652
|
-
return finishClassElement(
|
|
91653
|
-
|
|
91654
|
-
|
|
91655
|
-
|
|
91656
|
-
|
|
91657
|
-
|
|
91658
|
-
|
|
91659
|
-
|
|
91660
|
-
|
|
91661
|
-
|
|
91542
|
+
return finishClassElement(
|
|
91543
|
+
factory2.updatePropertyDeclaration(
|
|
91544
|
+
node,
|
|
91545
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
91546
|
+
Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
|
|
91547
|
+
/*questionOrExclamationToken*/
|
|
91548
|
+
void 0,
|
|
91549
|
+
/*type*/
|
|
91550
|
+
void 0,
|
|
91551
|
+
visitNode(node.initializer, visitor, isExpression)
|
|
91552
|
+
),
|
|
91553
|
+
node
|
|
91554
|
+
);
|
|
91662
91555
|
}
|
|
91663
91556
|
function visitParameterDeclaration(node) {
|
|
91664
91557
|
const updated = factory2.updateParameterDeclaration(
|
|
@@ -92241,7 +92134,10 @@ function transformESDecorators(context) {
|
|
|
92241
92134
|
classInfo2.classDescriptorName = factory2.createUniqueName("_classDescriptor", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
92242
92135
|
classInfo2.classExtraInitializersName = factory2.createUniqueName("_classExtraInitializers", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
92243
92136
|
const needsUniqueClassThis = some(node.members, (member) => (isPrivateIdentifierClassElementDeclaration(member) || isAutoAccessorPropertyDeclaration(member)) && hasStaticModifier(member));
|
|
92244
|
-
classInfo2.classThis = factory2.createUniqueName(
|
|
92137
|
+
classInfo2.classThis = factory2.createUniqueName(
|
|
92138
|
+
"_classThis",
|
|
92139
|
+
needsUniqueClassThis ? 16 /* Optimistic */ | 8 /* ReservedInNestedScopes */ : 16 /* Optimistic */ | 32 /* FileLevel */
|
|
92140
|
+
);
|
|
92245
92141
|
classDefinitionStatements.push(
|
|
92246
92142
|
createLet(classInfo2.classDecoratorsName, factory2.createArrayLiteralExpression(classDecorators)),
|
|
92247
92143
|
createLet(classInfo2.classDescriptorName),
|
|
@@ -94648,9 +94544,12 @@ function transformES2018(context) {
|
|
|
94648
94544
|
}
|
|
94649
94545
|
function visitReturnStatement(node) {
|
|
94650
94546
|
if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) {
|
|
94651
|
-
return factory2.updateReturnStatement(
|
|
94652
|
-
node
|
|
94653
|
-
|
|
94547
|
+
return factory2.updateReturnStatement(
|
|
94548
|
+
node,
|
|
94549
|
+
createDownlevelAwait(
|
|
94550
|
+
node.expression ? visitNode(node.expression, visitor, isExpression) : factory2.createVoidZero()
|
|
94551
|
+
)
|
|
94552
|
+
);
|
|
94654
94553
|
}
|
|
94655
94554
|
return visitEachChild(node, visitor, context);
|
|
94656
94555
|
}
|
|
@@ -94676,7 +94575,10 @@ function transformES2018(context) {
|
|
|
94676
94575
|
const target = e.expression;
|
|
94677
94576
|
objects.push(visitNode(target, visitor, isExpression));
|
|
94678
94577
|
} else {
|
|
94679
|
-
chunkObject = append(
|
|
94578
|
+
chunkObject = append(
|
|
94579
|
+
chunkObject,
|
|
94580
|
+
e.kind === 303 /* PropertyAssignment */ ? factory2.createPropertyAssignment(e.name, visitNode(e.initializer, visitor, isExpression)) : visitNode(e, visitor, isObjectLiteralElementLike)
|
|
94581
|
+
);
|
|
94680
94582
|
}
|
|
94681
94583
|
}
|
|
94682
94584
|
if (chunkObject) {
|
|
@@ -94715,13 +94617,16 @@ function transformES2018(context) {
|
|
|
94715
94617
|
);
|
|
94716
94618
|
exportedVariableStatement = false;
|
|
94717
94619
|
const visited = visitEachChild(node, visitor, context);
|
|
94718
|
-
const statement = concatenate(
|
|
94719
|
-
|
|
94720
|
-
|
|
94721
|
-
|
|
94722
|
-
|
|
94723
|
-
|
|
94724
|
-
|
|
94620
|
+
const statement = concatenate(
|
|
94621
|
+
visited.statements,
|
|
94622
|
+
taggedTemplateStringDeclarations && [
|
|
94623
|
+
factory2.createVariableStatement(
|
|
94624
|
+
/*modifiers*/
|
|
94625
|
+
void 0,
|
|
94626
|
+
factory2.createVariableDeclarationList(taggedTemplateStringDeclarations)
|
|
94627
|
+
)
|
|
94628
|
+
]
|
|
94629
|
+
);
|
|
94725
94630
|
const result = factory2.updateSourceFile(visited, setTextRange(factory2.createNodeArray(statement), node.statements));
|
|
94726
94631
|
exitSubtree(ancestorFacts);
|
|
94727
94632
|
return result;
|
|
@@ -95847,15 +95752,18 @@ function transformES2020(context) {
|
|
|
95847
95752
|
right = factory2.createTempVariable(hoistVariableDeclaration);
|
|
95848
95753
|
left = factory2.createAssignment(right, left);
|
|
95849
95754
|
}
|
|
95850
|
-
return setTextRange(
|
|
95851
|
-
|
|
95852
|
-
|
|
95853
|
-
|
|
95854
|
-
|
|
95855
|
-
|
|
95856
|
-
|
|
95857
|
-
|
|
95858
|
-
|
|
95755
|
+
return setTextRange(
|
|
95756
|
+
factory2.createConditionalExpression(
|
|
95757
|
+
createNotNullCondition(left, right),
|
|
95758
|
+
/*questionToken*/
|
|
95759
|
+
void 0,
|
|
95760
|
+
right,
|
|
95761
|
+
/*colonToken*/
|
|
95762
|
+
void 0,
|
|
95763
|
+
visitNode(node.right, visitor, isExpression)
|
|
95764
|
+
),
|
|
95765
|
+
node
|
|
95766
|
+
);
|
|
95859
95767
|
}
|
|
95860
95768
|
function visitDeleteExpression(node) {
|
|
95861
95769
|
return isOptionalChain(skipParentheses(node.expression)) ? setOriginalNode(visitNonOptionalExpression(
|
|
@@ -96009,13 +95917,16 @@ function transformESNext(context) {
|
|
|
96009
95917
|
const envBinding = createEnvBinding();
|
|
96010
95918
|
const bodyStatements = transformUsingDeclarations(node.statements, pos, node.statements.length, envBinding, topLevelStatements);
|
|
96011
95919
|
if (exportBindings.size) {
|
|
96012
|
-
append(
|
|
96013
|
-
|
|
96014
|
-
|
|
96015
|
-
|
|
96016
|
-
|
|
96017
|
-
|
|
96018
|
-
|
|
95920
|
+
append(
|
|
95921
|
+
topLevelStatements,
|
|
95922
|
+
factory2.createExportDeclaration(
|
|
95923
|
+
/*modifiers*/
|
|
95924
|
+
void 0,
|
|
95925
|
+
/*isTypeOnly*/
|
|
95926
|
+
false,
|
|
95927
|
+
factory2.createNamedExports(arrayFrom(exportBindings.values()))
|
|
95928
|
+
)
|
|
95929
|
+
);
|
|
96019
95930
|
}
|
|
96020
95931
|
addRange(topLevelStatements, endLexicalEnvironment());
|
|
96021
95932
|
if (exportVars.length) {
|
|
@@ -96779,7 +96690,9 @@ function transformJsx(context) {
|
|
|
96779
96690
|
}
|
|
96780
96691
|
}
|
|
96781
96692
|
function hasProto(obj) {
|
|
96782
|
-
return obj.properties.some(
|
|
96693
|
+
return obj.properties.some(
|
|
96694
|
+
(p) => isPropertyAssignment(p) && (isIdentifier(p.name) && idText(p.name) === "__proto__" || isStringLiteral(p.name) && p.name.text === "__proto__")
|
|
96695
|
+
);
|
|
96783
96696
|
}
|
|
96784
96697
|
function hasKeyAfterPropsSpread(node) {
|
|
96785
96698
|
let spread = false;
|
|
@@ -97801,10 +97714,13 @@ function transformES2015(context) {
|
|
|
97801
97714
|
}
|
|
97802
97715
|
}
|
|
97803
97716
|
if (node.flags & 256 /* IdentifierHasExtendedUnicodeEscape */) {
|
|
97804
|
-
return setOriginalNode(
|
|
97805
|
-
|
|
97717
|
+
return setOriginalNode(
|
|
97718
|
+
setTextRange(
|
|
97719
|
+
factory2.createIdentifier(unescapeLeadingUnderscores(node.escapedText)),
|
|
97720
|
+
node
|
|
97721
|
+
),
|
|
97806
97722
|
node
|
|
97807
|
-
)
|
|
97723
|
+
);
|
|
97808
97724
|
}
|
|
97809
97725
|
return node;
|
|
97810
97726
|
}
|
|
@@ -98983,7 +98899,11 @@ function transformES2015(context) {
|
|
|
98983
98899
|
if (node.flags & 7 /* BlockScoped */) {
|
|
98984
98900
|
enableSubstitutionsForBlockScopedBindings();
|
|
98985
98901
|
}
|
|
98986
|
-
const declarations = visitNodes2(
|
|
98902
|
+
const declarations = visitNodes2(
|
|
98903
|
+
node.declarations,
|
|
98904
|
+
node.flags & 1 /* Let */ ? visitVariableDeclarationInLetDeclarationList : visitVariableDeclaration,
|
|
98905
|
+
isVariableDeclaration
|
|
98906
|
+
);
|
|
98987
98907
|
const declarationList = factory2.createVariableDeclarationList(declarations);
|
|
98988
98908
|
setOriginalNode(declarationList, node);
|
|
98989
98909
|
setTextRange(declarationList, node);
|
|
@@ -100426,11 +100346,7 @@ function transformES2015(context) {
|
|
|
100426
100346
|
// As we visit each element, we return one of two functions to use as the "key":
|
|
100427
100347
|
// - `visitSpanOfSpreads` for one or more contiguous `...` spread expressions, i.e. `...a, ...b` in `[1, 2, ...a, ...b]`
|
|
100428
100348
|
// - `visitSpanOfNonSpreads` for one or more contiguous non-spread elements, i.e. `1, 2`, in `[1, 2, ...a, ...b]`
|
|
100429
|
-
spanMap(
|
|
100430
|
-
elements,
|
|
100431
|
-
partitionSpread,
|
|
100432
|
-
(partition, visitPartition, _start, end) => visitPartition(partition, multiLine, hasTrailingComma && end === numElements)
|
|
100433
|
-
)
|
|
100349
|
+
spanMap(elements, partitionSpread, (partition, visitPartition, _start, end) => visitPartition(partition, multiLine, hasTrailingComma && end === numElements))
|
|
100434
100350
|
);
|
|
100435
100351
|
if (segments.length === 1) {
|
|
100436
100352
|
const firstSegment = segments[0];
|
|
@@ -101082,11 +100998,7 @@ function transformGenerators(context) {
|
|
|
101082
100998
|
);
|
|
101083
100999
|
break;
|
|
101084
101000
|
case 212 /* ElementAccessExpression */:
|
|
101085
|
-
target = factory2.updateElementAccessExpression(
|
|
101086
|
-
left,
|
|
101087
|
-
cacheExpression(Debug.checkDefined(visitNode(left.expression, visitor, isLeftHandSideExpression))),
|
|
101088
|
-
cacheExpression(Debug.checkDefined(visitNode(left.argumentExpression, visitor, isExpression)))
|
|
101089
|
-
);
|
|
101001
|
+
target = factory2.updateElementAccessExpression(left, cacheExpression(Debug.checkDefined(visitNode(left.expression, visitor, isLeftHandSideExpression))), cacheExpression(Debug.checkDefined(visitNode(left.argumentExpression, visitor, isExpression))));
|
|
101090
101002
|
break;
|
|
101091
101003
|
default:
|
|
101092
101004
|
target = Debug.checkDefined(visitNode(left, visitor, isExpression));
|
|
@@ -101121,12 +101033,7 @@ function transformGenerators(context) {
|
|
|
101121
101033
|
} else if (node.operatorToken.kind === 28 /* CommaToken */) {
|
|
101122
101034
|
return visitCommaExpression(node);
|
|
101123
101035
|
}
|
|
101124
|
-
return factory2.updateBinaryExpression(
|
|
101125
|
-
node,
|
|
101126
|
-
cacheExpression(Debug.checkDefined(visitNode(node.left, visitor, isExpression))),
|
|
101127
|
-
node.operatorToken,
|
|
101128
|
-
Debug.checkDefined(visitNode(node.right, visitor, isExpression))
|
|
101129
|
-
);
|
|
101036
|
+
return factory2.updateBinaryExpression(node, cacheExpression(Debug.checkDefined(visitNode(node.left, visitor, isExpression))), node.operatorToken, Debug.checkDefined(visitNode(node.right, visitor, isExpression)));
|
|
101130
101037
|
}
|
|
101131
101038
|
return visitEachChild(node, visitor, context);
|
|
101132
101039
|
}
|
|
@@ -101334,11 +101241,7 @@ function transformGenerators(context) {
|
|
|
101334
101241
|
}
|
|
101335
101242
|
function visitElementAccessExpression(node) {
|
|
101336
101243
|
if (containsYield(node.argumentExpression)) {
|
|
101337
|
-
return factory2.updateElementAccessExpression(
|
|
101338
|
-
node,
|
|
101339
|
-
cacheExpression(Debug.checkDefined(visitNode(node.expression, visitor, isLeftHandSideExpression))),
|
|
101340
|
-
Debug.checkDefined(visitNode(node.argumentExpression, visitor, isExpression))
|
|
101341
|
-
);
|
|
101244
|
+
return factory2.updateElementAccessExpression(node, cacheExpression(Debug.checkDefined(visitNode(node.expression, visitor, isLeftHandSideExpression))), Debug.checkDefined(visitNode(node.argumentExpression, visitor, isExpression)));
|
|
101342
101245
|
}
|
|
101343
101246
|
return visitEachChild(node, visitor, context);
|
|
101344
101247
|
}
|
|
@@ -101696,12 +101599,7 @@ function transformGenerators(context) {
|
|
|
101696
101599
|
for (const variable of initializer.declarations) {
|
|
101697
101600
|
hoistVariableDeclaration(variable.name);
|
|
101698
101601
|
}
|
|
101699
|
-
node = factory2.updateForInStatement(
|
|
101700
|
-
node,
|
|
101701
|
-
initializer.declarations[0].name,
|
|
101702
|
-
Debug.checkDefined(visitNode(node.expression, visitor, isExpression)),
|
|
101703
|
-
Debug.checkDefined(visitNode(node.statement, visitor, isStatement, factory2.liftToBlock))
|
|
101704
|
-
);
|
|
101602
|
+
node = factory2.updateForInStatement(node, initializer.declarations[0].name, Debug.checkDefined(visitNode(node.expression, visitor, isExpression)), Debug.checkDefined(visitNode(node.statement, visitor, isStatement, factory2.liftToBlock)));
|
|
101705
101603
|
} else {
|
|
101706
101604
|
node = visitEachChild(node, visitor, context);
|
|
101707
101605
|
}
|
|
@@ -102862,12 +102760,14 @@ function transformModule(context) {
|
|
|
102862
102760
|
// Add the dependency array argument:
|
|
102863
102761
|
//
|
|
102864
102762
|
// ["require", "exports", module1", "module2", ...]
|
|
102865
|
-
factory2.createArrayLiteralExpression(
|
|
102866
|
-
|
|
102867
|
-
|
|
102868
|
-
|
|
102869
|
-
|
|
102870
|
-
|
|
102763
|
+
factory2.createArrayLiteralExpression(
|
|
102764
|
+
jsonSourceFile ? emptyArray : [
|
|
102765
|
+
factory2.createStringLiteral("require"),
|
|
102766
|
+
factory2.createStringLiteral("exports"),
|
|
102767
|
+
...aliasedModuleNames,
|
|
102768
|
+
...unaliasedModuleNames
|
|
102769
|
+
]
|
|
102770
|
+
),
|
|
102871
102771
|
// Add the module body function argument:
|
|
102872
102772
|
//
|
|
102873
102773
|
// function (require, exports, module1, module2) ...
|
|
@@ -103593,22 +103493,25 @@ function transformModule(context) {
|
|
|
103593
103493
|
);
|
|
103594
103494
|
} else {
|
|
103595
103495
|
const temp = factory2.createTempVariable(hoistVariableDeclaration);
|
|
103596
|
-
return factory2.createComma(
|
|
103597
|
-
|
|
103598
|
-
factory2.
|
|
103599
|
-
|
|
103600
|
-
|
|
103601
|
-
|
|
103602
|
-
|
|
103603
|
-
|
|
103604
|
-
|
|
103605
|
-
|
|
103606
|
-
|
|
103607
|
-
|
|
103608
|
-
|
|
103609
|
-
|
|
103610
|
-
|
|
103611
|
-
|
|
103496
|
+
return factory2.createComma(
|
|
103497
|
+
factory2.createAssignment(temp, arg),
|
|
103498
|
+
factory2.createConditionalExpression(
|
|
103499
|
+
/*condition*/
|
|
103500
|
+
factory2.createIdentifier("__syncRequire"),
|
|
103501
|
+
/*questionToken*/
|
|
103502
|
+
void 0,
|
|
103503
|
+
/*whenTrue*/
|
|
103504
|
+
createImportCallExpressionCommonJS(
|
|
103505
|
+
temp,
|
|
103506
|
+
/*isInlineable*/
|
|
103507
|
+
true
|
|
103508
|
+
),
|
|
103509
|
+
/*colonToken*/
|
|
103510
|
+
void 0,
|
|
103511
|
+
/*whenFalse*/
|
|
103512
|
+
createImportCallExpressionAMD(temp, containsLexicalThis)
|
|
103513
|
+
)
|
|
103514
|
+
);
|
|
103612
103515
|
}
|
|
103613
103516
|
}
|
|
103614
103517
|
function createImportCallExpressionAMD(arg, containsLexicalThis) {
|
|
@@ -104049,7 +103952,10 @@ function transformModule(context) {
|
|
|
104049
103952
|
factory2.createExpressionStatement(
|
|
104050
103953
|
createExportExpression(
|
|
104051
103954
|
factory2.cloneNode(node.exportClause.name),
|
|
104052
|
-
getHelperExpressionForExport(
|
|
103955
|
+
getHelperExpressionForExport(
|
|
103956
|
+
node,
|
|
103957
|
+
moduleKind !== 2 /* AMD */ ? createRequireCall(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : factory2.createIdentifier(idText(node.exportClause.name))
|
|
103958
|
+
)
|
|
104053
103959
|
)
|
|
104054
103960
|
),
|
|
104055
103961
|
node
|
|
@@ -104441,21 +104347,24 @@ function transformModule(context) {
|
|
|
104441
104347
|
factory2.createStringLiteralFromNode(name),
|
|
104442
104348
|
factory2.createObjectLiteralExpression([
|
|
104443
104349
|
factory2.createPropertyAssignment("enumerable", factory2.createTrue()),
|
|
104444
|
-
factory2.createPropertyAssignment(
|
|
104445
|
-
|
|
104446
|
-
|
|
104447
|
-
|
|
104448
|
-
|
|
104449
|
-
|
|
104450
|
-
|
|
104451
|
-
|
|
104452
|
-
|
|
104453
|
-
|
|
104454
|
-
|
|
104455
|
-
|
|
104456
|
-
|
|
104457
|
-
|
|
104458
|
-
|
|
104350
|
+
factory2.createPropertyAssignment(
|
|
104351
|
+
"get",
|
|
104352
|
+
factory2.createFunctionExpression(
|
|
104353
|
+
/*modifiers*/
|
|
104354
|
+
void 0,
|
|
104355
|
+
/*asteriskToken*/
|
|
104356
|
+
void 0,
|
|
104357
|
+
/*name*/
|
|
104358
|
+
void 0,
|
|
104359
|
+
/*typeParameters*/
|
|
104360
|
+
void 0,
|
|
104361
|
+
/*parameters*/
|
|
104362
|
+
[],
|
|
104363
|
+
/*type*/
|
|
104364
|
+
void 0,
|
|
104365
|
+
factory2.createBlock([factory2.createReturnStatement(value)])
|
|
104366
|
+
)
|
|
104367
|
+
)
|
|
104459
104368
|
])
|
|
104460
104369
|
]
|
|
104461
104370
|
) : factory2.createAssignment(
|
|
@@ -104830,10 +104739,7 @@ function transformSystemModule(context) {
|
|
|
104830
104739
|
const modifiers = node.transformFlags & 2097152 /* ContainsAwait */ ? factory2.createModifiersFromModifierFlags(512 /* Async */) : void 0;
|
|
104831
104740
|
const moduleObject = factory2.createObjectLiteralExpression(
|
|
104832
104741
|
[
|
|
104833
|
-
factory2.createPropertyAssignment(
|
|
104834
|
-
"setters",
|
|
104835
|
-
createSettersArray(exportStarFunction, dependencyGroups)
|
|
104836
|
-
),
|
|
104742
|
+
factory2.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)),
|
|
104837
104743
|
factory2.createPropertyAssignment(
|
|
104838
104744
|
"execute",
|
|
104839
104745
|
factory2.createFunctionExpression(
|
|
@@ -106153,18 +106059,21 @@ function transformECMAScriptModule(context) {
|
|
|
106153
106059
|
}
|
|
106154
106060
|
function appendExportsOfImportEqualsDeclaration(statements, node) {
|
|
106155
106061
|
if (hasSyntacticModifier(node, 1 /* Export */)) {
|
|
106156
|
-
statements = append(
|
|
106157
|
-
|
|
106158
|
-
|
|
106159
|
-
|
|
106160
|
-
factory2.createNamedExports([factory2.createExportSpecifier(
|
|
106161
|
-
/*isTypeOnly*/
|
|
106162
|
-
false,
|
|
106163
|
-
/*propertyName*/
|
|
106062
|
+
statements = append(
|
|
106063
|
+
statements,
|
|
106064
|
+
factory2.createExportDeclaration(
|
|
106065
|
+
/*modifiers*/
|
|
106164
106066
|
void 0,
|
|
106165
|
-
|
|
106166
|
-
|
|
106167
|
-
|
|
106067
|
+
node.isTypeOnly,
|
|
106068
|
+
factory2.createNamedExports([factory2.createExportSpecifier(
|
|
106069
|
+
/*isTypeOnly*/
|
|
106070
|
+
false,
|
|
106071
|
+
/*propertyName*/
|
|
106072
|
+
void 0,
|
|
106073
|
+
idText(node.name)
|
|
106074
|
+
)])
|
|
106075
|
+
)
|
|
106076
|
+
);
|
|
106168
106077
|
}
|
|
106169
106078
|
return statements;
|
|
106170
106079
|
}
|
|
@@ -106691,20 +106600,9 @@ function transformDeclarations(context) {
|
|
|
106691
106600
|
const errorInfo = getSymbolAccessibilityDiagnostic(symbolAccessibilityResult);
|
|
106692
106601
|
if (errorInfo) {
|
|
106693
106602
|
if (errorInfo.typeName) {
|
|
106694
|
-
context.addDiagnostic(createDiagnosticForNode(
|
|
106695
|
-
symbolAccessibilityResult.errorNode || errorInfo.errorNode,
|
|
106696
|
-
errorInfo.diagnosticMessage,
|
|
106697
|
-
getTextOfNode(errorInfo.typeName),
|
|
106698
|
-
symbolAccessibilityResult.errorSymbolName,
|
|
106699
|
-
symbolAccessibilityResult.errorModuleName
|
|
106700
|
-
));
|
|
106603
|
+
context.addDiagnostic(createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, getTextOfNode(errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName));
|
|
106701
106604
|
} else {
|
|
106702
|
-
context.addDiagnostic(createDiagnosticForNode(
|
|
106703
|
-
symbolAccessibilityResult.errorNode || errorInfo.errorNode,
|
|
106704
|
-
errorInfo.diagnosticMessage,
|
|
106705
|
-
symbolAccessibilityResult.errorSymbolName,
|
|
106706
|
-
symbolAccessibilityResult.errorModuleName
|
|
106707
|
-
));
|
|
106605
|
+
context.addDiagnostic(createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName));
|
|
106708
106606
|
}
|
|
106709
106607
|
return true;
|
|
106710
106608
|
}
|
|
@@ -106741,41 +106639,22 @@ function transformDeclarations(context) {
|
|
|
106741
106639
|
}
|
|
106742
106640
|
function reportInaccessibleUniqueSymbolError() {
|
|
106743
106641
|
if (errorNameNode || errorFallbackNode) {
|
|
106744
|
-
context.addDiagnostic(createDiagnosticForNode(
|
|
106745
|
-
errorNameNode || errorFallbackNode,
|
|
106746
|
-
Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary,
|
|
106747
|
-
errorDeclarationNameWithFallback(),
|
|
106748
|
-
"unique symbol"
|
|
106749
|
-
));
|
|
106642
|
+
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "unique symbol"));
|
|
106750
106643
|
}
|
|
106751
106644
|
}
|
|
106752
106645
|
function reportCyclicStructureError() {
|
|
106753
106646
|
if (errorNameNode || errorFallbackNode) {
|
|
106754
|
-
context.addDiagnostic(createDiagnosticForNode(
|
|
106755
|
-
errorNameNode || errorFallbackNode,
|
|
106756
|
-
Diagnostics.The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary,
|
|
106757
|
-
errorDeclarationNameWithFallback()
|
|
106758
|
-
));
|
|
106647
|
+
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary, errorDeclarationNameWithFallback()));
|
|
106759
106648
|
}
|
|
106760
106649
|
}
|
|
106761
106650
|
function reportInaccessibleThisError() {
|
|
106762
106651
|
if (errorNameNode || errorFallbackNode) {
|
|
106763
|
-
context.addDiagnostic(createDiagnosticForNode(
|
|
106764
|
-
errorNameNode || errorFallbackNode,
|
|
106765
|
-
Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary,
|
|
106766
|
-
errorDeclarationNameWithFallback(),
|
|
106767
|
-
"this"
|
|
106768
|
-
));
|
|
106652
|
+
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "this"));
|
|
106769
106653
|
}
|
|
106770
106654
|
}
|
|
106771
106655
|
function reportLikelyUnsafeImportRequiredError(specifier) {
|
|
106772
106656
|
if (errorNameNode || errorFallbackNode) {
|
|
106773
|
-
context.addDiagnostic(createDiagnosticForNode(
|
|
106774
|
-
errorNameNode || errorFallbackNode,
|
|
106775
|
-
Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary,
|
|
106776
|
-
errorDeclarationNameWithFallback(),
|
|
106777
|
-
specifier
|
|
106778
|
-
));
|
|
106657
|
+
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), specifier));
|
|
106779
106658
|
}
|
|
106780
106659
|
}
|
|
106781
106660
|
function reportTruncationError() {
|
|
@@ -106825,9 +106704,8 @@ function transformDeclarations(context) {
|
|
|
106825
106704
|
refs = /* @__PURE__ */ new Map();
|
|
106826
106705
|
libs2 = /* @__PURE__ */ new Map();
|
|
106827
106706
|
let hasNoDefaultLib = false;
|
|
106828
|
-
const bundle = factory2.createBundle(
|
|
106829
|
-
node.sourceFiles,
|
|
106830
|
-
(sourceFile) => {
|
|
106707
|
+
const bundle = factory2.createBundle(
|
|
106708
|
+
map(node.sourceFiles, (sourceFile) => {
|
|
106831
106709
|
if (sourceFile.isDeclarationFile)
|
|
106832
106710
|
return void 0;
|
|
106833
106711
|
hasNoDefaultLib = hasNoDefaultLib || sourceFile.hasNoDefaultLib;
|
|
@@ -106885,18 +106763,19 @@ function transformDeclarations(context) {
|
|
|
106885
106763
|
/*libReferences*/
|
|
106886
106764
|
[]
|
|
106887
106765
|
);
|
|
106888
|
-
}
|
|
106889
|
-
|
|
106890
|
-
|
|
106891
|
-
|
|
106892
|
-
|
|
106893
|
-
|
|
106894
|
-
|
|
106895
|
-
|
|
106896
|
-
|
|
106897
|
-
|
|
106898
|
-
|
|
106899
|
-
|
|
106766
|
+
}),
|
|
106767
|
+
mapDefined(node.prepends, (prepend) => {
|
|
106768
|
+
if (prepend.kind === 315 /* InputFiles */) {
|
|
106769
|
+
const sourceFile = createUnparsedSourceFile(prepend, "dts", stripInternal);
|
|
106770
|
+
hasNoDefaultLib = hasNoDefaultLib || !!sourceFile.hasNoDefaultLib;
|
|
106771
|
+
collectReferences(sourceFile, refs);
|
|
106772
|
+
recordTypeReferenceDirectivesIfNecessary(map(sourceFile.typeReferenceDirectives, (ref) => [ref.fileName, ref.resolutionMode]));
|
|
106773
|
+
collectLibs(sourceFile, libs2);
|
|
106774
|
+
return sourceFile;
|
|
106775
|
+
}
|
|
106776
|
+
return prepend;
|
|
106777
|
+
})
|
|
106778
|
+
);
|
|
106900
106779
|
bundle.syntheticFileReferences = [];
|
|
106901
106780
|
bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences();
|
|
106902
106781
|
bundle.syntheticLibReferences = getLibReferences();
|
|
@@ -107312,25 +107191,37 @@ function transformDeclarations(context) {
|
|
|
107312
107191
|
}
|
|
107313
107192
|
const visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : void 0;
|
|
107314
107193
|
if (!decl.importClause.namedBindings) {
|
|
107315
|
-
return visibleDefaultBinding && factory2.updateImportDeclaration(
|
|
107316
|
-
decl
|
|
107317
|
-
decl.
|
|
107318
|
-
|
|
107319
|
-
|
|
107320
|
-
|
|
107321
|
-
|
|
107194
|
+
return visibleDefaultBinding && factory2.updateImportDeclaration(
|
|
107195
|
+
decl,
|
|
107196
|
+
decl.modifiers,
|
|
107197
|
+
factory2.updateImportClause(
|
|
107198
|
+
decl.importClause,
|
|
107199
|
+
decl.importClause.isTypeOnly,
|
|
107200
|
+
visibleDefaultBinding,
|
|
107201
|
+
/*namedBindings*/
|
|
107202
|
+
void 0
|
|
107203
|
+
),
|
|
107204
|
+
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107205
|
+
getResolutionModeOverrideForClauseInNightly(decl.assertClause)
|
|
107206
|
+
);
|
|
107322
107207
|
}
|
|
107323
107208
|
if (decl.importClause.namedBindings.kind === 274 /* NamespaceImport */) {
|
|
107324
107209
|
const namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : (
|
|
107325
107210
|
/*namedBindings*/
|
|
107326
107211
|
void 0
|
|
107327
107212
|
);
|
|
107328
|
-
return visibleDefaultBinding || namedBindings ? factory2.updateImportDeclaration(
|
|
107329
|
-
decl
|
|
107330
|
-
decl.
|
|
107331
|
-
|
|
107332
|
-
|
|
107333
|
-
|
|
107213
|
+
return visibleDefaultBinding || namedBindings ? factory2.updateImportDeclaration(
|
|
107214
|
+
decl,
|
|
107215
|
+
decl.modifiers,
|
|
107216
|
+
factory2.updateImportClause(
|
|
107217
|
+
decl.importClause,
|
|
107218
|
+
decl.importClause.isTypeOnly,
|
|
107219
|
+
visibleDefaultBinding,
|
|
107220
|
+
namedBindings
|
|
107221
|
+
),
|
|
107222
|
+
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107223
|
+
getResolutionModeOverrideForClauseInNightly(decl.assertClause)
|
|
107224
|
+
) : void 0;
|
|
107334
107225
|
}
|
|
107335
107226
|
const bindingList = mapDefined(decl.importClause.namedBindings.elements, (b) => resolver.isDeclarationVisible(b) ? b : void 0);
|
|
107336
107227
|
if (bindingList && bindingList.length || visibleDefaultBinding) {
|
|
@@ -107988,13 +107879,16 @@ function transformDeclarations(context) {
|
|
|
107988
107879
|
return;
|
|
107989
107880
|
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(param);
|
|
107990
107881
|
if (param.name.kind === 80 /* Identifier */) {
|
|
107991
|
-
return preserveJsDoc(
|
|
107992
|
-
|
|
107993
|
-
|
|
107994
|
-
|
|
107995
|
-
|
|
107996
|
-
|
|
107997
|
-
|
|
107882
|
+
return preserveJsDoc(
|
|
107883
|
+
factory2.createPropertyDeclaration(
|
|
107884
|
+
ensureModifiers(param),
|
|
107885
|
+
param.name,
|
|
107886
|
+
param.questionToken,
|
|
107887
|
+
ensureType(param, param.type),
|
|
107888
|
+
ensureNoInitializer(param)
|
|
107889
|
+
),
|
|
107890
|
+
param
|
|
107891
|
+
);
|
|
107998
107892
|
} else {
|
|
107999
107893
|
return walkBindingPattern(param.name);
|
|
108000
107894
|
}
|
|
@@ -108070,14 +107964,17 @@ function transformDeclarations(context) {
|
|
|
108070
107964
|
}
|
|
108071
107965
|
return factory2.updateHeritageClause(clause, visitNodes2(factory2.createNodeArray(filter(clause.types, (t) => isEntityNameExpression(t.expression) || t.expression.kind === 106 /* NullKeyword */)), visitDeclarationSubtree, isExpressionWithTypeArguments));
|
|
108072
107966
|
}));
|
|
108073
|
-
return [
|
|
108074
|
-
|
|
108075
|
-
|
|
108076
|
-
|
|
108077
|
-
|
|
108078
|
-
|
|
108079
|
-
|
|
108080
|
-
|
|
107967
|
+
return [
|
|
107968
|
+
statement,
|
|
107969
|
+
cleanup(factory2.updateClassDeclaration(
|
|
107970
|
+
input,
|
|
107971
|
+
modifiers,
|
|
107972
|
+
input.name,
|
|
107973
|
+
typeParameters,
|
|
107974
|
+
heritageClauses,
|
|
107975
|
+
members
|
|
107976
|
+
))
|
|
107977
|
+
];
|
|
108081
107978
|
} else {
|
|
108082
107979
|
const heritageClauses = transformHeritageClauses(input.heritageClauses);
|
|
108083
107980
|
return cleanup(factory2.updateClassDeclaration(
|
|
@@ -108094,13 +107991,18 @@ function transformDeclarations(context) {
|
|
|
108094
107991
|
return cleanup(transformVariableStatement(input));
|
|
108095
107992
|
}
|
|
108096
107993
|
case 266 /* EnumDeclaration */: {
|
|
108097
|
-
return cleanup(factory2.updateEnumDeclaration(
|
|
108098
|
-
|
|
108099
|
-
|
|
108100
|
-
|
|
108101
|
-
|
|
108102
|
-
|
|
108103
|
-
|
|
107994
|
+
return cleanup(factory2.updateEnumDeclaration(
|
|
107995
|
+
input,
|
|
107996
|
+
factory2.createNodeArray(ensureModifiers(input)),
|
|
107997
|
+
input.name,
|
|
107998
|
+
factory2.createNodeArray(mapDefined(input.members, (m) => {
|
|
107999
|
+
if (shouldStripInternal(m))
|
|
108000
|
+
return;
|
|
108001
|
+
const constValue = resolver.getConstantValue(m);
|
|
108002
|
+
const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(constValue))) : factory2.createNumericLiteral(constValue);
|
|
108003
|
+
return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m);
|
|
108004
|
+
}))
|
|
108005
|
+
));
|
|
108104
108006
|
}
|
|
108105
108007
|
}
|
|
108106
108008
|
return Debug.assertNever(input, `Unhandled top-level node in declaration emit: ${Debug.formatSyntaxKind(input.kind)}`);
|
|
@@ -108224,9 +108126,19 @@ function transformDeclarations(context) {
|
|
|
108224
108126
|
return accessorType;
|
|
108225
108127
|
}
|
|
108226
108128
|
function transformHeritageClauses(nodes) {
|
|
108227
|
-
return factory2.createNodeArray(filter(
|
|
108228
|
-
|
|
108229
|
-
|
|
108129
|
+
return factory2.createNodeArray(filter(
|
|
108130
|
+
map(nodes, (clause) => factory2.updateHeritageClause(
|
|
108131
|
+
clause,
|
|
108132
|
+
visitNodes2(
|
|
108133
|
+
factory2.createNodeArray(filter(clause.types, (t) => {
|
|
108134
|
+
return isEntityNameExpression(t.expression) || clause.token === 96 /* ExtendsKeyword */ && t.expression.kind === 106 /* NullKeyword */;
|
|
108135
|
+
})),
|
|
108136
|
+
visitDeclarationSubtree,
|
|
108137
|
+
isExpressionWithTypeArguments
|
|
108138
|
+
)
|
|
108139
|
+
)),
|
|
108140
|
+
(clause) => clause.types && !!clause.types.length
|
|
108141
|
+
));
|
|
108230
108142
|
}
|
|
108231
108143
|
}
|
|
108232
108144
|
function isAlwaysType(node) {
|
|
@@ -110563,14 +110475,8 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
110563
110475
|
nonEscapingWrite(`}`);
|
|
110564
110476
|
}
|
|
110565
110477
|
function emitTabStop(hint, node, snippet) {
|
|
110566
|
-
Debug.assert(
|
|
110567
|
-
|
|
110568
|
-
`A tab stop cannot be attached to a node of kind ${Debug.formatSyntaxKind(node.kind)}.`
|
|
110569
|
-
);
|
|
110570
|
-
Debug.assert(
|
|
110571
|
-
hint !== 5 /* EmbeddedStatement */,
|
|
110572
|
-
`A tab stop cannot be attached to an embedded statement.`
|
|
110573
|
-
);
|
|
110478
|
+
Debug.assert(node.kind === 242 /* EmptyStatement */, `A tab stop cannot be attached to a node of kind ${Debug.formatSyntaxKind(node.kind)}.`);
|
|
110479
|
+
Debug.assert(hint !== 5 /* EmbeddedStatement */, `A tab stop cannot be attached to an embedded statement.`);
|
|
110574
110480
|
nonEscapingWrite(`$${snippet.order}`);
|
|
110575
110481
|
}
|
|
110576
110482
|
function emitIdentifier(node) {
|
|
@@ -111995,7 +111901,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
111995
111901
|
emitTokenWithComment(90 /* DefaultKeyword */, nextPos, writeKeyword, node);
|
|
111996
111902
|
}
|
|
111997
111903
|
writeSpace();
|
|
111998
|
-
emitExpression(
|
|
111904
|
+
emitExpression(
|
|
111905
|
+
node.expression,
|
|
111906
|
+
node.isExportEquals ? parenthesizer.getParenthesizeRightSideOfBinaryForOperator(64 /* EqualsToken */) : parenthesizer.parenthesizeExpressionOfExportDefault
|
|
111907
|
+
);
|
|
111999
111908
|
writeTrailingSemicolon();
|
|
112000
111909
|
}
|
|
112001
111910
|
function emitExportDeclaration(node) {
|
|
@@ -118180,19 +118089,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118180
118089
|
case 1 /* SourceFromProjectReference */:
|
|
118181
118090
|
case 2 /* OutputFromProjectReference */:
|
|
118182
118091
|
const referencedResolvedRef = Debug.checkDefined(resolvedProjectReferences == null ? void 0 : resolvedProjectReferences[reason.index]);
|
|
118183
|
-
const referenceInfo = forEachProjectReference(
|
|
118184
|
-
projectReferences,
|
|
118185
|
-
resolvedProjectReferences,
|
|
118186
|
-
(resolvedRef, parent, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent == null ? void 0 : parent.sourceFile) || options.configFile, index: index2 } : void 0
|
|
118187
|
-
);
|
|
118092
|
+
const referenceInfo = forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, parent, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent == null ? void 0 : parent.sourceFile) || options.configFile, index: index2 } : void 0);
|
|
118188
118093
|
if (!referenceInfo)
|
|
118189
118094
|
return void 0;
|
|
118190
118095
|
const { sourceFile, index } = referenceInfo;
|
|
118191
|
-
const referencesSyntax = forEachTsConfigPropArray(
|
|
118192
|
-
sourceFile,
|
|
118193
|
-
"references",
|
|
118194
|
-
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
118195
|
-
);
|
|
118096
|
+
const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
|
|
118196
118097
|
return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
|
|
118197
118098
|
sourceFile,
|
|
118198
118099
|
referencesSyntax.elements[index],
|
|
@@ -118332,11 +118233,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118332
118233
|
);
|
|
118333
118234
|
}
|
|
118334
118235
|
function createDiagnosticForReference(sourceFile, index, message, ...args) {
|
|
118335
|
-
const referencesSyntax = forEachTsConfigPropArray(
|
|
118336
|
-
sourceFile || options.configFile,
|
|
118337
|
-
"references",
|
|
118338
|
-
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
118339
|
-
);
|
|
118236
|
+
const referencesSyntax = forEachTsConfigPropArray(sourceFile || options.configFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
|
|
118340
118237
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
|
118341
118238
|
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
|
|
118342
118239
|
} else {
|
|
@@ -118930,13 +118827,16 @@ var BuilderState;
|
|
|
118930
118827
|
sourceFile,
|
|
118931
118828
|
(fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) => {
|
|
118932
118829
|
Debug.assert(isDeclarationFileName(fileName), `File extension for signature expected to be dts: Got:: ${fileName}`);
|
|
118933
|
-
onNewSignature(
|
|
118934
|
-
|
|
118935
|
-
|
|
118936
|
-
|
|
118937
|
-
|
|
118938
|
-
|
|
118939
|
-
|
|
118830
|
+
onNewSignature(
|
|
118831
|
+
computeSignatureWithDiagnostics(
|
|
118832
|
+
programOfThisState,
|
|
118833
|
+
sourceFile,
|
|
118834
|
+
text,
|
|
118835
|
+
host,
|
|
118836
|
+
data
|
|
118837
|
+
),
|
|
118838
|
+
sourceFiles
|
|
118839
|
+
);
|
|
118940
118840
|
},
|
|
118941
118841
|
cancellationToken,
|
|
118942
118842
|
/*emitOnly*/
|
|
@@ -119448,10 +119348,7 @@ function removeDiagnosticsOfLibraryFiles(state) {
|
|
|
119448
119348
|
state.cleanedDiagnosticsOfLibFiles = true;
|
|
119449
119349
|
const program = Debug.checkDefined(state.program);
|
|
119450
119350
|
const options = program.getCompilerOptions();
|
|
119451
|
-
forEach(
|
|
119452
|
-
program.getSourceFiles(),
|
|
119453
|
-
(f) => program.isSourceFileDefaultLibrary(f) && !skipTypeChecking(f, options, program) && removeSemanticDiagnosticsOf(state, f.resolvedPath)
|
|
119454
|
-
);
|
|
119351
|
+
forEach(program.getSourceFiles(), (f) => program.isSourceFileDefaultLibrary(f) && !skipTypeChecking(f, options, program) && removeSemanticDiagnosticsOf(state, f.resolvedPath));
|
|
119455
119352
|
}
|
|
119456
119353
|
}
|
|
119457
119354
|
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
@@ -119519,12 +119416,14 @@ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, hos
|
|
|
119519
119416
|
state.program,
|
|
119520
119417
|
/*firstSourceFile*/
|
|
119521
119418
|
void 0
|
|
119522
|
-
).forEach(
|
|
119523
|
-
|
|
119524
|
-
|
|
119525
|
-
|
|
119526
|
-
|
|
119527
|
-
|
|
119419
|
+
).forEach(
|
|
119420
|
+
(file) => handleDtsMayChangeOf(
|
|
119421
|
+
state,
|
|
119422
|
+
file.resolvedPath,
|
|
119423
|
+
cancellationToken,
|
|
119424
|
+
host
|
|
119425
|
+
)
|
|
119426
|
+
);
|
|
119528
119427
|
removeDiagnosticsOfLibraryFiles(state);
|
|
119529
119428
|
return true;
|
|
119530
119429
|
}
|
|
@@ -119557,16 +119456,13 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
|
|
|
119557
119456
|
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host))
|
|
119558
119457
|
return true;
|
|
119559
119458
|
const references = state.referencedMap.getKeys(exportedFromPath);
|
|
119560
|
-
return references && forEachKey(
|
|
119561
|
-
|
|
119562
|
-
|
|
119563
|
-
|
|
119564
|
-
|
|
119565
|
-
|
|
119566
|
-
|
|
119567
|
-
host
|
|
119568
|
-
)
|
|
119569
|
-
);
|
|
119459
|
+
return references && forEachKey(references, (filePath) => handleDtsMayChangeOfFileAndExportsOfFile(
|
|
119460
|
+
state,
|
|
119461
|
+
filePath,
|
|
119462
|
+
seenFileAndExportsOfFile,
|
|
119463
|
+
cancellationToken,
|
|
119464
|
+
host
|
|
119465
|
+
));
|
|
119570
119466
|
});
|
|
119571
119467
|
}
|
|
119572
119468
|
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
|
|
@@ -119674,11 +119570,13 @@ function getBuildInfo2(state, bundle) {
|
|
|
119674
119570
|
if (!isJsonSourceFile(file) && sourceFileMayBeEmitted(file, state.program)) {
|
|
119675
119571
|
const emitSignature = (_b2 = state.emitSignatures) == null ? void 0 : _b2.get(key);
|
|
119676
119572
|
if (emitSignature !== actualSignature) {
|
|
119677
|
-
(emitSignatures || (emitSignatures = [])).push(
|
|
119678
|
-
|
|
119679
|
-
|
|
119680
|
-
|
|
119681
|
-
|
|
119573
|
+
(emitSignatures || (emitSignatures = [])).push(
|
|
119574
|
+
emitSignature === void 0 ? fileId : (
|
|
119575
|
+
// There is no emit, encode as false
|
|
119576
|
+
// fileId, signature: emptyArray if signature only differs in dtsMap option than our own compilerOptions otherwise EmitSignature
|
|
119577
|
+
[fileId, !isString(emitSignature) && emitSignature[0] === actualSignature ? emptyArray : emitSignature]
|
|
119578
|
+
)
|
|
119579
|
+
);
|
|
119682
119580
|
}
|
|
119683
119581
|
}
|
|
119684
119582
|
}
|
|
@@ -119932,9 +119830,7 @@ function computeSignatureWithDiagnostics(program, sourceFile, text, host, data)
|
|
|
119932
119830
|
text = getTextHandlingSourceMapForSignature(text, data);
|
|
119933
119831
|
let sourceFileDirectory;
|
|
119934
119832
|
if ((_a = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a.length) {
|
|
119935
|
-
text += data.diagnostics.map(
|
|
119936
|
-
(diagnostic) => `${locationInfo(diagnostic)}${DiagnosticCategory[diagnostic.category]}${diagnostic.code}: ${flattenDiagnosticMessageText2(diagnostic.messageText)}`
|
|
119937
|
-
).join("\n");
|
|
119833
|
+
text += data.diagnostics.map((diagnostic) => `${locationInfo(diagnostic)}${DiagnosticCategory[diagnostic.category]}${diagnostic.code}: ${flattenDiagnosticMessageText2(diagnostic.messageText)}`).join("\n");
|
|
119938
119834
|
}
|
|
119939
119835
|
return (host.createHash ?? generateDjb2Hash)(text);
|
|
119940
119836
|
function flattenDiagnosticMessageText2(diagnostic) {
|
|
@@ -120341,9 +120237,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
120341
120237
|
return void 0;
|
|
120342
120238
|
}
|
|
120343
120239
|
const map2 = BuilderState.createManyToManyPathMap();
|
|
120344
|
-
referenceMap.forEach(
|
|
120345
|
-
([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId))
|
|
120346
|
-
);
|
|
120240
|
+
referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
|
|
120347
120241
|
return map2;
|
|
120348
120242
|
}
|
|
120349
120243
|
}
|
|
@@ -120833,11 +120727,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
120833
120727
|
seenNamesInFile.set(name, mode, true);
|
|
120834
120728
|
resolvedModules.push(resolution);
|
|
120835
120729
|
}
|
|
120836
|
-
reusedNames == null ? void 0 : reusedNames.forEach(
|
|
120837
|
-
|
|
120838
|
-
|
|
120839
|
-
|
|
120840
|
-
|
|
120730
|
+
reusedNames == null ? void 0 : reusedNames.forEach(
|
|
120731
|
+
(entry) => seenNamesInFile.set(
|
|
120732
|
+
loader.nameAndMode.getName(entry),
|
|
120733
|
+
loader.nameAndMode.getMode(entry, containingSourceFile),
|
|
120734
|
+
true
|
|
120735
|
+
)
|
|
120736
|
+
);
|
|
120841
120737
|
if (resolutionsInFile.size() !== seenNamesInFile.size()) {
|
|
120842
120738
|
resolutionsInFile.forEach((resolution, name, mode) => {
|
|
120843
120739
|
if (!seenNamesInFile.has(name, mode)) {
|
|
@@ -121466,10 +121362,7 @@ function getFilesInErrorForSummary(diagnostics) {
|
|
|
121466
121362
|
if (fileName === void 0) {
|
|
121467
121363
|
return void 0;
|
|
121468
121364
|
}
|
|
121469
|
-
const diagnosticForFileName = find(
|
|
121470
|
-
diagnostics,
|
|
121471
|
-
(diagnostic) => diagnostic.file !== void 0 && diagnostic.file.fileName === fileName
|
|
121472
|
-
);
|
|
121365
|
+
const diagnosticForFileName = find(diagnostics, (diagnostic) => diagnostic.file !== void 0 && diagnostic.file.fileName === fileName);
|
|
121473
121366
|
if (diagnosticForFileName !== void 0) {
|
|
121474
121367
|
const { line } = getLineAndCharacterOfPosition(diagnosticForFileName.file, diagnosticForFileName.start);
|
|
121475
121368
|
return {
|
|
@@ -122488,14 +122381,16 @@ function createWatchProgram(host) {
|
|
|
122488
122381
|
}
|
|
122489
122382
|
function parseConfigFile2() {
|
|
122490
122383
|
Debug.assert(configFileName);
|
|
122491
|
-
setConfigFileParsingResult(
|
|
122492
|
-
|
|
122493
|
-
|
|
122494
|
-
|
|
122495
|
-
|
|
122496
|
-
|
|
122497
|
-
|
|
122498
|
-
|
|
122384
|
+
setConfigFileParsingResult(
|
|
122385
|
+
getParsedCommandLineOfConfigFile(
|
|
122386
|
+
configFileName,
|
|
122387
|
+
optionsToExtendForConfigFile,
|
|
122388
|
+
parseConfigFileHost,
|
|
122389
|
+
extendedConfigCache || (extendedConfigCache = /* @__PURE__ */ new Map()),
|
|
122390
|
+
watchOptionsToExtend,
|
|
122391
|
+
extraFileExtensions
|
|
122392
|
+
)
|
|
122393
|
+
);
|
|
122499
122394
|
}
|
|
122500
122395
|
function setConfigFileParsingResult(configFileParseResult) {
|
|
122501
122396
|
rootFileNames = configFileParseResult.fileNames;
|
|
@@ -123333,10 +123228,13 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
|
|
|
123333
123228
|
config.projectReferences
|
|
123334
123229
|
);
|
|
123335
123230
|
if (state.watch) {
|
|
123336
|
-
state.lastCachedPackageJsonLookups.set(
|
|
123337
|
-
|
|
123338
|
-
|
|
123339
|
-
|
|
123231
|
+
state.lastCachedPackageJsonLookups.set(
|
|
123232
|
+
projectPath,
|
|
123233
|
+
state.moduleResolutionCache && map(
|
|
123234
|
+
state.moduleResolutionCache.getPackageJsonInfoCache().entries(),
|
|
123235
|
+
([path, data]) => [state.host.realpath && data ? toPath2(state, state.host.realpath(path)) : path, data]
|
|
123236
|
+
)
|
|
123237
|
+
);
|
|
123340
123238
|
state.builderPrograms.set(projectPath, program);
|
|
123341
123239
|
}
|
|
123342
123240
|
step++;
|
|
@@ -124390,15 +124288,18 @@ function buildNextInvalidatedProjectWorker(state, changeDetected) {
|
|
|
124390
124288
|
function watchConfigFile(state, resolved, resolvedPath, parsed) {
|
|
124391
124289
|
if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
|
|
124392
124290
|
return;
|
|
124393
|
-
state.allWatchedConfigFiles.set(
|
|
124394
|
-
|
|
124395
|
-
|
|
124396
|
-
|
|
124397
|
-
|
|
124398
|
-
|
|
124399
|
-
|
|
124400
|
-
|
|
124401
|
-
|
|
124291
|
+
state.allWatchedConfigFiles.set(
|
|
124292
|
+
resolvedPath,
|
|
124293
|
+
watchFile(
|
|
124294
|
+
state,
|
|
124295
|
+
resolved,
|
|
124296
|
+
() => invalidateProjectAndScheduleBuilds(state, resolvedPath, 2 /* Full */),
|
|
124297
|
+
2e3 /* High */,
|
|
124298
|
+
parsed == null ? void 0 : parsed.watchOptions,
|
|
124299
|
+
WatchType.ConfigFile,
|
|
124300
|
+
resolved
|
|
124301
|
+
)
|
|
124302
|
+
);
|
|
124402
124303
|
}
|
|
124403
124304
|
function watchExtendedConfigFiles(state, resolvedPath, parsed) {
|
|
124404
124305
|
updateSharedExtendedConfigFileWatcher(
|
|
@@ -125678,11 +125579,7 @@ function enableStatisticsAndTracing(system, compilerOptions, isBuildMode) {
|
|
|
125678
125579
|
enable(system);
|
|
125679
125580
|
}
|
|
125680
125581
|
if (canTrace(system, compilerOptions)) {
|
|
125681
|
-
startTracing(
|
|
125682
|
-
isBuildMode ? "build" : "project",
|
|
125683
|
-
compilerOptions.generateTrace,
|
|
125684
|
-
compilerOptions.configFilePath
|
|
125685
|
-
);
|
|
125582
|
+
startTracing(isBuildMode ? "build" : "project", compilerOptions.generateTrace, compilerOptions.configFilePath);
|
|
125686
125583
|
}
|
|
125687
125584
|
}
|
|
125688
125585
|
function isSolutionMarkOrMeasure(name) {
|