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/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230321`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -8389,13 +8389,14 @@ ${lanes.join("\n")}
|
|
|
8389
8389
|
Output_Formatting: diag(6256, 3 /* Message */, "Output_Formatting_6256", "Output Formatting"),
|
|
8390
8390
|
Completeness: diag(6257, 3 /* Message */, "Completeness_6257", "Completeness"),
|
|
8391
8391
|
_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"),
|
|
8392
|
-
|
|
8392
|
+
Found_1_error_in_0: diag(6259, 3 /* Message */, "Found_1_error_in_0_6259", "Found 1 error in {0}"),
|
|
8393
8393
|
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}"),
|
|
8394
8394
|
Found_0_errors_in_1_files: diag(6261, 3 /* Message */, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
8395
8395
|
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."),
|
|
8396
8396
|
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."),
|
|
8397
8397
|
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."),
|
|
8398
8398
|
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."),
|
|
8399
|
+
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."),
|
|
8399
8400
|
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."),
|
|
8400
8401
|
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}'."),
|
|
8401
8402
|
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."),
|
|
@@ -13858,17 +13859,17 @@ ${lanes.join("\n")}
|
|
|
13858
13859
|
return Debug.assertNever(name);
|
|
13859
13860
|
}
|
|
13860
13861
|
}
|
|
13861
|
-
function createDiagnosticForNode(node, message,
|
|
13862
|
+
function createDiagnosticForNode(node, message, ...args) {
|
|
13862
13863
|
const sourceFile = getSourceFileOfNode(node);
|
|
13863
|
-
return createDiagnosticForNodeInSourceFile(sourceFile, node, message,
|
|
13864
|
+
return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args);
|
|
13864
13865
|
}
|
|
13865
|
-
function createDiagnosticForNodeArray(sourceFile, nodes, message,
|
|
13866
|
+
function createDiagnosticForNodeArray(sourceFile, nodes, message, ...args) {
|
|
13866
13867
|
const start = skipTrivia(sourceFile.text, nodes.pos);
|
|
13867
|
-
return createFileDiagnostic(sourceFile, start, nodes.end - start, message,
|
|
13868
|
+
return createFileDiagnostic(sourceFile, start, nodes.end - start, message, ...args);
|
|
13868
13869
|
}
|
|
13869
|
-
function createDiagnosticForNodeInSourceFile(sourceFile, node, message,
|
|
13870
|
+
function createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args) {
|
|
13870
13871
|
const span = getErrorSpanForNode(sourceFile, node);
|
|
13871
|
-
return createFileDiagnostic(sourceFile, span.start, span.length, message,
|
|
13872
|
+
return createFileDiagnostic(sourceFile, span.start, span.length, message, ...args);
|
|
13872
13873
|
}
|
|
13873
13874
|
function createDiagnosticForNodeFromMessageChain(sourceFile, node, messageChain, relatedInformation) {
|
|
13874
13875
|
const span = getErrorSpanForNode(sourceFile, node);
|
|
@@ -15684,6 +15685,12 @@ ${lanes.join("\n")}
|
|
|
15684
15685
|
function isKeyword(token) {
|
|
15685
15686
|
return 82 /* FirstKeyword */ <= token && token <= 163 /* LastKeyword */;
|
|
15686
15687
|
}
|
|
15688
|
+
function isPunctuation(token) {
|
|
15689
|
+
return 18 /* FirstPunctuation */ <= token && token <= 78 /* LastPunctuation */;
|
|
15690
|
+
}
|
|
15691
|
+
function isKeywordOrPunctuation(token) {
|
|
15692
|
+
return isKeyword(token) || isPunctuation(token);
|
|
15693
|
+
}
|
|
15687
15694
|
function isContextualKeyword(token) {
|
|
15688
15695
|
return 127 /* FirstContextualKeyword */ <= token && token <= 163 /* LastContextualKeyword */;
|
|
15689
15696
|
}
|
|
@@ -27997,7 +28004,6 @@ ${lanes.join("\n")}
|
|
|
27997
28004
|
"src/compiler/parser.ts"() {
|
|
27998
28005
|
"use strict";
|
|
27999
28006
|
init_ts2();
|
|
28000
|
-
init_ts2();
|
|
28001
28007
|
init_ts_performance();
|
|
28002
28008
|
parseBaseNodeFactory = {
|
|
28003
28009
|
createBaseSourceFileNode: (kind) => new (SourceFileConstructor || (SourceFileConstructor = objectAllocator.getSourceFileConstructor()))(kind, -1, -1),
|
|
@@ -28533,14 +28539,12 @@ ${lanes.join("\n")}
|
|
|
28533
28539
|
scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
|
|
28534
28540
|
if (scriptKind2 === 6 /* JSON */) {
|
|
28535
28541
|
const result2 = parseJsonText2(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes);
|
|
28536
|
-
|
|
28542
|
+
convertToJson(
|
|
28537
28543
|
result2,
|
|
28538
28544
|
(_a2 = result2.statements[0]) == null ? void 0 : _a2.expression,
|
|
28539
28545
|
result2.parseDiagnostics,
|
|
28540
28546
|
/*returnValue*/
|
|
28541
28547
|
false,
|
|
28542
|
-
/*knownRootOptions*/
|
|
28543
|
-
void 0,
|
|
28544
28548
|
/*jsonConversionNotifier*/
|
|
28545
28549
|
void 0
|
|
28546
28550
|
);
|
|
@@ -28972,24 +28976,24 @@ ${lanes.join("\n")}
|
|
|
28972
28976
|
function inAwaitContext() {
|
|
28973
28977
|
return inContext(32768 /* AwaitContext */);
|
|
28974
28978
|
}
|
|
28975
|
-
function parseErrorAtCurrentToken(message,
|
|
28976
|
-
return parseErrorAt(scanner2.getTokenStart(), scanner2.getTokenEnd(), message,
|
|
28979
|
+
function parseErrorAtCurrentToken(message, ...args) {
|
|
28980
|
+
return parseErrorAt(scanner2.getTokenStart(), scanner2.getTokenEnd(), message, ...args);
|
|
28977
28981
|
}
|
|
28978
|
-
function parseErrorAtPosition(start, length2, message,
|
|
28982
|
+
function parseErrorAtPosition(start, length2, message, ...args) {
|
|
28979
28983
|
const lastError = lastOrUndefined(parseDiagnostics);
|
|
28980
28984
|
let result;
|
|
28981
28985
|
if (!lastError || start !== lastError.start) {
|
|
28982
|
-
result = createDetachedDiagnostic(fileName, start, length2, message,
|
|
28986
|
+
result = createDetachedDiagnostic(fileName, start, length2, message, ...args);
|
|
28983
28987
|
parseDiagnostics.push(result);
|
|
28984
28988
|
}
|
|
28985
28989
|
parseErrorBeforeNextFinishedNode = true;
|
|
28986
28990
|
return result;
|
|
28987
28991
|
}
|
|
28988
|
-
function parseErrorAt(start, end, message,
|
|
28989
|
-
return parseErrorAtPosition(start, end - start, message,
|
|
28992
|
+
function parseErrorAt(start, end, message, ...args) {
|
|
28993
|
+
return parseErrorAtPosition(start, end - start, message, ...args);
|
|
28990
28994
|
}
|
|
28991
|
-
function parseErrorAtRange(range, message,
|
|
28992
|
-
parseErrorAt(range.pos, range.end, message,
|
|
28995
|
+
function parseErrorAtRange(range, message, ...args) {
|
|
28996
|
+
parseErrorAt(range.pos, range.end, message, ...args);
|
|
28993
28997
|
}
|
|
28994
28998
|
function scanError(message, length2) {
|
|
28995
28999
|
parseErrorAtPosition(scanner2.getTokenEnd(), length2, message);
|
|
@@ -29195,6 +29199,7 @@ ${lanes.join("\n")}
|
|
|
29195
29199
|
nextTokenJSDoc();
|
|
29196
29200
|
return true;
|
|
29197
29201
|
}
|
|
29202
|
+
Debug.assert(isKeywordOrPunctuation(kind));
|
|
29198
29203
|
parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(kind));
|
|
29199
29204
|
return false;
|
|
29200
29205
|
}
|
|
@@ -29243,7 +29248,11 @@ ${lanes.join("\n")}
|
|
|
29243
29248
|
);
|
|
29244
29249
|
}
|
|
29245
29250
|
function parseExpectedTokenJSDoc(t) {
|
|
29246
|
-
|
|
29251
|
+
const optional = parseOptionalTokenJSDoc(t);
|
|
29252
|
+
if (optional)
|
|
29253
|
+
return optional;
|
|
29254
|
+
Debug.assert(isKeywordOrPunctuation(t));
|
|
29255
|
+
return createMissingNode(
|
|
29247
29256
|
t,
|
|
29248
29257
|
/*reportAtCurrentPosition*/
|
|
29249
29258
|
false,
|
|
@@ -29297,11 +29306,11 @@ ${lanes.join("\n")}
|
|
|
29297
29306
|
}
|
|
29298
29307
|
return node;
|
|
29299
29308
|
}
|
|
29300
|
-
function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage,
|
|
29309
|
+
function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, ...args) {
|
|
29301
29310
|
if (reportAtCurrentPosition) {
|
|
29302
|
-
parseErrorAtPosition(scanner2.getTokenFullStart(), 0, diagnosticMessage,
|
|
29311
|
+
parseErrorAtPosition(scanner2.getTokenFullStart(), 0, diagnosticMessage, ...args);
|
|
29303
29312
|
} else if (diagnosticMessage) {
|
|
29304
|
-
parseErrorAtCurrentToken(diagnosticMessage,
|
|
29313
|
+
parseErrorAtCurrentToken(diagnosticMessage, ...args);
|
|
29305
29314
|
}
|
|
29306
29315
|
const pos = getNodePos();
|
|
29307
29316
|
const result = kind === 79 /* Identifier */ ? factoryCreateIdentifier(
|
|
@@ -31660,6 +31669,7 @@ ${lanes.join("\n")}
|
|
|
31660
31669
|
if (simpleUnaryExpression.kind === 214 /* TypeAssertionExpression */) {
|
|
31661
31670
|
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);
|
|
31662
31671
|
} else {
|
|
31672
|
+
Debug.assert(isKeywordOrPunctuation(unaryOperator));
|
|
31663
31673
|
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));
|
|
31664
31674
|
}
|
|
31665
31675
|
}
|
|
@@ -34607,14 +34617,14 @@ ${lanes.join("\n")}
|
|
|
34607
34617
|
}
|
|
34608
34618
|
function parseReturnTag(start2, tagName, indent3, indentText) {
|
|
34609
34619
|
if (some(tags, isJSDocReturnTag)) {
|
|
34610
|
-
parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
|
|
34620
|
+
parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText));
|
|
34611
34621
|
}
|
|
34612
34622
|
const typeExpression = tryParseTypeExpression();
|
|
34613
34623
|
return finishNode(factory2.createJSDocReturnTag(tagName, typeExpression, parseTrailingTagComments(start2, getNodePos(), indent3, indentText)), start2);
|
|
34614
34624
|
}
|
|
34615
34625
|
function parseTypeTag(start2, tagName, indent3, indentText) {
|
|
34616
34626
|
if (some(tags, isJSDocTypeTag)) {
|
|
34617
|
-
parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
|
|
34627
|
+
parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText));
|
|
34618
34628
|
}
|
|
34619
34629
|
const typeExpression = parseJSDocTypeExpression(
|
|
34620
34630
|
/*mayOmitBraces*/
|
|
@@ -35427,13 +35437,13 @@ ${lanes.join("\n")}
|
|
|
35427
35437
|
function getOptionName(option) {
|
|
35428
35438
|
return option.name;
|
|
35429
35439
|
}
|
|
35430
|
-
function createUnknownOptionError(unknownOption, diagnostics,
|
|
35440
|
+
function createUnknownOptionError(unknownOption, diagnostics, unknownOptionErrorText, node, sourceFile) {
|
|
35431
35441
|
var _a2;
|
|
35432
35442
|
if ((_a2 = diagnostics.alternateMode) == null ? void 0 : _a2.getOptionsNameMap().optionsNameMap.has(unknownOption.toLowerCase())) {
|
|
35433
|
-
return
|
|
35443
|
+
return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.alternateMode.diagnostic, unknownOption);
|
|
35434
35444
|
}
|
|
35435
35445
|
const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
|
|
35436
|
-
return possibleOption ?
|
|
35446
|
+
return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
|
|
35437
35447
|
}
|
|
35438
35448
|
function parseCommandLineWorker(diagnostics, commandLine, readFile) {
|
|
35439
35449
|
const options = {};
|
|
@@ -35474,7 +35484,7 @@ ${lanes.join("\n")}
|
|
|
35474
35484
|
if (watchOpt) {
|
|
35475
35485
|
i = parseOptionValue(args, i, watchOptionsDidYouMeanDiagnostics, watchOpt, watchOptions || (watchOptions = {}), errors);
|
|
35476
35486
|
} else {
|
|
35477
|
-
errors.push(createUnknownOptionError(inputOptionName, diagnostics,
|
|
35487
|
+
errors.push(createUnknownOptionError(inputOptionName, diagnostics, s));
|
|
35478
35488
|
}
|
|
35479
35489
|
}
|
|
35480
35490
|
} else {
|
|
@@ -35664,9 +35674,7 @@ ${lanes.join("\n")}
|
|
|
35664
35674
|
config: convertConfigFileToObject(
|
|
35665
35675
|
jsonSourceFile,
|
|
35666
35676
|
jsonSourceFile.parseDiagnostics,
|
|
35667
|
-
/*
|
|
35668
|
-
false,
|
|
35669
|
-
/*optionsIterator*/
|
|
35677
|
+
/*jsonConversionNotifier*/
|
|
35670
35678
|
void 0
|
|
35671
35679
|
),
|
|
35672
35680
|
error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0
|
|
@@ -35707,24 +35715,9 @@ ${lanes.join("\n")}
|
|
|
35707
35715
|
// should never be needed since this is root
|
|
35708
35716
|
type: "object",
|
|
35709
35717
|
elementOptions: commandLineOptionsToMap([
|
|
35710
|
-
|
|
35711
|
-
|
|
35712
|
-
|
|
35713
|
-
elementOptions: getCommandLineCompilerOptionsMap(),
|
|
35714
|
-
extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics
|
|
35715
|
-
},
|
|
35716
|
-
{
|
|
35717
|
-
name: "watchOptions",
|
|
35718
|
-
type: "object",
|
|
35719
|
-
elementOptions: getCommandLineWatchOptionsMap(),
|
|
35720
|
-
extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics
|
|
35721
|
-
},
|
|
35722
|
-
{
|
|
35723
|
-
name: "typeAcquisition",
|
|
35724
|
-
type: "object",
|
|
35725
|
-
elementOptions: getCommandLineTypeAcquisitionMap(),
|
|
35726
|
-
extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics
|
|
35727
|
-
},
|
|
35718
|
+
compilerOptionsDeclaration,
|
|
35719
|
+
watchOptionsDeclaration,
|
|
35720
|
+
typeAcquisitionDeclaration,
|
|
35728
35721
|
extendsOptionDeclaration,
|
|
35729
35722
|
{
|
|
35730
35723
|
name: "references",
|
|
@@ -35770,10 +35763,9 @@ ${lanes.join("\n")}
|
|
|
35770
35763
|
}
|
|
35771
35764
|
return _tsconfigRootOptions;
|
|
35772
35765
|
}
|
|
35773
|
-
function convertConfigFileToObject(sourceFile, errors,
|
|
35766
|
+
function convertConfigFileToObject(sourceFile, errors, jsonConversionNotifier) {
|
|
35774
35767
|
var _a2;
|
|
35775
35768
|
const rootExpression = (_a2 = sourceFile.statements[0]) == null ? void 0 : _a2.expression;
|
|
35776
|
-
const knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : void 0;
|
|
35777
35769
|
if (rootExpression && rootExpression.kind !== 208 /* ObjectLiteralExpression */) {
|
|
35778
35770
|
errors.push(createDiagnosticForNodeInSourceFile(
|
|
35779
35771
|
sourceFile,
|
|
@@ -35784,52 +35776,46 @@ ${lanes.join("\n")}
|
|
|
35784
35776
|
if (isArrayLiteralExpression(rootExpression)) {
|
|
35785
35777
|
const firstObject = find(rootExpression.elements, isObjectLiteralExpression);
|
|
35786
35778
|
if (firstObject) {
|
|
35787
|
-
return
|
|
35779
|
+
return convertToJson(
|
|
35788
35780
|
sourceFile,
|
|
35789
35781
|
firstObject,
|
|
35790
35782
|
errors,
|
|
35791
35783
|
/*returnValue*/
|
|
35792
35784
|
true,
|
|
35793
|
-
|
|
35794
|
-
optionsIterator
|
|
35785
|
+
jsonConversionNotifier
|
|
35795
35786
|
);
|
|
35796
35787
|
}
|
|
35797
35788
|
}
|
|
35798
35789
|
return {};
|
|
35799
35790
|
}
|
|
35800
|
-
return
|
|
35791
|
+
return convertToJson(
|
|
35801
35792
|
sourceFile,
|
|
35802
35793
|
rootExpression,
|
|
35803
35794
|
errors,
|
|
35804
35795
|
/*returnValue*/
|
|
35805
35796
|
true,
|
|
35806
|
-
|
|
35807
|
-
optionsIterator
|
|
35797
|
+
jsonConversionNotifier
|
|
35808
35798
|
);
|
|
35809
35799
|
}
|
|
35810
35800
|
function convertToObject(sourceFile, errors) {
|
|
35811
35801
|
var _a2;
|
|
35812
|
-
return
|
|
35802
|
+
return convertToJson(
|
|
35813
35803
|
sourceFile,
|
|
35814
35804
|
(_a2 = sourceFile.statements[0]) == null ? void 0 : _a2.expression,
|
|
35815
35805
|
errors,
|
|
35816
35806
|
/*returnValue*/
|
|
35817
35807
|
true,
|
|
35818
|
-
/*knownRootOptions*/
|
|
35819
|
-
void 0,
|
|
35820
35808
|
/*jsonConversionNotifier*/
|
|
35821
35809
|
void 0
|
|
35822
35810
|
);
|
|
35823
35811
|
}
|
|
35824
|
-
function
|
|
35812
|
+
function convertToJson(sourceFile, rootExpression, errors, returnValue, jsonConversionNotifier) {
|
|
35825
35813
|
if (!rootExpression) {
|
|
35826
35814
|
return returnValue ? {} : void 0;
|
|
35827
35815
|
}
|
|
35828
|
-
return convertPropertyValueToJson(rootExpression,
|
|
35829
|
-
function
|
|
35830
|
-
|
|
35831
|
-
}
|
|
35832
|
-
function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) {
|
|
35816
|
+
return convertPropertyValueToJson(rootExpression, jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.rootOptions);
|
|
35817
|
+
function convertObjectLiteralExpressionToJson(node, objectOption) {
|
|
35818
|
+
var _a2;
|
|
35833
35819
|
const result = returnValue ? {} : void 0;
|
|
35834
35820
|
for (const element of node.properties) {
|
|
35835
35821
|
if (element.kind !== 300 /* PropertyAssignment */) {
|
|
@@ -35844,38 +35830,13 @@ ${lanes.join("\n")}
|
|
|
35844
35830
|
}
|
|
35845
35831
|
const textOfKey = isComputedNonLiteralName(element.name) ? void 0 : getTextOfPropertyName(element.name);
|
|
35846
35832
|
const keyText = textOfKey && unescapeLeadingUnderscores(textOfKey);
|
|
35847
|
-
const option = keyText
|
|
35848
|
-
if (keyText && extraKeyDiagnostics && !option) {
|
|
35849
|
-
if (knownOptions) {
|
|
35850
|
-
errors.push(createUnknownOptionError(
|
|
35851
|
-
keyText,
|
|
35852
|
-
extraKeyDiagnostics,
|
|
35853
|
-
(message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, element.name, message, arg0, arg1)
|
|
35854
|
-
));
|
|
35855
|
-
} else {
|
|
35856
|
-
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
|
|
35857
|
-
}
|
|
35858
|
-
}
|
|
35833
|
+
const option = keyText ? (_a2 = objectOption == null ? void 0 : objectOption.elementOptions) == null ? void 0 : _a2.get(keyText) : void 0;
|
|
35859
35834
|
const value = convertPropertyValueToJson(element.initializer, option);
|
|
35860
35835
|
if (typeof keyText !== "undefined") {
|
|
35861
35836
|
if (returnValue) {
|
|
35862
35837
|
result[keyText] = value;
|
|
35863
35838
|
}
|
|
35864
|
-
|
|
35865
|
-
(parentOption || isRootOptionMap(knownOptions))) {
|
|
35866
|
-
const isValidOptionValue = isCompilerOptionsValue(option, value);
|
|
35867
|
-
if (parentOption) {
|
|
35868
|
-
if (isValidOptionValue) {
|
|
35869
|
-
jsonConversionNotifier.onSetValidOptionKeyValueInParent(parentOption, option, value);
|
|
35870
|
-
}
|
|
35871
|
-
} else if (isRootOptionMap(knownOptions)) {
|
|
35872
|
-
if (isValidOptionValue) {
|
|
35873
|
-
jsonConversionNotifier.onSetValidOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
|
|
35874
|
-
} else if (!option) {
|
|
35875
|
-
jsonConversionNotifier.onSetUnknownOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
|
|
35876
|
-
}
|
|
35877
|
-
}
|
|
35878
|
-
}
|
|
35839
|
+
jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.onPropertySet(keyText, value, element, objectOption, option);
|
|
35879
35840
|
}
|
|
35880
35841
|
}
|
|
35881
35842
|
return result;
|
|
@@ -35888,112 +35849,40 @@ ${lanes.join("\n")}
|
|
|
35888
35849
|
return filter(elements.map((element) => convertPropertyValueToJson(element, elementOption)), (v) => v !== void 0);
|
|
35889
35850
|
}
|
|
35890
35851
|
function convertPropertyValueToJson(valueExpression, option) {
|
|
35891
|
-
let invalidReported;
|
|
35892
35852
|
switch (valueExpression.kind) {
|
|
35893
35853
|
case 111 /* TrueKeyword */:
|
|
35894
|
-
|
|
35895
|
-
return validateValue(
|
|
35896
|
-
/*value*/
|
|
35897
|
-
true
|
|
35898
|
-
);
|
|
35854
|
+
return true;
|
|
35899
35855
|
case 96 /* FalseKeyword */:
|
|
35900
|
-
|
|
35901
|
-
return validateValue(
|
|
35902
|
-
/*value*/
|
|
35903
|
-
false
|
|
35904
|
-
);
|
|
35856
|
+
return false;
|
|
35905
35857
|
case 105 /* NullKeyword */:
|
|
35906
|
-
|
|
35907
|
-
return validateValue(
|
|
35908
|
-
/*value*/
|
|
35909
|
-
null
|
|
35910
|
-
);
|
|
35858
|
+
return null;
|
|
35911
35859
|
case 10 /* StringLiteral */:
|
|
35912
35860
|
if (!isDoubleQuotedString(valueExpression)) {
|
|
35913
35861
|
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.String_literal_with_double_quotes_expected));
|
|
35914
35862
|
}
|
|
35915
|
-
|
|
35916
|
-
const text = valueExpression.text;
|
|
35917
|
-
if (option) {
|
|
35918
|
-
Debug.assert(option.type !== "listOrElement" || option.element.type === "string", "Only string or array of string is handled for now");
|
|
35919
|
-
}
|
|
35920
|
-
if (option && !isString(option.type)) {
|
|
35921
|
-
const customOption = option;
|
|
35922
|
-
if (!customOption.type.has(text.toLowerCase())) {
|
|
35923
|
-
errors.push(
|
|
35924
|
-
createDiagnosticForInvalidCustomType(
|
|
35925
|
-
customOption,
|
|
35926
|
-
(message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, message, arg0, arg1)
|
|
35927
|
-
)
|
|
35928
|
-
);
|
|
35929
|
-
invalidReported = true;
|
|
35930
|
-
}
|
|
35931
|
-
}
|
|
35932
|
-
return validateValue(text);
|
|
35863
|
+
return valueExpression.text;
|
|
35933
35864
|
case 8 /* NumericLiteral */:
|
|
35934
|
-
|
|
35935
|
-
return validateValue(Number(valueExpression.text));
|
|
35865
|
+
return Number(valueExpression.text);
|
|
35936
35866
|
case 222 /* PrefixUnaryExpression */:
|
|
35937
35867
|
if (valueExpression.operator !== 40 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) {
|
|
35938
35868
|
break;
|
|
35939
35869
|
}
|
|
35940
|
-
|
|
35941
|
-
return validateValue(-Number(valueExpression.operand.text));
|
|
35870
|
+
return -Number(valueExpression.operand.text);
|
|
35942
35871
|
case 208 /* ObjectLiteralExpression */:
|
|
35943
|
-
reportInvalidOptionValue(option && option.type !== "object" && (option.type !== "listOrElement" || option.element.type !== "object"));
|
|
35944
35872
|
const objectLiteralExpression = valueExpression;
|
|
35945
|
-
|
|
35946
|
-
const { elementOptions, extraKeyDiagnostics, name: optionName } = option;
|
|
35947
|
-
return validateValue(convertObjectLiteralExpressionToJson(
|
|
35948
|
-
objectLiteralExpression,
|
|
35949
|
-
elementOptions,
|
|
35950
|
-
extraKeyDiagnostics,
|
|
35951
|
-
optionName
|
|
35952
|
-
));
|
|
35953
|
-
} else {
|
|
35954
|
-
return validateValue(convertObjectLiteralExpressionToJson(
|
|
35955
|
-
objectLiteralExpression,
|
|
35956
|
-
/* knownOptions*/
|
|
35957
|
-
void 0,
|
|
35958
|
-
/*extraKeyDiagnosticMessage */
|
|
35959
|
-
void 0,
|
|
35960
|
-
/*parentOption*/
|
|
35961
|
-
void 0
|
|
35962
|
-
));
|
|
35963
|
-
}
|
|
35873
|
+
return convertObjectLiteralExpressionToJson(objectLiteralExpression, option);
|
|
35964
35874
|
case 207 /* ArrayLiteralExpression */:
|
|
35965
|
-
|
|
35966
|
-
return validateValue(convertArrayLiteralExpressionToJson(
|
|
35875
|
+
return convertArrayLiteralExpressionToJson(
|
|
35967
35876
|
valueExpression.elements,
|
|
35968
35877
|
option && option.element
|
|
35969
|
-
)
|
|
35878
|
+
);
|
|
35970
35879
|
}
|
|
35971
35880
|
if (option) {
|
|
35972
|
-
|
|
35973
|
-
/*isError*/
|
|
35974
|
-
true
|
|
35975
|
-
);
|
|
35881
|
+
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option)));
|
|
35976
35882
|
} else {
|
|
35977
35883
|
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal));
|
|
35978
35884
|
}
|
|
35979
35885
|
return void 0;
|
|
35980
|
-
function validateValue(value) {
|
|
35981
|
-
var _a2;
|
|
35982
|
-
if (!invalidReported) {
|
|
35983
|
-
const diagnostic = (_a2 = option == null ? void 0 : option.extraValidation) == null ? void 0 : _a2.call(option, value);
|
|
35984
|
-
if (diagnostic) {
|
|
35985
|
-
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ...diagnostic));
|
|
35986
|
-
return void 0;
|
|
35987
|
-
}
|
|
35988
|
-
}
|
|
35989
|
-
return value;
|
|
35990
|
-
}
|
|
35991
|
-
function reportInvalidOptionValue(isError) {
|
|
35992
|
-
if (isError) {
|
|
35993
|
-
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option)));
|
|
35994
|
-
invalidReported = true;
|
|
35995
|
-
}
|
|
35996
|
-
}
|
|
35997
35886
|
}
|
|
35998
35887
|
function isDoubleQuotedString(node) {
|
|
35999
35888
|
return isStringLiteral(node) && isStringDoubleQuoted(node, sourceFile);
|
|
@@ -36005,7 +35894,7 @@ ${lanes.join("\n")}
|
|
|
36005
35894
|
function isCompilerOptionsValue(option, value) {
|
|
36006
35895
|
if (option) {
|
|
36007
35896
|
if (isNullOrUndefined(value))
|
|
36008
|
-
return
|
|
35897
|
+
return !option.disallowNullOrUndefined;
|
|
36009
35898
|
if (option.type === "list") {
|
|
36010
35899
|
return isArray(value);
|
|
36011
35900
|
}
|
|
@@ -36365,7 +36254,7 @@ ${lanes.join("\n")}
|
|
|
36365
36254
|
const fileName = configFileName || "tsconfig.json";
|
|
36366
36255
|
const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
|
|
36367
36256
|
const nodeValue = firstDefined(getTsConfigPropArray(sourceFile, "files"), (property) => property.initializer);
|
|
36368
|
-
const error =
|
|
36257
|
+
const error = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
|
|
36369
36258
|
errors.push(error);
|
|
36370
36259
|
} else {
|
|
36371
36260
|
createCompilerDiagnosticOnlyIfJson(Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json");
|
|
@@ -36467,9 +36356,9 @@ ${lanes.join("\n")}
|
|
|
36467
36356
|
}
|
|
36468
36357
|
return "no-prop";
|
|
36469
36358
|
}
|
|
36470
|
-
function createCompilerDiagnosticOnlyIfJson(message,
|
|
36359
|
+
function createCompilerDiagnosticOnlyIfJson(message, ...args) {
|
|
36471
36360
|
if (!sourceFile) {
|
|
36472
|
-
errors.push(createCompilerDiagnostic(message,
|
|
36361
|
+
errors.push(createCompilerDiagnostic(message, ...args));
|
|
36473
36362
|
}
|
|
36474
36363
|
}
|
|
36475
36364
|
}
|
|
@@ -36568,27 +36457,42 @@ ${lanes.join("\n")}
|
|
|
36568
36457
|
const typeAcquisition = convertTypeAcquisitionFromJsonWorker(json.typeAcquisition, basePath, errors, configFileName);
|
|
36569
36458
|
const watchOptions = convertWatchOptionsFromJsonWorker(json.watchOptions, basePath, errors);
|
|
36570
36459
|
json.compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);
|
|
36460
|
+
const extendedConfigPath = json.extends || json.extends === "" ? getExtendsConfigPathOrArray(json.extends, host, basePath, configFileName, errors) : void 0;
|
|
36461
|
+
return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath };
|
|
36462
|
+
}
|
|
36463
|
+
function getExtendsConfigPathOrArray(value, host, basePath, configFileName, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
36571
36464
|
let extendedConfigPath;
|
|
36572
|
-
|
|
36573
|
-
|
|
36574
|
-
|
|
36575
|
-
|
|
36576
|
-
|
|
36577
|
-
|
|
36578
|
-
|
|
36465
|
+
const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
|
|
36466
|
+
if (isString(value)) {
|
|
36467
|
+
extendedConfigPath = getExtendsConfigPath(
|
|
36468
|
+
value,
|
|
36469
|
+
host,
|
|
36470
|
+
newBase,
|
|
36471
|
+
errors,
|
|
36472
|
+
valueExpression,
|
|
36473
|
+
sourceFile
|
|
36474
|
+
);
|
|
36475
|
+
} else if (isArray(value)) {
|
|
36476
|
+
extendedConfigPath = [];
|
|
36477
|
+
for (let index = 0; index < value.length; index++) {
|
|
36478
|
+
const fileName = value[index];
|
|
36479
|
+
if (isString(fileName)) {
|
|
36480
|
+
extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(
|
|
36481
|
+
fileName,
|
|
36482
|
+
host,
|
|
36483
|
+
newBase,
|
|
36484
|
+
errors,
|
|
36485
|
+
valueExpression == null ? void 0 : valueExpression.elements[index],
|
|
36486
|
+
sourceFile
|
|
36487
|
+
));
|
|
36579
36488
|
} else {
|
|
36580
|
-
|
|
36581
|
-
for (const fileName of json.extends) {
|
|
36582
|
-
if (isString(fileName)) {
|
|
36583
|
-
extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(fileName, host, newBase, errors, createCompilerDiagnostic));
|
|
36584
|
-
} else {
|
|
36585
|
-
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", getCompilerOptionValueTypeString(extendsOptionDeclaration.element)));
|
|
36586
|
-
}
|
|
36587
|
-
}
|
|
36489
|
+
convertJsonOption(extendsOptionDeclaration.element, value, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile);
|
|
36588
36490
|
}
|
|
36589
36491
|
}
|
|
36492
|
+
} else {
|
|
36493
|
+
convertJsonOption(extendsOptionDeclaration, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
|
|
36590
36494
|
}
|
|
36591
|
-
return
|
|
36495
|
+
return extendedConfigPath;
|
|
36592
36496
|
}
|
|
36593
36497
|
function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors) {
|
|
36594
36498
|
const options = getDefaultCompilerOptions(configFileName);
|
|
@@ -36596,69 +36500,11 @@ ${lanes.join("\n")}
|
|
|
36596
36500
|
let watchOptions;
|
|
36597
36501
|
let extendedConfigPath;
|
|
36598
36502
|
let rootCompilerOptions;
|
|
36599
|
-
const
|
|
36600
|
-
onSetValidOptionKeyValueInParent(parentOption, option, value) {
|
|
36601
|
-
let currentOption;
|
|
36602
|
-
switch (parentOption) {
|
|
36603
|
-
case "compilerOptions":
|
|
36604
|
-
currentOption = options;
|
|
36605
|
-
break;
|
|
36606
|
-
case "watchOptions":
|
|
36607
|
-
currentOption = watchOptions || (watchOptions = {});
|
|
36608
|
-
break;
|
|
36609
|
-
case "typeAcquisition":
|
|
36610
|
-
currentOption = typeAcquisition || (typeAcquisition = getDefaultTypeAcquisition(configFileName));
|
|
36611
|
-
break;
|
|
36612
|
-
default:
|
|
36613
|
-
Debug.fail("Unknown option");
|
|
36614
|
-
}
|
|
36615
|
-
currentOption[option.name] = normalizeOptionValue(option, basePath, value);
|
|
36616
|
-
},
|
|
36617
|
-
onSetValidOptionKeyValueInRoot(key, _keyNode, value, valueNode) {
|
|
36618
|
-
switch (key) {
|
|
36619
|
-
case "extends":
|
|
36620
|
-
const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
|
|
36621
|
-
if (isString(value)) {
|
|
36622
|
-
extendedConfigPath = getExtendsConfigPath(
|
|
36623
|
-
value,
|
|
36624
|
-
host,
|
|
36625
|
-
newBase,
|
|
36626
|
-
errors,
|
|
36627
|
-
(message, arg0) => createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0)
|
|
36628
|
-
);
|
|
36629
|
-
} else {
|
|
36630
|
-
extendedConfigPath = [];
|
|
36631
|
-
for (let index = 0; index < value.length; index++) {
|
|
36632
|
-
const fileName = value[index];
|
|
36633
|
-
if (isString(fileName)) {
|
|
36634
|
-
extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(
|
|
36635
|
-
fileName,
|
|
36636
|
-
host,
|
|
36637
|
-
newBase,
|
|
36638
|
-
errors,
|
|
36639
|
-
(message, arg0) => createDiagnosticForNodeInSourceFile(sourceFile, valueNode.elements[index], message, arg0)
|
|
36640
|
-
));
|
|
36641
|
-
}
|
|
36642
|
-
}
|
|
36643
|
-
}
|
|
36644
|
-
return;
|
|
36645
|
-
}
|
|
36646
|
-
},
|
|
36647
|
-
onSetUnknownOptionKeyValueInRoot(key, keyNode, _value, _valueNode) {
|
|
36648
|
-
if (key === "excludes") {
|
|
36649
|
-
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, keyNode, Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
|
|
36650
|
-
}
|
|
36651
|
-
if (find(commandOptionsWithoutBuild, (opt) => opt.name === key)) {
|
|
36652
|
-
rootCompilerOptions = append(rootCompilerOptions, keyNode);
|
|
36653
|
-
}
|
|
36654
|
-
}
|
|
36655
|
-
};
|
|
36503
|
+
const rootOptions = getTsconfigRootOptionsMap();
|
|
36656
36504
|
const json = convertConfigFileToObject(
|
|
36657
36505
|
sourceFile,
|
|
36658
36506
|
errors,
|
|
36659
|
-
|
|
36660
|
-
true,
|
|
36661
|
-
optionsIterator
|
|
36507
|
+
{ rootOptions, onPropertySet }
|
|
36662
36508
|
);
|
|
36663
36509
|
if (!typeAcquisition) {
|
|
36664
36510
|
typeAcquisition = getDefaultTypeAcquisition(configFileName);
|
|
@@ -36667,15 +36513,57 @@ ${lanes.join("\n")}
|
|
|
36667
36513
|
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, rootCompilerOptions[0], Diagnostics._0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file, getTextOfPropertyName(rootCompilerOptions[0])));
|
|
36668
36514
|
}
|
|
36669
36515
|
return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath };
|
|
36516
|
+
function onPropertySet(keyText, value, propertyAssignment, parentOption, option) {
|
|
36517
|
+
if (option && option !== extendsOptionDeclaration)
|
|
36518
|
+
value = convertJsonOption(option, value, basePath, errors, propertyAssignment, propertyAssignment.initializer, sourceFile);
|
|
36519
|
+
if (parentOption == null ? void 0 : parentOption.name) {
|
|
36520
|
+
if (option) {
|
|
36521
|
+
let currentOption;
|
|
36522
|
+
if (parentOption === compilerOptionsDeclaration)
|
|
36523
|
+
currentOption = options;
|
|
36524
|
+
else if (parentOption === watchOptionsDeclaration)
|
|
36525
|
+
currentOption = watchOptions != null ? watchOptions : watchOptions = {};
|
|
36526
|
+
else if (parentOption === typeAcquisitionDeclaration)
|
|
36527
|
+
currentOption = typeAcquisition != null ? typeAcquisition : typeAcquisition = getDefaultTypeAcquisition(configFileName);
|
|
36528
|
+
else
|
|
36529
|
+
Debug.fail("Unknown option");
|
|
36530
|
+
currentOption[option.name] = value;
|
|
36531
|
+
} else if (keyText && (parentOption == null ? void 0 : parentOption.extraKeyDiagnostics)) {
|
|
36532
|
+
if (parentOption.elementOptions) {
|
|
36533
|
+
errors.push(createUnknownOptionError(
|
|
36534
|
+
keyText,
|
|
36535
|
+
parentOption.extraKeyDiagnostics,
|
|
36536
|
+
/*unknownOptionErrorText*/
|
|
36537
|
+
void 0,
|
|
36538
|
+
propertyAssignment.name,
|
|
36539
|
+
sourceFile
|
|
36540
|
+
));
|
|
36541
|
+
} else {
|
|
36542
|
+
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, propertyAssignment.name, parentOption.extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
|
|
36543
|
+
}
|
|
36544
|
+
}
|
|
36545
|
+
} else if (parentOption === rootOptions) {
|
|
36546
|
+
if (option === extendsOptionDeclaration) {
|
|
36547
|
+
extendedConfigPath = getExtendsConfigPathOrArray(value, host, basePath, configFileName, errors, propertyAssignment, propertyAssignment.initializer, sourceFile);
|
|
36548
|
+
} else if (!option) {
|
|
36549
|
+
if (keyText === "excludes") {
|
|
36550
|
+
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, propertyAssignment.name, Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
|
|
36551
|
+
}
|
|
36552
|
+
if (find(commandOptionsWithoutBuild, (opt) => opt.name === keyText)) {
|
|
36553
|
+
rootCompilerOptions = append(rootCompilerOptions, propertyAssignment.name);
|
|
36554
|
+
}
|
|
36555
|
+
}
|
|
36556
|
+
}
|
|
36557
|
+
}
|
|
36670
36558
|
}
|
|
36671
|
-
function getExtendsConfigPath(extendedConfig, host, basePath, errors,
|
|
36559
|
+
function getExtendsConfigPath(extendedConfig, host, basePath, errors, valueExpression, sourceFile) {
|
|
36672
36560
|
extendedConfig = normalizeSlashes(extendedConfig);
|
|
36673
36561
|
if (isRootedDiskPath(extendedConfig) || startsWith(extendedConfig, "./") || startsWith(extendedConfig, "../")) {
|
|
36674
36562
|
let extendedConfigPath = getNormalizedAbsolutePath(extendedConfig, basePath);
|
|
36675
36563
|
if (!host.fileExists(extendedConfigPath) && !endsWith(extendedConfigPath, ".json" /* Json */)) {
|
|
36676
36564
|
extendedConfigPath = `${extendedConfigPath}.json`;
|
|
36677
36565
|
if (!host.fileExists(extendedConfigPath)) {
|
|
36678
|
-
errors.push(
|
|
36566
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.File_0_not_found, extendedConfig));
|
|
36679
36567
|
return void 0;
|
|
36680
36568
|
}
|
|
36681
36569
|
}
|
|
@@ -36686,9 +36574,9 @@ ${lanes.join("\n")}
|
|
|
36686
36574
|
return resolved.resolvedModule.resolvedFileName;
|
|
36687
36575
|
}
|
|
36688
36576
|
if (extendedConfig === "") {
|
|
36689
|
-
errors.push(
|
|
36577
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Compiler_option_0_cannot_be_given_an_empty_string, "extends"));
|
|
36690
36578
|
} else {
|
|
36691
|
-
errors.push(
|
|
36579
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.File_0_not_found, extendedConfig));
|
|
36692
36580
|
}
|
|
36693
36581
|
return void 0;
|
|
36694
36582
|
}
|
|
@@ -36790,42 +36678,33 @@ ${lanes.join("\n")}
|
|
|
36790
36678
|
if (opt) {
|
|
36791
36679
|
(defaultOptions || (defaultOptions = {}))[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors);
|
|
36792
36680
|
} else {
|
|
36793
|
-
errors.push(createUnknownOptionError(id, diagnostics
|
|
36681
|
+
errors.push(createUnknownOptionError(id, diagnostics));
|
|
36794
36682
|
}
|
|
36795
36683
|
}
|
|
36796
36684
|
return defaultOptions;
|
|
36797
36685
|
}
|
|
36798
|
-
function
|
|
36686
|
+
function createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, message, ...args) {
|
|
36687
|
+
return sourceFile && node ? createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args) : createCompilerDiagnostic(message, ...args);
|
|
36688
|
+
}
|
|
36689
|
+
function convertJsonOption(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
36690
|
+
if (opt.isCommandLineOnly) {
|
|
36691
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, propertyAssignment == null ? void 0 : propertyAssignment.name, Diagnostics.Option_0_can_only_be_specified_on_command_line, opt.name));
|
|
36692
|
+
return void 0;
|
|
36693
|
+
}
|
|
36799
36694
|
if (isCompilerOptionsValue(opt, value)) {
|
|
36800
36695
|
const optType = opt.type;
|
|
36801
36696
|
if (optType === "list" && isArray(value)) {
|
|
36802
|
-
return convertJsonOptionOfListType(opt, value, basePath, errors);
|
|
36697
|
+
return convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
|
|
36803
36698
|
} else if (optType === "listOrElement") {
|
|
36804
|
-
return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors) : convertJsonOption(opt.element, value, basePath, errors);
|
|
36699
|
+
return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile) : convertJsonOption(opt.element, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
|
|
36805
36700
|
} else if (!isString(opt.type)) {
|
|
36806
|
-
return convertJsonOptionOfCustomType(opt, value, errors);
|
|
36701
|
+
return convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile);
|
|
36807
36702
|
}
|
|
36808
|
-
const validatedValue = validateJsonOptionValue(opt, value, errors);
|
|
36703
|
+
const validatedValue = validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile);
|
|
36809
36704
|
return isNullOrUndefined(validatedValue) ? validatedValue : normalizeNonListOptionValue(opt, basePath, validatedValue);
|
|
36810
36705
|
} else {
|
|
36811
|
-
errors.push(
|
|
36812
|
-
}
|
|
36813
|
-
}
|
|
36814
|
-
function normalizeOptionValue(option, basePath, value) {
|
|
36815
|
-
if (isNullOrUndefined(value))
|
|
36816
|
-
return void 0;
|
|
36817
|
-
if (option.type === "listOrElement" && !isArray(value))
|
|
36818
|
-
return normalizeOptionValue(option.element, basePath, value);
|
|
36819
|
-
else if (option.type === "list" || option.type === "listOrElement") {
|
|
36820
|
-
const listOption = option;
|
|
36821
|
-
if (listOption.element.isFilePath || !isString(listOption.element.type)) {
|
|
36822
|
-
return filter(map(value, (v) => normalizeOptionValue(listOption.element, basePath, v)), (v) => listOption.listPreserveFalsyValues ? true : !!v);
|
|
36823
|
-
}
|
|
36824
|
-
return value;
|
|
36825
|
-
} else if (!isString(option.type)) {
|
|
36826
|
-
return option.type.get(isString(value) ? value.toLowerCase() : value);
|
|
36706
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt)));
|
|
36827
36707
|
}
|
|
36828
|
-
return normalizeNonListOptionValue(option, basePath, value);
|
|
36829
36708
|
}
|
|
36830
36709
|
function normalizeNonListOptionValue(option, basePath, value) {
|
|
36831
36710
|
if (option.isFilePath) {
|
|
@@ -36836,29 +36715,29 @@ ${lanes.join("\n")}
|
|
|
36836
36715
|
}
|
|
36837
36716
|
return value;
|
|
36838
36717
|
}
|
|
36839
|
-
function validateJsonOptionValue(opt, value, errors) {
|
|
36718
|
+
function validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile) {
|
|
36840
36719
|
var _a2;
|
|
36841
36720
|
if (isNullOrUndefined(value))
|
|
36842
36721
|
return void 0;
|
|
36843
36722
|
const d = (_a2 = opt.extraValidation) == null ? void 0 : _a2.call(opt, value);
|
|
36844
36723
|
if (!d)
|
|
36845
36724
|
return value;
|
|
36846
|
-
errors.push(
|
|
36725
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, ...d));
|
|
36847
36726
|
return void 0;
|
|
36848
36727
|
}
|
|
36849
|
-
function convertJsonOptionOfCustomType(opt, value, errors) {
|
|
36728
|
+
function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile) {
|
|
36850
36729
|
if (isNullOrUndefined(value))
|
|
36851
36730
|
return void 0;
|
|
36852
36731
|
const key = value.toLowerCase();
|
|
36853
36732
|
const val = opt.type.get(key);
|
|
36854
36733
|
if (val !== void 0) {
|
|
36855
|
-
return validateJsonOptionValue(opt, val, errors);
|
|
36734
|
+
return validateJsonOptionValue(opt, val, errors, valueExpression, sourceFile);
|
|
36856
36735
|
} else {
|
|
36857
|
-
errors.push(
|
|
36736
|
+
errors.push(createDiagnosticForInvalidCustomType(opt, (message, ...args) => createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, message, ...args)));
|
|
36858
36737
|
}
|
|
36859
36738
|
}
|
|
36860
|
-
function convertJsonOptionOfListType(option, values, basePath, errors) {
|
|
36861
|
-
return filter(map(values, (v) => convertJsonOption(option.element, v, basePath, errors)), (v) => option.listPreserveFalsyValues ? true : !!v);
|
|
36739
|
+
function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
36740
|
+
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);
|
|
36862
36741
|
}
|
|
36863
36742
|
function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions = emptyArray) {
|
|
36864
36743
|
basePath = normalizePath(basePath);
|
|
@@ -36965,7 +36844,7 @@ ${lanes.join("\n")}
|
|
|
36965
36844
|
});
|
|
36966
36845
|
function createDiagnostic(message, spec) {
|
|
36967
36846
|
const element = getTsConfigPropArrayElementValue(jsonSourceFile, specKey, spec);
|
|
36968
|
-
return
|
|
36847
|
+
return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(jsonSourceFile, element, message, spec);
|
|
36969
36848
|
}
|
|
36970
36849
|
}
|
|
36971
36850
|
function specToDiagnostic(spec, disallowTrailingRecursion) {
|
|
@@ -37076,6 +36955,8 @@ ${lanes.join("\n")}
|
|
|
37076
36955
|
return out;
|
|
37077
36956
|
}
|
|
37078
36957
|
function getOptionValueWithEmptyStrings(value, option) {
|
|
36958
|
+
if (value === void 0)
|
|
36959
|
+
return value;
|
|
37079
36960
|
switch (option.type) {
|
|
37080
36961
|
case "object":
|
|
37081
36962
|
return "";
|
|
@@ -37090,7 +36971,7 @@ ${lanes.join("\n")}
|
|
|
37090
36971
|
return getOptionValueWithEmptyStrings(value, option.element);
|
|
37091
36972
|
case "list":
|
|
37092
36973
|
const elementType = option.element;
|
|
37093
|
-
return isArray(value) ? value
|
|
36974
|
+
return isArray(value) ? mapDefined(value, (v) => getOptionValueWithEmptyStrings(v, elementType)) : "";
|
|
37094
36975
|
default:
|
|
37095
36976
|
return forEachEntry(option.type, (optionEnumValue, optionStringValue) => {
|
|
37096
36977
|
if (optionEnumValue === value) {
|
|
@@ -37121,7 +37002,7 @@ ${lanes.join("\n")}
|
|
|
37121
37002
|
return Debug.fail("Expected 'option.type' to have entries.");
|
|
37122
37003
|
}
|
|
37123
37004
|
}
|
|
37124
|
-
var compileOnSaveCommandLineOption, jsxOptionMap, inverseJsxOptionMap, libEntries, libs, libMap, optionsForWatch, commonOptionsWithBuild, targetOptionDeclaration, moduleOptionDeclaration, commandOptionsWithoutBuild, optionDeclarations, semanticDiagnosticsOptionDeclarations, affectsEmitOptionDeclarations, affectsDeclarationPathOptionDeclarations, moduleResolutionOptionDeclarations, sourceFileAffectingCompilerOptions, optionsAffectingProgramStructure, transpileOptionValueCompilerOptions, optionsForBuild, buildOpts, typeAcquisitionDeclarations, optionsNameMapCache, compilerOptionsAlternateMode, defaultInitCompilerOptions, compilerOptionsDidYouMeanDiagnostics, buildOptionsNameMapCache, buildOptionsAlternateMode, buildOptionsDidYouMeanDiagnostics, typeAcquisitionDidYouMeanDiagnostics, watchOptionsNameMapCache, watchOptionsDidYouMeanDiagnostics, commandLineCompilerOptionsMapCache, commandLineWatchOptionsMapCache, commandLineTypeAcquisitionMapCache, extendsOptionDeclaration, _tsconfigRootOptions, defaultIncludeSpec, invalidTrailingRecursionPattern, wildcardDirectoryPattern;
|
|
37005
|
+
var compileOnSaveCommandLineOption, jsxOptionMap, inverseJsxOptionMap, libEntries, libs, libMap, optionsForWatch, commonOptionsWithBuild, targetOptionDeclaration, moduleOptionDeclaration, commandOptionsWithoutBuild, optionDeclarations, semanticDiagnosticsOptionDeclarations, affectsEmitOptionDeclarations, affectsDeclarationPathOptionDeclarations, moduleResolutionOptionDeclarations, sourceFileAffectingCompilerOptions, optionsAffectingProgramStructure, transpileOptionValueCompilerOptions, optionsForBuild, buildOpts, typeAcquisitionDeclarations, optionsNameMapCache, compilerOptionsAlternateMode, defaultInitCompilerOptions, compilerOptionsDidYouMeanDiagnostics, buildOptionsNameMapCache, buildOptionsAlternateMode, buildOptionsDidYouMeanDiagnostics, typeAcquisitionDidYouMeanDiagnostics, watchOptionsNameMapCache, watchOptionsDidYouMeanDiagnostics, commandLineCompilerOptionsMapCache, commandLineWatchOptionsMapCache, commandLineTypeAcquisitionMapCache, extendsOptionDeclaration, compilerOptionsDeclaration, watchOptionsDeclaration, typeAcquisitionDeclaration, _tsconfigRootOptions, defaultIncludeSpec, invalidTrailingRecursionPattern, wildcardDirectoryPattern;
|
|
37125
37006
|
var init_commandLineParser = __esm({
|
|
37126
37007
|
"src/compiler/commandLineParser.ts"() {
|
|
37127
37008
|
"use strict";
|
|
@@ -38627,7 +38508,26 @@ ${lanes.join("\n")}
|
|
|
38627
38508
|
name: "extends",
|
|
38628
38509
|
type: "string"
|
|
38629
38510
|
},
|
|
38630
|
-
category: Diagnostics.File_Management
|
|
38511
|
+
category: Diagnostics.File_Management,
|
|
38512
|
+
disallowNullOrUndefined: true
|
|
38513
|
+
};
|
|
38514
|
+
compilerOptionsDeclaration = {
|
|
38515
|
+
name: "compilerOptions",
|
|
38516
|
+
type: "object",
|
|
38517
|
+
elementOptions: getCommandLineCompilerOptionsMap(),
|
|
38518
|
+
extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics
|
|
38519
|
+
};
|
|
38520
|
+
watchOptionsDeclaration = {
|
|
38521
|
+
name: "watchOptions",
|
|
38522
|
+
type: "object",
|
|
38523
|
+
elementOptions: getCommandLineWatchOptionsMap(),
|
|
38524
|
+
extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics
|
|
38525
|
+
};
|
|
38526
|
+
typeAcquisitionDeclaration = {
|
|
38527
|
+
name: "typeAcquisition",
|
|
38528
|
+
type: "object",
|
|
38529
|
+
elementOptions: getCommandLineTypeAcquisitionMap(),
|
|
38530
|
+
extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics
|
|
38631
38531
|
};
|
|
38632
38532
|
defaultIncludeSpec = "**/*";
|
|
38633
38533
|
invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/;
|
|
@@ -41355,8 +41255,8 @@ ${lanes.join("\n")}
|
|
|
41355
41255
|
var reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
|
|
41356
41256
|
var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
|
|
41357
41257
|
return bindSourceFile2;
|
|
41358
|
-
function createDiagnosticForNode2(node, message,
|
|
41359
|
-
return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message,
|
|
41258
|
+
function createDiagnosticForNode2(node, message, ...args) {
|
|
41259
|
+
return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, ...args);
|
|
41360
41260
|
}
|
|
41361
41261
|
function bindSourceFile2(f, opts) {
|
|
41362
41262
|
var _a2, _b;
|
|
@@ -41550,7 +41450,7 @@ ${lanes.join("\n")}
|
|
|
41550
41450
|
const declarationName = getNameOfDeclaration(node) || node;
|
|
41551
41451
|
forEach(symbol.declarations, (declaration, index) => {
|
|
41552
41452
|
const decl = getNameOfDeclaration(declaration) || declaration;
|
|
41553
|
-
const diag3 = createDiagnosticForNode2(decl, message,
|
|
41453
|
+
const diag3 = messageNeedsName ? createDiagnosticForNode2(decl, message, getDisplayName(declaration)) : createDiagnosticForNode2(decl, message);
|
|
41554
41454
|
file.bindDiagnostics.push(
|
|
41555
41455
|
multipleDefaultExports ? addRelatedInfo(diag3, createDiagnosticForNode2(declarationName, index === 0 ? Diagnostics.Another_export_default_is_here : Diagnostics.and_here)) : diag3
|
|
41556
41456
|
);
|
|
@@ -41558,7 +41458,7 @@ ${lanes.join("\n")}
|
|
|
41558
41458
|
relatedInformation.push(createDiagnosticForNode2(decl, Diagnostics.The_first_export_default_is_here));
|
|
41559
41459
|
}
|
|
41560
41460
|
});
|
|
41561
|
-
const diag2 = createDiagnosticForNode2(declarationName, message,
|
|
41461
|
+
const diag2 = messageNeedsName ? createDiagnosticForNode2(declarationName, message, getDisplayName(node)) : createDiagnosticForNode2(declarationName, message);
|
|
41562
41462
|
file.bindDiagnostics.push(addRelatedInfo(diag2, ...relatedInformation));
|
|
41563
41463
|
symbol = createSymbol(0 /* None */, name);
|
|
41564
41464
|
}
|
|
@@ -43019,9 +42919,9 @@ ${lanes.join("\n")}
|
|
|
43019
42919
|
}
|
|
43020
42920
|
}
|
|
43021
42921
|
}
|
|
43022
|
-
function errorOnFirstToken(node, message,
|
|
42922
|
+
function errorOnFirstToken(node, message, ...args) {
|
|
43023
42923
|
const span = getSpanOfTokenAtPosition(file, node.pos);
|
|
43024
|
-
file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message,
|
|
42924
|
+
file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, ...args));
|
|
43025
42925
|
}
|
|
43026
42926
|
function errorOrSuggestionOnNode(isError, node, message) {
|
|
43027
42927
|
errorOrSuggestionOnRange(isError, node, node, message);
|
|
@@ -45087,6 +44987,7 @@ ${lanes.join("\n")}
|
|
|
45087
44987
|
var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
|
|
45088
44988
|
var requireSymbol = createSymbol(4 /* Property */, "require");
|
|
45089
44989
|
var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
|
|
44990
|
+
var canCollectSymbolAliasAccessabilityData = !compilerOptions.verbatimModuleSyntax || !!compilerOptions.importsNotUsedAsValues;
|
|
45090
44991
|
var apparentArgumentCount;
|
|
45091
44992
|
const checker = {
|
|
45092
44993
|
getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
|
|
@@ -45914,8 +45815,8 @@ ${lanes.join("\n")}
|
|
|
45914
45815
|
getDiagnostics2(sourceFile, cancellationToken2);
|
|
45915
45816
|
return emitResolver;
|
|
45916
45817
|
}
|
|
45917
|
-
function lookupOrIssueError(location, message,
|
|
45918
|
-
const diagnostic = location ? createDiagnosticForNode(location, message,
|
|
45818
|
+
function lookupOrIssueError(location, message, ...args) {
|
|
45819
|
+
const diagnostic = location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
|
|
45919
45820
|
const existing = diagnostics.lookup(diagnostic);
|
|
45920
45821
|
if (existing) {
|
|
45921
45822
|
return existing;
|
|
@@ -45924,16 +45825,16 @@ ${lanes.join("\n")}
|
|
|
45924
45825
|
return diagnostic;
|
|
45925
45826
|
}
|
|
45926
45827
|
}
|
|
45927
|
-
function errorSkippedOn(key, location, message,
|
|
45928
|
-
const diagnostic = error(location, message,
|
|
45828
|
+
function errorSkippedOn(key, location, message, ...args) {
|
|
45829
|
+
const diagnostic = error(location, message, ...args);
|
|
45929
45830
|
diagnostic.skippedOn = key;
|
|
45930
45831
|
return diagnostic;
|
|
45931
45832
|
}
|
|
45932
|
-
function createError(location, message,
|
|
45933
|
-
return location ? createDiagnosticForNode(location, message,
|
|
45833
|
+
function createError(location, message, ...args) {
|
|
45834
|
+
return location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
|
|
45934
45835
|
}
|
|
45935
|
-
function error(location, message,
|
|
45936
|
-
const diagnostic = createError(location, message,
|
|
45836
|
+
function error(location, message, ...args) {
|
|
45837
|
+
const diagnostic = createError(location, message, ...args);
|
|
45937
45838
|
diagnostics.add(diagnostic);
|
|
45938
45839
|
return diagnostic;
|
|
45939
45840
|
}
|
|
@@ -45944,19 +45845,19 @@ ${lanes.join("\n")}
|
|
|
45944
45845
|
suggestionDiagnostics.add({ ...diagnostic, category: 2 /* Suggestion */ });
|
|
45945
45846
|
}
|
|
45946
45847
|
}
|
|
45947
|
-
function errorOrSuggestion(isError, location, message,
|
|
45848
|
+
function errorOrSuggestion(isError, location, message, ...args) {
|
|
45948
45849
|
if (location.pos < 0 || location.end < 0) {
|
|
45949
45850
|
if (!isError) {
|
|
45950
45851
|
return;
|
|
45951
45852
|
}
|
|
45952
45853
|
const file = getSourceFileOfNode(location);
|
|
45953
|
-
addErrorOrSuggestion(isError, "message" in message ? createFileDiagnostic(file, 0, 0, message,
|
|
45854
|
+
addErrorOrSuggestion(isError, "message" in message ? createFileDiagnostic(file, 0, 0, message, ...args) : createDiagnosticForFileFromMessageChain(file, message));
|
|
45954
45855
|
return;
|
|
45955
45856
|
}
|
|
45956
|
-
addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message,
|
|
45857
|
+
addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, ...args) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message));
|
|
45957
45858
|
}
|
|
45958
|
-
function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message,
|
|
45959
|
-
const diagnostic = error(location, message,
|
|
45859
|
+
function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, ...args) {
|
|
45860
|
+
const diagnostic = error(location, message, ...args);
|
|
45960
45861
|
if (maybeMissingAwait) {
|
|
45961
45862
|
const related = createDiagnosticForNode(location, Diagnostics.Did_you_forget_to_use_await);
|
|
45962
45863
|
addRelatedInfo(diagnostic, related);
|
|
@@ -47830,7 +47731,7 @@ ${lanes.join("\n")}
|
|
|
47830
47731
|
return void 0;
|
|
47831
47732
|
}
|
|
47832
47733
|
function markExportAsReferenced(node) {
|
|
47833
|
-
if (
|
|
47734
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
47834
47735
|
return;
|
|
47835
47736
|
}
|
|
47836
47737
|
const symbol = getSymbolOfDeclaration(node);
|
|
@@ -47843,7 +47744,7 @@ ${lanes.join("\n")}
|
|
|
47843
47744
|
}
|
|
47844
47745
|
}
|
|
47845
47746
|
function markAliasSymbolAsReferenced(symbol) {
|
|
47846
|
-
Debug.assert(
|
|
47747
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
47847
47748
|
const links = getSymbolLinks(symbol);
|
|
47848
47749
|
if (!links.referenced) {
|
|
47849
47750
|
links.referenced = true;
|
|
@@ -47974,6 +47875,9 @@ ${lanes.join("\n")}
|
|
|
47974
47875
|
}
|
|
47975
47876
|
}
|
|
47976
47877
|
symbol = getMergedSymbol(getSymbol2(getExportsOfSymbol(namespace), right.escapedText, meaning));
|
|
47878
|
+
if (!symbol && namespace.flags & 2097152 /* Alias */) {
|
|
47879
|
+
symbol = getMergedSymbol(getSymbol2(getExportsOfSymbol(resolveAlias(namespace)), right.escapedText, meaning));
|
|
47880
|
+
}
|
|
47977
47881
|
if (!symbol) {
|
|
47978
47882
|
if (!ignoreErrors) {
|
|
47979
47883
|
const namespaceName = getFullyQualifiedName(namespace);
|
|
@@ -49723,8 +49627,11 @@ ${lanes.join("\n")}
|
|
|
49723
49627
|
}
|
|
49724
49628
|
return typeToTypeNodeHelper(type2, context);
|
|
49725
49629
|
}
|
|
49630
|
+
function isMappedTypeHomomorphic(type2) {
|
|
49631
|
+
return !!getHomomorphicTypeVariable(type2);
|
|
49632
|
+
}
|
|
49726
49633
|
function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) {
|
|
49727
|
-
return
|
|
49634
|
+
return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2);
|
|
49728
49635
|
}
|
|
49729
49636
|
function createMappedTypeNodeFromType(type2) {
|
|
49730
49637
|
Debug.assert(!!(type2.flags & 524288 /* Object */));
|
|
@@ -56128,7 +56035,7 @@ ${lanes.join("\n")}
|
|
|
56128
56035
|
const typeVariable = getHomomorphicTypeVariable(type);
|
|
56129
56036
|
if (typeVariable && !type.declaration.nameType) {
|
|
56130
56037
|
const constraint = getConstraintOfTypeParameter(typeVariable);
|
|
56131
|
-
if (constraint &&
|
|
56038
|
+
if (constraint && everyType(constraint, isArrayOrTupleType)) {
|
|
56132
56039
|
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
56133
56040
|
}
|
|
56134
56041
|
}
|
|
@@ -58931,7 +58838,7 @@ ${lanes.join("\n")}
|
|
|
58931
58838
|
return type;
|
|
58932
58839
|
}
|
|
58933
58840
|
function getStringMappingType(symbol, type) {
|
|
58934
|
-
return type.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapType(type, (t) => getStringMappingType(symbol, t)) : type.flags &
|
|
58841
|
+
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)) : (
|
|
58935
58842
|
// Mapping<Mapping<T>> === Mapping<T>
|
|
58936
58843
|
type.flags & 268435456 /* StringMapping */ && symbol === type.symbol ? type : type.flags & (1 /* Any */ | 4 /* String */ | 268435456 /* StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : (
|
|
58937
58844
|
// This handles Mapping<`${number}`> and Mapping<`${bigint}`>
|
|
@@ -60605,7 +60512,13 @@ ${lanes.join("\n")}
|
|
|
60605
60512
|
return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
|
|
60606
60513
|
}
|
|
60607
60514
|
function hasContextSensitiveReturnExpression(node) {
|
|
60608
|
-
|
|
60515
|
+
if (node.typeParameters || getEffectiveReturnTypeNode(node) || !node.body) {
|
|
60516
|
+
return false;
|
|
60517
|
+
}
|
|
60518
|
+
if (node.body.kind !== 239 /* Block */) {
|
|
60519
|
+
return isContextSensitive(node.body);
|
|
60520
|
+
}
|
|
60521
|
+
return !!forEachReturnStatement(node.body, (statement) => !!statement.expression && isContextSensitive(statement.expression));
|
|
60609
60522
|
}
|
|
60610
60523
|
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
|
|
60611
60524
|
return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
|
|
@@ -61274,7 +61187,12 @@ ${lanes.join("\n")}
|
|
|
61274
61187
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
61275
61188
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
61276
61189
|
for (let i = 0; i < paramCount; i++) {
|
|
61277
|
-
const sourceType = i === restIndex ? getRestTypeAtPosition(
|
|
61190
|
+
const sourceType = i === restIndex ? getRestTypeAtPosition(
|
|
61191
|
+
source,
|
|
61192
|
+
i,
|
|
61193
|
+
/*readonly*/
|
|
61194
|
+
true
|
|
61195
|
+
) : tryGetTypeAtPosition(source, i);
|
|
61278
61196
|
const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
61279
61197
|
if (sourceType && targetType) {
|
|
61280
61198
|
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
@@ -61540,7 +61458,7 @@ ${lanes.join("\n")}
|
|
|
61540
61458
|
}
|
|
61541
61459
|
function getNormalizedType(type, writing) {
|
|
61542
61460
|
while (true) {
|
|
61543
|
-
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;
|
|
61461
|
+
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;
|
|
61544
61462
|
if (t === type)
|
|
61545
61463
|
return t;
|
|
61546
61464
|
type = t;
|
|
@@ -61559,6 +61477,11 @@ ${lanes.join("\n")}
|
|
|
61559
61477
|
}
|
|
61560
61478
|
return type;
|
|
61561
61479
|
}
|
|
61480
|
+
function getNormalizedTupleType(type, writing) {
|
|
61481
|
+
const elements = getTypeArguments(type);
|
|
61482
|
+
const normalizedElements = sameMap(elements, (t) => t.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(t, writing) : t);
|
|
61483
|
+
return elements !== normalizedElements ? createNormalizedTupleType(type.target, normalizedElements) : type;
|
|
61484
|
+
}
|
|
61562
61485
|
function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
|
|
61563
61486
|
var _a2;
|
|
61564
61487
|
let errorInfo;
|
|
@@ -61648,10 +61571,10 @@ ${lanes.join("\n")}
|
|
|
61648
61571
|
relatedInfo: relatedInfo == null ? void 0 : relatedInfo.slice()
|
|
61649
61572
|
};
|
|
61650
61573
|
}
|
|
61651
|
-
function reportIncompatibleError(message,
|
|
61574
|
+
function reportIncompatibleError(message, ...args) {
|
|
61652
61575
|
overrideNextErrorInfo++;
|
|
61653
61576
|
lastSkippedInfo = void 0;
|
|
61654
|
-
(incompatibleStack || (incompatibleStack = [])).push([message,
|
|
61577
|
+
(incompatibleStack || (incompatibleStack = [])).push([message, ...args]);
|
|
61655
61578
|
}
|
|
61656
61579
|
function reportIncompatibleStack() {
|
|
61657
61580
|
const stack = incompatibleStack || [];
|
|
@@ -61743,13 +61666,13 @@ ${lanes.join("\n")}
|
|
|
61743
61666
|
);
|
|
61744
61667
|
}
|
|
61745
61668
|
}
|
|
61746
|
-
function reportError(message,
|
|
61669
|
+
function reportError(message, ...args) {
|
|
61747
61670
|
Debug.assert(!!errorNode);
|
|
61748
61671
|
if (incompatibleStack)
|
|
61749
61672
|
reportIncompatibleStack();
|
|
61750
61673
|
if (message.elidedInCompatabilityPyramid)
|
|
61751
61674
|
return;
|
|
61752
|
-
errorInfo = chainDiagnosticMessages(errorInfo, message,
|
|
61675
|
+
errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
|
|
61753
61676
|
}
|
|
61754
61677
|
function associateRelatedInfo(info) {
|
|
61755
61678
|
Debug.assert(!!errorInfo);
|
|
@@ -63036,7 +62959,7 @@ ${lanes.join("\n")}
|
|
|
63036
62959
|
if (varianceResult !== void 0) {
|
|
63037
62960
|
return varianceResult;
|
|
63038
62961
|
}
|
|
63039
|
-
} else if (isReadonlyArrayType(target2) ?
|
|
62962
|
+
} else if (isReadonlyArrayType(target2) ? everyType(source2, isArrayOrTupleType) : isArrayType(target2) && everyType(source2, (t) => isTupleType(t) && !t.target.readonly)) {
|
|
63040
62963
|
if (relation !== identityRelation) {
|
|
63041
62964
|
return isRelatedTo(getIndexTypeOfType(source2, numberType) || anyType, getIndexTypeOfType(target2, numberType) || anyType, 3 /* Both */, reportErrors2);
|
|
63042
62965
|
} else {
|
|
@@ -63919,22 +63842,7 @@ ${lanes.join("\n")}
|
|
|
63919
63842
|
if (match === -1) {
|
|
63920
63843
|
return defaultValue;
|
|
63921
63844
|
}
|
|
63922
|
-
|
|
63923
|
-
/*searchElement*/
|
|
63924
|
-
true,
|
|
63925
|
-
match + 1
|
|
63926
|
-
);
|
|
63927
|
-
while (nextMatch !== -1) {
|
|
63928
|
-
if (!isTypeIdenticalTo(target.types[match], target.types[nextMatch])) {
|
|
63929
|
-
return defaultValue;
|
|
63930
|
-
}
|
|
63931
|
-
nextMatch = discriminable.indexOf(
|
|
63932
|
-
/*searchElement*/
|
|
63933
|
-
true,
|
|
63934
|
-
nextMatch + 1
|
|
63935
|
-
);
|
|
63936
|
-
}
|
|
63937
|
-
return target.types[match];
|
|
63845
|
+
return getUnionType(target.types.filter((_, index) => discriminable[index]));
|
|
63938
63846
|
}
|
|
63939
63847
|
function isWeakType(type) {
|
|
63940
63848
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -64135,7 +64043,7 @@ ${lanes.join("\n")}
|
|
|
64135
64043
|
return type.symbol;
|
|
64136
64044
|
}
|
|
64137
64045
|
if (isTupleType(type)) {
|
|
64138
|
-
return type
|
|
64046
|
+
return type;
|
|
64139
64047
|
}
|
|
64140
64048
|
}
|
|
64141
64049
|
if (type.flags & 262144 /* TypeParameter */) {
|
|
@@ -65534,7 +65442,11 @@ ${lanes.join("\n")}
|
|
|
65534
65442
|
return true;
|
|
65535
65443
|
}
|
|
65536
65444
|
if (constraintType.flags & 262144 /* TypeParameter */) {
|
|
65537
|
-
inferWithPriority(getIndexType(
|
|
65445
|
+
inferWithPriority(getIndexType(
|
|
65446
|
+
source,
|
|
65447
|
+
/*indexFlags*/
|
|
65448
|
+
!!source.pattern ? 2 /* NoIndexSignatures */ : 0 /* None */
|
|
65449
|
+
), constraintType, 32 /* MappedTypeConstraint */);
|
|
65538
65450
|
const extendedConstraint = getConstraintOfType(constraintType);
|
|
65539
65451
|
if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) {
|
|
65540
65452
|
return true;
|
|
@@ -66007,36 +65919,34 @@ ${lanes.join("\n")}
|
|
|
66007
65919
|
return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName : type.flags & 384 /* StringOrNumberLiteral */ ? escapeLeadingUnderscores("" + type.value) : void 0;
|
|
66008
65920
|
}
|
|
66009
65921
|
function tryGetElementAccessExpressionName(node) {
|
|
66010
|
-
|
|
66011
|
-
|
|
65922
|
+
return isStringOrNumericLiteralLike(node.argumentExpression) ? escapeLeadingUnderscores(node.argumentExpression.text) : isEntityNameExpression(node.argumentExpression) ? tryGetNameFromEntityNameExpression(node.argumentExpression) : void 0;
|
|
65923
|
+
}
|
|
65924
|
+
function tryGetNameFromEntityNameExpression(node) {
|
|
65925
|
+
const symbol = resolveEntityName(
|
|
65926
|
+
node,
|
|
65927
|
+
111551 /* Value */,
|
|
65928
|
+
/*ignoreErrors*/
|
|
65929
|
+
true
|
|
65930
|
+
);
|
|
65931
|
+
if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */))
|
|
65932
|
+
return void 0;
|
|
65933
|
+
const declaration = symbol.valueDeclaration;
|
|
65934
|
+
if (declaration === void 0)
|
|
65935
|
+
return void 0;
|
|
65936
|
+
const type = tryGetTypeFromEffectiveTypeNode(declaration);
|
|
65937
|
+
if (type) {
|
|
65938
|
+
const name = tryGetNameFromType(type);
|
|
65939
|
+
if (name !== void 0) {
|
|
65940
|
+
return name;
|
|
65941
|
+
}
|
|
66012
65942
|
}
|
|
66013
|
-
if (
|
|
66014
|
-
const
|
|
66015
|
-
|
|
66016
|
-
|
|
66017
|
-
/*ignoreErrors*/
|
|
66018
|
-
true
|
|
66019
|
-
);
|
|
66020
|
-
if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */))
|
|
66021
|
-
return void 0;
|
|
66022
|
-
const declaration = symbol.valueDeclaration;
|
|
66023
|
-
if (declaration === void 0)
|
|
66024
|
-
return void 0;
|
|
66025
|
-
const type = tryGetTypeFromEffectiveTypeNode(declaration);
|
|
66026
|
-
if (type) {
|
|
66027
|
-
const name = tryGetNameFromType(type);
|
|
66028
|
-
if (name !== void 0) {
|
|
66029
|
-
return name;
|
|
66030
|
-
}
|
|
65943
|
+
if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node)) {
|
|
65944
|
+
const initializer = getEffectiveInitializer(declaration);
|
|
65945
|
+
if (initializer) {
|
|
65946
|
+
return tryGetNameFromType(getTypeOfExpression(initializer));
|
|
66031
65947
|
}
|
|
66032
|
-
if (
|
|
66033
|
-
|
|
66034
|
-
if (initializer) {
|
|
66035
|
-
return tryGetNameFromType(getTypeOfExpression(initializer));
|
|
66036
|
-
}
|
|
66037
|
-
if (isEnumMember(declaration)) {
|
|
66038
|
-
return getTextOfPropertyName(declaration.name);
|
|
66039
|
-
}
|
|
65948
|
+
if (isEnumMember(declaration)) {
|
|
65949
|
+
return getTextOfPropertyName(declaration.name);
|
|
66040
65950
|
}
|
|
66041
65951
|
}
|
|
66042
65952
|
return void 0;
|
|
@@ -67954,7 +67864,7 @@ ${lanes.join("\n")}
|
|
|
67954
67864
|
});
|
|
67955
67865
|
}
|
|
67956
67866
|
function markAliasReferenced(symbol, location) {
|
|
67957
|
-
if (
|
|
67867
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
67958
67868
|
return;
|
|
67959
67869
|
}
|
|
67960
67870
|
if (isNonLocalAlias(
|
|
@@ -69246,7 +69156,11 @@ ${lanes.join("\n")}
|
|
|
69246
69156
|
if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
|
|
69247
69157
|
const apparentType = mapType(
|
|
69248
69158
|
instantiatedType,
|
|
69249
|
-
|
|
69159
|
+
// When obtaining apparent type of *contextual* type we don't want to get apparent type of mapped types.
|
|
69160
|
+
// That would evaluate mapped types with array or tuple type constraints too eagerly
|
|
69161
|
+
// and thus it would prevent `getTypeOfPropertyOfContextualType` from obtaining per-position contextual type for elements of array literal expressions.
|
|
69162
|
+
// Apparent type of other mapped types is already the mapped type itself so we can just avoid calling `getApparentType` here for all mapped types.
|
|
69163
|
+
(t) => getObjectFlags(t) & 32 /* Mapped */ ? t : getApparentType(t),
|
|
69250
69164
|
/*noReductions*/
|
|
69251
69165
|
true
|
|
69252
69166
|
);
|
|
@@ -70511,7 +70425,7 @@ ${lanes.join("\n")}
|
|
|
70511
70425
|
}
|
|
70512
70426
|
if (jsxFactorySym) {
|
|
70513
70427
|
jsxFactorySym.isReferenced = 67108863 /* All */;
|
|
70514
|
-
if (
|
|
70428
|
+
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
70515
70429
|
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
70516
70430
|
}
|
|
70517
70431
|
}
|
|
@@ -72085,16 +71999,16 @@ ${lanes.join("\n")}
|
|
|
72085
71999
|
}
|
|
72086
72000
|
return { start, length: length2, sourceFile };
|
|
72087
72001
|
}
|
|
72088
|
-
function getDiagnosticForCallNode(node, message,
|
|
72002
|
+
function getDiagnosticForCallNode(node, message, ...args) {
|
|
72089
72003
|
if (isCallExpression(node)) {
|
|
72090
72004
|
const { sourceFile, start, length: length2 } = getDiagnosticSpanForCallNode(node);
|
|
72091
72005
|
if ("message" in message) {
|
|
72092
|
-
return createFileDiagnostic(sourceFile, start, length2, message,
|
|
72006
|
+
return createFileDiagnostic(sourceFile, start, length2, message, ...args);
|
|
72093
72007
|
}
|
|
72094
72008
|
return createDiagnosticForFileFromMessageChain(sourceFile, message);
|
|
72095
72009
|
} else {
|
|
72096
72010
|
if ("message" in message) {
|
|
72097
|
-
return createDiagnosticForNode(node, message,
|
|
72011
|
+
return createDiagnosticForNode(node, message, ...args);
|
|
72098
72012
|
}
|
|
72099
72013
|
return createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, message);
|
|
72100
72014
|
}
|
|
@@ -72182,11 +72096,8 @@ ${lanes.join("\n")}
|
|
|
72182
72096
|
}
|
|
72183
72097
|
const parameter = (_a2 = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a2.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
|
|
72184
72098
|
if (parameter) {
|
|
72185
|
-
const
|
|
72186
|
-
|
|
72187
|
-
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,
|
|
72188
|
-
!parameter.name ? args.length : !isBindingPattern(parameter.name) ? idText(getFirstIdentifier(parameter.name)) : void 0
|
|
72189
|
-
);
|
|
72099
|
+
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))];
|
|
72100
|
+
const parameterError = createDiagnosticForNode(parameter, ...messageAndArgs);
|
|
72190
72101
|
return addRelatedInfo(diagnostic, parameterError);
|
|
72191
72102
|
}
|
|
72192
72103
|
return diagnostic;
|
|
@@ -73791,12 +73702,12 @@ ${lanes.join("\n")}
|
|
|
73791
73702
|
}
|
|
73792
73703
|
return void 0;
|
|
73793
73704
|
}
|
|
73794
|
-
function getRestTypeAtPosition(source, pos) {
|
|
73705
|
+
function getRestTypeAtPosition(source, pos, readonly = false) {
|
|
73795
73706
|
const parameterCount = getParameterCount(source);
|
|
73796
73707
|
const minArgumentCount = getMinArgumentCount(source);
|
|
73797
73708
|
const restType = getEffectiveRestType(source);
|
|
73798
73709
|
if (restType && pos >= parameterCount - 1) {
|
|
73799
|
-
return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
|
|
73710
|
+
return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType), readonly);
|
|
73800
73711
|
}
|
|
73801
73712
|
const types = [];
|
|
73802
73713
|
const flags = [];
|
|
@@ -73814,13 +73725,7 @@ ${lanes.join("\n")}
|
|
|
73814
73725
|
names.push(name);
|
|
73815
73726
|
}
|
|
73816
73727
|
}
|
|
73817
|
-
return createTupleType(
|
|
73818
|
-
types,
|
|
73819
|
-
flags,
|
|
73820
|
-
/*readonly*/
|
|
73821
|
-
false,
|
|
73822
|
-
length(names) === length(types) ? names : void 0
|
|
73823
|
-
);
|
|
73728
|
+
return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
|
|
73824
73729
|
}
|
|
73825
73730
|
function getParameterCount(signature) {
|
|
73826
73731
|
const length2 = signature.parameters.length;
|
|
@@ -77526,9 +77431,9 @@ ${lanes.join("\n")}
|
|
|
77526
77431
|
}
|
|
77527
77432
|
}
|
|
77528
77433
|
}
|
|
77529
|
-
function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage,
|
|
77434
|
+
function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, ...args) {
|
|
77530
77435
|
const promisedType = getPromisedTypeOfPromise(type, errorNode);
|
|
77531
|
-
return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage,
|
|
77436
|
+
return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, ...args);
|
|
77532
77437
|
}
|
|
77533
77438
|
function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) {
|
|
77534
77439
|
if (isTypeAny(type)) {
|
|
@@ -77591,8 +77496,8 @@ ${lanes.join("\n")}
|
|
|
77591
77496
|
}
|
|
77592
77497
|
return typeAsPromise.promisedTypeOfPromise = getUnionType(map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), 2 /* Subtype */);
|
|
77593
77498
|
}
|
|
77594
|
-
function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage,
|
|
77595
|
-
const awaitedType = withAlias ? getAwaitedType(type, errorNode, diagnosticMessage,
|
|
77499
|
+
function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage, ...args) {
|
|
77500
|
+
const awaitedType = withAlias ? getAwaitedType(type, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args);
|
|
77596
77501
|
return awaitedType || errorType;
|
|
77597
77502
|
}
|
|
77598
77503
|
function isThenableType(type) {
|
|
@@ -77648,11 +77553,11 @@ ${lanes.join("\n")}
|
|
|
77648
77553
|
Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
77649
77554
|
return type;
|
|
77650
77555
|
}
|
|
77651
|
-
function getAwaitedType(type, errorNode, diagnosticMessage,
|
|
77652
|
-
const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage,
|
|
77556
|
+
function getAwaitedType(type, errorNode, diagnosticMessage, ...args) {
|
|
77557
|
+
const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args);
|
|
77653
77558
|
return awaitedType && createAwaitedTypeIfNeeded(awaitedType);
|
|
77654
77559
|
}
|
|
77655
|
-
function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage,
|
|
77560
|
+
function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args) {
|
|
77656
77561
|
if (isTypeAny(type)) {
|
|
77657
77562
|
return type;
|
|
77658
77563
|
}
|
|
@@ -77670,7 +77575,7 @@ ${lanes.join("\n")}
|
|
|
77670
77575
|
}
|
|
77671
77576
|
return void 0;
|
|
77672
77577
|
}
|
|
77673
|
-
const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage,
|
|
77578
|
+
const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias;
|
|
77674
77579
|
awaitedTypeStack.push(type.id);
|
|
77675
77580
|
const mapped = mapType(type, mapper);
|
|
77676
77581
|
awaitedTypeStack.pop();
|
|
@@ -77694,7 +77599,7 @@ ${lanes.join("\n")}
|
|
|
77694
77599
|
return void 0;
|
|
77695
77600
|
}
|
|
77696
77601
|
awaitedTypeStack.push(type.id);
|
|
77697
|
-
const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage,
|
|
77602
|
+
const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, ...args);
|
|
77698
77603
|
awaitedTypeStack.pop();
|
|
77699
77604
|
if (!awaitedType) {
|
|
77700
77605
|
return void 0;
|
|
@@ -77708,7 +77613,7 @@ ${lanes.join("\n")}
|
|
|
77708
77613
|
if (thisTypeForErrorOut.value) {
|
|
77709
77614
|
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));
|
|
77710
77615
|
}
|
|
77711
|
-
chain = chainDiagnosticMessages(chain, diagnosticMessage,
|
|
77616
|
+
chain = chainDiagnosticMessages(chain, diagnosticMessage, ...args);
|
|
77712
77617
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(errorNode), errorNode, chain));
|
|
77713
77618
|
}
|
|
77714
77619
|
return void 0;
|
|
@@ -77886,7 +77791,7 @@ ${lanes.join("\n")}
|
|
|
77886
77791
|
true
|
|
77887
77792
|
);
|
|
77888
77793
|
if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
|
|
77889
|
-
if (
|
|
77794
|
+
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
77890
77795
|
markAliasSymbolAsReferenced(rootSymbol);
|
|
77891
77796
|
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
77892
77797
|
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);
|
|
@@ -78295,9 +78200,8 @@ ${lanes.join("\n")}
|
|
|
78295
78200
|
const sourceFile = getSourceFileOfNode(parent2);
|
|
78296
78201
|
const range = isJSDocTemplateTag(parent2) ? rangeOfNode(parent2) : rangeOfTypeParameters(sourceFile, parent2.typeParameters);
|
|
78297
78202
|
const only = parent2.typeParameters.length === 1;
|
|
78298
|
-
const
|
|
78299
|
-
|
|
78300
|
-
addDiagnostic(typeParameter, 1 /* Parameter */, createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, message, arg0));
|
|
78203
|
+
const messageAndArg = only ? [Diagnostics._0_is_declared_but_its_value_is_never_read, name] : [Diagnostics.All_type_parameters_are_unused];
|
|
78204
|
+
addDiagnostic(typeParameter, 1 /* Parameter */, createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, ...messageAndArg));
|
|
78301
78205
|
}
|
|
78302
78206
|
} else {
|
|
78303
78207
|
addDiagnostic(typeParameter, 1 /* Parameter */, createDiagnosticForNode(typeParameter, Diagnostics._0_is_declared_but_its_value_is_never_read, name));
|
|
@@ -79855,7 +79759,7 @@ ${lanes.join("\n")}
|
|
|
79855
79759
|
forEachKey(catchClause.locals, (caughtName) => {
|
|
79856
79760
|
const blockLocal = blockLocals.get(caughtName);
|
|
79857
79761
|
if ((blockLocal == null ? void 0 : blockLocal.valueDeclaration) && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) {
|
|
79858
|
-
grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName);
|
|
79762
|
+
grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, unescapeLeadingUnderscores(caughtName));
|
|
79859
79763
|
}
|
|
79860
79764
|
});
|
|
79861
79765
|
}
|
|
@@ -81451,6 +81355,9 @@ ${lanes.join("\n")}
|
|
|
81451
81355
|
) && !getSymbolLinks(getSymbolOfDeclaration(statement)).constEnumReferenced;
|
|
81452
81356
|
}
|
|
81453
81357
|
function checkImportsForTypeOnlyConversion(sourceFile) {
|
|
81358
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
81359
|
+
return;
|
|
81360
|
+
}
|
|
81454
81361
|
for (const statement of sourceFile.statements) {
|
|
81455
81362
|
if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) {
|
|
81456
81363
|
error(
|
|
@@ -81536,14 +81443,14 @@ ${lanes.join("\n")}
|
|
|
81536
81443
|
markAliasReferenced(sym, id);
|
|
81537
81444
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
81538
81445
|
checkExpressionCached(id);
|
|
81539
|
-
if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
81446
|
+
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
81540
81447
|
error(
|
|
81541
81448
|
id,
|
|
81542
81449
|
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,
|
|
81543
81450
|
idText(id)
|
|
81544
81451
|
);
|
|
81545
81452
|
}
|
|
81546
|
-
} else if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax) {
|
|
81453
|
+
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
81547
81454
|
error(
|
|
81548
81455
|
id,
|
|
81549
81456
|
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,
|
|
@@ -82880,7 +82787,7 @@ ${lanes.join("\n")}
|
|
|
82880
82787
|
return false;
|
|
82881
82788
|
}
|
|
82882
82789
|
function isValueAliasDeclaration(node) {
|
|
82883
|
-
Debug.assert(
|
|
82790
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
82884
82791
|
switch (node.kind) {
|
|
82885
82792
|
case 269 /* ImportEqualsDeclaration */:
|
|
82886
82793
|
return isAliasResolvedToValue(getSymbolOfDeclaration(node));
|
|
@@ -82921,7 +82828,7 @@ ${lanes.join("\n")}
|
|
|
82921
82828
|
return isConstEnumSymbol(s) || !!s.constEnumOnlyModule;
|
|
82922
82829
|
}
|
|
82923
82830
|
function isReferencedAliasDeclaration(node, checkChildren) {
|
|
82924
|
-
Debug.assert(
|
|
82831
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
82925
82832
|
if (isAliasSymbolDeclaration2(node)) {
|
|
82926
82833
|
const symbol = getSymbolOfDeclaration(node);
|
|
82927
82834
|
const links = symbol && getSymbolLinks(symbol);
|
|
@@ -83259,12 +83166,12 @@ ${lanes.join("\n")}
|
|
|
83259
83166
|
isDeclarationWithCollidingName,
|
|
83260
83167
|
isValueAliasDeclaration: (nodeIn) => {
|
|
83261
83168
|
const node = getParseTreeNode(nodeIn);
|
|
83262
|
-
return node ? isValueAliasDeclaration(node) : true;
|
|
83169
|
+
return node && canCollectSymbolAliasAccessabilityData ? isValueAliasDeclaration(node) : true;
|
|
83263
83170
|
},
|
|
83264
83171
|
hasGlobalName,
|
|
83265
83172
|
isReferencedAliasDeclaration: (nodeIn, checkChildren) => {
|
|
83266
83173
|
const node = getParseTreeNode(nodeIn);
|
|
83267
|
-
return node ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
83174
|
+
return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
83268
83175
|
},
|
|
83269
83176
|
getNodeCheckFlags: (nodeIn) => {
|
|
83270
83177
|
const node = getParseTreeNode(nodeIn);
|
|
@@ -84399,7 +84306,7 @@ ${lanes.join("\n")}
|
|
|
84399
84306
|
throw Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
|
|
84400
84307
|
}
|
|
84401
84308
|
if (!inDestructuring) {
|
|
84402
|
-
const effectiveName =
|
|
84309
|
+
const effectiveName = getEffectivePropertyNameForPropertyNameNode(name);
|
|
84403
84310
|
if (effectiveName === void 0) {
|
|
84404
84311
|
continue;
|
|
84405
84312
|
}
|
|
@@ -84868,12 +84775,12 @@ ${lanes.join("\n")}
|
|
|
84868
84775
|
switch (node.keywordToken) {
|
|
84869
84776
|
case 104 /* NewKeyword */:
|
|
84870
84777
|
if (escapedText !== "target") {
|
|
84871
|
-
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");
|
|
84778
|
+
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");
|
|
84872
84779
|
}
|
|
84873
84780
|
break;
|
|
84874
84781
|
case 101 /* ImportKeyword */:
|
|
84875
84782
|
if (escapedText !== "meta") {
|
|
84876
|
-
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");
|
|
84783
|
+
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");
|
|
84877
84784
|
}
|
|
84878
84785
|
break;
|
|
84879
84786
|
}
|
|
@@ -84881,35 +84788,35 @@ ${lanes.join("\n")}
|
|
|
84881
84788
|
function hasParseDiagnostics(sourceFile) {
|
|
84882
84789
|
return sourceFile.parseDiagnostics.length > 0;
|
|
84883
84790
|
}
|
|
84884
|
-
function grammarErrorOnFirstToken(node, message,
|
|
84791
|
+
function grammarErrorOnFirstToken(node, message, ...args) {
|
|
84885
84792
|
const sourceFile = getSourceFileOfNode(node);
|
|
84886
84793
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
84887
84794
|
const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
84888
|
-
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message,
|
|
84795
|
+
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, ...args));
|
|
84889
84796
|
return true;
|
|
84890
84797
|
}
|
|
84891
84798
|
return false;
|
|
84892
84799
|
}
|
|
84893
|
-
function grammarErrorAtPos(nodeForSourceFile, start, length2, message,
|
|
84800
|
+
function grammarErrorAtPos(nodeForSourceFile, start, length2, message, ...args) {
|
|
84894
84801
|
const sourceFile = getSourceFileOfNode(nodeForSourceFile);
|
|
84895
84802
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
84896
|
-
diagnostics.add(createFileDiagnostic(sourceFile, start, length2, message,
|
|
84803
|
+
diagnostics.add(createFileDiagnostic(sourceFile, start, length2, message, ...args));
|
|
84897
84804
|
return true;
|
|
84898
84805
|
}
|
|
84899
84806
|
return false;
|
|
84900
84807
|
}
|
|
84901
|
-
function grammarErrorOnNodeSkippedOn(key, node, message,
|
|
84808
|
+
function grammarErrorOnNodeSkippedOn(key, node, message, ...args) {
|
|
84902
84809
|
const sourceFile = getSourceFileOfNode(node);
|
|
84903
84810
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
84904
|
-
errorSkippedOn(key, node, message,
|
|
84811
|
+
errorSkippedOn(key, node, message, ...args);
|
|
84905
84812
|
return true;
|
|
84906
84813
|
}
|
|
84907
84814
|
return false;
|
|
84908
84815
|
}
|
|
84909
|
-
function grammarErrorOnNode(node, message,
|
|
84816
|
+
function grammarErrorOnNode(node, message, ...args) {
|
|
84910
84817
|
const sourceFile = getSourceFileOfNode(node);
|
|
84911
84818
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
84912
|
-
diagnostics.add(createDiagnosticForNode(node, message,
|
|
84819
|
+
diagnostics.add(createDiagnosticForNode(node, message, ...args));
|
|
84913
84820
|
return true;
|
|
84914
84821
|
}
|
|
84915
84822
|
return false;
|
|
@@ -85054,7 +84961,7 @@ ${lanes.join("\n")}
|
|
|
85054
84961
|
}
|
|
85055
84962
|
return false;
|
|
85056
84963
|
}
|
|
85057
|
-
function grammarErrorAfterFirstToken(node, message,
|
|
84964
|
+
function grammarErrorAfterFirstToken(node, message, ...args) {
|
|
85058
84965
|
const sourceFile = getSourceFileOfNode(node);
|
|
85059
84966
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
85060
84967
|
const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
@@ -85064,9 +84971,7 @@ ${lanes.join("\n")}
|
|
|
85064
84971
|
/*length*/
|
|
85065
84972
|
0,
|
|
85066
84973
|
message,
|
|
85067
|
-
|
|
85068
|
-
arg1,
|
|
85069
|
-
arg2
|
|
84974
|
+
...args
|
|
85070
84975
|
));
|
|
85071
84976
|
return true;
|
|
85072
84977
|
}
|
|
@@ -85212,6 +85117,10 @@ ${lanes.join("\n")}
|
|
|
85212
85117
|
}
|
|
85213
85118
|
return void 0;
|
|
85214
85119
|
}
|
|
85120
|
+
function getEffectivePropertyNameForPropertyNameNode(node) {
|
|
85121
|
+
const name = getPropertyNameForPropertyNameNode(node);
|
|
85122
|
+
return name ? name : isComputedPropertyName(node) && isEntityNameExpression(node.expression) ? tryGetNameFromEntityNameExpression(node.expression) : void 0;
|
|
85123
|
+
}
|
|
85215
85124
|
}
|
|
85216
85125
|
function isNotAccessor(declaration) {
|
|
85217
85126
|
return !isAccessor(declaration);
|
|
@@ -109876,8 +109785,7 @@ ${lanes.join("\n")}
|
|
|
109876
109785
|
}
|
|
109877
109786
|
}
|
|
109878
109787
|
function createBuildInfo(program, bundle) {
|
|
109879
|
-
|
|
109880
|
-
return { bundle, program, version: version2 };
|
|
109788
|
+
return { bundle, program, version };
|
|
109881
109789
|
}
|
|
109882
109790
|
function getBuildInfoText(buildInfo) {
|
|
109883
109791
|
return JSON.stringify(buildInfo);
|
|
@@ -109922,10 +109830,10 @@ ${lanes.join("\n")}
|
|
|
109922
109830
|
/*separateBeginAndEnd*/
|
|
109923
109831
|
true
|
|
109924
109832
|
);
|
|
109925
|
-
|
|
109833
|
+
mark("beforeEmit");
|
|
109926
109834
|
const result = emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers);
|
|
109927
|
-
|
|
109928
|
-
|
|
109835
|
+
mark("afterEmit");
|
|
109836
|
+
measure("Emit", "beforeEmit", "afterEmit");
|
|
109929
109837
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
109930
109838
|
return result;
|
|
109931
109839
|
}
|
|
@@ -113935,12 +113843,12 @@ ${lanes.join("\n")}
|
|
|
113935
113843
|
return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags != null ? flags : 0 /* None */, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix)));
|
|
113936
113844
|
}
|
|
113937
113845
|
function isUniqueName(name, privateName) {
|
|
113938
|
-
return
|
|
113846
|
+
return isFileLevelUniqueNameInCurrentFile(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
|
|
113939
113847
|
}
|
|
113940
113848
|
function isReservedName(name, privateName) {
|
|
113941
113849
|
return privateName ? !!(reservedPrivateNames == null ? void 0 : reservedPrivateNames.has(name)) : !!(reservedNames == null ? void 0 : reservedNames.has(name));
|
|
113942
113850
|
}
|
|
113943
|
-
function
|
|
113851
|
+
function isFileLevelUniqueNameInCurrentFile(name, _isPrivate) {
|
|
113944
113852
|
return currentSourceFile ? isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true;
|
|
113945
113853
|
}
|
|
113946
113854
|
function isUniqueLocalName(name, container) {
|
|
@@ -114059,7 +113967,7 @@ ${lanes.join("\n")}
|
|
|
114059
113967
|
function makeFileLevelOptimisticUniqueName(name) {
|
|
114060
113968
|
return makeUniqueName2(
|
|
114061
113969
|
name,
|
|
114062
|
-
|
|
113970
|
+
isFileLevelUniqueNameInCurrentFile,
|
|
114063
113971
|
/*optimistic*/
|
|
114064
113972
|
true,
|
|
114065
113973
|
/*scoped*/
|
|
@@ -114239,7 +114147,7 @@ ${lanes.join("\n")}
|
|
|
114239
114147
|
case 3 /* Unique */:
|
|
114240
114148
|
return makeUniqueName2(
|
|
114241
114149
|
idText(name),
|
|
114242
|
-
autoGenerate.flags & 32 /* FileLevel */ ?
|
|
114150
|
+
autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueNameInCurrentFile : isUniqueName,
|
|
114243
114151
|
!!(autoGenerate.flags & 16 /* Optimistic */),
|
|
114244
114152
|
!!(autoGenerate.flags & 8 /* ReservedInNestedScopes */),
|
|
114245
114153
|
isPrivateIdentifier(name),
|
|
@@ -115257,7 +115165,6 @@ ${lanes.join("\n")}
|
|
|
115257
115165
|
"src/compiler/watchUtilities.ts"() {
|
|
115258
115166
|
"use strict";
|
|
115259
115167
|
init_ts2();
|
|
115260
|
-
init_ts2();
|
|
115261
115168
|
ConfigFileProgramReloadLevel = /* @__PURE__ */ ((ConfigFileProgramReloadLevel2) => {
|
|
115262
115169
|
ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["None"] = 0] = "None";
|
|
115263
115170
|
ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["Partial"] = 1] = "Partial";
|
|
@@ -117257,12 +117164,12 @@ ${lanes.join("\n")}
|
|
|
117257
117164
|
}
|
|
117258
117165
|
}
|
|
117259
117166
|
}
|
|
117260
|
-
function createDiagnosticForNodeArray2(nodes, message,
|
|
117167
|
+
function createDiagnosticForNodeArray2(nodes, message, ...args) {
|
|
117261
117168
|
const start = nodes.pos;
|
|
117262
|
-
return createFileDiagnostic(sourceFile, start, nodes.end - start, message,
|
|
117169
|
+
return createFileDiagnostic(sourceFile, start, nodes.end - start, message, ...args);
|
|
117263
117170
|
}
|
|
117264
|
-
function createDiagnosticForNode2(node, message,
|
|
117265
|
-
return createDiagnosticForNodeInSourceFile(sourceFile, node, message,
|
|
117171
|
+
function createDiagnosticForNode2(node, message, ...args) {
|
|
117172
|
+
return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args);
|
|
117266
117173
|
}
|
|
117267
117174
|
});
|
|
117268
117175
|
}
|
|
@@ -117927,11 +117834,12 @@ ${lanes.join("\n")}
|
|
|
117927
117834
|
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
|
117928
117835
|
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
|
117929
117836
|
const diagnostic = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0;
|
|
117837
|
+
const args = suggestion ? [libName, suggestion] : [libName];
|
|
117930
117838
|
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
117931
117839
|
kind: 0 /* FilePreprocessingReferencedDiagnostic */,
|
|
117932
117840
|
reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index },
|
|
117933
117841
|
diagnostic,
|
|
117934
|
-
args
|
|
117842
|
+
args
|
|
117935
117843
|
});
|
|
117936
117844
|
}
|
|
117937
117845
|
});
|
|
@@ -118396,7 +118304,7 @@ ${lanes.join("\n")}
|
|
|
118396
118304
|
}
|
|
118397
118305
|
}
|
|
118398
118306
|
function verifyDeprecatedCompilerOptions() {
|
|
118399
|
-
function createDiagnostic(name, value, useInstead, message,
|
|
118307
|
+
function createDiagnostic(name, value, useInstead, message, ...args) {
|
|
118400
118308
|
if (useInstead) {
|
|
118401
118309
|
const details = chainDiagnosticMessages(
|
|
118402
118310
|
/*details*/
|
|
@@ -118404,7 +118312,7 @@ ${lanes.join("\n")}
|
|
|
118404
118312
|
Diagnostics.Use_0_instead,
|
|
118405
118313
|
useInstead
|
|
118406
118314
|
);
|
|
118407
|
-
const chain = chainDiagnosticMessages(details, message,
|
|
118315
|
+
const chain = chainDiagnosticMessages(details, message, ...args);
|
|
118408
118316
|
createDiagnosticForOption(
|
|
118409
118317
|
/*onKey*/
|
|
118410
118318
|
!value,
|
|
@@ -118421,10 +118329,7 @@ ${lanes.join("\n")}
|
|
|
118421
118329
|
/*option2*/
|
|
118422
118330
|
void 0,
|
|
118423
118331
|
message,
|
|
118424
|
-
|
|
118425
|
-
arg1,
|
|
118426
|
-
arg2,
|
|
118427
|
-
arg3
|
|
118332
|
+
...args
|
|
118428
118333
|
);
|
|
118429
118334
|
}
|
|
118430
118335
|
}
|
|
@@ -118477,8 +118382,8 @@ ${lanes.join("\n")}
|
|
|
118477
118382
|
});
|
|
118478
118383
|
}
|
|
118479
118384
|
function verifyDeprecatedProjectReference(ref, parentFile, index) {
|
|
118480
|
-
function createDiagnostic(_name, _value, _useInstead, message,
|
|
118481
|
-
createDiagnosticForReference(parentFile, index, message,
|
|
118385
|
+
function createDiagnostic(_name, _value, _useInstead, message, ...args) {
|
|
118386
|
+
createDiagnosticForReference(parentFile, index, message, ...args);
|
|
118482
118387
|
}
|
|
118483
118388
|
checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
|
|
118484
118389
|
if (ref.prepend) {
|
|
@@ -118660,7 +118565,7 @@ ${lanes.join("\n")}
|
|
|
118660
118565
|
}
|
|
118661
118566
|
});
|
|
118662
118567
|
}
|
|
118663
|
-
function createDiagnosticForOptionPathKeyValue(key, valueIndex, message,
|
|
118568
|
+
function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
|
|
118664
118569
|
let needCompilerDiagnostic = true;
|
|
118665
118570
|
const pathsSyntax = getOptionPathsSyntax();
|
|
118666
118571
|
for (const pathProp of pathsSyntax) {
|
|
@@ -118668,17 +118573,17 @@ ${lanes.join("\n")}
|
|
|
118668
118573
|
for (const keyProps of getPropertyAssignment(pathProp.initializer, key)) {
|
|
118669
118574
|
const initializer = keyProps.initializer;
|
|
118670
118575
|
if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
|
|
118671
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message,
|
|
118576
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
|
|
118672
118577
|
needCompilerDiagnostic = false;
|
|
118673
118578
|
}
|
|
118674
118579
|
}
|
|
118675
118580
|
}
|
|
118676
118581
|
}
|
|
118677
118582
|
if (needCompilerDiagnostic) {
|
|
118678
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
118583
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
118679
118584
|
}
|
|
118680
118585
|
}
|
|
118681
|
-
function createDiagnosticForOptionPaths(onKey, key, message,
|
|
118586
|
+
function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
|
|
118682
118587
|
let needCompilerDiagnostic = true;
|
|
118683
118588
|
const pathsSyntax = getOptionPathsSyntax();
|
|
118684
118589
|
for (const pathProp of pathsSyntax) {
|
|
@@ -118689,13 +118594,13 @@ ${lanes.join("\n")}
|
|
|
118689
118594
|
/*key2*/
|
|
118690
118595
|
void 0,
|
|
118691
118596
|
message,
|
|
118692
|
-
|
|
118597
|
+
...args
|
|
118693
118598
|
)) {
|
|
118694
118599
|
needCompilerDiagnostic = false;
|
|
118695
118600
|
}
|
|
118696
118601
|
}
|
|
118697
118602
|
if (needCompilerDiagnostic) {
|
|
118698
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
118603
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
118699
118604
|
}
|
|
118700
118605
|
}
|
|
118701
118606
|
function getOptionsSyntaxByName(name) {
|
|
@@ -118725,7 +118630,7 @@ ${lanes.join("\n")}
|
|
|
118725
118630
|
option3
|
|
118726
118631
|
);
|
|
118727
118632
|
}
|
|
118728
|
-
function createOptionValueDiagnostic(option1, message,
|
|
118633
|
+
function createOptionValueDiagnostic(option1, message, ...args) {
|
|
118729
118634
|
createDiagnosticForOption(
|
|
118730
118635
|
/*onKey*/
|
|
118731
118636
|
false,
|
|
@@ -118733,29 +118638,28 @@ ${lanes.join("\n")}
|
|
|
118733
118638
|
/*option2*/
|
|
118734
118639
|
void 0,
|
|
118735
118640
|
message,
|
|
118736
|
-
|
|
118737
|
-
arg1
|
|
118641
|
+
...args
|
|
118738
118642
|
);
|
|
118739
118643
|
}
|
|
118740
|
-
function createDiagnosticForReference(sourceFile, index, message,
|
|
118644
|
+
function createDiagnosticForReference(sourceFile, index, message, ...args) {
|
|
118741
118645
|
const referencesSyntax = firstDefined(
|
|
118742
118646
|
getTsConfigPropArray(sourceFile || options.configFile, "references"),
|
|
118743
118647
|
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
118744
118648
|
);
|
|
118745
118649
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
|
118746
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message,
|
|
118650
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
|
|
118747
118651
|
} else {
|
|
118748
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
118652
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
118749
118653
|
}
|
|
118750
118654
|
}
|
|
118751
|
-
function createDiagnosticForOption(onKey, option1, option2, message,
|
|
118655
|
+
function createDiagnosticForOption(onKey, option1, option2, message, ...args) {
|
|
118752
118656
|
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
|
118753
|
-
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message,
|
|
118657
|
+
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, ...args);
|
|
118754
118658
|
if (needCompilerDiagnostic) {
|
|
118755
118659
|
if ("messageText" in message) {
|
|
118756
118660
|
programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
|
|
118757
118661
|
} else {
|
|
118758
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
118662
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
118759
118663
|
}
|
|
118760
118664
|
}
|
|
118761
118665
|
}
|
|
@@ -118774,13 +118678,13 @@ ${lanes.join("\n")}
|
|
|
118774
118678
|
}
|
|
118775
118679
|
return _compilerOptionsObjectLiteralSyntax || void 0;
|
|
118776
118680
|
}
|
|
118777
|
-
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message,
|
|
118681
|
+
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
|
|
118778
118682
|
const props = getPropertyAssignment(objectLiteral, key1, key2);
|
|
118779
118683
|
for (const prop of props) {
|
|
118780
118684
|
if ("messageText" in message) {
|
|
118781
118685
|
programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
|
|
118782
118686
|
} else {
|
|
118783
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message,
|
|
118687
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
|
|
118784
118688
|
}
|
|
118785
118689
|
}
|
|
118786
118690
|
return !!props.length;
|
|
@@ -119118,7 +119022,6 @@ ${lanes.join("\n")}
|
|
|
119118
119022
|
"src/compiler/program.ts"() {
|
|
119119
119023
|
"use strict";
|
|
119120
119024
|
init_ts2();
|
|
119121
|
-
init_ts2();
|
|
119122
119025
|
init_ts_performance();
|
|
119123
119026
|
ForegroundColorEscapeSequences = /* @__PURE__ */ ((ForegroundColorEscapeSequences2) => {
|
|
119124
119027
|
ForegroundColorEscapeSequences2["Grey"] = "\x1B[90m";
|
|
@@ -119833,16 +119736,16 @@ ${lanes.join("\n")}
|
|
|
119833
119736
|
return emptyArray;
|
|
119834
119737
|
let buildInfoDirectory;
|
|
119835
119738
|
return diagnostics.map((diagnostic) => {
|
|
119836
|
-
const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram,
|
|
119739
|
+
const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPathInBuildInfoDirectory);
|
|
119837
119740
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
119838
119741
|
result.reportsDeprecated = diagnostic.reportDeprecated;
|
|
119839
119742
|
result.source = diagnostic.source;
|
|
119840
119743
|
result.skippedOn = diagnostic.skippedOn;
|
|
119841
119744
|
const { relatedInformation } = diagnostic;
|
|
119842
|
-
result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram,
|
|
119745
|
+
result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram, toPathInBuildInfoDirectory)) : [] : void 0;
|
|
119843
119746
|
return result;
|
|
119844
119747
|
});
|
|
119845
|
-
function
|
|
119748
|
+
function toPathInBuildInfoDirectory(path) {
|
|
119846
119749
|
buildInfoDirectory != null ? buildInfoDirectory : buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
|
|
119847
119750
|
return toPath(path, buildInfoDirectory, newProgram.getCanonicalFileName);
|
|
119848
119751
|
}
|
|
@@ -120745,7 +120648,7 @@ ${lanes.join("\n")}
|
|
|
120745
120648
|
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
120746
120649
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
120747
120650
|
let state;
|
|
120748
|
-
const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(
|
|
120651
|
+
const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(toPathInBuildInfoDirectory);
|
|
120749
120652
|
let filePathsSetList;
|
|
120750
120653
|
const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0;
|
|
120751
120654
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
@@ -120826,7 +120729,7 @@ ${lanes.join("\n")}
|
|
|
120826
120729
|
close: noop,
|
|
120827
120730
|
hasChangedEmitSignature: returnFalse
|
|
120828
120731
|
};
|
|
120829
|
-
function
|
|
120732
|
+
function toPathInBuildInfoDirectory(path) {
|
|
120830
120733
|
return toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
120831
120734
|
}
|
|
120832
120735
|
function toAbsolutePath(path) {
|
|
@@ -120908,7 +120811,6 @@ ${lanes.join("\n")}
|
|
|
120908
120811
|
"src/compiler/builder.ts"() {
|
|
120909
120812
|
"use strict";
|
|
120910
120813
|
init_ts2();
|
|
120911
|
-
init_ts2();
|
|
120912
120814
|
BuilderFileEmit = /* @__PURE__ */ ((BuilderFileEmit2) => {
|
|
120913
120815
|
BuilderFileEmit2[BuilderFileEmit2["None"] = 0] = "None";
|
|
120914
120816
|
BuilderFileEmit2[BuilderFileEmit2["Js"] = 1] = "Js";
|
|
@@ -121788,7 +121690,6 @@ ${lanes.join("\n")}
|
|
|
121788
121690
|
"src/compiler/resolutionCache.ts"() {
|
|
121789
121691
|
"use strict";
|
|
121790
121692
|
init_ts2();
|
|
121791
|
-
init_ts2();
|
|
121792
121693
|
}
|
|
121793
121694
|
});
|
|
121794
121695
|
|
|
@@ -121901,15 +121802,13 @@ ${lanes.join("\n")}
|
|
|
121901
121802
|
const nonNilFiles = filesInError.filter((fileInError) => fileInError !== void 0);
|
|
121902
121803
|
const distinctFileNamesWithLines = nonNilFiles.map((fileInError) => `${fileInError.fileName}:${fileInError.line}`).filter((value, index, self) => self.indexOf(value) === index);
|
|
121903
121804
|
const firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
|
|
121904
|
-
|
|
121905
|
-
|
|
121906
|
-
|
|
121907
|
-
|
|
121908
|
-
|
|
121909
|
-
|
|
121910
|
-
|
|
121911
|
-
distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length
|
|
121912
|
-
);
|
|
121805
|
+
let messageAndArgs;
|
|
121806
|
+
if (errorCount === 1) {
|
|
121807
|
+
messageAndArgs = filesInError[0] !== void 0 ? [Diagnostics.Found_1_error_in_0, firstFileReference] : [Diagnostics.Found_1_error];
|
|
121808
|
+
} else {
|
|
121809
|
+
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];
|
|
121810
|
+
}
|
|
121811
|
+
const d = createCompilerDiagnostic(...messageAndArgs);
|
|
121913
121812
|
const suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "";
|
|
121914
121813
|
return `${newLine}${flattenDiagnosticMessageText(d.messageText, newLine)}${newLine}${newLine}${suffix}`;
|
|
121915
121814
|
}
|
|
@@ -122119,15 +122018,15 @@ ${lanes.join("\n")}
|
|
|
122119
122018
|
toFileName(referencedResolvedRef.sourceFile.fileName, fileNameConvertor),
|
|
122120
122019
|
options.outFile ? "--outFile" : "--out"
|
|
122121
122020
|
);
|
|
122122
|
-
case 8 /* AutomaticTypeDirectiveFile */:
|
|
122021
|
+
case 8 /* AutomaticTypeDirectiveFile */: {
|
|
122022
|
+
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];
|
|
122123
122023
|
return chainDiagnosticMessages(
|
|
122124
122024
|
/*details*/
|
|
122125
122025
|
void 0,
|
|
122126
|
-
|
|
122127
|
-
reason.typeReference,
|
|
122128
|
-
reason.packageId && packageIdToString(reason.packageId)
|
|
122026
|
+
...messageAndArgs
|
|
122129
122027
|
);
|
|
122130
|
-
|
|
122028
|
+
}
|
|
122029
|
+
case 6 /* LibFile */: {
|
|
122131
122030
|
if (reason.index !== void 0)
|
|
122132
122031
|
return chainDiagnosticMessages(
|
|
122133
122032
|
/*details*/
|
|
@@ -122136,12 +122035,13 @@ ${lanes.join("\n")}
|
|
|
122136
122035
|
options.lib[reason.index]
|
|
122137
122036
|
);
|
|
122138
122037
|
const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === getEmitScriptTarget(options) ? key : void 0);
|
|
122038
|
+
const messageAndArgs = target ? [Diagnostics.Default_library_for_target_0, target] : [Diagnostics.Default_library];
|
|
122139
122039
|
return chainDiagnosticMessages(
|
|
122140
122040
|
/*details*/
|
|
122141
122041
|
void 0,
|
|
122142
|
-
|
|
122143
|
-
target
|
|
122042
|
+
...messageAndArgs
|
|
122144
122043
|
);
|
|
122044
|
+
}
|
|
122145
122045
|
default:
|
|
122146
122046
|
Debug.assertNever(reason);
|
|
122147
122047
|
}
|
|
@@ -123183,7 +123083,6 @@ ${lanes.join("\n")}
|
|
|
123183
123083
|
"src/compiler/watchPublic.ts"() {
|
|
123184
123084
|
"use strict";
|
|
123185
123085
|
init_ts2();
|
|
123186
|
-
init_ts2();
|
|
123187
123086
|
}
|
|
123188
123087
|
});
|
|
123189
123088
|
|
|
@@ -125203,7 +125102,6 @@ ${lanes.join("\n")}
|
|
|
125203
125102
|
"src/compiler/tsbuildPublic.ts"() {
|
|
125204
125103
|
"use strict";
|
|
125205
125104
|
init_ts2();
|
|
125206
|
-
init_ts2();
|
|
125207
125105
|
init_ts_performance();
|
|
125208
125106
|
minimumDate = /* @__PURE__ */ new Date(-864e13);
|
|
125209
125107
|
maximumDate = /* @__PURE__ */ new Date(864e13);
|
|
@@ -127279,9 +127177,6 @@ ${lanes.join("\n")}
|
|
|
127279
127177
|
const { types, checker } = type;
|
|
127280
127178
|
return types.length === 2 && (areIntersectedTypesAvoidingStringReduction(checker, types[0], types[1]) || areIntersectedTypesAvoidingStringReduction(checker, types[1], types[0]));
|
|
127281
127179
|
}
|
|
127282
|
-
function isPunctuation(kind) {
|
|
127283
|
-
return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */;
|
|
127284
|
-
}
|
|
127285
127180
|
function isInsideTemplateLiteral(node, position, sourceFile) {
|
|
127286
127181
|
return isTemplateLiteralKind(node.kind) && (node.getStart(sourceFile) < position && position < node.end) || !!node.isUnterminated && position === node.end;
|
|
127287
127182
|
}
|
|
@@ -131758,7 +131653,6 @@ ${lanes.join("\n")}
|
|
|
131758
131653
|
"src/services/sourcemaps.ts"() {
|
|
131759
131654
|
"use strict";
|
|
131760
131655
|
init_ts4();
|
|
131761
|
-
init_ts4();
|
|
131762
131656
|
base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+\/=]+)$)?/;
|
|
131763
131657
|
}
|
|
131764
131658
|
});
|
|
@@ -132988,6 +132882,241 @@ ${lanes.join("\n")}
|
|
|
132988
132882
|
}
|
|
132989
132883
|
});
|
|
132990
132884
|
|
|
132885
|
+
// src/services/classifier2020.ts
|
|
132886
|
+
function getSemanticClassifications2(program, cancellationToken, sourceFile, span) {
|
|
132887
|
+
const classifications = getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span);
|
|
132888
|
+
Debug.assert(classifications.spans.length % 3 === 0);
|
|
132889
|
+
const dense = classifications.spans;
|
|
132890
|
+
const result = [];
|
|
132891
|
+
for (let i = 0; i < dense.length; i += 3) {
|
|
132892
|
+
result.push({
|
|
132893
|
+
textSpan: createTextSpan(dense[i], dense[i + 1]),
|
|
132894
|
+
classificationType: dense[i + 2]
|
|
132895
|
+
});
|
|
132896
|
+
}
|
|
132897
|
+
return result;
|
|
132898
|
+
}
|
|
132899
|
+
function getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span) {
|
|
132900
|
+
return {
|
|
132901
|
+
spans: getSemanticTokens(program, sourceFile, span, cancellationToken),
|
|
132902
|
+
endOfLineState: 0 /* None */
|
|
132903
|
+
};
|
|
132904
|
+
}
|
|
132905
|
+
function getSemanticTokens(program, sourceFile, span, cancellationToken) {
|
|
132906
|
+
const resultTokens = [];
|
|
132907
|
+
const collector = (node, typeIdx, modifierSet) => {
|
|
132908
|
+
resultTokens.push(node.getStart(sourceFile), node.getWidth(sourceFile), (typeIdx + 1 << 8 /* typeOffset */) + modifierSet);
|
|
132909
|
+
};
|
|
132910
|
+
if (program && sourceFile) {
|
|
132911
|
+
collectTokens(program, sourceFile, span, collector, cancellationToken);
|
|
132912
|
+
}
|
|
132913
|
+
return resultTokens;
|
|
132914
|
+
}
|
|
132915
|
+
function collectTokens(program, sourceFile, span, collector, cancellationToken) {
|
|
132916
|
+
const typeChecker = program.getTypeChecker();
|
|
132917
|
+
let inJSXElement = false;
|
|
132918
|
+
function visit(node) {
|
|
132919
|
+
switch (node.kind) {
|
|
132920
|
+
case 265 /* ModuleDeclaration */:
|
|
132921
|
+
case 261 /* ClassDeclaration */:
|
|
132922
|
+
case 262 /* InterfaceDeclaration */:
|
|
132923
|
+
case 260 /* FunctionDeclaration */:
|
|
132924
|
+
case 229 /* ClassExpression */:
|
|
132925
|
+
case 216 /* FunctionExpression */:
|
|
132926
|
+
case 217 /* ArrowFunction */:
|
|
132927
|
+
cancellationToken.throwIfCancellationRequested();
|
|
132928
|
+
}
|
|
132929
|
+
if (!node || !textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) {
|
|
132930
|
+
return;
|
|
132931
|
+
}
|
|
132932
|
+
const prevInJSXElement = inJSXElement;
|
|
132933
|
+
if (isJsxElement(node) || isJsxSelfClosingElement(node)) {
|
|
132934
|
+
inJSXElement = true;
|
|
132935
|
+
}
|
|
132936
|
+
if (isJsxExpression(node)) {
|
|
132937
|
+
inJSXElement = false;
|
|
132938
|
+
}
|
|
132939
|
+
if (isIdentifier(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) {
|
|
132940
|
+
let symbol = typeChecker.getSymbolAtLocation(node);
|
|
132941
|
+
if (symbol) {
|
|
132942
|
+
if (symbol.flags & 2097152 /* Alias */) {
|
|
132943
|
+
symbol = typeChecker.getAliasedSymbol(symbol);
|
|
132944
|
+
}
|
|
132945
|
+
let typeIdx = classifySymbol2(symbol, getMeaningFromLocation(node));
|
|
132946
|
+
if (typeIdx !== void 0) {
|
|
132947
|
+
let modifierSet = 0;
|
|
132948
|
+
if (node.parent) {
|
|
132949
|
+
const parentIsDeclaration = isBindingElement(node.parent) || tokenFromDeclarationMapping.get(node.parent.kind) === typeIdx;
|
|
132950
|
+
if (parentIsDeclaration && node.parent.name === node) {
|
|
132951
|
+
modifierSet = 1 << 0 /* declaration */;
|
|
132952
|
+
}
|
|
132953
|
+
}
|
|
132954
|
+
if (typeIdx === 6 /* parameter */ && isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
|
|
132955
|
+
typeIdx = 9 /* property */;
|
|
132956
|
+
}
|
|
132957
|
+
typeIdx = reclassifyByType(typeChecker, node, typeIdx);
|
|
132958
|
+
const decl = symbol.valueDeclaration;
|
|
132959
|
+
if (decl) {
|
|
132960
|
+
const modifiers = getCombinedModifierFlags(decl);
|
|
132961
|
+
const nodeFlags = getCombinedNodeFlags(decl);
|
|
132962
|
+
if (modifiers & 32 /* Static */) {
|
|
132963
|
+
modifierSet |= 1 << 1 /* static */;
|
|
132964
|
+
}
|
|
132965
|
+
if (modifiers & 512 /* Async */) {
|
|
132966
|
+
modifierSet |= 1 << 2 /* async */;
|
|
132967
|
+
}
|
|
132968
|
+
if (typeIdx !== 0 /* class */ && typeIdx !== 2 /* interface */) {
|
|
132969
|
+
if (modifiers & 64 /* Readonly */ || nodeFlags & 2 /* Const */ || symbol.getFlags() & 8 /* EnumMember */) {
|
|
132970
|
+
modifierSet |= 1 << 3 /* readonly */;
|
|
132971
|
+
}
|
|
132972
|
+
}
|
|
132973
|
+
if ((typeIdx === 7 /* variable */ || typeIdx === 10 /* function */) && isLocalDeclaration(decl, sourceFile)) {
|
|
132974
|
+
modifierSet |= 1 << 5 /* local */;
|
|
132975
|
+
}
|
|
132976
|
+
if (program.isSourceFileDefaultLibrary(decl.getSourceFile())) {
|
|
132977
|
+
modifierSet |= 1 << 4 /* defaultLibrary */;
|
|
132978
|
+
}
|
|
132979
|
+
} else if (symbol.declarations && symbol.declarations.some((d) => program.isSourceFileDefaultLibrary(d.getSourceFile()))) {
|
|
132980
|
+
modifierSet |= 1 << 4 /* defaultLibrary */;
|
|
132981
|
+
}
|
|
132982
|
+
collector(node, typeIdx, modifierSet);
|
|
132983
|
+
}
|
|
132984
|
+
}
|
|
132985
|
+
}
|
|
132986
|
+
forEachChild(node, visit);
|
|
132987
|
+
inJSXElement = prevInJSXElement;
|
|
132988
|
+
}
|
|
132989
|
+
visit(sourceFile);
|
|
132990
|
+
}
|
|
132991
|
+
function classifySymbol2(symbol, meaning) {
|
|
132992
|
+
const flags = symbol.getFlags();
|
|
132993
|
+
if (flags & 32 /* Class */) {
|
|
132994
|
+
return 0 /* class */;
|
|
132995
|
+
} else if (flags & 384 /* Enum */) {
|
|
132996
|
+
return 1 /* enum */;
|
|
132997
|
+
} else if (flags & 524288 /* TypeAlias */) {
|
|
132998
|
+
return 5 /* type */;
|
|
132999
|
+
} else if (flags & 64 /* Interface */) {
|
|
133000
|
+
if (meaning & 2 /* Type */) {
|
|
133001
|
+
return 2 /* interface */;
|
|
133002
|
+
}
|
|
133003
|
+
} else if (flags & 262144 /* TypeParameter */) {
|
|
133004
|
+
return 4 /* typeParameter */;
|
|
133005
|
+
}
|
|
133006
|
+
let decl = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0];
|
|
133007
|
+
if (decl && isBindingElement(decl)) {
|
|
133008
|
+
decl = getDeclarationForBindingElement(decl);
|
|
133009
|
+
}
|
|
133010
|
+
return decl && tokenFromDeclarationMapping.get(decl.kind);
|
|
133011
|
+
}
|
|
133012
|
+
function reclassifyByType(typeChecker, node, typeIdx) {
|
|
133013
|
+
if (typeIdx === 7 /* variable */ || typeIdx === 9 /* property */ || typeIdx === 6 /* parameter */) {
|
|
133014
|
+
const type = typeChecker.getTypeAtLocation(node);
|
|
133015
|
+
if (type) {
|
|
133016
|
+
const test = (condition) => {
|
|
133017
|
+
return condition(type) || type.isUnion() && type.types.some(condition);
|
|
133018
|
+
};
|
|
133019
|
+
if (typeIdx !== 6 /* parameter */ && test((t) => t.getConstructSignatures().length > 0)) {
|
|
133020
|
+
return 0 /* class */;
|
|
133021
|
+
}
|
|
133022
|
+
if (test((t) => t.getCallSignatures().length > 0) && !test((t) => t.getProperties().length > 0) || isExpressionInCallExpression(node)) {
|
|
133023
|
+
return typeIdx === 9 /* property */ ? 11 /* member */ : 10 /* function */;
|
|
133024
|
+
}
|
|
133025
|
+
}
|
|
133026
|
+
}
|
|
133027
|
+
return typeIdx;
|
|
133028
|
+
}
|
|
133029
|
+
function isLocalDeclaration(decl, sourceFile) {
|
|
133030
|
+
if (isBindingElement(decl)) {
|
|
133031
|
+
decl = getDeclarationForBindingElement(decl);
|
|
133032
|
+
}
|
|
133033
|
+
if (isVariableDeclaration(decl)) {
|
|
133034
|
+
return (!isSourceFile(decl.parent.parent.parent) || isCatchClause(decl.parent)) && decl.getSourceFile() === sourceFile;
|
|
133035
|
+
} else if (isFunctionDeclaration(decl)) {
|
|
133036
|
+
return !isSourceFile(decl.parent) && decl.getSourceFile() === sourceFile;
|
|
133037
|
+
}
|
|
133038
|
+
return false;
|
|
133039
|
+
}
|
|
133040
|
+
function getDeclarationForBindingElement(element) {
|
|
133041
|
+
while (true) {
|
|
133042
|
+
if (isBindingElement(element.parent.parent)) {
|
|
133043
|
+
element = element.parent.parent;
|
|
133044
|
+
} else {
|
|
133045
|
+
return element.parent.parent;
|
|
133046
|
+
}
|
|
133047
|
+
}
|
|
133048
|
+
}
|
|
133049
|
+
function inImportClause(node) {
|
|
133050
|
+
const parent2 = node.parent;
|
|
133051
|
+
return parent2 && (isImportClause(parent2) || isImportSpecifier(parent2) || isNamespaceImport(parent2));
|
|
133052
|
+
}
|
|
133053
|
+
function isExpressionInCallExpression(node) {
|
|
133054
|
+
while (isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
|
|
133055
|
+
node = node.parent;
|
|
133056
|
+
}
|
|
133057
|
+
return isCallExpression(node.parent) && node.parent.expression === node;
|
|
133058
|
+
}
|
|
133059
|
+
function isRightSideOfQualifiedNameOrPropertyAccess2(node) {
|
|
133060
|
+
return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node;
|
|
133061
|
+
}
|
|
133062
|
+
var TokenEncodingConsts, TokenType, TokenModifier, tokenFromDeclarationMapping;
|
|
133063
|
+
var init_classifier2020 = __esm({
|
|
133064
|
+
"src/services/classifier2020.ts"() {
|
|
133065
|
+
"use strict";
|
|
133066
|
+
init_ts4();
|
|
133067
|
+
TokenEncodingConsts = /* @__PURE__ */ ((TokenEncodingConsts2) => {
|
|
133068
|
+
TokenEncodingConsts2[TokenEncodingConsts2["typeOffset"] = 8] = "typeOffset";
|
|
133069
|
+
TokenEncodingConsts2[TokenEncodingConsts2["modifierMask"] = 255] = "modifierMask";
|
|
133070
|
+
return TokenEncodingConsts2;
|
|
133071
|
+
})(TokenEncodingConsts || {});
|
|
133072
|
+
TokenType = /* @__PURE__ */ ((TokenType2) => {
|
|
133073
|
+
TokenType2[TokenType2["class"] = 0] = "class";
|
|
133074
|
+
TokenType2[TokenType2["enum"] = 1] = "enum";
|
|
133075
|
+
TokenType2[TokenType2["interface"] = 2] = "interface";
|
|
133076
|
+
TokenType2[TokenType2["namespace"] = 3] = "namespace";
|
|
133077
|
+
TokenType2[TokenType2["typeParameter"] = 4] = "typeParameter";
|
|
133078
|
+
TokenType2[TokenType2["type"] = 5] = "type";
|
|
133079
|
+
TokenType2[TokenType2["parameter"] = 6] = "parameter";
|
|
133080
|
+
TokenType2[TokenType2["variable"] = 7] = "variable";
|
|
133081
|
+
TokenType2[TokenType2["enumMember"] = 8] = "enumMember";
|
|
133082
|
+
TokenType2[TokenType2["property"] = 9] = "property";
|
|
133083
|
+
TokenType2[TokenType2["function"] = 10] = "function";
|
|
133084
|
+
TokenType2[TokenType2["member"] = 11] = "member";
|
|
133085
|
+
return TokenType2;
|
|
133086
|
+
})(TokenType || {});
|
|
133087
|
+
TokenModifier = /* @__PURE__ */ ((TokenModifier2) => {
|
|
133088
|
+
TokenModifier2[TokenModifier2["declaration"] = 0] = "declaration";
|
|
133089
|
+
TokenModifier2[TokenModifier2["static"] = 1] = "static";
|
|
133090
|
+
TokenModifier2[TokenModifier2["async"] = 2] = "async";
|
|
133091
|
+
TokenModifier2[TokenModifier2["readonly"] = 3] = "readonly";
|
|
133092
|
+
TokenModifier2[TokenModifier2["defaultLibrary"] = 4] = "defaultLibrary";
|
|
133093
|
+
TokenModifier2[TokenModifier2["local"] = 5] = "local";
|
|
133094
|
+
return TokenModifier2;
|
|
133095
|
+
})(TokenModifier || {});
|
|
133096
|
+
tokenFromDeclarationMapping = /* @__PURE__ */ new Map([
|
|
133097
|
+
[258 /* VariableDeclaration */, 7 /* variable */],
|
|
133098
|
+
[167 /* Parameter */, 6 /* parameter */],
|
|
133099
|
+
[170 /* PropertyDeclaration */, 9 /* property */],
|
|
133100
|
+
[265 /* ModuleDeclaration */, 3 /* namespace */],
|
|
133101
|
+
[264 /* EnumDeclaration */, 1 /* enum */],
|
|
133102
|
+
[303 /* EnumMember */, 8 /* enumMember */],
|
|
133103
|
+
[261 /* ClassDeclaration */, 0 /* class */],
|
|
133104
|
+
[172 /* MethodDeclaration */, 11 /* member */],
|
|
133105
|
+
[260 /* FunctionDeclaration */, 10 /* function */],
|
|
133106
|
+
[216 /* FunctionExpression */, 10 /* function */],
|
|
133107
|
+
[171 /* MethodSignature */, 11 /* member */],
|
|
133108
|
+
[175 /* GetAccessor */, 9 /* property */],
|
|
133109
|
+
[176 /* SetAccessor */, 9 /* property */],
|
|
133110
|
+
[169 /* PropertySignature */, 9 /* property */],
|
|
133111
|
+
[262 /* InterfaceDeclaration */, 2 /* interface */],
|
|
133112
|
+
[263 /* TypeAliasDeclaration */, 5 /* type */],
|
|
133113
|
+
[166 /* TypeParameter */, 4 /* typeParameter */],
|
|
133114
|
+
[300 /* PropertyAssignment */, 9 /* property */],
|
|
133115
|
+
[301 /* ShorthandPropertyAssignment */, 9 /* property */]
|
|
133116
|
+
]);
|
|
133117
|
+
}
|
|
133118
|
+
});
|
|
133119
|
+
|
|
132991
133120
|
// src/services/services.ts
|
|
132992
133121
|
function createNode(kind, pos, end, parent2) {
|
|
132993
133122
|
const node = isNodeKind(kind) ? new NodeObject(kind, pos, end) : kind === 79 /* Identifier */ ? new IdentifierObject(79 /* Identifier */, pos, end) : kind === 80 /* PrivateIdentifier */ ? new PrivateIdentifierObject(80 /* PrivateIdentifier */, pos, end) : new TokenObject(kind, pos, end);
|
|
@@ -133754,7 +133883,7 @@ ${lanes.join("\n")}
|
|
|
133754
133883
|
synchronizeHostData();
|
|
133755
133884
|
const responseFormat = format || "original" /* Original */;
|
|
133756
133885
|
if (responseFormat === "2020" /* TwentyTwenty */) {
|
|
133757
|
-
return
|
|
133886
|
+
return getSemanticClassifications2(program, cancellationToken, getValidSourceFile(fileName), span);
|
|
133758
133887
|
} else {
|
|
133759
133888
|
return getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
|
|
133760
133889
|
}
|
|
@@ -133765,7 +133894,7 @@ ${lanes.join("\n")}
|
|
|
133765
133894
|
if (responseFormat === "original" /* Original */) {
|
|
133766
133895
|
return getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
|
|
133767
133896
|
} else {
|
|
133768
|
-
return
|
|
133897
|
+
return getEncodedSemanticClassifications2(program, cancellationToken, getValidSourceFile(fileName), span);
|
|
133769
133898
|
}
|
|
133770
133899
|
}
|
|
133771
133900
|
function getSyntacticClassifications2(fileName, span) {
|
|
@@ -134425,9 +134554,10 @@ ${lanes.join("\n")}
|
|
|
134425
134554
|
"src/services/services.ts"() {
|
|
134426
134555
|
"use strict";
|
|
134427
134556
|
init_ts4();
|
|
134428
|
-
init_ts4();
|
|
134429
134557
|
init_ts_NavigateTo();
|
|
134430
134558
|
init_ts_NavigationBar();
|
|
134559
|
+
init_classifier();
|
|
134560
|
+
init_classifier2020();
|
|
134431
134561
|
servicesVersion = "0.8";
|
|
134432
134562
|
NodeObject = class {
|
|
134433
134563
|
constructor(kind, pos, end) {
|
|
@@ -137029,241 +137159,6 @@ ${lanes.join("\n")}
|
|
|
137029
137159
|
}
|
|
137030
137160
|
});
|
|
137031
137161
|
|
|
137032
|
-
// src/services/classifier2020.ts
|
|
137033
|
-
function getSemanticClassifications2(program, cancellationToken, sourceFile, span) {
|
|
137034
|
-
const classifications = getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span);
|
|
137035
|
-
Debug.assert(classifications.spans.length % 3 === 0);
|
|
137036
|
-
const dense = classifications.spans;
|
|
137037
|
-
const result = [];
|
|
137038
|
-
for (let i = 0; i < dense.length; i += 3) {
|
|
137039
|
-
result.push({
|
|
137040
|
-
textSpan: createTextSpan(dense[i], dense[i + 1]),
|
|
137041
|
-
classificationType: dense[i + 2]
|
|
137042
|
-
});
|
|
137043
|
-
}
|
|
137044
|
-
return result;
|
|
137045
|
-
}
|
|
137046
|
-
function getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span) {
|
|
137047
|
-
return {
|
|
137048
|
-
spans: getSemanticTokens(program, sourceFile, span, cancellationToken),
|
|
137049
|
-
endOfLineState: 0 /* None */
|
|
137050
|
-
};
|
|
137051
|
-
}
|
|
137052
|
-
function getSemanticTokens(program, sourceFile, span, cancellationToken) {
|
|
137053
|
-
const resultTokens = [];
|
|
137054
|
-
const collector = (node, typeIdx, modifierSet) => {
|
|
137055
|
-
resultTokens.push(node.getStart(sourceFile), node.getWidth(sourceFile), (typeIdx + 1 << 8 /* typeOffset */) + modifierSet);
|
|
137056
|
-
};
|
|
137057
|
-
if (program && sourceFile) {
|
|
137058
|
-
collectTokens(program, sourceFile, span, collector, cancellationToken);
|
|
137059
|
-
}
|
|
137060
|
-
return resultTokens;
|
|
137061
|
-
}
|
|
137062
|
-
function collectTokens(program, sourceFile, span, collector, cancellationToken) {
|
|
137063
|
-
const typeChecker = program.getTypeChecker();
|
|
137064
|
-
let inJSXElement = false;
|
|
137065
|
-
function visit(node) {
|
|
137066
|
-
switch (node.kind) {
|
|
137067
|
-
case 265 /* ModuleDeclaration */:
|
|
137068
|
-
case 261 /* ClassDeclaration */:
|
|
137069
|
-
case 262 /* InterfaceDeclaration */:
|
|
137070
|
-
case 260 /* FunctionDeclaration */:
|
|
137071
|
-
case 229 /* ClassExpression */:
|
|
137072
|
-
case 216 /* FunctionExpression */:
|
|
137073
|
-
case 217 /* ArrowFunction */:
|
|
137074
|
-
cancellationToken.throwIfCancellationRequested();
|
|
137075
|
-
}
|
|
137076
|
-
if (!node || !textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) {
|
|
137077
|
-
return;
|
|
137078
|
-
}
|
|
137079
|
-
const prevInJSXElement = inJSXElement;
|
|
137080
|
-
if (isJsxElement(node) || isJsxSelfClosingElement(node)) {
|
|
137081
|
-
inJSXElement = true;
|
|
137082
|
-
}
|
|
137083
|
-
if (isJsxExpression(node)) {
|
|
137084
|
-
inJSXElement = false;
|
|
137085
|
-
}
|
|
137086
|
-
if (isIdentifier(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) {
|
|
137087
|
-
let symbol = typeChecker.getSymbolAtLocation(node);
|
|
137088
|
-
if (symbol) {
|
|
137089
|
-
if (symbol.flags & 2097152 /* Alias */) {
|
|
137090
|
-
symbol = typeChecker.getAliasedSymbol(symbol);
|
|
137091
|
-
}
|
|
137092
|
-
let typeIdx = classifySymbol2(symbol, getMeaningFromLocation(node));
|
|
137093
|
-
if (typeIdx !== void 0) {
|
|
137094
|
-
let modifierSet = 0;
|
|
137095
|
-
if (node.parent) {
|
|
137096
|
-
const parentIsDeclaration = isBindingElement(node.parent) || tokenFromDeclarationMapping.get(node.parent.kind) === typeIdx;
|
|
137097
|
-
if (parentIsDeclaration && node.parent.name === node) {
|
|
137098
|
-
modifierSet = 1 << 0 /* declaration */;
|
|
137099
|
-
}
|
|
137100
|
-
}
|
|
137101
|
-
if (typeIdx === 6 /* parameter */ && isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
|
|
137102
|
-
typeIdx = 9 /* property */;
|
|
137103
|
-
}
|
|
137104
|
-
typeIdx = reclassifyByType(typeChecker, node, typeIdx);
|
|
137105
|
-
const decl = symbol.valueDeclaration;
|
|
137106
|
-
if (decl) {
|
|
137107
|
-
const modifiers = getCombinedModifierFlags(decl);
|
|
137108
|
-
const nodeFlags = getCombinedNodeFlags(decl);
|
|
137109
|
-
if (modifiers & 32 /* Static */) {
|
|
137110
|
-
modifierSet |= 1 << 1 /* static */;
|
|
137111
|
-
}
|
|
137112
|
-
if (modifiers & 512 /* Async */) {
|
|
137113
|
-
modifierSet |= 1 << 2 /* async */;
|
|
137114
|
-
}
|
|
137115
|
-
if (typeIdx !== 0 /* class */ && typeIdx !== 2 /* interface */) {
|
|
137116
|
-
if (modifiers & 64 /* Readonly */ || nodeFlags & 2 /* Const */ || symbol.getFlags() & 8 /* EnumMember */) {
|
|
137117
|
-
modifierSet |= 1 << 3 /* readonly */;
|
|
137118
|
-
}
|
|
137119
|
-
}
|
|
137120
|
-
if ((typeIdx === 7 /* variable */ || typeIdx === 10 /* function */) && isLocalDeclaration(decl, sourceFile)) {
|
|
137121
|
-
modifierSet |= 1 << 5 /* local */;
|
|
137122
|
-
}
|
|
137123
|
-
if (program.isSourceFileDefaultLibrary(decl.getSourceFile())) {
|
|
137124
|
-
modifierSet |= 1 << 4 /* defaultLibrary */;
|
|
137125
|
-
}
|
|
137126
|
-
} else if (symbol.declarations && symbol.declarations.some((d) => program.isSourceFileDefaultLibrary(d.getSourceFile()))) {
|
|
137127
|
-
modifierSet |= 1 << 4 /* defaultLibrary */;
|
|
137128
|
-
}
|
|
137129
|
-
collector(node, typeIdx, modifierSet);
|
|
137130
|
-
}
|
|
137131
|
-
}
|
|
137132
|
-
}
|
|
137133
|
-
forEachChild(node, visit);
|
|
137134
|
-
inJSXElement = prevInJSXElement;
|
|
137135
|
-
}
|
|
137136
|
-
visit(sourceFile);
|
|
137137
|
-
}
|
|
137138
|
-
function classifySymbol2(symbol, meaning) {
|
|
137139
|
-
const flags = symbol.getFlags();
|
|
137140
|
-
if (flags & 32 /* Class */) {
|
|
137141
|
-
return 0 /* class */;
|
|
137142
|
-
} else if (flags & 384 /* Enum */) {
|
|
137143
|
-
return 1 /* enum */;
|
|
137144
|
-
} else if (flags & 524288 /* TypeAlias */) {
|
|
137145
|
-
return 5 /* type */;
|
|
137146
|
-
} else if (flags & 64 /* Interface */) {
|
|
137147
|
-
if (meaning & 2 /* Type */) {
|
|
137148
|
-
return 2 /* interface */;
|
|
137149
|
-
}
|
|
137150
|
-
} else if (flags & 262144 /* TypeParameter */) {
|
|
137151
|
-
return 4 /* typeParameter */;
|
|
137152
|
-
}
|
|
137153
|
-
let decl = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0];
|
|
137154
|
-
if (decl && isBindingElement(decl)) {
|
|
137155
|
-
decl = getDeclarationForBindingElement(decl);
|
|
137156
|
-
}
|
|
137157
|
-
return decl && tokenFromDeclarationMapping.get(decl.kind);
|
|
137158
|
-
}
|
|
137159
|
-
function reclassifyByType(typeChecker, node, typeIdx) {
|
|
137160
|
-
if (typeIdx === 7 /* variable */ || typeIdx === 9 /* property */ || typeIdx === 6 /* parameter */) {
|
|
137161
|
-
const type = typeChecker.getTypeAtLocation(node);
|
|
137162
|
-
if (type) {
|
|
137163
|
-
const test = (condition) => {
|
|
137164
|
-
return condition(type) || type.isUnion() && type.types.some(condition);
|
|
137165
|
-
};
|
|
137166
|
-
if (typeIdx !== 6 /* parameter */ && test((t) => t.getConstructSignatures().length > 0)) {
|
|
137167
|
-
return 0 /* class */;
|
|
137168
|
-
}
|
|
137169
|
-
if (test((t) => t.getCallSignatures().length > 0) && !test((t) => t.getProperties().length > 0) || isExpressionInCallExpression(node)) {
|
|
137170
|
-
return typeIdx === 9 /* property */ ? 11 /* member */ : 10 /* function */;
|
|
137171
|
-
}
|
|
137172
|
-
}
|
|
137173
|
-
}
|
|
137174
|
-
return typeIdx;
|
|
137175
|
-
}
|
|
137176
|
-
function isLocalDeclaration(decl, sourceFile) {
|
|
137177
|
-
if (isBindingElement(decl)) {
|
|
137178
|
-
decl = getDeclarationForBindingElement(decl);
|
|
137179
|
-
}
|
|
137180
|
-
if (isVariableDeclaration(decl)) {
|
|
137181
|
-
return (!isSourceFile(decl.parent.parent.parent) || isCatchClause(decl.parent)) && decl.getSourceFile() === sourceFile;
|
|
137182
|
-
} else if (isFunctionDeclaration(decl)) {
|
|
137183
|
-
return !isSourceFile(decl.parent) && decl.getSourceFile() === sourceFile;
|
|
137184
|
-
}
|
|
137185
|
-
return false;
|
|
137186
|
-
}
|
|
137187
|
-
function getDeclarationForBindingElement(element) {
|
|
137188
|
-
while (true) {
|
|
137189
|
-
if (isBindingElement(element.parent.parent)) {
|
|
137190
|
-
element = element.parent.parent;
|
|
137191
|
-
} else {
|
|
137192
|
-
return element.parent.parent;
|
|
137193
|
-
}
|
|
137194
|
-
}
|
|
137195
|
-
}
|
|
137196
|
-
function inImportClause(node) {
|
|
137197
|
-
const parent2 = node.parent;
|
|
137198
|
-
return parent2 && (isImportClause(parent2) || isImportSpecifier(parent2) || isNamespaceImport(parent2));
|
|
137199
|
-
}
|
|
137200
|
-
function isExpressionInCallExpression(node) {
|
|
137201
|
-
while (isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
|
|
137202
|
-
node = node.parent;
|
|
137203
|
-
}
|
|
137204
|
-
return isCallExpression(node.parent) && node.parent.expression === node;
|
|
137205
|
-
}
|
|
137206
|
-
function isRightSideOfQualifiedNameOrPropertyAccess2(node) {
|
|
137207
|
-
return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node;
|
|
137208
|
-
}
|
|
137209
|
-
var TokenEncodingConsts, TokenType, TokenModifier, tokenFromDeclarationMapping;
|
|
137210
|
-
var init_classifier2020 = __esm({
|
|
137211
|
-
"src/services/classifier2020.ts"() {
|
|
137212
|
-
"use strict";
|
|
137213
|
-
init_ts4();
|
|
137214
|
-
TokenEncodingConsts = /* @__PURE__ */ ((TokenEncodingConsts2) => {
|
|
137215
|
-
TokenEncodingConsts2[TokenEncodingConsts2["typeOffset"] = 8] = "typeOffset";
|
|
137216
|
-
TokenEncodingConsts2[TokenEncodingConsts2["modifierMask"] = 255] = "modifierMask";
|
|
137217
|
-
return TokenEncodingConsts2;
|
|
137218
|
-
})(TokenEncodingConsts || {});
|
|
137219
|
-
TokenType = /* @__PURE__ */ ((TokenType2) => {
|
|
137220
|
-
TokenType2[TokenType2["class"] = 0] = "class";
|
|
137221
|
-
TokenType2[TokenType2["enum"] = 1] = "enum";
|
|
137222
|
-
TokenType2[TokenType2["interface"] = 2] = "interface";
|
|
137223
|
-
TokenType2[TokenType2["namespace"] = 3] = "namespace";
|
|
137224
|
-
TokenType2[TokenType2["typeParameter"] = 4] = "typeParameter";
|
|
137225
|
-
TokenType2[TokenType2["type"] = 5] = "type";
|
|
137226
|
-
TokenType2[TokenType2["parameter"] = 6] = "parameter";
|
|
137227
|
-
TokenType2[TokenType2["variable"] = 7] = "variable";
|
|
137228
|
-
TokenType2[TokenType2["enumMember"] = 8] = "enumMember";
|
|
137229
|
-
TokenType2[TokenType2["property"] = 9] = "property";
|
|
137230
|
-
TokenType2[TokenType2["function"] = 10] = "function";
|
|
137231
|
-
TokenType2[TokenType2["member"] = 11] = "member";
|
|
137232
|
-
return TokenType2;
|
|
137233
|
-
})(TokenType || {});
|
|
137234
|
-
TokenModifier = /* @__PURE__ */ ((TokenModifier2) => {
|
|
137235
|
-
TokenModifier2[TokenModifier2["declaration"] = 0] = "declaration";
|
|
137236
|
-
TokenModifier2[TokenModifier2["static"] = 1] = "static";
|
|
137237
|
-
TokenModifier2[TokenModifier2["async"] = 2] = "async";
|
|
137238
|
-
TokenModifier2[TokenModifier2["readonly"] = 3] = "readonly";
|
|
137239
|
-
TokenModifier2[TokenModifier2["defaultLibrary"] = 4] = "defaultLibrary";
|
|
137240
|
-
TokenModifier2[TokenModifier2["local"] = 5] = "local";
|
|
137241
|
-
return TokenModifier2;
|
|
137242
|
-
})(TokenModifier || {});
|
|
137243
|
-
tokenFromDeclarationMapping = /* @__PURE__ */ new Map([
|
|
137244
|
-
[258 /* VariableDeclaration */, 7 /* variable */],
|
|
137245
|
-
[167 /* Parameter */, 6 /* parameter */],
|
|
137246
|
-
[170 /* PropertyDeclaration */, 9 /* property */],
|
|
137247
|
-
[265 /* ModuleDeclaration */, 3 /* namespace */],
|
|
137248
|
-
[264 /* EnumDeclaration */, 1 /* enum */],
|
|
137249
|
-
[303 /* EnumMember */, 8 /* enumMember */],
|
|
137250
|
-
[261 /* ClassDeclaration */, 0 /* class */],
|
|
137251
|
-
[172 /* MethodDeclaration */, 11 /* member */],
|
|
137252
|
-
[260 /* FunctionDeclaration */, 10 /* function */],
|
|
137253
|
-
[216 /* FunctionExpression */, 10 /* function */],
|
|
137254
|
-
[171 /* MethodSignature */, 11 /* member */],
|
|
137255
|
-
[175 /* GetAccessor */, 9 /* property */],
|
|
137256
|
-
[176 /* SetAccessor */, 9 /* property */],
|
|
137257
|
-
[169 /* PropertySignature */, 9 /* property */],
|
|
137258
|
-
[262 /* InterfaceDeclaration */, 2 /* interface */],
|
|
137259
|
-
[263 /* TypeAliasDeclaration */, 5 /* type */],
|
|
137260
|
-
[166 /* TypeParameter */, 4 /* typeParameter */],
|
|
137261
|
-
[300 /* PropertyAssignment */, 9 /* property */],
|
|
137262
|
-
[301 /* ShorthandPropertyAssignment */, 9 /* property */]
|
|
137263
|
-
]);
|
|
137264
|
-
}
|
|
137265
|
-
});
|
|
137266
|
-
|
|
137267
137162
|
// src/services/_namespaces/ts.classifier.v2020.ts
|
|
137268
137163
|
var ts_classifier_v2020_exports = {};
|
|
137269
137164
|
__export(ts_classifier_v2020_exports, {
|
|
@@ -170372,7 +170267,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
170372
170267
|
serverHost: this.projectService.host,
|
|
170373
170268
|
session: this.projectService.session
|
|
170374
170269
|
};
|
|
170375
|
-
const pluginModule = pluginModuleFactory({ typescript:
|
|
170270
|
+
const pluginModule = pluginModuleFactory({ typescript: ts_exports2 });
|
|
170376
170271
|
const newLS = pluginModule.create(info);
|
|
170377
170272
|
for (const k of Object.keys(this.languageService)) {
|
|
170378
170273
|
if (!(k in newLS)) {
|
|
@@ -178704,8 +178599,8 @@ ${e.message}`;
|
|
|
178704
178599
|
});
|
|
178705
178600
|
|
|
178706
178601
|
// src/server/_namespaces/ts.ts
|
|
178707
|
-
var
|
|
178708
|
-
__export(
|
|
178602
|
+
var ts_exports2 = {};
|
|
178603
|
+
__export(ts_exports2, {
|
|
178709
178604
|
ANONYMOUS: () => ANONYMOUS,
|
|
178710
178605
|
AccessFlags: () => AccessFlags,
|
|
178711
178606
|
AssertionLevel: () => AssertionLevel,
|
|
@@ -179008,8 +178903,8 @@ ${e.message}`;
|
|
|
179008
178903
|
convertCompilerOptionsFromJson: () => convertCompilerOptionsFromJson,
|
|
179009
178904
|
convertJsonOption: () => convertJsonOption,
|
|
179010
178905
|
convertToBase64: () => convertToBase64,
|
|
178906
|
+
convertToJson: () => convertToJson,
|
|
179011
178907
|
convertToObject: () => convertToObject,
|
|
179012
|
-
convertToObjectWorker: () => convertToObjectWorker,
|
|
179013
178908
|
convertToOptionsWithAbsolutePaths: () => convertToOptionsWithAbsolutePaths,
|
|
179014
178909
|
convertToRelativePath: () => convertToRelativePath,
|
|
179015
178910
|
convertToTSConfig: () => convertToTSConfig,
|
|
@@ -180155,6 +180050,7 @@ ${e.message}`;
|
|
|
180155
180050
|
isJsxText: () => isJsxText,
|
|
180156
180051
|
isJumpStatementTarget: () => isJumpStatementTarget,
|
|
180157
180052
|
isKeyword: () => isKeyword,
|
|
180053
|
+
isKeywordOrPunctuation: () => isKeywordOrPunctuation,
|
|
180158
180054
|
isKnownSymbol: () => isKnownSymbol,
|
|
180159
180055
|
isLabelName: () => isLabelName,
|
|
180160
180056
|
isLabelOfLabeledStatement: () => isLabelOfLabeledStatement,
|
|
@@ -181062,8 +180958,8 @@ ${e.message}`;
|
|
|
181062
180958
|
});
|
|
181063
180959
|
|
|
181064
180960
|
// src/tsserverlibrary/_namespaces/ts.ts
|
|
181065
|
-
var
|
|
181066
|
-
__export(
|
|
180961
|
+
var ts_exports3 = {};
|
|
180962
|
+
__export(ts_exports3, {
|
|
181067
180963
|
ANONYMOUS: () => ANONYMOUS,
|
|
181068
180964
|
AccessFlags: () => AccessFlags,
|
|
181069
180965
|
AssertionLevel: () => AssertionLevel,
|
|
@@ -181366,8 +181262,8 @@ ${e.message}`;
|
|
|
181366
181262
|
convertCompilerOptionsFromJson: () => convertCompilerOptionsFromJson,
|
|
181367
181263
|
convertJsonOption: () => convertJsonOption,
|
|
181368
181264
|
convertToBase64: () => convertToBase64,
|
|
181265
|
+
convertToJson: () => convertToJson,
|
|
181369
181266
|
convertToObject: () => convertToObject,
|
|
181370
|
-
convertToObjectWorker: () => convertToObjectWorker,
|
|
181371
181267
|
convertToOptionsWithAbsolutePaths: () => convertToOptionsWithAbsolutePaths,
|
|
181372
181268
|
convertToRelativePath: () => convertToRelativePath,
|
|
181373
181269
|
convertToTSConfig: () => convertToTSConfig,
|
|
@@ -182513,6 +182409,7 @@ ${e.message}`;
|
|
|
182513
182409
|
isJsxText: () => isJsxText,
|
|
182514
182410
|
isJumpStatementTarget: () => isJumpStatementTarget,
|
|
182515
182411
|
isKeyword: () => isKeyword,
|
|
182412
|
+
isKeywordOrPunctuation: () => isKeywordOrPunctuation,
|
|
182516
182413
|
isKnownSymbol: () => isKnownSymbol,
|
|
182517
182414
|
isLabelName: () => isLabelName,
|
|
182518
182415
|
isLabelOfLabeledStatement: () => isLabelOfLabeledStatement,
|
|
@@ -183324,7 +183221,7 @@ ${e.message}`;
|
|
|
183324
183221
|
var require_tsserverlibrary = __commonJS({
|
|
183325
183222
|
"src/tsserverlibrary/tsserverlibrary.ts"(exports, module2) {
|
|
183326
183223
|
init_ts7();
|
|
183327
|
-
module2.exports =
|
|
183224
|
+
module2.exports = ts_exports3;
|
|
183328
183225
|
}
|
|
183329
183226
|
});
|
|
183330
183227
|
return require_tsserverlibrary();
|