typescript 5.1.0-dev.20230320 → 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 +391 -515
- package/lib/tsserver.js +631 -726
- package/lib/tsserverlibrary.d.ts +6 -6
- package/lib/tsserverlibrary.js +642 -745
- package/lib/typescript.d.ts +6 -6
- package/lib/typescript.js +637 -741
- package/lib/typingsInstaller.js +74 -255
- 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;
|
|
@@ -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
|
}
|
|
@@ -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,42 +35911,33 @@ 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(
|
|
36052
|
-
}
|
|
36053
|
-
}
|
|
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);
|
|
35939
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt)));
|
|
36067
35940
|
}
|
|
36068
|
-
return normalizeNonListOptionValue(option, basePath, value);
|
|
36069
35941
|
}
|
|
36070
35942
|
function normalizeNonListOptionValue(option, basePath, value) {
|
|
36071
35943
|
if (option.isFilePath) {
|
|
@@ -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
|
}
|
|
@@ -56524,7 +56403,7 @@ function createTypeChecker(host) {
|
|
|
56524
56403
|
return type;
|
|
56525
56404
|
}
|
|
56526
56405
|
function getStringMappingType(symbol, type) {
|
|
56527
|
-
return type.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapType(type, (t) => getStringMappingType(symbol, t)) : type.flags &
|
|
56406
|
+
return type.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapType(type, (t) => getStringMappingType(symbol, t)) : type.flags & 128 /* StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : type.flags & 134217728 /* TemplateLiteral */ ? getTemplateLiteralType(...applyTemplateStringMapping(symbol, type.texts, type.types)) : (
|
|
56528
56407
|
// Mapping<Mapping<T>> === Mapping<T>
|
|
56529
56408
|
type.flags & 268435456 /* StringMapping */ && symbol === type.symbol ? type : type.flags & (1 /* Any */ | 4 /* String */ | 268435456 /* StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : (
|
|
56530
56409
|
// This handles Mapping<`${number}`> and Mapping<`${bigint}`>
|
|
@@ -58198,7 +58077,13 @@ function createTypeChecker(host) {
|
|
|
58198
58077
|
return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
|
|
58199
58078
|
}
|
|
58200
58079
|
function hasContextSensitiveReturnExpression(node) {
|
|
58201
|
-
|
|
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));
|
|
58202
58087
|
}
|
|
58203
58088
|
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
|
|
58204
58089
|
return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
|
|
@@ -58867,7 +58752,12 @@ function createTypeChecker(host) {
|
|
|
58867
58752
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
58868
58753
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
58869
58754
|
for (let i = 0; i < paramCount; i++) {
|
|
58870
|
-
const sourceType = i === restIndex ? getRestTypeAtPosition(
|
|
58755
|
+
const sourceType = i === restIndex ? getRestTypeAtPosition(
|
|
58756
|
+
source,
|
|
58757
|
+
i,
|
|
58758
|
+
/*readonly*/
|
|
58759
|
+
true
|
|
58760
|
+
) : tryGetTypeAtPosition(source, i);
|
|
58871
58761
|
const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
58872
58762
|
if (sourceType && targetType) {
|
|
58873
58763
|
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
@@ -59133,7 +59023,7 @@ function createTypeChecker(host) {
|
|
|
59133
59023
|
}
|
|
59134
59024
|
function getNormalizedType(type, writing) {
|
|
59135
59025
|
while (true) {
|
|
59136
|
-
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;
|
|
59137
59027
|
if (t === type)
|
|
59138
59028
|
return t;
|
|
59139
59029
|
type = t;
|
|
@@ -59152,6 +59042,11 @@ function createTypeChecker(host) {
|
|
|
59152
59042
|
}
|
|
59153
59043
|
return type;
|
|
59154
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
|
+
}
|
|
59155
59050
|
function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
|
|
59156
59051
|
var _a2;
|
|
59157
59052
|
let errorInfo;
|
|
@@ -59241,10 +59136,10 @@ function createTypeChecker(host) {
|
|
|
59241
59136
|
relatedInfo: relatedInfo == null ? void 0 : relatedInfo.slice()
|
|
59242
59137
|
};
|
|
59243
59138
|
}
|
|
59244
|
-
function reportIncompatibleError(message,
|
|
59139
|
+
function reportIncompatibleError(message, ...args) {
|
|
59245
59140
|
overrideNextErrorInfo++;
|
|
59246
59141
|
lastSkippedInfo = void 0;
|
|
59247
|
-
(incompatibleStack || (incompatibleStack = [])).push([message,
|
|
59142
|
+
(incompatibleStack || (incompatibleStack = [])).push([message, ...args]);
|
|
59248
59143
|
}
|
|
59249
59144
|
function reportIncompatibleStack() {
|
|
59250
59145
|
const stack = incompatibleStack || [];
|
|
@@ -59336,13 +59231,13 @@ function createTypeChecker(host) {
|
|
|
59336
59231
|
);
|
|
59337
59232
|
}
|
|
59338
59233
|
}
|
|
59339
|
-
function reportError(message,
|
|
59234
|
+
function reportError(message, ...args) {
|
|
59340
59235
|
Debug.assert(!!errorNode);
|
|
59341
59236
|
if (incompatibleStack)
|
|
59342
59237
|
reportIncompatibleStack();
|
|
59343
59238
|
if (message.elidedInCompatabilityPyramid)
|
|
59344
59239
|
return;
|
|
59345
|
-
errorInfo = chainDiagnosticMessages(errorInfo, message,
|
|
59240
|
+
errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
|
|
59346
59241
|
}
|
|
59347
59242
|
function associateRelatedInfo(info) {
|
|
59348
59243
|
Debug.assert(!!errorInfo);
|
|
@@ -60629,7 +60524,7 @@ function createTypeChecker(host) {
|
|
|
60629
60524
|
if (varianceResult !== void 0) {
|
|
60630
60525
|
return varianceResult;
|
|
60631
60526
|
}
|
|
60632
|
-
} else if (isReadonlyArrayType(target2) ?
|
|
60527
|
+
} else if (isReadonlyArrayType(target2) ? everyType(source2, isArrayOrTupleType) : isArrayType(target2) && everyType(source2, (t) => isTupleType(t) && !t.target.readonly)) {
|
|
60633
60528
|
if (relation !== identityRelation) {
|
|
60634
60529
|
return isRelatedTo(getIndexTypeOfType(source2, numberType) || anyType, getIndexTypeOfType(target2, numberType) || anyType, 3 /* Both */, reportErrors2);
|
|
60635
60530
|
} else {
|
|
@@ -61512,22 +61407,7 @@ function createTypeChecker(host) {
|
|
|
61512
61407
|
if (match === -1) {
|
|
61513
61408
|
return defaultValue;
|
|
61514
61409
|
}
|
|
61515
|
-
|
|
61516
|
-
/*searchElement*/
|
|
61517
|
-
true,
|
|
61518
|
-
match + 1
|
|
61519
|
-
);
|
|
61520
|
-
while (nextMatch !== -1) {
|
|
61521
|
-
if (!isTypeIdenticalTo(target.types[match], target.types[nextMatch])) {
|
|
61522
|
-
return defaultValue;
|
|
61523
|
-
}
|
|
61524
|
-
nextMatch = discriminable.indexOf(
|
|
61525
|
-
/*searchElement*/
|
|
61526
|
-
true,
|
|
61527
|
-
nextMatch + 1
|
|
61528
|
-
);
|
|
61529
|
-
}
|
|
61530
|
-
return target.types[match];
|
|
61410
|
+
return getUnionType(target.types.filter((_, index) => discriminable[index]));
|
|
61531
61411
|
}
|
|
61532
61412
|
function isWeakType(type) {
|
|
61533
61413
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -61728,7 +61608,7 @@ function createTypeChecker(host) {
|
|
|
61728
61608
|
return type.symbol;
|
|
61729
61609
|
}
|
|
61730
61610
|
if (isTupleType(type)) {
|
|
61731
|
-
return type
|
|
61611
|
+
return type;
|
|
61732
61612
|
}
|
|
61733
61613
|
}
|
|
61734
61614
|
if (type.flags & 262144 /* TypeParameter */) {
|
|
@@ -63127,7 +63007,11 @@ function createTypeChecker(host) {
|
|
|
63127
63007
|
return true;
|
|
63128
63008
|
}
|
|
63129
63009
|
if (constraintType.flags & 262144 /* TypeParameter */) {
|
|
63130
|
-
inferWithPriority(getIndexType(
|
|
63010
|
+
inferWithPriority(getIndexType(
|
|
63011
|
+
source,
|
|
63012
|
+
/*indexFlags*/
|
|
63013
|
+
!!source.pattern ? 2 /* NoIndexSignatures */ : 0 /* None */
|
|
63014
|
+
), constraintType, 32 /* MappedTypeConstraint */);
|
|
63131
63015
|
const extendedConstraint = getConstraintOfType(constraintType);
|
|
63132
63016
|
if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) {
|
|
63133
63017
|
return true;
|
|
@@ -63600,36 +63484,34 @@ function createTypeChecker(host) {
|
|
|
63600
63484
|
return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName : type.flags & 384 /* StringOrNumberLiteral */ ? escapeLeadingUnderscores("" + type.value) : void 0;
|
|
63601
63485
|
}
|
|
63602
63486
|
function tryGetElementAccessExpressionName(node) {
|
|
63603
|
-
|
|
63604
|
-
|
|
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
|
+
}
|
|
63605
63507
|
}
|
|
63606
|
-
if (
|
|
63607
|
-
const
|
|
63608
|
-
|
|
63609
|
-
|
|
63610
|
-
/*ignoreErrors*/
|
|
63611
|
-
true
|
|
63612
|
-
);
|
|
63613
|
-
if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */))
|
|
63614
|
-
return void 0;
|
|
63615
|
-
const declaration = symbol.valueDeclaration;
|
|
63616
|
-
if (declaration === void 0)
|
|
63617
|
-
return void 0;
|
|
63618
|
-
const type = tryGetTypeFromEffectiveTypeNode(declaration);
|
|
63619
|
-
if (type) {
|
|
63620
|
-
const name = tryGetNameFromType(type);
|
|
63621
|
-
if (name !== void 0) {
|
|
63622
|
-
return name;
|
|
63623
|
-
}
|
|
63508
|
+
if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node)) {
|
|
63509
|
+
const initializer = getEffectiveInitializer(declaration);
|
|
63510
|
+
if (initializer) {
|
|
63511
|
+
return tryGetNameFromType(getTypeOfExpression(initializer));
|
|
63624
63512
|
}
|
|
63625
|
-
if (
|
|
63626
|
-
|
|
63627
|
-
if (initializer) {
|
|
63628
|
-
return tryGetNameFromType(getTypeOfExpression(initializer));
|
|
63629
|
-
}
|
|
63630
|
-
if (isEnumMember(declaration)) {
|
|
63631
|
-
return getTextOfPropertyName(declaration.name);
|
|
63632
|
-
}
|
|
63513
|
+
if (isEnumMember(declaration)) {
|
|
63514
|
+
return getTextOfPropertyName(declaration.name);
|
|
63633
63515
|
}
|
|
63634
63516
|
}
|
|
63635
63517
|
return void 0;
|
|
@@ -65547,7 +65429,7 @@ function createTypeChecker(host) {
|
|
|
65547
65429
|
});
|
|
65548
65430
|
}
|
|
65549
65431
|
function markAliasReferenced(symbol, location) {
|
|
65550
|
-
if (
|
|
65432
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
65551
65433
|
return;
|
|
65552
65434
|
}
|
|
65553
65435
|
if (isNonLocalAlias(
|
|
@@ -66839,7 +66721,11 @@ function createTypeChecker(host) {
|
|
|
66839
66721
|
if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
|
|
66840
66722
|
const apparentType = mapType(
|
|
66841
66723
|
instantiatedType,
|
|
66842
|
-
|
|
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),
|
|
66843
66729
|
/*noReductions*/
|
|
66844
66730
|
true
|
|
66845
66731
|
);
|
|
@@ -68104,7 +67990,7 @@ function createTypeChecker(host) {
|
|
|
68104
67990
|
}
|
|
68105
67991
|
if (jsxFactorySym) {
|
|
68106
67992
|
jsxFactorySym.isReferenced = 67108863 /* All */;
|
|
68107
|
-
if (
|
|
67993
|
+
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
68108
67994
|
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
68109
67995
|
}
|
|
68110
67996
|
}
|
|
@@ -69678,16 +69564,16 @@ function createTypeChecker(host) {
|
|
|
69678
69564
|
}
|
|
69679
69565
|
return { start, length: length2, sourceFile };
|
|
69680
69566
|
}
|
|
69681
|
-
function getDiagnosticForCallNode(node, message,
|
|
69567
|
+
function getDiagnosticForCallNode(node, message, ...args) {
|
|
69682
69568
|
if (isCallExpression(node)) {
|
|
69683
69569
|
const { sourceFile, start, length: length2 } = getDiagnosticSpanForCallNode(node);
|
|
69684
69570
|
if ("message" in message) {
|
|
69685
|
-
return createFileDiagnostic(sourceFile, start, length2, message,
|
|
69571
|
+
return createFileDiagnostic(sourceFile, start, length2, message, ...args);
|
|
69686
69572
|
}
|
|
69687
69573
|
return createDiagnosticForFileFromMessageChain(sourceFile, message);
|
|
69688
69574
|
} else {
|
|
69689
69575
|
if ("message" in message) {
|
|
69690
|
-
return createDiagnosticForNode(node, message,
|
|
69576
|
+
return createDiagnosticForNode(node, message, ...args);
|
|
69691
69577
|
}
|
|
69692
69578
|
return createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, message);
|
|
69693
69579
|
}
|
|
@@ -69775,11 +69661,8 @@ function createTypeChecker(host) {
|
|
|
69775
69661
|
}
|
|
69776
69662
|
const parameter = (_a2 = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a2.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
|
|
69777
69663
|
if (parameter) {
|
|
69778
|
-
const
|
|
69779
|
-
|
|
69780
|
-
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,
|
|
69781
|
-
!parameter.name ? args.length : !isBindingPattern(parameter.name) ? idText(getFirstIdentifier(parameter.name)) : void 0
|
|
69782
|
-
);
|
|
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);
|
|
69783
69666
|
return addRelatedInfo(diagnostic, parameterError);
|
|
69784
69667
|
}
|
|
69785
69668
|
return diagnostic;
|
|
@@ -71384,12 +71267,12 @@ function createTypeChecker(host) {
|
|
|
71384
71267
|
}
|
|
71385
71268
|
return void 0;
|
|
71386
71269
|
}
|
|
71387
|
-
function getRestTypeAtPosition(source, pos) {
|
|
71270
|
+
function getRestTypeAtPosition(source, pos, readonly = false) {
|
|
71388
71271
|
const parameterCount = getParameterCount(source);
|
|
71389
71272
|
const minArgumentCount = getMinArgumentCount(source);
|
|
71390
71273
|
const restType = getEffectiveRestType(source);
|
|
71391
71274
|
if (restType && pos >= parameterCount - 1) {
|
|
71392
|
-
return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
|
|
71275
|
+
return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType), readonly);
|
|
71393
71276
|
}
|
|
71394
71277
|
const types = [];
|
|
71395
71278
|
const flags = [];
|
|
@@ -71407,13 +71290,7 @@ function createTypeChecker(host) {
|
|
|
71407
71290
|
names.push(name);
|
|
71408
71291
|
}
|
|
71409
71292
|
}
|
|
71410
|
-
return createTupleType(
|
|
71411
|
-
types,
|
|
71412
|
-
flags,
|
|
71413
|
-
/*readonly*/
|
|
71414
|
-
false,
|
|
71415
|
-
length(names) === length(types) ? names : void 0
|
|
71416
|
-
);
|
|
71293
|
+
return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
|
|
71417
71294
|
}
|
|
71418
71295
|
function getParameterCount(signature) {
|
|
71419
71296
|
const length2 = signature.parameters.length;
|
|
@@ -75119,9 +74996,9 @@ function createTypeChecker(host) {
|
|
|
75119
74996
|
}
|
|
75120
74997
|
}
|
|
75121
74998
|
}
|
|
75122
|
-
function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage,
|
|
74999
|
+
function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, ...args) {
|
|
75123
75000
|
const promisedType = getPromisedTypeOfPromise(type, errorNode);
|
|
75124
|
-
return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage,
|
|
75001
|
+
return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, ...args);
|
|
75125
75002
|
}
|
|
75126
75003
|
function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) {
|
|
75127
75004
|
if (isTypeAny(type)) {
|
|
@@ -75184,8 +75061,8 @@ function createTypeChecker(host) {
|
|
|
75184
75061
|
}
|
|
75185
75062
|
return typeAsPromise.promisedTypeOfPromise = getUnionType(map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), 2 /* Subtype */);
|
|
75186
75063
|
}
|
|
75187
|
-
function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage,
|
|
75188
|
-
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);
|
|
75189
75066
|
return awaitedType || errorType;
|
|
75190
75067
|
}
|
|
75191
75068
|
function isThenableType(type) {
|
|
@@ -75241,11 +75118,11 @@ function createTypeChecker(host) {
|
|
|
75241
75118
|
Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
75242
75119
|
return type;
|
|
75243
75120
|
}
|
|
75244
|
-
function getAwaitedType(type, errorNode, diagnosticMessage,
|
|
75245
|
-
const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage,
|
|
75121
|
+
function getAwaitedType(type, errorNode, diagnosticMessage, ...args) {
|
|
75122
|
+
const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args);
|
|
75246
75123
|
return awaitedType && createAwaitedTypeIfNeeded(awaitedType);
|
|
75247
75124
|
}
|
|
75248
|
-
function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage,
|
|
75125
|
+
function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args) {
|
|
75249
75126
|
if (isTypeAny(type)) {
|
|
75250
75127
|
return type;
|
|
75251
75128
|
}
|
|
@@ -75263,7 +75140,7 @@ function createTypeChecker(host) {
|
|
|
75263
75140
|
}
|
|
75264
75141
|
return void 0;
|
|
75265
75142
|
}
|
|
75266
|
-
const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage,
|
|
75143
|
+
const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias;
|
|
75267
75144
|
awaitedTypeStack.push(type.id);
|
|
75268
75145
|
const mapped = mapType(type, mapper);
|
|
75269
75146
|
awaitedTypeStack.pop();
|
|
@@ -75287,7 +75164,7 @@ function createTypeChecker(host) {
|
|
|
75287
75164
|
return void 0;
|
|
75288
75165
|
}
|
|
75289
75166
|
awaitedTypeStack.push(type.id);
|
|
75290
|
-
const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage,
|
|
75167
|
+
const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, ...args);
|
|
75291
75168
|
awaitedTypeStack.pop();
|
|
75292
75169
|
if (!awaitedType) {
|
|
75293
75170
|
return void 0;
|
|
@@ -75301,7 +75178,7 @@ function createTypeChecker(host) {
|
|
|
75301
75178
|
if (thisTypeForErrorOut.value) {
|
|
75302
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));
|
|
75303
75180
|
}
|
|
75304
|
-
chain = chainDiagnosticMessages(chain, diagnosticMessage,
|
|
75181
|
+
chain = chainDiagnosticMessages(chain, diagnosticMessage, ...args);
|
|
75305
75182
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(errorNode), errorNode, chain));
|
|
75306
75183
|
}
|
|
75307
75184
|
return void 0;
|
|
@@ -75479,7 +75356,7 @@ function createTypeChecker(host) {
|
|
|
75479
75356
|
true
|
|
75480
75357
|
);
|
|
75481
75358
|
if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
|
|
75482
|
-
if (
|
|
75359
|
+
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
75483
75360
|
markAliasSymbolAsReferenced(rootSymbol);
|
|
75484
75361
|
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
75485
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);
|
|
@@ -75888,9 +75765,8 @@ function createTypeChecker(host) {
|
|
|
75888
75765
|
const sourceFile = getSourceFileOfNode(parent);
|
|
75889
75766
|
const range = isJSDocTemplateTag(parent) ? rangeOfNode(parent) : rangeOfTypeParameters(sourceFile, parent.typeParameters);
|
|
75890
75767
|
const only = parent.typeParameters.length === 1;
|
|
75891
|
-
const
|
|
75892
|
-
|
|
75893
|
-
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));
|
|
75894
75770
|
}
|
|
75895
75771
|
} else {
|
|
75896
75772
|
addDiagnostic(typeParameter, 1 /* Parameter */, createDiagnosticForNode(typeParameter, Diagnostics._0_is_declared_but_its_value_is_never_read, name));
|
|
@@ -77448,7 +77324,7 @@ function createTypeChecker(host) {
|
|
|
77448
77324
|
forEachKey(catchClause.locals, (caughtName) => {
|
|
77449
77325
|
const blockLocal = blockLocals.get(caughtName);
|
|
77450
77326
|
if ((blockLocal == null ? void 0 : blockLocal.valueDeclaration) && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) {
|
|
77451
|
-
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));
|
|
77452
77328
|
}
|
|
77453
77329
|
});
|
|
77454
77330
|
}
|
|
@@ -79044,6 +78920,9 @@ function createTypeChecker(host) {
|
|
|
79044
78920
|
) && !getSymbolLinks(getSymbolOfDeclaration(statement)).constEnumReferenced;
|
|
79045
78921
|
}
|
|
79046
78922
|
function checkImportsForTypeOnlyConversion(sourceFile) {
|
|
78923
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
78924
|
+
return;
|
|
78925
|
+
}
|
|
79047
78926
|
for (const statement of sourceFile.statements) {
|
|
79048
78927
|
if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) {
|
|
79049
78928
|
error(
|
|
@@ -79129,14 +79008,14 @@ function createTypeChecker(host) {
|
|
|
79129
79008
|
markAliasReferenced(sym, id);
|
|
79130
79009
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
79131
79010
|
checkExpressionCached(id);
|
|
79132
|
-
if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
79011
|
+
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
79133
79012
|
error(
|
|
79134
79013
|
id,
|
|
79135
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,
|
|
79136
79015
|
idText(id)
|
|
79137
79016
|
);
|
|
79138
79017
|
}
|
|
79139
|
-
} else if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax) {
|
|
79018
|
+
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
79140
79019
|
error(
|
|
79141
79020
|
id,
|
|
79142
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,
|
|
@@ -80473,7 +80352,7 @@ function createTypeChecker(host) {
|
|
|
80473
80352
|
return false;
|
|
80474
80353
|
}
|
|
80475
80354
|
function isValueAliasDeclaration(node) {
|
|
80476
|
-
Debug.assert(
|
|
80355
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
80477
80356
|
switch (node.kind) {
|
|
80478
80357
|
case 269 /* ImportEqualsDeclaration */:
|
|
80479
80358
|
return isAliasResolvedToValue(getSymbolOfDeclaration(node));
|
|
@@ -80514,7 +80393,7 @@ function createTypeChecker(host) {
|
|
|
80514
80393
|
return isConstEnumSymbol(s) || !!s.constEnumOnlyModule;
|
|
80515
80394
|
}
|
|
80516
80395
|
function isReferencedAliasDeclaration(node, checkChildren) {
|
|
80517
|
-
Debug.assert(
|
|
80396
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
80518
80397
|
if (isAliasSymbolDeclaration(node)) {
|
|
80519
80398
|
const symbol = getSymbolOfDeclaration(node);
|
|
80520
80399
|
const links = symbol && getSymbolLinks(symbol);
|
|
@@ -80852,12 +80731,12 @@ function createTypeChecker(host) {
|
|
|
80852
80731
|
isDeclarationWithCollidingName,
|
|
80853
80732
|
isValueAliasDeclaration: (nodeIn) => {
|
|
80854
80733
|
const node = getParseTreeNode(nodeIn);
|
|
80855
|
-
return node ? isValueAliasDeclaration(node) : true;
|
|
80734
|
+
return node && canCollectSymbolAliasAccessabilityData ? isValueAliasDeclaration(node) : true;
|
|
80856
80735
|
},
|
|
80857
80736
|
hasGlobalName,
|
|
80858
80737
|
isReferencedAliasDeclaration: (nodeIn, checkChildren) => {
|
|
80859
80738
|
const node = getParseTreeNode(nodeIn);
|
|
80860
|
-
return node ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
80739
|
+
return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
80861
80740
|
},
|
|
80862
80741
|
getNodeCheckFlags: (nodeIn) => {
|
|
80863
80742
|
const node = getParseTreeNode(nodeIn);
|
|
@@ -81992,7 +81871,7 @@ function createTypeChecker(host) {
|
|
|
81992
81871
|
throw Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
|
|
81993
81872
|
}
|
|
81994
81873
|
if (!inDestructuring) {
|
|
81995
|
-
const effectiveName =
|
|
81874
|
+
const effectiveName = getEffectivePropertyNameForPropertyNameNode(name);
|
|
81996
81875
|
if (effectiveName === void 0) {
|
|
81997
81876
|
continue;
|
|
81998
81877
|
}
|
|
@@ -82461,12 +82340,12 @@ function createTypeChecker(host) {
|
|
|
82461
82340
|
switch (node.keywordToken) {
|
|
82462
82341
|
case 104 /* NewKeyword */:
|
|
82463
82342
|
if (escapedText !== "target") {
|
|
82464
|
-
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");
|
|
82465
82344
|
}
|
|
82466
82345
|
break;
|
|
82467
82346
|
case 101 /* ImportKeyword */:
|
|
82468
82347
|
if (escapedText !== "meta") {
|
|
82469
|
-
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");
|
|
82470
82349
|
}
|
|
82471
82350
|
break;
|
|
82472
82351
|
}
|
|
@@ -82474,35 +82353,35 @@ function createTypeChecker(host) {
|
|
|
82474
82353
|
function hasParseDiagnostics(sourceFile) {
|
|
82475
82354
|
return sourceFile.parseDiagnostics.length > 0;
|
|
82476
82355
|
}
|
|
82477
|
-
function grammarErrorOnFirstToken(node, message,
|
|
82356
|
+
function grammarErrorOnFirstToken(node, message, ...args) {
|
|
82478
82357
|
const sourceFile = getSourceFileOfNode(node);
|
|
82479
82358
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
82480
82359
|
const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
82481
|
-
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message,
|
|
82360
|
+
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, ...args));
|
|
82482
82361
|
return true;
|
|
82483
82362
|
}
|
|
82484
82363
|
return false;
|
|
82485
82364
|
}
|
|
82486
|
-
function grammarErrorAtPos(nodeForSourceFile, start, length2, message,
|
|
82365
|
+
function grammarErrorAtPos(nodeForSourceFile, start, length2, message, ...args) {
|
|
82487
82366
|
const sourceFile = getSourceFileOfNode(nodeForSourceFile);
|
|
82488
82367
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
82489
|
-
diagnostics.add(createFileDiagnostic(sourceFile, start, length2, message,
|
|
82368
|
+
diagnostics.add(createFileDiagnostic(sourceFile, start, length2, message, ...args));
|
|
82490
82369
|
return true;
|
|
82491
82370
|
}
|
|
82492
82371
|
return false;
|
|
82493
82372
|
}
|
|
82494
|
-
function grammarErrorOnNodeSkippedOn(key, node, message,
|
|
82373
|
+
function grammarErrorOnNodeSkippedOn(key, node, message, ...args) {
|
|
82495
82374
|
const sourceFile = getSourceFileOfNode(node);
|
|
82496
82375
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
82497
|
-
errorSkippedOn(key, node, message,
|
|
82376
|
+
errorSkippedOn(key, node, message, ...args);
|
|
82498
82377
|
return true;
|
|
82499
82378
|
}
|
|
82500
82379
|
return false;
|
|
82501
82380
|
}
|
|
82502
|
-
function grammarErrorOnNode(node, message,
|
|
82381
|
+
function grammarErrorOnNode(node, message, ...args) {
|
|
82503
82382
|
const sourceFile = getSourceFileOfNode(node);
|
|
82504
82383
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
82505
|
-
diagnostics.add(createDiagnosticForNode(node, message,
|
|
82384
|
+
diagnostics.add(createDiagnosticForNode(node, message, ...args));
|
|
82506
82385
|
return true;
|
|
82507
82386
|
}
|
|
82508
82387
|
return false;
|
|
@@ -82647,7 +82526,7 @@ function createTypeChecker(host) {
|
|
|
82647
82526
|
}
|
|
82648
82527
|
return false;
|
|
82649
82528
|
}
|
|
82650
|
-
function grammarErrorAfterFirstToken(node, message,
|
|
82529
|
+
function grammarErrorAfterFirstToken(node, message, ...args) {
|
|
82651
82530
|
const sourceFile = getSourceFileOfNode(node);
|
|
82652
82531
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
82653
82532
|
const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
@@ -82657,9 +82536,7 @@ function createTypeChecker(host) {
|
|
|
82657
82536
|
/*length*/
|
|
82658
82537
|
0,
|
|
82659
82538
|
message,
|
|
82660
|
-
|
|
82661
|
-
arg1,
|
|
82662
|
-
arg2
|
|
82539
|
+
...args
|
|
82663
82540
|
));
|
|
82664
82541
|
return true;
|
|
82665
82542
|
}
|
|
@@ -82805,6 +82682,10 @@ function createTypeChecker(host) {
|
|
|
82805
82682
|
}
|
|
82806
82683
|
return void 0;
|
|
82807
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
|
+
}
|
|
82808
82689
|
}
|
|
82809
82690
|
function isNotAccessor(declaration) {
|
|
82810
82691
|
return !isAccessor(declaration);
|
|
@@ -106975,8 +106856,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
106975
106856
|
}
|
|
106976
106857
|
}
|
|
106977
106858
|
function createBuildInfo(program, bundle) {
|
|
106978
|
-
|
|
106979
|
-
return { bundle, program, version: version2 };
|
|
106859
|
+
return { bundle, program, version };
|
|
106980
106860
|
}
|
|
106981
106861
|
function getBuildInfoText(buildInfo) {
|
|
106982
106862
|
return JSON.stringify(buildInfo);
|
|
@@ -107064,10 +106944,10 @@ function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
|
|
|
107064
106944
|
/*separateBeginAndEnd*/
|
|
107065
106945
|
true
|
|
107066
106946
|
);
|
|
107067
|
-
|
|
106947
|
+
mark("beforeEmit");
|
|
107068
106948
|
const result = emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers);
|
|
107069
|
-
|
|
107070
|
-
|
|
106949
|
+
mark("afterEmit");
|
|
106950
|
+
measure("Emit", "beforeEmit", "afterEmit");
|
|
107071
106951
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
107072
106952
|
return result;
|
|
107073
106953
|
}
|
|
@@ -111081,12 +110961,12 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
111081
110961
|
return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags != null ? flags : 0 /* None */, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix)));
|
|
111082
110962
|
}
|
|
111083
110963
|
function isUniqueName(name, privateName) {
|
|
111084
|
-
return
|
|
110964
|
+
return isFileLevelUniqueNameInCurrentFile(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
|
|
111085
110965
|
}
|
|
111086
110966
|
function isReservedName(name, privateName) {
|
|
111087
110967
|
return privateName ? !!(reservedPrivateNames == null ? void 0 : reservedPrivateNames.has(name)) : !!(reservedNames == null ? void 0 : reservedNames.has(name));
|
|
111088
110968
|
}
|
|
111089
|
-
function
|
|
110969
|
+
function isFileLevelUniqueNameInCurrentFile(name, _isPrivate) {
|
|
111090
110970
|
return currentSourceFile ? isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true;
|
|
111091
110971
|
}
|
|
111092
110972
|
function isUniqueLocalName(name, container) {
|
|
@@ -111205,7 +111085,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
111205
111085
|
function makeFileLevelOptimisticUniqueName(name) {
|
|
111206
111086
|
return makeUniqueName(
|
|
111207
111087
|
name,
|
|
111208
|
-
|
|
111088
|
+
isFileLevelUniqueNameInCurrentFile,
|
|
111209
111089
|
/*optimistic*/
|
|
111210
111090
|
true,
|
|
111211
111091
|
/*scoped*/
|
|
@@ -111385,7 +111265,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
111385
111265
|
case 3 /* Unique */:
|
|
111386
111266
|
return makeUniqueName(
|
|
111387
111267
|
idText(name),
|
|
111388
|
-
autoGenerate.flags & 32 /* FileLevel */ ?
|
|
111268
|
+
autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueNameInCurrentFile : isUniqueName,
|
|
111389
111269
|
!!(autoGenerate.flags & 16 /* Optimistic */),
|
|
111390
111270
|
!!(autoGenerate.flags & 8 /* ReservedInNestedScopes */),
|
|
111391
111271
|
isPrivateIdentifier(name),
|
|
@@ -114406,12 +114286,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
114406
114286
|
}
|
|
114407
114287
|
}
|
|
114408
114288
|
}
|
|
114409
|
-
function createDiagnosticForNodeArray2(nodes, message,
|
|
114289
|
+
function createDiagnosticForNodeArray2(nodes, message, ...args) {
|
|
114410
114290
|
const start = nodes.pos;
|
|
114411
|
-
return createFileDiagnostic(sourceFile, start, nodes.end - start, message,
|
|
114291
|
+
return createFileDiagnostic(sourceFile, start, nodes.end - start, message, ...args);
|
|
114412
114292
|
}
|
|
114413
|
-
function createDiagnosticForNode2(node, message,
|
|
114414
|
-
return createDiagnosticForNodeInSourceFile(sourceFile, node, message,
|
|
114293
|
+
function createDiagnosticForNode2(node, message, ...args) {
|
|
114294
|
+
return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args);
|
|
114415
114295
|
}
|
|
114416
114296
|
});
|
|
114417
114297
|
}
|
|
@@ -115076,11 +114956,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115076
114956
|
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
|
115077
114957
|
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
|
115078
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];
|
|
115079
114960
|
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
115080
114961
|
kind: 0 /* FilePreprocessingReferencedDiagnostic */,
|
|
115081
114962
|
reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index },
|
|
115082
114963
|
diagnostic,
|
|
115083
|
-
args
|
|
114964
|
+
args
|
|
115084
114965
|
});
|
|
115085
114966
|
}
|
|
115086
114967
|
});
|
|
@@ -115545,7 +115426,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115545
115426
|
}
|
|
115546
115427
|
}
|
|
115547
115428
|
function verifyDeprecatedCompilerOptions() {
|
|
115548
|
-
function createDiagnostic(name, value, useInstead, message,
|
|
115429
|
+
function createDiagnostic(name, value, useInstead, message, ...args) {
|
|
115549
115430
|
if (useInstead) {
|
|
115550
115431
|
const details = chainDiagnosticMessages(
|
|
115551
115432
|
/*details*/
|
|
@@ -115553,7 +115434,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115553
115434
|
Diagnostics.Use_0_instead,
|
|
115554
115435
|
useInstead
|
|
115555
115436
|
);
|
|
115556
|
-
const chain = chainDiagnosticMessages(details, message,
|
|
115437
|
+
const chain = chainDiagnosticMessages(details, message, ...args);
|
|
115557
115438
|
createDiagnosticForOption(
|
|
115558
115439
|
/*onKey*/
|
|
115559
115440
|
!value,
|
|
@@ -115570,10 +115451,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115570
115451
|
/*option2*/
|
|
115571
115452
|
void 0,
|
|
115572
115453
|
message,
|
|
115573
|
-
|
|
115574
|
-
arg1,
|
|
115575
|
-
arg2,
|
|
115576
|
-
arg3
|
|
115454
|
+
...args
|
|
115577
115455
|
);
|
|
115578
115456
|
}
|
|
115579
115457
|
}
|
|
@@ -115626,8 +115504,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115626
115504
|
});
|
|
115627
115505
|
}
|
|
115628
115506
|
function verifyDeprecatedProjectReference(ref, parentFile, index) {
|
|
115629
|
-
function createDiagnostic(_name, _value, _useInstead, message,
|
|
115630
|
-
createDiagnosticForReference(parentFile, index, message,
|
|
115507
|
+
function createDiagnostic(_name, _value, _useInstead, message, ...args) {
|
|
115508
|
+
createDiagnosticForReference(parentFile, index, message, ...args);
|
|
115631
115509
|
}
|
|
115632
115510
|
checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
|
|
115633
115511
|
if (ref.prepend) {
|
|
@@ -115809,7 +115687,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115809
115687
|
}
|
|
115810
115688
|
});
|
|
115811
115689
|
}
|
|
115812
|
-
function createDiagnosticForOptionPathKeyValue(key, valueIndex, message,
|
|
115690
|
+
function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
|
|
115813
115691
|
let needCompilerDiagnostic = true;
|
|
115814
115692
|
const pathsSyntax = getOptionPathsSyntax();
|
|
115815
115693
|
for (const pathProp of pathsSyntax) {
|
|
@@ -115817,17 +115695,17 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115817
115695
|
for (const keyProps of getPropertyAssignment(pathProp.initializer, key)) {
|
|
115818
115696
|
const initializer = keyProps.initializer;
|
|
115819
115697
|
if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
|
|
115820
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message,
|
|
115698
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
|
|
115821
115699
|
needCompilerDiagnostic = false;
|
|
115822
115700
|
}
|
|
115823
115701
|
}
|
|
115824
115702
|
}
|
|
115825
115703
|
}
|
|
115826
115704
|
if (needCompilerDiagnostic) {
|
|
115827
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
115705
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
115828
115706
|
}
|
|
115829
115707
|
}
|
|
115830
|
-
function createDiagnosticForOptionPaths(onKey, key, message,
|
|
115708
|
+
function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
|
|
115831
115709
|
let needCompilerDiagnostic = true;
|
|
115832
115710
|
const pathsSyntax = getOptionPathsSyntax();
|
|
115833
115711
|
for (const pathProp of pathsSyntax) {
|
|
@@ -115838,13 +115716,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115838
115716
|
/*key2*/
|
|
115839
115717
|
void 0,
|
|
115840
115718
|
message,
|
|
115841
|
-
|
|
115719
|
+
...args
|
|
115842
115720
|
)) {
|
|
115843
115721
|
needCompilerDiagnostic = false;
|
|
115844
115722
|
}
|
|
115845
115723
|
}
|
|
115846
115724
|
if (needCompilerDiagnostic) {
|
|
115847
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
115725
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
115848
115726
|
}
|
|
115849
115727
|
}
|
|
115850
115728
|
function getOptionsSyntaxByName(name) {
|
|
@@ -115874,7 +115752,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115874
115752
|
option3
|
|
115875
115753
|
);
|
|
115876
115754
|
}
|
|
115877
|
-
function createOptionValueDiagnostic(option1, message,
|
|
115755
|
+
function createOptionValueDiagnostic(option1, message, ...args) {
|
|
115878
115756
|
createDiagnosticForOption(
|
|
115879
115757
|
/*onKey*/
|
|
115880
115758
|
false,
|
|
@@ -115882,29 +115760,28 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115882
115760
|
/*option2*/
|
|
115883
115761
|
void 0,
|
|
115884
115762
|
message,
|
|
115885
|
-
|
|
115886
|
-
arg1
|
|
115763
|
+
...args
|
|
115887
115764
|
);
|
|
115888
115765
|
}
|
|
115889
|
-
function createDiagnosticForReference(sourceFile, index, message,
|
|
115766
|
+
function createDiagnosticForReference(sourceFile, index, message, ...args) {
|
|
115890
115767
|
const referencesSyntax = firstDefined(
|
|
115891
115768
|
getTsConfigPropArray(sourceFile || options.configFile, "references"),
|
|
115892
115769
|
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
115893
115770
|
);
|
|
115894
115771
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
|
115895
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message,
|
|
115772
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
|
|
115896
115773
|
} else {
|
|
115897
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
115774
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
115898
115775
|
}
|
|
115899
115776
|
}
|
|
115900
|
-
function createDiagnosticForOption(onKey, option1, option2, message,
|
|
115777
|
+
function createDiagnosticForOption(onKey, option1, option2, message, ...args) {
|
|
115901
115778
|
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
|
115902
|
-
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message,
|
|
115779
|
+
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, ...args);
|
|
115903
115780
|
if (needCompilerDiagnostic) {
|
|
115904
115781
|
if ("messageText" in message) {
|
|
115905
115782
|
programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
|
|
115906
115783
|
} else {
|
|
115907
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
115784
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
115908
115785
|
}
|
|
115909
115786
|
}
|
|
115910
115787
|
}
|
|
@@ -115923,13 +115800,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115923
115800
|
}
|
|
115924
115801
|
return _compilerOptionsObjectLiteralSyntax || void 0;
|
|
115925
115802
|
}
|
|
115926
|
-
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message,
|
|
115803
|
+
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
|
|
115927
115804
|
const props = getPropertyAssignment(objectLiteral, key1, key2);
|
|
115928
115805
|
for (const prop of props) {
|
|
115929
115806
|
if ("messageText" in message) {
|
|
115930
115807
|
programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
|
|
115931
115808
|
} else {
|
|
115932
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message,
|
|
115809
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
|
|
115933
115810
|
}
|
|
115934
115811
|
}
|
|
115935
115812
|
return !!props.length;
|
|
@@ -116830,16 +116707,16 @@ function convertToDiagnostics(diagnostics, newProgram) {
|
|
|
116830
116707
|
return emptyArray;
|
|
116831
116708
|
let buildInfoDirectory;
|
|
116832
116709
|
return diagnostics.map((diagnostic) => {
|
|
116833
|
-
const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram,
|
|
116710
|
+
const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPathInBuildInfoDirectory);
|
|
116834
116711
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
116835
116712
|
result.reportsDeprecated = diagnostic.reportDeprecated;
|
|
116836
116713
|
result.source = diagnostic.source;
|
|
116837
116714
|
result.skippedOn = diagnostic.skippedOn;
|
|
116838
116715
|
const { relatedInformation } = diagnostic;
|
|
116839
|
-
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;
|
|
116840
116717
|
return result;
|
|
116841
116718
|
});
|
|
116842
|
-
function
|
|
116719
|
+
function toPathInBuildInfoDirectory(path) {
|
|
116843
116720
|
buildInfoDirectory != null ? buildInfoDirectory : buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
|
|
116844
116721
|
return toPath(path, buildInfoDirectory, newProgram.getCanonicalFileName);
|
|
116845
116722
|
}
|
|
@@ -117742,7 +117619,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
117742
117619
|
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
117743
117620
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
117744
117621
|
let state;
|
|
117745
|
-
const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(
|
|
117622
|
+
const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(toPathInBuildInfoDirectory);
|
|
117746
117623
|
let filePathsSetList;
|
|
117747
117624
|
const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0;
|
|
117748
117625
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
@@ -117823,7 +117700,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
117823
117700
|
close: noop,
|
|
117824
117701
|
hasChangedEmitSignature: returnFalse
|
|
117825
117702
|
};
|
|
117826
|
-
function
|
|
117703
|
+
function toPathInBuildInfoDirectory(path) {
|
|
117827
117704
|
return toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
117828
117705
|
}
|
|
117829
117706
|
function toAbsolutePath(path) {
|
|
@@ -118862,15 +118739,13 @@ function getErrorSummaryText(errorCount, filesInError, newLine, host) {
|
|
|
118862
118739
|
const nonNilFiles = filesInError.filter((fileInError) => fileInError !== void 0);
|
|
118863
118740
|
const distinctFileNamesWithLines = nonNilFiles.map((fileInError) => `${fileInError.fileName}:${fileInError.line}`).filter((value, index, self) => self.indexOf(value) === index);
|
|
118864
118741
|
const firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
|
|
118865
|
-
|
|
118866
|
-
|
|
118867
|
-
|
|
118868
|
-
|
|
118869
|
-
|
|
118870
|
-
|
|
118871
|
-
|
|
118872
|
-
distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length
|
|
118873
|
-
);
|
|
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);
|
|
118874
118749
|
const suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "";
|
|
118875
118750
|
return `${newLine}${flattenDiagnosticMessageText(d.messageText, newLine)}${newLine}${newLine}${suffix}`;
|
|
118876
118751
|
}
|
|
@@ -119080,15 +118955,15 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
|
|
|
119080
118955
|
toFileName(referencedResolvedRef.sourceFile.fileName, fileNameConvertor),
|
|
119081
118956
|
options.outFile ? "--outFile" : "--out"
|
|
119082
118957
|
);
|
|
119083
|
-
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];
|
|
119084
118960
|
return chainDiagnosticMessages(
|
|
119085
118961
|
/*details*/
|
|
119086
118962
|
void 0,
|
|
119087
|
-
|
|
119088
|
-
reason.typeReference,
|
|
119089
|
-
reason.packageId && packageIdToString(reason.packageId)
|
|
118963
|
+
...messageAndArgs
|
|
119090
118964
|
);
|
|
119091
|
-
|
|
118965
|
+
}
|
|
118966
|
+
case 6 /* LibFile */: {
|
|
119092
118967
|
if (reason.index !== void 0)
|
|
119093
118968
|
return chainDiagnosticMessages(
|
|
119094
118969
|
/*details*/
|
|
@@ -119097,12 +118972,13 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
|
|
|
119097
118972
|
options.lib[reason.index]
|
|
119098
118973
|
);
|
|
119099
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];
|
|
119100
118976
|
return chainDiagnosticMessages(
|
|
119101
118977
|
/*details*/
|
|
119102
118978
|
void 0,
|
|
119103
|
-
|
|
119104
|
-
target
|
|
118979
|
+
...messageAndArgs
|
|
119105
118980
|
);
|
|
118981
|
+
}
|
|
119106
118982
|
default:
|
|
119107
118983
|
Debug.assertNever(reason);
|
|
119108
118984
|
}
|