typescript 5.1.0-dev.20230319 → 5.1.0-dev.20230321
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.legacy.d.ts +1 -1
- package/lib/tsc.js +459 -560
- package/lib/tsserver.js +699 -771
- package/lib/tsserverlibrary.d.ts +6 -6
- package/lib/tsserverlibrary.js +710 -790
- package/lib/typescript.d.ts +6 -6
- package/lib/typescript.js +705 -786
- package/lib/typingsInstaller.js +75 -256
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -15,15 +15,10 @@ and limitations under the License.
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
"use strict";
|
|
18
|
-
var __defProp = Object.defineProperty;
|
|
19
|
-
var __export = (target, all) => {
|
|
20
|
-
for (var name in all)
|
|
21
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
|
-
};
|
|
23
18
|
|
|
24
19
|
// src/compiler/corePublic.ts
|
|
25
20
|
var versionMajorMinor = "5.1";
|
|
26
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230321`;
|
|
27
22
|
|
|
28
23
|
// src/compiler/core.ts
|
|
29
24
|
var emptyArray = [];
|
|
@@ -2655,25 +2650,6 @@ try {
|
|
|
2655
2650
|
}
|
|
2656
2651
|
var perfLogger = (etwModule == null ? void 0 : etwModule.logEvent) ? etwModule : void 0;
|
|
2657
2652
|
|
|
2658
|
-
// src/compiler/_namespaces/ts.performance.ts
|
|
2659
|
-
var ts_performance_exports = {};
|
|
2660
|
-
__export(ts_performance_exports, {
|
|
2661
|
-
clearMarks: () => clearMarks,
|
|
2662
|
-
clearMeasures: () => clearMeasures,
|
|
2663
|
-
createTimer: () => createTimer,
|
|
2664
|
-
createTimerIf: () => createTimerIf,
|
|
2665
|
-
disable: () => disable,
|
|
2666
|
-
enable: () => enable,
|
|
2667
|
-
forEachMark: () => forEachMark,
|
|
2668
|
-
forEachMeasure: () => forEachMeasure,
|
|
2669
|
-
getCount: () => getCount,
|
|
2670
|
-
getDuration: () => getDuration,
|
|
2671
|
-
isEnabled: () => isEnabled,
|
|
2672
|
-
mark: () => mark,
|
|
2673
|
-
measure: () => measure,
|
|
2674
|
-
nullTimer: () => nullTimer
|
|
2675
|
-
});
|
|
2676
|
-
|
|
2677
2653
|
// src/compiler/performance.ts
|
|
2678
2654
|
var perfHooks;
|
|
2679
2655
|
var performanceImpl;
|
|
@@ -3711,7 +3687,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3711
3687
|
TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
|
|
3712
3688
|
TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
|
|
3713
3689
|
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
|
|
3714
|
-
TypeFlags2[TypeFlags2["ObjectFlagsType"] =
|
|
3690
|
+
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
|
|
3715
3691
|
TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
|
|
3716
3692
|
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
|
|
3717
3693
|
TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
|
|
@@ -4869,7 +4845,7 @@ var sys = (() => {
|
|
|
4869
4845
|
}
|
|
4870
4846
|
let activeSession;
|
|
4871
4847
|
let profilePath = "./profile.cpuprofile";
|
|
4872
|
-
const
|
|
4848
|
+
const Buffer = require("buffer").Buffer;
|
|
4873
4849
|
const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
4874
4850
|
const platform = _os.platform();
|
|
4875
4851
|
const useCaseSensitiveFileNames = isFileSystemCaseSensitive();
|
|
@@ -5076,7 +5052,7 @@ var sys = (() => {
|
|
|
5076
5052
|
}
|
|
5077
5053
|
}
|
|
5078
5054
|
function bufferFrom(input, encoding) {
|
|
5079
|
-
return
|
|
5055
|
+
return Buffer.from && Buffer.from !== Int8Array.from ? Buffer.from(input, encoding) : new Buffer(input, encoding);
|
|
5080
5056
|
}
|
|
5081
5057
|
function isFileSystemCaseSensitive() {
|
|
5082
5058
|
if (platform === "win32" || platform === "win64") {
|
|
@@ -7103,13 +7079,14 @@ var Diagnostics = {
|
|
|
7103
7079
|
Output_Formatting: diag(6256, 3 /* Message */, "Output_Formatting_6256", "Output Formatting"),
|
|
7104
7080
|
Completeness: diag(6257, 3 /* Message */, "Completeness_6257", "Completeness"),
|
|
7105
7081
|
_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file: diag(6258, 1 /* Error */, "_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file_6258", "'{0}' should be set inside the 'compilerOptions' object of the config json file"),
|
|
7106
|
-
|
|
7082
|
+
Found_1_error_in_0: diag(6259, 3 /* Message */, "Found_1_error_in_0_6259", "Found 1 error in {0}"),
|
|
7107
7083
|
Found_0_errors_in_the_same_file_starting_at_Colon_1: diag(6260, 3 /* Message */, "Found_0_errors_in_the_same_file_starting_at_Colon_1_6260", "Found {0} errors in the same file, starting at: {1}"),
|
|
7108
7084
|
Found_0_errors_in_1_files: diag(6261, 3 /* Message */, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
7109
7085
|
File_name_0_has_a_1_extension_looking_up_2_instead: diag(6262, 3 /* Message */, "File_name_0_has_a_1_extension_looking_up_2_instead_6262", "File name '{0}' has a '{1}' extension - looking up '{2}' instead."),
|
|
7110
7086
|
Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set: diag(6263, 1 /* Error */, "Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set_6263", "Module '{0}' was resolved to '{1}', but '--allowArbitraryExtensions' is not set."),
|
|
7111
7087
|
Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present: diag(6264, 3 /* Message */, "Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present_6264", "Enable importing files with any extension, provided a declaration file is present."),
|
|
7112
7088
|
Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder: diag(6265, 3 /* Message */, "Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_no_6265", "Resolving type reference directive for program that specifies custom typeRoots, skipping lookup in 'node_modules' folder."),
|
|
7089
|
+
Option_0_can_only_be_specified_on_command_line: diag(6266, 1 /* Error */, "Option_0_can_only_be_specified_on_command_line_6266", "Option '{0}' can only be specified on command line."),
|
|
7113
7090
|
Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, 3 /* Message */, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
|
|
7114
7091
|
Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, 3 /* Message */, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
7115
7092
|
Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, 3 /* Message */, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
|
|
@@ -12270,17 +12247,17 @@ function entityNameToString(name) {
|
|
|
12270
12247
|
return Debug.assertNever(name);
|
|
12271
12248
|
}
|
|
12272
12249
|
}
|
|
12273
|
-
function createDiagnosticForNode(node, message,
|
|
12250
|
+
function createDiagnosticForNode(node, message, ...args) {
|
|
12274
12251
|
const sourceFile = getSourceFileOfNode(node);
|
|
12275
|
-
return createDiagnosticForNodeInSourceFile(sourceFile, node, message,
|
|
12252
|
+
return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args);
|
|
12276
12253
|
}
|
|
12277
|
-
function createDiagnosticForNodeArray(sourceFile, nodes, message,
|
|
12254
|
+
function createDiagnosticForNodeArray(sourceFile, nodes, message, ...args) {
|
|
12278
12255
|
const start = skipTrivia(sourceFile.text, nodes.pos);
|
|
12279
|
-
return createFileDiagnostic(sourceFile, start, nodes.end - start, message,
|
|
12256
|
+
return createFileDiagnostic(sourceFile, start, nodes.end - start, message, ...args);
|
|
12280
12257
|
}
|
|
12281
|
-
function createDiagnosticForNodeInSourceFile(sourceFile, node, message,
|
|
12258
|
+
function createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args) {
|
|
12282
12259
|
const span = getErrorSpanForNode(sourceFile, node);
|
|
12283
|
-
return createFileDiagnostic(sourceFile, span.start, span.length, message,
|
|
12260
|
+
return createFileDiagnostic(sourceFile, span.start, span.length, message, ...args);
|
|
12284
12261
|
}
|
|
12285
12262
|
function createDiagnosticForNodeFromMessageChain(sourceFile, node, messageChain, relatedInformation) {
|
|
12286
12263
|
const span = getErrorSpanForNode(sourceFile, node);
|
|
@@ -14029,6 +14006,12 @@ function getAncestor(node, kind) {
|
|
|
14029
14006
|
function isKeyword(token) {
|
|
14030
14007
|
return 82 /* FirstKeyword */ <= token && token <= 163 /* LastKeyword */;
|
|
14031
14008
|
}
|
|
14009
|
+
function isPunctuation(token) {
|
|
14010
|
+
return 18 /* FirstPunctuation */ <= token && token <= 78 /* LastPunctuation */;
|
|
14011
|
+
}
|
|
14012
|
+
function isKeywordOrPunctuation(token) {
|
|
14013
|
+
return isKeyword(token) || isPunctuation(token);
|
|
14014
|
+
}
|
|
14032
14015
|
function isContextualKeyword(token) {
|
|
14033
14016
|
return 127 /* FirstContextualKeyword */ <= token && token <= 163 /* LastContextualKeyword */;
|
|
14034
14017
|
}
|
|
@@ -15716,7 +15699,7 @@ function getClassLikeDeclarationOfSymbol(symbol) {
|
|
|
15716
15699
|
return (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isClassLike);
|
|
15717
15700
|
}
|
|
15718
15701
|
function getObjectFlags(type) {
|
|
15719
|
-
return type.flags &
|
|
15702
|
+
return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0;
|
|
15720
15703
|
}
|
|
15721
15704
|
function isUMDExportSymbol(symbol) {
|
|
15722
15705
|
return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
|
|
@@ -26085,14 +26068,12 @@ var Parser;
|
|
|
26085
26068
|
scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
|
|
26086
26069
|
if (scriptKind2 === 6 /* JSON */) {
|
|
26087
26070
|
const result2 = parseJsonText2(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes);
|
|
26088
|
-
|
|
26071
|
+
convertToJson(
|
|
26089
26072
|
result2,
|
|
26090
26073
|
(_a2 = result2.statements[0]) == null ? void 0 : _a2.expression,
|
|
26091
26074
|
result2.parseDiagnostics,
|
|
26092
26075
|
/*returnValue*/
|
|
26093
26076
|
false,
|
|
26094
|
-
/*knownRootOptions*/
|
|
26095
|
-
void 0,
|
|
26096
26077
|
/*jsonConversionNotifier*/
|
|
26097
26078
|
void 0
|
|
26098
26079
|
);
|
|
@@ -26524,24 +26505,24 @@ var Parser;
|
|
|
26524
26505
|
function inAwaitContext() {
|
|
26525
26506
|
return inContext(32768 /* AwaitContext */);
|
|
26526
26507
|
}
|
|
26527
|
-
function parseErrorAtCurrentToken(message,
|
|
26528
|
-
return parseErrorAt(scanner.getTokenStart(), scanner.getTokenEnd(), message,
|
|
26508
|
+
function parseErrorAtCurrentToken(message, ...args) {
|
|
26509
|
+
return parseErrorAt(scanner.getTokenStart(), scanner.getTokenEnd(), message, ...args);
|
|
26529
26510
|
}
|
|
26530
|
-
function parseErrorAtPosition(start, length2, message,
|
|
26511
|
+
function parseErrorAtPosition(start, length2, message, ...args) {
|
|
26531
26512
|
const lastError = lastOrUndefined(parseDiagnostics);
|
|
26532
26513
|
let result;
|
|
26533
26514
|
if (!lastError || start !== lastError.start) {
|
|
26534
|
-
result = createDetachedDiagnostic(fileName, start, length2, message,
|
|
26515
|
+
result = createDetachedDiagnostic(fileName, start, length2, message, ...args);
|
|
26535
26516
|
parseDiagnostics.push(result);
|
|
26536
26517
|
}
|
|
26537
26518
|
parseErrorBeforeNextFinishedNode = true;
|
|
26538
26519
|
return result;
|
|
26539
26520
|
}
|
|
26540
|
-
function parseErrorAt(start, end, message,
|
|
26541
|
-
return parseErrorAtPosition(start, end - start, message,
|
|
26521
|
+
function parseErrorAt(start, end, message, ...args) {
|
|
26522
|
+
return parseErrorAtPosition(start, end - start, message, ...args);
|
|
26542
26523
|
}
|
|
26543
|
-
function parseErrorAtRange(range, message,
|
|
26544
|
-
parseErrorAt(range.pos, range.end, message,
|
|
26524
|
+
function parseErrorAtRange(range, message, ...args) {
|
|
26525
|
+
parseErrorAt(range.pos, range.end, message, ...args);
|
|
26545
26526
|
}
|
|
26546
26527
|
function scanError(message, length2) {
|
|
26547
26528
|
parseErrorAtPosition(scanner.getTokenEnd(), length2, message);
|
|
@@ -26747,6 +26728,7 @@ var Parser;
|
|
|
26747
26728
|
nextTokenJSDoc();
|
|
26748
26729
|
return true;
|
|
26749
26730
|
}
|
|
26731
|
+
Debug.assert(isKeywordOrPunctuation(kind));
|
|
26750
26732
|
parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(kind));
|
|
26751
26733
|
return false;
|
|
26752
26734
|
}
|
|
@@ -26795,7 +26777,11 @@ var Parser;
|
|
|
26795
26777
|
);
|
|
26796
26778
|
}
|
|
26797
26779
|
function parseExpectedTokenJSDoc(t) {
|
|
26798
|
-
|
|
26780
|
+
const optional = parseOptionalTokenJSDoc(t);
|
|
26781
|
+
if (optional)
|
|
26782
|
+
return optional;
|
|
26783
|
+
Debug.assert(isKeywordOrPunctuation(t));
|
|
26784
|
+
return createMissingNode(
|
|
26799
26785
|
t,
|
|
26800
26786
|
/*reportAtCurrentPosition*/
|
|
26801
26787
|
false,
|
|
@@ -26849,11 +26835,11 @@ var Parser;
|
|
|
26849
26835
|
}
|
|
26850
26836
|
return node;
|
|
26851
26837
|
}
|
|
26852
|
-
function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage,
|
|
26838
|
+
function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, ...args) {
|
|
26853
26839
|
if (reportAtCurrentPosition) {
|
|
26854
|
-
parseErrorAtPosition(scanner.getTokenFullStart(), 0, diagnosticMessage,
|
|
26840
|
+
parseErrorAtPosition(scanner.getTokenFullStart(), 0, diagnosticMessage, ...args);
|
|
26855
26841
|
} else if (diagnosticMessage) {
|
|
26856
|
-
parseErrorAtCurrentToken(diagnosticMessage,
|
|
26842
|
+
parseErrorAtCurrentToken(diagnosticMessage, ...args);
|
|
26857
26843
|
}
|
|
26858
26844
|
const pos = getNodePos();
|
|
26859
26845
|
const result = kind === 79 /* Identifier */ ? factoryCreateIdentifier(
|
|
@@ -29212,6 +29198,7 @@ var Parser;
|
|
|
29212
29198
|
if (simpleUnaryExpression.kind === 214 /* TypeAssertionExpression */) {
|
|
29213
29199
|
parseErrorAt(pos, end, Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
|
|
29214
29200
|
} else {
|
|
29201
|
+
Debug.assert(isKeywordOrPunctuation(unaryOperator));
|
|
29215
29202
|
parseErrorAt(pos, end, Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, tokenToString(unaryOperator));
|
|
29216
29203
|
}
|
|
29217
29204
|
}
|
|
@@ -32159,14 +32146,14 @@ var Parser;
|
|
|
32159
32146
|
}
|
|
32160
32147
|
function parseReturnTag(start2, tagName, indent2, indentText) {
|
|
32161
32148
|
if (some(tags, isJSDocReturnTag)) {
|
|
32162
|
-
parseErrorAt(tagName.pos, scanner.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
|
|
32149
|
+
parseErrorAt(tagName.pos, scanner.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText));
|
|
32163
32150
|
}
|
|
32164
32151
|
const typeExpression = tryParseTypeExpression();
|
|
32165
32152
|
return finishNode(factory2.createJSDocReturnTag(tagName, typeExpression, parseTrailingTagComments(start2, getNodePos(), indent2, indentText)), start2);
|
|
32166
32153
|
}
|
|
32167
32154
|
function parseTypeTag(start2, tagName, indent2, indentText) {
|
|
32168
32155
|
if (some(tags, isJSDocTypeTag)) {
|
|
32169
|
-
parseErrorAt(tagName.pos, scanner.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
|
|
32156
|
+
parseErrorAt(tagName.pos, scanner.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText));
|
|
32170
32157
|
}
|
|
32171
32158
|
const typeExpression = parseJSDocTypeExpression(
|
|
32172
32159
|
/*mayOmitBraces*/
|
|
@@ -34613,9 +34600,6 @@ var defaultInitCompilerOptions = {
|
|
|
34613
34600
|
forceConsistentCasingInFileNames: true,
|
|
34614
34601
|
skipLibCheck: true
|
|
34615
34602
|
};
|
|
34616
|
-
function createCompilerDiagnosticForInvalidCustomType(opt) {
|
|
34617
|
-
return createDiagnosticForInvalidCustomType(opt, createCompilerDiagnostic);
|
|
34618
|
-
}
|
|
34619
34603
|
function createDiagnosticForInvalidCustomType(opt, createDiagnostic) {
|
|
34620
34604
|
const namesOfType = arrayFrom(opt.type.keys());
|
|
34621
34605
|
const stringNames = (opt.deprecatedKeys ? namesOfType.filter((k) => !opt.deprecatedKeys.has(k)) : namesOfType).map((key) => `'${key}'`).join(", ");
|
|
@@ -34651,13 +34635,13 @@ function parseListTypeOption(opt, value = "", errors) {
|
|
|
34651
34635
|
function getOptionName(option) {
|
|
34652
34636
|
return option.name;
|
|
34653
34637
|
}
|
|
34654
|
-
function createUnknownOptionError(unknownOption, diagnostics,
|
|
34638
|
+
function createUnknownOptionError(unknownOption, diagnostics, unknownOptionErrorText, node, sourceFile) {
|
|
34655
34639
|
var _a2;
|
|
34656
34640
|
if ((_a2 = diagnostics.alternateMode) == null ? void 0 : _a2.getOptionsNameMap().optionsNameMap.has(unknownOption.toLowerCase())) {
|
|
34657
|
-
return
|
|
34641
|
+
return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.alternateMode.diagnostic, unknownOption);
|
|
34658
34642
|
}
|
|
34659
34643
|
const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
|
|
34660
|
-
return possibleOption ?
|
|
34644
|
+
return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
|
|
34661
34645
|
}
|
|
34662
34646
|
function parseCommandLineWorker(diagnostics, commandLine, readFile) {
|
|
34663
34647
|
const options = {};
|
|
@@ -34698,7 +34682,7 @@ function parseCommandLineWorker(diagnostics, commandLine, readFile) {
|
|
|
34698
34682
|
if (watchOpt) {
|
|
34699
34683
|
i = parseOptionValue(args, i, watchOptionsDidYouMeanDiagnostics, watchOpt, watchOptions || (watchOptions = {}), errors);
|
|
34700
34684
|
} else {
|
|
34701
|
-
errors.push(createUnknownOptionError(inputOptionName, diagnostics,
|
|
34685
|
+
errors.push(createUnknownOptionError(inputOptionName, diagnostics, s));
|
|
34702
34686
|
}
|
|
34703
34687
|
}
|
|
34704
34688
|
} else {
|
|
@@ -34902,9 +34886,7 @@ function parseConfigFileTextToJson(fileName, jsonText) {
|
|
|
34902
34886
|
config: convertConfigFileToObject(
|
|
34903
34887
|
jsonSourceFile,
|
|
34904
34888
|
jsonSourceFile.parseDiagnostics,
|
|
34905
|
-
/*
|
|
34906
|
-
false,
|
|
34907
|
-
/*optionsIterator*/
|
|
34889
|
+
/*jsonConversionNotifier*/
|
|
34908
34890
|
void 0
|
|
34909
34891
|
),
|
|
34910
34892
|
error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0
|
|
@@ -34961,7 +34943,26 @@ var extendsOptionDeclaration = {
|
|
|
34961
34943
|
name: "extends",
|
|
34962
34944
|
type: "string"
|
|
34963
34945
|
},
|
|
34964
|
-
category: Diagnostics.File_Management
|
|
34946
|
+
category: Diagnostics.File_Management,
|
|
34947
|
+
disallowNullOrUndefined: true
|
|
34948
|
+
};
|
|
34949
|
+
var compilerOptionsDeclaration = {
|
|
34950
|
+
name: "compilerOptions",
|
|
34951
|
+
type: "object",
|
|
34952
|
+
elementOptions: getCommandLineCompilerOptionsMap(),
|
|
34953
|
+
extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics
|
|
34954
|
+
};
|
|
34955
|
+
var watchOptionsDeclaration = {
|
|
34956
|
+
name: "watchOptions",
|
|
34957
|
+
type: "object",
|
|
34958
|
+
elementOptions: getCommandLineWatchOptionsMap(),
|
|
34959
|
+
extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics
|
|
34960
|
+
};
|
|
34961
|
+
var typeAcquisitionDeclaration = {
|
|
34962
|
+
name: "typeAcquisition",
|
|
34963
|
+
type: "object",
|
|
34964
|
+
elementOptions: getCommandLineTypeAcquisitionMap(),
|
|
34965
|
+
extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics
|
|
34965
34966
|
};
|
|
34966
34967
|
var _tsconfigRootOptions;
|
|
34967
34968
|
function getTsconfigRootOptionsMap() {
|
|
@@ -34971,24 +34972,9 @@ function getTsconfigRootOptionsMap() {
|
|
|
34971
34972
|
// should never be needed since this is root
|
|
34972
34973
|
type: "object",
|
|
34973
34974
|
elementOptions: commandLineOptionsToMap([
|
|
34974
|
-
|
|
34975
|
-
|
|
34976
|
-
|
|
34977
|
-
elementOptions: getCommandLineCompilerOptionsMap(),
|
|
34978
|
-
extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics
|
|
34979
|
-
},
|
|
34980
|
-
{
|
|
34981
|
-
name: "watchOptions",
|
|
34982
|
-
type: "object",
|
|
34983
|
-
elementOptions: getCommandLineWatchOptionsMap(),
|
|
34984
|
-
extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics
|
|
34985
|
-
},
|
|
34986
|
-
{
|
|
34987
|
-
name: "typeAcquisition",
|
|
34988
|
-
type: "object",
|
|
34989
|
-
elementOptions: getCommandLineTypeAcquisitionMap(),
|
|
34990
|
-
extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics
|
|
34991
|
-
},
|
|
34975
|
+
compilerOptionsDeclaration,
|
|
34976
|
+
watchOptionsDeclaration,
|
|
34977
|
+
typeAcquisitionDeclaration,
|
|
34992
34978
|
extendsOptionDeclaration,
|
|
34993
34979
|
{
|
|
34994
34980
|
name: "references",
|
|
@@ -35034,10 +35020,9 @@ function getTsconfigRootOptionsMap() {
|
|
|
35034
35020
|
}
|
|
35035
35021
|
return _tsconfigRootOptions;
|
|
35036
35022
|
}
|
|
35037
|
-
function convertConfigFileToObject(sourceFile, errors,
|
|
35023
|
+
function convertConfigFileToObject(sourceFile, errors, jsonConversionNotifier) {
|
|
35038
35024
|
var _a2;
|
|
35039
35025
|
const rootExpression = (_a2 = sourceFile.statements[0]) == null ? void 0 : _a2.expression;
|
|
35040
|
-
const knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : void 0;
|
|
35041
35026
|
if (rootExpression && rootExpression.kind !== 208 /* ObjectLiteralExpression */) {
|
|
35042
35027
|
errors.push(createDiagnosticForNodeInSourceFile(
|
|
35043
35028
|
sourceFile,
|
|
@@ -35048,52 +35033,46 @@ function convertConfigFileToObject(sourceFile, errors, reportOptionsErrors, opti
|
|
|
35048
35033
|
if (isArrayLiteralExpression(rootExpression)) {
|
|
35049
35034
|
const firstObject = find(rootExpression.elements, isObjectLiteralExpression);
|
|
35050
35035
|
if (firstObject) {
|
|
35051
|
-
return
|
|
35036
|
+
return convertToJson(
|
|
35052
35037
|
sourceFile,
|
|
35053
35038
|
firstObject,
|
|
35054
35039
|
errors,
|
|
35055
35040
|
/*returnValue*/
|
|
35056
35041
|
true,
|
|
35057
|
-
|
|
35058
|
-
optionsIterator
|
|
35042
|
+
jsonConversionNotifier
|
|
35059
35043
|
);
|
|
35060
35044
|
}
|
|
35061
35045
|
}
|
|
35062
35046
|
return {};
|
|
35063
35047
|
}
|
|
35064
|
-
return
|
|
35048
|
+
return convertToJson(
|
|
35065
35049
|
sourceFile,
|
|
35066
35050
|
rootExpression,
|
|
35067
35051
|
errors,
|
|
35068
35052
|
/*returnValue*/
|
|
35069
35053
|
true,
|
|
35070
|
-
|
|
35071
|
-
optionsIterator
|
|
35054
|
+
jsonConversionNotifier
|
|
35072
35055
|
);
|
|
35073
35056
|
}
|
|
35074
35057
|
function convertToObject(sourceFile, errors) {
|
|
35075
35058
|
var _a2;
|
|
35076
|
-
return
|
|
35059
|
+
return convertToJson(
|
|
35077
35060
|
sourceFile,
|
|
35078
35061
|
(_a2 = sourceFile.statements[0]) == null ? void 0 : _a2.expression,
|
|
35079
35062
|
errors,
|
|
35080
35063
|
/*returnValue*/
|
|
35081
35064
|
true,
|
|
35082
|
-
/*knownRootOptions*/
|
|
35083
|
-
void 0,
|
|
35084
35065
|
/*jsonConversionNotifier*/
|
|
35085
35066
|
void 0
|
|
35086
35067
|
);
|
|
35087
35068
|
}
|
|
35088
|
-
function
|
|
35069
|
+
function convertToJson(sourceFile, rootExpression, errors, returnValue, jsonConversionNotifier) {
|
|
35089
35070
|
if (!rootExpression) {
|
|
35090
35071
|
return returnValue ? {} : void 0;
|
|
35091
35072
|
}
|
|
35092
|
-
return convertPropertyValueToJson(rootExpression,
|
|
35093
|
-
function
|
|
35094
|
-
|
|
35095
|
-
}
|
|
35096
|
-
function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) {
|
|
35073
|
+
return convertPropertyValueToJson(rootExpression, jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.rootOptions);
|
|
35074
|
+
function convertObjectLiteralExpressionToJson(node, objectOption) {
|
|
35075
|
+
var _a2;
|
|
35097
35076
|
const result = returnValue ? {} : void 0;
|
|
35098
35077
|
for (const element of node.properties) {
|
|
35099
35078
|
if (element.kind !== 300 /* PropertyAssignment */) {
|
|
@@ -35108,38 +35087,13 @@ function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue,
|
|
|
35108
35087
|
}
|
|
35109
35088
|
const textOfKey = isComputedNonLiteralName(element.name) ? void 0 : getTextOfPropertyName(element.name);
|
|
35110
35089
|
const keyText = textOfKey && unescapeLeadingUnderscores(textOfKey);
|
|
35111
|
-
const option = keyText
|
|
35112
|
-
if (keyText && extraKeyDiagnostics && !option) {
|
|
35113
|
-
if (knownOptions) {
|
|
35114
|
-
errors.push(createUnknownOptionError(
|
|
35115
|
-
keyText,
|
|
35116
|
-
extraKeyDiagnostics,
|
|
35117
|
-
(message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, element.name, message, arg0, arg1)
|
|
35118
|
-
));
|
|
35119
|
-
} else {
|
|
35120
|
-
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
|
|
35121
|
-
}
|
|
35122
|
-
}
|
|
35090
|
+
const option = keyText ? (_a2 = objectOption == null ? void 0 : objectOption.elementOptions) == null ? void 0 : _a2.get(keyText) : void 0;
|
|
35123
35091
|
const value = convertPropertyValueToJson(element.initializer, option);
|
|
35124
35092
|
if (typeof keyText !== "undefined") {
|
|
35125
35093
|
if (returnValue) {
|
|
35126
35094
|
result[keyText] = value;
|
|
35127
35095
|
}
|
|
35128
|
-
|
|
35129
|
-
(parentOption || isRootOptionMap(knownOptions))) {
|
|
35130
|
-
const isValidOptionValue = isCompilerOptionsValue(option, value);
|
|
35131
|
-
if (parentOption) {
|
|
35132
|
-
if (isValidOptionValue) {
|
|
35133
|
-
jsonConversionNotifier.onSetValidOptionKeyValueInParent(parentOption, option, value);
|
|
35134
|
-
}
|
|
35135
|
-
} else if (isRootOptionMap(knownOptions)) {
|
|
35136
|
-
if (isValidOptionValue) {
|
|
35137
|
-
jsonConversionNotifier.onSetValidOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
|
|
35138
|
-
} else if (!option) {
|
|
35139
|
-
jsonConversionNotifier.onSetUnknownOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
|
|
35140
|
-
}
|
|
35141
|
-
}
|
|
35142
|
-
}
|
|
35096
|
+
jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.onPropertySet(keyText, value, element, objectOption, option);
|
|
35143
35097
|
}
|
|
35144
35098
|
}
|
|
35145
35099
|
return result;
|
|
@@ -35152,112 +35106,40 @@ function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue,
|
|
|
35152
35106
|
return filter(elements.map((element) => convertPropertyValueToJson(element, elementOption)), (v) => v !== void 0);
|
|
35153
35107
|
}
|
|
35154
35108
|
function convertPropertyValueToJson(valueExpression, option) {
|
|
35155
|
-
let invalidReported;
|
|
35156
35109
|
switch (valueExpression.kind) {
|
|
35157
35110
|
case 111 /* TrueKeyword */:
|
|
35158
|
-
|
|
35159
|
-
return validateValue(
|
|
35160
|
-
/*value*/
|
|
35161
|
-
true
|
|
35162
|
-
);
|
|
35111
|
+
return true;
|
|
35163
35112
|
case 96 /* FalseKeyword */:
|
|
35164
|
-
|
|
35165
|
-
return validateValue(
|
|
35166
|
-
/*value*/
|
|
35167
|
-
false
|
|
35168
|
-
);
|
|
35113
|
+
return false;
|
|
35169
35114
|
case 105 /* NullKeyword */:
|
|
35170
|
-
|
|
35171
|
-
return validateValue(
|
|
35172
|
-
/*value*/
|
|
35173
|
-
null
|
|
35174
|
-
);
|
|
35115
|
+
return null;
|
|
35175
35116
|
case 10 /* StringLiteral */:
|
|
35176
35117
|
if (!isDoubleQuotedString(valueExpression)) {
|
|
35177
35118
|
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.String_literal_with_double_quotes_expected));
|
|
35178
35119
|
}
|
|
35179
|
-
|
|
35180
|
-
const text = valueExpression.text;
|
|
35181
|
-
if (option) {
|
|
35182
|
-
Debug.assert(option.type !== "listOrElement" || option.element.type === "string", "Only string or array of string is handled for now");
|
|
35183
|
-
}
|
|
35184
|
-
if (option && !isString(option.type)) {
|
|
35185
|
-
const customOption = option;
|
|
35186
|
-
if (!customOption.type.has(text.toLowerCase())) {
|
|
35187
|
-
errors.push(
|
|
35188
|
-
createDiagnosticForInvalidCustomType(
|
|
35189
|
-
customOption,
|
|
35190
|
-
(message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, message, arg0, arg1)
|
|
35191
|
-
)
|
|
35192
|
-
);
|
|
35193
|
-
invalidReported = true;
|
|
35194
|
-
}
|
|
35195
|
-
}
|
|
35196
|
-
return validateValue(text);
|
|
35120
|
+
return valueExpression.text;
|
|
35197
35121
|
case 8 /* NumericLiteral */:
|
|
35198
|
-
|
|
35199
|
-
return validateValue(Number(valueExpression.text));
|
|
35122
|
+
return Number(valueExpression.text);
|
|
35200
35123
|
case 222 /* PrefixUnaryExpression */:
|
|
35201
35124
|
if (valueExpression.operator !== 40 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) {
|
|
35202
35125
|
break;
|
|
35203
35126
|
}
|
|
35204
|
-
|
|
35205
|
-
return validateValue(-Number(valueExpression.operand.text));
|
|
35127
|
+
return -Number(valueExpression.operand.text);
|
|
35206
35128
|
case 208 /* ObjectLiteralExpression */:
|
|
35207
|
-
reportInvalidOptionValue(option && option.type !== "object" && (option.type !== "listOrElement" || option.element.type !== "object"));
|
|
35208
35129
|
const objectLiteralExpression = valueExpression;
|
|
35209
|
-
|
|
35210
|
-
const { elementOptions, extraKeyDiagnostics, name: optionName } = option;
|
|
35211
|
-
return validateValue(convertObjectLiteralExpressionToJson(
|
|
35212
|
-
objectLiteralExpression,
|
|
35213
|
-
elementOptions,
|
|
35214
|
-
extraKeyDiagnostics,
|
|
35215
|
-
optionName
|
|
35216
|
-
));
|
|
35217
|
-
} else {
|
|
35218
|
-
return validateValue(convertObjectLiteralExpressionToJson(
|
|
35219
|
-
objectLiteralExpression,
|
|
35220
|
-
/* knownOptions*/
|
|
35221
|
-
void 0,
|
|
35222
|
-
/*extraKeyDiagnosticMessage */
|
|
35223
|
-
void 0,
|
|
35224
|
-
/*parentOption*/
|
|
35225
|
-
void 0
|
|
35226
|
-
));
|
|
35227
|
-
}
|
|
35130
|
+
return convertObjectLiteralExpressionToJson(objectLiteralExpression, option);
|
|
35228
35131
|
case 207 /* ArrayLiteralExpression */:
|
|
35229
|
-
|
|
35230
|
-
return validateValue(convertArrayLiteralExpressionToJson(
|
|
35132
|
+
return convertArrayLiteralExpressionToJson(
|
|
35231
35133
|
valueExpression.elements,
|
|
35232
35134
|
option && option.element
|
|
35233
|
-
)
|
|
35135
|
+
);
|
|
35234
35136
|
}
|
|
35235
35137
|
if (option) {
|
|
35236
|
-
|
|
35237
|
-
/*isError*/
|
|
35238
|
-
true
|
|
35239
|
-
);
|
|
35138
|
+
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option)));
|
|
35240
35139
|
} else {
|
|
35241
35140
|
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal));
|
|
35242
35141
|
}
|
|
35243
35142
|
return void 0;
|
|
35244
|
-
function validateValue(value) {
|
|
35245
|
-
var _a2;
|
|
35246
|
-
if (!invalidReported) {
|
|
35247
|
-
const diagnostic = (_a2 = option == null ? void 0 : option.extraValidation) == null ? void 0 : _a2.call(option, value);
|
|
35248
|
-
if (diagnostic) {
|
|
35249
|
-
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ...diagnostic));
|
|
35250
|
-
return void 0;
|
|
35251
|
-
}
|
|
35252
|
-
}
|
|
35253
|
-
return value;
|
|
35254
|
-
}
|
|
35255
|
-
function reportInvalidOptionValue(isError) {
|
|
35256
|
-
if (isError) {
|
|
35257
|
-
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option)));
|
|
35258
|
-
invalidReported = true;
|
|
35259
|
-
}
|
|
35260
|
-
}
|
|
35261
35143
|
}
|
|
35262
35144
|
function isDoubleQuotedString(node) {
|
|
35263
35145
|
return isStringLiteral(node) && isStringDoubleQuoted(node, sourceFile);
|
|
@@ -35269,7 +35151,7 @@ function getCompilerOptionValueTypeString(option) {
|
|
|
35269
35151
|
function isCompilerOptionsValue(option, value) {
|
|
35270
35152
|
if (option) {
|
|
35271
35153
|
if (isNullOrUndefined(value))
|
|
35272
|
-
return
|
|
35154
|
+
return !option.disallowNullOrUndefined;
|
|
35273
35155
|
if (option.type === "list") {
|
|
35274
35156
|
return isArray(value);
|
|
35275
35157
|
}
|
|
@@ -35615,7 +35497,7 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
35615
35497
|
const fileName = configFileName || "tsconfig.json";
|
|
35616
35498
|
const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
|
|
35617
35499
|
const nodeValue = firstDefined(getTsConfigPropArray(sourceFile, "files"), (property) => property.initializer);
|
|
35618
|
-
const error =
|
|
35500
|
+
const error = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
|
|
35619
35501
|
errors.push(error);
|
|
35620
35502
|
} else {
|
|
35621
35503
|
createCompilerDiagnosticOnlyIfJson(Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json");
|
|
@@ -35717,9 +35599,9 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
35717
35599
|
}
|
|
35718
35600
|
return "no-prop";
|
|
35719
35601
|
}
|
|
35720
|
-
function createCompilerDiagnosticOnlyIfJson(message,
|
|
35602
|
+
function createCompilerDiagnosticOnlyIfJson(message, ...args) {
|
|
35721
35603
|
if (!sourceFile) {
|
|
35722
|
-
errors.push(createCompilerDiagnostic(message,
|
|
35604
|
+
errors.push(createCompilerDiagnostic(message, ...args));
|
|
35723
35605
|
}
|
|
35724
35606
|
}
|
|
35725
35607
|
}
|
|
@@ -35818,27 +35700,42 @@ function parseOwnConfigOfJson(json, host, basePath, configFileName, errors) {
|
|
|
35818
35700
|
const typeAcquisition = convertTypeAcquisitionFromJsonWorker(json.typeAcquisition, basePath, errors, configFileName);
|
|
35819
35701
|
const watchOptions = convertWatchOptionsFromJsonWorker(json.watchOptions, basePath, errors);
|
|
35820
35702
|
json.compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);
|
|
35703
|
+
const extendedConfigPath = json.extends || json.extends === "" ? getExtendsConfigPathOrArray(json.extends, host, basePath, configFileName, errors) : void 0;
|
|
35704
|
+
return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath };
|
|
35705
|
+
}
|
|
35706
|
+
function getExtendsConfigPathOrArray(value, host, basePath, configFileName, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
35821
35707
|
let extendedConfigPath;
|
|
35822
|
-
|
|
35823
|
-
|
|
35824
|
-
|
|
35825
|
-
|
|
35826
|
-
|
|
35827
|
-
|
|
35828
|
-
|
|
35708
|
+
const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
|
|
35709
|
+
if (isString(value)) {
|
|
35710
|
+
extendedConfigPath = getExtendsConfigPath(
|
|
35711
|
+
value,
|
|
35712
|
+
host,
|
|
35713
|
+
newBase,
|
|
35714
|
+
errors,
|
|
35715
|
+
valueExpression,
|
|
35716
|
+
sourceFile
|
|
35717
|
+
);
|
|
35718
|
+
} else if (isArray(value)) {
|
|
35719
|
+
extendedConfigPath = [];
|
|
35720
|
+
for (let index = 0; index < value.length; index++) {
|
|
35721
|
+
const fileName = value[index];
|
|
35722
|
+
if (isString(fileName)) {
|
|
35723
|
+
extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(
|
|
35724
|
+
fileName,
|
|
35725
|
+
host,
|
|
35726
|
+
newBase,
|
|
35727
|
+
errors,
|
|
35728
|
+
valueExpression == null ? void 0 : valueExpression.elements[index],
|
|
35729
|
+
sourceFile
|
|
35730
|
+
));
|
|
35829
35731
|
} else {
|
|
35830
|
-
|
|
35831
|
-
for (const fileName of json.extends) {
|
|
35832
|
-
if (isString(fileName)) {
|
|
35833
|
-
extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(fileName, host, newBase, errors, createCompilerDiagnostic));
|
|
35834
|
-
} else {
|
|
35835
|
-
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", getCompilerOptionValueTypeString(extendsOptionDeclaration.element)));
|
|
35836
|
-
}
|
|
35837
|
-
}
|
|
35732
|
+
convertJsonOption(extendsOptionDeclaration.element, value, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile);
|
|
35838
35733
|
}
|
|
35839
35734
|
}
|
|
35735
|
+
} else {
|
|
35736
|
+
convertJsonOption(extendsOptionDeclaration, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
|
|
35840
35737
|
}
|
|
35841
|
-
return
|
|
35738
|
+
return extendedConfigPath;
|
|
35842
35739
|
}
|
|
35843
35740
|
function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors) {
|
|
35844
35741
|
const options = getDefaultCompilerOptions(configFileName);
|
|
@@ -35846,69 +35743,11 @@ function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileNa
|
|
|
35846
35743
|
let watchOptions;
|
|
35847
35744
|
let extendedConfigPath;
|
|
35848
35745
|
let rootCompilerOptions;
|
|
35849
|
-
const
|
|
35850
|
-
onSetValidOptionKeyValueInParent(parentOption, option, value) {
|
|
35851
|
-
let currentOption;
|
|
35852
|
-
switch (parentOption) {
|
|
35853
|
-
case "compilerOptions":
|
|
35854
|
-
currentOption = options;
|
|
35855
|
-
break;
|
|
35856
|
-
case "watchOptions":
|
|
35857
|
-
currentOption = watchOptions || (watchOptions = {});
|
|
35858
|
-
break;
|
|
35859
|
-
case "typeAcquisition":
|
|
35860
|
-
currentOption = typeAcquisition || (typeAcquisition = getDefaultTypeAcquisition(configFileName));
|
|
35861
|
-
break;
|
|
35862
|
-
default:
|
|
35863
|
-
Debug.fail("Unknown option");
|
|
35864
|
-
}
|
|
35865
|
-
currentOption[option.name] = normalizeOptionValue(option, basePath, value);
|
|
35866
|
-
},
|
|
35867
|
-
onSetValidOptionKeyValueInRoot(key, _keyNode, value, valueNode) {
|
|
35868
|
-
switch (key) {
|
|
35869
|
-
case "extends":
|
|
35870
|
-
const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
|
|
35871
|
-
if (isString(value)) {
|
|
35872
|
-
extendedConfigPath = getExtendsConfigPath(
|
|
35873
|
-
value,
|
|
35874
|
-
host,
|
|
35875
|
-
newBase,
|
|
35876
|
-
errors,
|
|
35877
|
-
(message, arg0) => createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0)
|
|
35878
|
-
);
|
|
35879
|
-
} else {
|
|
35880
|
-
extendedConfigPath = [];
|
|
35881
|
-
for (let index = 0; index < value.length; index++) {
|
|
35882
|
-
const fileName = value[index];
|
|
35883
|
-
if (isString(fileName)) {
|
|
35884
|
-
extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(
|
|
35885
|
-
fileName,
|
|
35886
|
-
host,
|
|
35887
|
-
newBase,
|
|
35888
|
-
errors,
|
|
35889
|
-
(message, arg0) => createDiagnosticForNodeInSourceFile(sourceFile, valueNode.elements[index], message, arg0)
|
|
35890
|
-
));
|
|
35891
|
-
}
|
|
35892
|
-
}
|
|
35893
|
-
}
|
|
35894
|
-
return;
|
|
35895
|
-
}
|
|
35896
|
-
},
|
|
35897
|
-
onSetUnknownOptionKeyValueInRoot(key, keyNode, _value, _valueNode) {
|
|
35898
|
-
if (key === "excludes") {
|
|
35899
|
-
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, keyNode, Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
|
|
35900
|
-
}
|
|
35901
|
-
if (find(commandOptionsWithoutBuild, (opt) => opt.name === key)) {
|
|
35902
|
-
rootCompilerOptions = append(rootCompilerOptions, keyNode);
|
|
35903
|
-
}
|
|
35904
|
-
}
|
|
35905
|
-
};
|
|
35746
|
+
const rootOptions = getTsconfigRootOptionsMap();
|
|
35906
35747
|
const json = convertConfigFileToObject(
|
|
35907
35748
|
sourceFile,
|
|
35908
35749
|
errors,
|
|
35909
|
-
|
|
35910
|
-
true,
|
|
35911
|
-
optionsIterator
|
|
35750
|
+
{ rootOptions, onPropertySet }
|
|
35912
35751
|
);
|
|
35913
35752
|
if (!typeAcquisition) {
|
|
35914
35753
|
typeAcquisition = getDefaultTypeAcquisition(configFileName);
|
|
@@ -35917,15 +35756,57 @@ function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileNa
|
|
|
35917
35756
|
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, rootCompilerOptions[0], Diagnostics._0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file, getTextOfPropertyName(rootCompilerOptions[0])));
|
|
35918
35757
|
}
|
|
35919
35758
|
return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath };
|
|
35759
|
+
function onPropertySet(keyText, value, propertyAssignment, parentOption, option) {
|
|
35760
|
+
if (option && option !== extendsOptionDeclaration)
|
|
35761
|
+
value = convertJsonOption(option, value, basePath, errors, propertyAssignment, propertyAssignment.initializer, sourceFile);
|
|
35762
|
+
if (parentOption == null ? void 0 : parentOption.name) {
|
|
35763
|
+
if (option) {
|
|
35764
|
+
let currentOption;
|
|
35765
|
+
if (parentOption === compilerOptionsDeclaration)
|
|
35766
|
+
currentOption = options;
|
|
35767
|
+
else if (parentOption === watchOptionsDeclaration)
|
|
35768
|
+
currentOption = watchOptions != null ? watchOptions : watchOptions = {};
|
|
35769
|
+
else if (parentOption === typeAcquisitionDeclaration)
|
|
35770
|
+
currentOption = typeAcquisition != null ? typeAcquisition : typeAcquisition = getDefaultTypeAcquisition(configFileName);
|
|
35771
|
+
else
|
|
35772
|
+
Debug.fail("Unknown option");
|
|
35773
|
+
currentOption[option.name] = value;
|
|
35774
|
+
} else if (keyText && (parentOption == null ? void 0 : parentOption.extraKeyDiagnostics)) {
|
|
35775
|
+
if (parentOption.elementOptions) {
|
|
35776
|
+
errors.push(createUnknownOptionError(
|
|
35777
|
+
keyText,
|
|
35778
|
+
parentOption.extraKeyDiagnostics,
|
|
35779
|
+
/*unknownOptionErrorText*/
|
|
35780
|
+
void 0,
|
|
35781
|
+
propertyAssignment.name,
|
|
35782
|
+
sourceFile
|
|
35783
|
+
));
|
|
35784
|
+
} else {
|
|
35785
|
+
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, propertyAssignment.name, parentOption.extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
|
|
35786
|
+
}
|
|
35787
|
+
}
|
|
35788
|
+
} else if (parentOption === rootOptions) {
|
|
35789
|
+
if (option === extendsOptionDeclaration) {
|
|
35790
|
+
extendedConfigPath = getExtendsConfigPathOrArray(value, host, basePath, configFileName, errors, propertyAssignment, propertyAssignment.initializer, sourceFile);
|
|
35791
|
+
} else if (!option) {
|
|
35792
|
+
if (keyText === "excludes") {
|
|
35793
|
+
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, propertyAssignment.name, Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
|
|
35794
|
+
}
|
|
35795
|
+
if (find(commandOptionsWithoutBuild, (opt) => opt.name === keyText)) {
|
|
35796
|
+
rootCompilerOptions = append(rootCompilerOptions, propertyAssignment.name);
|
|
35797
|
+
}
|
|
35798
|
+
}
|
|
35799
|
+
}
|
|
35800
|
+
}
|
|
35920
35801
|
}
|
|
35921
|
-
function getExtendsConfigPath(extendedConfig, host, basePath, errors,
|
|
35802
|
+
function getExtendsConfigPath(extendedConfig, host, basePath, errors, valueExpression, sourceFile) {
|
|
35922
35803
|
extendedConfig = normalizeSlashes(extendedConfig);
|
|
35923
35804
|
if (isRootedDiskPath(extendedConfig) || startsWith(extendedConfig, "./") || startsWith(extendedConfig, "../")) {
|
|
35924
35805
|
let extendedConfigPath = getNormalizedAbsolutePath(extendedConfig, basePath);
|
|
35925
35806
|
if (!host.fileExists(extendedConfigPath) && !endsWith(extendedConfigPath, ".json" /* Json */)) {
|
|
35926
35807
|
extendedConfigPath = `${extendedConfigPath}.json`;
|
|
35927
35808
|
if (!host.fileExists(extendedConfigPath)) {
|
|
35928
|
-
errors.push(
|
|
35809
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.File_0_not_found, extendedConfig));
|
|
35929
35810
|
return void 0;
|
|
35930
35811
|
}
|
|
35931
35812
|
}
|
|
@@ -35936,9 +35817,9 @@ function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiag
|
|
|
35936
35817
|
return resolved.resolvedModule.resolvedFileName;
|
|
35937
35818
|
}
|
|
35938
35819
|
if (extendedConfig === "") {
|
|
35939
|
-
errors.push(
|
|
35820
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Compiler_option_0_cannot_be_given_an_empty_string, "extends"));
|
|
35940
35821
|
} else {
|
|
35941
|
-
errors.push(
|
|
35822
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.File_0_not_found, extendedConfig));
|
|
35942
35823
|
}
|
|
35943
35824
|
return void 0;
|
|
35944
35825
|
}
|
|
@@ -36030,43 +35911,34 @@ function convertOptionsFromJson(optionsNameMap, jsonOptions, basePath, defaultOp
|
|
|
36030
35911
|
if (opt) {
|
|
36031
35912
|
(defaultOptions || (defaultOptions = {}))[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors);
|
|
36032
35913
|
} else {
|
|
36033
|
-
errors.push(createUnknownOptionError(id, diagnostics
|
|
35914
|
+
errors.push(createUnknownOptionError(id, diagnostics));
|
|
36034
35915
|
}
|
|
36035
35916
|
}
|
|
36036
35917
|
return defaultOptions;
|
|
36037
35918
|
}
|
|
36038
|
-
function
|
|
35919
|
+
function createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, message, ...args) {
|
|
35920
|
+
return sourceFile && node ? createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args) : createCompilerDiagnostic(message, ...args);
|
|
35921
|
+
}
|
|
35922
|
+
function convertJsonOption(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
35923
|
+
if (opt.isCommandLineOnly) {
|
|
35924
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, propertyAssignment == null ? void 0 : propertyAssignment.name, Diagnostics.Option_0_can_only_be_specified_on_command_line, opt.name));
|
|
35925
|
+
return void 0;
|
|
35926
|
+
}
|
|
36039
35927
|
if (isCompilerOptionsValue(opt, value)) {
|
|
36040
35928
|
const optType = opt.type;
|
|
36041
35929
|
if (optType === "list" && isArray(value)) {
|
|
36042
|
-
return convertJsonOptionOfListType(opt, value, basePath, errors);
|
|
35930
|
+
return convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
|
|
36043
35931
|
} else if (optType === "listOrElement") {
|
|
36044
|
-
return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors) : convertJsonOption(opt.element, value, basePath, errors);
|
|
35932
|
+
return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile) : convertJsonOption(opt.element, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
|
|
36045
35933
|
} else if (!isString(opt.type)) {
|
|
36046
|
-
return convertJsonOptionOfCustomType(opt, value, errors);
|
|
35934
|
+
return convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile);
|
|
36047
35935
|
}
|
|
36048
|
-
const validatedValue = validateJsonOptionValue(opt, value, errors);
|
|
35936
|
+
const validatedValue = validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile);
|
|
36049
35937
|
return isNullOrUndefined(validatedValue) ? validatedValue : normalizeNonListOptionValue(opt, basePath, validatedValue);
|
|
36050
35938
|
} else {
|
|
36051
|
-
errors.push(
|
|
35939
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt)));
|
|
36052
35940
|
}
|
|
36053
35941
|
}
|
|
36054
|
-
function normalizeOptionValue(option, basePath, value) {
|
|
36055
|
-
if (isNullOrUndefined(value))
|
|
36056
|
-
return void 0;
|
|
36057
|
-
if (option.type === "listOrElement" && !isArray(value))
|
|
36058
|
-
return normalizeOptionValue(option.element, basePath, value);
|
|
36059
|
-
else if (option.type === "list" || option.type === "listOrElement") {
|
|
36060
|
-
const listOption = option;
|
|
36061
|
-
if (listOption.element.isFilePath || !isString(listOption.element.type)) {
|
|
36062
|
-
return filter(map(value, (v) => normalizeOptionValue(listOption.element, basePath, v)), (v) => listOption.listPreserveFalsyValues ? true : !!v);
|
|
36063
|
-
}
|
|
36064
|
-
return value;
|
|
36065
|
-
} else if (!isString(option.type)) {
|
|
36066
|
-
return option.type.get(isString(value) ? value.toLowerCase() : value);
|
|
36067
|
-
}
|
|
36068
|
-
return normalizeNonListOptionValue(option, basePath, value);
|
|
36069
|
-
}
|
|
36070
35942
|
function normalizeNonListOptionValue(option, basePath, value) {
|
|
36071
35943
|
if (option.isFilePath) {
|
|
36072
35944
|
value = getNormalizedAbsolutePath(value, basePath);
|
|
@@ -36076,29 +35948,29 @@ function normalizeNonListOptionValue(option, basePath, value) {
|
|
|
36076
35948
|
}
|
|
36077
35949
|
return value;
|
|
36078
35950
|
}
|
|
36079
|
-
function validateJsonOptionValue(opt, value, errors) {
|
|
35951
|
+
function validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile) {
|
|
36080
35952
|
var _a2;
|
|
36081
35953
|
if (isNullOrUndefined(value))
|
|
36082
35954
|
return void 0;
|
|
36083
35955
|
const d = (_a2 = opt.extraValidation) == null ? void 0 : _a2.call(opt, value);
|
|
36084
35956
|
if (!d)
|
|
36085
35957
|
return value;
|
|
36086
|
-
errors.push(
|
|
35958
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, ...d));
|
|
36087
35959
|
return void 0;
|
|
36088
35960
|
}
|
|
36089
|
-
function convertJsonOptionOfCustomType(opt, value, errors) {
|
|
35961
|
+
function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile) {
|
|
36090
35962
|
if (isNullOrUndefined(value))
|
|
36091
35963
|
return void 0;
|
|
36092
35964
|
const key = value.toLowerCase();
|
|
36093
35965
|
const val = opt.type.get(key);
|
|
36094
35966
|
if (val !== void 0) {
|
|
36095
|
-
return validateJsonOptionValue(opt, val, errors);
|
|
35967
|
+
return validateJsonOptionValue(opt, val, errors, valueExpression, sourceFile);
|
|
36096
35968
|
} else {
|
|
36097
|
-
errors.push(
|
|
35969
|
+
errors.push(createDiagnosticForInvalidCustomType(opt, (message, ...args) => createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, message, ...args)));
|
|
36098
35970
|
}
|
|
36099
35971
|
}
|
|
36100
|
-
function convertJsonOptionOfListType(option, values, basePath, errors) {
|
|
36101
|
-
return filter(map(values, (v) => convertJsonOption(option.element, v, basePath, errors)), (v) => option.listPreserveFalsyValues ? true : !!v);
|
|
35972
|
+
function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
35973
|
+
return filter(map(values, (v, index) => convertJsonOption(option.element, v, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile)), (v) => option.listPreserveFalsyValues ? true : !!v);
|
|
36102
35974
|
}
|
|
36103
35975
|
var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/;
|
|
36104
35976
|
var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
|
|
@@ -36207,7 +36079,7 @@ function validateSpecs(specs, errors, disallowTrailingRecursion, jsonSourceFile,
|
|
|
36207
36079
|
});
|
|
36208
36080
|
function createDiagnostic(message, spec) {
|
|
36209
36081
|
const element = getTsConfigPropArrayElementValue(jsonSourceFile, specKey, spec);
|
|
36210
|
-
return
|
|
36082
|
+
return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(jsonSourceFile, element, message, spec);
|
|
36211
36083
|
}
|
|
36212
36084
|
}
|
|
36213
36085
|
function specToDiagnostic(spec, disallowTrailingRecursion) {
|
|
@@ -38904,8 +38776,8 @@ function createBinder() {
|
|
|
38904
38776
|
var reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
|
|
38905
38777
|
var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
|
|
38906
38778
|
return bindSourceFile2;
|
|
38907
|
-
function createDiagnosticForNode2(node, message,
|
|
38908
|
-
return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message,
|
|
38779
|
+
function createDiagnosticForNode2(node, message, ...args) {
|
|
38780
|
+
return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, ...args);
|
|
38909
38781
|
}
|
|
38910
38782
|
function bindSourceFile2(f, opts) {
|
|
38911
38783
|
var _a2, _b;
|
|
@@ -39099,7 +38971,7 @@ function createBinder() {
|
|
|
39099
38971
|
const declarationName = getNameOfDeclaration(node) || node;
|
|
39100
38972
|
forEach(symbol.declarations, (declaration, index) => {
|
|
39101
38973
|
const decl = getNameOfDeclaration(declaration) || declaration;
|
|
39102
|
-
const diag3 = createDiagnosticForNode2(decl, message,
|
|
38974
|
+
const diag3 = messageNeedsName ? createDiagnosticForNode2(decl, message, getDisplayName(declaration)) : createDiagnosticForNode2(decl, message);
|
|
39103
38975
|
file.bindDiagnostics.push(
|
|
39104
38976
|
multipleDefaultExports ? addRelatedInfo(diag3, createDiagnosticForNode2(declarationName, index === 0 ? Diagnostics.Another_export_default_is_here : Diagnostics.and_here)) : diag3
|
|
39105
38977
|
);
|
|
@@ -39107,7 +38979,7 @@ function createBinder() {
|
|
|
39107
38979
|
relatedInformation.push(createDiagnosticForNode2(decl, Diagnostics.The_first_export_default_is_here));
|
|
39108
38980
|
}
|
|
39109
38981
|
});
|
|
39110
|
-
const diag2 = createDiagnosticForNode2(declarationName, message,
|
|
38982
|
+
const diag2 = messageNeedsName ? createDiagnosticForNode2(declarationName, message, getDisplayName(node)) : createDiagnosticForNode2(declarationName, message);
|
|
39111
38983
|
file.bindDiagnostics.push(addRelatedInfo(diag2, ...relatedInformation));
|
|
39112
38984
|
symbol = createSymbol(0 /* None */, name);
|
|
39113
38985
|
}
|
|
@@ -40568,9 +40440,9 @@ function createBinder() {
|
|
|
40568
40440
|
}
|
|
40569
40441
|
}
|
|
40570
40442
|
}
|
|
40571
|
-
function errorOnFirstToken(node, message,
|
|
40443
|
+
function errorOnFirstToken(node, message, ...args) {
|
|
40572
40444
|
const span = getSpanOfTokenAtPosition(file, node.pos);
|
|
40573
|
-
file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message,
|
|
40445
|
+
file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, ...args));
|
|
40574
40446
|
}
|
|
40575
40447
|
function errorOrSuggestionOnNode(isError, node, message) {
|
|
40576
40448
|
errorOrSuggestionOnRange(isError, node, node, message);
|
|
@@ -42680,6 +42552,7 @@ function createTypeChecker(host) {
|
|
|
42680
42552
|
var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
|
|
42681
42553
|
var requireSymbol = createSymbol(4 /* Property */, "require");
|
|
42682
42554
|
var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
|
|
42555
|
+
var canCollectSymbolAliasAccessabilityData = !compilerOptions.verbatimModuleSyntax || !!compilerOptions.importsNotUsedAsValues;
|
|
42683
42556
|
var apparentArgumentCount;
|
|
42684
42557
|
const checker = {
|
|
42685
42558
|
getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
|
|
@@ -43507,8 +43380,8 @@ function createTypeChecker(host) {
|
|
|
43507
43380
|
getDiagnostics(sourceFile, cancellationToken2);
|
|
43508
43381
|
return emitResolver;
|
|
43509
43382
|
}
|
|
43510
|
-
function lookupOrIssueError(location, message,
|
|
43511
|
-
const diagnostic = location ? createDiagnosticForNode(location, message,
|
|
43383
|
+
function lookupOrIssueError(location, message, ...args) {
|
|
43384
|
+
const diagnostic = location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
|
|
43512
43385
|
const existing = diagnostics.lookup(diagnostic);
|
|
43513
43386
|
if (existing) {
|
|
43514
43387
|
return existing;
|
|
@@ -43517,16 +43390,16 @@ function createTypeChecker(host) {
|
|
|
43517
43390
|
return diagnostic;
|
|
43518
43391
|
}
|
|
43519
43392
|
}
|
|
43520
|
-
function errorSkippedOn(key, location, message,
|
|
43521
|
-
const diagnostic = error(location, message,
|
|
43393
|
+
function errorSkippedOn(key, location, message, ...args) {
|
|
43394
|
+
const diagnostic = error(location, message, ...args);
|
|
43522
43395
|
diagnostic.skippedOn = key;
|
|
43523
43396
|
return diagnostic;
|
|
43524
43397
|
}
|
|
43525
|
-
function createError(location, message,
|
|
43526
|
-
return location ? createDiagnosticForNode(location, message,
|
|
43398
|
+
function createError(location, message, ...args) {
|
|
43399
|
+
return location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
|
|
43527
43400
|
}
|
|
43528
|
-
function error(location, message,
|
|
43529
|
-
const diagnostic = createError(location, message,
|
|
43401
|
+
function error(location, message, ...args) {
|
|
43402
|
+
const diagnostic = createError(location, message, ...args);
|
|
43530
43403
|
diagnostics.add(diagnostic);
|
|
43531
43404
|
return diagnostic;
|
|
43532
43405
|
}
|
|
@@ -43537,19 +43410,19 @@ function createTypeChecker(host) {
|
|
|
43537
43410
|
suggestionDiagnostics.add({ ...diagnostic, category: 2 /* Suggestion */ });
|
|
43538
43411
|
}
|
|
43539
43412
|
}
|
|
43540
|
-
function errorOrSuggestion(isError, location, message,
|
|
43413
|
+
function errorOrSuggestion(isError, location, message, ...args) {
|
|
43541
43414
|
if (location.pos < 0 || location.end < 0) {
|
|
43542
43415
|
if (!isError) {
|
|
43543
43416
|
return;
|
|
43544
43417
|
}
|
|
43545
43418
|
const file = getSourceFileOfNode(location);
|
|
43546
|
-
addErrorOrSuggestion(isError, "message" in message ? createFileDiagnostic(file, 0, 0, message,
|
|
43419
|
+
addErrorOrSuggestion(isError, "message" in message ? createFileDiagnostic(file, 0, 0, message, ...args) : createDiagnosticForFileFromMessageChain(file, message));
|
|
43547
43420
|
return;
|
|
43548
43421
|
}
|
|
43549
|
-
addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message,
|
|
43422
|
+
addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, ...args) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message));
|
|
43550
43423
|
}
|
|
43551
|
-
function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message,
|
|
43552
|
-
const diagnostic = error(location, message,
|
|
43424
|
+
function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, ...args) {
|
|
43425
|
+
const diagnostic = error(location, message, ...args);
|
|
43553
43426
|
if (maybeMissingAwait) {
|
|
43554
43427
|
const related = createDiagnosticForNode(location, Diagnostics.Did_you_forget_to_use_await);
|
|
43555
43428
|
addRelatedInfo(diagnostic, related);
|
|
@@ -45423,7 +45296,7 @@ function createTypeChecker(host) {
|
|
|
45423
45296
|
return void 0;
|
|
45424
45297
|
}
|
|
45425
45298
|
function markExportAsReferenced(node) {
|
|
45426
|
-
if (
|
|
45299
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
45427
45300
|
return;
|
|
45428
45301
|
}
|
|
45429
45302
|
const symbol = getSymbolOfDeclaration(node);
|
|
@@ -45436,7 +45309,7 @@ function createTypeChecker(host) {
|
|
|
45436
45309
|
}
|
|
45437
45310
|
}
|
|
45438
45311
|
function markAliasSymbolAsReferenced(symbol) {
|
|
45439
|
-
Debug.assert(
|
|
45312
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
45440
45313
|
const links = getSymbolLinks(symbol);
|
|
45441
45314
|
if (!links.referenced) {
|
|
45442
45315
|
links.referenced = true;
|
|
@@ -45567,6 +45440,9 @@ function createTypeChecker(host) {
|
|
|
45567
45440
|
}
|
|
45568
45441
|
}
|
|
45569
45442
|
symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, meaning));
|
|
45443
|
+
if (!symbol && namespace.flags & 2097152 /* Alias */) {
|
|
45444
|
+
symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(resolveAlias(namespace)), right.escapedText, meaning));
|
|
45445
|
+
}
|
|
45570
45446
|
if (!symbol) {
|
|
45571
45447
|
if (!ignoreErrors) {
|
|
45572
45448
|
const namespaceName = getFullyQualifiedName(namespace);
|
|
@@ -47316,8 +47192,11 @@ function createTypeChecker(host) {
|
|
|
47316
47192
|
}
|
|
47317
47193
|
return typeToTypeNodeHelper(type2, context);
|
|
47318
47194
|
}
|
|
47195
|
+
function isMappedTypeHomomorphic(type2) {
|
|
47196
|
+
return !!getHomomorphicTypeVariable(type2);
|
|
47197
|
+
}
|
|
47319
47198
|
function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) {
|
|
47320
|
-
return
|
|
47199
|
+
return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2);
|
|
47321
47200
|
}
|
|
47322
47201
|
function createMappedTypeNodeFromType(type2) {
|
|
47323
47202
|
Debug.assert(!!(type2.flags & 524288 /* Object */));
|
|
@@ -53721,7 +53600,7 @@ function createTypeChecker(host) {
|
|
|
53721
53600
|
const typeVariable = getHomomorphicTypeVariable(type);
|
|
53722
53601
|
if (typeVariable && !type.declaration.nameType) {
|
|
53723
53602
|
const constraint = getConstraintOfTypeParameter(typeVariable);
|
|
53724
|
-
if (constraint &&
|
|
53603
|
+
if (constraint && everyType(constraint, isArrayOrTupleType)) {
|
|
53725
53604
|
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
53726
53605
|
}
|
|
53727
53606
|
}
|
|
@@ -56488,31 +56367,21 @@ function createTypeChecker(host) {
|
|
|
56488
56367
|
}
|
|
56489
56368
|
return type;
|
|
56490
56369
|
function addSpans(texts2, types2) {
|
|
56491
|
-
const isTextsArray = isArray(texts2);
|
|
56492
56370
|
for (let i = 0; i < types2.length; i++) {
|
|
56493
56371
|
const t = types2[i];
|
|
56494
|
-
const addText = isTextsArray ? texts2[i + 1] : texts2;
|
|
56495
56372
|
if (t.flags & (2944 /* Literal */ | 65536 /* Null */ | 32768 /* Undefined */)) {
|
|
56496
56373
|
text += getTemplateStringForType(t) || "";
|
|
56497
|
-
text +=
|
|
56498
|
-
if (!isTextsArray)
|
|
56499
|
-
return true;
|
|
56374
|
+
text += texts2[i + 1];
|
|
56500
56375
|
} else if (t.flags & 134217728 /* TemplateLiteral */) {
|
|
56501
56376
|
text += t.texts[0];
|
|
56502
56377
|
if (!addSpans(t.texts, t.types))
|
|
56503
56378
|
return false;
|
|
56504
|
-
text +=
|
|
56505
|
-
if (!isTextsArray)
|
|
56506
|
-
return true;
|
|
56379
|
+
text += texts2[i + 1];
|
|
56507
56380
|
} else if (isGenericIndexType(t) || isPatternLiteralPlaceholderType(t)) {
|
|
56508
56381
|
newTypes.push(t);
|
|
56509
56382
|
newTexts.push(text);
|
|
56510
|
-
text =
|
|
56511
|
-
} else
|
|
56512
|
-
const added = addSpans(texts2[i + 1], t.types);
|
|
56513
|
-
if (!added)
|
|
56514
|
-
return false;
|
|
56515
|
-
} else if (isTextsArray) {
|
|
56383
|
+
text = texts2[i + 1];
|
|
56384
|
+
} else {
|
|
56516
56385
|
return false;
|
|
56517
56386
|
}
|
|
56518
56387
|
}
|
|
@@ -56524,6 +56393,11 @@ function createTypeChecker(host) {
|
|
|
56524
56393
|
}
|
|
56525
56394
|
function createTemplateLiteralType(texts, types) {
|
|
56526
56395
|
const type = createType(134217728 /* TemplateLiteral */);
|
|
56396
|
+
type.objectFlags = getPropagatingFlagsOfTypes(
|
|
56397
|
+
types,
|
|
56398
|
+
/*excludeKinds*/
|
|
56399
|
+
98304 /* Nullable */
|
|
56400
|
+
);
|
|
56527
56401
|
type.texts = texts;
|
|
56528
56402
|
type.types = types;
|
|
56529
56403
|
return type;
|
|
@@ -56823,6 +56697,9 @@ function createTypeChecker(host) {
|
|
|
56823
56697
|
return accessNode.kind === 210 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.kind === 197 /* IndexedAccessType */ ? accessNode.indexType : accessNode.kind === 165 /* ComputedPropertyName */ ? accessNode.expression : accessNode;
|
|
56824
56698
|
}
|
|
56825
56699
|
function isPatternLiteralPlaceholderType(type) {
|
|
56700
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
56701
|
+
return some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 65536 /* Null */ | 32768 /* Undefined */)) || isPatternLiteralPlaceholderType(t));
|
|
56702
|
+
}
|
|
56826
56703
|
return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
|
|
56827
56704
|
}
|
|
56828
56705
|
function isPatternLiteralType(type) {
|
|
@@ -56838,7 +56715,7 @@ function createTypeChecker(host) {
|
|
|
56838
56715
|
return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
|
|
56839
56716
|
}
|
|
56840
56717
|
function getGenericObjectFlags(type) {
|
|
56841
|
-
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
56718
|
+
if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
|
|
56842
56719
|
if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
|
|
56843
56720
|
type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
|
|
56844
56721
|
}
|
|
@@ -56850,7 +56727,7 @@ function createTypeChecker(host) {
|
|
|
56850
56727
|
}
|
|
56851
56728
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
56852
56729
|
}
|
|
56853
|
-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ |
|
|
56730
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
56854
56731
|
}
|
|
56855
56732
|
function getSimplifiedType(type, writing) {
|
|
56856
56733
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -57864,6 +57741,9 @@ function createTypeChecker(host) {
|
|
|
57864
57741
|
if (!result) {
|
|
57865
57742
|
const newMapper = createTypeMapper(typeParameters, typeArguments);
|
|
57866
57743
|
result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
|
|
57744
|
+
if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
57745
|
+
result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
57746
|
+
}
|
|
57867
57747
|
target.instantiations.set(id, result);
|
|
57868
57748
|
}
|
|
57869
57749
|
return result;
|
|
@@ -57992,7 +57872,7 @@ function createTypeChecker(host) {
|
|
|
57992
57872
|
) : strictNullChecks && modifiers & 8 /* ExcludeOptional */ && isOptional ? getTypeWithFacts(propType, 524288 /* NEUndefined */) : propType;
|
|
57993
57873
|
}
|
|
57994
57874
|
function instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
57995
|
-
const result = createObjectType(type.objectFlags | 64 /* Instantiated */, type.symbol);
|
|
57875
|
+
const result = createObjectType(type.objectFlags & ~(524288 /* CouldContainTypeVariablesComputed */ | 1048576 /* CouldContainTypeVariables */) | 64 /* Instantiated */, type.symbol);
|
|
57996
57876
|
if (type.objectFlags & 32 /* Mapped */) {
|
|
57997
57877
|
result.declaration = type.declaration;
|
|
57998
57878
|
const origTypeParameter = getTypeParameterFromMappedType(type);
|
|
@@ -58197,7 +58077,13 @@ function createTypeChecker(host) {
|
|
|
58197
58077
|
return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
|
|
58198
58078
|
}
|
|
58199
58079
|
function hasContextSensitiveReturnExpression(node) {
|
|
58200
|
-
|
|
58080
|
+
if (node.typeParameters || getEffectiveReturnTypeNode(node) || !node.body) {
|
|
58081
|
+
return false;
|
|
58082
|
+
}
|
|
58083
|
+
if (node.body.kind !== 239 /* Block */) {
|
|
58084
|
+
return isContextSensitive(node.body);
|
|
58085
|
+
}
|
|
58086
|
+
return !!forEachReturnStatement(node.body, (statement) => !!statement.expression && isContextSensitive(statement.expression));
|
|
58201
58087
|
}
|
|
58202
58088
|
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
|
|
58203
58089
|
return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
|
|
@@ -58866,7 +58752,12 @@ function createTypeChecker(host) {
|
|
|
58866
58752
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
58867
58753
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
58868
58754
|
for (let i = 0; i < paramCount; i++) {
|
|
58869
|
-
const sourceType = i === restIndex ? getRestTypeAtPosition(
|
|
58755
|
+
const sourceType = i === restIndex ? getRestTypeAtPosition(
|
|
58756
|
+
source,
|
|
58757
|
+
i,
|
|
58758
|
+
/*readonly*/
|
|
58759
|
+
true
|
|
58760
|
+
) : tryGetTypeAtPosition(source, i);
|
|
58870
58761
|
const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
58871
58762
|
if (sourceType && targetType) {
|
|
58872
58763
|
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
@@ -59132,7 +59023,7 @@ function createTypeChecker(host) {
|
|
|
59132
59023
|
}
|
|
59133
59024
|
function getNormalizedType(type, writing) {
|
|
59134
59025
|
while (true) {
|
|
59135
|
-
const t = isFreshLiteralType(type) ? type.regularType : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) : type;
|
|
59026
|
+
const t = isFreshLiteralType(type) ? type.regularType : isGenericTupleType(type) ? getNormalizedTupleType(type, writing) : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) : type;
|
|
59136
59027
|
if (t === type)
|
|
59137
59028
|
return t;
|
|
59138
59029
|
type = t;
|
|
@@ -59151,6 +59042,11 @@ function createTypeChecker(host) {
|
|
|
59151
59042
|
}
|
|
59152
59043
|
return type;
|
|
59153
59044
|
}
|
|
59045
|
+
function getNormalizedTupleType(type, writing) {
|
|
59046
|
+
const elements = getTypeArguments(type);
|
|
59047
|
+
const normalizedElements = sameMap(elements, (t) => t.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(t, writing) : t);
|
|
59048
|
+
return elements !== normalizedElements ? createNormalizedTupleType(type.target, normalizedElements) : type;
|
|
59049
|
+
}
|
|
59154
59050
|
function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
|
|
59155
59051
|
var _a2;
|
|
59156
59052
|
let errorInfo;
|
|
@@ -59240,10 +59136,10 @@ function createTypeChecker(host) {
|
|
|
59240
59136
|
relatedInfo: relatedInfo == null ? void 0 : relatedInfo.slice()
|
|
59241
59137
|
};
|
|
59242
59138
|
}
|
|
59243
|
-
function reportIncompatibleError(message,
|
|
59139
|
+
function reportIncompatibleError(message, ...args) {
|
|
59244
59140
|
overrideNextErrorInfo++;
|
|
59245
59141
|
lastSkippedInfo = void 0;
|
|
59246
|
-
(incompatibleStack || (incompatibleStack = [])).push([message,
|
|
59142
|
+
(incompatibleStack || (incompatibleStack = [])).push([message, ...args]);
|
|
59247
59143
|
}
|
|
59248
59144
|
function reportIncompatibleStack() {
|
|
59249
59145
|
const stack = incompatibleStack || [];
|
|
@@ -59335,13 +59231,13 @@ function createTypeChecker(host) {
|
|
|
59335
59231
|
);
|
|
59336
59232
|
}
|
|
59337
59233
|
}
|
|
59338
|
-
function reportError(message,
|
|
59234
|
+
function reportError(message, ...args) {
|
|
59339
59235
|
Debug.assert(!!errorNode);
|
|
59340
59236
|
if (incompatibleStack)
|
|
59341
59237
|
reportIncompatibleStack();
|
|
59342
59238
|
if (message.elidedInCompatabilityPyramid)
|
|
59343
59239
|
return;
|
|
59344
|
-
errorInfo = chainDiagnosticMessages(errorInfo, message,
|
|
59240
|
+
errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
|
|
59345
59241
|
}
|
|
59346
59242
|
function associateRelatedInfo(info) {
|
|
59347
59243
|
Debug.assert(!!errorInfo);
|
|
@@ -60628,7 +60524,7 @@ function createTypeChecker(host) {
|
|
|
60628
60524
|
if (varianceResult !== void 0) {
|
|
60629
60525
|
return varianceResult;
|
|
60630
60526
|
}
|
|
60631
|
-
} else if (isReadonlyArrayType(target2) ?
|
|
60527
|
+
} else if (isReadonlyArrayType(target2) ? everyType(source2, isArrayOrTupleType) : isArrayType(target2) && everyType(source2, (t) => isTupleType(t) && !t.target.readonly)) {
|
|
60632
60528
|
if (relation !== identityRelation) {
|
|
60633
60529
|
return isRelatedTo(getIndexTypeOfType(source2, numberType) || anyType, getIndexTypeOfType(target2, numberType) || anyType, 3 /* Both */, reportErrors2);
|
|
60634
60530
|
} else {
|
|
@@ -61511,22 +61407,7 @@ function createTypeChecker(host) {
|
|
|
61511
61407
|
if (match === -1) {
|
|
61512
61408
|
return defaultValue;
|
|
61513
61409
|
}
|
|
61514
|
-
|
|
61515
|
-
/*searchElement*/
|
|
61516
|
-
true,
|
|
61517
|
-
match + 1
|
|
61518
|
-
);
|
|
61519
|
-
while (nextMatch !== -1) {
|
|
61520
|
-
if (!isTypeIdenticalTo(target.types[match], target.types[nextMatch])) {
|
|
61521
|
-
return defaultValue;
|
|
61522
|
-
}
|
|
61523
|
-
nextMatch = discriminable.indexOf(
|
|
61524
|
-
/*searchElement*/
|
|
61525
|
-
true,
|
|
61526
|
-
nextMatch + 1
|
|
61527
|
-
);
|
|
61528
|
-
}
|
|
61529
|
-
return target.types[match];
|
|
61410
|
+
return getUnionType(target.types.filter((_, index) => discriminable[index]));
|
|
61530
61411
|
}
|
|
61531
61412
|
function isWeakType(type) {
|
|
61532
61413
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -61727,7 +61608,7 @@ function createTypeChecker(host) {
|
|
|
61727
61608
|
return type.symbol;
|
|
61728
61609
|
}
|
|
61729
61610
|
if (isTupleType(type)) {
|
|
61730
|
-
return type
|
|
61611
|
+
return type;
|
|
61731
61612
|
}
|
|
61732
61613
|
}
|
|
61733
61614
|
if (type.flags & 262144 /* TypeParameter */) {
|
|
@@ -62500,8 +62381,8 @@ function createTypeChecker(host) {
|
|
|
62500
62381
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
62501
62382
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
62502
62383
|
}
|
|
62503
|
-
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node ||
|
|
62504
|
-
if (type.flags &
|
|
62384
|
+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
62385
|
+
if (type.flags & 138117121 /* ObjectFlagsType */) {
|
|
62505
62386
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
62506
62387
|
}
|
|
62507
62388
|
return result;
|
|
@@ -63126,7 +63007,11 @@ function createTypeChecker(host) {
|
|
|
63126
63007
|
return true;
|
|
63127
63008
|
}
|
|
63128
63009
|
if (constraintType.flags & 262144 /* TypeParameter */) {
|
|
63129
|
-
inferWithPriority(getIndexType(
|
|
63010
|
+
inferWithPriority(getIndexType(
|
|
63011
|
+
source,
|
|
63012
|
+
/*indexFlags*/
|
|
63013
|
+
!!source.pattern ? 2 /* NoIndexSignatures */ : 0 /* None */
|
|
63014
|
+
), constraintType, 32 /* MappedTypeConstraint */);
|
|
63130
63015
|
const extendedConstraint = getConstraintOfType(constraintType);
|
|
63131
63016
|
if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) {
|
|
63132
63017
|
return true;
|
|
@@ -63599,36 +63484,34 @@ function createTypeChecker(host) {
|
|
|
63599
63484
|
return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName : type.flags & 384 /* StringOrNumberLiteral */ ? escapeLeadingUnderscores("" + type.value) : void 0;
|
|
63600
63485
|
}
|
|
63601
63486
|
function tryGetElementAccessExpressionName(node) {
|
|
63602
|
-
|
|
63603
|
-
|
|
63487
|
+
return isStringOrNumericLiteralLike(node.argumentExpression) ? escapeLeadingUnderscores(node.argumentExpression.text) : isEntityNameExpression(node.argumentExpression) ? tryGetNameFromEntityNameExpression(node.argumentExpression) : void 0;
|
|
63488
|
+
}
|
|
63489
|
+
function tryGetNameFromEntityNameExpression(node) {
|
|
63490
|
+
const symbol = resolveEntityName(
|
|
63491
|
+
node,
|
|
63492
|
+
111551 /* Value */,
|
|
63493
|
+
/*ignoreErrors*/
|
|
63494
|
+
true
|
|
63495
|
+
);
|
|
63496
|
+
if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */))
|
|
63497
|
+
return void 0;
|
|
63498
|
+
const declaration = symbol.valueDeclaration;
|
|
63499
|
+
if (declaration === void 0)
|
|
63500
|
+
return void 0;
|
|
63501
|
+
const type = tryGetTypeFromEffectiveTypeNode(declaration);
|
|
63502
|
+
if (type) {
|
|
63503
|
+
const name = tryGetNameFromType(type);
|
|
63504
|
+
if (name !== void 0) {
|
|
63505
|
+
return name;
|
|
63506
|
+
}
|
|
63604
63507
|
}
|
|
63605
|
-
if (
|
|
63606
|
-
const
|
|
63607
|
-
|
|
63608
|
-
|
|
63609
|
-
/*ignoreErrors*/
|
|
63610
|
-
true
|
|
63611
|
-
);
|
|
63612
|
-
if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */))
|
|
63613
|
-
return void 0;
|
|
63614
|
-
const declaration = symbol.valueDeclaration;
|
|
63615
|
-
if (declaration === void 0)
|
|
63616
|
-
return void 0;
|
|
63617
|
-
const type = tryGetTypeFromEffectiveTypeNode(declaration);
|
|
63618
|
-
if (type) {
|
|
63619
|
-
const name = tryGetNameFromType(type);
|
|
63620
|
-
if (name !== void 0) {
|
|
63621
|
-
return name;
|
|
63622
|
-
}
|
|
63508
|
+
if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node)) {
|
|
63509
|
+
const initializer = getEffectiveInitializer(declaration);
|
|
63510
|
+
if (initializer) {
|
|
63511
|
+
return tryGetNameFromType(getTypeOfExpression(initializer));
|
|
63623
63512
|
}
|
|
63624
|
-
if (
|
|
63625
|
-
|
|
63626
|
-
if (initializer) {
|
|
63627
|
-
return tryGetNameFromType(getTypeOfExpression(initializer));
|
|
63628
|
-
}
|
|
63629
|
-
if (isEnumMember(declaration)) {
|
|
63630
|
-
return getTextOfPropertyName(declaration.name);
|
|
63631
|
-
}
|
|
63513
|
+
if (isEnumMember(declaration)) {
|
|
63514
|
+
return getTextOfPropertyName(declaration.name);
|
|
63632
63515
|
}
|
|
63633
63516
|
}
|
|
63634
63517
|
return void 0;
|
|
@@ -65546,7 +65429,7 @@ function createTypeChecker(host) {
|
|
|
65546
65429
|
});
|
|
65547
65430
|
}
|
|
65548
65431
|
function markAliasReferenced(symbol, location) {
|
|
65549
|
-
if (
|
|
65432
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
65550
65433
|
return;
|
|
65551
65434
|
}
|
|
65552
65435
|
if (isNonLocalAlias(
|
|
@@ -66684,30 +66567,52 @@ function createTypeChecker(host) {
|
|
|
66684
66567
|
}
|
|
66685
66568
|
return void 0;
|
|
66686
66569
|
}
|
|
66687
|
-
function
|
|
66688
|
-
|
|
66689
|
-
|
|
66690
|
-
|
|
66691
|
-
|
|
66692
|
-
|
|
66693
|
-
|
|
66694
|
-
|
|
66695
|
-
|
|
66696
|
-
|
|
66697
|
-
|
|
66698
|
-
|
|
66699
|
-
|
|
66700
|
-
|
|
66701
|
-
t
|
|
66702
|
-
|
|
66703
|
-
|
|
66704
|
-
|
|
66705
|
-
|
|
66706
|
-
|
|
66707
|
-
|
|
66570
|
+
function getSpreadIndices(elements) {
|
|
66571
|
+
let first2, last2;
|
|
66572
|
+
for (let i = 0; i < elements.length; i++) {
|
|
66573
|
+
if (isSpreadElement(elements[i])) {
|
|
66574
|
+
first2 != null ? first2 : first2 = i;
|
|
66575
|
+
last2 = i;
|
|
66576
|
+
}
|
|
66577
|
+
}
|
|
66578
|
+
return { first: first2, last: last2 };
|
|
66579
|
+
}
|
|
66580
|
+
function getContextualTypeForElementExpression(type, index, length2, firstSpreadIndex, lastSpreadIndex) {
|
|
66581
|
+
return type && mapType(
|
|
66582
|
+
type,
|
|
66583
|
+
(t) => {
|
|
66584
|
+
if (isTupleType(t)) {
|
|
66585
|
+
if ((firstSpreadIndex === void 0 || index < firstSpreadIndex) && index < t.target.fixedLength) {
|
|
66586
|
+
return getTypeArguments(t)[index];
|
|
66587
|
+
}
|
|
66588
|
+
const offset = length2 !== void 0 && (lastSpreadIndex === void 0 || index > lastSpreadIndex) ? length2 - index : 0;
|
|
66589
|
+
const fixedEndLength = offset > 0 && t.target.hasRestElement ? getEndElementCount(t.target, 3 /* Fixed */) : 0;
|
|
66590
|
+
if (offset > 0 && offset <= fixedEndLength) {
|
|
66591
|
+
return getTypeArguments(t)[getTypeReferenceArity(t) - offset];
|
|
66592
|
+
}
|
|
66593
|
+
return getElementTypeOfSliceOfTupleType(
|
|
66594
|
+
t,
|
|
66595
|
+
firstSpreadIndex === void 0 ? t.target.fixedLength : Math.min(t.target.fixedLength, firstSpreadIndex),
|
|
66596
|
+
length2 === void 0 || lastSpreadIndex === void 0 ? fixedEndLength : Math.min(fixedEndLength, length2 - lastSpreadIndex),
|
|
66597
|
+
/*writing*/
|
|
66598
|
+
false,
|
|
66599
|
+
/*noReductions*/
|
|
66600
|
+
true
|
|
66601
|
+
);
|
|
66602
|
+
}
|
|
66603
|
+
return (!firstSpreadIndex || index < firstSpreadIndex) && getTypeOfPropertyOfContextualType(t, "" + index) || getIteratedTypeOrElementType(
|
|
66604
|
+
1 /* Element */,
|
|
66605
|
+
t,
|
|
66606
|
+
undefinedType,
|
|
66607
|
+
/*errorNode*/
|
|
66608
|
+
void 0,
|
|
66609
|
+
/*checkAssignability*/
|
|
66610
|
+
false
|
|
66611
|
+
);
|
|
66612
|
+
},
|
|
66708
66613
|
/*noReductions*/
|
|
66709
66614
|
true
|
|
66710
|
-
)
|
|
66615
|
+
);
|
|
66711
66616
|
}
|
|
66712
66617
|
function getContextualTypeForConditionalOperand(node, contextFlags) {
|
|
66713
66618
|
const conditional = node.parent;
|
|
@@ -66816,7 +66721,11 @@ function createTypeChecker(host) {
|
|
|
66816
66721
|
if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
|
|
66817
66722
|
const apparentType = mapType(
|
|
66818
66723
|
instantiatedType,
|
|
66819
|
-
|
|
66724
|
+
// When obtaining apparent type of *contextual* type we don't want to get apparent type of mapped types.
|
|
66725
|
+
// That would evaluate mapped types with array or tuple type constraints too eagerly
|
|
66726
|
+
// and thus it would prevent `getTypeOfPropertyOfContextualType` from obtaining per-position contextual type for elements of array literal expressions.
|
|
66727
|
+
// Apparent type of other mapped types is already the mapped type itself so we can just avoid calling `getApparentType` here for all mapped types.
|
|
66728
|
+
(t) => getObjectFlags(t) & 32 /* Mapped */ ? t : getApparentType(t),
|
|
66820
66729
|
/*noReductions*/
|
|
66821
66730
|
true
|
|
66822
66731
|
);
|
|
@@ -66894,9 +66803,9 @@ function createTypeChecker(host) {
|
|
|
66894
66803
|
case 207 /* ArrayLiteralExpression */: {
|
|
66895
66804
|
const arrayLiteral = parent;
|
|
66896
66805
|
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
|
|
66897
|
-
const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
|
|
66898
66806
|
const elementIndex = indexOfNode(arrayLiteral.elements, node);
|
|
66899
|
-
|
|
66807
|
+
const spreadIndices = (_b = (_a2 = getNodeLinks(arrayLiteral)).spreadIndices) != null ? _b : _a2.spreadIndices = getSpreadIndices(arrayLiteral.elements);
|
|
66808
|
+
return getContextualTypeForElementExpression(type, elementIndex, arrayLiteral.elements.length, spreadIndices.first, spreadIndices.last);
|
|
66900
66809
|
}
|
|
66901
66810
|
case 225 /* ConditionalExpression */:
|
|
66902
66811
|
return getContextualTypeForConditionalOperand(node, contextFlags);
|
|
@@ -68081,7 +67990,7 @@ function createTypeChecker(host) {
|
|
|
68081
67990
|
}
|
|
68082
67991
|
if (jsxFactorySym) {
|
|
68083
67992
|
jsxFactorySym.isReferenced = 67108863 /* All */;
|
|
68084
|
-
if (
|
|
67993
|
+
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
68085
67994
|
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
68086
67995
|
}
|
|
68087
67996
|
}
|
|
@@ -69308,7 +69217,7 @@ function createTypeChecker(host) {
|
|
|
69308
69217
|
flags.push(4 /* Rest */);
|
|
69309
69218
|
}
|
|
69310
69219
|
} else {
|
|
69311
|
-
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
69220
|
+
const contextualType = isTupleType(restType) ? getContextualTypeForElementExpression(restType, i - index, argCount - index) || unknownType : getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
69312
69221
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
69313
69222
|
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 402784252 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
69314
69223
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
@@ -69655,16 +69564,16 @@ function createTypeChecker(host) {
|
|
|
69655
69564
|
}
|
|
69656
69565
|
return { start, length: length2, sourceFile };
|
|
69657
69566
|
}
|
|
69658
|
-
function getDiagnosticForCallNode(node, message,
|
|
69567
|
+
function getDiagnosticForCallNode(node, message, ...args) {
|
|
69659
69568
|
if (isCallExpression(node)) {
|
|
69660
69569
|
const { sourceFile, start, length: length2 } = getDiagnosticSpanForCallNode(node);
|
|
69661
69570
|
if ("message" in message) {
|
|
69662
|
-
return createFileDiagnostic(sourceFile, start, length2, message,
|
|
69571
|
+
return createFileDiagnostic(sourceFile, start, length2, message, ...args);
|
|
69663
69572
|
}
|
|
69664
69573
|
return createDiagnosticForFileFromMessageChain(sourceFile, message);
|
|
69665
69574
|
} else {
|
|
69666
69575
|
if ("message" in message) {
|
|
69667
|
-
return createDiagnosticForNode(node, message,
|
|
69576
|
+
return createDiagnosticForNode(node, message, ...args);
|
|
69668
69577
|
}
|
|
69669
69578
|
return createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, message);
|
|
69670
69579
|
}
|
|
@@ -69752,11 +69661,8 @@ function createTypeChecker(host) {
|
|
|
69752
69661
|
}
|
|
69753
69662
|
const parameter = (_a2 = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a2.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
|
|
69754
69663
|
if (parameter) {
|
|
69755
|
-
const
|
|
69756
|
-
|
|
69757
|
-
isBindingPattern(parameter.name) ? Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided : isRestParameter(parameter) ? Diagnostics.Arguments_for_the_rest_parameter_0_were_not_provided : Diagnostics.An_argument_for_0_was_not_provided,
|
|
69758
|
-
!parameter.name ? args.length : !isBindingPattern(parameter.name) ? idText(getFirstIdentifier(parameter.name)) : void 0
|
|
69759
|
-
);
|
|
69664
|
+
const messageAndArgs = isBindingPattern(parameter.name) ? [Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided] : isRestParameter(parameter) ? [Diagnostics.Arguments_for_the_rest_parameter_0_were_not_provided, idText(getFirstIdentifier(parameter.name))] : [Diagnostics.An_argument_for_0_was_not_provided, !parameter.name ? args.length : idText(getFirstIdentifier(parameter.name))];
|
|
69665
|
+
const parameterError = createDiagnosticForNode(parameter, ...messageAndArgs);
|
|
69760
69666
|
return addRelatedInfo(diagnostic, parameterError);
|
|
69761
69667
|
}
|
|
69762
69668
|
return diagnostic;
|
|
@@ -71361,12 +71267,12 @@ function createTypeChecker(host) {
|
|
|
71361
71267
|
}
|
|
71362
71268
|
return void 0;
|
|
71363
71269
|
}
|
|
71364
|
-
function getRestTypeAtPosition(source, pos) {
|
|
71270
|
+
function getRestTypeAtPosition(source, pos, readonly = false) {
|
|
71365
71271
|
const parameterCount = getParameterCount(source);
|
|
71366
71272
|
const minArgumentCount = getMinArgumentCount(source);
|
|
71367
71273
|
const restType = getEffectiveRestType(source);
|
|
71368
71274
|
if (restType && pos >= parameterCount - 1) {
|
|
71369
|
-
return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
|
|
71275
|
+
return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType), readonly);
|
|
71370
71276
|
}
|
|
71371
71277
|
const types = [];
|
|
71372
71278
|
const flags = [];
|
|
@@ -71384,13 +71290,7 @@ function createTypeChecker(host) {
|
|
|
71384
71290
|
names.push(name);
|
|
71385
71291
|
}
|
|
71386
71292
|
}
|
|
71387
|
-
return createTupleType(
|
|
71388
|
-
types,
|
|
71389
|
-
flags,
|
|
71390
|
-
/*readonly*/
|
|
71391
|
-
false,
|
|
71392
|
-
length(names) === length(types) ? names : void 0
|
|
71393
|
-
);
|
|
71293
|
+
return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
|
|
71394
71294
|
}
|
|
71395
71295
|
function getParameterCount(signature) {
|
|
71396
71296
|
const length2 = signature.parameters.length;
|
|
@@ -75096,9 +74996,9 @@ function createTypeChecker(host) {
|
|
|
75096
74996
|
}
|
|
75097
74997
|
}
|
|
75098
74998
|
}
|
|
75099
|
-
function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage,
|
|
74999
|
+
function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, ...args) {
|
|
75100
75000
|
const promisedType = getPromisedTypeOfPromise(type, errorNode);
|
|
75101
|
-
return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage,
|
|
75001
|
+
return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, ...args);
|
|
75102
75002
|
}
|
|
75103
75003
|
function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) {
|
|
75104
75004
|
if (isTypeAny(type)) {
|
|
@@ -75161,8 +75061,8 @@ function createTypeChecker(host) {
|
|
|
75161
75061
|
}
|
|
75162
75062
|
return typeAsPromise.promisedTypeOfPromise = getUnionType(map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), 2 /* Subtype */);
|
|
75163
75063
|
}
|
|
75164
|
-
function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage,
|
|
75165
|
-
const awaitedType = withAlias ? getAwaitedType(type, errorNode, diagnosticMessage,
|
|
75064
|
+
function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage, ...args) {
|
|
75065
|
+
const awaitedType = withAlias ? getAwaitedType(type, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args);
|
|
75166
75066
|
return awaitedType || errorType;
|
|
75167
75067
|
}
|
|
75168
75068
|
function isThenableType(type) {
|
|
@@ -75218,11 +75118,11 @@ function createTypeChecker(host) {
|
|
|
75218
75118
|
Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
75219
75119
|
return type;
|
|
75220
75120
|
}
|
|
75221
|
-
function getAwaitedType(type, errorNode, diagnosticMessage,
|
|
75222
|
-
const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage,
|
|
75121
|
+
function getAwaitedType(type, errorNode, diagnosticMessage, ...args) {
|
|
75122
|
+
const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args);
|
|
75223
75123
|
return awaitedType && createAwaitedTypeIfNeeded(awaitedType);
|
|
75224
75124
|
}
|
|
75225
|
-
function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage,
|
|
75125
|
+
function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args) {
|
|
75226
75126
|
if (isTypeAny(type)) {
|
|
75227
75127
|
return type;
|
|
75228
75128
|
}
|
|
@@ -75240,7 +75140,7 @@ function createTypeChecker(host) {
|
|
|
75240
75140
|
}
|
|
75241
75141
|
return void 0;
|
|
75242
75142
|
}
|
|
75243
|
-
const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage,
|
|
75143
|
+
const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias;
|
|
75244
75144
|
awaitedTypeStack.push(type.id);
|
|
75245
75145
|
const mapped = mapType(type, mapper);
|
|
75246
75146
|
awaitedTypeStack.pop();
|
|
@@ -75264,7 +75164,7 @@ function createTypeChecker(host) {
|
|
|
75264
75164
|
return void 0;
|
|
75265
75165
|
}
|
|
75266
75166
|
awaitedTypeStack.push(type.id);
|
|
75267
|
-
const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage,
|
|
75167
|
+
const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, ...args);
|
|
75268
75168
|
awaitedTypeStack.pop();
|
|
75269
75169
|
if (!awaitedType) {
|
|
75270
75170
|
return void 0;
|
|
@@ -75278,7 +75178,7 @@ function createTypeChecker(host) {
|
|
|
75278
75178
|
if (thisTypeForErrorOut.value) {
|
|
75279
75179
|
chain = chainDiagnosticMessages(chain, Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForErrorOut.value));
|
|
75280
75180
|
}
|
|
75281
|
-
chain = chainDiagnosticMessages(chain, diagnosticMessage,
|
|
75181
|
+
chain = chainDiagnosticMessages(chain, diagnosticMessage, ...args);
|
|
75282
75182
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(errorNode), errorNode, chain));
|
|
75283
75183
|
}
|
|
75284
75184
|
return void 0;
|
|
@@ -75456,7 +75356,7 @@ function createTypeChecker(host) {
|
|
|
75456
75356
|
true
|
|
75457
75357
|
);
|
|
75458
75358
|
if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
|
|
75459
|
-
if (
|
|
75359
|
+
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
75460
75360
|
markAliasSymbolAsReferenced(rootSymbol);
|
|
75461
75361
|
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
75462
75362
|
const diag2 = error(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
|
|
@@ -75865,9 +75765,8 @@ function createTypeChecker(host) {
|
|
|
75865
75765
|
const sourceFile = getSourceFileOfNode(parent);
|
|
75866
75766
|
const range = isJSDocTemplateTag(parent) ? rangeOfNode(parent) : rangeOfTypeParameters(sourceFile, parent.typeParameters);
|
|
75867
75767
|
const only = parent.typeParameters.length === 1;
|
|
75868
|
-
const
|
|
75869
|
-
|
|
75870
|
-
addDiagnostic(typeParameter, 1 /* Parameter */, createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, message, arg0));
|
|
75768
|
+
const messageAndArg = only ? [Diagnostics._0_is_declared_but_its_value_is_never_read, name] : [Diagnostics.All_type_parameters_are_unused];
|
|
75769
|
+
addDiagnostic(typeParameter, 1 /* Parameter */, createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, ...messageAndArg));
|
|
75871
75770
|
}
|
|
75872
75771
|
} else {
|
|
75873
75772
|
addDiagnostic(typeParameter, 1 /* Parameter */, createDiagnosticForNode(typeParameter, Diagnostics._0_is_declared_but_its_value_is_never_read, name));
|
|
@@ -77425,7 +77324,7 @@ function createTypeChecker(host) {
|
|
|
77425
77324
|
forEachKey(catchClause.locals, (caughtName) => {
|
|
77426
77325
|
const blockLocal = blockLocals.get(caughtName);
|
|
77427
77326
|
if ((blockLocal == null ? void 0 : blockLocal.valueDeclaration) && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) {
|
|
77428
|
-
grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName);
|
|
77327
|
+
grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, unescapeLeadingUnderscores(caughtName));
|
|
77429
77328
|
}
|
|
77430
77329
|
});
|
|
77431
77330
|
}
|
|
@@ -79021,6 +78920,9 @@ function createTypeChecker(host) {
|
|
|
79021
78920
|
) && !getSymbolLinks(getSymbolOfDeclaration(statement)).constEnumReferenced;
|
|
79022
78921
|
}
|
|
79023
78922
|
function checkImportsForTypeOnlyConversion(sourceFile) {
|
|
78923
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
78924
|
+
return;
|
|
78925
|
+
}
|
|
79024
78926
|
for (const statement of sourceFile.statements) {
|
|
79025
78927
|
if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) {
|
|
79026
78928
|
error(
|
|
@@ -79106,14 +79008,14 @@ function createTypeChecker(host) {
|
|
|
79106
79008
|
markAliasReferenced(sym, id);
|
|
79107
79009
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
79108
79010
|
checkExpressionCached(id);
|
|
79109
|
-
if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
79011
|
+
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
79110
79012
|
error(
|
|
79111
79013
|
id,
|
|
79112
79014
|
node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration : Diagnostics.An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration,
|
|
79113
79015
|
idText(id)
|
|
79114
79016
|
);
|
|
79115
79017
|
}
|
|
79116
|
-
} else if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax) {
|
|
79018
|
+
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
79117
79019
|
error(
|
|
79118
79020
|
id,
|
|
79119
79021
|
node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type : Diagnostics.An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type,
|
|
@@ -80450,7 +80352,7 @@ function createTypeChecker(host) {
|
|
|
80450
80352
|
return false;
|
|
80451
80353
|
}
|
|
80452
80354
|
function isValueAliasDeclaration(node) {
|
|
80453
|
-
Debug.assert(
|
|
80355
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
80454
80356
|
switch (node.kind) {
|
|
80455
80357
|
case 269 /* ImportEqualsDeclaration */:
|
|
80456
80358
|
return isAliasResolvedToValue(getSymbolOfDeclaration(node));
|
|
@@ -80491,7 +80393,7 @@ function createTypeChecker(host) {
|
|
|
80491
80393
|
return isConstEnumSymbol(s) || !!s.constEnumOnlyModule;
|
|
80492
80394
|
}
|
|
80493
80395
|
function isReferencedAliasDeclaration(node, checkChildren) {
|
|
80494
|
-
Debug.assert(
|
|
80396
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
80495
80397
|
if (isAliasSymbolDeclaration(node)) {
|
|
80496
80398
|
const symbol = getSymbolOfDeclaration(node);
|
|
80497
80399
|
const links = symbol && getSymbolLinks(symbol);
|
|
@@ -80829,12 +80731,12 @@ function createTypeChecker(host) {
|
|
|
80829
80731
|
isDeclarationWithCollidingName,
|
|
80830
80732
|
isValueAliasDeclaration: (nodeIn) => {
|
|
80831
80733
|
const node = getParseTreeNode(nodeIn);
|
|
80832
|
-
return node ? isValueAliasDeclaration(node) : true;
|
|
80734
|
+
return node && canCollectSymbolAliasAccessabilityData ? isValueAliasDeclaration(node) : true;
|
|
80833
80735
|
},
|
|
80834
80736
|
hasGlobalName,
|
|
80835
80737
|
isReferencedAliasDeclaration: (nodeIn, checkChildren) => {
|
|
80836
80738
|
const node = getParseTreeNode(nodeIn);
|
|
80837
|
-
return node ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
80739
|
+
return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
80838
80740
|
},
|
|
80839
80741
|
getNodeCheckFlags: (nodeIn) => {
|
|
80840
80742
|
const node = getParseTreeNode(nodeIn);
|
|
@@ -81969,7 +81871,7 @@ function createTypeChecker(host) {
|
|
|
81969
81871
|
throw Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
|
|
81970
81872
|
}
|
|
81971
81873
|
if (!inDestructuring) {
|
|
81972
|
-
const effectiveName =
|
|
81874
|
+
const effectiveName = getEffectivePropertyNameForPropertyNameNode(name);
|
|
81973
81875
|
if (effectiveName === void 0) {
|
|
81974
81876
|
continue;
|
|
81975
81877
|
}
|
|
@@ -82438,12 +82340,12 @@ function createTypeChecker(host) {
|
|
|
82438
82340
|
switch (node.keywordToken) {
|
|
82439
82341
|
case 104 /* NewKeyword */:
|
|
82440
82342
|
if (escapedText !== "target") {
|
|
82441
|
-
return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, tokenToString(node.keywordToken), "target");
|
|
82343
|
+
return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, unescapeLeadingUnderscores(node.name.escapedText), tokenToString(node.keywordToken), "target");
|
|
82442
82344
|
}
|
|
82443
82345
|
break;
|
|
82444
82346
|
case 101 /* ImportKeyword */:
|
|
82445
82347
|
if (escapedText !== "meta") {
|
|
82446
|
-
return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, tokenToString(node.keywordToken), "meta");
|
|
82348
|
+
return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, unescapeLeadingUnderscores(node.name.escapedText), tokenToString(node.keywordToken), "meta");
|
|
82447
82349
|
}
|
|
82448
82350
|
break;
|
|
82449
82351
|
}
|
|
@@ -82451,35 +82353,35 @@ function createTypeChecker(host) {
|
|
|
82451
82353
|
function hasParseDiagnostics(sourceFile) {
|
|
82452
82354
|
return sourceFile.parseDiagnostics.length > 0;
|
|
82453
82355
|
}
|
|
82454
|
-
function grammarErrorOnFirstToken(node, message,
|
|
82356
|
+
function grammarErrorOnFirstToken(node, message, ...args) {
|
|
82455
82357
|
const sourceFile = getSourceFileOfNode(node);
|
|
82456
82358
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
82457
82359
|
const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
82458
|
-
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message,
|
|
82360
|
+
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, ...args));
|
|
82459
82361
|
return true;
|
|
82460
82362
|
}
|
|
82461
82363
|
return false;
|
|
82462
82364
|
}
|
|
82463
|
-
function grammarErrorAtPos(nodeForSourceFile, start, length2, message,
|
|
82365
|
+
function grammarErrorAtPos(nodeForSourceFile, start, length2, message, ...args) {
|
|
82464
82366
|
const sourceFile = getSourceFileOfNode(nodeForSourceFile);
|
|
82465
82367
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
82466
|
-
diagnostics.add(createFileDiagnostic(sourceFile, start, length2, message,
|
|
82368
|
+
diagnostics.add(createFileDiagnostic(sourceFile, start, length2, message, ...args));
|
|
82467
82369
|
return true;
|
|
82468
82370
|
}
|
|
82469
82371
|
return false;
|
|
82470
82372
|
}
|
|
82471
|
-
function grammarErrorOnNodeSkippedOn(key, node, message,
|
|
82373
|
+
function grammarErrorOnNodeSkippedOn(key, node, message, ...args) {
|
|
82472
82374
|
const sourceFile = getSourceFileOfNode(node);
|
|
82473
82375
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
82474
|
-
errorSkippedOn(key, node, message,
|
|
82376
|
+
errorSkippedOn(key, node, message, ...args);
|
|
82475
82377
|
return true;
|
|
82476
82378
|
}
|
|
82477
82379
|
return false;
|
|
82478
82380
|
}
|
|
82479
|
-
function grammarErrorOnNode(node, message,
|
|
82381
|
+
function grammarErrorOnNode(node, message, ...args) {
|
|
82480
82382
|
const sourceFile = getSourceFileOfNode(node);
|
|
82481
82383
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
82482
|
-
diagnostics.add(createDiagnosticForNode(node, message,
|
|
82384
|
+
diagnostics.add(createDiagnosticForNode(node, message, ...args));
|
|
82483
82385
|
return true;
|
|
82484
82386
|
}
|
|
82485
82387
|
return false;
|
|
@@ -82624,7 +82526,7 @@ function createTypeChecker(host) {
|
|
|
82624
82526
|
}
|
|
82625
82527
|
return false;
|
|
82626
82528
|
}
|
|
82627
|
-
function grammarErrorAfterFirstToken(node, message,
|
|
82529
|
+
function grammarErrorAfterFirstToken(node, message, ...args) {
|
|
82628
82530
|
const sourceFile = getSourceFileOfNode(node);
|
|
82629
82531
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
82630
82532
|
const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
@@ -82634,9 +82536,7 @@ function createTypeChecker(host) {
|
|
|
82634
82536
|
/*length*/
|
|
82635
82537
|
0,
|
|
82636
82538
|
message,
|
|
82637
|
-
|
|
82638
|
-
arg1,
|
|
82639
|
-
arg2
|
|
82539
|
+
...args
|
|
82640
82540
|
));
|
|
82641
82541
|
return true;
|
|
82642
82542
|
}
|
|
@@ -82782,6 +82682,10 @@ function createTypeChecker(host) {
|
|
|
82782
82682
|
}
|
|
82783
82683
|
return void 0;
|
|
82784
82684
|
}
|
|
82685
|
+
function getEffectivePropertyNameForPropertyNameNode(node) {
|
|
82686
|
+
const name = getPropertyNameForPropertyNameNode(node);
|
|
82687
|
+
return name ? name : isComputedPropertyName(node) && isEntityNameExpression(node.expression) ? tryGetNameFromEntityNameExpression(node.expression) : void 0;
|
|
82688
|
+
}
|
|
82785
82689
|
}
|
|
82786
82690
|
function isNotAccessor(declaration) {
|
|
82787
82691
|
return !isAccessor(declaration);
|
|
@@ -106952,8 +106856,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
106952
106856
|
}
|
|
106953
106857
|
}
|
|
106954
106858
|
function createBuildInfo(program, bundle) {
|
|
106955
|
-
|
|
106956
|
-
return { bundle, program, version: version2 };
|
|
106859
|
+
return { bundle, program, version };
|
|
106957
106860
|
}
|
|
106958
106861
|
function getBuildInfoText(buildInfo) {
|
|
106959
106862
|
return JSON.stringify(buildInfo);
|
|
@@ -107041,10 +106944,10 @@ function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
|
|
|
107041
106944
|
/*separateBeginAndEnd*/
|
|
107042
106945
|
true
|
|
107043
106946
|
);
|
|
107044
|
-
|
|
106947
|
+
mark("beforeEmit");
|
|
107045
106948
|
const result = emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers);
|
|
107046
|
-
|
|
107047
|
-
|
|
106949
|
+
mark("afterEmit");
|
|
106950
|
+
measure("Emit", "beforeEmit", "afterEmit");
|
|
107048
106951
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
107049
106952
|
return result;
|
|
107050
106953
|
}
|
|
@@ -111058,12 +110961,12 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
111058
110961
|
return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags != null ? flags : 0 /* None */, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix)));
|
|
111059
110962
|
}
|
|
111060
110963
|
function isUniqueName(name, privateName) {
|
|
111061
|
-
return
|
|
110964
|
+
return isFileLevelUniqueNameInCurrentFile(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
|
|
111062
110965
|
}
|
|
111063
110966
|
function isReservedName(name, privateName) {
|
|
111064
110967
|
return privateName ? !!(reservedPrivateNames == null ? void 0 : reservedPrivateNames.has(name)) : !!(reservedNames == null ? void 0 : reservedNames.has(name));
|
|
111065
110968
|
}
|
|
111066
|
-
function
|
|
110969
|
+
function isFileLevelUniqueNameInCurrentFile(name, _isPrivate) {
|
|
111067
110970
|
return currentSourceFile ? isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true;
|
|
111068
110971
|
}
|
|
111069
110972
|
function isUniqueLocalName(name, container) {
|
|
@@ -111182,7 +111085,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
111182
111085
|
function makeFileLevelOptimisticUniqueName(name) {
|
|
111183
111086
|
return makeUniqueName(
|
|
111184
111087
|
name,
|
|
111185
|
-
|
|
111088
|
+
isFileLevelUniqueNameInCurrentFile,
|
|
111186
111089
|
/*optimistic*/
|
|
111187
111090
|
true,
|
|
111188
111091
|
/*scoped*/
|
|
@@ -111362,7 +111265,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
111362
111265
|
case 3 /* Unique */:
|
|
111363
111266
|
return makeUniqueName(
|
|
111364
111267
|
idText(name),
|
|
111365
|
-
autoGenerate.flags & 32 /* FileLevel */ ?
|
|
111268
|
+
autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueNameInCurrentFile : isUniqueName,
|
|
111366
111269
|
!!(autoGenerate.flags & 16 /* Optimistic */),
|
|
111367
111270
|
!!(autoGenerate.flags & 8 /* ReservedInNestedScopes */),
|
|
111368
111271
|
isPrivateIdentifier(name),
|
|
@@ -114383,12 +114286,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
114383
114286
|
}
|
|
114384
114287
|
}
|
|
114385
114288
|
}
|
|
114386
|
-
function createDiagnosticForNodeArray2(nodes, message,
|
|
114289
|
+
function createDiagnosticForNodeArray2(nodes, message, ...args) {
|
|
114387
114290
|
const start = nodes.pos;
|
|
114388
|
-
return createFileDiagnostic(sourceFile, start, nodes.end - start, message,
|
|
114291
|
+
return createFileDiagnostic(sourceFile, start, nodes.end - start, message, ...args);
|
|
114389
114292
|
}
|
|
114390
|
-
function createDiagnosticForNode2(node, message,
|
|
114391
|
-
return createDiagnosticForNodeInSourceFile(sourceFile, node, message,
|
|
114293
|
+
function createDiagnosticForNode2(node, message, ...args) {
|
|
114294
|
+
return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args);
|
|
114392
114295
|
}
|
|
114393
114296
|
});
|
|
114394
114297
|
}
|
|
@@ -115053,11 +114956,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115053
114956
|
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
|
115054
114957
|
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
|
115055
114958
|
const diagnostic = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0;
|
|
114959
|
+
const args = suggestion ? [libName, suggestion] : [libName];
|
|
115056
114960
|
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
115057
114961
|
kind: 0 /* FilePreprocessingReferencedDiagnostic */,
|
|
115058
114962
|
reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index },
|
|
115059
114963
|
diagnostic,
|
|
115060
|
-
args
|
|
114964
|
+
args
|
|
115061
114965
|
});
|
|
115062
114966
|
}
|
|
115063
114967
|
});
|
|
@@ -115522,7 +115426,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115522
115426
|
}
|
|
115523
115427
|
}
|
|
115524
115428
|
function verifyDeprecatedCompilerOptions() {
|
|
115525
|
-
function createDiagnostic(name, value, useInstead, message,
|
|
115429
|
+
function createDiagnostic(name, value, useInstead, message, ...args) {
|
|
115526
115430
|
if (useInstead) {
|
|
115527
115431
|
const details = chainDiagnosticMessages(
|
|
115528
115432
|
/*details*/
|
|
@@ -115530,7 +115434,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115530
115434
|
Diagnostics.Use_0_instead,
|
|
115531
115435
|
useInstead
|
|
115532
115436
|
);
|
|
115533
|
-
const chain = chainDiagnosticMessages(details, message,
|
|
115437
|
+
const chain = chainDiagnosticMessages(details, message, ...args);
|
|
115534
115438
|
createDiagnosticForOption(
|
|
115535
115439
|
/*onKey*/
|
|
115536
115440
|
!value,
|
|
@@ -115547,10 +115451,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115547
115451
|
/*option2*/
|
|
115548
115452
|
void 0,
|
|
115549
115453
|
message,
|
|
115550
|
-
|
|
115551
|
-
arg1,
|
|
115552
|
-
arg2,
|
|
115553
|
-
arg3
|
|
115454
|
+
...args
|
|
115554
115455
|
);
|
|
115555
115456
|
}
|
|
115556
115457
|
}
|
|
@@ -115603,8 +115504,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115603
115504
|
});
|
|
115604
115505
|
}
|
|
115605
115506
|
function verifyDeprecatedProjectReference(ref, parentFile, index) {
|
|
115606
|
-
function createDiagnostic(_name, _value, _useInstead, message,
|
|
115607
|
-
createDiagnosticForReference(parentFile, index, message,
|
|
115507
|
+
function createDiagnostic(_name, _value, _useInstead, message, ...args) {
|
|
115508
|
+
createDiagnosticForReference(parentFile, index, message, ...args);
|
|
115608
115509
|
}
|
|
115609
115510
|
checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
|
|
115610
115511
|
if (ref.prepend) {
|
|
@@ -115786,7 +115687,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115786
115687
|
}
|
|
115787
115688
|
});
|
|
115788
115689
|
}
|
|
115789
|
-
function createDiagnosticForOptionPathKeyValue(key, valueIndex, message,
|
|
115690
|
+
function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
|
|
115790
115691
|
let needCompilerDiagnostic = true;
|
|
115791
115692
|
const pathsSyntax = getOptionPathsSyntax();
|
|
115792
115693
|
for (const pathProp of pathsSyntax) {
|
|
@@ -115794,17 +115695,17 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115794
115695
|
for (const keyProps of getPropertyAssignment(pathProp.initializer, key)) {
|
|
115795
115696
|
const initializer = keyProps.initializer;
|
|
115796
115697
|
if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
|
|
115797
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message,
|
|
115698
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
|
|
115798
115699
|
needCompilerDiagnostic = false;
|
|
115799
115700
|
}
|
|
115800
115701
|
}
|
|
115801
115702
|
}
|
|
115802
115703
|
}
|
|
115803
115704
|
if (needCompilerDiagnostic) {
|
|
115804
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
115705
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
115805
115706
|
}
|
|
115806
115707
|
}
|
|
115807
|
-
function createDiagnosticForOptionPaths(onKey, key, message,
|
|
115708
|
+
function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
|
|
115808
115709
|
let needCompilerDiagnostic = true;
|
|
115809
115710
|
const pathsSyntax = getOptionPathsSyntax();
|
|
115810
115711
|
for (const pathProp of pathsSyntax) {
|
|
@@ -115815,13 +115716,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115815
115716
|
/*key2*/
|
|
115816
115717
|
void 0,
|
|
115817
115718
|
message,
|
|
115818
|
-
|
|
115719
|
+
...args
|
|
115819
115720
|
)) {
|
|
115820
115721
|
needCompilerDiagnostic = false;
|
|
115821
115722
|
}
|
|
115822
115723
|
}
|
|
115823
115724
|
if (needCompilerDiagnostic) {
|
|
115824
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
115725
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
115825
115726
|
}
|
|
115826
115727
|
}
|
|
115827
115728
|
function getOptionsSyntaxByName(name) {
|
|
@@ -115851,7 +115752,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115851
115752
|
option3
|
|
115852
115753
|
);
|
|
115853
115754
|
}
|
|
115854
|
-
function createOptionValueDiagnostic(option1, message,
|
|
115755
|
+
function createOptionValueDiagnostic(option1, message, ...args) {
|
|
115855
115756
|
createDiagnosticForOption(
|
|
115856
115757
|
/*onKey*/
|
|
115857
115758
|
false,
|
|
@@ -115859,29 +115760,28 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115859
115760
|
/*option2*/
|
|
115860
115761
|
void 0,
|
|
115861
115762
|
message,
|
|
115862
|
-
|
|
115863
|
-
arg1
|
|
115763
|
+
...args
|
|
115864
115764
|
);
|
|
115865
115765
|
}
|
|
115866
|
-
function createDiagnosticForReference(sourceFile, index, message,
|
|
115766
|
+
function createDiagnosticForReference(sourceFile, index, message, ...args) {
|
|
115867
115767
|
const referencesSyntax = firstDefined(
|
|
115868
115768
|
getTsConfigPropArray(sourceFile || options.configFile, "references"),
|
|
115869
115769
|
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
115870
115770
|
);
|
|
115871
115771
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
|
115872
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message,
|
|
115772
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
|
|
115873
115773
|
} else {
|
|
115874
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
115774
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
115875
115775
|
}
|
|
115876
115776
|
}
|
|
115877
|
-
function createDiagnosticForOption(onKey, option1, option2, message,
|
|
115777
|
+
function createDiagnosticForOption(onKey, option1, option2, message, ...args) {
|
|
115878
115778
|
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
|
115879
|
-
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message,
|
|
115779
|
+
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, ...args);
|
|
115880
115780
|
if (needCompilerDiagnostic) {
|
|
115881
115781
|
if ("messageText" in message) {
|
|
115882
115782
|
programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
|
|
115883
115783
|
} else {
|
|
115884
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
115784
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
115885
115785
|
}
|
|
115886
115786
|
}
|
|
115887
115787
|
}
|
|
@@ -115900,13 +115800,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115900
115800
|
}
|
|
115901
115801
|
return _compilerOptionsObjectLiteralSyntax || void 0;
|
|
115902
115802
|
}
|
|
115903
|
-
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message,
|
|
115803
|
+
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
|
|
115904
115804
|
const props = getPropertyAssignment(objectLiteral, key1, key2);
|
|
115905
115805
|
for (const prop of props) {
|
|
115906
115806
|
if ("messageText" in message) {
|
|
115907
115807
|
programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
|
|
115908
115808
|
} else {
|
|
115909
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message,
|
|
115809
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
|
|
115910
115810
|
}
|
|
115911
115811
|
}
|
|
115912
115812
|
return !!props.length;
|
|
@@ -116807,16 +116707,16 @@ function convertToDiagnostics(diagnostics, newProgram) {
|
|
|
116807
116707
|
return emptyArray;
|
|
116808
116708
|
let buildInfoDirectory;
|
|
116809
116709
|
return diagnostics.map((diagnostic) => {
|
|
116810
|
-
const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram,
|
|
116710
|
+
const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPathInBuildInfoDirectory);
|
|
116811
116711
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
116812
116712
|
result.reportsDeprecated = diagnostic.reportDeprecated;
|
|
116813
116713
|
result.source = diagnostic.source;
|
|
116814
116714
|
result.skippedOn = diagnostic.skippedOn;
|
|
116815
116715
|
const { relatedInformation } = diagnostic;
|
|
116816
|
-
result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram,
|
|
116716
|
+
result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram, toPathInBuildInfoDirectory)) : [] : void 0;
|
|
116817
116717
|
return result;
|
|
116818
116718
|
});
|
|
116819
|
-
function
|
|
116719
|
+
function toPathInBuildInfoDirectory(path) {
|
|
116820
116720
|
buildInfoDirectory != null ? buildInfoDirectory : buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
|
|
116821
116721
|
return toPath(path, buildInfoDirectory, newProgram.getCanonicalFileName);
|
|
116822
116722
|
}
|
|
@@ -117719,7 +117619,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
117719
117619
|
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
117720
117620
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
117721
117621
|
let state;
|
|
117722
|
-
const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(
|
|
117622
|
+
const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(toPathInBuildInfoDirectory);
|
|
117723
117623
|
let filePathsSetList;
|
|
117724
117624
|
const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0;
|
|
117725
117625
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
@@ -117800,7 +117700,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
117800
117700
|
close: noop,
|
|
117801
117701
|
hasChangedEmitSignature: returnFalse
|
|
117802
117702
|
};
|
|
117803
|
-
function
|
|
117703
|
+
function toPathInBuildInfoDirectory(path) {
|
|
117804
117704
|
return toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
117805
117705
|
}
|
|
117806
117706
|
function toAbsolutePath(path) {
|
|
@@ -118839,15 +118739,13 @@ function getErrorSummaryText(errorCount, filesInError, newLine, host) {
|
|
|
118839
118739
|
const nonNilFiles = filesInError.filter((fileInError) => fileInError !== void 0);
|
|
118840
118740
|
const distinctFileNamesWithLines = nonNilFiles.map((fileInError) => `${fileInError.fileName}:${fileInError.line}`).filter((value, index, self) => self.indexOf(value) === index);
|
|
118841
118741
|
const firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
|
|
118842
|
-
|
|
118843
|
-
|
|
118844
|
-
|
|
118845
|
-
|
|
118846
|
-
|
|
118847
|
-
|
|
118848
|
-
|
|
118849
|
-
distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length
|
|
118850
|
-
);
|
|
118742
|
+
let messageAndArgs;
|
|
118743
|
+
if (errorCount === 1) {
|
|
118744
|
+
messageAndArgs = filesInError[0] !== void 0 ? [Diagnostics.Found_1_error_in_0, firstFileReference] : [Diagnostics.Found_1_error];
|
|
118745
|
+
} else {
|
|
118746
|
+
messageAndArgs = distinctFileNamesWithLines.length === 0 ? [Diagnostics.Found_0_errors, errorCount] : distinctFileNamesWithLines.length === 1 ? [Diagnostics.Found_0_errors_in_the_same_file_starting_at_Colon_1, errorCount, firstFileReference] : [Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length];
|
|
118747
|
+
}
|
|
118748
|
+
const d = createCompilerDiagnostic(...messageAndArgs);
|
|
118851
118749
|
const suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "";
|
|
118852
118750
|
return `${newLine}${flattenDiagnosticMessageText(d.messageText, newLine)}${newLine}${newLine}${suffix}`;
|
|
118853
118751
|
}
|
|
@@ -119057,15 +118955,15 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
|
|
|
119057
118955
|
toFileName(referencedResolvedRef.sourceFile.fileName, fileNameConvertor),
|
|
119058
118956
|
options.outFile ? "--outFile" : "--out"
|
|
119059
118957
|
);
|
|
119060
|
-
case 8 /* AutomaticTypeDirectiveFile */:
|
|
118958
|
+
case 8 /* AutomaticTypeDirectiveFile */: {
|
|
118959
|
+
const messageAndArgs = options.types ? reason.packageId ? [Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1, reason.typeReference, packageIdToString(reason.packageId)] : [Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions, reason.typeReference] : reason.packageId ? [Diagnostics.Entry_point_for_implicit_type_library_0_with_packageId_1, reason.typeReference, packageIdToString(reason.packageId)] : [Diagnostics.Entry_point_for_implicit_type_library_0, reason.typeReference];
|
|
119061
118960
|
return chainDiagnosticMessages(
|
|
119062
118961
|
/*details*/
|
|
119063
118962
|
void 0,
|
|
119064
|
-
|
|
119065
|
-
reason.typeReference,
|
|
119066
|
-
reason.packageId && packageIdToString(reason.packageId)
|
|
118963
|
+
...messageAndArgs
|
|
119067
118964
|
);
|
|
119068
|
-
|
|
118965
|
+
}
|
|
118966
|
+
case 6 /* LibFile */: {
|
|
119069
118967
|
if (reason.index !== void 0)
|
|
119070
118968
|
return chainDiagnosticMessages(
|
|
119071
118969
|
/*details*/
|
|
@@ -119074,12 +118972,13 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
|
|
|
119074
118972
|
options.lib[reason.index]
|
|
119075
118973
|
);
|
|
119076
118974
|
const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === getEmitScriptTarget(options) ? key : void 0);
|
|
118975
|
+
const messageAndArgs = target ? [Diagnostics.Default_library_for_target_0, target] : [Diagnostics.Default_library];
|
|
119077
118976
|
return chainDiagnosticMessages(
|
|
119078
118977
|
/*details*/
|
|
119079
118978
|
void 0,
|
|
119080
|
-
|
|
119081
|
-
target
|
|
118979
|
+
...messageAndArgs
|
|
119082
118980
|
);
|
|
118981
|
+
}
|
|
119083
118982
|
default:
|
|
119084
118983
|
Debug.assertNever(reason);
|
|
119085
118984
|
}
|