@typescript-deploys/pr-build 5.3.0-pr-55020-2 → 5.3.0-pr-55291-6
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 +1259 -1403
- package/lib/tsserver.js +1804 -2041
- package/lib/typescript.d.ts +339 -117
- package/lib/typescript.js +1804 -2041
- package/lib/typingsInstaller.js +124 -110
- 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-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.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;
|
|
@@ -6650,9 +6680,9 @@ var Diagnostics = {
|
|
|
6650
6680
|
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2821, 1 /* Error */, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),
|
|
6651
6681
|
Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, 1 /* Error */, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
|
|
6652
6682
|
Cannot_find_namespace_0_Did_you_mean_1: diag(2833, 1 /* Error */, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6683
|
+
Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path."),
|
|
6684
|
+
Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"),
|
|
6685
|
+
Import_assertions_are_not_allowed_on_statements_that_transpile_to_CommonJS_require_calls: diag(2836, 1 /* Error */, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_CommonJS_require_calls_2836", "Import assertions are not allowed on statements that transpile to CommonJS 'require' calls."),
|
|
6656
6686
|
Import_assertion_values_must_be_string_literal_expressions: diag(2837, 1 /* Error */, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
|
|
6657
6687
|
All_declarations_of_0_must_have_identical_constraints: diag(2838, 1 /* Error */, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
|
|
6658
6688
|
This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value: diag(2839, 1 /* Error */, "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839", "This condition will always return '{0}' since JavaScript compares objects by reference, not value."),
|
|
@@ -12673,10 +12703,7 @@ function isPartOfTypeNode(node) {
|
|
|
12673
12703
|
} else if (node.parent.kind === 211 /* PropertyAccessExpression */ && node.parent.name === node) {
|
|
12674
12704
|
node = node.parent;
|
|
12675
12705
|
}
|
|
12676
|
-
Debug.assert(
|
|
12677
|
-
node.kind === 80 /* Identifier */ || node.kind === 166 /* QualifiedName */ || node.kind === 211 /* PropertyAccessExpression */,
|
|
12678
|
-
"'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."
|
|
12679
|
-
);
|
|
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'.");
|
|
12680
12707
|
case 166 /* QualifiedName */:
|
|
12681
12708
|
case 211 /* PropertyAccessExpression */:
|
|
12682
12709
|
case 110 /* ThisKeyword */: {
|
|
@@ -12879,11 +12906,7 @@ function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
|
|
|
12879
12906
|
});
|
|
12880
12907
|
}
|
|
12881
12908
|
function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
|
|
12882
|
-
return forEachPropertyAssignment(
|
|
12883
|
-
objectLiteral,
|
|
12884
|
-
propKey,
|
|
12885
|
-
(property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0
|
|
12886
|
-
);
|
|
12909
|
+
return forEachPropertyAssignment(objectLiteral, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
|
|
12887
12910
|
}
|
|
12888
12911
|
function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
|
|
12889
12912
|
if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
|
|
@@ -15049,9 +15072,16 @@ function getSourceFilePathInNewDirWorker(fileName, newDirPath, currentDirectory,
|
|
|
15049
15072
|
return combinePaths(newDirPath, sourceFilePath);
|
|
15050
15073
|
}
|
|
15051
15074
|
function writeFile(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
|
|
15052
|
-
host.writeFile(
|
|
15053
|
-
|
|
15054
|
-
|
|
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
|
+
);
|
|
15055
15085
|
}
|
|
15056
15086
|
function ensureDirectoriesExist(directoryPath, createDirectory, directoryExists) {
|
|
15057
15087
|
if (directoryPath.length > getRootLength(directoryPath) && !directoryExists(directoryPath)) {
|
|
@@ -15921,21 +15951,17 @@ function isUMDExportSymbol(symbol) {
|
|
|
15921
15951
|
}
|
|
15922
15952
|
function getLastChild(node) {
|
|
15923
15953
|
let lastChild;
|
|
15924
|
-
forEachChild(
|
|
15925
|
-
|
|
15926
|
-
|
|
15927
|
-
|
|
15928
|
-
|
|
15929
|
-
|
|
15930
|
-
|
|
15931
|
-
|
|
15932
|
-
if (nodeIsPresent(children[i])) {
|
|
15933
|
-
lastChild = children[i];
|
|
15934
|
-
break;
|
|
15935
|
-
}
|
|
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;
|
|
15936
15962
|
}
|
|
15937
15963
|
}
|
|
15938
|
-
);
|
|
15964
|
+
});
|
|
15939
15965
|
return lastChild;
|
|
15940
15966
|
}
|
|
15941
15967
|
function isTypeNodeKind(kind) {
|
|
@@ -25068,21 +25094,18 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
|
|
|
25068
25094
|
if (some(helperNames)) {
|
|
25069
25095
|
helperNames.sort(compareStringsCaseSensitive);
|
|
25070
25096
|
namedBindings = nodeFactory.createNamedImports(
|
|
25071
|
-
map(
|
|
25072
|
-
|
|
25073
|
-
|
|
25074
|
-
|
|
25075
|
-
|
|
25076
|
-
|
|
25077
|
-
|
|
25078
|
-
|
|
25079
|
-
|
|
25080
|
-
|
|
25081
|
-
|
|
25082
|
-
|
|
25083
|
-
helperFactory.getUnscopedHelperName(name)
|
|
25084
|
-
)
|
|
25085
|
-
)
|
|
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
|
+
))
|
|
25086
25109
|
);
|
|
25087
25110
|
const parseNode = getOriginalNode(sourceFile, isSourceFile);
|
|
25088
25111
|
const emitNode = getOrCreateEmitNode(parseNode);
|
|
@@ -26499,9 +26522,9 @@ var Parser;
|
|
|
26499
26522
|
/*allowReservedWords*/
|
|
26500
26523
|
true
|
|
26501
26524
|
);
|
|
26502
|
-
const
|
|
26525
|
+
const isValid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length;
|
|
26503
26526
|
clearState();
|
|
26504
|
-
return
|
|
26527
|
+
return isValid ? entityName : void 0;
|
|
26505
26528
|
}
|
|
26506
26529
|
Parser2.parseIsolatedEntityName = parseIsolatedEntityName2;
|
|
26507
26530
|
function parseJsonText2(fileName2, sourceText2, languageVersion2 = 2 /* ES2015 */, syntaxCursor2, setParentNodes = false) {
|
|
@@ -33125,16 +33148,7 @@ var IncrementalParser;
|
|
|
33125
33148
|
Debug.assert(textSpanEnd(changeRange.span) === textSpanEnd(textChangeRange.span));
|
|
33126
33149
|
Debug.assert(textSpanEnd(textChangeRangeNewSpan(changeRange)) === textSpanEnd(textChangeRangeNewSpan(textChangeRange)));
|
|
33127
33150
|
const delta = textChangeRangeNewSpan(changeRange).length - changeRange.span.length;
|
|
33128
|
-
updateTokenPositionsAndMarkElements(
|
|
33129
|
-
incrementalSourceFile,
|
|
33130
|
-
changeRange.span.start,
|
|
33131
|
-
textSpanEnd(changeRange.span),
|
|
33132
|
-
textSpanEnd(textChangeRangeNewSpan(changeRange)),
|
|
33133
|
-
delta,
|
|
33134
|
-
oldText,
|
|
33135
|
-
newText,
|
|
33136
|
-
aggressiveChecks
|
|
33137
|
-
);
|
|
33151
|
+
updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, textSpanEnd(changeRange.span), textSpanEnd(textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks);
|
|
33138
33152
|
const result = Parser.parseSourceFile(
|
|
33139
33153
|
sourceFile.fileName,
|
|
33140
33154
|
newText,
|
|
@@ -36288,14 +36302,17 @@ function getExtendsConfigPathOrArray(value, host, basePath, configFileName, erro
|
|
|
36288
36302
|
for (let index = 0; index < value.length; index++) {
|
|
36289
36303
|
const fileName = value[index];
|
|
36290
36304
|
if (isString(fileName)) {
|
|
36291
|
-
extendedConfigPath = append(
|
|
36292
|
-
|
|
36293
|
-
|
|
36294
|
-
|
|
36295
|
-
|
|
36296
|
-
|
|
36297
|
-
|
|
36298
|
-
|
|
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
|
+
);
|
|
36299
36316
|
} else {
|
|
36300
36317
|
convertJsonOption(extendsOptionDeclaration.element, value, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile);
|
|
36301
36318
|
}
|
|
@@ -37140,12 +37157,7 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
37140
37157
|
}
|
|
37141
37158
|
}
|
|
37142
37159
|
return resolvedTypeScriptOnly(
|
|
37143
|
-
loadNodeModuleFromDirectory(
|
|
37144
|
-
4 /* Declaration */,
|
|
37145
|
-
candidate,
|
|
37146
|
-
!directoryExists,
|
|
37147
|
-
moduleResolutionState
|
|
37148
|
-
)
|
|
37160
|
+
loadNodeModuleFromDirectory(4 /* Declaration */, candidate, !directoryExists, moduleResolutionState)
|
|
37149
37161
|
);
|
|
37150
37162
|
});
|
|
37151
37163
|
} else {
|
|
@@ -38621,13 +38633,15 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38621
38633
|
false,
|
|
38622
38634
|
redirectedReference
|
|
38623
38635
|
);
|
|
38624
|
-
return toSearchResult(
|
|
38625
|
-
|
|
38626
|
-
|
|
38627
|
-
|
|
38628
|
-
|
|
38629
|
-
|
|
38630
|
-
|
|
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
|
+
);
|
|
38631
38645
|
}
|
|
38632
38646
|
if (state.traceEnabled) {
|
|
38633
38647
|
trace(state.host, Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
@@ -38660,13 +38674,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38660
38674
|
);
|
|
38661
38675
|
}
|
|
38662
38676
|
if (state.traceEnabled) {
|
|
38663
|
-
trace(
|
|
38664
|
-
state.host,
|
|
38665
|
-
Diagnostics.Using_0_subpath_1_with_target_2,
|
|
38666
|
-
isImports ? "imports" : "exports",
|
|
38667
|
-
key,
|
|
38668
|
-
pattern ? target.replace(/\*/g, subpath) : target + subpath
|
|
38669
|
-
);
|
|
38677
|
+
trace(state.host, Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath);
|
|
38670
38678
|
}
|
|
38671
38679
|
const finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
|
|
38672
38680
|
const inputLink = tryLoadInputFileForPath(finalPath, subpath, combinePaths(scope.packageDirectory, "package.json"), isImports);
|
|
@@ -40889,31 +40897,15 @@ function createBinder() {
|
|
|
40889
40897
|
return;
|
|
40890
40898
|
}
|
|
40891
40899
|
if (inStrictMode && originalKeywordKind >= 119 /* FirstFutureReservedWord */ && originalKeywordKind <= 127 /* LastFutureReservedWord */) {
|
|
40892
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(
|
|
40893
|
-
node,
|
|
40894
|
-
getStrictModeIdentifierMessage(node),
|
|
40895
|
-
declarationNameToString(node)
|
|
40896
|
-
));
|
|
40900
|
+
file.bindDiagnostics.push(createDiagnosticForNode2(node, getStrictModeIdentifierMessage(node), declarationNameToString(node)));
|
|
40897
40901
|
} else if (originalKeywordKind === 135 /* AwaitKeyword */) {
|
|
40898
40902
|
if (isExternalModule(file) && isInTopLevelContext(node)) {
|
|
40899
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(
|
|
40900
|
-
node,
|
|
40901
|
-
Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module,
|
|
40902
|
-
declarationNameToString(node)
|
|
40903
|
-
));
|
|
40903
|
+
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, declarationNameToString(node)));
|
|
40904
40904
|
} else if (node.flags & 65536 /* AwaitContext */) {
|
|
40905
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(
|
|
40906
|
-
node,
|
|
40907
|
-
Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here,
|
|
40908
|
-
declarationNameToString(node)
|
|
40909
|
-
));
|
|
40905
|
+
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
|
|
40910
40906
|
}
|
|
40911
40907
|
} else if (originalKeywordKind === 127 /* YieldKeyword */ && node.flags & 16384 /* YieldContext */) {
|
|
40912
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(
|
|
40913
|
-
node,
|
|
40914
|
-
Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here,
|
|
40915
|
-
declarationNameToString(node)
|
|
40916
|
-
));
|
|
40908
|
+
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
|
|
40917
40909
|
}
|
|
40918
40910
|
}
|
|
40919
40911
|
}
|
|
@@ -40929,11 +40921,7 @@ function createBinder() {
|
|
|
40929
40921
|
function checkPrivateIdentifier(node) {
|
|
40930
40922
|
if (node.escapedText === "#constructor") {
|
|
40931
40923
|
if (!file.parseDiagnostics.length) {
|
|
40932
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(
|
|
40933
|
-
node,
|
|
40934
|
-
Diagnostics.constructor_is_a_reserved_word,
|
|
40935
|
-
declarationNameToString(node)
|
|
40936
|
-
));
|
|
40924
|
+
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.constructor_is_a_reserved_word, declarationNameToString(node)));
|
|
40937
40925
|
}
|
|
40938
40926
|
}
|
|
40939
40927
|
}
|
|
@@ -40961,13 +40949,7 @@ function createBinder() {
|
|
|
40961
40949
|
const identifier = name;
|
|
40962
40950
|
if (isEvalOrArgumentsIdentifier(identifier)) {
|
|
40963
40951
|
const span = getErrorSpanForNode(file, name);
|
|
40964
|
-
file.bindDiagnostics.push(createFileDiagnostic(
|
|
40965
|
-
file,
|
|
40966
|
-
span.start,
|
|
40967
|
-
span.length,
|
|
40968
|
-
getStrictModeEvalOrArgumentsMessage(contextNode),
|
|
40969
|
-
idText(identifier)
|
|
40970
|
-
));
|
|
40952
|
+
file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, getStrictModeEvalOrArgumentsMessage(contextNode), idText(identifier)));
|
|
40971
40953
|
}
|
|
40972
40954
|
}
|
|
40973
40955
|
}
|
|
@@ -40998,12 +40980,7 @@ function createBinder() {
|
|
|
40998
40980
|
if (languageVersion < 2 /* ES2015 */) {
|
|
40999
40981
|
if (blockScopeContainer.kind !== 312 /* SourceFile */ && blockScopeContainer.kind !== 267 /* ModuleDeclaration */ && !isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) {
|
|
41000
40982
|
const errorSpan = getErrorSpanForNode(file, node);
|
|
41001
|
-
file.bindDiagnostics.push(createFileDiagnostic(
|
|
41002
|
-
file,
|
|
41003
|
-
errorSpan.start,
|
|
41004
|
-
errorSpan.length,
|
|
41005
|
-
getStrictModeBlockScopeFunctionDeclarationMessage(node)
|
|
41006
|
-
));
|
|
40983
|
+
file.bindDiagnostics.push(createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node)));
|
|
41007
40984
|
}
|
|
41008
40985
|
}
|
|
41009
40986
|
}
|
|
@@ -41234,11 +41211,7 @@ function createBinder() {
|
|
|
41234
41211
|
return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */);
|
|
41235
41212
|
case 174 /* MethodDeclaration */:
|
|
41236
41213
|
case 173 /* MethodSignature */:
|
|
41237
|
-
return bindPropertyOrMethodOrAccessor(
|
|
41238
|
-
node,
|
|
41239
|
-
8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */),
|
|
41240
|
-
isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 103359 /* MethodExcludes */
|
|
41241
|
-
);
|
|
41214
|
+
return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 103359 /* MethodExcludes */);
|
|
41242
41215
|
case 262 /* FunctionDeclaration */:
|
|
41243
41216
|
return bindFunctionDeclaration(node);
|
|
41244
41217
|
case 176 /* Constructor */:
|
|
@@ -42575,32 +42548,29 @@ function tryGetModuleNameFromAmbientModule(moduleSymbol, checker) {
|
|
|
42575
42548
|
if (decl) {
|
|
42576
42549
|
return decl.name.text;
|
|
42577
42550
|
}
|
|
42578
|
-
const ambientModuleDeclareCandidates = mapDefined(
|
|
42579
|
-
|
|
42580
|
-
(d)
|
|
42581
|
-
|
|
42582
|
-
|
|
42583
|
-
|
|
42584
|
-
|
|
42585
|
-
|
|
42586
|
-
|
|
42587
|
-
|
|
42588
|
-
|
|
42589
|
-
|
|
42590
|
-
|
|
42591
|
-
|
|
42592
|
-
|
|
42593
|
-
|
|
42594
|
-
|
|
42595
|
-
|
|
42596
|
-
|
|
42597
|
-
while (namespaceDeclaration.flags & 8 /* NestedNamespace */) {
|
|
42598
|
-
namespaceDeclaration = namespaceDeclaration.parent;
|
|
42599
|
-
}
|
|
42600
|
-
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;
|
|
42601
42570
|
}
|
|
42571
|
+
return namespaceDeclaration;
|
|
42602
42572
|
}
|
|
42603
|
-
);
|
|
42573
|
+
});
|
|
42604
42574
|
const ambientModuleDeclare = ambientModuleDeclareCandidates[0];
|
|
42605
42575
|
if (ambientModuleDeclare) {
|
|
42606
42576
|
return ambientModuleDeclare.name.text;
|
|
@@ -45288,10 +45258,7 @@ function createTypeChecker(host) {
|
|
|
45288
45258
|
diagnosticMessage = error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName);
|
|
45289
45259
|
}
|
|
45290
45260
|
if (diagnosticMessage) {
|
|
45291
|
-
addRelatedInfo(
|
|
45292
|
-
diagnosticMessage,
|
|
45293
|
-
createDiagnosticForNode(declaration, Diagnostics._0_is_declared_here, declarationName)
|
|
45294
|
-
);
|
|
45261
|
+
addRelatedInfo(diagnosticMessage, createDiagnosticForNode(declaration, Diagnostics._0_is_declared_here, declarationName));
|
|
45295
45262
|
}
|
|
45296
45263
|
}
|
|
45297
45264
|
}
|
|
@@ -45467,11 +45434,14 @@ function createTypeChecker(host) {
|
|
|
45467
45434
|
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
45468
45435
|
const err = error(node.name, Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
|
|
45469
45436
|
if (exportAssignment) {
|
|
45470
|
-
addRelatedInfo(
|
|
45471
|
-
|
|
45472
|
-
|
|
45473
|
-
|
|
45474
|
-
|
|
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
|
+
);
|
|
45475
45445
|
}
|
|
45476
45446
|
} else if (isImportClause(node)) {
|
|
45477
45447
|
reportNonDefaultExport(moduleSymbol, node);
|
|
@@ -45528,10 +45498,12 @@ function createTypeChecker(host) {
|
|
|
45528
45498
|
const diagnostic = error(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
|
|
45529
45499
|
const exportStar = (_b = moduleSymbol.exports) == null ? void 0 : _b.get("__export" /* ExportStar */);
|
|
45530
45500
|
if (exportStar) {
|
|
45531
|
-
const defaultExport = (_c = exportStar.declarations) == null ? void 0 : _c.find(
|
|
45532
|
-
|
|
45533
|
-
|
|
45534
|
-
|
|
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
|
+
);
|
|
45535
45507
|
if (defaultExport) {
|
|
45536
45508
|
addRelatedInfo(diagnostic, createDiagnosticForNode(defaultExport, Diagnostics.export_Asterisk_does_not_re_export_a_default));
|
|
45537
45509
|
}
|
|
@@ -45678,10 +45650,7 @@ function createTypeChecker(host) {
|
|
|
45678
45650
|
const suggestionName = symbolToString(suggestion);
|
|
45679
45651
|
const diagnostic = error(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
|
45680
45652
|
if (suggestion.valueDeclaration) {
|
|
45681
|
-
addRelatedInfo(
|
|
45682
|
-
diagnostic,
|
|
45683
|
-
createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName)
|
|
45684
|
-
);
|
|
45653
|
+
addRelatedInfo(diagnostic, createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName));
|
|
45685
45654
|
}
|
|
45686
45655
|
} else {
|
|
45687
45656
|
if ((_a = moduleSymbol.exports) == null ? void 0 : _a.has("default" /* Default */)) {
|
|
@@ -45708,10 +45677,7 @@ function createTypeChecker(host) {
|
|
|
45708
45677
|
const exportedSymbol = exports ? find(symbolsToArray(exports), (symbol) => !!getSymbolIfSameReference(symbol, localSymbol)) : void 0;
|
|
45709
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);
|
|
45710
45679
|
if (localSymbol.declarations) {
|
|
45711
|
-
addRelatedInfo(
|
|
45712
|
-
diagnostic,
|
|
45713
|
-
...map(localSymbol.declarations, (decl, index) => createDiagnosticForNode(decl, index === 0 ? Diagnostics._0_is_declared_here : Diagnostics.and_here, declarationName))
|
|
45714
|
-
);
|
|
45680
|
+
addRelatedInfo(diagnostic, ...map(localSymbol.declarations, (decl, index) => createDiagnosticForNode(decl, index === 0 ? Diagnostics._0_is_declared_here : Diagnostics.and_here, declarationName)));
|
|
45715
45681
|
}
|
|
45716
45682
|
}
|
|
45717
45683
|
} else {
|
|
@@ -46376,11 +46342,15 @@ function createTypeChecker(host) {
|
|
|
46376
46342
|
}
|
|
46377
46343
|
}
|
|
46378
46344
|
}
|
|
46379
|
-
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
46380
|
-
|
|
46381
|
-
|
|
46382
|
-
|
|
46383
|
-
|
|
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
|
+
));
|
|
46384
46354
|
}
|
|
46385
46355
|
}
|
|
46386
46356
|
}
|
|
@@ -46437,13 +46407,9 @@ function createTypeChecker(host) {
|
|
|
46437
46407
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
46438
46408
|
const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
|
|
46439
46409
|
if (suggestedExt) {
|
|
46440
|
-
error(
|
|
46441
|
-
errorNode,
|
|
46442
|
-
Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0,
|
|
46443
|
-
moduleReference + suggestedExt
|
|
46444
|
-
);
|
|
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);
|
|
46445
46411
|
} else {
|
|
46446
|
-
error(errorNode, Diagnostics.
|
|
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);
|
|
46447
46413
|
}
|
|
46448
46414
|
} else {
|
|
46449
46415
|
error(errorNode, moduleNotFoundError, moduleReference);
|
|
@@ -46466,12 +46432,16 @@ function createTypeChecker(host) {
|
|
|
46466
46432
|
if (!isExternalModuleNameRelative(moduleReference) && packageId) {
|
|
46467
46433
|
errorInfo = createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageId.name);
|
|
46468
46434
|
}
|
|
46469
|
-
errorOrSuggestion(
|
|
46470
|
-
|
|
46471
|
-
|
|
46472
|
-
|
|
46473
|
-
|
|
46474
|
-
|
|
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
|
+
);
|
|
46475
46445
|
}
|
|
46476
46446
|
function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) {
|
|
46477
46447
|
if (moduleSymbol == null ? void 0 : moduleSymbol.exports) {
|
|
@@ -46708,10 +46678,12 @@ function createTypeChecker(host) {
|
|
|
46708
46678
|
}
|
|
46709
46679
|
if (exportStar == null ? void 0 : exportStar.isTypeOnly) {
|
|
46710
46680
|
typeOnlyExportStarMap ?? (typeOnlyExportStarMap = /* @__PURE__ */ new Map());
|
|
46711
|
-
symbols.forEach(
|
|
46712
|
-
escapedName
|
|
46713
|
-
|
|
46714
|
-
|
|
46681
|
+
symbols.forEach(
|
|
46682
|
+
(_, escapedName) => typeOnlyExportStarMap.set(
|
|
46683
|
+
escapedName,
|
|
46684
|
+
exportStar
|
|
46685
|
+
)
|
|
46686
|
+
);
|
|
46715
46687
|
}
|
|
46716
46688
|
return symbols;
|
|
46717
46689
|
}
|
|
@@ -46947,13 +46919,7 @@ function createTypeChecker(host) {
|
|
|
46947
46919
|
return resolved;
|
|
46948
46920
|
}
|
|
46949
46921
|
function createAnonymousType(symbol, members, callSignatures, constructSignatures, indexInfos) {
|
|
46950
|
-
return setStructuredTypeMembers(
|
|
46951
|
-
createObjectType(16 /* Anonymous */, symbol),
|
|
46952
|
-
members,
|
|
46953
|
-
callSignatures,
|
|
46954
|
-
constructSignatures,
|
|
46955
|
-
indexInfos
|
|
46956
|
-
);
|
|
46922
|
+
return setStructuredTypeMembers(createObjectType(16 /* Anonymous */, symbol), members, callSignatures, constructSignatures, indexInfos);
|
|
46957
46923
|
}
|
|
46958
46924
|
function getResolvedTypeWithoutAbstractConstructSignatures(type) {
|
|
46959
46925
|
if (type.constructSignatures.length === 0)
|
|
@@ -48183,11 +48149,7 @@ function createTypeChecker(host) {
|
|
|
48183
48149
|
}
|
|
48184
48150
|
} else {
|
|
48185
48151
|
if (typeArguments !== getIdentifierTypeArguments(qualifier.right)) {
|
|
48186
|
-
qualifier = factory.updateQualifiedName(
|
|
48187
|
-
qualifier,
|
|
48188
|
-
qualifier.left,
|
|
48189
|
-
setIdentifierTypeArguments(factory.cloneNode(qualifier.right), typeArguments)
|
|
48190
|
-
);
|
|
48152
|
+
qualifier = factory.updateQualifiedName(qualifier, qualifier.left, setIdentifierTypeArguments(factory.cloneNode(qualifier.right), typeArguments));
|
|
48191
48153
|
}
|
|
48192
48154
|
}
|
|
48193
48155
|
}
|
|
@@ -48213,11 +48175,7 @@ function createTypeChecker(host) {
|
|
|
48213
48175
|
}
|
|
48214
48176
|
} else {
|
|
48215
48177
|
if (typeArguments !== getIdentifierTypeArguments(typeName.right)) {
|
|
48216
|
-
typeName = factory.updateQualifiedName(
|
|
48217
|
-
typeName,
|
|
48218
|
-
typeName.left,
|
|
48219
|
-
setIdentifierTypeArguments(factory.cloneNode(typeName.right), typeArguments)
|
|
48220
|
-
);
|
|
48178
|
+
typeName = factory.updateQualifiedName(typeName, typeName.left, setIdentifierTypeArguments(factory.cloneNode(typeName.right), typeArguments));
|
|
48221
48179
|
}
|
|
48222
48180
|
}
|
|
48223
48181
|
typeArguments = ref.typeArguments;
|
|
@@ -48774,7 +48732,9 @@ function createTypeChecker(host) {
|
|
|
48774
48732
|
if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], context.enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning2 : getQualifiedLeftMeaning(meaning2))) {
|
|
48775
48733
|
const parents = getContainersOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol2, context.enclosingDeclaration, meaning2);
|
|
48776
48734
|
if (length(parents)) {
|
|
48777
|
-
parentSpecifiers = parents.map(
|
|
48735
|
+
parentSpecifiers = parents.map(
|
|
48736
|
+
(symbol3) => some(symbol3.declarations, hasNonGlobalAugmentationExternalModuleSymbol) ? getSpecifierForModuleSymbol(symbol3, context) : void 0
|
|
48737
|
+
);
|
|
48778
48738
|
const indices = parents.map((_, i) => i);
|
|
48779
48739
|
indices.sort(sortByBestName);
|
|
48780
48740
|
const sortedParents = indices.map((i) => parents[i]);
|
|
@@ -49555,7 +49515,11 @@ function createTypeChecker(host) {
|
|
|
49555
49515
|
if (accessibleResult.accessibility === 0 /* Accessible */) {
|
|
49556
49516
|
const chain = lookupSymbolChainWorker(sym, context, meaning);
|
|
49557
49517
|
if (!(sym.flags & 4 /* Property */)) {
|
|
49558
|
-
|
|
49518
|
+
const root = chain[0];
|
|
49519
|
+
const contextFile = getSourceFileOfNode(oldcontext.enclosingDeclaration);
|
|
49520
|
+
if (some(root.declarations, (d) => getSourceFileOfNode(d) === contextFile)) {
|
|
49521
|
+
includePrivateSymbol(root);
|
|
49522
|
+
}
|
|
49559
49523
|
}
|
|
49560
49524
|
} else if ((_a = oldcontext.tracker.inner) == null ? void 0 : _a.trackSymbol) {
|
|
49561
49525
|
return oldcontext.tracker.inner.trackSymbol(sym, decl, meaning);
|
|
@@ -49600,21 +49564,24 @@ function createTypeChecker(host) {
|
|
|
49600
49564
|
ns.name,
|
|
49601
49565
|
body = factory.updateModuleBlock(
|
|
49602
49566
|
body,
|
|
49603
|
-
factory.createNodeArray([
|
|
49604
|
-
|
|
49605
|
-
|
|
49606
|
-
|
|
49607
|
-
|
|
49608
|
-
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,
|
|
49609
49572
|
/*isTypeOnly*/
|
|
49610
49573
|
false,
|
|
49611
|
-
|
|
49612
|
-
|
|
49613
|
-
|
|
49614
|
-
|
|
49615
|
-
|
|
49616
|
-
|
|
49617
|
-
|
|
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
|
+
])
|
|
49618
49585
|
)
|
|
49619
49586
|
);
|
|
49620
49587
|
statements = [...statements.slice(0, nsIndex), ns, ...statements.slice(nsIndex + 1)];
|
|
@@ -49634,15 +49601,18 @@ function createTypeChecker(host) {
|
|
|
49634
49601
|
const exports = filter(statements, (d) => isExportDeclaration(d) && !d.moduleSpecifier && !!d.exportClause && isNamedExports(d.exportClause));
|
|
49635
49602
|
if (length(exports) > 1) {
|
|
49636
49603
|
const nonExports = filter(statements, (d) => !isExportDeclaration(d) || !!d.moduleSpecifier || !d.exportClause);
|
|
49637
|
-
statements = [
|
|
49638
|
-
|
|
49639
|
-
|
|
49640
|
-
|
|
49641
|
-
|
|
49642
|
-
|
|
49643
|
-
|
|
49644
|
-
|
|
49645
|
-
|
|
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
|
+
];
|
|
49646
49616
|
}
|
|
49647
49617
|
const reexports = filter(statements, (d) => isExportDeclaration(d) && !!d.moduleSpecifier && !!d.exportClause && isNamedExports(d.exportClause));
|
|
49648
49618
|
if (length(reexports) > 1) {
|
|
@@ -49821,18 +49791,21 @@ function createTypeChecker(host) {
|
|
|
49821
49791
|
);
|
|
49822
49792
|
context.tracker.trackSymbol(type.symbol, context.enclosingDeclaration, 111551 /* Value */);
|
|
49823
49793
|
} else {
|
|
49824
|
-
const statement = setTextRange(
|
|
49825
|
-
|
|
49826
|
-
|
|
49827
|
-
|
|
49828
|
-
factory.
|
|
49829
|
-
|
|
49830
|
-
|
|
49831
|
-
|
|
49832
|
-
|
|
49833
|
-
|
|
49834
|
-
|
|
49835
|
-
|
|
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
|
+
);
|
|
49836
49809
|
addResult(statement, name !== localName ? modifierFlags & ~1 /* Export */ : modifierFlags);
|
|
49837
49810
|
if (name !== localName && !isPrivate) {
|
|
49838
49811
|
addResult(
|
|
@@ -49906,18 +49879,21 @@ function createTypeChecker(host) {
|
|
|
49906
49879
|
factory.createIdentifier(getInternalSymbolName(symbol, symbolName2))
|
|
49907
49880
|
), 0 /* None */);
|
|
49908
49881
|
} else if (needsExportDeclaration) {
|
|
49909
|
-
addResult(
|
|
49910
|
-
|
|
49911
|
-
|
|
49912
|
-
|
|
49913
|
-
false,
|
|
49914
|
-
factory.createNamedExports([factory.createExportSpecifier(
|
|
49882
|
+
addResult(
|
|
49883
|
+
factory.createExportDeclaration(
|
|
49884
|
+
/*modifiers*/
|
|
49885
|
+
void 0,
|
|
49915
49886
|
/*isTypeOnly*/
|
|
49916
49887
|
false,
|
|
49917
|
-
|
|
49918
|
-
|
|
49919
|
-
|
|
49920
|
-
|
|
49888
|
+
factory.createNamedExports([factory.createExportSpecifier(
|
|
49889
|
+
/*isTypeOnly*/
|
|
49890
|
+
false,
|
|
49891
|
+
getInternalSymbolName(symbol, symbolName2),
|
|
49892
|
+
symbolName2
|
|
49893
|
+
)])
|
|
49894
|
+
),
|
|
49895
|
+
0 /* None */
|
|
49896
|
+
);
|
|
49921
49897
|
}
|
|
49922
49898
|
}
|
|
49923
49899
|
function includePrivateSymbol(symbol) {
|
|
@@ -49925,10 +49901,7 @@ function createTypeChecker(host) {
|
|
|
49925
49901
|
return;
|
|
49926
49902
|
Debug.assertIsDefined(deferredPrivatesStack[deferredPrivatesStack.length - 1]);
|
|
49927
49903
|
getUnusedName(unescapeLeadingUnderscores(symbol.escapedName), symbol);
|
|
49928
|
-
const isExternalImportAlias = !!(symbol.flags & 2097152 /* Alias */) && !some(
|
|
49929
|
-
symbol.declarations,
|
|
49930
|
-
(d) => !!findAncestor(d, isExportDeclaration) || isNamespaceExport(d) || isImportEqualsDeclaration(d) && !isExternalModuleReference(d.moduleReference)
|
|
49931
|
-
);
|
|
49904
|
+
const isExternalImportAlias = !!(symbol.flags & 2097152 /* Alias */) && !some(symbol.declarations, (d) => !!findAncestor(d, isExportDeclaration) || isNamespaceExport(d) || isImportEqualsDeclaration(d) && !isExternalModuleReference(d.moduleReference));
|
|
49932
49905
|
deferredPrivatesStack[isExternalImportAlias ? 0 : deferredPrivatesStack.length - 1].set(getSymbolId(symbol), symbol);
|
|
49933
49906
|
}
|
|
49934
49907
|
function isExportingScope(enclosingDeclaration2) {
|
|
@@ -49965,16 +49938,19 @@ function createTypeChecker(host) {
|
|
|
49965
49938
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
49966
49939
|
context.enclosingDeclaration = jsdocAliasDecl;
|
|
49967
49940
|
const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && serializeExistingTypeNode(context, jsdocAliasDecl.typeExpression.type, includePrivateSymbol, bundled) || typeToTypeNodeHelper(aliasType, context);
|
|
49968
|
-
addResult(
|
|
49969
|
-
|
|
49970
|
-
|
|
49971
|
-
|
|
49972
|
-
|
|
49973
|
-
|
|
49974
|
-
|
|
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 }]
|
|
49975
49951
|
),
|
|
49976
|
-
|
|
49977
|
-
)
|
|
49952
|
+
modifierFlags
|
|
49953
|
+
);
|
|
49978
49954
|
context.flags = oldFlags;
|
|
49979
49955
|
context.enclosingDeclaration = oldEnclosingDecl;
|
|
49980
49956
|
}
|
|
@@ -49989,14 +49965,17 @@ function createTypeChecker(host) {
|
|
|
49989
49965
|
const constructSignatures = serializeSignatures(1 /* Construct */, interfaceType, baseType, 180 /* ConstructSignature */);
|
|
49990
49966
|
const indexSignatures = serializeIndexSignatures(interfaceType, baseType);
|
|
49991
49967
|
const heritageClauses = !length(baseTypes) ? void 0 : [factory.createHeritageClause(96 /* ExtendsKeyword */, mapDefined(baseTypes, (b) => trySerializeAsTypeReference(b, 111551 /* Value */)))];
|
|
49992
|
-
addResult(
|
|
49993
|
-
|
|
49994
|
-
|
|
49995
|
-
|
|
49996
|
-
|
|
49997
|
-
|
|
49998
|
-
|
|
49999
|
-
|
|
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
|
+
);
|
|
50000
49979
|
}
|
|
50001
49980
|
function getNamespaceMembersForSerialization(symbol) {
|
|
50002
49981
|
const exports = getExportsOfSymbol(symbol);
|
|
@@ -50046,24 +50025,33 @@ function createTypeChecker(host) {
|
|
|
50046
50025
|
);
|
|
50047
50026
|
}))
|
|
50048
50027
|
)]);
|
|
50049
|
-
addResult(
|
|
50050
|
-
|
|
50051
|
-
|
|
50052
|
-
|
|
50053
|
-
|
|
50054
|
-
|
|
50055
|
-
|
|
50028
|
+
addResult(
|
|
50029
|
+
factory.createModuleDeclaration(
|
|
50030
|
+
/*modifiers*/
|
|
50031
|
+
void 0,
|
|
50032
|
+
factory.createIdentifier(localName),
|
|
50033
|
+
nsBody,
|
|
50034
|
+
32 /* Namespace */
|
|
50035
|
+
),
|
|
50036
|
+
0 /* None */
|
|
50037
|
+
);
|
|
50056
50038
|
}
|
|
50057
50039
|
}
|
|
50058
50040
|
function serializeEnum(symbol, symbolName2, modifierFlags) {
|
|
50059
|
-
addResult(
|
|
50060
|
-
factory.
|
|
50061
|
-
|
|
50062
|
-
|
|
50063
|
-
|
|
50064
|
-
|
|
50065
|
-
|
|
50066
|
-
|
|
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
|
+
);
|
|
50067
50055
|
}
|
|
50068
50056
|
function serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags) {
|
|
50069
50057
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
|
@@ -50095,13 +50083,7 @@ function createTypeChecker(host) {
|
|
|
50095
50083
|
}
|
|
50096
50084
|
function serializeAsNamespaceDeclaration(props, localName, modifierFlags, suppressNewPrivateContext) {
|
|
50097
50085
|
if (length(props)) {
|
|
50098
|
-
const localVsRemoteMap = arrayToMultiMap(
|
|
50099
|
-
props,
|
|
50100
|
-
(p) => !length(p.declarations) || some(
|
|
50101
|
-
p.declarations,
|
|
50102
|
-
(d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)
|
|
50103
|
-
) ? "local" : "remote"
|
|
50104
|
-
);
|
|
50086
|
+
const localVsRemoteMap = arrayToMultiMap(props, (p) => !length(p.declarations) || some(p.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)) ? "local" : "remote");
|
|
50105
50087
|
const localProps = localVsRemoteMap.get("local") || emptyArray;
|
|
50106
50088
|
let fakespace = parseNodeFactory.createModuleDeclaration(
|
|
50107
50089
|
/*modifiers*/
|
|
@@ -50178,10 +50160,7 @@ function createTypeChecker(host) {
|
|
|
50178
50160
|
}
|
|
50179
50161
|
return cleanup(factory.createExpressionWithTypeArguments(
|
|
50180
50162
|
expr,
|
|
50181
|
-
map(
|
|
50182
|
-
e.typeArguments,
|
|
50183
|
-
(a) => serializeExistingTypeNode(context, a, includePrivateSymbol, bundled) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context)
|
|
50184
|
-
)
|
|
50163
|
+
map(e.typeArguments, (a) => serializeExistingTypeNode(context, a, includePrivateSymbol, bundled) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
|
|
50185
50164
|
));
|
|
50186
50165
|
function cleanup(result2) {
|
|
50187
50166
|
context.enclosingDeclaration = oldEnclosing;
|
|
@@ -50255,14 +50234,20 @@ function createTypeChecker(host) {
|
|
|
50255
50234
|
)] : serializeSignatures(1 /* Construct */, staticType, staticBaseType, 176 /* Constructor */);
|
|
50256
50235
|
const indexSignatures = serializeIndexSignatures(classType, baseTypes[0]);
|
|
50257
50236
|
context.enclosingDeclaration = oldEnclosing;
|
|
50258
|
-
addResult(
|
|
50259
|
-
|
|
50260
|
-
|
|
50261
|
-
|
|
50262
|
-
|
|
50263
|
-
|
|
50264
|
-
|
|
50265
|
-
|
|
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
|
+
);
|
|
50266
50251
|
}
|
|
50267
50252
|
function getSomeTargetNameFromDeclarations(declarations) {
|
|
50268
50253
|
return firstDefined(declarations, (d) => {
|
|
@@ -50308,25 +50293,28 @@ function createTypeChecker(host) {
|
|
|
50308
50293
|
if (((_b = (_a = node.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.kind) === 260 /* VariableDeclaration */) {
|
|
50309
50294
|
const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
50310
50295
|
const { propertyName } = node;
|
|
50311
|
-
addResult(
|
|
50312
|
-
|
|
50313
|
-
|
|
50314
|
-
factory.createImportClause(
|
|
50315
|
-
/*isTypeOnly*/
|
|
50316
|
-
false,
|
|
50317
|
-
/*name*/
|
|
50296
|
+
addResult(
|
|
50297
|
+
factory.createImportDeclaration(
|
|
50298
|
+
/*modifiers*/
|
|
50318
50299
|
void 0,
|
|
50319
|
-
factory.
|
|
50300
|
+
factory.createImportClause(
|
|
50320
50301
|
/*isTypeOnly*/
|
|
50321
50302
|
false,
|
|
50322
|
-
|
|
50323
|
-
|
|
50324
|
-
|
|
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
|
|
50325
50315
|
),
|
|
50326
|
-
|
|
50327
|
-
|
|
50328
|
-
void 0
|
|
50329
|
-
), 0 /* None */);
|
|
50316
|
+
0 /* None */
|
|
50317
|
+
);
|
|
50330
50318
|
break;
|
|
50331
50319
|
}
|
|
50332
50320
|
Debug.failBadSyntaxKind(((_c = node.parent) == null ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization");
|
|
@@ -50344,22 +50332,28 @@ function createTypeChecker(host) {
|
|
|
50344
50332
|
const initializer = node.initializer;
|
|
50345
50333
|
const uniqueName = factory.createUniqueName(localName);
|
|
50346
50334
|
const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
50347
|
-
addResult(
|
|
50348
|
-
|
|
50349
|
-
|
|
50350
|
-
|
|
50351
|
-
|
|
50352
|
-
|
|
50353
|
-
|
|
50354
|
-
|
|
50355
|
-
|
|
50356
|
-
/*
|
|
50357
|
-
|
|
50358
|
-
|
|
50359
|
-
|
|
50360
|
-
|
|
50361
|
-
|
|
50362
|
-
|
|
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
|
+
);
|
|
50363
50357
|
break;
|
|
50364
50358
|
}
|
|
50365
50359
|
case 271 /* ImportEqualsDeclaration */:
|
|
@@ -50368,20 +50362,23 @@ function createTypeChecker(host) {
|
|
|
50368
50362
|
break;
|
|
50369
50363
|
}
|
|
50370
50364
|
const isLocalImport = !(target.flags & 512 /* ValueModule */) && !isVariableDeclaration(node);
|
|
50371
|
-
addResult(
|
|
50372
|
-
|
|
50373
|
-
|
|
50374
|
-
|
|
50375
|
-
|
|
50376
|
-
|
|
50377
|
-
|
|
50378
|
-
|
|
50379
|
-
|
|
50380
|
-
|
|
50381
|
-
|
|
50382
|
-
|
|
50383
|
-
|
|
50384
|
-
|
|
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
|
+
);
|
|
50385
50382
|
break;
|
|
50386
50383
|
case 270 /* NamespaceExportDeclaration */:
|
|
50387
50384
|
addResult(factory.createNamespaceExportDeclaration(idText(node.name)), 0 /* None */);
|
|
@@ -50389,72 +50386,84 @@ function createTypeChecker(host) {
|
|
|
50389
50386
|
case 273 /* ImportClause */: {
|
|
50390
50387
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
50391
50388
|
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
|
50392
|
-
addResult(
|
|
50393
|
-
|
|
50394
|
-
|
|
50395
|
-
|
|
50396
|
-
|
|
50397
|
-
|
|
50398
|
-
|
|
50399
|
-
|
|
50400
|
-
|
|
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
|
|
50401
50402
|
),
|
|
50402
|
-
|
|
50403
|
-
|
|
50404
|
-
), 0 /* None */);
|
|
50403
|
+
0 /* None */
|
|
50404
|
+
);
|
|
50405
50405
|
break;
|
|
50406
50406
|
}
|
|
50407
50407
|
case 274 /* NamespaceImport */: {
|
|
50408
50408
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
50409
50409
|
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
|
50410
|
-
addResult(
|
|
50411
|
-
|
|
50412
|
-
|
|
50413
|
-
factory.createImportClause(
|
|
50414
|
-
/*isTypeOnly*/
|
|
50415
|
-
false,
|
|
50416
|
-
/*name*/
|
|
50410
|
+
addResult(
|
|
50411
|
+
factory.createImportDeclaration(
|
|
50412
|
+
/*modifiers*/
|
|
50417
50413
|
void 0,
|
|
50418
|
-
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
|
|
50419
50423
|
),
|
|
50420
|
-
|
|
50421
|
-
|
|
50422
|
-
), 0 /* None */);
|
|
50424
|
+
0 /* None */
|
|
50425
|
+
);
|
|
50423
50426
|
break;
|
|
50424
50427
|
}
|
|
50425
50428
|
case 280 /* NamespaceExport */:
|
|
50426
|
-
addResult(
|
|
50427
|
-
|
|
50428
|
-
|
|
50429
|
-
|
|
50430
|
-
|
|
50431
|
-
|
|
50432
|
-
|
|
50433
|
-
|
|
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
|
+
);
|
|
50434
50440
|
break;
|
|
50435
50441
|
case 276 /* ImportSpecifier */: {
|
|
50436
50442
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
50437
50443
|
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
|
50438
|
-
addResult(
|
|
50439
|
-
|
|
50440
|
-
|
|
50441
|
-
factory.createImportClause(
|
|
50442
|
-
/*isTypeOnly*/
|
|
50443
|
-
false,
|
|
50444
|
-
/*name*/
|
|
50444
|
+
addResult(
|
|
50445
|
+
factory.createImportDeclaration(
|
|
50446
|
+
/*modifiers*/
|
|
50445
50447
|
void 0,
|
|
50446
|
-
factory.
|
|
50447
|
-
|
|
50448
|
-
|
|
50449
|
-
|
|
50450
|
-
|
|
50451
|
-
|
|
50452
|
-
|
|
50453
|
-
|
|
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
|
|
50454
50464
|
),
|
|
50455
|
-
|
|
50456
|
-
|
|
50457
|
-
), 0 /* None */);
|
|
50465
|
+
0 /* None */
|
|
50466
|
+
);
|
|
50458
50467
|
break;
|
|
50459
50468
|
}
|
|
50460
50469
|
case 281 /* ExportSpecifier */:
|
|
@@ -50482,19 +50491,22 @@ function createTypeChecker(host) {
|
|
|
50482
50491
|
}
|
|
50483
50492
|
}
|
|
50484
50493
|
function serializeExportSpecifier(localName, targetName, specifier) {
|
|
50485
|
-
addResult(
|
|
50486
|
-
|
|
50487
|
-
|
|
50488
|
-
|
|
50489
|
-
false,
|
|
50490
|
-
factory.createNamedExports([factory.createExportSpecifier(
|
|
50494
|
+
addResult(
|
|
50495
|
+
factory.createExportDeclaration(
|
|
50496
|
+
/*modifiers*/
|
|
50497
|
+
void 0,
|
|
50491
50498
|
/*isTypeOnly*/
|
|
50492
50499
|
false,
|
|
50493
|
-
|
|
50494
|
-
|
|
50495
|
-
|
|
50496
|
-
|
|
50497
|
-
|
|
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
|
+
);
|
|
50498
50510
|
}
|
|
50499
50511
|
function serializeMaybeAliasAssignment(symbol) {
|
|
50500
50512
|
var _a;
|
|
@@ -50542,20 +50554,23 @@ function createTypeChecker(host) {
|
|
|
50542
50554
|
serializeExportSpecifier(name, getInternalSymbolName(target, symbolName(target)));
|
|
50543
50555
|
} else {
|
|
50544
50556
|
const varName = getUnusedName(name, symbol);
|
|
50545
|
-
addResult(
|
|
50546
|
-
|
|
50547
|
-
|
|
50548
|
-
|
|
50549
|
-
|
|
50550
|
-
|
|
50551
|
-
|
|
50552
|
-
|
|
50553
|
-
|
|
50554
|
-
|
|
50555
|
-
|
|
50556
|
-
|
|
50557
|
-
|
|
50558
|
-
|
|
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
|
+
);
|
|
50559
50574
|
serializeExportSpecifier(name, varName);
|
|
50560
50575
|
}
|
|
50561
50576
|
}
|
|
@@ -50622,60 +50637,72 @@ function createTypeChecker(host) {
|
|
|
50622
50637
|
if (p.flags & 98304 /* Accessor */ && useAccessors) {
|
|
50623
50638
|
const result = [];
|
|
50624
50639
|
if (p.flags & 65536 /* SetAccessor */) {
|
|
50625
|
-
result.push(setTextRange(
|
|
50626
|
-
factory.
|
|
50627
|
-
|
|
50628
|
-
|
|
50629
|
-
|
|
50630
|
-
|
|
50631
|
-
|
|
50632
|
-
|
|
50633
|
-
|
|
50634
|
-
|
|
50635
|
-
|
|
50636
|
-
|
|
50637
|
-
|
|
50638
|
-
|
|
50639
|
-
|
|
50640
|
-
|
|
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
|
+
));
|
|
50641
50659
|
}
|
|
50642
50660
|
if (p.flags & 32768 /* GetAccessor */) {
|
|
50643
50661
|
const isPrivate2 = modifierFlags & 8 /* Private */;
|
|
50644
|
-
result.push(setTextRange(
|
|
50645
|
-
factory.
|
|
50646
|
-
|
|
50647
|
-
|
|
50648
|
-
|
|
50649
|
-
|
|
50650
|
-
|
|
50651
|
-
|
|
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
|
+
));
|
|
50652
50673
|
}
|
|
50653
50674
|
return result;
|
|
50654
50675
|
} else if (p.flags & (4 /* Property */ | 3 /* Variable */ | 98304 /* Accessor */)) {
|
|
50655
|
-
return setTextRange(
|
|
50656
|
-
|
|
50657
|
-
name,
|
|
50658
|
-
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
50659
|
-
isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled),
|
|
50660
|
-
// TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
|
|
50661
|
-
// interface members can't have initializers, however class members _can_
|
|
50662
|
-
/*initializer*/
|
|
50663
|
-
void 0
|
|
50664
|
-
), ((_d = p.declarations) == null ? void 0 : _d.find(or(isPropertyDeclaration, isVariableDeclaration))) || firstPropertyLikeDecl);
|
|
50665
|
-
}
|
|
50666
|
-
if (p.flags & (8192 /* Method */ | 16 /* Function */)) {
|
|
50667
|
-
const type = getTypeOfSymbol(p);
|
|
50668
|
-
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
|
50669
|
-
if (flag & 8 /* Private */) {
|
|
50670
|
-
return setTextRange(createProperty2(
|
|
50676
|
+
return setTextRange(
|
|
50677
|
+
createProperty2(
|
|
50671
50678
|
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* Readonly */ : 0) | flag),
|
|
50672
50679
|
name,
|
|
50673
50680
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
50674
|
-
|
|
50675
|
-
|
|
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_
|
|
50676
50684
|
/*initializer*/
|
|
50677
50685
|
void 0
|
|
50678
|
-
),
|
|
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
|
+
);
|
|
50679
50706
|
}
|
|
50680
50707
|
const results2 = [];
|
|
50681
50708
|
for (const sig of signatures) {
|
|
@@ -50746,13 +50773,16 @@ function createTypeChecker(host) {
|
|
|
50746
50773
|
}
|
|
50747
50774
|
}
|
|
50748
50775
|
if (privateProtected) {
|
|
50749
|
-
return [setTextRange(
|
|
50750
|
-
factory.
|
|
50751
|
-
|
|
50752
|
-
|
|
50753
|
-
|
|
50754
|
-
|
|
50755
|
-
|
|
50776
|
+
return [setTextRange(
|
|
50777
|
+
factory.createConstructorDeclaration(
|
|
50778
|
+
factory.createModifiersFromModifierFlags(privateProtected),
|
|
50779
|
+
/*parameters*/
|
|
50780
|
+
[],
|
|
50781
|
+
/*body*/
|
|
50782
|
+
void 0
|
|
50783
|
+
),
|
|
50784
|
+
signatures[0].declaration
|
|
50785
|
+
)];
|
|
50756
50786
|
}
|
|
50757
50787
|
}
|
|
50758
50788
|
const results2 = [];
|
|
@@ -52290,19 +52320,11 @@ function createTypeChecker(host) {
|
|
|
52290
52320
|
function reportCircularityError(symbol) {
|
|
52291
52321
|
const declaration = symbol.valueDeclaration;
|
|
52292
52322
|
if (getEffectiveTypeAnnotationNode(declaration)) {
|
|
52293
|
-
error(
|
|
52294
|
-
symbol.valueDeclaration,
|
|
52295
|
-
Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,
|
|
52296
|
-
symbolToString(symbol)
|
|
52297
|
-
);
|
|
52323
|
+
error(symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
52298
52324
|
return errorType;
|
|
52299
52325
|
}
|
|
52300
52326
|
if (noImplicitAny && (declaration.kind !== 169 /* Parameter */ || declaration.initializer)) {
|
|
52301
|
-
error(
|
|
52302
|
-
symbol.valueDeclaration,
|
|
52303
|
-
Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer,
|
|
52304
|
-
symbolToString(symbol)
|
|
52305
|
-
);
|
|
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));
|
|
52306
52328
|
}
|
|
52307
52329
|
return anyType;
|
|
52308
52330
|
}
|
|
@@ -52513,10 +52535,7 @@ function createTypeChecker(host) {
|
|
|
52513
52535
|
function getConstructorsForTypeArguments(type, typeArgumentNodes, location) {
|
|
52514
52536
|
const typeArgCount = length(typeArgumentNodes);
|
|
52515
52537
|
const isJavascript = isInJSFile(location);
|
|
52516
|
-
return filter(
|
|
52517
|
-
getSignaturesOfType(type, 1 /* Construct */),
|
|
52518
|
-
(sig) => (isJavascript || typeArgCount >= getMinTypeArgumentCount(sig.typeParameters)) && typeArgCount <= length(sig.typeParameters)
|
|
52519
|
-
);
|
|
52538
|
+
return filter(getSignaturesOfType(type, 1 /* Construct */), (sig) => (isJavascript || typeArgCount >= getMinTypeArgumentCount(sig.typeParameters)) && typeArgCount <= length(sig.typeParameters));
|
|
52520
52539
|
}
|
|
52521
52540
|
function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes, location) {
|
|
52522
52541
|
const signatures = getConstructorsForTypeArguments(type, typeArgumentNodes, location);
|
|
@@ -52663,16 +52682,12 @@ function createTypeChecker(host) {
|
|
|
52663
52682
|
return type.resolvedBaseTypes = emptyArray;
|
|
52664
52683
|
}
|
|
52665
52684
|
if (type === reducedBaseType || hasBaseType(reducedBaseType, type)) {
|
|
52666
|
-
error(
|
|
52667
|
-
type
|
|
52668
|
-
|
|
52669
|
-
|
|
52670
|
-
|
|
52671
|
-
|
|
52672
|
-
void 0,
|
|
52673
|
-
2 /* WriteArrayAsGenericType */
|
|
52674
|
-
)
|
|
52675
|
-
);
|
|
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
|
+
));
|
|
52676
52691
|
return type.resolvedBaseTypes = emptyArray;
|
|
52677
52692
|
}
|
|
52678
52693
|
if (type.resolvedBaseTypes === resolvingEmptyArray) {
|
|
@@ -52826,7 +52841,9 @@ function createTypeChecker(host) {
|
|
|
52826
52841
|
if (hasBindableName(member)) {
|
|
52827
52842
|
const memberSymbol = getSymbolOfDeclaration(member);
|
|
52828
52843
|
const value = getEnumMemberValue(member);
|
|
52829
|
-
const memberType = getFreshTypeOfLiteralType(
|
|
52844
|
+
const memberType = getFreshTypeOfLiteralType(
|
|
52845
|
+
value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol)
|
|
52846
|
+
);
|
|
52830
52847
|
getSymbolLinks(memberSymbol).declaredType = memberType;
|
|
52831
52848
|
memberTypeList.push(getRegularTypeOfLiteralType(memberType));
|
|
52832
52849
|
}
|
|
@@ -53234,10 +53251,7 @@ function createTypeChecker(host) {
|
|
|
53234
53251
|
return signature.optionalCallSignatureCache[key] || (signature.optionalCallSignatureCache[key] = createOptionalCallSignature(signature, callChainFlags));
|
|
53235
53252
|
}
|
|
53236
53253
|
function createOptionalCallSignature(signature, callChainFlags) {
|
|
53237
|
-
Debug.assert(
|
|
53238
|
-
callChainFlags === 8 /* IsInnerCallChain */ || callChainFlags === 16 /* IsOuterCallChain */,
|
|
53239
|
-
"An optional call signature can either be for an inner call chain or an outer call chain, but not both."
|
|
53240
|
-
);
|
|
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.");
|
|
53241
53255
|
const result = cloneSignature(signature);
|
|
53242
53256
|
result.flags |= callChainFlags;
|
|
53243
53257
|
return result;
|
|
@@ -53524,11 +53538,7 @@ function createTypeChecker(host) {
|
|
|
53524
53538
|
for (const info of sourceInfos) {
|
|
53525
53539
|
const indexType = info.keyType;
|
|
53526
53540
|
if (every(types, (t) => !!getIndexInfoOfType(t, indexType))) {
|
|
53527
|
-
result.push(createIndexInfo(
|
|
53528
|
-
indexType,
|
|
53529
|
-
getUnionType(map(types, (t) => getIndexTypeOfType(t, indexType))),
|
|
53530
|
-
some(types, (t) => getIndexInfoOfType(t, indexType).isReadonly)
|
|
53531
|
-
));
|
|
53541
|
+
result.push(createIndexInfo(indexType, getUnionType(map(types, (t) => getIndexTypeOfType(t, indexType))), some(types, (t) => getIndexInfoOfType(t, indexType).isReadonly)));
|
|
53532
53542
|
}
|
|
53533
53543
|
}
|
|
53534
53544
|
return result;
|
|
@@ -53620,11 +53630,7 @@ function createTypeChecker(host) {
|
|
|
53620
53630
|
for (let i = 0; i < indexInfos.length; i++) {
|
|
53621
53631
|
const info = indexInfos[i];
|
|
53622
53632
|
if (info.keyType === newInfo.keyType) {
|
|
53623
|
-
indexInfos[i] = createIndexInfo(
|
|
53624
|
-
info.keyType,
|
|
53625
|
-
union ? getUnionType([info.type, newInfo.type]) : getIntersectionType([info.type, newInfo.type]),
|
|
53626
|
-
union ? info.isReadonly || newInfo.isReadonly : info.isReadonly && newInfo.isReadonly
|
|
53627
|
-
);
|
|
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);
|
|
53628
53634
|
return indexInfos;
|
|
53629
53635
|
}
|
|
53630
53636
|
}
|
|
@@ -53704,20 +53710,23 @@ function createTypeChecker(host) {
|
|
|
53704
53710
|
const classType = getDeclaredTypeOfClassOrInterface(symbol);
|
|
53705
53711
|
let constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : emptyArray;
|
|
53706
53712
|
if (symbol.flags & 16 /* Function */) {
|
|
53707
|
-
constructSignatures = addRange(
|
|
53708
|
-
|
|
53709
|
-
(
|
|
53710
|
-
|
|
53711
|
-
sig.
|
|
53712
|
-
|
|
53713
|
-
|
|
53714
|
-
|
|
53715
|
-
|
|
53716
|
-
|
|
53717
|
-
|
|
53718
|
-
|
|
53719
|
-
|
|
53720
|
-
|
|
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
|
+
);
|
|
53721
53730
|
}
|
|
53722
53731
|
if (!constructSignatures.length) {
|
|
53723
53732
|
constructSignatures = getDefaultConstructSignatures(classType);
|
|
@@ -53839,11 +53848,7 @@ function createTypeChecker(host) {
|
|
|
53839
53848
|
const isReadonly = !!(templateModifiers & 1 /* IncludeReadonly */ || !(templateModifiers & 2 /* ExcludeReadonly */) && modifiersProp && isReadonlySymbol(modifiersProp));
|
|
53840
53849
|
const stripOptional = strictNullChecks && !isOptional && modifiersProp && modifiersProp.flags & 16777216 /* Optional */;
|
|
53841
53850
|
const lateFlag = modifiersProp ? getIsLateCheckFlag(modifiersProp) : 0;
|
|
53842
|
-
const prop = createSymbol(
|
|
53843
|
-
4 /* Property */ | (isOptional ? 16777216 /* Optional */ : 0),
|
|
53844
|
-
propName,
|
|
53845
|
-
lateFlag | 262144 /* Mapped */ | (isReadonly ? 8 /* Readonly */ : 0) | (stripOptional ? 524288 /* StripOptional */ : 0)
|
|
53846
|
-
);
|
|
53851
|
+
const prop = createSymbol(4 /* Property */ | (isOptional ? 16777216 /* Optional */ : 0), propName, lateFlag | 262144 /* Mapped */ | (isReadonly ? 8 /* Readonly */ : 0) | (stripOptional ? 524288 /* StripOptional */ : 0));
|
|
53847
53852
|
prop.links.mappedType = type;
|
|
53848
53853
|
prop.links.nameType = propNameType;
|
|
53849
53854
|
prop.links.keyType = keyType;
|
|
@@ -54564,31 +54569,21 @@ function createTypeChecker(host) {
|
|
|
54564
54569
|
if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) {
|
|
54565
54570
|
const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
|
|
54566
54571
|
if (neverProp) {
|
|
54567
|
-
return chainDiagnosticMessages(
|
|
54568
|
-
|
|
54569
|
-
|
|
54570
|
-
|
|
54571
|
-
|
|
54572
|
-
|
|
54573
|
-
void 0,
|
|
54574
|
-
536870912 /* NoTypeReduction */
|
|
54575
|
-
),
|
|
54576
|
-
symbolToString(neverProp)
|
|
54577
|
-
);
|
|
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));
|
|
54578
54578
|
}
|
|
54579
54579
|
const privateProp = find(getPropertiesOfUnionOrIntersectionType(type), isConflictingPrivateProperty);
|
|
54580
54580
|
if (privateProp) {
|
|
54581
|
-
return chainDiagnosticMessages(
|
|
54582
|
-
|
|
54583
|
-
|
|
54584
|
-
|
|
54585
|
-
|
|
54586
|
-
|
|
54587
|
-
void 0,
|
|
54588
|
-
536870912 /* NoTypeReduction */
|
|
54589
|
-
),
|
|
54590
|
-
symbolToString(privateProp)
|
|
54591
|
-
);
|
|
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));
|
|
54592
54587
|
}
|
|
54593
54588
|
}
|
|
54594
54589
|
return errorInfo;
|
|
@@ -54673,16 +54668,12 @@ function createTypeChecker(host) {
|
|
|
54673
54668
|
}
|
|
54674
54669
|
}
|
|
54675
54670
|
}
|
|
54676
|
-
return applicableInfos ? createIndexInfo(
|
|
54677
|
-
|
|
54678
|
-
|
|
54679
|
-
|
|
54680
|
-
|
|
54681
|
-
|
|
54682
|
-
/*initial*/
|
|
54683
|
-
true
|
|
54684
|
-
)
|
|
54685
|
-
) : 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;
|
|
54686
54677
|
}
|
|
54687
54678
|
function isApplicableIndexType(source, target) {
|
|
54688
54679
|
return isTypeAssignableTo(source, target) || target === stringType && isTypeAssignableTo(source, numberType) || target === numberType && (source === numericStringType || !!(source.flags & 128 /* StringLiteral */) && isNumericLiteralName(source.value));
|
|
@@ -55034,12 +55025,7 @@ function createTypeChecker(host) {
|
|
|
55034
55025
|
/*parameterIndex*/
|
|
55035
55026
|
void 0,
|
|
55036
55027
|
type
|
|
55037
|
-
) : createTypePredicate(
|
|
55038
|
-
node.assertsModifier ? 3 /* AssertsIdentifier */ : 1 /* Identifier */,
|
|
55039
|
-
parameterName.escapedText,
|
|
55040
|
-
findIndex(signature.parameters, (p) => p.escapedName === parameterName.escapedText),
|
|
55041
|
-
type
|
|
55042
|
-
);
|
|
55028
|
+
) : createTypePredicate(node.assertsModifier ? 3 /* AssertsIdentifier */ : 1 /* Identifier */, parameterName.escapedText, findIndex(signature.parameters, (p) => p.escapedName === parameterName.escapedText), type);
|
|
55043
55029
|
}
|
|
55044
55030
|
function getUnionOrIntersectionType(types, kind, unionReduction) {
|
|
55045
55031
|
return kind !== 2097152 /* Intersection */ ? getUnionType(types, unionReduction) : getIntersectionType(types);
|
|
@@ -55234,12 +55220,7 @@ function createTypeChecker(host) {
|
|
|
55234
55220
|
if (parameter.type) {
|
|
55235
55221
|
forEachType(getTypeFromTypeNode(parameter.type), (keyType) => {
|
|
55236
55222
|
if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos, keyType)) {
|
|
55237
|
-
indexInfos.push(createIndexInfo(
|
|
55238
|
-
keyType,
|
|
55239
|
-
declaration.type ? getTypeFromTypeNode(declaration.type) : anyType,
|
|
55240
|
-
hasEffectiveModifier(declaration, 64 /* Readonly */),
|
|
55241
|
-
declaration
|
|
55242
|
-
));
|
|
55223
|
+
indexInfos.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, hasEffectiveModifier(declaration, 64 /* Readonly */), declaration));
|
|
55243
55224
|
}
|
|
55244
55225
|
});
|
|
55245
55226
|
}
|
|
@@ -55270,9 +55251,12 @@ function createTypeChecker(host) {
|
|
|
55270
55251
|
if (index < typeParameters.length) {
|
|
55271
55252
|
const declaredConstraint = getConstraintOfTypeParameter(typeParameters[index]);
|
|
55272
55253
|
if (declaredConstraint) {
|
|
55273
|
-
const mapper = makeDeferredTypeMapper(
|
|
55274
|
-
|
|
55275
|
-
|
|
55254
|
+
const mapper = makeDeferredTypeMapper(
|
|
55255
|
+
typeParameters,
|
|
55256
|
+
typeParameters.map((_, index2) => () => {
|
|
55257
|
+
return getEffectiveTypeArgumentAtIndex(typeReference, typeParameters, index2);
|
|
55258
|
+
})
|
|
55259
|
+
);
|
|
55276
55260
|
const constraint = instantiateType(declaredConstraint, mapper);
|
|
55277
55261
|
if (constraint !== typeParameter) {
|
|
55278
55262
|
inferences = append(inferences, constraint);
|
|
@@ -55289,10 +55273,7 @@ function createTypeChecker(host) {
|
|
|
55289
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) {
|
|
55290
55274
|
const checkMappedType2 = grandParent.parent.checkType;
|
|
55291
55275
|
const nodeType = getTypeFromTypeNode(checkMappedType2.type);
|
|
55292
|
-
inferences = append(inferences, instantiateType(
|
|
55293
|
-
nodeType,
|
|
55294
|
-
makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(checkMappedType2.typeParameter)), checkMappedType2.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType2.typeParameter.constraint) : keyofConstraintType)
|
|
55295
|
-
));
|
|
55276
|
+
inferences = append(inferences, instantiateType(nodeType, makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(checkMappedType2.typeParameter)), checkMappedType2.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType2.typeParameter.constraint) : keyofConstraintType)));
|
|
55296
55277
|
}
|
|
55297
55278
|
}
|
|
55298
55279
|
}
|
|
@@ -55467,12 +55448,7 @@ function createTypeChecker(host) {
|
|
|
55467
55448
|
const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
55468
55449
|
let instantiation = links.instantiations.get(id);
|
|
55469
55450
|
if (!instantiation) {
|
|
55470
|
-
links.instantiations.set(id, instantiation = instantiateTypeWithAlias(
|
|
55471
|
-
type,
|
|
55472
|
-
createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters), isInJSFile(symbol.valueDeclaration))),
|
|
55473
|
-
aliasSymbol,
|
|
55474
|
-
aliasTypeArguments
|
|
55475
|
-
));
|
|
55451
|
+
links.instantiations.set(id, instantiation = instantiateTypeWithAlias(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters), isInJSFile(symbol.valueDeclaration))), aliasSymbol, aliasTypeArguments));
|
|
55476
55452
|
}
|
|
55477
55453
|
return instantiation;
|
|
55478
55454
|
}
|
|
@@ -56308,11 +56284,7 @@ function createTypeChecker(host) {
|
|
|
56308
56284
|
const flags = elementFlags[i];
|
|
56309
56285
|
combinedFlags |= flags;
|
|
56310
56286
|
if (!(combinedFlags & 12 /* Variable */)) {
|
|
56311
|
-
const property = createSymbol(
|
|
56312
|
-
4 /* Property */ | (flags & 2 /* Optional */ ? 16777216 /* Optional */ : 0),
|
|
56313
|
-
"" + i,
|
|
56314
|
-
readonly ? 8 /* Readonly */ : 0
|
|
56315
|
-
);
|
|
56287
|
+
const property = createSymbol(4 /* Property */ | (flags & 2 /* Optional */ ? 16777216 /* Optional */ : 0), "" + i, readonly ? 8 /* Readonly */ : 0);
|
|
56316
56288
|
property.links.tupleLabelDeclaration = namedMemberDeclarations == null ? void 0 : namedMemberDeclarations[i];
|
|
56317
56289
|
property.links.type = typeParameter;
|
|
56318
56290
|
properties.push(property);
|
|
@@ -56383,7 +56355,10 @@ function createTypeChecker(host) {
|
|
|
56383
56355
|
} else if (isTupleType(type)) {
|
|
56384
56356
|
const elements = getElementTypes(type);
|
|
56385
56357
|
if (elements.length + expandedTypes.length >= 1e4) {
|
|
56386
|
-
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
|
+
);
|
|
56387
56362
|
return errorType;
|
|
56388
56363
|
}
|
|
56389
56364
|
forEach(elements, (t, n) => {
|
|
@@ -56402,10 +56377,7 @@ function createTypeChecker(host) {
|
|
|
56402
56377
|
expandedFlags[i] = 1 /* Required */;
|
|
56403
56378
|
}
|
|
56404
56379
|
if (firstRestIndex >= 0 && firstRestIndex < lastOptionalOrRestIndex) {
|
|
56405
|
-
expandedTypes[firstRestIndex] = getUnionType(sameMap(
|
|
56406
|
-
expandedTypes.slice(firstRestIndex, lastOptionalOrRestIndex + 1),
|
|
56407
|
-
(t, i) => expandedFlags[firstRestIndex + i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t
|
|
56408
|
-
));
|
|
56380
|
+
expandedTypes[firstRestIndex] = getUnionType(sameMap(expandedTypes.slice(firstRestIndex, lastOptionalOrRestIndex + 1), (t, i) => expandedFlags[firstRestIndex + i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t));
|
|
56409
56381
|
expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
56410
56382
|
expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
56411
56383
|
expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
@@ -56443,10 +56415,7 @@ function createTypeChecker(host) {
|
|
|
56443
56415
|
);
|
|
56444
56416
|
}
|
|
56445
56417
|
function getKnownKeysOfTupleType(type) {
|
|
56446
|
-
return getUnionType(append(
|
|
56447
|
-
arrayOf(type.target.fixedLength, (i) => getStringLiteralType("" + i)),
|
|
56448
|
-
getIndexType(type.target.readonly ? globalReadonlyArrayType : globalArrayType)
|
|
56449
|
-
));
|
|
56418
|
+
return getUnionType(append(arrayOf(type.target.fixedLength, (i) => getStringLiteralType("" + i)), getIndexType(type.target.readonly ? globalReadonlyArrayType : globalArrayType)));
|
|
56450
56419
|
}
|
|
56451
56420
|
function getStartElementCount(type, flags) {
|
|
56452
56421
|
const index = findIndex(type.elementFlags, (f) => !(f & flags));
|
|
@@ -56582,10 +56551,7 @@ function createTypeChecker(host) {
|
|
|
56582
56551
|
}
|
|
56583
56552
|
}
|
|
56584
56553
|
function removeStringLiteralsMatchedByTemplateLiterals(types) {
|
|
56585
|
-
const templates = filter(
|
|
56586
|
-
types,
|
|
56587
|
-
(t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types))
|
|
56588
|
-
);
|
|
56554
|
+
const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types)));
|
|
56589
56555
|
if (templates.length) {
|
|
56590
56556
|
let i = types.length;
|
|
56591
56557
|
while (i > 0) {
|
|
@@ -56755,12 +56721,7 @@ function createTypeChecker(host) {
|
|
|
56755
56721
|
const links = getNodeLinks(node);
|
|
56756
56722
|
if (!links.resolvedType) {
|
|
56757
56723
|
const aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
56758
|
-
links.resolvedType = getUnionType(
|
|
56759
|
-
map(node.types, getTypeFromTypeNode),
|
|
56760
|
-
1 /* Literal */,
|
|
56761
|
-
aliasSymbol,
|
|
56762
|
-
getTypeArgumentsForAliasSymbol(aliasSymbol)
|
|
56763
|
-
);
|
|
56724
|
+
links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNode), 1 /* Literal */, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
|
|
56764
56725
|
}
|
|
56765
56726
|
return links.resolvedType;
|
|
56766
56727
|
}
|
|
@@ -57113,11 +57074,7 @@ function createTypeChecker(host) {
|
|
|
57113
57074
|
}
|
|
57114
57075
|
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
57115
57076
|
type = getReducedType(type);
|
|
57116
|
-
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(
|
|
57117
|
-
type,
|
|
57118
|
-
(indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
|
|
57119
|
-
indexFlags === defaultIndexFlags
|
|
57120
|
-
);
|
|
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);
|
|
57121
57078
|
}
|
|
57122
57079
|
function getExtractStringType(type) {
|
|
57123
57080
|
if (keyofStringsOnly) {
|
|
@@ -57357,13 +57314,7 @@ function createTypeChecker(host) {
|
|
|
57357
57314
|
error(indexNode, Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
|
|
57358
57315
|
return undefinedType;
|
|
57359
57316
|
}
|
|
57360
|
-
error(
|
|
57361
|
-
indexNode,
|
|
57362
|
-
Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2,
|
|
57363
|
-
typeToString(objectType),
|
|
57364
|
-
getTypeReferenceArity(objectType),
|
|
57365
|
-
unescapeLeadingUnderscores(propName)
|
|
57366
|
-
);
|
|
57317
|
+
error(indexNode, Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), unescapeLeadingUnderscores(propName));
|
|
57367
57318
|
} else {
|
|
57368
57319
|
error(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
57369
57320
|
}
|
|
@@ -58644,24 +58595,29 @@ function createTypeChecker(host) {
|
|
|
58644
58595
|
if (typeVariable) {
|
|
58645
58596
|
const mappedTypeVariable = instantiateType(typeVariable, mapper);
|
|
58646
58597
|
if (typeVariable !== mappedTypeVariable) {
|
|
58647
|
-
return mapTypeWithAlias(
|
|
58648
|
-
|
|
58649
|
-
|
|
58650
|
-
|
|
58651
|
-
if (
|
|
58652
|
-
|
|
58653
|
-
|
|
58654
|
-
|
|
58655
|
-
|
|
58656
|
-
|
|
58657
|
-
|
|
58658
|
-
|
|
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
|
+
}
|
|
58659
58613
|
}
|
|
58614
|
+
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
58660
58615
|
}
|
|
58661
|
-
return
|
|
58662
|
-
}
|
|
58663
|
-
|
|
58664
|
-
|
|
58616
|
+
return t;
|
|
58617
|
+
},
|
|
58618
|
+
aliasSymbol,
|
|
58619
|
+
aliasTypeArguments
|
|
58620
|
+
);
|
|
58665
58621
|
}
|
|
58666
58622
|
}
|
|
58667
58623
|
return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments);
|
|
@@ -59055,10 +59011,13 @@ function createTypeChecker(host) {
|
|
|
59055
59011
|
const resultObj = errorOutputContainer || {};
|
|
59056
59012
|
checkTypeAssignableTo(source, target, node, headMessage, containingMessageChain, resultObj);
|
|
59057
59013
|
const diagnostic = resultObj.errors[resultObj.errors.length - 1];
|
|
59058
|
-
addRelatedInfo(
|
|
59059
|
-
|
|
59060
|
-
|
|
59061
|
-
|
|
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
|
+
);
|
|
59062
59021
|
return true;
|
|
59063
59022
|
}
|
|
59064
59023
|
}
|
|
@@ -59115,10 +59074,13 @@ function createTypeChecker(host) {
|
|
|
59115
59074
|
);
|
|
59116
59075
|
if (resultObj.errors) {
|
|
59117
59076
|
if (target.symbol && length(target.symbol.declarations)) {
|
|
59118
|
-
addRelatedInfo(
|
|
59119
|
-
|
|
59120
|
-
|
|
59121
|
-
|
|
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
|
+
);
|
|
59122
59084
|
}
|
|
59123
59085
|
if ((getFunctionFlags(node) & 2 /* Async */) === 0 && !getTypeOfPropertyOfType(sourceReturn, "then") && checkTypeRelatedTo(
|
|
59124
59086
|
createPromiseType(sourceReturn),
|
|
@@ -59127,10 +59089,13 @@ function createTypeChecker(host) {
|
|
|
59127
59089
|
/*errorNode*/
|
|
59128
59090
|
void 0
|
|
59129
59091
|
)) {
|
|
59130
|
-
addRelatedInfo(
|
|
59131
|
-
|
|
59132
|
-
|
|
59133
|
-
|
|
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
|
+
);
|
|
59134
59099
|
}
|
|
59135
59100
|
return true;
|
|
59136
59101
|
}
|
|
@@ -59225,12 +59190,15 @@ function createTypeChecker(host) {
|
|
|
59225
59190
|
if (!issuedElaboration && (targetProp && length(targetProp.declarations) || target.symbol && length(target.symbol.declarations))) {
|
|
59226
59191
|
const targetNode = targetProp && length(targetProp.declarations) ? targetProp.declarations[0] : target.symbol.declarations[0];
|
|
59227
59192
|
if (!getSourceFileOfNode(targetNode).hasNoDefaultLib) {
|
|
59228
|
-
addRelatedInfo(
|
|
59229
|
-
|
|
59230
|
-
|
|
59231
|
-
|
|
59232
|
-
|
|
59233
|
-
|
|
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
|
+
);
|
|
59234
59202
|
}
|
|
59235
59203
|
}
|
|
59236
59204
|
}
|
|
@@ -59612,11 +59580,7 @@ function createTypeChecker(host) {
|
|
|
59612
59580
|
}
|
|
59613
59581
|
if (!related) {
|
|
59614
59582
|
if (reportErrors2) {
|
|
59615
|
-
errorReporter(
|
|
59616
|
-
Diagnostics.Types_of_parameters_0_and_1_are_incompatible,
|
|
59617
|
-
unescapeLeadingUnderscores(getParameterNameAtPosition(source, i)),
|
|
59618
|
-
unescapeLeadingUnderscores(getParameterNameAtPosition(target, i))
|
|
59619
|
-
);
|
|
59583
|
+
errorReporter(Diagnostics.Types_of_parameters_0_and_1_are_incompatible, unescapeLeadingUnderscores(getParameterNameAtPosition(source, i)), unescapeLeadingUnderscores(getParameterNameAtPosition(target, i)));
|
|
59620
59584
|
}
|
|
59621
59585
|
return 0 /* False */;
|
|
59622
59586
|
}
|
|
@@ -59737,16 +59701,12 @@ function createTypeChecker(host) {
|
|
|
59737
59701
|
const targetProperty = getPropertyOfType(targetEnumType, property.escapedName);
|
|
59738
59702
|
if (!targetProperty || !(targetProperty.flags & 8 /* EnumMember */)) {
|
|
59739
59703
|
if (errorReporter) {
|
|
59740
|
-
errorReporter(
|
|
59741
|
-
|
|
59742
|
-
|
|
59743
|
-
|
|
59744
|
-
|
|
59745
|
-
|
|
59746
|
-
void 0,
|
|
59747
|
-
64 /* UseFullyQualifiedType */
|
|
59748
|
-
)
|
|
59749
|
-
);
|
|
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
|
+
));
|
|
59750
59710
|
enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
|
|
59751
59711
|
} else {
|
|
59752
59712
|
enumRelation.set(id, 2 /* Failed */);
|
|
@@ -60419,18 +60379,9 @@ function createTypeChecker(host) {
|
|
|
60419
60379
|
}
|
|
60420
60380
|
}
|
|
60421
60381
|
if (suggestion !== void 0) {
|
|
60422
|
-
reportParentSkippedError(
|
|
60423
|
-
Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2,
|
|
60424
|
-
symbolToString(prop),
|
|
60425
|
-
typeToString(errorTarget),
|
|
60426
|
-
suggestion
|
|
60427
|
-
);
|
|
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);
|
|
60428
60383
|
} else {
|
|
60429
|
-
reportParentSkippedError(
|
|
60430
|
-
Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
|
|
60431
|
-
symbolToString(prop),
|
|
60432
|
-
typeToString(errorTarget)
|
|
60433
|
-
);
|
|
60384
|
+
reportParentSkippedError(Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(errorTarget));
|
|
60434
60385
|
}
|
|
60435
60386
|
}
|
|
60436
60387
|
}
|
|
@@ -61632,12 +61583,7 @@ function createTypeChecker(host) {
|
|
|
61632
61583
|
if (sourcePropFlags & 8 /* Private */ && targetPropFlags & 8 /* Private */) {
|
|
61633
61584
|
reportError(Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp));
|
|
61634
61585
|
} else {
|
|
61635
|
-
reportError(
|
|
61636
|
-
Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2,
|
|
61637
|
-
symbolToString(targetProp),
|
|
61638
|
-
typeToString(sourcePropFlags & 8 /* Private */ ? source2 : target2),
|
|
61639
|
-
typeToString(sourcePropFlags & 8 /* Private */ ? target2 : source2)
|
|
61640
|
-
);
|
|
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));
|
|
61641
61587
|
}
|
|
61642
61588
|
}
|
|
61643
61589
|
return 0 /* False */;
|
|
@@ -61645,23 +61591,13 @@ function createTypeChecker(host) {
|
|
|
61645
61591
|
} else if (targetPropFlags & 16 /* Protected */) {
|
|
61646
61592
|
if (!isValidOverrideOf(sourceProp, targetProp)) {
|
|
61647
61593
|
if (reportErrors2) {
|
|
61648
|
-
reportError(
|
|
61649
|
-
Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2,
|
|
61650
|
-
symbolToString(targetProp),
|
|
61651
|
-
typeToString(getDeclaringClass(sourceProp) || source2),
|
|
61652
|
-
typeToString(getDeclaringClass(targetProp) || target2)
|
|
61653
|
-
);
|
|
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));
|
|
61654
61595
|
}
|
|
61655
61596
|
return 0 /* False */;
|
|
61656
61597
|
}
|
|
61657
61598
|
} else if (sourcePropFlags & 16 /* Protected */) {
|
|
61658
61599
|
if (reportErrors2) {
|
|
61659
|
-
reportError(
|
|
61660
|
-
Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2,
|
|
61661
|
-
symbolToString(targetProp),
|
|
61662
|
-
typeToString(source2),
|
|
61663
|
-
typeToString(target2)
|
|
61664
|
-
);
|
|
61600
|
+
reportError(Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source2), typeToString(target2));
|
|
61665
61601
|
}
|
|
61666
61602
|
return 0 /* False */;
|
|
61667
61603
|
}
|
|
@@ -61677,12 +61613,7 @@ function createTypeChecker(host) {
|
|
|
61677
61613
|
}
|
|
61678
61614
|
if (!skipOptional && sourceProp.flags & 16777216 /* Optional */ && targetProp.flags & 106500 /* ClassMember */ && !(targetProp.flags & 16777216 /* Optional */)) {
|
|
61679
61615
|
if (reportErrors2) {
|
|
61680
|
-
reportError(
|
|
61681
|
-
Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2,
|
|
61682
|
-
symbolToString(targetProp),
|
|
61683
|
-
typeToString(source2),
|
|
61684
|
-
typeToString(target2)
|
|
61685
|
-
);
|
|
61616
|
+
reportError(Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source2), typeToString(target2));
|
|
61686
61617
|
}
|
|
61687
61618
|
return 0 /* False */;
|
|
61688
61619
|
}
|
|
@@ -61928,8 +61859,14 @@ function createTypeChecker(host) {
|
|
|
61928
61859
|
}
|
|
61929
61860
|
const sourceIsJSConstructor = source2.symbol && isJSConstructor(source2.symbol.valueDeclaration);
|
|
61930
61861
|
const targetIsJSConstructor = target2.symbol && isJSConstructor(target2.symbol.valueDeclaration);
|
|
61931
|
-
const sourceSignatures = getSignaturesOfType(
|
|
61932
|
-
|
|
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
|
+
);
|
|
61933
61870
|
if (kind === 1 /* Construct */ && sourceSignatures.length && targetSignatures.length) {
|
|
61934
61871
|
const sourceIsAbstract = !!(sourceSignatures[0].flags & 4 /* Abstract */);
|
|
61935
61872
|
const targetIsAbstract = !!(targetSignatures[0].flags & 4 /* Abstract */);
|
|
@@ -62003,18 +61940,14 @@ function createTypeChecker(host) {
|
|
|
62003
61940
|
shouldElaborateErrors = false;
|
|
62004
61941
|
}
|
|
62005
61942
|
if (shouldElaborateErrors) {
|
|
62006
|
-
reportError(
|
|
62007
|
-
|
|
62008
|
-
|
|
62009
|
-
|
|
62010
|
-
|
|
62011
|
-
|
|
62012
|
-
|
|
62013
|
-
|
|
62014
|
-
void 0,
|
|
62015
|
-
kind
|
|
62016
|
-
)
|
|
62017
|
-
);
|
|
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
|
+
));
|
|
62018
61951
|
}
|
|
62019
61952
|
return 0 /* False */;
|
|
62020
61953
|
}
|
|
@@ -62047,16 +61980,7 @@ function createTypeChecker(host) {
|
|
|
62047
61980
|
}
|
|
62048
61981
|
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
62049
61982
|
const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
|
|
62050
|
-
return compareSignaturesRelated(
|
|
62051
|
-
erase ? getErasedSignature(source2) : source2,
|
|
62052
|
-
erase ? getErasedSignature(target2) : target2,
|
|
62053
|
-
checkMode,
|
|
62054
|
-
reportErrors2,
|
|
62055
|
-
reportError,
|
|
62056
|
-
incompatibleReporter,
|
|
62057
|
-
isRelatedToWorker2,
|
|
62058
|
-
reportUnreliableMapper
|
|
62059
|
-
);
|
|
61983
|
+
return compareSignaturesRelated(erase ? getErasedSignature(source2) : source2, erase ? getErasedSignature(target2) : target2, checkMode, reportErrors2, reportError, incompatibleReporter, isRelatedToWorker2, reportUnreliableMapper);
|
|
62060
61984
|
function isRelatedToWorker2(source3, target3, reportErrors3) {
|
|
62061
61985
|
return isRelatedTo(
|
|
62062
61986
|
source3,
|
|
@@ -62965,13 +62889,7 @@ function createTypeChecker(host) {
|
|
|
62965
62889
|
}
|
|
62966
62890
|
}
|
|
62967
62891
|
}
|
|
62968
|
-
const result = createAnonymousType(
|
|
62969
|
-
type.symbol,
|
|
62970
|
-
members,
|
|
62971
|
-
emptyArray,
|
|
62972
|
-
emptyArray,
|
|
62973
|
-
sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly))
|
|
62974
|
-
);
|
|
62892
|
+
const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly)));
|
|
62975
62893
|
result.objectFlags |= getObjectFlags(type) & (4096 /* JSLiteral */ | 262144 /* NonInferrableType */);
|
|
62976
62894
|
return result;
|
|
62977
62895
|
}
|
|
@@ -63184,19 +63102,25 @@ function createTypeChecker(host) {
|
|
|
63184
63102
|
return context;
|
|
63185
63103
|
}
|
|
63186
63104
|
function makeFixingMapperForContext(context) {
|
|
63187
|
-
return makeDeferredTypeMapper(
|
|
63188
|
-
|
|
63189
|
-
|
|
63190
|
-
|
|
63191
|
-
|
|
63192
|
-
|
|
63193
|
-
|
|
63194
|
-
|
|
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
|
+
);
|
|
63195
63116
|
}
|
|
63196
63117
|
function makeNonFixingMapperForContext(context) {
|
|
63197
|
-
return makeDeferredTypeMapper(
|
|
63198
|
-
|
|
63199
|
-
|
|
63118
|
+
return makeDeferredTypeMapper(
|
|
63119
|
+
map(context.inferences, (i) => i.typeParameter),
|
|
63120
|
+
map(context.inferences, (_, i) => () => {
|
|
63121
|
+
return getInferredType(context, i);
|
|
63122
|
+
})
|
|
63123
|
+
);
|
|
63200
63124
|
}
|
|
63201
63125
|
function clearCachedInferences(inferences) {
|
|
63202
63126
|
for (const inference of inferences) {
|
|
@@ -63944,11 +63868,7 @@ function createTypeChecker(host) {
|
|
|
63944
63868
|
)) {
|
|
63945
63869
|
allTypeFlags &= ~2112 /* BigIntLike */;
|
|
63946
63870
|
}
|
|
63947
|
-
const matchingType = reduceLeft(
|
|
63948
|
-
constraintTypes,
|
|
63949
|
-
(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,
|
|
63950
|
-
neverType
|
|
63951
|
-
);
|
|
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);
|
|
63952
63872
|
if (!(matchingType.flags & 131072 /* Never */)) {
|
|
63953
63873
|
inferFromTypes(matchingType, target2);
|
|
63954
63874
|
continue;
|
|
@@ -63994,10 +63914,7 @@ function createTypeChecker(host) {
|
|
|
63994
63914
|
return;
|
|
63995
63915
|
}
|
|
63996
63916
|
const startLength = isTupleType(source) ? Math.min(source.target.fixedLength, target.target.fixedLength) : 0;
|
|
63997
|
-
const endLength = Math.min(
|
|
63998
|
-
isTupleType(source) ? getEndElementCount(source.target, 3 /* Fixed */) : 0,
|
|
63999
|
-
target.target.hasRestElement ? getEndElementCount(target.target, 3 /* Fixed */) : 0
|
|
64000
|
-
);
|
|
63917
|
+
const endLength = Math.min(isTupleType(source) ? getEndElementCount(source.target, 3 /* Fixed */) : 0, target.target.hasRestElement ? getEndElementCount(target.target, 3 /* Fixed */) : 0);
|
|
64001
63918
|
for (let i = 0; i < startLength; i++) {
|
|
64002
63919
|
inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
|
|
64003
63920
|
}
|
|
@@ -64546,7 +64463,7 @@ function createTypeChecker(host) {
|
|
|
64546
64463
|
const resolved = resolveStructuredTypeMembers(type);
|
|
64547
64464
|
return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
|
|
64548
64465
|
}
|
|
64549
|
-
function getTypeFacts(type) {
|
|
64466
|
+
function getTypeFacts(type, strictTruthy) {
|
|
64550
64467
|
if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
|
|
64551
64468
|
type = getBaseConstraintOfType(type) || unknownType;
|
|
64552
64469
|
}
|
|
@@ -64576,7 +64493,7 @@ function createTypeChecker(host) {
|
|
|
64576
64493
|
return strictNullChecks ? 16316168 /* BooleanStrictFacts */ : 16774920 /* BooleanFacts */;
|
|
64577
64494
|
}
|
|
64578
64495
|
if (flags & 528 /* BooleanLike */) {
|
|
64579
|
-
return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
|
|
64496
|
+
return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : strictTruthy ? 16774920 /* TrueFacts */ & ~8388608 /* Falsy */ : 16774920 /* TrueFacts */;
|
|
64580
64497
|
}
|
|
64581
64498
|
if (flags & 524288 /* Object */) {
|
|
64582
64499
|
return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
|
|
@@ -64600,7 +64517,7 @@ function createTypeChecker(host) {
|
|
|
64600
64517
|
return 0 /* None */;
|
|
64601
64518
|
}
|
|
64602
64519
|
if (flags & 1048576 /* Union */) {
|
|
64603
|
-
return reduceLeft(type.types, (facts, t) => facts | getTypeFacts(t), 0 /* None */);
|
|
64520
|
+
return reduceLeft(type.types, (facts, t) => facts | getTypeFacts(t, strictTruthy), 0 /* None */);
|
|
64604
64521
|
}
|
|
64605
64522
|
if (flags & 2097152 /* Intersection */) {
|
|
64606
64523
|
return getIntersectionTypeFacts(type);
|
|
@@ -64620,8 +64537,8 @@ function createTypeChecker(host) {
|
|
|
64620
64537
|
}
|
|
64621
64538
|
return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
|
|
64622
64539
|
}
|
|
64623
|
-
function getTypeWithFacts(type, include) {
|
|
64624
|
-
return filterType(type, (t) => (getTypeFacts(t) & include) !== 0);
|
|
64540
|
+
function getTypeWithFacts(type, include, strictTruthy) {
|
|
64541
|
+
return filterType(type, (t) => (getTypeFacts(t, strictTruthy) & include) !== 0);
|
|
64625
64542
|
}
|
|
64626
64543
|
function getAdjustedTypeWithFacts(type, facts) {
|
|
64627
64544
|
const reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
|
|
@@ -64919,7 +64836,9 @@ function createTypeChecker(host) {
|
|
|
64919
64836
|
return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType]));
|
|
64920
64837
|
}
|
|
64921
64838
|
function createFinalArrayType(elementType) {
|
|
64922
|
-
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
|
+
);
|
|
64923
64842
|
}
|
|
64924
64843
|
function getFinalArrayType(evolvingArrayType) {
|
|
64925
64844
|
return evolvingArrayType.finalArrayType || (evolvingArrayType.finalArrayType = createFinalArrayType(evolvingArrayType.elementType));
|
|
@@ -65320,7 +65239,10 @@ function createTypeChecker(host) {
|
|
|
65320
65239
|
}
|
|
65321
65240
|
function getInitialOrAssignedType(flow) {
|
|
65322
65241
|
const node = flow.node;
|
|
65323
|
-
return getNarrowableTypeForReference(
|
|
65242
|
+
return getNarrowableTypeForReference(
|
|
65243
|
+
node.kind === 260 /* VariableDeclaration */ || node.kind === 208 /* BindingElement */ ? getInitialType(node) : getAssignedType(node),
|
|
65244
|
+
reference
|
|
65245
|
+
);
|
|
65324
65246
|
}
|
|
65325
65247
|
function getTypeAtFlowAssignment(flow) {
|
|
65326
65248
|
const node = flow.node;
|
|
@@ -65459,21 +65381,9 @@ function createTypeChecker(host) {
|
|
|
65459
65381
|
} else {
|
|
65460
65382
|
if (strictNullChecks) {
|
|
65461
65383
|
if (optionalChainContainsReference(expr, reference)) {
|
|
65462
|
-
type = narrowTypeBySwitchOptionalChainContainment(
|
|
65463
|
-
type,
|
|
65464
|
-
flow.switchStatement,
|
|
65465
|
-
flow.clauseStart,
|
|
65466
|
-
flow.clauseEnd,
|
|
65467
|
-
(t) => !(t.flags & (32768 /* Undefined */ | 131072 /* Never */))
|
|
65468
|
-
);
|
|
65384
|
+
type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, (t) => !(t.flags & (32768 /* Undefined */ | 131072 /* Never */)));
|
|
65469
65385
|
} else if (expr.kind === 221 /* TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) {
|
|
65470
|
-
type = narrowTypeBySwitchOptionalChainContainment(
|
|
65471
|
-
type,
|
|
65472
|
-
flow.switchStatement,
|
|
65473
|
-
flow.clauseStart,
|
|
65474
|
-
flow.clauseEnd,
|
|
65475
|
-
(t) => !(t.flags & 131072 /* Never */ || t.flags & 128 /* StringLiteral */ && t.value === "undefined")
|
|
65476
|
-
);
|
|
65386
|
+
type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, (t) => !(t.flags & 131072 /* Never */ || t.flags & 128 /* StringLiteral */ && t.value === "undefined"));
|
|
65477
65387
|
}
|
|
65478
65388
|
}
|
|
65479
65389
|
const access = getDiscriminantPropertyAccess(expr, type);
|
|
@@ -65688,7 +65598,12 @@ function createTypeChecker(host) {
|
|
|
65688
65598
|
}
|
|
65689
65599
|
const access = getDiscriminantPropertyAccess(expr, type);
|
|
65690
65600
|
if (access) {
|
|
65691
|
-
return narrowTypeByDiscriminant(type, access, (t) => getTypeWithFacts(
|
|
65601
|
+
return narrowTypeByDiscriminant(type, access, (t) => getTypeWithFacts(
|
|
65602
|
+
t,
|
|
65603
|
+
assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */,
|
|
65604
|
+
/*strictTruthy*/
|
|
65605
|
+
true
|
|
65606
|
+
));
|
|
65692
65607
|
}
|
|
65693
65608
|
return type;
|
|
65694
65609
|
}
|
|
@@ -66096,7 +66011,10 @@ function createTypeChecker(host) {
|
|
|
66096
66011
|
const narrowedType = mapType(candidate, (c) => {
|
|
66097
66012
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
66098
66013
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
66099
|
-
const directlyRelated = mapType(
|
|
66014
|
+
const directlyRelated = mapType(
|
|
66015
|
+
matching || type,
|
|
66016
|
+
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
|
|
66017
|
+
);
|
|
66100
66018
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
66101
66019
|
});
|
|
66102
66020
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -68133,7 +68051,10 @@ function createTypeChecker(host) {
|
|
|
68133
68051
|
inConstContext
|
|
68134
68052
|
));
|
|
68135
68053
|
}
|
|
68136
|
-
return createArrayLiteralType(createArrayType(
|
|
68054
|
+
return createArrayLiteralType(createArrayType(
|
|
68055
|
+
elementTypes.length ? getUnionType(sameMap(elementTypes, (t, i) => elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessTypeOrUndefined(t, numberType) || anyType : t), 2 /* Subtype */) : strictNullChecks ? implicitNeverType : undefinedWideningType,
|
|
68056
|
+
inConstContext
|
|
68057
|
+
));
|
|
68137
68058
|
}
|
|
68138
68059
|
function createArrayLiteralType(type) {
|
|
68139
68060
|
if (!(getObjectFlags(type) & 4 /* Reference */)) {
|
|
@@ -68286,12 +68207,7 @@ function createTypeChecker(host) {
|
|
|
68286
68207
|
if (impliedProp) {
|
|
68287
68208
|
prop.flags |= impliedProp.flags & 16777216 /* Optional */;
|
|
68288
68209
|
} else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, stringType)) {
|
|
68289
|
-
error(
|
|
68290
|
-
memberDecl.name,
|
|
68291
|
-
Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
|
|
68292
|
-
symbolToString(member),
|
|
68293
|
-
typeToString(contextualType)
|
|
68294
|
-
);
|
|
68210
|
+
error(memberDecl.name, Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType));
|
|
68295
68211
|
}
|
|
68296
68212
|
}
|
|
68297
68213
|
prop.declarations = member.declarations;
|
|
@@ -68361,22 +68277,13 @@ function createTypeChecker(host) {
|
|
|
68361
68277
|
}
|
|
68362
68278
|
popContextualType();
|
|
68363
68279
|
if (contextualTypeHasPattern) {
|
|
68364
|
-
const rootPatternParent = findAncestor(
|
|
68365
|
-
|
|
68366
|
-
(n) => n.kind === 260 /* VariableDeclaration */ || n.kind === 226 /* BinaryExpression */ || n.kind === 169 /* Parameter */
|
|
68367
|
-
);
|
|
68368
|
-
const spreadOrOutsideRootObject = findAncestor(
|
|
68369
|
-
node,
|
|
68370
|
-
(n) => n === rootPatternParent || n.kind === 305 /* SpreadAssignment */
|
|
68371
|
-
);
|
|
68280
|
+
const rootPatternParent = findAncestor(contextualType.pattern.parent, (n) => n.kind === 260 /* VariableDeclaration */ || n.kind === 226 /* BinaryExpression */ || n.kind === 169 /* Parameter */);
|
|
68281
|
+
const spreadOrOutsideRootObject = findAncestor(node, (n) => n === rootPatternParent || n.kind === 305 /* SpreadAssignment */);
|
|
68372
68282
|
if (spreadOrOutsideRootObject.kind !== 305 /* SpreadAssignment */) {
|
|
68373
68283
|
for (const prop of getPropertiesOfType(contextualType)) {
|
|
68374
68284
|
if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
|
|
68375
68285
|
if (!(prop.flags & 16777216 /* Optional */)) {
|
|
68376
|
-
error(
|
|
68377
|
-
prop.valueDeclaration || ((_a = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a.links.bindingElement),
|
|
68378
|
-
Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value
|
|
68379
|
-
);
|
|
68286
|
+
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);
|
|
68380
68287
|
}
|
|
68381
68288
|
propertiesTable.set(prop.escapedName, prop);
|
|
68382
68289
|
propertiesArray.push(prop);
|
|
@@ -68448,7 +68355,10 @@ function createTypeChecker(host) {
|
|
|
68448
68355
|
checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment);
|
|
68449
68356
|
const nodeSourceFile = getSourceFileOfNode(node);
|
|
68450
68357
|
if (getJSXTransformEnabled(compilerOptions) && (compilerOptions.jsxFactory || nodeSourceFile.pragmas.has("jsx")) && !compilerOptions.jsxFragmentFactory && !nodeSourceFile.pragmas.has("jsxfrag")) {
|
|
68451
|
-
error(
|
|
68358
|
+
error(
|
|
68359
|
+
node,
|
|
68360
|
+
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
|
|
68361
|
+
);
|
|
68452
68362
|
}
|
|
68453
68363
|
checkJsxChildren(node);
|
|
68454
68364
|
return getJsxElementTypeAt(node) || anyType;
|
|
@@ -69029,12 +68939,7 @@ function createTypeChecker(host) {
|
|
|
69029
68939
|
}
|
|
69030
68940
|
if (flags & 256 /* Abstract */) {
|
|
69031
68941
|
if (errorNode) {
|
|
69032
|
-
error(
|
|
69033
|
-
errorNode,
|
|
69034
|
-
Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression,
|
|
69035
|
-
symbolToString(prop),
|
|
69036
|
-
typeToString(getDeclaringClass(prop))
|
|
69037
|
-
);
|
|
68942
|
+
error(errorNode, Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(getDeclaringClass(prop)));
|
|
69038
68943
|
}
|
|
69039
68944
|
return false;
|
|
69040
68945
|
}
|
|
@@ -69043,12 +68948,7 @@ function createTypeChecker(host) {
|
|
|
69043
68948
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
69044
68949
|
if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) {
|
|
69045
68950
|
if (errorNode) {
|
|
69046
|
-
error(
|
|
69047
|
-
errorNode,
|
|
69048
|
-
Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor,
|
|
69049
|
-
symbolToString(prop),
|
|
69050
|
-
getTextOfIdentifierOrLiteral(declaringClassDeclaration.name)
|
|
69051
|
-
);
|
|
68951
|
+
error(errorNode, Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor, symbolToString(prop), getTextOfIdentifierOrLiteral(declaringClassDeclaration.name));
|
|
69052
68952
|
}
|
|
69053
68953
|
return false;
|
|
69054
68954
|
}
|
|
@@ -69060,12 +68960,7 @@ function createTypeChecker(host) {
|
|
|
69060
68960
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
69061
68961
|
if (!isNodeWithinClass(location, declaringClassDeclaration)) {
|
|
69062
68962
|
if (errorNode) {
|
|
69063
|
-
error(
|
|
69064
|
-
errorNode,
|
|
69065
|
-
Diagnostics.Property_0_is_private_and_only_accessible_within_class_1,
|
|
69066
|
-
symbolToString(prop),
|
|
69067
|
-
typeToString(getDeclaringClass(prop))
|
|
69068
|
-
);
|
|
68963
|
+
error(errorNode, Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(getDeclaringClass(prop)));
|
|
69069
68964
|
}
|
|
69070
68965
|
return false;
|
|
69071
68966
|
}
|
|
@@ -69083,12 +68978,7 @@ function createTypeChecker(host) {
|
|
|
69083
68978
|
enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
|
|
69084
68979
|
if (flags & 32 /* Static */ || !enclosingClass) {
|
|
69085
68980
|
if (errorNode) {
|
|
69086
|
-
error(
|
|
69087
|
-
errorNode,
|
|
69088
|
-
Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses,
|
|
69089
|
-
symbolToString(prop),
|
|
69090
|
-
typeToString(getDeclaringClass(prop) || containingType)
|
|
69091
|
-
);
|
|
68981
|
+
error(errorNode, Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || containingType));
|
|
69092
68982
|
}
|
|
69093
68983
|
return false;
|
|
69094
68984
|
}
|
|
@@ -69101,13 +68991,7 @@ function createTypeChecker(host) {
|
|
|
69101
68991
|
}
|
|
69102
68992
|
if (!containingType || !hasBaseType(containingType, enclosingClass)) {
|
|
69103
68993
|
if (errorNode) {
|
|
69104
|
-
error(
|
|
69105
|
-
errorNode,
|
|
69106
|
-
Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2,
|
|
69107
|
-
symbolToString(prop),
|
|
69108
|
-
typeToString(enclosingClass),
|
|
69109
|
-
typeToString(containingType)
|
|
69110
|
-
);
|
|
68994
|
+
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));
|
|
69111
68995
|
}
|
|
69112
68996
|
return false;
|
|
69113
68997
|
}
|
|
@@ -69519,10 +69403,7 @@ function createTypeChecker(host) {
|
|
|
69519
69403
|
diagnosticMessage = error(right, Diagnostics.Class_0_used_before_its_declaration, declarationName);
|
|
69520
69404
|
}
|
|
69521
69405
|
if (diagnosticMessage) {
|
|
69522
|
-
addRelatedInfo(
|
|
69523
|
-
diagnosticMessage,
|
|
69524
|
-
createDiagnosticForNode(valueDeclaration, Diagnostics._0_is_declared_here, declarationName)
|
|
69525
|
-
);
|
|
69406
|
+
addRelatedInfo(diagnosticMessage, createDiagnosticForNode(valueDeclaration, Diagnostics._0_is_declared_here, declarationName));
|
|
69526
69407
|
}
|
|
69527
69408
|
}
|
|
69528
69409
|
function isInPropertyInitializerOrClassStaticBlock(node) {
|
|
@@ -70462,12 +70343,7 @@ function createTypeChecker(host) {
|
|
|
70462
70343
|
forEach(getElementTypes(spreadType), (t, i2) => {
|
|
70463
70344
|
var _a;
|
|
70464
70345
|
const flags = spreadType.target.elementFlags[i2];
|
|
70465
|
-
const syntheticArg = createSyntheticExpression(
|
|
70466
|
-
arg,
|
|
70467
|
-
flags & 4 /* Rest */ ? createArrayType(t) : t,
|
|
70468
|
-
!!(flags & 12 /* Variable */),
|
|
70469
|
-
(_a = spreadType.target.labeledElementDeclarations) == null ? void 0 : _a[i2]
|
|
70470
|
-
);
|
|
70346
|
+
const syntheticArg = createSyntheticExpression(arg, flags & 4 /* Rest */ ? createArrayType(t) : t, !!(flags & 12 /* Variable */), (_a = spreadType.target.labeledElementDeclarations) == null ? void 0 : _a[i2]);
|
|
70471
70347
|
effectiveArgs.push(syntheticArg);
|
|
70472
70348
|
});
|
|
70473
70349
|
} else {
|
|
@@ -71385,10 +71261,7 @@ function createTypeChecker(host) {
|
|
|
71385
71261
|
const sigs = getSignaturesOfType(getTypeOfSymbol(getSymbolLinks(apparentType.symbol).target), kind);
|
|
71386
71262
|
if (!sigs || !sigs.length)
|
|
71387
71263
|
return;
|
|
71388
|
-
addRelatedInfo(
|
|
71389
|
-
diagnostic,
|
|
71390
|
-
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)
|
|
71391
|
-
);
|
|
71264
|
+
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));
|
|
71392
71265
|
}
|
|
71393
71266
|
}
|
|
71394
71267
|
function resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode) {
|
|
@@ -72015,12 +71888,7 @@ function createTypeChecker(host) {
|
|
|
72015
71888
|
addLazyDiagnostic(() => {
|
|
72016
71889
|
const widenedType = getWidenedType(exprType);
|
|
72017
71890
|
if (!isTypeComparableTo(targetType, widenedType)) {
|
|
72018
|
-
checkTypeComparableTo(
|
|
72019
|
-
exprType,
|
|
72020
|
-
targetType,
|
|
72021
|
-
errNode,
|
|
72022
|
-
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
|
|
72023
|
-
);
|
|
71891
|
+
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);
|
|
72024
71892
|
}
|
|
72025
71893
|
});
|
|
72026
71894
|
}
|
|
@@ -72394,7 +72262,14 @@ function createTypeChecker(host) {
|
|
|
72394
72262
|
if (declaration.type) {
|
|
72395
72263
|
const typeNode = getEffectiveTypeAnnotationNode(declaration);
|
|
72396
72264
|
if (typeNode) {
|
|
72397
|
-
|
|
72265
|
+
const source = addOptionality(
|
|
72266
|
+
getTypeFromTypeNode(typeNode),
|
|
72267
|
+
/*isProperty*/
|
|
72268
|
+
false,
|
|
72269
|
+
isOptionalDeclaration(declaration)
|
|
72270
|
+
);
|
|
72271
|
+
const target = getTypeAtPosition(context, i);
|
|
72272
|
+
inferTypes(inferenceContext.inferences, source, target);
|
|
72398
72273
|
}
|
|
72399
72274
|
}
|
|
72400
72275
|
}
|
|
@@ -72737,13 +72612,19 @@ function createTypeChecker(host) {
|
|
|
72737
72612
|
function createPromiseReturnType(func, promisedType) {
|
|
72738
72613
|
const promiseType = createPromiseType(promisedType);
|
|
72739
72614
|
if (promiseType === unknownType) {
|
|
72740
|
-
error(
|
|
72615
|
+
error(
|
|
72616
|
+
func,
|
|
72617
|
+
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
|
|
72618
|
+
);
|
|
72741
72619
|
return errorType;
|
|
72742
72620
|
} else if (!getGlobalPromiseConstructorSymbol(
|
|
72743
72621
|
/*reportErrors*/
|
|
72744
72622
|
true
|
|
72745
72623
|
)) {
|
|
72746
|
-
error(
|
|
72624
|
+
error(
|
|
72625
|
+
func,
|
|
72626
|
+
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
|
|
72627
|
+
);
|
|
72747
72628
|
}
|
|
72748
72629
|
return promiseType;
|
|
72749
72630
|
}
|
|
@@ -72926,7 +72807,11 @@ function createTypeChecker(host) {
|
|
|
72926
72807
|
function getYieldedTypeOfYieldExpression(node, expressionType, sentType, isAsync) {
|
|
72927
72808
|
const errorNode = node.expression || node;
|
|
72928
72809
|
const yieldedType = node.asteriskToken ? checkIteratedTypeOrElementType(isAsync ? 19 /* AsyncYieldStar */ : 17 /* YieldStar */, expressionType, sentType, errorNode) : expressionType;
|
|
72929
|
-
return !isAsync ? yieldedType : getAwaitedType(
|
|
72810
|
+
return !isAsync ? yieldedType : getAwaitedType(
|
|
72811
|
+
yieldedType,
|
|
72812
|
+
errorNode,
|
|
72813
|
+
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
|
|
72814
|
+
);
|
|
72930
72815
|
}
|
|
72931
72816
|
function getNotEqualFactsFromTypeofSwitch(start, end, witnesses) {
|
|
72932
72817
|
let facts = 0 /* None */;
|
|
@@ -73424,11 +73309,7 @@ function createTypeChecker(host) {
|
|
|
73424
73309
|
return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
|
|
73425
73310
|
case 46 /* PlusPlusToken */:
|
|
73426
73311
|
case 47 /* MinusMinusToken */:
|
|
73427
|
-
const ok = checkArithmeticOperandType(
|
|
73428
|
-
node.operand,
|
|
73429
|
-
checkNonNullType(operandType, node.operand),
|
|
73430
|
-
Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type
|
|
73431
|
-
);
|
|
73312
|
+
const ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type);
|
|
73432
73313
|
if (ok) {
|
|
73433
73314
|
checkReferenceExpression(
|
|
73434
73315
|
node.operand,
|
|
@@ -74021,7 +73902,9 @@ function createTypeChecker(host) {
|
|
|
74021
73902
|
}
|
|
74022
73903
|
if (!resultType) {
|
|
74023
73904
|
const closeEnoughKind = 296 /* NumberLike */ | 2112 /* BigIntLike */ | 402653316 /* StringLike */ | 3 /* AnyOrUnknown */;
|
|
74024
|
-
reportOperatorError(
|
|
73905
|
+
reportOperatorError(
|
|
73906
|
+
(left2, right2) => isTypeAssignableToKind(left2, closeEnoughKind) && isTypeAssignableToKind(right2, closeEnoughKind)
|
|
73907
|
+
);
|
|
74025
73908
|
return anyType;
|
|
74026
73909
|
}
|
|
74027
73910
|
if (operator === 65 /* PlusEqualsToken */) {
|
|
@@ -74185,11 +74068,7 @@ function createTypeChecker(host) {
|
|
|
74185
74068
|
true
|
|
74186
74069
|
);
|
|
74187
74070
|
}
|
|
74188
|
-
if (checkReferenceExpression(
|
|
74189
|
-
left,
|
|
74190
|
-
Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access,
|
|
74191
|
-
Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access
|
|
74192
|
-
)) {
|
|
74071
|
+
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)) {
|
|
74193
74072
|
let headMessage;
|
|
74194
74073
|
if (exactOptionalPropertyTypes && isPropertyAccessExpression(left) && maybeTypeOfKind(valueType, 32768 /* Undefined */)) {
|
|
74195
74074
|
const target = getTypeOfPropertyOfType(getTypeOfExpression(left.expression), left.name.escapedText);
|
|
@@ -74271,21 +74150,13 @@ function createTypeChecker(host) {
|
|
|
74271
74150
|
const isLeftNaN = isGlobalNaN(skipParentheses(left2));
|
|
74272
74151
|
const isRightNaN = isGlobalNaN(skipParentheses(right2));
|
|
74273
74152
|
if (isLeftNaN || isRightNaN) {
|
|
74274
|
-
const err = error(
|
|
74275
|
-
errorNode2,
|
|
74276
|
-
Diagnostics.This_condition_will_always_return_0,
|
|
74277
|
-
tokenToString(operator2 === 37 /* EqualsEqualsEqualsToken */ || operator2 === 35 /* EqualsEqualsToken */ ? 97 /* FalseKeyword */ : 112 /* TrueKeyword */)
|
|
74278
|
-
);
|
|
74153
|
+
const err = error(errorNode2, Diagnostics.This_condition_will_always_return_0, tokenToString(operator2 === 37 /* EqualsEqualsEqualsToken */ || operator2 === 35 /* EqualsEqualsToken */ ? 97 /* FalseKeyword */ : 112 /* TrueKeyword */));
|
|
74279
74154
|
if (isLeftNaN && isRightNaN)
|
|
74280
74155
|
return;
|
|
74281
74156
|
const operatorString = operator2 === 38 /* ExclamationEqualsEqualsToken */ || operator2 === 36 /* ExclamationEqualsToken */ ? tokenToString(54 /* ExclamationToken */) : "";
|
|
74282
74157
|
const location = isLeftNaN ? right2 : left2;
|
|
74283
74158
|
const expression = skipParentheses(location);
|
|
74284
|
-
addRelatedInfo(err, createDiagnosticForNode(
|
|
74285
|
-
location,
|
|
74286
|
-
Diagnostics.Did_you_mean_0,
|
|
74287
|
-
`${operatorString}Number.isNaN(${isEntityNameExpression(expression) ? entityNameToString(expression) : "..."})`
|
|
74288
|
-
));
|
|
74159
|
+
addRelatedInfo(err, createDiagnosticForNode(location, Diagnostics.Did_you_mean_0, `${operatorString}Number.isNaN(${isEntityNameExpression(expression) ? entityNameToString(expression) : "..."})`));
|
|
74289
74160
|
}
|
|
74290
74161
|
}
|
|
74291
74162
|
function isGlobalNaN(expr) {
|
|
@@ -75069,11 +74940,7 @@ function createTypeChecker(host) {
|
|
|
75069
74940
|
}
|
|
75070
74941
|
const name = element.name;
|
|
75071
74942
|
if (name.kind === 80 /* Identifier */ && name.escapedText === predicateVariableName) {
|
|
75072
|
-
error(
|
|
75073
|
-
predicateVariableNode,
|
|
75074
|
-
Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern,
|
|
75075
|
-
predicateVariableName
|
|
75076
|
-
);
|
|
74943
|
+
error(predicateVariableNode, Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
|
|
75077
74944
|
return true;
|
|
75078
74945
|
} else if (name.kind === 207 /* ArrayBindingPattern */ || name.kind === 206 /* ObjectBindingPattern */) {
|
|
75079
74946
|
if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(
|
|
@@ -75473,12 +75340,7 @@ function createTypeChecker(host) {
|
|
|
75473
75340
|
return getEffectiveTypeArguments(node, typeParameters)[index];
|
|
75474
75341
|
}
|
|
75475
75342
|
function getEffectiveTypeArguments(node, typeParameters) {
|
|
75476
|
-
return fillMissingTypeArguments(
|
|
75477
|
-
map(node.typeArguments, getTypeFromTypeNode),
|
|
75478
|
-
typeParameters,
|
|
75479
|
-
getMinTypeArgumentCount(typeParameters),
|
|
75480
|
-
isInJSFile(node)
|
|
75481
|
-
);
|
|
75343
|
+
return fillMissingTypeArguments(map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), isInJSFile(node));
|
|
75482
75344
|
}
|
|
75483
75345
|
function checkTypeArgumentConstraints(node, typeParameters) {
|
|
75484
75346
|
let typeArguments;
|
|
@@ -76293,12 +76155,7 @@ function createTypeChecker(host) {
|
|
|
76293
76155
|
const rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName);
|
|
76294
76156
|
const collidingSymbol = getSymbol(node.locals, rootName.escapedText, 111551 /* Value */);
|
|
76295
76157
|
if (collidingSymbol) {
|
|
76296
|
-
error(
|
|
76297
|
-
collidingSymbol.valueDeclaration,
|
|
76298
|
-
Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions,
|
|
76299
|
-
idText(rootName),
|
|
76300
|
-
entityNameToString(promiseConstructorName)
|
|
76301
|
-
);
|
|
76158
|
+
error(collidingSymbol.valueDeclaration, Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, idText(rootName), entityNameToString(promiseConstructorName));
|
|
76302
76159
|
return;
|
|
76303
76160
|
}
|
|
76304
76161
|
}
|
|
@@ -76901,7 +76758,11 @@ function createTypeChecker(host) {
|
|
|
76901
76758
|
const importDecl = importClause.parent;
|
|
76902
76759
|
const nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? importClause.namedBindings.kind === 274 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length : 0);
|
|
76903
76760
|
if (nDeclarations === unuseds.length) {
|
|
76904
|
-
addDiagnostic(
|
|
76761
|
+
addDiagnostic(
|
|
76762
|
+
importDecl,
|
|
76763
|
+
0 /* Local */,
|
|
76764
|
+
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)
|
|
76765
|
+
);
|
|
76905
76766
|
} else {
|
|
76906
76767
|
for (const unused of unuseds)
|
|
76907
76768
|
errorUnusedLocal(unused, idText(unused.name), addDiagnostic);
|
|
@@ -76913,7 +76774,11 @@ function createTypeChecker(host) {
|
|
|
76913
76774
|
if (bindingElements.length === 1 && bindingPattern.parent.kind === 260 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 261 /* VariableDeclarationList */) {
|
|
76914
76775
|
addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId);
|
|
76915
76776
|
} else {
|
|
76916
|
-
addDiagnostic(
|
|
76777
|
+
addDiagnostic(
|
|
76778
|
+
bindingPattern,
|
|
76779
|
+
kind,
|
|
76780
|
+
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)
|
|
76781
|
+
);
|
|
76917
76782
|
}
|
|
76918
76783
|
} else {
|
|
76919
76784
|
for (const e of bindingElements) {
|
|
@@ -76923,7 +76788,11 @@ function createTypeChecker(host) {
|
|
|
76923
76788
|
});
|
|
76924
76789
|
unusedVariables.forEach(([declarationList, declarations]) => {
|
|
76925
76790
|
if (declarationList.declarations.length === declarations.length) {
|
|
76926
|
-
addDiagnostic(
|
|
76791
|
+
addDiagnostic(
|
|
76792
|
+
declarationList,
|
|
76793
|
+
0 /* Local */,
|
|
76794
|
+
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)
|
|
76795
|
+
);
|
|
76927
76796
|
} else {
|
|
76928
76797
|
for (const decl of declarations) {
|
|
76929
76798
|
addDiagnostic(decl, 0 /* Local */, createDiagnosticForNode(decl, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(decl.name)));
|
|
@@ -77051,13 +76920,7 @@ function createTypeChecker(host) {
|
|
|
77051
76920
|
}
|
|
77052
76921
|
const parent = getDeclarationContainer(node);
|
|
77053
76922
|
if (parent.kind === 312 /* SourceFile */ && isExternalOrCommonJsModule(parent)) {
|
|
77054
|
-
errorSkippedOn(
|
|
77055
|
-
"noEmit",
|
|
77056
|
-
name,
|
|
77057
|
-
Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module,
|
|
77058
|
-
declarationNameToString(name),
|
|
77059
|
-
declarationNameToString(name)
|
|
77060
|
-
);
|
|
76923
|
+
errorSkippedOn("noEmit", name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, declarationNameToString(name), declarationNameToString(name));
|
|
77061
76924
|
}
|
|
77062
76925
|
}
|
|
77063
76926
|
function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) {
|
|
@@ -77069,13 +76932,7 @@ function createTypeChecker(host) {
|
|
|
77069
76932
|
}
|
|
77070
76933
|
const parent = getDeclarationContainer(node);
|
|
77071
76934
|
if (parent.kind === 312 /* SourceFile */ && isExternalOrCommonJsModule(parent) && parent.flags & 4096 /* HasAsyncFunctions */) {
|
|
77072
|
-
errorSkippedOn(
|
|
77073
|
-
"noEmit",
|
|
77074
|
-
name,
|
|
77075
|
-
Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions,
|
|
77076
|
-
declarationNameToString(name),
|
|
77077
|
-
declarationNameToString(name)
|
|
77078
|
-
);
|
|
76935
|
+
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));
|
|
77079
76936
|
}
|
|
77080
76937
|
}
|
|
77081
76938
|
function recordPotentialCollisionWithWeakMapSetInGeneratedCode(node, name) {
|
|
@@ -77116,13 +76973,7 @@ function createTypeChecker(host) {
|
|
|
77116
76973
|
}
|
|
77117
76974
|
if (hasCollision) {
|
|
77118
76975
|
Debug.assert(isNamedDeclaration(node) && isIdentifier(node.name), "The target of a Reflect collision check should be an identifier");
|
|
77119
|
-
errorSkippedOn(
|
|
77120
|
-
"noEmit",
|
|
77121
|
-
node,
|
|
77122
|
-
Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers,
|
|
77123
|
-
declarationNameToString(node.name),
|
|
77124
|
-
"Reflect"
|
|
77125
|
-
);
|
|
76976
|
+
errorSkippedOn("noEmit", node, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers, declarationNameToString(node.name), "Reflect");
|
|
77126
76977
|
}
|
|
77127
76978
|
}
|
|
77128
76979
|
function checkCollisionsForDeclarationName(node, name) {
|
|
@@ -77357,10 +77208,7 @@ function createTypeChecker(host) {
|
|
|
77357
77208
|
typeToString(nextType)
|
|
77358
77209
|
);
|
|
77359
77210
|
if (firstDeclaration) {
|
|
77360
|
-
addRelatedInfo(
|
|
77361
|
-
err,
|
|
77362
|
-
createDiagnosticForNode(firstDeclaration, Diagnostics._0_was_also_declared_here, declName)
|
|
77363
|
-
);
|
|
77211
|
+
addRelatedInfo(err, createDiagnosticForNode(firstDeclaration, Diagnostics._0_was_also_declared_here, declName));
|
|
77364
77212
|
}
|
|
77365
77213
|
}
|
|
77366
77214
|
function areDeclarationFlagsIdentical(left, right) {
|
|
@@ -77997,13 +77845,10 @@ function createTypeChecker(host) {
|
|
|
77997
77845
|
!!getAwaitedTypeOfPromise(type) || !allowAsyncIterables && isForOfStatement(errorNode.parent) && errorNode.parent.expression === errorNode && getGlobalAsyncIterableType(
|
|
77998
77846
|
/*reportErrors*/
|
|
77999
77847
|
false
|
|
78000
|
-
) !== emptyGenericType && isTypeAssignableTo(
|
|
78001
|
-
|
|
78002
|
-
|
|
78003
|
-
|
|
78004
|
-
false
|
|
78005
|
-
)
|
|
78006
|
-
)
|
|
77848
|
+
) !== emptyGenericType && isTypeAssignableTo(type, getGlobalAsyncIterableType(
|
|
77849
|
+
/*reportErrors*/
|
|
77850
|
+
false
|
|
77851
|
+
))
|
|
78007
77852
|
);
|
|
78008
77853
|
return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
|
|
78009
77854
|
}
|
|
@@ -78460,14 +78305,7 @@ function createTypeChecker(host) {
|
|
|
78460
78305
|
const localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfDeclaration(info.declaration)) === type.symbol ? info.declaration : void 0;
|
|
78461
78306
|
const errorNode = localPropDeclaration || localIndexDeclaration || (interfaceDeclaration && !some(getBaseTypes(type), (base) => !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType)) ? interfaceDeclaration : void 0);
|
|
78462
78307
|
if (errorNode && !isTypeAssignableTo(propType, info.type)) {
|
|
78463
|
-
const diagnostic = createError(
|
|
78464
|
-
errorNode,
|
|
78465
|
-
Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3,
|
|
78466
|
-
symbolToString(prop),
|
|
78467
|
-
typeToString(propType),
|
|
78468
|
-
typeToString(info.keyType),
|
|
78469
|
-
typeToString(info.type)
|
|
78470
|
-
);
|
|
78308
|
+
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));
|
|
78471
78309
|
if (propDeclaration && errorNode !== propDeclaration) {
|
|
78472
78310
|
addRelatedInfo(diagnostic, createDiagnosticForNode(propDeclaration, Diagnostics._0_is_declared_here, symbolToString(prop)));
|
|
78473
78311
|
}
|
|
@@ -78486,14 +78324,7 @@ function createTypeChecker(host) {
|
|
|
78486
78324
|
const localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfDeclaration(info.declaration)) === type.symbol ? info.declaration : void 0;
|
|
78487
78325
|
const errorNode = localCheckDeclaration || localIndexDeclaration || (interfaceDeclaration && !some(getBaseTypes(type), (base) => !!getIndexInfoOfType(base, checkInfo.keyType) && !!getIndexTypeOfType(base, info.keyType)) ? interfaceDeclaration : void 0);
|
|
78488
78326
|
if (errorNode && !isTypeAssignableTo(checkInfo.type, info.type)) {
|
|
78489
|
-
error(
|
|
78490
|
-
errorNode,
|
|
78491
|
-
Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3,
|
|
78492
|
-
typeToString(checkInfo.keyType),
|
|
78493
|
-
typeToString(checkInfo.type),
|
|
78494
|
-
typeToString(info.keyType),
|
|
78495
|
-
typeToString(info.type)
|
|
78496
|
-
);
|
|
78327
|
+
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));
|
|
78497
78328
|
}
|
|
78498
78329
|
}
|
|
78499
78330
|
}
|
|
@@ -78774,12 +78605,7 @@ function createTypeChecker(host) {
|
|
|
78774
78605
|
)) {
|
|
78775
78606
|
issueMemberSpecificError(node, typeWithThis, baseWithThis, Diagnostics.Class_0_incorrectly_extends_base_class_1);
|
|
78776
78607
|
} else {
|
|
78777
|
-
checkTypeAssignableTo(
|
|
78778
|
-
staticType,
|
|
78779
|
-
getTypeWithoutSignatures(staticBaseType),
|
|
78780
|
-
node.name || node,
|
|
78781
|
-
Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1
|
|
78782
|
-
);
|
|
78608
|
+
checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);
|
|
78783
78609
|
}
|
|
78784
78610
|
if (baseConstructorType.flags & 8650752 /* TypeVariable */) {
|
|
78785
78611
|
if (!isMixinConstructorType(staticType)) {
|
|
@@ -79342,7 +79168,10 @@ function createTypeChecker(host) {
|
|
|
79342
79168
|
const value = evaluate(initializer, member);
|
|
79343
79169
|
if (value !== void 0) {
|
|
79344
79170
|
if (isConstEnum && typeof value === "number" && !isFinite(value)) {
|
|
79345
|
-
error(
|
|
79171
|
+
error(
|
|
79172
|
+
initializer,
|
|
79173
|
+
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
|
|
79174
|
+
);
|
|
79346
79175
|
}
|
|
79347
79176
|
} else if (isConstEnum) {
|
|
79348
79177
|
error(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
|
|
@@ -79709,7 +79538,10 @@ function createTypeChecker(host) {
|
|
|
79709
79538
|
}
|
|
79710
79539
|
const inAmbientExternalModule = node.parent.kind === 268 /* ModuleBlock */ && isAmbientModule(node.parent.parent);
|
|
79711
79540
|
if (node.parent.kind !== 312 /* SourceFile */ && !inAmbientExternalModule) {
|
|
79712
|
-
error(
|
|
79541
|
+
error(
|
|
79542
|
+
moduleName,
|
|
79543
|
+
node.kind === 278 /* ExportDeclaration */ ? Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module
|
|
79544
|
+
);
|
|
79713
79545
|
return false;
|
|
79714
79546
|
}
|
|
79715
79547
|
if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) {
|
|
@@ -79745,11 +79577,14 @@ function createTypeChecker(host) {
|
|
|
79745
79577
|
if (alreadyExportedSymbol === target) {
|
|
79746
79578
|
const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
|
|
79747
79579
|
if (exportingDeclaration) {
|
|
79748
|
-
addRelatedInfo(
|
|
79749
|
-
|
|
79750
|
-
|
|
79751
|
-
|
|
79752
|
-
|
|
79580
|
+
addRelatedInfo(
|
|
79581
|
+
diag2,
|
|
79582
|
+
createDiagnosticForNode(
|
|
79583
|
+
exportingDeclaration,
|
|
79584
|
+
Diagnostics._0_is_automatically_exported_here,
|
|
79585
|
+
unescapeLeadingUnderscores(alreadyExportedSymbol.escapedName)
|
|
79586
|
+
)
|
|
79587
|
+
);
|
|
79753
79588
|
}
|
|
79754
79589
|
}
|
|
79755
79590
|
} else {
|
|
@@ -79870,7 +79705,7 @@ function createTypeChecker(host) {
|
|
|
79870
79705
|
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */) {
|
|
79871
79706
|
return grammarErrorOnNode(
|
|
79872
79707
|
declaration.assertClause,
|
|
79873
|
-
moduleKind === 199 /* NodeNext */ ? Diagnostics.
|
|
79708
|
+
moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_transpile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext
|
|
79874
79709
|
);
|
|
79875
79710
|
}
|
|
79876
79711
|
if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
|
|
@@ -80416,9 +80251,14 @@ function createTypeChecker(host) {
|
|
|
80416
80251
|
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;
|
|
80417
80252
|
const typeNode = node.type;
|
|
80418
80253
|
const type = getTypeFromTypeNode(typeNode);
|
|
80419
|
-
grammarErrorOnNode(
|
|
80420
|
-
|
|
80421
|
-
|
|
80254
|
+
grammarErrorOnNode(
|
|
80255
|
+
node,
|
|
80256
|
+
diagnostic,
|
|
80257
|
+
token,
|
|
80258
|
+
typeToString(
|
|
80259
|
+
isJSDocNullableType(node) && !(type === neverType || type === voidType) ? getUnionType(append([type, undefinedType], node.postfix ? void 0 : nullType)) : type
|
|
80260
|
+
)
|
|
80261
|
+
);
|
|
80422
80262
|
} else {
|
|
80423
80263
|
grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
|
|
80424
80264
|
}
|
|
@@ -83132,10 +82972,7 @@ function createTypeChecker(host) {
|
|
|
83132
82972
|
if (isInTopLevelContext(forInOrOfStatement)) {
|
|
83133
82973
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
83134
82974
|
if (!isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
83135
|
-
diagnostics.add(createDiagnosticForNode(
|
|
83136
|
-
forInOrOfStatement.awaitModifier,
|
|
83137
|
-
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
|
|
83138
|
-
));
|
|
82975
|
+
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));
|
|
83139
82976
|
}
|
|
83140
82977
|
switch (moduleKind) {
|
|
83141
82978
|
case 100 /* Node16 */:
|
|
@@ -83154,10 +82991,7 @@ function createTypeChecker(host) {
|
|
|
83154
82991
|
}
|
|
83155
82992
|
default:
|
|
83156
82993
|
diagnostics.add(
|
|
83157
|
-
createDiagnosticForNode(
|
|
83158
|
-
forInOrOfStatement.awaitModifier,
|
|
83159
|
-
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
|
|
83160
|
-
)
|
|
82994
|
+
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)
|
|
83161
82995
|
);
|
|
83162
82996
|
break;
|
|
83163
82997
|
}
|
|
@@ -87015,10 +86849,7 @@ function createTemplateCooked(factory2, template) {
|
|
|
87015
86849
|
function getRawLiteral(factory2, node, currentSourceFile) {
|
|
87016
86850
|
let text = node.rawText;
|
|
87017
86851
|
if (text === void 0) {
|
|
87018
|
-
Debug.assertIsDefined(
|
|
87019
|
-
currentSourceFile,
|
|
87020
|
-
"Template literal node is missing 'rawText' and does not have a source file. Possibly bad transform."
|
|
87021
|
-
);
|
|
86852
|
+
Debug.assertIsDefined(currentSourceFile, "Template literal node is missing 'rawText' and does not have a source file. Possibly bad transform.");
|
|
87022
86853
|
text = getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
|
|
87023
86854
|
const isLast = node.kind === 15 /* NoSubstitutionTemplateLiteral */ || node.kind === 18 /* TemplateTail */;
|
|
87024
86855
|
text = text.substring(1, text.length - (isLast ? 1 : 2));
|
|
@@ -87066,12 +86897,15 @@ function transformTypeScript(context) {
|
|
|
87066
86897
|
return transformSourceFile(node);
|
|
87067
86898
|
}
|
|
87068
86899
|
function transformBundle(node) {
|
|
87069
|
-
return factory2.createBundle(
|
|
87070
|
-
|
|
87071
|
-
|
|
87072
|
-
|
|
87073
|
-
|
|
87074
|
-
|
|
86900
|
+
return factory2.createBundle(
|
|
86901
|
+
node.sourceFiles.map(transformSourceFile),
|
|
86902
|
+
mapDefined(node.prepends, (prepend) => {
|
|
86903
|
+
if (prepend.kind === 315 /* InputFiles */) {
|
|
86904
|
+
return createUnparsedSourceFile(prepend, "js");
|
|
86905
|
+
}
|
|
86906
|
+
return prepend;
|
|
86907
|
+
})
|
|
86908
|
+
);
|
|
87075
86909
|
}
|
|
87076
86910
|
function transformSourceFile(node) {
|
|
87077
86911
|
if (node.isDeclarationFile) {
|
|
@@ -91519,16 +91353,19 @@ function transformLegacyDecorators(context) {
|
|
|
91519
91353
|
true
|
|
91520
91354
|
);
|
|
91521
91355
|
if (hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node)) {
|
|
91522
|
-
members = setTextRange(
|
|
91523
|
-
|
|
91524
|
-
|
|
91525
|
-
factory2.
|
|
91526
|
-
|
|
91527
|
-
|
|
91528
|
-
|
|
91356
|
+
members = setTextRange(
|
|
91357
|
+
factory2.createNodeArray([
|
|
91358
|
+
...members,
|
|
91359
|
+
factory2.createClassStaticBlockDeclaration(
|
|
91360
|
+
factory2.createBlock(
|
|
91361
|
+
decorationStatements,
|
|
91362
|
+
/*multiLine*/
|
|
91363
|
+
true
|
|
91364
|
+
)
|
|
91529
91365
|
)
|
|
91530
|
-
)
|
|
91531
|
-
|
|
91366
|
+
]),
|
|
91367
|
+
members
|
|
91368
|
+
);
|
|
91532
91369
|
decorationStatements = void 0;
|
|
91533
91370
|
}
|
|
91534
91371
|
return { decorationStatements, members };
|
|
@@ -91575,16 +91412,19 @@ function transformLegacyDecorators(context) {
|
|
|
91575
91412
|
({ members, decorationStatements } = transformDecoratorsOfClassElements(node, members));
|
|
91576
91413
|
const assignClassAliasInStaticBlock = languageVersion >= 9 /* ES2022 */ && !!classAlias && some(members, (member) => isPropertyDeclaration(member) && hasSyntacticModifier(member, 32 /* Static */) || isClassStaticBlockDeclaration(member));
|
|
91577
91414
|
if (assignClassAliasInStaticBlock) {
|
|
91578
|
-
members = setTextRange(
|
|
91579
|
-
factory2.
|
|
91580
|
-
factory2.
|
|
91581
|
-
factory2.
|
|
91582
|
-
factory2.
|
|
91583
|
-
|
|
91584
|
-
|
|
91585
|
-
|
|
91586
|
-
|
|
91587
|
-
|
|
91415
|
+
members = setTextRange(
|
|
91416
|
+
factory2.createNodeArray([
|
|
91417
|
+
factory2.createClassStaticBlockDeclaration(
|
|
91418
|
+
factory2.createBlock([
|
|
91419
|
+
factory2.createExpressionStatement(
|
|
91420
|
+
factory2.createAssignment(classAlias, factory2.createThis())
|
|
91421
|
+
)
|
|
91422
|
+
])
|
|
91423
|
+
),
|
|
91424
|
+
...members
|
|
91425
|
+
]),
|
|
91426
|
+
members
|
|
91427
|
+
);
|
|
91588
91428
|
}
|
|
91589
91429
|
const classExpression = factory2.createClassExpression(
|
|
91590
91430
|
modifiers,
|
|
@@ -91656,55 +91496,67 @@ function transformLegacyDecorators(context) {
|
|
|
91656
91496
|
return updated;
|
|
91657
91497
|
}
|
|
91658
91498
|
function visitMethodDeclaration(node) {
|
|
91659
|
-
return finishClassElement(
|
|
91660
|
-
|
|
91661
|
-
|
|
91662
|
-
|
|
91663
|
-
|
|
91664
|
-
|
|
91665
|
-
|
|
91666
|
-
|
|
91667
|
-
|
|
91668
|
-
|
|
91669
|
-
|
|
91670
|
-
|
|
91671
|
-
|
|
91672
|
-
|
|
91499
|
+
return finishClassElement(
|
|
91500
|
+
factory2.updateMethodDeclaration(
|
|
91501
|
+
node,
|
|
91502
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
91503
|
+
node.asteriskToken,
|
|
91504
|
+
Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
|
|
91505
|
+
/*questionToken*/
|
|
91506
|
+
void 0,
|
|
91507
|
+
/*typeParameters*/
|
|
91508
|
+
void 0,
|
|
91509
|
+
visitNodes2(node.parameters, visitor, isParameter),
|
|
91510
|
+
/*type*/
|
|
91511
|
+
void 0,
|
|
91512
|
+
visitNode(node.body, visitor, isBlock)
|
|
91513
|
+
),
|
|
91514
|
+
node
|
|
91515
|
+
);
|
|
91673
91516
|
}
|
|
91674
91517
|
function visitGetAccessorDeclaration(node) {
|
|
91675
|
-
return finishClassElement(
|
|
91676
|
-
|
|
91677
|
-
|
|
91678
|
-
|
|
91679
|
-
|
|
91680
|
-
|
|
91681
|
-
|
|
91682
|
-
|
|
91683
|
-
|
|
91518
|
+
return finishClassElement(
|
|
91519
|
+
factory2.updateGetAccessorDeclaration(
|
|
91520
|
+
node,
|
|
91521
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
91522
|
+
Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
|
|
91523
|
+
visitNodes2(node.parameters, visitor, isParameter),
|
|
91524
|
+
/*type*/
|
|
91525
|
+
void 0,
|
|
91526
|
+
visitNode(node.body, visitor, isBlock)
|
|
91527
|
+
),
|
|
91528
|
+
node
|
|
91529
|
+
);
|
|
91684
91530
|
}
|
|
91685
91531
|
function visitSetAccessorDeclaration(node) {
|
|
91686
|
-
return finishClassElement(
|
|
91687
|
-
|
|
91688
|
-
|
|
91689
|
-
|
|
91690
|
-
|
|
91691
|
-
|
|
91692
|
-
|
|
91532
|
+
return finishClassElement(
|
|
91533
|
+
factory2.updateSetAccessorDeclaration(
|
|
91534
|
+
node,
|
|
91535
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
91536
|
+
Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
|
|
91537
|
+
visitNodes2(node.parameters, visitor, isParameter),
|
|
91538
|
+
visitNode(node.body, visitor, isBlock)
|
|
91539
|
+
),
|
|
91540
|
+
node
|
|
91541
|
+
);
|
|
91693
91542
|
}
|
|
91694
91543
|
function visitPropertyDeclaration(node) {
|
|
91695
91544
|
if (node.flags & 33554432 /* Ambient */ || hasSyntacticModifier(node, 2 /* Ambient */)) {
|
|
91696
91545
|
return void 0;
|
|
91697
91546
|
}
|
|
91698
|
-
return finishClassElement(
|
|
91699
|
-
|
|
91700
|
-
|
|
91701
|
-
|
|
91702
|
-
|
|
91703
|
-
|
|
91704
|
-
|
|
91705
|
-
|
|
91706
|
-
|
|
91707
|
-
|
|
91547
|
+
return finishClassElement(
|
|
91548
|
+
factory2.updatePropertyDeclaration(
|
|
91549
|
+
node,
|
|
91550
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
91551
|
+
Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)),
|
|
91552
|
+
/*questionOrExclamationToken*/
|
|
91553
|
+
void 0,
|
|
91554
|
+
/*type*/
|
|
91555
|
+
void 0,
|
|
91556
|
+
visitNode(node.initializer, visitor, isExpression)
|
|
91557
|
+
),
|
|
91558
|
+
node
|
|
91559
|
+
);
|
|
91708
91560
|
}
|
|
91709
91561
|
function visitParameterDeclaration(node) {
|
|
91710
91562
|
const updated = factory2.updateParameterDeclaration(
|
|
@@ -92287,7 +92139,10 @@ function transformESDecorators(context) {
|
|
|
92287
92139
|
classInfo2.classDescriptorName = factory2.createUniqueName("_classDescriptor", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
92288
92140
|
classInfo2.classExtraInitializersName = factory2.createUniqueName("_classExtraInitializers", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
92289
92141
|
const needsUniqueClassThis = some(node.members, (member) => (isPrivateIdentifierClassElementDeclaration(member) || isAutoAccessorPropertyDeclaration(member)) && hasStaticModifier(member));
|
|
92290
|
-
classInfo2.classThis = factory2.createUniqueName(
|
|
92142
|
+
classInfo2.classThis = factory2.createUniqueName(
|
|
92143
|
+
"_classThis",
|
|
92144
|
+
needsUniqueClassThis ? 16 /* Optimistic */ | 8 /* ReservedInNestedScopes */ : 16 /* Optimistic */ | 32 /* FileLevel */
|
|
92145
|
+
);
|
|
92291
92146
|
classDefinitionStatements.push(
|
|
92292
92147
|
createLet(classInfo2.classDecoratorsName, factory2.createArrayLiteralExpression(classDecorators)),
|
|
92293
92148
|
createLet(classInfo2.classDescriptorName),
|
|
@@ -94694,9 +94549,12 @@ function transformES2018(context) {
|
|
|
94694
94549
|
}
|
|
94695
94550
|
function visitReturnStatement(node) {
|
|
94696
94551
|
if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) {
|
|
94697
|
-
return factory2.updateReturnStatement(
|
|
94698
|
-
node
|
|
94699
|
-
|
|
94552
|
+
return factory2.updateReturnStatement(
|
|
94553
|
+
node,
|
|
94554
|
+
createDownlevelAwait(
|
|
94555
|
+
node.expression ? visitNode(node.expression, visitor, isExpression) : factory2.createVoidZero()
|
|
94556
|
+
)
|
|
94557
|
+
);
|
|
94700
94558
|
}
|
|
94701
94559
|
return visitEachChild(node, visitor, context);
|
|
94702
94560
|
}
|
|
@@ -94722,7 +94580,10 @@ function transformES2018(context) {
|
|
|
94722
94580
|
const target = e.expression;
|
|
94723
94581
|
objects.push(visitNode(target, visitor, isExpression));
|
|
94724
94582
|
} else {
|
|
94725
|
-
chunkObject = append(
|
|
94583
|
+
chunkObject = append(
|
|
94584
|
+
chunkObject,
|
|
94585
|
+
e.kind === 303 /* PropertyAssignment */ ? factory2.createPropertyAssignment(e.name, visitNode(e.initializer, visitor, isExpression)) : visitNode(e, visitor, isObjectLiteralElementLike)
|
|
94586
|
+
);
|
|
94726
94587
|
}
|
|
94727
94588
|
}
|
|
94728
94589
|
if (chunkObject) {
|
|
@@ -94761,13 +94622,16 @@ function transformES2018(context) {
|
|
|
94761
94622
|
);
|
|
94762
94623
|
exportedVariableStatement = false;
|
|
94763
94624
|
const visited = visitEachChild(node, visitor, context);
|
|
94764
|
-
const statement = concatenate(
|
|
94765
|
-
|
|
94766
|
-
|
|
94767
|
-
|
|
94768
|
-
|
|
94769
|
-
|
|
94770
|
-
|
|
94625
|
+
const statement = concatenate(
|
|
94626
|
+
visited.statements,
|
|
94627
|
+
taggedTemplateStringDeclarations && [
|
|
94628
|
+
factory2.createVariableStatement(
|
|
94629
|
+
/*modifiers*/
|
|
94630
|
+
void 0,
|
|
94631
|
+
factory2.createVariableDeclarationList(taggedTemplateStringDeclarations)
|
|
94632
|
+
)
|
|
94633
|
+
]
|
|
94634
|
+
);
|
|
94771
94635
|
const result = factory2.updateSourceFile(visited, setTextRange(factory2.createNodeArray(statement), node.statements));
|
|
94772
94636
|
exitSubtree(ancestorFacts);
|
|
94773
94637
|
return result;
|
|
@@ -95893,15 +95757,18 @@ function transformES2020(context) {
|
|
|
95893
95757
|
right = factory2.createTempVariable(hoistVariableDeclaration);
|
|
95894
95758
|
left = factory2.createAssignment(right, left);
|
|
95895
95759
|
}
|
|
95896
|
-
return setTextRange(
|
|
95897
|
-
|
|
95898
|
-
|
|
95899
|
-
|
|
95900
|
-
|
|
95901
|
-
|
|
95902
|
-
|
|
95903
|
-
|
|
95904
|
-
|
|
95760
|
+
return setTextRange(
|
|
95761
|
+
factory2.createConditionalExpression(
|
|
95762
|
+
createNotNullCondition(left, right),
|
|
95763
|
+
/*questionToken*/
|
|
95764
|
+
void 0,
|
|
95765
|
+
right,
|
|
95766
|
+
/*colonToken*/
|
|
95767
|
+
void 0,
|
|
95768
|
+
visitNode(node.right, visitor, isExpression)
|
|
95769
|
+
),
|
|
95770
|
+
node
|
|
95771
|
+
);
|
|
95905
95772
|
}
|
|
95906
95773
|
function visitDeleteExpression(node) {
|
|
95907
95774
|
return isOptionalChain(skipParentheses(node.expression)) ? setOriginalNode(visitNonOptionalExpression(
|
|
@@ -96055,13 +95922,16 @@ function transformESNext(context) {
|
|
|
96055
95922
|
const envBinding = createEnvBinding();
|
|
96056
95923
|
const bodyStatements = transformUsingDeclarations(node.statements, pos, node.statements.length, envBinding, topLevelStatements);
|
|
96057
95924
|
if (exportBindings.size) {
|
|
96058
|
-
append(
|
|
96059
|
-
|
|
96060
|
-
|
|
96061
|
-
|
|
96062
|
-
|
|
96063
|
-
|
|
96064
|
-
|
|
95925
|
+
append(
|
|
95926
|
+
topLevelStatements,
|
|
95927
|
+
factory2.createExportDeclaration(
|
|
95928
|
+
/*modifiers*/
|
|
95929
|
+
void 0,
|
|
95930
|
+
/*isTypeOnly*/
|
|
95931
|
+
false,
|
|
95932
|
+
factory2.createNamedExports(arrayFrom(exportBindings.values()))
|
|
95933
|
+
)
|
|
95934
|
+
);
|
|
96065
95935
|
}
|
|
96066
95936
|
addRange(topLevelStatements, endLexicalEnvironment());
|
|
96067
95937
|
if (exportVars.length) {
|
|
@@ -96825,7 +96695,9 @@ function transformJsx(context) {
|
|
|
96825
96695
|
}
|
|
96826
96696
|
}
|
|
96827
96697
|
function hasProto(obj) {
|
|
96828
|
-
return obj.properties.some(
|
|
96698
|
+
return obj.properties.some(
|
|
96699
|
+
(p) => isPropertyAssignment(p) && (isIdentifier(p.name) && idText(p.name) === "__proto__" || isStringLiteral(p.name) && p.name.text === "__proto__")
|
|
96700
|
+
);
|
|
96829
96701
|
}
|
|
96830
96702
|
function hasKeyAfterPropsSpread(node) {
|
|
96831
96703
|
let spread = false;
|
|
@@ -97847,10 +97719,13 @@ function transformES2015(context) {
|
|
|
97847
97719
|
}
|
|
97848
97720
|
}
|
|
97849
97721
|
if (node.flags & 256 /* IdentifierHasExtendedUnicodeEscape */) {
|
|
97850
|
-
return setOriginalNode(
|
|
97851
|
-
|
|
97722
|
+
return setOriginalNode(
|
|
97723
|
+
setTextRange(
|
|
97724
|
+
factory2.createIdentifier(unescapeLeadingUnderscores(node.escapedText)),
|
|
97725
|
+
node
|
|
97726
|
+
),
|
|
97852
97727
|
node
|
|
97853
|
-
)
|
|
97728
|
+
);
|
|
97854
97729
|
}
|
|
97855
97730
|
return node;
|
|
97856
97731
|
}
|
|
@@ -99029,7 +98904,11 @@ function transformES2015(context) {
|
|
|
99029
98904
|
if (node.flags & 7 /* BlockScoped */) {
|
|
99030
98905
|
enableSubstitutionsForBlockScopedBindings();
|
|
99031
98906
|
}
|
|
99032
|
-
const declarations = visitNodes2(
|
|
98907
|
+
const declarations = visitNodes2(
|
|
98908
|
+
node.declarations,
|
|
98909
|
+
node.flags & 1 /* Let */ ? visitVariableDeclarationInLetDeclarationList : visitVariableDeclaration,
|
|
98910
|
+
isVariableDeclaration
|
|
98911
|
+
);
|
|
99033
98912
|
const declarationList = factory2.createVariableDeclarationList(declarations);
|
|
99034
98913
|
setOriginalNode(declarationList, node);
|
|
99035
98914
|
setTextRange(declarationList, node);
|
|
@@ -100472,11 +100351,7 @@ function transformES2015(context) {
|
|
|
100472
100351
|
// As we visit each element, we return one of two functions to use as the "key":
|
|
100473
100352
|
// - `visitSpanOfSpreads` for one or more contiguous `...` spread expressions, i.e. `...a, ...b` in `[1, 2, ...a, ...b]`
|
|
100474
100353
|
// - `visitSpanOfNonSpreads` for one or more contiguous non-spread elements, i.e. `1, 2`, in `[1, 2, ...a, ...b]`
|
|
100475
|
-
spanMap(
|
|
100476
|
-
elements,
|
|
100477
|
-
partitionSpread,
|
|
100478
|
-
(partition, visitPartition, _start, end) => visitPartition(partition, multiLine, hasTrailingComma && end === numElements)
|
|
100479
|
-
)
|
|
100354
|
+
spanMap(elements, partitionSpread, (partition, visitPartition, _start, end) => visitPartition(partition, multiLine, hasTrailingComma && end === numElements))
|
|
100480
100355
|
);
|
|
100481
100356
|
if (segments.length === 1) {
|
|
100482
100357
|
const firstSegment = segments[0];
|
|
@@ -101128,11 +101003,7 @@ function transformGenerators(context) {
|
|
|
101128
101003
|
);
|
|
101129
101004
|
break;
|
|
101130
101005
|
case 212 /* ElementAccessExpression */:
|
|
101131
|
-
target = factory2.updateElementAccessExpression(
|
|
101132
|
-
left,
|
|
101133
|
-
cacheExpression(Debug.checkDefined(visitNode(left.expression, visitor, isLeftHandSideExpression))),
|
|
101134
|
-
cacheExpression(Debug.checkDefined(visitNode(left.argumentExpression, visitor, isExpression)))
|
|
101135
|
-
);
|
|
101006
|
+
target = factory2.updateElementAccessExpression(left, cacheExpression(Debug.checkDefined(visitNode(left.expression, visitor, isLeftHandSideExpression))), cacheExpression(Debug.checkDefined(visitNode(left.argumentExpression, visitor, isExpression))));
|
|
101136
101007
|
break;
|
|
101137
101008
|
default:
|
|
101138
101009
|
target = Debug.checkDefined(visitNode(left, visitor, isExpression));
|
|
@@ -101167,12 +101038,7 @@ function transformGenerators(context) {
|
|
|
101167
101038
|
} else if (node.operatorToken.kind === 28 /* CommaToken */) {
|
|
101168
101039
|
return visitCommaExpression(node);
|
|
101169
101040
|
}
|
|
101170
|
-
return factory2.updateBinaryExpression(
|
|
101171
|
-
node,
|
|
101172
|
-
cacheExpression(Debug.checkDefined(visitNode(node.left, visitor, isExpression))),
|
|
101173
|
-
node.operatorToken,
|
|
101174
|
-
Debug.checkDefined(visitNode(node.right, visitor, isExpression))
|
|
101175
|
-
);
|
|
101041
|
+
return factory2.updateBinaryExpression(node, cacheExpression(Debug.checkDefined(visitNode(node.left, visitor, isExpression))), node.operatorToken, Debug.checkDefined(visitNode(node.right, visitor, isExpression)));
|
|
101176
101042
|
}
|
|
101177
101043
|
return visitEachChild(node, visitor, context);
|
|
101178
101044
|
}
|
|
@@ -101380,11 +101246,7 @@ function transformGenerators(context) {
|
|
|
101380
101246
|
}
|
|
101381
101247
|
function visitElementAccessExpression(node) {
|
|
101382
101248
|
if (containsYield(node.argumentExpression)) {
|
|
101383
|
-
return factory2.updateElementAccessExpression(
|
|
101384
|
-
node,
|
|
101385
|
-
cacheExpression(Debug.checkDefined(visitNode(node.expression, visitor, isLeftHandSideExpression))),
|
|
101386
|
-
Debug.checkDefined(visitNode(node.argumentExpression, visitor, isExpression))
|
|
101387
|
-
);
|
|
101249
|
+
return factory2.updateElementAccessExpression(node, cacheExpression(Debug.checkDefined(visitNode(node.expression, visitor, isLeftHandSideExpression))), Debug.checkDefined(visitNode(node.argumentExpression, visitor, isExpression)));
|
|
101388
101250
|
}
|
|
101389
101251
|
return visitEachChild(node, visitor, context);
|
|
101390
101252
|
}
|
|
@@ -101742,12 +101604,7 @@ function transformGenerators(context) {
|
|
|
101742
101604
|
for (const variable of initializer.declarations) {
|
|
101743
101605
|
hoistVariableDeclaration(variable.name);
|
|
101744
101606
|
}
|
|
101745
|
-
node = factory2.updateForInStatement(
|
|
101746
|
-
node,
|
|
101747
|
-
initializer.declarations[0].name,
|
|
101748
|
-
Debug.checkDefined(visitNode(node.expression, visitor, isExpression)),
|
|
101749
|
-
Debug.checkDefined(visitNode(node.statement, visitor, isStatement, factory2.liftToBlock))
|
|
101750
|
-
);
|
|
101607
|
+
node = factory2.updateForInStatement(node, initializer.declarations[0].name, Debug.checkDefined(visitNode(node.expression, visitor, isExpression)), Debug.checkDefined(visitNode(node.statement, visitor, isStatement, factory2.liftToBlock)));
|
|
101751
101608
|
} else {
|
|
101752
101609
|
node = visitEachChild(node, visitor, context);
|
|
101753
101610
|
}
|
|
@@ -102908,12 +102765,14 @@ function transformModule(context) {
|
|
|
102908
102765
|
// Add the dependency array argument:
|
|
102909
102766
|
//
|
|
102910
102767
|
// ["require", "exports", module1", "module2", ...]
|
|
102911
|
-
factory2.createArrayLiteralExpression(
|
|
102912
|
-
|
|
102913
|
-
|
|
102914
|
-
|
|
102915
|
-
|
|
102916
|
-
|
|
102768
|
+
factory2.createArrayLiteralExpression(
|
|
102769
|
+
jsonSourceFile ? emptyArray : [
|
|
102770
|
+
factory2.createStringLiteral("require"),
|
|
102771
|
+
factory2.createStringLiteral("exports"),
|
|
102772
|
+
...aliasedModuleNames,
|
|
102773
|
+
...unaliasedModuleNames
|
|
102774
|
+
]
|
|
102775
|
+
),
|
|
102917
102776
|
// Add the module body function argument:
|
|
102918
102777
|
//
|
|
102919
102778
|
// function (require, exports, module1, module2) ...
|
|
@@ -103639,22 +103498,25 @@ function transformModule(context) {
|
|
|
103639
103498
|
);
|
|
103640
103499
|
} else {
|
|
103641
103500
|
const temp = factory2.createTempVariable(hoistVariableDeclaration);
|
|
103642
|
-
return factory2.createComma(
|
|
103643
|
-
|
|
103644
|
-
factory2.
|
|
103645
|
-
|
|
103646
|
-
|
|
103647
|
-
|
|
103648
|
-
|
|
103649
|
-
|
|
103650
|
-
|
|
103651
|
-
|
|
103652
|
-
|
|
103653
|
-
|
|
103654
|
-
|
|
103655
|
-
|
|
103656
|
-
|
|
103657
|
-
|
|
103501
|
+
return factory2.createComma(
|
|
103502
|
+
factory2.createAssignment(temp, arg),
|
|
103503
|
+
factory2.createConditionalExpression(
|
|
103504
|
+
/*condition*/
|
|
103505
|
+
factory2.createIdentifier("__syncRequire"),
|
|
103506
|
+
/*questionToken*/
|
|
103507
|
+
void 0,
|
|
103508
|
+
/*whenTrue*/
|
|
103509
|
+
createImportCallExpressionCommonJS(
|
|
103510
|
+
temp,
|
|
103511
|
+
/*isInlineable*/
|
|
103512
|
+
true
|
|
103513
|
+
),
|
|
103514
|
+
/*colonToken*/
|
|
103515
|
+
void 0,
|
|
103516
|
+
/*whenFalse*/
|
|
103517
|
+
createImportCallExpressionAMD(temp, containsLexicalThis)
|
|
103518
|
+
)
|
|
103519
|
+
);
|
|
103658
103520
|
}
|
|
103659
103521
|
}
|
|
103660
103522
|
function createImportCallExpressionAMD(arg, containsLexicalThis) {
|
|
@@ -104095,7 +103957,10 @@ function transformModule(context) {
|
|
|
104095
103957
|
factory2.createExpressionStatement(
|
|
104096
103958
|
createExportExpression(
|
|
104097
103959
|
factory2.cloneNode(node.exportClause.name),
|
|
104098
|
-
getHelperExpressionForExport(
|
|
103960
|
+
getHelperExpressionForExport(
|
|
103961
|
+
node,
|
|
103962
|
+
moduleKind !== 2 /* AMD */ ? createRequireCall(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : factory2.createIdentifier(idText(node.exportClause.name))
|
|
103963
|
+
)
|
|
104099
103964
|
)
|
|
104100
103965
|
),
|
|
104101
103966
|
node
|
|
@@ -104487,21 +104352,24 @@ function transformModule(context) {
|
|
|
104487
104352
|
factory2.createStringLiteralFromNode(name),
|
|
104488
104353
|
factory2.createObjectLiteralExpression([
|
|
104489
104354
|
factory2.createPropertyAssignment("enumerable", factory2.createTrue()),
|
|
104490
|
-
factory2.createPropertyAssignment(
|
|
104491
|
-
|
|
104492
|
-
|
|
104493
|
-
|
|
104494
|
-
|
|
104495
|
-
|
|
104496
|
-
|
|
104497
|
-
|
|
104498
|
-
|
|
104499
|
-
|
|
104500
|
-
|
|
104501
|
-
|
|
104502
|
-
|
|
104503
|
-
|
|
104504
|
-
|
|
104355
|
+
factory2.createPropertyAssignment(
|
|
104356
|
+
"get",
|
|
104357
|
+
factory2.createFunctionExpression(
|
|
104358
|
+
/*modifiers*/
|
|
104359
|
+
void 0,
|
|
104360
|
+
/*asteriskToken*/
|
|
104361
|
+
void 0,
|
|
104362
|
+
/*name*/
|
|
104363
|
+
void 0,
|
|
104364
|
+
/*typeParameters*/
|
|
104365
|
+
void 0,
|
|
104366
|
+
/*parameters*/
|
|
104367
|
+
[],
|
|
104368
|
+
/*type*/
|
|
104369
|
+
void 0,
|
|
104370
|
+
factory2.createBlock([factory2.createReturnStatement(value)])
|
|
104371
|
+
)
|
|
104372
|
+
)
|
|
104505
104373
|
])
|
|
104506
104374
|
]
|
|
104507
104375
|
) : factory2.createAssignment(
|
|
@@ -104876,10 +104744,7 @@ function transformSystemModule(context) {
|
|
|
104876
104744
|
const modifiers = node.transformFlags & 2097152 /* ContainsAwait */ ? factory2.createModifiersFromModifierFlags(512 /* Async */) : void 0;
|
|
104877
104745
|
const moduleObject = factory2.createObjectLiteralExpression(
|
|
104878
104746
|
[
|
|
104879
|
-
factory2.createPropertyAssignment(
|
|
104880
|
-
"setters",
|
|
104881
|
-
createSettersArray(exportStarFunction, dependencyGroups)
|
|
104882
|
-
),
|
|
104747
|
+
factory2.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)),
|
|
104883
104748
|
factory2.createPropertyAssignment(
|
|
104884
104749
|
"execute",
|
|
104885
104750
|
factory2.createFunctionExpression(
|
|
@@ -106199,18 +106064,21 @@ function transformECMAScriptModule(context) {
|
|
|
106199
106064
|
}
|
|
106200
106065
|
function appendExportsOfImportEqualsDeclaration(statements, node) {
|
|
106201
106066
|
if (hasSyntacticModifier(node, 1 /* Export */)) {
|
|
106202
|
-
statements = append(
|
|
106203
|
-
|
|
106204
|
-
|
|
106205
|
-
|
|
106206
|
-
factory2.createNamedExports([factory2.createExportSpecifier(
|
|
106207
|
-
/*isTypeOnly*/
|
|
106208
|
-
false,
|
|
106209
|
-
/*propertyName*/
|
|
106067
|
+
statements = append(
|
|
106068
|
+
statements,
|
|
106069
|
+
factory2.createExportDeclaration(
|
|
106070
|
+
/*modifiers*/
|
|
106210
106071
|
void 0,
|
|
106211
|
-
|
|
106212
|
-
|
|
106213
|
-
|
|
106072
|
+
node.isTypeOnly,
|
|
106073
|
+
factory2.createNamedExports([factory2.createExportSpecifier(
|
|
106074
|
+
/*isTypeOnly*/
|
|
106075
|
+
false,
|
|
106076
|
+
/*propertyName*/
|
|
106077
|
+
void 0,
|
|
106078
|
+
idText(node.name)
|
|
106079
|
+
)])
|
|
106080
|
+
)
|
|
106081
|
+
);
|
|
106214
106082
|
}
|
|
106215
106083
|
return statements;
|
|
106216
106084
|
}
|
|
@@ -106737,20 +106605,9 @@ function transformDeclarations(context) {
|
|
|
106737
106605
|
const errorInfo = getSymbolAccessibilityDiagnostic(symbolAccessibilityResult);
|
|
106738
106606
|
if (errorInfo) {
|
|
106739
106607
|
if (errorInfo.typeName) {
|
|
106740
|
-
context.addDiagnostic(createDiagnosticForNode(
|
|
106741
|
-
symbolAccessibilityResult.errorNode || errorInfo.errorNode,
|
|
106742
|
-
errorInfo.diagnosticMessage,
|
|
106743
|
-
getTextOfNode(errorInfo.typeName),
|
|
106744
|
-
symbolAccessibilityResult.errorSymbolName,
|
|
106745
|
-
symbolAccessibilityResult.errorModuleName
|
|
106746
|
-
));
|
|
106608
|
+
context.addDiagnostic(createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, getTextOfNode(errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName));
|
|
106747
106609
|
} else {
|
|
106748
|
-
context.addDiagnostic(createDiagnosticForNode(
|
|
106749
|
-
symbolAccessibilityResult.errorNode || errorInfo.errorNode,
|
|
106750
|
-
errorInfo.diagnosticMessage,
|
|
106751
|
-
symbolAccessibilityResult.errorSymbolName,
|
|
106752
|
-
symbolAccessibilityResult.errorModuleName
|
|
106753
|
-
));
|
|
106610
|
+
context.addDiagnostic(createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName));
|
|
106754
106611
|
}
|
|
106755
106612
|
return true;
|
|
106756
106613
|
}
|
|
@@ -106787,41 +106644,22 @@ function transformDeclarations(context) {
|
|
|
106787
106644
|
}
|
|
106788
106645
|
function reportInaccessibleUniqueSymbolError() {
|
|
106789
106646
|
if (errorNameNode || errorFallbackNode) {
|
|
106790
|
-
context.addDiagnostic(createDiagnosticForNode(
|
|
106791
|
-
errorNameNode || errorFallbackNode,
|
|
106792
|
-
Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary,
|
|
106793
|
-
errorDeclarationNameWithFallback(),
|
|
106794
|
-
"unique symbol"
|
|
106795
|
-
));
|
|
106647
|
+
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "unique symbol"));
|
|
106796
106648
|
}
|
|
106797
106649
|
}
|
|
106798
106650
|
function reportCyclicStructureError() {
|
|
106799
106651
|
if (errorNameNode || errorFallbackNode) {
|
|
106800
|
-
context.addDiagnostic(createDiagnosticForNode(
|
|
106801
|
-
errorNameNode || errorFallbackNode,
|
|
106802
|
-
Diagnostics.The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialized_A_type_annotation_is_necessary,
|
|
106803
|
-
errorDeclarationNameWithFallback()
|
|
106804
|
-
));
|
|
106652
|
+
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()));
|
|
106805
106653
|
}
|
|
106806
106654
|
}
|
|
106807
106655
|
function reportInaccessibleThisError() {
|
|
106808
106656
|
if (errorNameNode || errorFallbackNode) {
|
|
106809
|
-
context.addDiagnostic(createDiagnosticForNode(
|
|
106810
|
-
errorNameNode || errorFallbackNode,
|
|
106811
|
-
Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary,
|
|
106812
|
-
errorDeclarationNameWithFallback(),
|
|
106813
|
-
"this"
|
|
106814
|
-
));
|
|
106657
|
+
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "this"));
|
|
106815
106658
|
}
|
|
106816
106659
|
}
|
|
106817
106660
|
function reportLikelyUnsafeImportRequiredError(specifier) {
|
|
106818
106661
|
if (errorNameNode || errorFallbackNode) {
|
|
106819
|
-
context.addDiagnostic(createDiagnosticForNode(
|
|
106820
|
-
errorNameNode || errorFallbackNode,
|
|
106821
|
-
Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary,
|
|
106822
|
-
errorDeclarationNameWithFallback(),
|
|
106823
|
-
specifier
|
|
106824
|
-
));
|
|
106662
|
+
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));
|
|
106825
106663
|
}
|
|
106826
106664
|
}
|
|
106827
106665
|
function reportTruncationError() {
|
|
@@ -106871,9 +106709,8 @@ function transformDeclarations(context) {
|
|
|
106871
106709
|
refs = /* @__PURE__ */ new Map();
|
|
106872
106710
|
libs2 = /* @__PURE__ */ new Map();
|
|
106873
106711
|
let hasNoDefaultLib = false;
|
|
106874
|
-
const bundle = factory2.createBundle(
|
|
106875
|
-
node.sourceFiles,
|
|
106876
|
-
(sourceFile) => {
|
|
106712
|
+
const bundle = factory2.createBundle(
|
|
106713
|
+
map(node.sourceFiles, (sourceFile) => {
|
|
106877
106714
|
if (sourceFile.isDeclarationFile)
|
|
106878
106715
|
return void 0;
|
|
106879
106716
|
hasNoDefaultLib = hasNoDefaultLib || sourceFile.hasNoDefaultLib;
|
|
@@ -106931,18 +106768,19 @@ function transformDeclarations(context) {
|
|
|
106931
106768
|
/*libReferences*/
|
|
106932
106769
|
[]
|
|
106933
106770
|
);
|
|
106934
|
-
}
|
|
106935
|
-
|
|
106936
|
-
|
|
106937
|
-
|
|
106938
|
-
|
|
106939
|
-
|
|
106940
|
-
|
|
106941
|
-
|
|
106942
|
-
|
|
106943
|
-
|
|
106944
|
-
|
|
106945
|
-
|
|
106771
|
+
}),
|
|
106772
|
+
mapDefined(node.prepends, (prepend) => {
|
|
106773
|
+
if (prepend.kind === 315 /* InputFiles */) {
|
|
106774
|
+
const sourceFile = createUnparsedSourceFile(prepend, "dts", stripInternal);
|
|
106775
|
+
hasNoDefaultLib = hasNoDefaultLib || !!sourceFile.hasNoDefaultLib;
|
|
106776
|
+
collectReferences(sourceFile, refs);
|
|
106777
|
+
recordTypeReferenceDirectivesIfNecessary(map(sourceFile.typeReferenceDirectives, (ref) => [ref.fileName, ref.resolutionMode]));
|
|
106778
|
+
collectLibs(sourceFile, libs2);
|
|
106779
|
+
return sourceFile;
|
|
106780
|
+
}
|
|
106781
|
+
return prepend;
|
|
106782
|
+
})
|
|
106783
|
+
);
|
|
106946
106784
|
bundle.syntheticFileReferences = [];
|
|
106947
106785
|
bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences();
|
|
106948
106786
|
bundle.syntheticLibReferences = getLibReferences();
|
|
@@ -107358,25 +107196,37 @@ function transformDeclarations(context) {
|
|
|
107358
107196
|
}
|
|
107359
107197
|
const visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : void 0;
|
|
107360
107198
|
if (!decl.importClause.namedBindings) {
|
|
107361
|
-
return visibleDefaultBinding && factory2.updateImportDeclaration(
|
|
107362
|
-
decl
|
|
107363
|
-
decl.
|
|
107364
|
-
|
|
107365
|
-
|
|
107366
|
-
|
|
107367
|
-
|
|
107199
|
+
return visibleDefaultBinding && factory2.updateImportDeclaration(
|
|
107200
|
+
decl,
|
|
107201
|
+
decl.modifiers,
|
|
107202
|
+
factory2.updateImportClause(
|
|
107203
|
+
decl.importClause,
|
|
107204
|
+
decl.importClause.isTypeOnly,
|
|
107205
|
+
visibleDefaultBinding,
|
|
107206
|
+
/*namedBindings*/
|
|
107207
|
+
void 0
|
|
107208
|
+
),
|
|
107209
|
+
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107210
|
+
getResolutionModeOverrideForClauseInNightly(decl.assertClause)
|
|
107211
|
+
);
|
|
107368
107212
|
}
|
|
107369
107213
|
if (decl.importClause.namedBindings.kind === 274 /* NamespaceImport */) {
|
|
107370
107214
|
const namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : (
|
|
107371
107215
|
/*namedBindings*/
|
|
107372
107216
|
void 0
|
|
107373
107217
|
);
|
|
107374
|
-
return visibleDefaultBinding || namedBindings ? factory2.updateImportDeclaration(
|
|
107375
|
-
decl
|
|
107376
|
-
decl.
|
|
107377
|
-
|
|
107378
|
-
|
|
107379
|
-
|
|
107218
|
+
return visibleDefaultBinding || namedBindings ? factory2.updateImportDeclaration(
|
|
107219
|
+
decl,
|
|
107220
|
+
decl.modifiers,
|
|
107221
|
+
factory2.updateImportClause(
|
|
107222
|
+
decl.importClause,
|
|
107223
|
+
decl.importClause.isTypeOnly,
|
|
107224
|
+
visibleDefaultBinding,
|
|
107225
|
+
namedBindings
|
|
107226
|
+
),
|
|
107227
|
+
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107228
|
+
getResolutionModeOverrideForClauseInNightly(decl.assertClause)
|
|
107229
|
+
) : void 0;
|
|
107380
107230
|
}
|
|
107381
107231
|
const bindingList = mapDefined(decl.importClause.namedBindings.elements, (b) => resolver.isDeclarationVisible(b) ? b : void 0);
|
|
107382
107232
|
if (bindingList && bindingList.length || visibleDefaultBinding) {
|
|
@@ -108034,13 +107884,16 @@ function transformDeclarations(context) {
|
|
|
108034
107884
|
return;
|
|
108035
107885
|
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(param);
|
|
108036
107886
|
if (param.name.kind === 80 /* Identifier */) {
|
|
108037
|
-
return preserveJsDoc(
|
|
108038
|
-
|
|
108039
|
-
|
|
108040
|
-
|
|
108041
|
-
|
|
108042
|
-
|
|
108043
|
-
|
|
107887
|
+
return preserveJsDoc(
|
|
107888
|
+
factory2.createPropertyDeclaration(
|
|
107889
|
+
ensureModifiers(param),
|
|
107890
|
+
param.name,
|
|
107891
|
+
param.questionToken,
|
|
107892
|
+
ensureType(param, param.type),
|
|
107893
|
+
ensureNoInitializer(param)
|
|
107894
|
+
),
|
|
107895
|
+
param
|
|
107896
|
+
);
|
|
108044
107897
|
} else {
|
|
108045
107898
|
return walkBindingPattern(param.name);
|
|
108046
107899
|
}
|
|
@@ -108116,14 +107969,17 @@ function transformDeclarations(context) {
|
|
|
108116
107969
|
}
|
|
108117
107970
|
return factory2.updateHeritageClause(clause, visitNodes2(factory2.createNodeArray(filter(clause.types, (t) => isEntityNameExpression(t.expression) || t.expression.kind === 106 /* NullKeyword */)), visitDeclarationSubtree, isExpressionWithTypeArguments));
|
|
108118
107971
|
}));
|
|
108119
|
-
return [
|
|
108120
|
-
|
|
108121
|
-
|
|
108122
|
-
|
|
108123
|
-
|
|
108124
|
-
|
|
108125
|
-
|
|
108126
|
-
|
|
107972
|
+
return [
|
|
107973
|
+
statement,
|
|
107974
|
+
cleanup(factory2.updateClassDeclaration(
|
|
107975
|
+
input,
|
|
107976
|
+
modifiers,
|
|
107977
|
+
input.name,
|
|
107978
|
+
typeParameters,
|
|
107979
|
+
heritageClauses,
|
|
107980
|
+
members
|
|
107981
|
+
))
|
|
107982
|
+
];
|
|
108127
107983
|
} else {
|
|
108128
107984
|
const heritageClauses = transformHeritageClauses(input.heritageClauses);
|
|
108129
107985
|
return cleanup(factory2.updateClassDeclaration(
|
|
@@ -108140,13 +107996,18 @@ function transformDeclarations(context) {
|
|
|
108140
107996
|
return cleanup(transformVariableStatement(input));
|
|
108141
107997
|
}
|
|
108142
107998
|
case 266 /* EnumDeclaration */: {
|
|
108143
|
-
return cleanup(factory2.updateEnumDeclaration(
|
|
108144
|
-
|
|
108145
|
-
|
|
108146
|
-
|
|
108147
|
-
|
|
108148
|
-
|
|
108149
|
-
|
|
107999
|
+
return cleanup(factory2.updateEnumDeclaration(
|
|
108000
|
+
input,
|
|
108001
|
+
factory2.createNodeArray(ensureModifiers(input)),
|
|
108002
|
+
input.name,
|
|
108003
|
+
factory2.createNodeArray(mapDefined(input.members, (m) => {
|
|
108004
|
+
if (shouldStripInternal(m))
|
|
108005
|
+
return;
|
|
108006
|
+
const constValue = resolver.getConstantValue(m);
|
|
108007
|
+
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);
|
|
108008
|
+
return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m);
|
|
108009
|
+
}))
|
|
108010
|
+
));
|
|
108150
108011
|
}
|
|
108151
108012
|
}
|
|
108152
108013
|
return Debug.assertNever(input, `Unhandled top-level node in declaration emit: ${Debug.formatSyntaxKind(input.kind)}`);
|
|
@@ -108270,9 +108131,19 @@ function transformDeclarations(context) {
|
|
|
108270
108131
|
return accessorType;
|
|
108271
108132
|
}
|
|
108272
108133
|
function transformHeritageClauses(nodes) {
|
|
108273
|
-
return factory2.createNodeArray(filter(
|
|
108274
|
-
|
|
108275
|
-
|
|
108134
|
+
return factory2.createNodeArray(filter(
|
|
108135
|
+
map(nodes, (clause) => factory2.updateHeritageClause(
|
|
108136
|
+
clause,
|
|
108137
|
+
visitNodes2(
|
|
108138
|
+
factory2.createNodeArray(filter(clause.types, (t) => {
|
|
108139
|
+
return isEntityNameExpression(t.expression) || clause.token === 96 /* ExtendsKeyword */ && t.expression.kind === 106 /* NullKeyword */;
|
|
108140
|
+
})),
|
|
108141
|
+
visitDeclarationSubtree,
|
|
108142
|
+
isExpressionWithTypeArguments
|
|
108143
|
+
)
|
|
108144
|
+
)),
|
|
108145
|
+
(clause) => clause.types && !!clause.types.length
|
|
108146
|
+
));
|
|
108276
108147
|
}
|
|
108277
108148
|
}
|
|
108278
108149
|
function isAlwaysType(node) {
|
|
@@ -110609,14 +110480,8 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
110609
110480
|
nonEscapingWrite(`}`);
|
|
110610
110481
|
}
|
|
110611
110482
|
function emitTabStop(hint, node, snippet) {
|
|
110612
|
-
Debug.assert(
|
|
110613
|
-
|
|
110614
|
-
`A tab stop cannot be attached to a node of kind ${Debug.formatSyntaxKind(node.kind)}.`
|
|
110615
|
-
);
|
|
110616
|
-
Debug.assert(
|
|
110617
|
-
hint !== 5 /* EmbeddedStatement */,
|
|
110618
|
-
`A tab stop cannot be attached to an embedded statement.`
|
|
110619
|
-
);
|
|
110483
|
+
Debug.assert(node.kind === 242 /* EmptyStatement */, `A tab stop cannot be attached to a node of kind ${Debug.formatSyntaxKind(node.kind)}.`);
|
|
110484
|
+
Debug.assert(hint !== 5 /* EmbeddedStatement */, `A tab stop cannot be attached to an embedded statement.`);
|
|
110620
110485
|
nonEscapingWrite(`$${snippet.order}`);
|
|
110621
110486
|
}
|
|
110622
110487
|
function emitIdentifier(node) {
|
|
@@ -112041,7 +111906,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
112041
111906
|
emitTokenWithComment(90 /* DefaultKeyword */, nextPos, writeKeyword, node);
|
|
112042
111907
|
}
|
|
112043
111908
|
writeSpace();
|
|
112044
|
-
emitExpression(
|
|
111909
|
+
emitExpression(
|
|
111910
|
+
node.expression,
|
|
111911
|
+
node.isExportEquals ? parenthesizer.getParenthesizeRightSideOfBinaryForOperator(64 /* EqualsToken */) : parenthesizer.parenthesizeExpressionOfExportDefault
|
|
111912
|
+
);
|
|
112045
111913
|
writeTrailingSemicolon();
|
|
112046
111914
|
}
|
|
112047
111915
|
function emitExportDeclaration(node) {
|
|
@@ -118226,19 +118094,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118226
118094
|
case 1 /* SourceFromProjectReference */:
|
|
118227
118095
|
case 2 /* OutputFromProjectReference */:
|
|
118228
118096
|
const referencedResolvedRef = Debug.checkDefined(resolvedProjectReferences == null ? void 0 : resolvedProjectReferences[reason.index]);
|
|
118229
|
-
const referenceInfo = forEachProjectReference(
|
|
118230
|
-
projectReferences,
|
|
118231
|
-
resolvedProjectReferences,
|
|
118232
|
-
(resolvedRef, parent, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent == null ? void 0 : parent.sourceFile) || options.configFile, index: index2 } : void 0
|
|
118233
|
-
);
|
|
118097
|
+
const referenceInfo = forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, parent, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent == null ? void 0 : parent.sourceFile) || options.configFile, index: index2 } : void 0);
|
|
118234
118098
|
if (!referenceInfo)
|
|
118235
118099
|
return void 0;
|
|
118236
118100
|
const { sourceFile, index } = referenceInfo;
|
|
118237
|
-
const referencesSyntax = forEachTsConfigPropArray(
|
|
118238
|
-
sourceFile,
|
|
118239
|
-
"references",
|
|
118240
|
-
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
118241
|
-
);
|
|
118101
|
+
const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
|
|
118242
118102
|
return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
|
|
118243
118103
|
sourceFile,
|
|
118244
118104
|
referencesSyntax.elements[index],
|
|
@@ -118378,11 +118238,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118378
118238
|
);
|
|
118379
118239
|
}
|
|
118380
118240
|
function createDiagnosticForReference(sourceFile, index, message, ...args) {
|
|
118381
|
-
const referencesSyntax = forEachTsConfigPropArray(
|
|
118382
|
-
sourceFile || options.configFile,
|
|
118383
|
-
"references",
|
|
118384
|
-
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
118385
|
-
);
|
|
118241
|
+
const referencesSyntax = forEachTsConfigPropArray(sourceFile || options.configFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
|
|
118386
118242
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
|
118387
118243
|
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
|
|
118388
118244
|
} else {
|
|
@@ -118976,13 +118832,16 @@ var BuilderState;
|
|
|
118976
118832
|
sourceFile,
|
|
118977
118833
|
(fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) => {
|
|
118978
118834
|
Debug.assert(isDeclarationFileName(fileName), `File extension for signature expected to be dts: Got:: ${fileName}`);
|
|
118979
|
-
onNewSignature(
|
|
118980
|
-
|
|
118981
|
-
|
|
118982
|
-
|
|
118983
|
-
|
|
118984
|
-
|
|
118985
|
-
|
|
118835
|
+
onNewSignature(
|
|
118836
|
+
computeSignatureWithDiagnostics(
|
|
118837
|
+
programOfThisState,
|
|
118838
|
+
sourceFile,
|
|
118839
|
+
text,
|
|
118840
|
+
host,
|
|
118841
|
+
data
|
|
118842
|
+
),
|
|
118843
|
+
sourceFiles
|
|
118844
|
+
);
|
|
118986
118845
|
},
|
|
118987
118846
|
cancellationToken,
|
|
118988
118847
|
/*emitOnly*/
|
|
@@ -119494,10 +119353,7 @@ function removeDiagnosticsOfLibraryFiles(state) {
|
|
|
119494
119353
|
state.cleanedDiagnosticsOfLibFiles = true;
|
|
119495
119354
|
const program = Debug.checkDefined(state.program);
|
|
119496
119355
|
const options = program.getCompilerOptions();
|
|
119497
|
-
forEach(
|
|
119498
|
-
program.getSourceFiles(),
|
|
119499
|
-
(f) => program.isSourceFileDefaultLibrary(f) && !skipTypeChecking(f, options, program) && removeSemanticDiagnosticsOf(state, f.resolvedPath)
|
|
119500
|
-
);
|
|
119356
|
+
forEach(program.getSourceFiles(), (f) => program.isSourceFileDefaultLibrary(f) && !skipTypeChecking(f, options, program) && removeSemanticDiagnosticsOf(state, f.resolvedPath));
|
|
119501
119357
|
}
|
|
119502
119358
|
}
|
|
119503
119359
|
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
@@ -119565,12 +119421,14 @@ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, hos
|
|
|
119565
119421
|
state.program,
|
|
119566
119422
|
/*firstSourceFile*/
|
|
119567
119423
|
void 0
|
|
119568
|
-
).forEach(
|
|
119569
|
-
|
|
119570
|
-
|
|
119571
|
-
|
|
119572
|
-
|
|
119573
|
-
|
|
119424
|
+
).forEach(
|
|
119425
|
+
(file) => handleDtsMayChangeOf(
|
|
119426
|
+
state,
|
|
119427
|
+
file.resolvedPath,
|
|
119428
|
+
cancellationToken,
|
|
119429
|
+
host
|
|
119430
|
+
)
|
|
119431
|
+
);
|
|
119574
119432
|
removeDiagnosticsOfLibraryFiles(state);
|
|
119575
119433
|
return true;
|
|
119576
119434
|
}
|
|
@@ -119603,16 +119461,13 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
|
|
|
119603
119461
|
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host))
|
|
119604
119462
|
return true;
|
|
119605
119463
|
const references = state.referencedMap.getKeys(exportedFromPath);
|
|
119606
|
-
return references && forEachKey(
|
|
119607
|
-
|
|
119608
|
-
|
|
119609
|
-
|
|
119610
|
-
|
|
119611
|
-
|
|
119612
|
-
|
|
119613
|
-
host
|
|
119614
|
-
)
|
|
119615
|
-
);
|
|
119464
|
+
return references && forEachKey(references, (filePath) => handleDtsMayChangeOfFileAndExportsOfFile(
|
|
119465
|
+
state,
|
|
119466
|
+
filePath,
|
|
119467
|
+
seenFileAndExportsOfFile,
|
|
119468
|
+
cancellationToken,
|
|
119469
|
+
host
|
|
119470
|
+
));
|
|
119616
119471
|
});
|
|
119617
119472
|
}
|
|
119618
119473
|
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
|
|
@@ -119720,11 +119575,13 @@ function getBuildInfo2(state, bundle) {
|
|
|
119720
119575
|
if (!isJsonSourceFile(file) && sourceFileMayBeEmitted(file, state.program)) {
|
|
119721
119576
|
const emitSignature = (_b2 = state.emitSignatures) == null ? void 0 : _b2.get(key);
|
|
119722
119577
|
if (emitSignature !== actualSignature) {
|
|
119723
|
-
(emitSignatures || (emitSignatures = [])).push(
|
|
119724
|
-
|
|
119725
|
-
|
|
119726
|
-
|
|
119727
|
-
|
|
119578
|
+
(emitSignatures || (emitSignatures = [])).push(
|
|
119579
|
+
emitSignature === void 0 ? fileId : (
|
|
119580
|
+
// There is no emit, encode as false
|
|
119581
|
+
// fileId, signature: emptyArray if signature only differs in dtsMap option than our own compilerOptions otherwise EmitSignature
|
|
119582
|
+
[fileId, !isString(emitSignature) && emitSignature[0] === actualSignature ? emptyArray : emitSignature]
|
|
119583
|
+
)
|
|
119584
|
+
);
|
|
119728
119585
|
}
|
|
119729
119586
|
}
|
|
119730
119587
|
}
|
|
@@ -119978,9 +119835,7 @@ function computeSignatureWithDiagnostics(program, sourceFile, text, host, data)
|
|
|
119978
119835
|
text = getTextHandlingSourceMapForSignature(text, data);
|
|
119979
119836
|
let sourceFileDirectory;
|
|
119980
119837
|
if ((_a = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a.length) {
|
|
119981
|
-
text += data.diagnostics.map(
|
|
119982
|
-
(diagnostic) => `${locationInfo(diagnostic)}${DiagnosticCategory[diagnostic.category]}${diagnostic.code}: ${flattenDiagnosticMessageText2(diagnostic.messageText)}`
|
|
119983
|
-
).join("\n");
|
|
119838
|
+
text += data.diagnostics.map((diagnostic) => `${locationInfo(diagnostic)}${DiagnosticCategory[diagnostic.category]}${diagnostic.code}: ${flattenDiagnosticMessageText2(diagnostic.messageText)}`).join("\n");
|
|
119984
119839
|
}
|
|
119985
119840
|
return (host.createHash ?? generateDjb2Hash)(text);
|
|
119986
119841
|
function flattenDiagnosticMessageText2(diagnostic) {
|
|
@@ -120387,9 +120242,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
120387
120242
|
return void 0;
|
|
120388
120243
|
}
|
|
120389
120244
|
const map2 = BuilderState.createManyToManyPathMap();
|
|
120390
|
-
referenceMap.forEach(
|
|
120391
|
-
([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId))
|
|
120392
|
-
);
|
|
120245
|
+
referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
|
|
120393
120246
|
return map2;
|
|
120394
120247
|
}
|
|
120395
120248
|
}
|
|
@@ -120879,11 +120732,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
120879
120732
|
seenNamesInFile.set(name, mode, true);
|
|
120880
120733
|
resolvedModules.push(resolution);
|
|
120881
120734
|
}
|
|
120882
|
-
reusedNames == null ? void 0 : reusedNames.forEach(
|
|
120883
|
-
|
|
120884
|
-
|
|
120885
|
-
|
|
120886
|
-
|
|
120735
|
+
reusedNames == null ? void 0 : reusedNames.forEach(
|
|
120736
|
+
(entry) => seenNamesInFile.set(
|
|
120737
|
+
loader.nameAndMode.getName(entry),
|
|
120738
|
+
loader.nameAndMode.getMode(entry, containingSourceFile),
|
|
120739
|
+
true
|
|
120740
|
+
)
|
|
120741
|
+
);
|
|
120887
120742
|
if (resolutionsInFile.size() !== seenNamesInFile.size()) {
|
|
120888
120743
|
resolutionsInFile.forEach((resolution, name, mode) => {
|
|
120889
120744
|
if (!seenNamesInFile.has(name, mode)) {
|
|
@@ -121512,10 +121367,7 @@ function getFilesInErrorForSummary(diagnostics) {
|
|
|
121512
121367
|
if (fileName === void 0) {
|
|
121513
121368
|
return void 0;
|
|
121514
121369
|
}
|
|
121515
|
-
const diagnosticForFileName = find(
|
|
121516
|
-
diagnostics,
|
|
121517
|
-
(diagnostic) => diagnostic.file !== void 0 && diagnostic.file.fileName === fileName
|
|
121518
|
-
);
|
|
121370
|
+
const diagnosticForFileName = find(diagnostics, (diagnostic) => diagnostic.file !== void 0 && diagnostic.file.fileName === fileName);
|
|
121519
121371
|
if (diagnosticForFileName !== void 0) {
|
|
121520
121372
|
const { line } = getLineAndCharacterOfPosition(diagnosticForFileName.file, diagnosticForFileName.start);
|
|
121521
121373
|
return {
|
|
@@ -122534,14 +122386,16 @@ function createWatchProgram(host) {
|
|
|
122534
122386
|
}
|
|
122535
122387
|
function parseConfigFile2() {
|
|
122536
122388
|
Debug.assert(configFileName);
|
|
122537
|
-
setConfigFileParsingResult(
|
|
122538
|
-
|
|
122539
|
-
|
|
122540
|
-
|
|
122541
|
-
|
|
122542
|
-
|
|
122543
|
-
|
|
122544
|
-
|
|
122389
|
+
setConfigFileParsingResult(
|
|
122390
|
+
getParsedCommandLineOfConfigFile(
|
|
122391
|
+
configFileName,
|
|
122392
|
+
optionsToExtendForConfigFile,
|
|
122393
|
+
parseConfigFileHost,
|
|
122394
|
+
extendedConfigCache || (extendedConfigCache = /* @__PURE__ */ new Map()),
|
|
122395
|
+
watchOptionsToExtend,
|
|
122396
|
+
extraFileExtensions
|
|
122397
|
+
)
|
|
122398
|
+
);
|
|
122545
122399
|
}
|
|
122546
122400
|
function setConfigFileParsingResult(configFileParseResult) {
|
|
122547
122401
|
rootFileNames = configFileParseResult.fileNames;
|
|
@@ -123379,10 +123233,13 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
|
|
|
123379
123233
|
config.projectReferences
|
|
123380
123234
|
);
|
|
123381
123235
|
if (state.watch) {
|
|
123382
|
-
state.lastCachedPackageJsonLookups.set(
|
|
123383
|
-
|
|
123384
|
-
|
|
123385
|
-
|
|
123236
|
+
state.lastCachedPackageJsonLookups.set(
|
|
123237
|
+
projectPath,
|
|
123238
|
+
state.moduleResolutionCache && map(
|
|
123239
|
+
state.moduleResolutionCache.getPackageJsonInfoCache().entries(),
|
|
123240
|
+
([path, data]) => [state.host.realpath && data ? toPath2(state, state.host.realpath(path)) : path, data]
|
|
123241
|
+
)
|
|
123242
|
+
);
|
|
123386
123243
|
state.builderPrograms.set(projectPath, program);
|
|
123387
123244
|
}
|
|
123388
123245
|
step++;
|
|
@@ -124436,15 +124293,18 @@ function buildNextInvalidatedProjectWorker(state, changeDetected) {
|
|
|
124436
124293
|
function watchConfigFile(state, resolved, resolvedPath, parsed) {
|
|
124437
124294
|
if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
|
|
124438
124295
|
return;
|
|
124439
|
-
state.allWatchedConfigFiles.set(
|
|
124440
|
-
|
|
124441
|
-
|
|
124442
|
-
|
|
124443
|
-
|
|
124444
|
-
|
|
124445
|
-
|
|
124446
|
-
|
|
124447
|
-
|
|
124296
|
+
state.allWatchedConfigFiles.set(
|
|
124297
|
+
resolvedPath,
|
|
124298
|
+
watchFile(
|
|
124299
|
+
state,
|
|
124300
|
+
resolved,
|
|
124301
|
+
() => invalidateProjectAndScheduleBuilds(state, resolvedPath, 2 /* Full */),
|
|
124302
|
+
2e3 /* High */,
|
|
124303
|
+
parsed == null ? void 0 : parsed.watchOptions,
|
|
124304
|
+
WatchType.ConfigFile,
|
|
124305
|
+
resolved
|
|
124306
|
+
)
|
|
124307
|
+
);
|
|
124448
124308
|
}
|
|
124449
124309
|
function watchExtendedConfigFiles(state, resolvedPath, parsed) {
|
|
124450
124310
|
updateSharedExtendedConfigFileWatcher(
|
|
@@ -125724,11 +125584,7 @@ function enableStatisticsAndTracing(system, compilerOptions, isBuildMode) {
|
|
|
125724
125584
|
enable(system);
|
|
125725
125585
|
}
|
|
125726
125586
|
if (canTrace(system, compilerOptions)) {
|
|
125727
|
-
startTracing(
|
|
125728
|
-
isBuildMode ? "build" : "project",
|
|
125729
|
-
compilerOptions.generateTrace,
|
|
125730
|
-
compilerOptions.configFilePath
|
|
125731
|
-
);
|
|
125587
|
+
startTracing(isBuildMode ? "build" : "project", compilerOptions.generateTrace, compilerOptions.configFilePath);
|
|
125732
125588
|
}
|
|
125733
125589
|
}
|
|
125734
125590
|
function isSolutionMarkOrMeasure(name) {
|