typescript 5.1.0-dev.20230319 → 5.1.0-dev.20230321
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.decorators.legacy.d.ts +1 -1
- package/lib/tsc.js +459 -560
- package/lib/tsserver.js +699 -771
- package/lib/tsserverlibrary.d.ts +6 -6
- package/lib/tsserverlibrary.js +710 -790
- package/lib/typescript.d.ts +6 -6
- package/lib/typescript.js +705 -786
- package/lib/typingsInstaller.js +75 -256
- package/package.json +2 -2
package/lib/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";
|
|
@@ -4439,7 +4439,7 @@ ${lanes.join("\n")}
|
|
|
4439
4439
|
TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
|
|
4440
4440
|
TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
|
|
4441
4441
|
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
|
|
4442
|
-
TypeFlags2[TypeFlags2["ObjectFlagsType"] =
|
|
4442
|
+
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
|
|
4443
4443
|
TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
|
|
4444
4444
|
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
|
|
4445
4445
|
TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
|
|
@@ -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
|
}
|
|
@@ -17454,7 +17461,7 @@ ${lanes.join("\n")}
|
|
|
17454
17461
|
return (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isClassLike);
|
|
17455
17462
|
}
|
|
17456
17463
|
function getObjectFlags(type) {
|
|
17457
|
-
return type.flags &
|
|
17464
|
+
return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0;
|
|
17458
17465
|
}
|
|
17459
17466
|
function forSomeAncestorDirectory(directory, callback) {
|
|
17460
17467
|
return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
|
|
@@ -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
|
}
|
|
@@ -58895,31 +58802,21 @@ ${lanes.join("\n")}
|
|
|
58895
58802
|
}
|
|
58896
58803
|
return type;
|
|
58897
58804
|
function addSpans(texts2, types2) {
|
|
58898
|
-
const isTextsArray = isArray(texts2);
|
|
58899
58805
|
for (let i = 0; i < types2.length; i++) {
|
|
58900
58806
|
const t = types2[i];
|
|
58901
|
-
const addText = isTextsArray ? texts2[i + 1] : texts2;
|
|
58902
58807
|
if (t.flags & (2944 /* Literal */ | 65536 /* Null */ | 32768 /* Undefined */)) {
|
|
58903
58808
|
text += getTemplateStringForType(t) || "";
|
|
58904
|
-
text +=
|
|
58905
|
-
if (!isTextsArray)
|
|
58906
|
-
return true;
|
|
58809
|
+
text += texts2[i + 1];
|
|
58907
58810
|
} else if (t.flags & 134217728 /* TemplateLiteral */) {
|
|
58908
58811
|
text += t.texts[0];
|
|
58909
58812
|
if (!addSpans(t.texts, t.types))
|
|
58910
58813
|
return false;
|
|
58911
|
-
text +=
|
|
58912
|
-
if (!isTextsArray)
|
|
58913
|
-
return true;
|
|
58814
|
+
text += texts2[i + 1];
|
|
58914
58815
|
} else if (isGenericIndexType(t) || isPatternLiteralPlaceholderType(t)) {
|
|
58915
58816
|
newTypes.push(t);
|
|
58916
58817
|
newTexts.push(text);
|
|
58917
|
-
text =
|
|
58918
|
-
} else
|
|
58919
|
-
const added = addSpans(texts2[i + 1], t.types);
|
|
58920
|
-
if (!added)
|
|
58921
|
-
return false;
|
|
58922
|
-
} else if (isTextsArray) {
|
|
58818
|
+
text = texts2[i + 1];
|
|
58819
|
+
} else {
|
|
58923
58820
|
return false;
|
|
58924
58821
|
}
|
|
58925
58822
|
}
|
|
@@ -58931,6 +58828,11 @@ ${lanes.join("\n")}
|
|
|
58931
58828
|
}
|
|
58932
58829
|
function createTemplateLiteralType(texts, types) {
|
|
58933
58830
|
const type = createType(134217728 /* TemplateLiteral */);
|
|
58831
|
+
type.objectFlags = getPropagatingFlagsOfTypes(
|
|
58832
|
+
types,
|
|
58833
|
+
/*excludeKinds*/
|
|
58834
|
+
98304 /* Nullable */
|
|
58835
|
+
);
|
|
58934
58836
|
type.texts = texts;
|
|
58935
58837
|
type.types = types;
|
|
58936
58838
|
return type;
|
|
@@ -59230,6 +59132,9 @@ ${lanes.join("\n")}
|
|
|
59230
59132
|
return accessNode.kind === 210 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.kind === 197 /* IndexedAccessType */ ? accessNode.indexType : accessNode.kind === 165 /* ComputedPropertyName */ ? accessNode.expression : accessNode;
|
|
59231
59133
|
}
|
|
59232
59134
|
function isPatternLiteralPlaceholderType(type) {
|
|
59135
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
59136
|
+
return some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 65536 /* Null */ | 32768 /* Undefined */)) || isPatternLiteralPlaceholderType(t));
|
|
59137
|
+
}
|
|
59233
59138
|
return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
|
|
59234
59139
|
}
|
|
59235
59140
|
function isPatternLiteralType(type) {
|
|
@@ -59245,7 +59150,7 @@ ${lanes.join("\n")}
|
|
|
59245
59150
|
return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
|
|
59246
59151
|
}
|
|
59247
59152
|
function getGenericObjectFlags(type) {
|
|
59248
|
-
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
59153
|
+
if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
|
|
59249
59154
|
if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
|
|
59250
59155
|
type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
|
|
59251
59156
|
}
|
|
@@ -59257,7 +59162,7 @@ ${lanes.join("\n")}
|
|
|
59257
59162
|
}
|
|
59258
59163
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
59259
59164
|
}
|
|
59260
|
-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ |
|
|
59165
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
59261
59166
|
}
|
|
59262
59167
|
function getSimplifiedType(type, writing) {
|
|
59263
59168
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -60271,6 +60176,9 @@ ${lanes.join("\n")}
|
|
|
60271
60176
|
if (!result) {
|
|
60272
60177
|
const newMapper = createTypeMapper(typeParameters, typeArguments);
|
|
60273
60178
|
result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
|
|
60179
|
+
if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
60180
|
+
result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
60181
|
+
}
|
|
60274
60182
|
target.instantiations.set(id, result);
|
|
60275
60183
|
}
|
|
60276
60184
|
return result;
|
|
@@ -60399,7 +60307,7 @@ ${lanes.join("\n")}
|
|
|
60399
60307
|
) : strictNullChecks && modifiers & 8 /* ExcludeOptional */ && isOptional ? getTypeWithFacts(propType, 524288 /* NEUndefined */) : propType;
|
|
60400
60308
|
}
|
|
60401
60309
|
function instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
60402
|
-
const result = createObjectType(type.objectFlags | 64 /* Instantiated */, type.symbol);
|
|
60310
|
+
const result = createObjectType(type.objectFlags & ~(524288 /* CouldContainTypeVariablesComputed */ | 1048576 /* CouldContainTypeVariables */) | 64 /* Instantiated */, type.symbol);
|
|
60403
60311
|
if (type.objectFlags & 32 /* Mapped */) {
|
|
60404
60312
|
result.declaration = type.declaration;
|
|
60405
60313
|
const origTypeParameter = getTypeParameterFromMappedType(type);
|
|
@@ -60604,7 +60512,13 @@ ${lanes.join("\n")}
|
|
|
60604
60512
|
return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
|
|
60605
60513
|
}
|
|
60606
60514
|
function hasContextSensitiveReturnExpression(node) {
|
|
60607
|
-
|
|
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));
|
|
60608
60522
|
}
|
|
60609
60523
|
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
|
|
60610
60524
|
return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
|
|
@@ -61273,7 +61187,12 @@ ${lanes.join("\n")}
|
|
|
61273
61187
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
61274
61188
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
61275
61189
|
for (let i = 0; i < paramCount; i++) {
|
|
61276
|
-
const sourceType = i === restIndex ? getRestTypeAtPosition(
|
|
61190
|
+
const sourceType = i === restIndex ? getRestTypeAtPosition(
|
|
61191
|
+
source,
|
|
61192
|
+
i,
|
|
61193
|
+
/*readonly*/
|
|
61194
|
+
true
|
|
61195
|
+
) : tryGetTypeAtPosition(source, i);
|
|
61277
61196
|
const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
61278
61197
|
if (sourceType && targetType) {
|
|
61279
61198
|
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
@@ -61539,7 +61458,7 @@ ${lanes.join("\n")}
|
|
|
61539
61458
|
}
|
|
61540
61459
|
function getNormalizedType(type, writing) {
|
|
61541
61460
|
while (true) {
|
|
61542
|
-
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;
|
|
61543
61462
|
if (t === type)
|
|
61544
61463
|
return t;
|
|
61545
61464
|
type = t;
|
|
@@ -61558,6 +61477,11 @@ ${lanes.join("\n")}
|
|
|
61558
61477
|
}
|
|
61559
61478
|
return type;
|
|
61560
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
|
+
}
|
|
61561
61485
|
function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
|
|
61562
61486
|
var _a2;
|
|
61563
61487
|
let errorInfo;
|
|
@@ -61647,10 +61571,10 @@ ${lanes.join("\n")}
|
|
|
61647
61571
|
relatedInfo: relatedInfo == null ? void 0 : relatedInfo.slice()
|
|
61648
61572
|
};
|
|
61649
61573
|
}
|
|
61650
|
-
function reportIncompatibleError(message,
|
|
61574
|
+
function reportIncompatibleError(message, ...args) {
|
|
61651
61575
|
overrideNextErrorInfo++;
|
|
61652
61576
|
lastSkippedInfo = void 0;
|
|
61653
|
-
(incompatibleStack || (incompatibleStack = [])).push([message,
|
|
61577
|
+
(incompatibleStack || (incompatibleStack = [])).push([message, ...args]);
|
|
61654
61578
|
}
|
|
61655
61579
|
function reportIncompatibleStack() {
|
|
61656
61580
|
const stack = incompatibleStack || [];
|
|
@@ -61742,13 +61666,13 @@ ${lanes.join("\n")}
|
|
|
61742
61666
|
);
|
|
61743
61667
|
}
|
|
61744
61668
|
}
|
|
61745
|
-
function reportError(message,
|
|
61669
|
+
function reportError(message, ...args) {
|
|
61746
61670
|
Debug.assert(!!errorNode);
|
|
61747
61671
|
if (incompatibleStack)
|
|
61748
61672
|
reportIncompatibleStack();
|
|
61749
61673
|
if (message.elidedInCompatabilityPyramid)
|
|
61750
61674
|
return;
|
|
61751
|
-
errorInfo = chainDiagnosticMessages(errorInfo, message,
|
|
61675
|
+
errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
|
|
61752
61676
|
}
|
|
61753
61677
|
function associateRelatedInfo(info) {
|
|
61754
61678
|
Debug.assert(!!errorInfo);
|
|
@@ -63035,7 +62959,7 @@ ${lanes.join("\n")}
|
|
|
63035
62959
|
if (varianceResult !== void 0) {
|
|
63036
62960
|
return varianceResult;
|
|
63037
62961
|
}
|
|
63038
|
-
} else if (isReadonlyArrayType(target2) ?
|
|
62962
|
+
} else if (isReadonlyArrayType(target2) ? everyType(source2, isArrayOrTupleType) : isArrayType(target2) && everyType(source2, (t) => isTupleType(t) && !t.target.readonly)) {
|
|
63039
62963
|
if (relation !== identityRelation) {
|
|
63040
62964
|
return isRelatedTo(getIndexTypeOfType(source2, numberType) || anyType, getIndexTypeOfType(target2, numberType) || anyType, 3 /* Both */, reportErrors2);
|
|
63041
62965
|
} else {
|
|
@@ -63918,22 +63842,7 @@ ${lanes.join("\n")}
|
|
|
63918
63842
|
if (match === -1) {
|
|
63919
63843
|
return defaultValue;
|
|
63920
63844
|
}
|
|
63921
|
-
|
|
63922
|
-
/*searchElement*/
|
|
63923
|
-
true,
|
|
63924
|
-
match + 1
|
|
63925
|
-
);
|
|
63926
|
-
while (nextMatch !== -1) {
|
|
63927
|
-
if (!isTypeIdenticalTo(target.types[match], target.types[nextMatch])) {
|
|
63928
|
-
return defaultValue;
|
|
63929
|
-
}
|
|
63930
|
-
nextMatch = discriminable.indexOf(
|
|
63931
|
-
/*searchElement*/
|
|
63932
|
-
true,
|
|
63933
|
-
nextMatch + 1
|
|
63934
|
-
);
|
|
63935
|
-
}
|
|
63936
|
-
return target.types[match];
|
|
63845
|
+
return getUnionType(target.types.filter((_, index) => discriminable[index]));
|
|
63937
63846
|
}
|
|
63938
63847
|
function isWeakType(type) {
|
|
63939
63848
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -64134,7 +64043,7 @@ ${lanes.join("\n")}
|
|
|
64134
64043
|
return type.symbol;
|
|
64135
64044
|
}
|
|
64136
64045
|
if (isTupleType(type)) {
|
|
64137
|
-
return type
|
|
64046
|
+
return type;
|
|
64138
64047
|
}
|
|
64139
64048
|
}
|
|
64140
64049
|
if (type.flags & 262144 /* TypeParameter */) {
|
|
@@ -64907,8 +64816,8 @@ ${lanes.join("\n")}
|
|
|
64907
64816
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
64908
64817
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
64909
64818
|
}
|
|
64910
|
-
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node ||
|
|
64911
|
-
if (type.flags &
|
|
64819
|
+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
64820
|
+
if (type.flags & 138117121 /* ObjectFlagsType */) {
|
|
64912
64821
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
64913
64822
|
}
|
|
64914
64823
|
return result;
|
|
@@ -65533,7 +65442,11 @@ ${lanes.join("\n")}
|
|
|
65533
65442
|
return true;
|
|
65534
65443
|
}
|
|
65535
65444
|
if (constraintType.flags & 262144 /* TypeParameter */) {
|
|
65536
|
-
inferWithPriority(getIndexType(
|
|
65445
|
+
inferWithPriority(getIndexType(
|
|
65446
|
+
source,
|
|
65447
|
+
/*indexFlags*/
|
|
65448
|
+
!!source.pattern ? 2 /* NoIndexSignatures */ : 0 /* None */
|
|
65449
|
+
), constraintType, 32 /* MappedTypeConstraint */);
|
|
65537
65450
|
const extendedConstraint = getConstraintOfType(constraintType);
|
|
65538
65451
|
if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) {
|
|
65539
65452
|
return true;
|
|
@@ -66006,36 +65919,34 @@ ${lanes.join("\n")}
|
|
|
66006
65919
|
return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName : type.flags & 384 /* StringOrNumberLiteral */ ? escapeLeadingUnderscores("" + type.value) : void 0;
|
|
66007
65920
|
}
|
|
66008
65921
|
function tryGetElementAccessExpressionName(node) {
|
|
66009
|
-
|
|
66010
|
-
|
|
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
|
+
}
|
|
66011
65942
|
}
|
|
66012
|
-
if (
|
|
66013
|
-
const
|
|
66014
|
-
|
|
66015
|
-
|
|
66016
|
-
/*ignoreErrors*/
|
|
66017
|
-
true
|
|
66018
|
-
);
|
|
66019
|
-
if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */))
|
|
66020
|
-
return void 0;
|
|
66021
|
-
const declaration = symbol.valueDeclaration;
|
|
66022
|
-
if (declaration === void 0)
|
|
66023
|
-
return void 0;
|
|
66024
|
-
const type = tryGetTypeFromEffectiveTypeNode(declaration);
|
|
66025
|
-
if (type) {
|
|
66026
|
-
const name = tryGetNameFromType(type);
|
|
66027
|
-
if (name !== void 0) {
|
|
66028
|
-
return name;
|
|
66029
|
-
}
|
|
65943
|
+
if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node)) {
|
|
65944
|
+
const initializer = getEffectiveInitializer(declaration);
|
|
65945
|
+
if (initializer) {
|
|
65946
|
+
return tryGetNameFromType(getTypeOfExpression(initializer));
|
|
66030
65947
|
}
|
|
66031
|
-
if (
|
|
66032
|
-
|
|
66033
|
-
if (initializer) {
|
|
66034
|
-
return tryGetNameFromType(getTypeOfExpression(initializer));
|
|
66035
|
-
}
|
|
66036
|
-
if (isEnumMember(declaration)) {
|
|
66037
|
-
return getTextOfPropertyName(declaration.name);
|
|
66038
|
-
}
|
|
65948
|
+
if (isEnumMember(declaration)) {
|
|
65949
|
+
return getTextOfPropertyName(declaration.name);
|
|
66039
65950
|
}
|
|
66040
65951
|
}
|
|
66041
65952
|
return void 0;
|
|
@@ -67953,7 +67864,7 @@ ${lanes.join("\n")}
|
|
|
67953
67864
|
});
|
|
67954
67865
|
}
|
|
67955
67866
|
function markAliasReferenced(symbol, location) {
|
|
67956
|
-
if (
|
|
67867
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
67957
67868
|
return;
|
|
67958
67869
|
}
|
|
67959
67870
|
if (isNonLocalAlias(
|
|
@@ -69091,30 +69002,52 @@ ${lanes.join("\n")}
|
|
|
69091
69002
|
}
|
|
69092
69003
|
return void 0;
|
|
69093
69004
|
}
|
|
69094
|
-
function
|
|
69095
|
-
|
|
69096
|
-
|
|
69097
|
-
|
|
69098
|
-
|
|
69099
|
-
|
|
69100
|
-
|
|
69101
|
-
|
|
69102
|
-
|
|
69103
|
-
|
|
69104
|
-
|
|
69105
|
-
|
|
69106
|
-
|
|
69107
|
-
|
|
69108
|
-
t
|
|
69109
|
-
|
|
69110
|
-
|
|
69111
|
-
|
|
69112
|
-
|
|
69113
|
-
|
|
69114
|
-
|
|
69005
|
+
function getSpreadIndices(elements) {
|
|
69006
|
+
let first2, last2;
|
|
69007
|
+
for (let i = 0; i < elements.length; i++) {
|
|
69008
|
+
if (isSpreadElement(elements[i])) {
|
|
69009
|
+
first2 != null ? first2 : first2 = i;
|
|
69010
|
+
last2 = i;
|
|
69011
|
+
}
|
|
69012
|
+
}
|
|
69013
|
+
return { first: first2, last: last2 };
|
|
69014
|
+
}
|
|
69015
|
+
function getContextualTypeForElementExpression(type, index, length2, firstSpreadIndex, lastSpreadIndex) {
|
|
69016
|
+
return type && mapType(
|
|
69017
|
+
type,
|
|
69018
|
+
(t) => {
|
|
69019
|
+
if (isTupleType(t)) {
|
|
69020
|
+
if ((firstSpreadIndex === void 0 || index < firstSpreadIndex) && index < t.target.fixedLength) {
|
|
69021
|
+
return getTypeArguments(t)[index];
|
|
69022
|
+
}
|
|
69023
|
+
const offset = length2 !== void 0 && (lastSpreadIndex === void 0 || index > lastSpreadIndex) ? length2 - index : 0;
|
|
69024
|
+
const fixedEndLength = offset > 0 && t.target.hasRestElement ? getEndElementCount(t.target, 3 /* Fixed */) : 0;
|
|
69025
|
+
if (offset > 0 && offset <= fixedEndLength) {
|
|
69026
|
+
return getTypeArguments(t)[getTypeReferenceArity(t) - offset];
|
|
69027
|
+
}
|
|
69028
|
+
return getElementTypeOfSliceOfTupleType(
|
|
69029
|
+
t,
|
|
69030
|
+
firstSpreadIndex === void 0 ? t.target.fixedLength : Math.min(t.target.fixedLength, firstSpreadIndex),
|
|
69031
|
+
length2 === void 0 || lastSpreadIndex === void 0 ? fixedEndLength : Math.min(fixedEndLength, length2 - lastSpreadIndex),
|
|
69032
|
+
/*writing*/
|
|
69033
|
+
false,
|
|
69034
|
+
/*noReductions*/
|
|
69035
|
+
true
|
|
69036
|
+
);
|
|
69037
|
+
}
|
|
69038
|
+
return (!firstSpreadIndex || index < firstSpreadIndex) && getTypeOfPropertyOfContextualType(t, "" + index) || getIteratedTypeOrElementType(
|
|
69039
|
+
1 /* Element */,
|
|
69040
|
+
t,
|
|
69041
|
+
undefinedType,
|
|
69042
|
+
/*errorNode*/
|
|
69043
|
+
void 0,
|
|
69044
|
+
/*checkAssignability*/
|
|
69045
|
+
false
|
|
69046
|
+
);
|
|
69047
|
+
},
|
|
69115
69048
|
/*noReductions*/
|
|
69116
69049
|
true
|
|
69117
|
-
)
|
|
69050
|
+
);
|
|
69118
69051
|
}
|
|
69119
69052
|
function getContextualTypeForConditionalOperand(node, contextFlags) {
|
|
69120
69053
|
const conditional = node.parent;
|
|
@@ -69223,7 +69156,11 @@ ${lanes.join("\n")}
|
|
|
69223
69156
|
if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
|
|
69224
69157
|
const apparentType = mapType(
|
|
69225
69158
|
instantiatedType,
|
|
69226
|
-
|
|
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),
|
|
69227
69164
|
/*noReductions*/
|
|
69228
69165
|
true
|
|
69229
69166
|
);
|
|
@@ -69301,9 +69238,9 @@ ${lanes.join("\n")}
|
|
|
69301
69238
|
case 207 /* ArrayLiteralExpression */: {
|
|
69302
69239
|
const arrayLiteral = parent2;
|
|
69303
69240
|
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
|
|
69304
|
-
const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
|
|
69305
69241
|
const elementIndex = indexOfNode(arrayLiteral.elements, node);
|
|
69306
|
-
|
|
69242
|
+
const spreadIndices = (_b = (_a2 = getNodeLinks(arrayLiteral)).spreadIndices) != null ? _b : _a2.spreadIndices = getSpreadIndices(arrayLiteral.elements);
|
|
69243
|
+
return getContextualTypeForElementExpression(type, elementIndex, arrayLiteral.elements.length, spreadIndices.first, spreadIndices.last);
|
|
69307
69244
|
}
|
|
69308
69245
|
case 225 /* ConditionalExpression */:
|
|
69309
69246
|
return getContextualTypeForConditionalOperand(node, contextFlags);
|
|
@@ -70488,7 +70425,7 @@ ${lanes.join("\n")}
|
|
|
70488
70425
|
}
|
|
70489
70426
|
if (jsxFactorySym) {
|
|
70490
70427
|
jsxFactorySym.isReferenced = 67108863 /* All */;
|
|
70491
|
-
if (
|
|
70428
|
+
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
70492
70429
|
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
70493
70430
|
}
|
|
70494
70431
|
}
|
|
@@ -71715,7 +71652,7 @@ ${lanes.join("\n")}
|
|
|
71715
71652
|
flags.push(4 /* Rest */);
|
|
71716
71653
|
}
|
|
71717
71654
|
} else {
|
|
71718
|
-
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
71655
|
+
const contextualType = isTupleType(restType) ? getContextualTypeForElementExpression(restType, i - index, argCount - index) || unknownType : getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
71719
71656
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
71720
71657
|
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 402784252 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
71721
71658
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
@@ -72062,16 +71999,16 @@ ${lanes.join("\n")}
|
|
|
72062
71999
|
}
|
|
72063
72000
|
return { start, length: length2, sourceFile };
|
|
72064
72001
|
}
|
|
72065
|
-
function getDiagnosticForCallNode(node, message,
|
|
72002
|
+
function getDiagnosticForCallNode(node, message, ...args) {
|
|
72066
72003
|
if (isCallExpression(node)) {
|
|
72067
72004
|
const { sourceFile, start, length: length2 } = getDiagnosticSpanForCallNode(node);
|
|
72068
72005
|
if ("message" in message) {
|
|
72069
|
-
return createFileDiagnostic(sourceFile, start, length2, message,
|
|
72006
|
+
return createFileDiagnostic(sourceFile, start, length2, message, ...args);
|
|
72070
72007
|
}
|
|
72071
72008
|
return createDiagnosticForFileFromMessageChain(sourceFile, message);
|
|
72072
72009
|
} else {
|
|
72073
72010
|
if ("message" in message) {
|
|
72074
|
-
return createDiagnosticForNode(node, message,
|
|
72011
|
+
return createDiagnosticForNode(node, message, ...args);
|
|
72075
72012
|
}
|
|
72076
72013
|
return createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, message);
|
|
72077
72014
|
}
|
|
@@ -72159,11 +72096,8 @@ ${lanes.join("\n")}
|
|
|
72159
72096
|
}
|
|
72160
72097
|
const parameter = (_a2 = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a2.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
|
|
72161
72098
|
if (parameter) {
|
|
72162
|
-
const
|
|
72163
|
-
|
|
72164
|
-
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,
|
|
72165
|
-
!parameter.name ? args.length : !isBindingPattern(parameter.name) ? idText(getFirstIdentifier(parameter.name)) : void 0
|
|
72166
|
-
);
|
|
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);
|
|
72167
72101
|
return addRelatedInfo(diagnostic, parameterError);
|
|
72168
72102
|
}
|
|
72169
72103
|
return diagnostic;
|
|
@@ -73768,12 +73702,12 @@ ${lanes.join("\n")}
|
|
|
73768
73702
|
}
|
|
73769
73703
|
return void 0;
|
|
73770
73704
|
}
|
|
73771
|
-
function getRestTypeAtPosition(source, pos) {
|
|
73705
|
+
function getRestTypeAtPosition(source, pos, readonly = false) {
|
|
73772
73706
|
const parameterCount = getParameterCount(source);
|
|
73773
73707
|
const minArgumentCount = getMinArgumentCount(source);
|
|
73774
73708
|
const restType = getEffectiveRestType(source);
|
|
73775
73709
|
if (restType && pos >= parameterCount - 1) {
|
|
73776
|
-
return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
|
|
73710
|
+
return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType), readonly);
|
|
73777
73711
|
}
|
|
73778
73712
|
const types = [];
|
|
73779
73713
|
const flags = [];
|
|
@@ -73791,13 +73725,7 @@ ${lanes.join("\n")}
|
|
|
73791
73725
|
names.push(name);
|
|
73792
73726
|
}
|
|
73793
73727
|
}
|
|
73794
|
-
return createTupleType(
|
|
73795
|
-
types,
|
|
73796
|
-
flags,
|
|
73797
|
-
/*readonly*/
|
|
73798
|
-
false,
|
|
73799
|
-
length(names) === length(types) ? names : void 0
|
|
73800
|
-
);
|
|
73728
|
+
return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
|
|
73801
73729
|
}
|
|
73802
73730
|
function getParameterCount(signature) {
|
|
73803
73731
|
const length2 = signature.parameters.length;
|
|
@@ -77503,9 +77431,9 @@ ${lanes.join("\n")}
|
|
|
77503
77431
|
}
|
|
77504
77432
|
}
|
|
77505
77433
|
}
|
|
77506
|
-
function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage,
|
|
77434
|
+
function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, ...args) {
|
|
77507
77435
|
const promisedType = getPromisedTypeOfPromise(type, errorNode);
|
|
77508
|
-
return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage,
|
|
77436
|
+
return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, ...args);
|
|
77509
77437
|
}
|
|
77510
77438
|
function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) {
|
|
77511
77439
|
if (isTypeAny(type)) {
|
|
@@ -77568,8 +77496,8 @@ ${lanes.join("\n")}
|
|
|
77568
77496
|
}
|
|
77569
77497
|
return typeAsPromise.promisedTypeOfPromise = getUnionType(map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), 2 /* Subtype */);
|
|
77570
77498
|
}
|
|
77571
|
-
function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage,
|
|
77572
|
-
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);
|
|
77573
77501
|
return awaitedType || errorType;
|
|
77574
77502
|
}
|
|
77575
77503
|
function isThenableType(type) {
|
|
@@ -77625,11 +77553,11 @@ ${lanes.join("\n")}
|
|
|
77625
77553
|
Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
77626
77554
|
return type;
|
|
77627
77555
|
}
|
|
77628
|
-
function getAwaitedType(type, errorNode, diagnosticMessage,
|
|
77629
|
-
const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage,
|
|
77556
|
+
function getAwaitedType(type, errorNode, diagnosticMessage, ...args) {
|
|
77557
|
+
const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args);
|
|
77630
77558
|
return awaitedType && createAwaitedTypeIfNeeded(awaitedType);
|
|
77631
77559
|
}
|
|
77632
|
-
function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage,
|
|
77560
|
+
function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args) {
|
|
77633
77561
|
if (isTypeAny(type)) {
|
|
77634
77562
|
return type;
|
|
77635
77563
|
}
|
|
@@ -77647,7 +77575,7 @@ ${lanes.join("\n")}
|
|
|
77647
77575
|
}
|
|
77648
77576
|
return void 0;
|
|
77649
77577
|
}
|
|
77650
|
-
const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage,
|
|
77578
|
+
const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias;
|
|
77651
77579
|
awaitedTypeStack.push(type.id);
|
|
77652
77580
|
const mapped = mapType(type, mapper);
|
|
77653
77581
|
awaitedTypeStack.pop();
|
|
@@ -77671,7 +77599,7 @@ ${lanes.join("\n")}
|
|
|
77671
77599
|
return void 0;
|
|
77672
77600
|
}
|
|
77673
77601
|
awaitedTypeStack.push(type.id);
|
|
77674
|
-
const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage,
|
|
77602
|
+
const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, ...args);
|
|
77675
77603
|
awaitedTypeStack.pop();
|
|
77676
77604
|
if (!awaitedType) {
|
|
77677
77605
|
return void 0;
|
|
@@ -77685,7 +77613,7 @@ ${lanes.join("\n")}
|
|
|
77685
77613
|
if (thisTypeForErrorOut.value) {
|
|
77686
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));
|
|
77687
77615
|
}
|
|
77688
|
-
chain = chainDiagnosticMessages(chain, diagnosticMessage,
|
|
77616
|
+
chain = chainDiagnosticMessages(chain, diagnosticMessage, ...args);
|
|
77689
77617
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(errorNode), errorNode, chain));
|
|
77690
77618
|
}
|
|
77691
77619
|
return void 0;
|
|
@@ -77863,7 +77791,7 @@ ${lanes.join("\n")}
|
|
|
77863
77791
|
true
|
|
77864
77792
|
);
|
|
77865
77793
|
if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
|
|
77866
|
-
if (
|
|
77794
|
+
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
77867
77795
|
markAliasSymbolAsReferenced(rootSymbol);
|
|
77868
77796
|
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
77869
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);
|
|
@@ -78272,9 +78200,8 @@ ${lanes.join("\n")}
|
|
|
78272
78200
|
const sourceFile = getSourceFileOfNode(parent2);
|
|
78273
78201
|
const range = isJSDocTemplateTag(parent2) ? rangeOfNode(parent2) : rangeOfTypeParameters(sourceFile, parent2.typeParameters);
|
|
78274
78202
|
const only = parent2.typeParameters.length === 1;
|
|
78275
|
-
const
|
|
78276
|
-
|
|
78277
|
-
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));
|
|
78278
78205
|
}
|
|
78279
78206
|
} else {
|
|
78280
78207
|
addDiagnostic(typeParameter, 1 /* Parameter */, createDiagnosticForNode(typeParameter, Diagnostics._0_is_declared_but_its_value_is_never_read, name));
|
|
@@ -79832,7 +79759,7 @@ ${lanes.join("\n")}
|
|
|
79832
79759
|
forEachKey(catchClause.locals, (caughtName) => {
|
|
79833
79760
|
const blockLocal = blockLocals.get(caughtName);
|
|
79834
79761
|
if ((blockLocal == null ? void 0 : blockLocal.valueDeclaration) && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) {
|
|
79835
|
-
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));
|
|
79836
79763
|
}
|
|
79837
79764
|
});
|
|
79838
79765
|
}
|
|
@@ -81428,6 +81355,9 @@ ${lanes.join("\n")}
|
|
|
81428
81355
|
) && !getSymbolLinks(getSymbolOfDeclaration(statement)).constEnumReferenced;
|
|
81429
81356
|
}
|
|
81430
81357
|
function checkImportsForTypeOnlyConversion(sourceFile) {
|
|
81358
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
81359
|
+
return;
|
|
81360
|
+
}
|
|
81431
81361
|
for (const statement of sourceFile.statements) {
|
|
81432
81362
|
if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) {
|
|
81433
81363
|
error(
|
|
@@ -81513,14 +81443,14 @@ ${lanes.join("\n")}
|
|
|
81513
81443
|
markAliasReferenced(sym, id);
|
|
81514
81444
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
81515
81445
|
checkExpressionCached(id);
|
|
81516
|
-
if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
81446
|
+
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
81517
81447
|
error(
|
|
81518
81448
|
id,
|
|
81519
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,
|
|
81520
81450
|
idText(id)
|
|
81521
81451
|
);
|
|
81522
81452
|
}
|
|
81523
|
-
} else if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax) {
|
|
81453
|
+
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
81524
81454
|
error(
|
|
81525
81455
|
id,
|
|
81526
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,
|
|
@@ -82857,7 +82787,7 @@ ${lanes.join("\n")}
|
|
|
82857
82787
|
return false;
|
|
82858
82788
|
}
|
|
82859
82789
|
function isValueAliasDeclaration(node) {
|
|
82860
|
-
Debug.assert(
|
|
82790
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
82861
82791
|
switch (node.kind) {
|
|
82862
82792
|
case 269 /* ImportEqualsDeclaration */:
|
|
82863
82793
|
return isAliasResolvedToValue(getSymbolOfDeclaration(node));
|
|
@@ -82898,7 +82828,7 @@ ${lanes.join("\n")}
|
|
|
82898
82828
|
return isConstEnumSymbol(s) || !!s.constEnumOnlyModule;
|
|
82899
82829
|
}
|
|
82900
82830
|
function isReferencedAliasDeclaration(node, checkChildren) {
|
|
82901
|
-
Debug.assert(
|
|
82831
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
82902
82832
|
if (isAliasSymbolDeclaration2(node)) {
|
|
82903
82833
|
const symbol = getSymbolOfDeclaration(node);
|
|
82904
82834
|
const links = symbol && getSymbolLinks(symbol);
|
|
@@ -83236,12 +83166,12 @@ ${lanes.join("\n")}
|
|
|
83236
83166
|
isDeclarationWithCollidingName,
|
|
83237
83167
|
isValueAliasDeclaration: (nodeIn) => {
|
|
83238
83168
|
const node = getParseTreeNode(nodeIn);
|
|
83239
|
-
return node ? isValueAliasDeclaration(node) : true;
|
|
83169
|
+
return node && canCollectSymbolAliasAccessabilityData ? isValueAliasDeclaration(node) : true;
|
|
83240
83170
|
},
|
|
83241
83171
|
hasGlobalName,
|
|
83242
83172
|
isReferencedAliasDeclaration: (nodeIn, checkChildren) => {
|
|
83243
83173
|
const node = getParseTreeNode(nodeIn);
|
|
83244
|
-
return node ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
83174
|
+
return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
83245
83175
|
},
|
|
83246
83176
|
getNodeCheckFlags: (nodeIn) => {
|
|
83247
83177
|
const node = getParseTreeNode(nodeIn);
|
|
@@ -84376,7 +84306,7 @@ ${lanes.join("\n")}
|
|
|
84376
84306
|
throw Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
|
|
84377
84307
|
}
|
|
84378
84308
|
if (!inDestructuring) {
|
|
84379
|
-
const effectiveName =
|
|
84309
|
+
const effectiveName = getEffectivePropertyNameForPropertyNameNode(name);
|
|
84380
84310
|
if (effectiveName === void 0) {
|
|
84381
84311
|
continue;
|
|
84382
84312
|
}
|
|
@@ -84845,12 +84775,12 @@ ${lanes.join("\n")}
|
|
|
84845
84775
|
switch (node.keywordToken) {
|
|
84846
84776
|
case 104 /* NewKeyword */:
|
|
84847
84777
|
if (escapedText !== "target") {
|
|
84848
|
-
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");
|
|
84849
84779
|
}
|
|
84850
84780
|
break;
|
|
84851
84781
|
case 101 /* ImportKeyword */:
|
|
84852
84782
|
if (escapedText !== "meta") {
|
|
84853
|
-
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");
|
|
84854
84784
|
}
|
|
84855
84785
|
break;
|
|
84856
84786
|
}
|
|
@@ -84858,35 +84788,35 @@ ${lanes.join("\n")}
|
|
|
84858
84788
|
function hasParseDiagnostics(sourceFile) {
|
|
84859
84789
|
return sourceFile.parseDiagnostics.length > 0;
|
|
84860
84790
|
}
|
|
84861
|
-
function grammarErrorOnFirstToken(node, message,
|
|
84791
|
+
function grammarErrorOnFirstToken(node, message, ...args) {
|
|
84862
84792
|
const sourceFile = getSourceFileOfNode(node);
|
|
84863
84793
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
84864
84794
|
const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
84865
|
-
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message,
|
|
84795
|
+
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, ...args));
|
|
84866
84796
|
return true;
|
|
84867
84797
|
}
|
|
84868
84798
|
return false;
|
|
84869
84799
|
}
|
|
84870
|
-
function grammarErrorAtPos(nodeForSourceFile, start, length2, message,
|
|
84800
|
+
function grammarErrorAtPos(nodeForSourceFile, start, length2, message, ...args) {
|
|
84871
84801
|
const sourceFile = getSourceFileOfNode(nodeForSourceFile);
|
|
84872
84802
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
84873
|
-
diagnostics.add(createFileDiagnostic(sourceFile, start, length2, message,
|
|
84803
|
+
diagnostics.add(createFileDiagnostic(sourceFile, start, length2, message, ...args));
|
|
84874
84804
|
return true;
|
|
84875
84805
|
}
|
|
84876
84806
|
return false;
|
|
84877
84807
|
}
|
|
84878
|
-
function grammarErrorOnNodeSkippedOn(key, node, message,
|
|
84808
|
+
function grammarErrorOnNodeSkippedOn(key, node, message, ...args) {
|
|
84879
84809
|
const sourceFile = getSourceFileOfNode(node);
|
|
84880
84810
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
84881
|
-
errorSkippedOn(key, node, message,
|
|
84811
|
+
errorSkippedOn(key, node, message, ...args);
|
|
84882
84812
|
return true;
|
|
84883
84813
|
}
|
|
84884
84814
|
return false;
|
|
84885
84815
|
}
|
|
84886
|
-
function grammarErrorOnNode(node, message,
|
|
84816
|
+
function grammarErrorOnNode(node, message, ...args) {
|
|
84887
84817
|
const sourceFile = getSourceFileOfNode(node);
|
|
84888
84818
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
84889
|
-
diagnostics.add(createDiagnosticForNode(node, message,
|
|
84819
|
+
diagnostics.add(createDiagnosticForNode(node, message, ...args));
|
|
84890
84820
|
return true;
|
|
84891
84821
|
}
|
|
84892
84822
|
return false;
|
|
@@ -85031,7 +84961,7 @@ ${lanes.join("\n")}
|
|
|
85031
84961
|
}
|
|
85032
84962
|
return false;
|
|
85033
84963
|
}
|
|
85034
|
-
function grammarErrorAfterFirstToken(node, message,
|
|
84964
|
+
function grammarErrorAfterFirstToken(node, message, ...args) {
|
|
85035
84965
|
const sourceFile = getSourceFileOfNode(node);
|
|
85036
84966
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
85037
84967
|
const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
@@ -85041,9 +84971,7 @@ ${lanes.join("\n")}
|
|
|
85041
84971
|
/*length*/
|
|
85042
84972
|
0,
|
|
85043
84973
|
message,
|
|
85044
|
-
|
|
85045
|
-
arg1,
|
|
85046
|
-
arg2
|
|
84974
|
+
...args
|
|
85047
84975
|
));
|
|
85048
84976
|
return true;
|
|
85049
84977
|
}
|
|
@@ -85189,6 +85117,10 @@ ${lanes.join("\n")}
|
|
|
85189
85117
|
}
|
|
85190
85118
|
return void 0;
|
|
85191
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
|
+
}
|
|
85192
85124
|
}
|
|
85193
85125
|
function isNotAccessor(declaration) {
|
|
85194
85126
|
return !isAccessor(declaration);
|
|
@@ -109853,8 +109785,7 @@ ${lanes.join("\n")}
|
|
|
109853
109785
|
}
|
|
109854
109786
|
}
|
|
109855
109787
|
function createBuildInfo(program, bundle) {
|
|
109856
|
-
|
|
109857
|
-
return { bundle, program, version: version2 };
|
|
109788
|
+
return { bundle, program, version };
|
|
109858
109789
|
}
|
|
109859
109790
|
function getBuildInfoText(buildInfo) {
|
|
109860
109791
|
return JSON.stringify(buildInfo);
|
|
@@ -109899,10 +109830,10 @@ ${lanes.join("\n")}
|
|
|
109899
109830
|
/*separateBeginAndEnd*/
|
|
109900
109831
|
true
|
|
109901
109832
|
);
|
|
109902
|
-
|
|
109833
|
+
mark("beforeEmit");
|
|
109903
109834
|
const result = emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers);
|
|
109904
|
-
|
|
109905
|
-
|
|
109835
|
+
mark("afterEmit");
|
|
109836
|
+
measure("Emit", "beforeEmit", "afterEmit");
|
|
109906
109837
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
109907
109838
|
return result;
|
|
109908
109839
|
}
|
|
@@ -113912,12 +113843,12 @@ ${lanes.join("\n")}
|
|
|
113912
113843
|
return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags != null ? flags : 0 /* None */, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix)));
|
|
113913
113844
|
}
|
|
113914
113845
|
function isUniqueName(name, privateName) {
|
|
113915
|
-
return
|
|
113846
|
+
return isFileLevelUniqueNameInCurrentFile(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
|
|
113916
113847
|
}
|
|
113917
113848
|
function isReservedName(name, privateName) {
|
|
113918
113849
|
return privateName ? !!(reservedPrivateNames == null ? void 0 : reservedPrivateNames.has(name)) : !!(reservedNames == null ? void 0 : reservedNames.has(name));
|
|
113919
113850
|
}
|
|
113920
|
-
function
|
|
113851
|
+
function isFileLevelUniqueNameInCurrentFile(name, _isPrivate) {
|
|
113921
113852
|
return currentSourceFile ? isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true;
|
|
113922
113853
|
}
|
|
113923
113854
|
function isUniqueLocalName(name, container) {
|
|
@@ -114036,7 +113967,7 @@ ${lanes.join("\n")}
|
|
|
114036
113967
|
function makeFileLevelOptimisticUniqueName(name) {
|
|
114037
113968
|
return makeUniqueName2(
|
|
114038
113969
|
name,
|
|
114039
|
-
|
|
113970
|
+
isFileLevelUniqueNameInCurrentFile,
|
|
114040
113971
|
/*optimistic*/
|
|
114041
113972
|
true,
|
|
114042
113973
|
/*scoped*/
|
|
@@ -114216,7 +114147,7 @@ ${lanes.join("\n")}
|
|
|
114216
114147
|
case 3 /* Unique */:
|
|
114217
114148
|
return makeUniqueName2(
|
|
114218
114149
|
idText(name),
|
|
114219
|
-
autoGenerate.flags & 32 /* FileLevel */ ?
|
|
114150
|
+
autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueNameInCurrentFile : isUniqueName,
|
|
114220
114151
|
!!(autoGenerate.flags & 16 /* Optimistic */),
|
|
114221
114152
|
!!(autoGenerate.flags & 8 /* ReservedInNestedScopes */),
|
|
114222
114153
|
isPrivateIdentifier(name),
|
|
@@ -115234,7 +115165,6 @@ ${lanes.join("\n")}
|
|
|
115234
115165
|
"src/compiler/watchUtilities.ts"() {
|
|
115235
115166
|
"use strict";
|
|
115236
115167
|
init_ts2();
|
|
115237
|
-
init_ts2();
|
|
115238
115168
|
ConfigFileProgramReloadLevel = /* @__PURE__ */ ((ConfigFileProgramReloadLevel2) => {
|
|
115239
115169
|
ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["None"] = 0] = "None";
|
|
115240
115170
|
ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["Partial"] = 1] = "Partial";
|
|
@@ -117234,12 +117164,12 @@ ${lanes.join("\n")}
|
|
|
117234
117164
|
}
|
|
117235
117165
|
}
|
|
117236
117166
|
}
|
|
117237
|
-
function createDiagnosticForNodeArray2(nodes, message,
|
|
117167
|
+
function createDiagnosticForNodeArray2(nodes, message, ...args) {
|
|
117238
117168
|
const start = nodes.pos;
|
|
117239
|
-
return createFileDiagnostic(sourceFile, start, nodes.end - start, message,
|
|
117169
|
+
return createFileDiagnostic(sourceFile, start, nodes.end - start, message, ...args);
|
|
117240
117170
|
}
|
|
117241
|
-
function createDiagnosticForNode2(node, message,
|
|
117242
|
-
return createDiagnosticForNodeInSourceFile(sourceFile, node, message,
|
|
117171
|
+
function createDiagnosticForNode2(node, message, ...args) {
|
|
117172
|
+
return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args);
|
|
117243
117173
|
}
|
|
117244
117174
|
});
|
|
117245
117175
|
}
|
|
@@ -117904,11 +117834,12 @@ ${lanes.join("\n")}
|
|
|
117904
117834
|
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
|
117905
117835
|
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
|
117906
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];
|
|
117907
117838
|
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
117908
117839
|
kind: 0 /* FilePreprocessingReferencedDiagnostic */,
|
|
117909
117840
|
reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index },
|
|
117910
117841
|
diagnostic,
|
|
117911
|
-
args
|
|
117842
|
+
args
|
|
117912
117843
|
});
|
|
117913
117844
|
}
|
|
117914
117845
|
});
|
|
@@ -118373,7 +118304,7 @@ ${lanes.join("\n")}
|
|
|
118373
118304
|
}
|
|
118374
118305
|
}
|
|
118375
118306
|
function verifyDeprecatedCompilerOptions() {
|
|
118376
|
-
function createDiagnostic(name, value, useInstead, message,
|
|
118307
|
+
function createDiagnostic(name, value, useInstead, message, ...args) {
|
|
118377
118308
|
if (useInstead) {
|
|
118378
118309
|
const details = chainDiagnosticMessages(
|
|
118379
118310
|
/*details*/
|
|
@@ -118381,7 +118312,7 @@ ${lanes.join("\n")}
|
|
|
118381
118312
|
Diagnostics.Use_0_instead,
|
|
118382
118313
|
useInstead
|
|
118383
118314
|
);
|
|
118384
|
-
const chain = chainDiagnosticMessages(details, message,
|
|
118315
|
+
const chain = chainDiagnosticMessages(details, message, ...args);
|
|
118385
118316
|
createDiagnosticForOption(
|
|
118386
118317
|
/*onKey*/
|
|
118387
118318
|
!value,
|
|
@@ -118398,10 +118329,7 @@ ${lanes.join("\n")}
|
|
|
118398
118329
|
/*option2*/
|
|
118399
118330
|
void 0,
|
|
118400
118331
|
message,
|
|
118401
|
-
|
|
118402
|
-
arg1,
|
|
118403
|
-
arg2,
|
|
118404
|
-
arg3
|
|
118332
|
+
...args
|
|
118405
118333
|
);
|
|
118406
118334
|
}
|
|
118407
118335
|
}
|
|
@@ -118454,8 +118382,8 @@ ${lanes.join("\n")}
|
|
|
118454
118382
|
});
|
|
118455
118383
|
}
|
|
118456
118384
|
function verifyDeprecatedProjectReference(ref, parentFile, index) {
|
|
118457
|
-
function createDiagnostic(_name, _value, _useInstead, message,
|
|
118458
|
-
createDiagnosticForReference(parentFile, index, message,
|
|
118385
|
+
function createDiagnostic(_name, _value, _useInstead, message, ...args) {
|
|
118386
|
+
createDiagnosticForReference(parentFile, index, message, ...args);
|
|
118459
118387
|
}
|
|
118460
118388
|
checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
|
|
118461
118389
|
if (ref.prepend) {
|
|
@@ -118637,7 +118565,7 @@ ${lanes.join("\n")}
|
|
|
118637
118565
|
}
|
|
118638
118566
|
});
|
|
118639
118567
|
}
|
|
118640
|
-
function createDiagnosticForOptionPathKeyValue(key, valueIndex, message,
|
|
118568
|
+
function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
|
|
118641
118569
|
let needCompilerDiagnostic = true;
|
|
118642
118570
|
const pathsSyntax = getOptionPathsSyntax();
|
|
118643
118571
|
for (const pathProp of pathsSyntax) {
|
|
@@ -118645,17 +118573,17 @@ ${lanes.join("\n")}
|
|
|
118645
118573
|
for (const keyProps of getPropertyAssignment(pathProp.initializer, key)) {
|
|
118646
118574
|
const initializer = keyProps.initializer;
|
|
118647
118575
|
if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
|
|
118648
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message,
|
|
118576
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
|
|
118649
118577
|
needCompilerDiagnostic = false;
|
|
118650
118578
|
}
|
|
118651
118579
|
}
|
|
118652
118580
|
}
|
|
118653
118581
|
}
|
|
118654
118582
|
if (needCompilerDiagnostic) {
|
|
118655
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
118583
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
118656
118584
|
}
|
|
118657
118585
|
}
|
|
118658
|
-
function createDiagnosticForOptionPaths(onKey, key, message,
|
|
118586
|
+
function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
|
|
118659
118587
|
let needCompilerDiagnostic = true;
|
|
118660
118588
|
const pathsSyntax = getOptionPathsSyntax();
|
|
118661
118589
|
for (const pathProp of pathsSyntax) {
|
|
@@ -118666,13 +118594,13 @@ ${lanes.join("\n")}
|
|
|
118666
118594
|
/*key2*/
|
|
118667
118595
|
void 0,
|
|
118668
118596
|
message,
|
|
118669
|
-
|
|
118597
|
+
...args
|
|
118670
118598
|
)) {
|
|
118671
118599
|
needCompilerDiagnostic = false;
|
|
118672
118600
|
}
|
|
118673
118601
|
}
|
|
118674
118602
|
if (needCompilerDiagnostic) {
|
|
118675
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
118603
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
118676
118604
|
}
|
|
118677
118605
|
}
|
|
118678
118606
|
function getOptionsSyntaxByName(name) {
|
|
@@ -118702,7 +118630,7 @@ ${lanes.join("\n")}
|
|
|
118702
118630
|
option3
|
|
118703
118631
|
);
|
|
118704
118632
|
}
|
|
118705
|
-
function createOptionValueDiagnostic(option1, message,
|
|
118633
|
+
function createOptionValueDiagnostic(option1, message, ...args) {
|
|
118706
118634
|
createDiagnosticForOption(
|
|
118707
118635
|
/*onKey*/
|
|
118708
118636
|
false,
|
|
@@ -118710,29 +118638,28 @@ ${lanes.join("\n")}
|
|
|
118710
118638
|
/*option2*/
|
|
118711
118639
|
void 0,
|
|
118712
118640
|
message,
|
|
118713
|
-
|
|
118714
|
-
arg1
|
|
118641
|
+
...args
|
|
118715
118642
|
);
|
|
118716
118643
|
}
|
|
118717
|
-
function createDiagnosticForReference(sourceFile, index, message,
|
|
118644
|
+
function createDiagnosticForReference(sourceFile, index, message, ...args) {
|
|
118718
118645
|
const referencesSyntax = firstDefined(
|
|
118719
118646
|
getTsConfigPropArray(sourceFile || options.configFile, "references"),
|
|
118720
118647
|
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
118721
118648
|
);
|
|
118722
118649
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
|
118723
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message,
|
|
118650
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
|
|
118724
118651
|
} else {
|
|
118725
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
118652
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
118726
118653
|
}
|
|
118727
118654
|
}
|
|
118728
|
-
function createDiagnosticForOption(onKey, option1, option2, message,
|
|
118655
|
+
function createDiagnosticForOption(onKey, option1, option2, message, ...args) {
|
|
118729
118656
|
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
|
118730
|
-
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message,
|
|
118657
|
+
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, ...args);
|
|
118731
118658
|
if (needCompilerDiagnostic) {
|
|
118732
118659
|
if ("messageText" in message) {
|
|
118733
118660
|
programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
|
|
118734
118661
|
} else {
|
|
118735
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
118662
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
118736
118663
|
}
|
|
118737
118664
|
}
|
|
118738
118665
|
}
|
|
@@ -118751,13 +118678,13 @@ ${lanes.join("\n")}
|
|
|
118751
118678
|
}
|
|
118752
118679
|
return _compilerOptionsObjectLiteralSyntax || void 0;
|
|
118753
118680
|
}
|
|
118754
|
-
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message,
|
|
118681
|
+
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
|
|
118755
118682
|
const props = getPropertyAssignment(objectLiteral, key1, key2);
|
|
118756
118683
|
for (const prop of props) {
|
|
118757
118684
|
if ("messageText" in message) {
|
|
118758
118685
|
programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
|
|
118759
118686
|
} else {
|
|
118760
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message,
|
|
118687
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
|
|
118761
118688
|
}
|
|
118762
118689
|
}
|
|
118763
118690
|
return !!props.length;
|
|
@@ -119095,7 +119022,6 @@ ${lanes.join("\n")}
|
|
|
119095
119022
|
"src/compiler/program.ts"() {
|
|
119096
119023
|
"use strict";
|
|
119097
119024
|
init_ts2();
|
|
119098
|
-
init_ts2();
|
|
119099
119025
|
init_ts_performance();
|
|
119100
119026
|
ForegroundColorEscapeSequences = /* @__PURE__ */ ((ForegroundColorEscapeSequences2) => {
|
|
119101
119027
|
ForegroundColorEscapeSequences2["Grey"] = "\x1B[90m";
|
|
@@ -119810,16 +119736,16 @@ ${lanes.join("\n")}
|
|
|
119810
119736
|
return emptyArray;
|
|
119811
119737
|
let buildInfoDirectory;
|
|
119812
119738
|
return diagnostics.map((diagnostic) => {
|
|
119813
|
-
const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram,
|
|
119739
|
+
const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPathInBuildInfoDirectory);
|
|
119814
119740
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
119815
119741
|
result.reportsDeprecated = diagnostic.reportDeprecated;
|
|
119816
119742
|
result.source = diagnostic.source;
|
|
119817
119743
|
result.skippedOn = diagnostic.skippedOn;
|
|
119818
119744
|
const { relatedInformation } = diagnostic;
|
|
119819
|
-
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;
|
|
119820
119746
|
return result;
|
|
119821
119747
|
});
|
|
119822
|
-
function
|
|
119748
|
+
function toPathInBuildInfoDirectory(path) {
|
|
119823
119749
|
buildInfoDirectory != null ? buildInfoDirectory : buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
|
|
119824
119750
|
return toPath(path, buildInfoDirectory, newProgram.getCanonicalFileName);
|
|
119825
119751
|
}
|
|
@@ -120722,7 +120648,7 @@ ${lanes.join("\n")}
|
|
|
120722
120648
|
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
120723
120649
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
120724
120650
|
let state;
|
|
120725
|
-
const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(
|
|
120651
|
+
const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(toPathInBuildInfoDirectory);
|
|
120726
120652
|
let filePathsSetList;
|
|
120727
120653
|
const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0;
|
|
120728
120654
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
@@ -120803,7 +120729,7 @@ ${lanes.join("\n")}
|
|
|
120803
120729
|
close: noop,
|
|
120804
120730
|
hasChangedEmitSignature: returnFalse
|
|
120805
120731
|
};
|
|
120806
|
-
function
|
|
120732
|
+
function toPathInBuildInfoDirectory(path) {
|
|
120807
120733
|
return toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
120808
120734
|
}
|
|
120809
120735
|
function toAbsolutePath(path) {
|
|
@@ -120885,7 +120811,6 @@ ${lanes.join("\n")}
|
|
|
120885
120811
|
"src/compiler/builder.ts"() {
|
|
120886
120812
|
"use strict";
|
|
120887
120813
|
init_ts2();
|
|
120888
|
-
init_ts2();
|
|
120889
120814
|
BuilderFileEmit = /* @__PURE__ */ ((BuilderFileEmit2) => {
|
|
120890
120815
|
BuilderFileEmit2[BuilderFileEmit2["None"] = 0] = "None";
|
|
120891
120816
|
BuilderFileEmit2[BuilderFileEmit2["Js"] = 1] = "Js";
|
|
@@ -121765,7 +121690,6 @@ ${lanes.join("\n")}
|
|
|
121765
121690
|
"src/compiler/resolutionCache.ts"() {
|
|
121766
121691
|
"use strict";
|
|
121767
121692
|
init_ts2();
|
|
121768
|
-
init_ts2();
|
|
121769
121693
|
}
|
|
121770
121694
|
});
|
|
121771
121695
|
|
|
@@ -121878,15 +121802,13 @@ ${lanes.join("\n")}
|
|
|
121878
121802
|
const nonNilFiles = filesInError.filter((fileInError) => fileInError !== void 0);
|
|
121879
121803
|
const distinctFileNamesWithLines = nonNilFiles.map((fileInError) => `${fileInError.fileName}:${fileInError.line}`).filter((value, index, self) => self.indexOf(value) === index);
|
|
121880
121804
|
const firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
|
|
121881
|
-
|
|
121882
|
-
|
|
121883
|
-
|
|
121884
|
-
|
|
121885
|
-
|
|
121886
|
-
|
|
121887
|
-
|
|
121888
|
-
distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length
|
|
121889
|
-
);
|
|
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);
|
|
121890
121812
|
const suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "";
|
|
121891
121813
|
return `${newLine}${flattenDiagnosticMessageText(d.messageText, newLine)}${newLine}${newLine}${suffix}`;
|
|
121892
121814
|
}
|
|
@@ -122096,15 +122018,15 @@ ${lanes.join("\n")}
|
|
|
122096
122018
|
toFileName(referencedResolvedRef.sourceFile.fileName, fileNameConvertor),
|
|
122097
122019
|
options.outFile ? "--outFile" : "--out"
|
|
122098
122020
|
);
|
|
122099
|
-
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];
|
|
122100
122023
|
return chainDiagnosticMessages(
|
|
122101
122024
|
/*details*/
|
|
122102
122025
|
void 0,
|
|
122103
|
-
|
|
122104
|
-
reason.typeReference,
|
|
122105
|
-
reason.packageId && packageIdToString(reason.packageId)
|
|
122026
|
+
...messageAndArgs
|
|
122106
122027
|
);
|
|
122107
|
-
|
|
122028
|
+
}
|
|
122029
|
+
case 6 /* LibFile */: {
|
|
122108
122030
|
if (reason.index !== void 0)
|
|
122109
122031
|
return chainDiagnosticMessages(
|
|
122110
122032
|
/*details*/
|
|
@@ -122113,12 +122035,13 @@ ${lanes.join("\n")}
|
|
|
122113
122035
|
options.lib[reason.index]
|
|
122114
122036
|
);
|
|
122115
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];
|
|
122116
122039
|
return chainDiagnosticMessages(
|
|
122117
122040
|
/*details*/
|
|
122118
122041
|
void 0,
|
|
122119
|
-
|
|
122120
|
-
target
|
|
122042
|
+
...messageAndArgs
|
|
122121
122043
|
);
|
|
122044
|
+
}
|
|
122122
122045
|
default:
|
|
122123
122046
|
Debug.assertNever(reason);
|
|
122124
122047
|
}
|
|
@@ -123160,7 +123083,6 @@ ${lanes.join("\n")}
|
|
|
123160
123083
|
"src/compiler/watchPublic.ts"() {
|
|
123161
123084
|
"use strict";
|
|
123162
123085
|
init_ts2();
|
|
123163
|
-
init_ts2();
|
|
123164
123086
|
}
|
|
123165
123087
|
});
|
|
123166
123088
|
|
|
@@ -125180,7 +125102,6 @@ ${lanes.join("\n")}
|
|
|
125180
125102
|
"src/compiler/tsbuildPublic.ts"() {
|
|
125181
125103
|
"use strict";
|
|
125182
125104
|
init_ts2();
|
|
125183
|
-
init_ts2();
|
|
125184
125105
|
init_ts_performance();
|
|
125185
125106
|
minimumDate = /* @__PURE__ */ new Date(-864e13);
|
|
125186
125107
|
maximumDate = /* @__PURE__ */ new Date(864e13);
|
|
@@ -127256,9 +127177,6 @@ ${lanes.join("\n")}
|
|
|
127256
127177
|
const { types, checker } = type;
|
|
127257
127178
|
return types.length === 2 && (areIntersectedTypesAvoidingStringReduction(checker, types[0], types[1]) || areIntersectedTypesAvoidingStringReduction(checker, types[1], types[0]));
|
|
127258
127179
|
}
|
|
127259
|
-
function isPunctuation(kind) {
|
|
127260
|
-
return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */;
|
|
127261
|
-
}
|
|
127262
127180
|
function isInsideTemplateLiteral(node, position, sourceFile) {
|
|
127263
127181
|
return isTemplateLiteralKind(node.kind) && (node.getStart(sourceFile) < position && position < node.end) || !!node.isUnterminated && position === node.end;
|
|
127264
127182
|
}
|
|
@@ -131735,7 +131653,6 @@ ${lanes.join("\n")}
|
|
|
131735
131653
|
"src/services/sourcemaps.ts"() {
|
|
131736
131654
|
"use strict";
|
|
131737
131655
|
init_ts4();
|
|
131738
|
-
init_ts4();
|
|
131739
131656
|
base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+\/=]+)$)?/;
|
|
131740
131657
|
}
|
|
131741
131658
|
});
|
|
@@ -132965,6 +132882,241 @@ ${lanes.join("\n")}
|
|
|
132965
132882
|
}
|
|
132966
132883
|
});
|
|
132967
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
|
+
|
|
132968
133120
|
// src/services/services.ts
|
|
132969
133121
|
function createNode(kind, pos, end, parent2) {
|
|
132970
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);
|
|
@@ -133731,7 +133883,7 @@ ${lanes.join("\n")}
|
|
|
133731
133883
|
synchronizeHostData();
|
|
133732
133884
|
const responseFormat = format || "original" /* Original */;
|
|
133733
133885
|
if (responseFormat === "2020" /* TwentyTwenty */) {
|
|
133734
|
-
return
|
|
133886
|
+
return getSemanticClassifications2(program, cancellationToken, getValidSourceFile(fileName), span);
|
|
133735
133887
|
} else {
|
|
133736
133888
|
return getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
|
|
133737
133889
|
}
|
|
@@ -133742,7 +133894,7 @@ ${lanes.join("\n")}
|
|
|
133742
133894
|
if (responseFormat === "original" /* Original */) {
|
|
133743
133895
|
return getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
|
|
133744
133896
|
} else {
|
|
133745
|
-
return
|
|
133897
|
+
return getEncodedSemanticClassifications2(program, cancellationToken, getValidSourceFile(fileName), span);
|
|
133746
133898
|
}
|
|
133747
133899
|
}
|
|
133748
133900
|
function getSyntacticClassifications2(fileName, span) {
|
|
@@ -134402,9 +134554,10 @@ ${lanes.join("\n")}
|
|
|
134402
134554
|
"src/services/services.ts"() {
|
|
134403
134555
|
"use strict";
|
|
134404
134556
|
init_ts4();
|
|
134405
|
-
init_ts4();
|
|
134406
134557
|
init_ts_NavigateTo();
|
|
134407
134558
|
init_ts_NavigationBar();
|
|
134559
|
+
init_classifier();
|
|
134560
|
+
init_classifier2020();
|
|
134408
134561
|
servicesVersion = "0.8";
|
|
134409
134562
|
NodeObject = class {
|
|
134410
134563
|
constructor(kind, pos, end) {
|
|
@@ -137006,241 +137159,6 @@ ${lanes.join("\n")}
|
|
|
137006
137159
|
}
|
|
137007
137160
|
});
|
|
137008
137161
|
|
|
137009
|
-
// src/services/classifier2020.ts
|
|
137010
|
-
function getSemanticClassifications2(program, cancellationToken, sourceFile, span) {
|
|
137011
|
-
const classifications = getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span);
|
|
137012
|
-
Debug.assert(classifications.spans.length % 3 === 0);
|
|
137013
|
-
const dense = classifications.spans;
|
|
137014
|
-
const result = [];
|
|
137015
|
-
for (let i = 0; i < dense.length; i += 3) {
|
|
137016
|
-
result.push({
|
|
137017
|
-
textSpan: createTextSpan(dense[i], dense[i + 1]),
|
|
137018
|
-
classificationType: dense[i + 2]
|
|
137019
|
-
});
|
|
137020
|
-
}
|
|
137021
|
-
return result;
|
|
137022
|
-
}
|
|
137023
|
-
function getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span) {
|
|
137024
|
-
return {
|
|
137025
|
-
spans: getSemanticTokens(program, sourceFile, span, cancellationToken),
|
|
137026
|
-
endOfLineState: 0 /* None */
|
|
137027
|
-
};
|
|
137028
|
-
}
|
|
137029
|
-
function getSemanticTokens(program, sourceFile, span, cancellationToken) {
|
|
137030
|
-
const resultTokens = [];
|
|
137031
|
-
const collector = (node, typeIdx, modifierSet) => {
|
|
137032
|
-
resultTokens.push(node.getStart(sourceFile), node.getWidth(sourceFile), (typeIdx + 1 << 8 /* typeOffset */) + modifierSet);
|
|
137033
|
-
};
|
|
137034
|
-
if (program && sourceFile) {
|
|
137035
|
-
collectTokens(program, sourceFile, span, collector, cancellationToken);
|
|
137036
|
-
}
|
|
137037
|
-
return resultTokens;
|
|
137038
|
-
}
|
|
137039
|
-
function collectTokens(program, sourceFile, span, collector, cancellationToken) {
|
|
137040
|
-
const typeChecker = program.getTypeChecker();
|
|
137041
|
-
let inJSXElement = false;
|
|
137042
|
-
function visit(node) {
|
|
137043
|
-
switch (node.kind) {
|
|
137044
|
-
case 265 /* ModuleDeclaration */:
|
|
137045
|
-
case 261 /* ClassDeclaration */:
|
|
137046
|
-
case 262 /* InterfaceDeclaration */:
|
|
137047
|
-
case 260 /* FunctionDeclaration */:
|
|
137048
|
-
case 229 /* ClassExpression */:
|
|
137049
|
-
case 216 /* FunctionExpression */:
|
|
137050
|
-
case 217 /* ArrowFunction */:
|
|
137051
|
-
cancellationToken.throwIfCancellationRequested();
|
|
137052
|
-
}
|
|
137053
|
-
if (!node || !textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) {
|
|
137054
|
-
return;
|
|
137055
|
-
}
|
|
137056
|
-
const prevInJSXElement = inJSXElement;
|
|
137057
|
-
if (isJsxElement(node) || isJsxSelfClosingElement(node)) {
|
|
137058
|
-
inJSXElement = true;
|
|
137059
|
-
}
|
|
137060
|
-
if (isJsxExpression(node)) {
|
|
137061
|
-
inJSXElement = false;
|
|
137062
|
-
}
|
|
137063
|
-
if (isIdentifier(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) {
|
|
137064
|
-
let symbol = typeChecker.getSymbolAtLocation(node);
|
|
137065
|
-
if (symbol) {
|
|
137066
|
-
if (symbol.flags & 2097152 /* Alias */) {
|
|
137067
|
-
symbol = typeChecker.getAliasedSymbol(symbol);
|
|
137068
|
-
}
|
|
137069
|
-
let typeIdx = classifySymbol2(symbol, getMeaningFromLocation(node));
|
|
137070
|
-
if (typeIdx !== void 0) {
|
|
137071
|
-
let modifierSet = 0;
|
|
137072
|
-
if (node.parent) {
|
|
137073
|
-
const parentIsDeclaration = isBindingElement(node.parent) || tokenFromDeclarationMapping.get(node.parent.kind) === typeIdx;
|
|
137074
|
-
if (parentIsDeclaration && node.parent.name === node) {
|
|
137075
|
-
modifierSet = 1 << 0 /* declaration */;
|
|
137076
|
-
}
|
|
137077
|
-
}
|
|
137078
|
-
if (typeIdx === 6 /* parameter */ && isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
|
|
137079
|
-
typeIdx = 9 /* property */;
|
|
137080
|
-
}
|
|
137081
|
-
typeIdx = reclassifyByType(typeChecker, node, typeIdx);
|
|
137082
|
-
const decl = symbol.valueDeclaration;
|
|
137083
|
-
if (decl) {
|
|
137084
|
-
const modifiers = getCombinedModifierFlags(decl);
|
|
137085
|
-
const nodeFlags = getCombinedNodeFlags(decl);
|
|
137086
|
-
if (modifiers & 32 /* Static */) {
|
|
137087
|
-
modifierSet |= 1 << 1 /* static */;
|
|
137088
|
-
}
|
|
137089
|
-
if (modifiers & 512 /* Async */) {
|
|
137090
|
-
modifierSet |= 1 << 2 /* async */;
|
|
137091
|
-
}
|
|
137092
|
-
if (typeIdx !== 0 /* class */ && typeIdx !== 2 /* interface */) {
|
|
137093
|
-
if (modifiers & 64 /* Readonly */ || nodeFlags & 2 /* Const */ || symbol.getFlags() & 8 /* EnumMember */) {
|
|
137094
|
-
modifierSet |= 1 << 3 /* readonly */;
|
|
137095
|
-
}
|
|
137096
|
-
}
|
|
137097
|
-
if ((typeIdx === 7 /* variable */ || typeIdx === 10 /* function */) && isLocalDeclaration(decl, sourceFile)) {
|
|
137098
|
-
modifierSet |= 1 << 5 /* local */;
|
|
137099
|
-
}
|
|
137100
|
-
if (program.isSourceFileDefaultLibrary(decl.getSourceFile())) {
|
|
137101
|
-
modifierSet |= 1 << 4 /* defaultLibrary */;
|
|
137102
|
-
}
|
|
137103
|
-
} else if (symbol.declarations && symbol.declarations.some((d) => program.isSourceFileDefaultLibrary(d.getSourceFile()))) {
|
|
137104
|
-
modifierSet |= 1 << 4 /* defaultLibrary */;
|
|
137105
|
-
}
|
|
137106
|
-
collector(node, typeIdx, modifierSet);
|
|
137107
|
-
}
|
|
137108
|
-
}
|
|
137109
|
-
}
|
|
137110
|
-
forEachChild(node, visit);
|
|
137111
|
-
inJSXElement = prevInJSXElement;
|
|
137112
|
-
}
|
|
137113
|
-
visit(sourceFile);
|
|
137114
|
-
}
|
|
137115
|
-
function classifySymbol2(symbol, meaning) {
|
|
137116
|
-
const flags = symbol.getFlags();
|
|
137117
|
-
if (flags & 32 /* Class */) {
|
|
137118
|
-
return 0 /* class */;
|
|
137119
|
-
} else if (flags & 384 /* Enum */) {
|
|
137120
|
-
return 1 /* enum */;
|
|
137121
|
-
} else if (flags & 524288 /* TypeAlias */) {
|
|
137122
|
-
return 5 /* type */;
|
|
137123
|
-
} else if (flags & 64 /* Interface */) {
|
|
137124
|
-
if (meaning & 2 /* Type */) {
|
|
137125
|
-
return 2 /* interface */;
|
|
137126
|
-
}
|
|
137127
|
-
} else if (flags & 262144 /* TypeParameter */) {
|
|
137128
|
-
return 4 /* typeParameter */;
|
|
137129
|
-
}
|
|
137130
|
-
let decl = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0];
|
|
137131
|
-
if (decl && isBindingElement(decl)) {
|
|
137132
|
-
decl = getDeclarationForBindingElement(decl);
|
|
137133
|
-
}
|
|
137134
|
-
return decl && tokenFromDeclarationMapping.get(decl.kind);
|
|
137135
|
-
}
|
|
137136
|
-
function reclassifyByType(typeChecker, node, typeIdx) {
|
|
137137
|
-
if (typeIdx === 7 /* variable */ || typeIdx === 9 /* property */ || typeIdx === 6 /* parameter */) {
|
|
137138
|
-
const type = typeChecker.getTypeAtLocation(node);
|
|
137139
|
-
if (type) {
|
|
137140
|
-
const test = (condition) => {
|
|
137141
|
-
return condition(type) || type.isUnion() && type.types.some(condition);
|
|
137142
|
-
};
|
|
137143
|
-
if (typeIdx !== 6 /* parameter */ && test((t) => t.getConstructSignatures().length > 0)) {
|
|
137144
|
-
return 0 /* class */;
|
|
137145
|
-
}
|
|
137146
|
-
if (test((t) => t.getCallSignatures().length > 0) && !test((t) => t.getProperties().length > 0) || isExpressionInCallExpression(node)) {
|
|
137147
|
-
return typeIdx === 9 /* property */ ? 11 /* member */ : 10 /* function */;
|
|
137148
|
-
}
|
|
137149
|
-
}
|
|
137150
|
-
}
|
|
137151
|
-
return typeIdx;
|
|
137152
|
-
}
|
|
137153
|
-
function isLocalDeclaration(decl, sourceFile) {
|
|
137154
|
-
if (isBindingElement(decl)) {
|
|
137155
|
-
decl = getDeclarationForBindingElement(decl);
|
|
137156
|
-
}
|
|
137157
|
-
if (isVariableDeclaration(decl)) {
|
|
137158
|
-
return (!isSourceFile(decl.parent.parent.parent) || isCatchClause(decl.parent)) && decl.getSourceFile() === sourceFile;
|
|
137159
|
-
} else if (isFunctionDeclaration(decl)) {
|
|
137160
|
-
return !isSourceFile(decl.parent) && decl.getSourceFile() === sourceFile;
|
|
137161
|
-
}
|
|
137162
|
-
return false;
|
|
137163
|
-
}
|
|
137164
|
-
function getDeclarationForBindingElement(element) {
|
|
137165
|
-
while (true) {
|
|
137166
|
-
if (isBindingElement(element.parent.parent)) {
|
|
137167
|
-
element = element.parent.parent;
|
|
137168
|
-
} else {
|
|
137169
|
-
return element.parent.parent;
|
|
137170
|
-
}
|
|
137171
|
-
}
|
|
137172
|
-
}
|
|
137173
|
-
function inImportClause(node) {
|
|
137174
|
-
const parent2 = node.parent;
|
|
137175
|
-
return parent2 && (isImportClause(parent2) || isImportSpecifier(parent2) || isNamespaceImport(parent2));
|
|
137176
|
-
}
|
|
137177
|
-
function isExpressionInCallExpression(node) {
|
|
137178
|
-
while (isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
|
|
137179
|
-
node = node.parent;
|
|
137180
|
-
}
|
|
137181
|
-
return isCallExpression(node.parent) && node.parent.expression === node;
|
|
137182
|
-
}
|
|
137183
|
-
function isRightSideOfQualifiedNameOrPropertyAccess2(node) {
|
|
137184
|
-
return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node;
|
|
137185
|
-
}
|
|
137186
|
-
var TokenEncodingConsts, TokenType, TokenModifier, tokenFromDeclarationMapping;
|
|
137187
|
-
var init_classifier2020 = __esm({
|
|
137188
|
-
"src/services/classifier2020.ts"() {
|
|
137189
|
-
"use strict";
|
|
137190
|
-
init_ts4();
|
|
137191
|
-
TokenEncodingConsts = /* @__PURE__ */ ((TokenEncodingConsts2) => {
|
|
137192
|
-
TokenEncodingConsts2[TokenEncodingConsts2["typeOffset"] = 8] = "typeOffset";
|
|
137193
|
-
TokenEncodingConsts2[TokenEncodingConsts2["modifierMask"] = 255] = "modifierMask";
|
|
137194
|
-
return TokenEncodingConsts2;
|
|
137195
|
-
})(TokenEncodingConsts || {});
|
|
137196
|
-
TokenType = /* @__PURE__ */ ((TokenType2) => {
|
|
137197
|
-
TokenType2[TokenType2["class"] = 0] = "class";
|
|
137198
|
-
TokenType2[TokenType2["enum"] = 1] = "enum";
|
|
137199
|
-
TokenType2[TokenType2["interface"] = 2] = "interface";
|
|
137200
|
-
TokenType2[TokenType2["namespace"] = 3] = "namespace";
|
|
137201
|
-
TokenType2[TokenType2["typeParameter"] = 4] = "typeParameter";
|
|
137202
|
-
TokenType2[TokenType2["type"] = 5] = "type";
|
|
137203
|
-
TokenType2[TokenType2["parameter"] = 6] = "parameter";
|
|
137204
|
-
TokenType2[TokenType2["variable"] = 7] = "variable";
|
|
137205
|
-
TokenType2[TokenType2["enumMember"] = 8] = "enumMember";
|
|
137206
|
-
TokenType2[TokenType2["property"] = 9] = "property";
|
|
137207
|
-
TokenType2[TokenType2["function"] = 10] = "function";
|
|
137208
|
-
TokenType2[TokenType2["member"] = 11] = "member";
|
|
137209
|
-
return TokenType2;
|
|
137210
|
-
})(TokenType || {});
|
|
137211
|
-
TokenModifier = /* @__PURE__ */ ((TokenModifier2) => {
|
|
137212
|
-
TokenModifier2[TokenModifier2["declaration"] = 0] = "declaration";
|
|
137213
|
-
TokenModifier2[TokenModifier2["static"] = 1] = "static";
|
|
137214
|
-
TokenModifier2[TokenModifier2["async"] = 2] = "async";
|
|
137215
|
-
TokenModifier2[TokenModifier2["readonly"] = 3] = "readonly";
|
|
137216
|
-
TokenModifier2[TokenModifier2["defaultLibrary"] = 4] = "defaultLibrary";
|
|
137217
|
-
TokenModifier2[TokenModifier2["local"] = 5] = "local";
|
|
137218
|
-
return TokenModifier2;
|
|
137219
|
-
})(TokenModifier || {});
|
|
137220
|
-
tokenFromDeclarationMapping = /* @__PURE__ */ new Map([
|
|
137221
|
-
[258 /* VariableDeclaration */, 7 /* variable */],
|
|
137222
|
-
[167 /* Parameter */, 6 /* parameter */],
|
|
137223
|
-
[170 /* PropertyDeclaration */, 9 /* property */],
|
|
137224
|
-
[265 /* ModuleDeclaration */, 3 /* namespace */],
|
|
137225
|
-
[264 /* EnumDeclaration */, 1 /* enum */],
|
|
137226
|
-
[303 /* EnumMember */, 8 /* enumMember */],
|
|
137227
|
-
[261 /* ClassDeclaration */, 0 /* class */],
|
|
137228
|
-
[172 /* MethodDeclaration */, 11 /* member */],
|
|
137229
|
-
[260 /* FunctionDeclaration */, 10 /* function */],
|
|
137230
|
-
[216 /* FunctionExpression */, 10 /* function */],
|
|
137231
|
-
[171 /* MethodSignature */, 11 /* member */],
|
|
137232
|
-
[175 /* GetAccessor */, 9 /* property */],
|
|
137233
|
-
[176 /* SetAccessor */, 9 /* property */],
|
|
137234
|
-
[169 /* PropertySignature */, 9 /* property */],
|
|
137235
|
-
[262 /* InterfaceDeclaration */, 2 /* interface */],
|
|
137236
|
-
[263 /* TypeAliasDeclaration */, 5 /* type */],
|
|
137237
|
-
[166 /* TypeParameter */, 4 /* typeParameter */],
|
|
137238
|
-
[300 /* PropertyAssignment */, 9 /* property */],
|
|
137239
|
-
[301 /* ShorthandPropertyAssignment */, 9 /* property */]
|
|
137240
|
-
]);
|
|
137241
|
-
}
|
|
137242
|
-
});
|
|
137243
|
-
|
|
137244
137162
|
// src/services/_namespaces/ts.classifier.v2020.ts
|
|
137245
137163
|
var ts_classifier_v2020_exports = {};
|
|
137246
137164
|
__export(ts_classifier_v2020_exports, {
|
|
@@ -170349,7 +170267,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
170349
170267
|
serverHost: this.projectService.host,
|
|
170350
170268
|
session: this.projectService.session
|
|
170351
170269
|
};
|
|
170352
|
-
const pluginModule = pluginModuleFactory({ typescript:
|
|
170270
|
+
const pluginModule = pluginModuleFactory({ typescript: ts_exports2 });
|
|
170353
170271
|
const newLS = pluginModule.create(info);
|
|
170354
170272
|
for (const k of Object.keys(this.languageService)) {
|
|
170355
170273
|
if (!(k in newLS)) {
|
|
@@ -178681,8 +178599,8 @@ ${e.message}`;
|
|
|
178681
178599
|
});
|
|
178682
178600
|
|
|
178683
178601
|
// src/server/_namespaces/ts.ts
|
|
178684
|
-
var
|
|
178685
|
-
__export(
|
|
178602
|
+
var ts_exports2 = {};
|
|
178603
|
+
__export(ts_exports2, {
|
|
178686
178604
|
ANONYMOUS: () => ANONYMOUS,
|
|
178687
178605
|
AccessFlags: () => AccessFlags,
|
|
178688
178606
|
AssertionLevel: () => AssertionLevel,
|
|
@@ -178985,8 +178903,8 @@ ${e.message}`;
|
|
|
178985
178903
|
convertCompilerOptionsFromJson: () => convertCompilerOptionsFromJson,
|
|
178986
178904
|
convertJsonOption: () => convertJsonOption,
|
|
178987
178905
|
convertToBase64: () => convertToBase64,
|
|
178906
|
+
convertToJson: () => convertToJson,
|
|
178988
178907
|
convertToObject: () => convertToObject,
|
|
178989
|
-
convertToObjectWorker: () => convertToObjectWorker,
|
|
178990
178908
|
convertToOptionsWithAbsolutePaths: () => convertToOptionsWithAbsolutePaths,
|
|
178991
178909
|
convertToRelativePath: () => convertToRelativePath,
|
|
178992
178910
|
convertToTSConfig: () => convertToTSConfig,
|
|
@@ -180132,6 +180050,7 @@ ${e.message}`;
|
|
|
180132
180050
|
isJsxText: () => isJsxText,
|
|
180133
180051
|
isJumpStatementTarget: () => isJumpStatementTarget,
|
|
180134
180052
|
isKeyword: () => isKeyword,
|
|
180053
|
+
isKeywordOrPunctuation: () => isKeywordOrPunctuation,
|
|
180135
180054
|
isKnownSymbol: () => isKnownSymbol,
|
|
180136
180055
|
isLabelName: () => isLabelName,
|
|
180137
180056
|
isLabelOfLabeledStatement: () => isLabelOfLabeledStatement,
|
|
@@ -181039,8 +180958,8 @@ ${e.message}`;
|
|
|
181039
180958
|
});
|
|
181040
180959
|
|
|
181041
180960
|
// src/tsserverlibrary/_namespaces/ts.ts
|
|
181042
|
-
var
|
|
181043
|
-
__export(
|
|
180961
|
+
var ts_exports3 = {};
|
|
180962
|
+
__export(ts_exports3, {
|
|
181044
180963
|
ANONYMOUS: () => ANONYMOUS,
|
|
181045
180964
|
AccessFlags: () => AccessFlags,
|
|
181046
180965
|
AssertionLevel: () => AssertionLevel,
|
|
@@ -181343,8 +181262,8 @@ ${e.message}`;
|
|
|
181343
181262
|
convertCompilerOptionsFromJson: () => convertCompilerOptionsFromJson,
|
|
181344
181263
|
convertJsonOption: () => convertJsonOption,
|
|
181345
181264
|
convertToBase64: () => convertToBase64,
|
|
181265
|
+
convertToJson: () => convertToJson,
|
|
181346
181266
|
convertToObject: () => convertToObject,
|
|
181347
|
-
convertToObjectWorker: () => convertToObjectWorker,
|
|
181348
181267
|
convertToOptionsWithAbsolutePaths: () => convertToOptionsWithAbsolutePaths,
|
|
181349
181268
|
convertToRelativePath: () => convertToRelativePath,
|
|
181350
181269
|
convertToTSConfig: () => convertToTSConfig,
|
|
@@ -182490,6 +182409,7 @@ ${e.message}`;
|
|
|
182490
182409
|
isJsxText: () => isJsxText,
|
|
182491
182410
|
isJumpStatementTarget: () => isJumpStatementTarget,
|
|
182492
182411
|
isKeyword: () => isKeyword,
|
|
182412
|
+
isKeywordOrPunctuation: () => isKeywordOrPunctuation,
|
|
182493
182413
|
isKnownSymbol: () => isKnownSymbol,
|
|
182494
182414
|
isLabelName: () => isLabelName,
|
|
182495
182415
|
isLabelOfLabeledStatement: () => isLabelOfLabeledStatement,
|
|
@@ -183301,7 +183221,7 @@ ${e.message}`;
|
|
|
183301
183221
|
var require_tsserverlibrary = __commonJS({
|
|
183302
183222
|
"src/tsserverlibrary/tsserverlibrary.ts"(exports, module2) {
|
|
183303
183223
|
init_ts7();
|
|
183304
|
-
module2.exports =
|
|
183224
|
+
module2.exports = ts_exports3;
|
|
183305
183225
|
}
|
|
183306
183226
|
});
|
|
183307
183227
|
return require_tsserverlibrary();
|