typescript 5.1.0-dev.20230320 → 5.1.0-dev.20230321
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.decorators.legacy.d.ts +1 -1
- package/lib/tsc.js +391 -515
- package/lib/tsserver.js +631 -726
- package/lib/tsserverlibrary.d.ts +6 -6
- package/lib/tsserverlibrary.js +642 -745
- package/lib/typescript.d.ts +6 -6
- package/lib/typescript.js +637 -741
- package/lib/typingsInstaller.js +74 -255
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -338,8 +338,8 @@ __export(server_exports, {
|
|
|
338
338
|
convertCompilerOptionsFromJson: () => convertCompilerOptionsFromJson,
|
|
339
339
|
convertJsonOption: () => convertJsonOption,
|
|
340
340
|
convertToBase64: () => convertToBase64,
|
|
341
|
+
convertToJson: () => convertToJson,
|
|
341
342
|
convertToObject: () => convertToObject,
|
|
342
|
-
convertToObjectWorker: () => convertToObjectWorker,
|
|
343
343
|
convertToOptionsWithAbsolutePaths: () => convertToOptionsWithAbsolutePaths,
|
|
344
344
|
convertToRelativePath: () => convertToRelativePath,
|
|
345
345
|
convertToTSConfig: () => convertToTSConfig,
|
|
@@ -1485,6 +1485,7 @@ __export(server_exports, {
|
|
|
1485
1485
|
isJsxText: () => isJsxText,
|
|
1486
1486
|
isJumpStatementTarget: () => isJumpStatementTarget,
|
|
1487
1487
|
isKeyword: () => isKeyword,
|
|
1488
|
+
isKeywordOrPunctuation: () => isKeywordOrPunctuation,
|
|
1488
1489
|
isKnownSymbol: () => isKnownSymbol,
|
|
1489
1490
|
isLabelName: () => isLabelName,
|
|
1490
1491
|
isLabelOfLabeledStatement: () => isLabelOfLabeledStatement,
|
|
@@ -2285,7 +2286,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2285
2286
|
|
|
2286
2287
|
// src/compiler/corePublic.ts
|
|
2287
2288
|
var versionMajorMinor = "5.1";
|
|
2288
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2289
|
+
var version = `${versionMajorMinor}.0-dev.20230321`;
|
|
2289
2290
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2290
2291
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2291
2292
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -10565,13 +10566,14 @@ var Diagnostics = {
|
|
|
10565
10566
|
Output_Formatting: diag(6256, 3 /* Message */, "Output_Formatting_6256", "Output Formatting"),
|
|
10566
10567
|
Completeness: diag(6257, 3 /* Message */, "Completeness_6257", "Completeness"),
|
|
10567
10568
|
_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"),
|
|
10568
|
-
|
|
10569
|
+
Found_1_error_in_0: diag(6259, 3 /* Message */, "Found_1_error_in_0_6259", "Found 1 error in {0}"),
|
|
10569
10570
|
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}"),
|
|
10570
10571
|
Found_0_errors_in_1_files: diag(6261, 3 /* Message */, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
10571
10572
|
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."),
|
|
10572
10573
|
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."),
|
|
10573
10574
|
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."),
|
|
10574
10575
|
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."),
|
|
10576
|
+
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."),
|
|
10575
10577
|
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."),
|
|
10576
10578
|
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}'."),
|
|
10577
10579
|
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."),
|
|
@@ -16031,17 +16033,17 @@ function entityNameToString(name) {
|
|
|
16031
16033
|
return Debug.assertNever(name);
|
|
16032
16034
|
}
|
|
16033
16035
|
}
|
|
16034
|
-
function createDiagnosticForNode(node, message,
|
|
16036
|
+
function createDiagnosticForNode(node, message, ...args) {
|
|
16035
16037
|
const sourceFile = getSourceFileOfNode(node);
|
|
16036
|
-
return createDiagnosticForNodeInSourceFile(sourceFile, node, message,
|
|
16038
|
+
return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args);
|
|
16037
16039
|
}
|
|
16038
|
-
function createDiagnosticForNodeArray(sourceFile, nodes, message,
|
|
16040
|
+
function createDiagnosticForNodeArray(sourceFile, nodes, message, ...args) {
|
|
16039
16041
|
const start2 = skipTrivia(sourceFile.text, nodes.pos);
|
|
16040
|
-
return createFileDiagnostic(sourceFile, start2, nodes.end - start2, message,
|
|
16042
|
+
return createFileDiagnostic(sourceFile, start2, nodes.end - start2, message, ...args);
|
|
16041
16043
|
}
|
|
16042
|
-
function createDiagnosticForNodeInSourceFile(sourceFile, node, message,
|
|
16044
|
+
function createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args) {
|
|
16043
16045
|
const span = getErrorSpanForNode(sourceFile, node);
|
|
16044
|
-
return createFileDiagnostic(sourceFile, span.start, span.length, message,
|
|
16046
|
+
return createFileDiagnostic(sourceFile, span.start, span.length, message, ...args);
|
|
16045
16047
|
}
|
|
16046
16048
|
function createDiagnosticForNodeFromMessageChain(sourceFile, node, messageChain, relatedInformation) {
|
|
16047
16049
|
const span = getErrorSpanForNode(sourceFile, node);
|
|
@@ -17867,6 +17869,12 @@ function getAncestor(node, kind) {
|
|
|
17867
17869
|
function isKeyword(token) {
|
|
17868
17870
|
return 82 /* FirstKeyword */ <= token && token <= 163 /* LastKeyword */;
|
|
17869
17871
|
}
|
|
17872
|
+
function isPunctuation(token) {
|
|
17873
|
+
return 18 /* FirstPunctuation */ <= token && token <= 78 /* LastPunctuation */;
|
|
17874
|
+
}
|
|
17875
|
+
function isKeywordOrPunctuation(token) {
|
|
17876
|
+
return isKeyword(token) || isPunctuation(token);
|
|
17877
|
+
}
|
|
17870
17878
|
function isContextualKeyword(token) {
|
|
17871
17879
|
return 127 /* FirstContextualKeyword */ <= token && token <= 163 /* LastContextualKeyword */;
|
|
17872
17880
|
}
|
|
@@ -30421,14 +30429,12 @@ var Parser;
|
|
|
30421
30429
|
scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
|
|
30422
30430
|
if (scriptKind2 === 6 /* JSON */) {
|
|
30423
30431
|
const result2 = parseJsonText2(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes);
|
|
30424
|
-
|
|
30432
|
+
convertToJson(
|
|
30425
30433
|
result2,
|
|
30426
30434
|
(_a2 = result2.statements[0]) == null ? void 0 : _a2.expression,
|
|
30427
30435
|
result2.parseDiagnostics,
|
|
30428
30436
|
/*returnValue*/
|
|
30429
30437
|
false,
|
|
30430
|
-
/*knownRootOptions*/
|
|
30431
|
-
void 0,
|
|
30432
30438
|
/*jsonConversionNotifier*/
|
|
30433
30439
|
void 0
|
|
30434
30440
|
);
|
|
@@ -30860,24 +30866,24 @@ var Parser;
|
|
|
30860
30866
|
function inAwaitContext() {
|
|
30861
30867
|
return inContext(32768 /* AwaitContext */);
|
|
30862
30868
|
}
|
|
30863
|
-
function parseErrorAtCurrentToken(message,
|
|
30864
|
-
return parseErrorAt(scanner2.getTokenStart(), scanner2.getTokenEnd(), message,
|
|
30869
|
+
function parseErrorAtCurrentToken(message, ...args) {
|
|
30870
|
+
return parseErrorAt(scanner2.getTokenStart(), scanner2.getTokenEnd(), message, ...args);
|
|
30865
30871
|
}
|
|
30866
|
-
function parseErrorAtPosition(start2, length2, message,
|
|
30872
|
+
function parseErrorAtPosition(start2, length2, message, ...args) {
|
|
30867
30873
|
const lastError = lastOrUndefined(parseDiagnostics);
|
|
30868
30874
|
let result;
|
|
30869
30875
|
if (!lastError || start2 !== lastError.start) {
|
|
30870
|
-
result = createDetachedDiagnostic(fileName, start2, length2, message,
|
|
30876
|
+
result = createDetachedDiagnostic(fileName, start2, length2, message, ...args);
|
|
30871
30877
|
parseDiagnostics.push(result);
|
|
30872
30878
|
}
|
|
30873
30879
|
parseErrorBeforeNextFinishedNode = true;
|
|
30874
30880
|
return result;
|
|
30875
30881
|
}
|
|
30876
|
-
function parseErrorAt(start2, end, message,
|
|
30877
|
-
return parseErrorAtPosition(start2, end - start2, message,
|
|
30882
|
+
function parseErrorAt(start2, end, message, ...args) {
|
|
30883
|
+
return parseErrorAtPosition(start2, end - start2, message, ...args);
|
|
30878
30884
|
}
|
|
30879
|
-
function parseErrorAtRange(range, message,
|
|
30880
|
-
parseErrorAt(range.pos, range.end, message,
|
|
30885
|
+
function parseErrorAtRange(range, message, ...args) {
|
|
30886
|
+
parseErrorAt(range.pos, range.end, message, ...args);
|
|
30881
30887
|
}
|
|
30882
30888
|
function scanError(message, length2) {
|
|
30883
30889
|
parseErrorAtPosition(scanner2.getTokenEnd(), length2, message);
|
|
@@ -31083,6 +31089,7 @@ var Parser;
|
|
|
31083
31089
|
nextTokenJSDoc();
|
|
31084
31090
|
return true;
|
|
31085
31091
|
}
|
|
31092
|
+
Debug.assert(isKeywordOrPunctuation(kind));
|
|
31086
31093
|
parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(kind));
|
|
31087
31094
|
return false;
|
|
31088
31095
|
}
|
|
@@ -31131,7 +31138,11 @@ var Parser;
|
|
|
31131
31138
|
);
|
|
31132
31139
|
}
|
|
31133
31140
|
function parseExpectedTokenJSDoc(t) {
|
|
31134
|
-
|
|
31141
|
+
const optional = parseOptionalTokenJSDoc(t);
|
|
31142
|
+
if (optional)
|
|
31143
|
+
return optional;
|
|
31144
|
+
Debug.assert(isKeywordOrPunctuation(t));
|
|
31145
|
+
return createMissingNode(
|
|
31135
31146
|
t,
|
|
31136
31147
|
/*reportAtCurrentPosition*/
|
|
31137
31148
|
false,
|
|
@@ -31185,11 +31196,11 @@ var Parser;
|
|
|
31185
31196
|
}
|
|
31186
31197
|
return node;
|
|
31187
31198
|
}
|
|
31188
|
-
function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage,
|
|
31199
|
+
function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, ...args) {
|
|
31189
31200
|
if (reportAtCurrentPosition) {
|
|
31190
|
-
parseErrorAtPosition(scanner2.getTokenFullStart(), 0, diagnosticMessage,
|
|
31201
|
+
parseErrorAtPosition(scanner2.getTokenFullStart(), 0, diagnosticMessage, ...args);
|
|
31191
31202
|
} else if (diagnosticMessage) {
|
|
31192
|
-
parseErrorAtCurrentToken(diagnosticMessage,
|
|
31203
|
+
parseErrorAtCurrentToken(diagnosticMessage, ...args);
|
|
31193
31204
|
}
|
|
31194
31205
|
const pos = getNodePos();
|
|
31195
31206
|
const result = kind === 79 /* Identifier */ ? factoryCreateIdentifier(
|
|
@@ -33548,6 +33559,7 @@ var Parser;
|
|
|
33548
33559
|
if (simpleUnaryExpression.kind === 214 /* TypeAssertionExpression */) {
|
|
33549
33560
|
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);
|
|
33550
33561
|
} else {
|
|
33562
|
+
Debug.assert(isKeywordOrPunctuation(unaryOperator));
|
|
33551
33563
|
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));
|
|
33552
33564
|
}
|
|
33553
33565
|
}
|
|
@@ -36495,14 +36507,14 @@ var Parser;
|
|
|
36495
36507
|
}
|
|
36496
36508
|
function parseReturnTag(start3, tagName, indent3, indentText) {
|
|
36497
36509
|
if (some(tags, isJSDocReturnTag)) {
|
|
36498
|
-
parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
|
|
36510
|
+
parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText));
|
|
36499
36511
|
}
|
|
36500
36512
|
const typeExpression = tryParseTypeExpression();
|
|
36501
36513
|
return finishNode(factory2.createJSDocReturnTag(tagName, typeExpression, parseTrailingTagComments(start3, getNodePos(), indent3, indentText)), start3);
|
|
36502
36514
|
}
|
|
36503
36515
|
function parseTypeTag(start3, tagName, indent3, indentText) {
|
|
36504
36516
|
if (some(tags, isJSDocTypeTag)) {
|
|
36505
|
-
parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, tagName.escapedText);
|
|
36517
|
+
parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText));
|
|
36506
36518
|
}
|
|
36507
36519
|
const typeExpression = parseJSDocTypeExpression(
|
|
36508
36520
|
/*mayOmitBraces*/
|
|
@@ -38987,13 +38999,13 @@ function parseListTypeOption(opt, value = "", errors) {
|
|
|
38987
38999
|
function getOptionName(option) {
|
|
38988
39000
|
return option.name;
|
|
38989
39001
|
}
|
|
38990
|
-
function createUnknownOptionError(unknownOption, diagnostics,
|
|
39002
|
+
function createUnknownOptionError(unknownOption, diagnostics, unknownOptionErrorText, node, sourceFile) {
|
|
38991
39003
|
var _a2;
|
|
38992
39004
|
if ((_a2 = diagnostics.alternateMode) == null ? void 0 : _a2.getOptionsNameMap().optionsNameMap.has(unknownOption.toLowerCase())) {
|
|
38993
|
-
return
|
|
39005
|
+
return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.alternateMode.diagnostic, unknownOption);
|
|
38994
39006
|
}
|
|
38995
39007
|
const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
|
|
38996
|
-
return possibleOption ?
|
|
39008
|
+
return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
|
|
38997
39009
|
}
|
|
38998
39010
|
function parseCommandLineWorker(diagnostics, commandLine, readFile) {
|
|
38999
39011
|
const options = {};
|
|
@@ -39034,7 +39046,7 @@ function parseCommandLineWorker(diagnostics, commandLine, readFile) {
|
|
|
39034
39046
|
if (watchOpt) {
|
|
39035
39047
|
i = parseOptionValue(args, i, watchOptionsDidYouMeanDiagnostics, watchOpt, watchOptions || (watchOptions = {}), errors);
|
|
39036
39048
|
} else {
|
|
39037
|
-
errors.push(createUnknownOptionError(inputOptionName, diagnostics,
|
|
39049
|
+
errors.push(createUnknownOptionError(inputOptionName, diagnostics, s));
|
|
39038
39050
|
}
|
|
39039
39051
|
}
|
|
39040
39052
|
} else {
|
|
@@ -39245,9 +39257,7 @@ function parseConfigFileTextToJson(fileName, jsonText) {
|
|
|
39245
39257
|
config: convertConfigFileToObject(
|
|
39246
39258
|
jsonSourceFile,
|
|
39247
39259
|
jsonSourceFile.parseDiagnostics,
|
|
39248
|
-
/*
|
|
39249
|
-
false,
|
|
39250
|
-
/*optionsIterator*/
|
|
39260
|
+
/*jsonConversionNotifier*/
|
|
39251
39261
|
void 0
|
|
39252
39262
|
),
|
|
39253
39263
|
error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0
|
|
@@ -39304,7 +39314,26 @@ var extendsOptionDeclaration = {
|
|
|
39304
39314
|
name: "extends",
|
|
39305
39315
|
type: "string"
|
|
39306
39316
|
},
|
|
39307
|
-
category: Diagnostics.File_Management
|
|
39317
|
+
category: Diagnostics.File_Management,
|
|
39318
|
+
disallowNullOrUndefined: true
|
|
39319
|
+
};
|
|
39320
|
+
var compilerOptionsDeclaration = {
|
|
39321
|
+
name: "compilerOptions",
|
|
39322
|
+
type: "object",
|
|
39323
|
+
elementOptions: getCommandLineCompilerOptionsMap(),
|
|
39324
|
+
extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics
|
|
39325
|
+
};
|
|
39326
|
+
var watchOptionsDeclaration = {
|
|
39327
|
+
name: "watchOptions",
|
|
39328
|
+
type: "object",
|
|
39329
|
+
elementOptions: getCommandLineWatchOptionsMap(),
|
|
39330
|
+
extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics
|
|
39331
|
+
};
|
|
39332
|
+
var typeAcquisitionDeclaration = {
|
|
39333
|
+
name: "typeAcquisition",
|
|
39334
|
+
type: "object",
|
|
39335
|
+
elementOptions: getCommandLineTypeAcquisitionMap(),
|
|
39336
|
+
extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics
|
|
39308
39337
|
};
|
|
39309
39338
|
var _tsconfigRootOptions;
|
|
39310
39339
|
function getTsconfigRootOptionsMap() {
|
|
@@ -39314,24 +39343,9 @@ function getTsconfigRootOptionsMap() {
|
|
|
39314
39343
|
// should never be needed since this is root
|
|
39315
39344
|
type: "object",
|
|
39316
39345
|
elementOptions: commandLineOptionsToMap([
|
|
39317
|
-
|
|
39318
|
-
|
|
39319
|
-
|
|
39320
|
-
elementOptions: getCommandLineCompilerOptionsMap(),
|
|
39321
|
-
extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics
|
|
39322
|
-
},
|
|
39323
|
-
{
|
|
39324
|
-
name: "watchOptions",
|
|
39325
|
-
type: "object",
|
|
39326
|
-
elementOptions: getCommandLineWatchOptionsMap(),
|
|
39327
|
-
extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics
|
|
39328
|
-
},
|
|
39329
|
-
{
|
|
39330
|
-
name: "typeAcquisition",
|
|
39331
|
-
type: "object",
|
|
39332
|
-
elementOptions: getCommandLineTypeAcquisitionMap(),
|
|
39333
|
-
extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics
|
|
39334
|
-
},
|
|
39346
|
+
compilerOptionsDeclaration,
|
|
39347
|
+
watchOptionsDeclaration,
|
|
39348
|
+
typeAcquisitionDeclaration,
|
|
39335
39349
|
extendsOptionDeclaration,
|
|
39336
39350
|
{
|
|
39337
39351
|
name: "references",
|
|
@@ -39377,10 +39391,9 @@ function getTsconfigRootOptionsMap() {
|
|
|
39377
39391
|
}
|
|
39378
39392
|
return _tsconfigRootOptions;
|
|
39379
39393
|
}
|
|
39380
|
-
function convertConfigFileToObject(sourceFile, errors,
|
|
39394
|
+
function convertConfigFileToObject(sourceFile, errors, jsonConversionNotifier) {
|
|
39381
39395
|
var _a2;
|
|
39382
39396
|
const rootExpression = (_a2 = sourceFile.statements[0]) == null ? void 0 : _a2.expression;
|
|
39383
|
-
const knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : void 0;
|
|
39384
39397
|
if (rootExpression && rootExpression.kind !== 208 /* ObjectLiteralExpression */) {
|
|
39385
39398
|
errors.push(createDiagnosticForNodeInSourceFile(
|
|
39386
39399
|
sourceFile,
|
|
@@ -39391,52 +39404,46 @@ function convertConfigFileToObject(sourceFile, errors, reportOptionsErrors, opti
|
|
|
39391
39404
|
if (isArrayLiteralExpression(rootExpression)) {
|
|
39392
39405
|
const firstObject = find(rootExpression.elements, isObjectLiteralExpression);
|
|
39393
39406
|
if (firstObject) {
|
|
39394
|
-
return
|
|
39407
|
+
return convertToJson(
|
|
39395
39408
|
sourceFile,
|
|
39396
39409
|
firstObject,
|
|
39397
39410
|
errors,
|
|
39398
39411
|
/*returnValue*/
|
|
39399
39412
|
true,
|
|
39400
|
-
|
|
39401
|
-
optionsIterator
|
|
39413
|
+
jsonConversionNotifier
|
|
39402
39414
|
);
|
|
39403
39415
|
}
|
|
39404
39416
|
}
|
|
39405
39417
|
return {};
|
|
39406
39418
|
}
|
|
39407
|
-
return
|
|
39419
|
+
return convertToJson(
|
|
39408
39420
|
sourceFile,
|
|
39409
39421
|
rootExpression,
|
|
39410
39422
|
errors,
|
|
39411
39423
|
/*returnValue*/
|
|
39412
39424
|
true,
|
|
39413
|
-
|
|
39414
|
-
optionsIterator
|
|
39425
|
+
jsonConversionNotifier
|
|
39415
39426
|
);
|
|
39416
39427
|
}
|
|
39417
39428
|
function convertToObject(sourceFile, errors) {
|
|
39418
39429
|
var _a2;
|
|
39419
|
-
return
|
|
39430
|
+
return convertToJson(
|
|
39420
39431
|
sourceFile,
|
|
39421
39432
|
(_a2 = sourceFile.statements[0]) == null ? void 0 : _a2.expression,
|
|
39422
39433
|
errors,
|
|
39423
39434
|
/*returnValue*/
|
|
39424
39435
|
true,
|
|
39425
|
-
/*knownRootOptions*/
|
|
39426
|
-
void 0,
|
|
39427
39436
|
/*jsonConversionNotifier*/
|
|
39428
39437
|
void 0
|
|
39429
39438
|
);
|
|
39430
39439
|
}
|
|
39431
|
-
function
|
|
39440
|
+
function convertToJson(sourceFile, rootExpression, errors, returnValue, jsonConversionNotifier) {
|
|
39432
39441
|
if (!rootExpression) {
|
|
39433
39442
|
return returnValue ? {} : void 0;
|
|
39434
39443
|
}
|
|
39435
|
-
return convertPropertyValueToJson(rootExpression,
|
|
39436
|
-
function
|
|
39437
|
-
|
|
39438
|
-
}
|
|
39439
|
-
function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) {
|
|
39444
|
+
return convertPropertyValueToJson(rootExpression, jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.rootOptions);
|
|
39445
|
+
function convertObjectLiteralExpressionToJson(node, objectOption) {
|
|
39446
|
+
var _a2;
|
|
39440
39447
|
const result = returnValue ? {} : void 0;
|
|
39441
39448
|
for (const element of node.properties) {
|
|
39442
39449
|
if (element.kind !== 300 /* PropertyAssignment */) {
|
|
@@ -39451,38 +39458,13 @@ function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue,
|
|
|
39451
39458
|
}
|
|
39452
39459
|
const textOfKey = isComputedNonLiteralName(element.name) ? void 0 : getTextOfPropertyName(element.name);
|
|
39453
39460
|
const keyText = textOfKey && unescapeLeadingUnderscores(textOfKey);
|
|
39454
|
-
const option = keyText
|
|
39455
|
-
if (keyText && extraKeyDiagnostics && !option) {
|
|
39456
|
-
if (knownOptions) {
|
|
39457
|
-
errors.push(createUnknownOptionError(
|
|
39458
|
-
keyText,
|
|
39459
|
-
extraKeyDiagnostics,
|
|
39460
|
-
(message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, element.name, message, arg0, arg1)
|
|
39461
|
-
));
|
|
39462
|
-
} else {
|
|
39463
|
-
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
|
|
39464
|
-
}
|
|
39465
|
-
}
|
|
39461
|
+
const option = keyText ? (_a2 = objectOption == null ? void 0 : objectOption.elementOptions) == null ? void 0 : _a2.get(keyText) : void 0;
|
|
39466
39462
|
const value = convertPropertyValueToJson(element.initializer, option);
|
|
39467
39463
|
if (typeof keyText !== "undefined") {
|
|
39468
39464
|
if (returnValue) {
|
|
39469
39465
|
result[keyText] = value;
|
|
39470
39466
|
}
|
|
39471
|
-
|
|
39472
|
-
(parentOption || isRootOptionMap(knownOptions))) {
|
|
39473
|
-
const isValidOptionValue = isCompilerOptionsValue(option, value);
|
|
39474
|
-
if (parentOption) {
|
|
39475
|
-
if (isValidOptionValue) {
|
|
39476
|
-
jsonConversionNotifier.onSetValidOptionKeyValueInParent(parentOption, option, value);
|
|
39477
|
-
}
|
|
39478
|
-
} else if (isRootOptionMap(knownOptions)) {
|
|
39479
|
-
if (isValidOptionValue) {
|
|
39480
|
-
jsonConversionNotifier.onSetValidOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
|
|
39481
|
-
} else if (!option) {
|
|
39482
|
-
jsonConversionNotifier.onSetUnknownOptionKeyValueInRoot(keyText, element.name, value, element.initializer);
|
|
39483
|
-
}
|
|
39484
|
-
}
|
|
39485
|
-
}
|
|
39467
|
+
jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.onPropertySet(keyText, value, element, objectOption, option);
|
|
39486
39468
|
}
|
|
39487
39469
|
}
|
|
39488
39470
|
return result;
|
|
@@ -39495,112 +39477,40 @@ function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue,
|
|
|
39495
39477
|
return filter(elements.map((element) => convertPropertyValueToJson(element, elementOption)), (v) => v !== void 0);
|
|
39496
39478
|
}
|
|
39497
39479
|
function convertPropertyValueToJson(valueExpression, option) {
|
|
39498
|
-
let invalidReported;
|
|
39499
39480
|
switch (valueExpression.kind) {
|
|
39500
39481
|
case 111 /* TrueKeyword */:
|
|
39501
|
-
|
|
39502
|
-
return validateValue(
|
|
39503
|
-
/*value*/
|
|
39504
|
-
true
|
|
39505
|
-
);
|
|
39482
|
+
return true;
|
|
39506
39483
|
case 96 /* FalseKeyword */:
|
|
39507
|
-
|
|
39508
|
-
return validateValue(
|
|
39509
|
-
/*value*/
|
|
39510
|
-
false
|
|
39511
|
-
);
|
|
39484
|
+
return false;
|
|
39512
39485
|
case 105 /* NullKeyword */:
|
|
39513
|
-
|
|
39514
|
-
return validateValue(
|
|
39515
|
-
/*value*/
|
|
39516
|
-
null
|
|
39517
|
-
);
|
|
39486
|
+
return null;
|
|
39518
39487
|
case 10 /* StringLiteral */:
|
|
39519
39488
|
if (!isDoubleQuotedString(valueExpression)) {
|
|
39520
39489
|
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.String_literal_with_double_quotes_expected));
|
|
39521
39490
|
}
|
|
39522
|
-
|
|
39523
|
-
const text = valueExpression.text;
|
|
39524
|
-
if (option) {
|
|
39525
|
-
Debug.assert(option.type !== "listOrElement" || option.element.type === "string", "Only string or array of string is handled for now");
|
|
39526
|
-
}
|
|
39527
|
-
if (option && !isString(option.type)) {
|
|
39528
|
-
const customOption = option;
|
|
39529
|
-
if (!customOption.type.has(text.toLowerCase())) {
|
|
39530
|
-
errors.push(
|
|
39531
|
-
createDiagnosticForInvalidCustomType(
|
|
39532
|
-
customOption,
|
|
39533
|
-
(message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, message, arg0, arg1)
|
|
39534
|
-
)
|
|
39535
|
-
);
|
|
39536
|
-
invalidReported = true;
|
|
39537
|
-
}
|
|
39538
|
-
}
|
|
39539
|
-
return validateValue(text);
|
|
39491
|
+
return valueExpression.text;
|
|
39540
39492
|
case 8 /* NumericLiteral */:
|
|
39541
|
-
|
|
39542
|
-
return validateValue(Number(valueExpression.text));
|
|
39493
|
+
return Number(valueExpression.text);
|
|
39543
39494
|
case 222 /* PrefixUnaryExpression */:
|
|
39544
39495
|
if (valueExpression.operator !== 40 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) {
|
|
39545
39496
|
break;
|
|
39546
39497
|
}
|
|
39547
|
-
|
|
39548
|
-
return validateValue(-Number(valueExpression.operand.text));
|
|
39498
|
+
return -Number(valueExpression.operand.text);
|
|
39549
39499
|
case 208 /* ObjectLiteralExpression */:
|
|
39550
|
-
reportInvalidOptionValue(option && option.type !== "object" && (option.type !== "listOrElement" || option.element.type !== "object"));
|
|
39551
39500
|
const objectLiteralExpression = valueExpression;
|
|
39552
|
-
|
|
39553
|
-
const { elementOptions, extraKeyDiagnostics, name: optionName } = option;
|
|
39554
|
-
return validateValue(convertObjectLiteralExpressionToJson(
|
|
39555
|
-
objectLiteralExpression,
|
|
39556
|
-
elementOptions,
|
|
39557
|
-
extraKeyDiagnostics,
|
|
39558
|
-
optionName
|
|
39559
|
-
));
|
|
39560
|
-
} else {
|
|
39561
|
-
return validateValue(convertObjectLiteralExpressionToJson(
|
|
39562
|
-
objectLiteralExpression,
|
|
39563
|
-
/* knownOptions*/
|
|
39564
|
-
void 0,
|
|
39565
|
-
/*extraKeyDiagnosticMessage */
|
|
39566
|
-
void 0,
|
|
39567
|
-
/*parentOption*/
|
|
39568
|
-
void 0
|
|
39569
|
-
));
|
|
39570
|
-
}
|
|
39501
|
+
return convertObjectLiteralExpressionToJson(objectLiteralExpression, option);
|
|
39571
39502
|
case 207 /* ArrayLiteralExpression */:
|
|
39572
|
-
|
|
39573
|
-
return validateValue(convertArrayLiteralExpressionToJson(
|
|
39503
|
+
return convertArrayLiteralExpressionToJson(
|
|
39574
39504
|
valueExpression.elements,
|
|
39575
39505
|
option && option.element
|
|
39576
|
-
)
|
|
39506
|
+
);
|
|
39577
39507
|
}
|
|
39578
39508
|
if (option) {
|
|
39579
|
-
|
|
39580
|
-
/*isError*/
|
|
39581
|
-
true
|
|
39582
|
-
);
|
|
39509
|
+
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option)));
|
|
39583
39510
|
} else {
|
|
39584
39511
|
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal));
|
|
39585
39512
|
}
|
|
39586
39513
|
return void 0;
|
|
39587
|
-
function validateValue(value) {
|
|
39588
|
-
var _a2;
|
|
39589
|
-
if (!invalidReported) {
|
|
39590
|
-
const diagnostic = (_a2 = option == null ? void 0 : option.extraValidation) == null ? void 0 : _a2.call(option, value);
|
|
39591
|
-
if (diagnostic) {
|
|
39592
|
-
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ...diagnostic));
|
|
39593
|
-
return void 0;
|
|
39594
|
-
}
|
|
39595
|
-
}
|
|
39596
|
-
return value;
|
|
39597
|
-
}
|
|
39598
|
-
function reportInvalidOptionValue(isError) {
|
|
39599
|
-
if (isError) {
|
|
39600
|
-
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option)));
|
|
39601
|
-
invalidReported = true;
|
|
39602
|
-
}
|
|
39603
|
-
}
|
|
39604
39514
|
}
|
|
39605
39515
|
function isDoubleQuotedString(node) {
|
|
39606
39516
|
return isStringLiteral(node) && isStringDoubleQuoted(node, sourceFile);
|
|
@@ -39612,7 +39522,7 @@ function getCompilerOptionValueTypeString(option) {
|
|
|
39612
39522
|
function isCompilerOptionsValue(option, value) {
|
|
39613
39523
|
if (option) {
|
|
39614
39524
|
if (isNullOrUndefined(value))
|
|
39615
|
-
return
|
|
39525
|
+
return !option.disallowNullOrUndefined;
|
|
39616
39526
|
if (option.type === "list") {
|
|
39617
39527
|
return isArray(value);
|
|
39618
39528
|
}
|
|
@@ -39973,7 +39883,7 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
39973
39883
|
const fileName = configFileName || "tsconfig.json";
|
|
39974
39884
|
const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty;
|
|
39975
39885
|
const nodeValue = firstDefined(getTsConfigPropArray(sourceFile, "files"), (property) => property.initializer);
|
|
39976
|
-
const error =
|
|
39886
|
+
const error = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName);
|
|
39977
39887
|
errors.push(error);
|
|
39978
39888
|
} else {
|
|
39979
39889
|
createCompilerDiagnosticOnlyIfJson(Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json");
|
|
@@ -40075,9 +39985,9 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
|
|
|
40075
39985
|
}
|
|
40076
39986
|
return "no-prop";
|
|
40077
39987
|
}
|
|
40078
|
-
function createCompilerDiagnosticOnlyIfJson(message,
|
|
39988
|
+
function createCompilerDiagnosticOnlyIfJson(message, ...args) {
|
|
40079
39989
|
if (!sourceFile) {
|
|
40080
|
-
errors.push(createCompilerDiagnostic(message,
|
|
39990
|
+
errors.push(createCompilerDiagnostic(message, ...args));
|
|
40081
39991
|
}
|
|
40082
39992
|
}
|
|
40083
39993
|
}
|
|
@@ -40176,27 +40086,42 @@ function parseOwnConfigOfJson(json, host, basePath, configFileName, errors) {
|
|
|
40176
40086
|
const typeAcquisition = convertTypeAcquisitionFromJsonWorker(json.typeAcquisition, basePath, errors, configFileName);
|
|
40177
40087
|
const watchOptions = convertWatchOptionsFromJsonWorker(json.watchOptions, basePath, errors);
|
|
40178
40088
|
json.compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);
|
|
40089
|
+
const extendedConfigPath = json.extends || json.extends === "" ? getExtendsConfigPathOrArray(json.extends, host, basePath, configFileName, errors) : void 0;
|
|
40090
|
+
return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath };
|
|
40091
|
+
}
|
|
40092
|
+
function getExtendsConfigPathOrArray(value, host, basePath, configFileName, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
40179
40093
|
let extendedConfigPath;
|
|
40180
|
-
|
|
40181
|
-
|
|
40182
|
-
|
|
40183
|
-
|
|
40184
|
-
|
|
40185
|
-
|
|
40186
|
-
|
|
40094
|
+
const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
|
|
40095
|
+
if (isString(value)) {
|
|
40096
|
+
extendedConfigPath = getExtendsConfigPath(
|
|
40097
|
+
value,
|
|
40098
|
+
host,
|
|
40099
|
+
newBase,
|
|
40100
|
+
errors,
|
|
40101
|
+
valueExpression,
|
|
40102
|
+
sourceFile
|
|
40103
|
+
);
|
|
40104
|
+
} else if (isArray(value)) {
|
|
40105
|
+
extendedConfigPath = [];
|
|
40106
|
+
for (let index = 0; index < value.length; index++) {
|
|
40107
|
+
const fileName = value[index];
|
|
40108
|
+
if (isString(fileName)) {
|
|
40109
|
+
extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(
|
|
40110
|
+
fileName,
|
|
40111
|
+
host,
|
|
40112
|
+
newBase,
|
|
40113
|
+
errors,
|
|
40114
|
+
valueExpression == null ? void 0 : valueExpression.elements[index],
|
|
40115
|
+
sourceFile
|
|
40116
|
+
));
|
|
40187
40117
|
} else {
|
|
40188
|
-
|
|
40189
|
-
for (const fileName of json.extends) {
|
|
40190
|
-
if (isString(fileName)) {
|
|
40191
|
-
extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(fileName, host, newBase, errors, createCompilerDiagnostic));
|
|
40192
|
-
} else {
|
|
40193
|
-
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", getCompilerOptionValueTypeString(extendsOptionDeclaration.element)));
|
|
40194
|
-
}
|
|
40195
|
-
}
|
|
40118
|
+
convertJsonOption(extendsOptionDeclaration.element, value, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile);
|
|
40196
40119
|
}
|
|
40197
40120
|
}
|
|
40121
|
+
} else {
|
|
40122
|
+
convertJsonOption(extendsOptionDeclaration, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
|
|
40198
40123
|
}
|
|
40199
|
-
return
|
|
40124
|
+
return extendedConfigPath;
|
|
40200
40125
|
}
|
|
40201
40126
|
function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors) {
|
|
40202
40127
|
const options = getDefaultCompilerOptions(configFileName);
|
|
@@ -40204,69 +40129,11 @@ function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileNa
|
|
|
40204
40129
|
let watchOptions;
|
|
40205
40130
|
let extendedConfigPath;
|
|
40206
40131
|
let rootCompilerOptions;
|
|
40207
|
-
const
|
|
40208
|
-
onSetValidOptionKeyValueInParent(parentOption, option, value) {
|
|
40209
|
-
let currentOption;
|
|
40210
|
-
switch (parentOption) {
|
|
40211
|
-
case "compilerOptions":
|
|
40212
|
-
currentOption = options;
|
|
40213
|
-
break;
|
|
40214
|
-
case "watchOptions":
|
|
40215
|
-
currentOption = watchOptions || (watchOptions = {});
|
|
40216
|
-
break;
|
|
40217
|
-
case "typeAcquisition":
|
|
40218
|
-
currentOption = typeAcquisition || (typeAcquisition = getDefaultTypeAcquisition(configFileName));
|
|
40219
|
-
break;
|
|
40220
|
-
default:
|
|
40221
|
-
Debug.fail("Unknown option");
|
|
40222
|
-
}
|
|
40223
|
-
currentOption[option.name] = normalizeOptionValue(option, basePath, value);
|
|
40224
|
-
},
|
|
40225
|
-
onSetValidOptionKeyValueInRoot(key, _keyNode, value, valueNode) {
|
|
40226
|
-
switch (key) {
|
|
40227
|
-
case "extends":
|
|
40228
|
-
const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
|
|
40229
|
-
if (isString(value)) {
|
|
40230
|
-
extendedConfigPath = getExtendsConfigPath(
|
|
40231
|
-
value,
|
|
40232
|
-
host,
|
|
40233
|
-
newBase,
|
|
40234
|
-
errors,
|
|
40235
|
-
(message, arg0) => createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0)
|
|
40236
|
-
);
|
|
40237
|
-
} else {
|
|
40238
|
-
extendedConfigPath = [];
|
|
40239
|
-
for (let index = 0; index < value.length; index++) {
|
|
40240
|
-
const fileName = value[index];
|
|
40241
|
-
if (isString(fileName)) {
|
|
40242
|
-
extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(
|
|
40243
|
-
fileName,
|
|
40244
|
-
host,
|
|
40245
|
-
newBase,
|
|
40246
|
-
errors,
|
|
40247
|
-
(message, arg0) => createDiagnosticForNodeInSourceFile(sourceFile, valueNode.elements[index], message, arg0)
|
|
40248
|
-
));
|
|
40249
|
-
}
|
|
40250
|
-
}
|
|
40251
|
-
}
|
|
40252
|
-
return;
|
|
40253
|
-
}
|
|
40254
|
-
},
|
|
40255
|
-
onSetUnknownOptionKeyValueInRoot(key, keyNode, _value, _valueNode) {
|
|
40256
|
-
if (key === "excludes") {
|
|
40257
|
-
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, keyNode, Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
|
|
40258
|
-
}
|
|
40259
|
-
if (find(commandOptionsWithoutBuild, (opt) => opt.name === key)) {
|
|
40260
|
-
rootCompilerOptions = append(rootCompilerOptions, keyNode);
|
|
40261
|
-
}
|
|
40262
|
-
}
|
|
40263
|
-
};
|
|
40132
|
+
const rootOptions = getTsconfigRootOptionsMap();
|
|
40264
40133
|
const json = convertConfigFileToObject(
|
|
40265
40134
|
sourceFile,
|
|
40266
40135
|
errors,
|
|
40267
|
-
|
|
40268
|
-
true,
|
|
40269
|
-
optionsIterator
|
|
40136
|
+
{ rootOptions, onPropertySet }
|
|
40270
40137
|
);
|
|
40271
40138
|
if (!typeAcquisition) {
|
|
40272
40139
|
typeAcquisition = getDefaultTypeAcquisition(configFileName);
|
|
@@ -40275,15 +40142,57 @@ function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileNa
|
|
|
40275
40142
|
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, rootCompilerOptions[0], Diagnostics._0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file, getTextOfPropertyName(rootCompilerOptions[0])));
|
|
40276
40143
|
}
|
|
40277
40144
|
return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath };
|
|
40145
|
+
function onPropertySet(keyText, value, propertyAssignment, parentOption, option) {
|
|
40146
|
+
if (option && option !== extendsOptionDeclaration)
|
|
40147
|
+
value = convertJsonOption(option, value, basePath, errors, propertyAssignment, propertyAssignment.initializer, sourceFile);
|
|
40148
|
+
if (parentOption == null ? void 0 : parentOption.name) {
|
|
40149
|
+
if (option) {
|
|
40150
|
+
let currentOption;
|
|
40151
|
+
if (parentOption === compilerOptionsDeclaration)
|
|
40152
|
+
currentOption = options;
|
|
40153
|
+
else if (parentOption === watchOptionsDeclaration)
|
|
40154
|
+
currentOption = watchOptions != null ? watchOptions : watchOptions = {};
|
|
40155
|
+
else if (parentOption === typeAcquisitionDeclaration)
|
|
40156
|
+
currentOption = typeAcquisition != null ? typeAcquisition : typeAcquisition = getDefaultTypeAcquisition(configFileName);
|
|
40157
|
+
else
|
|
40158
|
+
Debug.fail("Unknown option");
|
|
40159
|
+
currentOption[option.name] = value;
|
|
40160
|
+
} else if (keyText && (parentOption == null ? void 0 : parentOption.extraKeyDiagnostics)) {
|
|
40161
|
+
if (parentOption.elementOptions) {
|
|
40162
|
+
errors.push(createUnknownOptionError(
|
|
40163
|
+
keyText,
|
|
40164
|
+
parentOption.extraKeyDiagnostics,
|
|
40165
|
+
/*unknownOptionErrorText*/
|
|
40166
|
+
void 0,
|
|
40167
|
+
propertyAssignment.name,
|
|
40168
|
+
sourceFile
|
|
40169
|
+
));
|
|
40170
|
+
} else {
|
|
40171
|
+
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, propertyAssignment.name, parentOption.extraKeyDiagnostics.unknownOptionDiagnostic, keyText));
|
|
40172
|
+
}
|
|
40173
|
+
}
|
|
40174
|
+
} else if (parentOption === rootOptions) {
|
|
40175
|
+
if (option === extendsOptionDeclaration) {
|
|
40176
|
+
extendedConfigPath = getExtendsConfigPathOrArray(value, host, basePath, configFileName, errors, propertyAssignment, propertyAssignment.initializer, sourceFile);
|
|
40177
|
+
} else if (!option) {
|
|
40178
|
+
if (keyText === "excludes") {
|
|
40179
|
+
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, propertyAssignment.name, Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
|
|
40180
|
+
}
|
|
40181
|
+
if (find(commandOptionsWithoutBuild, (opt) => opt.name === keyText)) {
|
|
40182
|
+
rootCompilerOptions = append(rootCompilerOptions, propertyAssignment.name);
|
|
40183
|
+
}
|
|
40184
|
+
}
|
|
40185
|
+
}
|
|
40186
|
+
}
|
|
40278
40187
|
}
|
|
40279
|
-
function getExtendsConfigPath(extendedConfig, host, basePath, errors,
|
|
40188
|
+
function getExtendsConfigPath(extendedConfig, host, basePath, errors, valueExpression, sourceFile) {
|
|
40280
40189
|
extendedConfig = normalizeSlashes(extendedConfig);
|
|
40281
40190
|
if (isRootedDiskPath(extendedConfig) || startsWith(extendedConfig, "./") || startsWith(extendedConfig, "../")) {
|
|
40282
40191
|
let extendedConfigPath = getNormalizedAbsolutePath(extendedConfig, basePath);
|
|
40283
40192
|
if (!host.fileExists(extendedConfigPath) && !endsWith(extendedConfigPath, ".json" /* Json */)) {
|
|
40284
40193
|
extendedConfigPath = `${extendedConfigPath}.json`;
|
|
40285
40194
|
if (!host.fileExists(extendedConfigPath)) {
|
|
40286
|
-
errors.push(
|
|
40195
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.File_0_not_found, extendedConfig));
|
|
40287
40196
|
return void 0;
|
|
40288
40197
|
}
|
|
40289
40198
|
}
|
|
@@ -40294,9 +40203,9 @@ function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiag
|
|
|
40294
40203
|
return resolved.resolvedModule.resolvedFileName;
|
|
40295
40204
|
}
|
|
40296
40205
|
if (extendedConfig === "") {
|
|
40297
|
-
errors.push(
|
|
40206
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Compiler_option_0_cannot_be_given_an_empty_string, "extends"));
|
|
40298
40207
|
} else {
|
|
40299
|
-
errors.push(
|
|
40208
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.File_0_not_found, extendedConfig));
|
|
40300
40209
|
}
|
|
40301
40210
|
return void 0;
|
|
40302
40211
|
}
|
|
@@ -40398,43 +40307,34 @@ function convertOptionsFromJson(optionsNameMap, jsonOptions, basePath, defaultOp
|
|
|
40398
40307
|
if (opt) {
|
|
40399
40308
|
(defaultOptions || (defaultOptions = {}))[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors);
|
|
40400
40309
|
} else {
|
|
40401
|
-
errors.push(createUnknownOptionError(id, diagnostics
|
|
40310
|
+
errors.push(createUnknownOptionError(id, diagnostics));
|
|
40402
40311
|
}
|
|
40403
40312
|
}
|
|
40404
40313
|
return defaultOptions;
|
|
40405
40314
|
}
|
|
40406
|
-
function
|
|
40315
|
+
function createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, message, ...args) {
|
|
40316
|
+
return sourceFile && node ? createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args) : createCompilerDiagnostic(message, ...args);
|
|
40317
|
+
}
|
|
40318
|
+
function convertJsonOption(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
40319
|
+
if (opt.isCommandLineOnly) {
|
|
40320
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, propertyAssignment == null ? void 0 : propertyAssignment.name, Diagnostics.Option_0_can_only_be_specified_on_command_line, opt.name));
|
|
40321
|
+
return void 0;
|
|
40322
|
+
}
|
|
40407
40323
|
if (isCompilerOptionsValue(opt, value)) {
|
|
40408
40324
|
const optType = opt.type;
|
|
40409
40325
|
if (optType === "list" && isArray(value)) {
|
|
40410
|
-
return convertJsonOptionOfListType(opt, value, basePath, errors);
|
|
40326
|
+
return convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
|
|
40411
40327
|
} else if (optType === "listOrElement") {
|
|
40412
|
-
return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors) : convertJsonOption(opt.element, value, basePath, errors);
|
|
40328
|
+
return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile) : convertJsonOption(opt.element, value, basePath, errors, propertyAssignment, valueExpression, sourceFile);
|
|
40413
40329
|
} else if (!isString(opt.type)) {
|
|
40414
|
-
return convertJsonOptionOfCustomType(opt, value, errors);
|
|
40330
|
+
return convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile);
|
|
40415
40331
|
}
|
|
40416
|
-
const validatedValue = validateJsonOptionValue(opt, value, errors);
|
|
40332
|
+
const validatedValue = validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile);
|
|
40417
40333
|
return isNullOrUndefined(validatedValue) ? validatedValue : normalizeNonListOptionValue(opt, basePath, validatedValue);
|
|
40418
40334
|
} else {
|
|
40419
|
-
errors.push(
|
|
40335
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt)));
|
|
40420
40336
|
}
|
|
40421
40337
|
}
|
|
40422
|
-
function normalizeOptionValue(option, basePath, value) {
|
|
40423
|
-
if (isNullOrUndefined(value))
|
|
40424
|
-
return void 0;
|
|
40425
|
-
if (option.type === "listOrElement" && !isArray(value))
|
|
40426
|
-
return normalizeOptionValue(option.element, basePath, value);
|
|
40427
|
-
else if (option.type === "list" || option.type === "listOrElement") {
|
|
40428
|
-
const listOption = option;
|
|
40429
|
-
if (listOption.element.isFilePath || !isString(listOption.element.type)) {
|
|
40430
|
-
return filter(map(value, (v) => normalizeOptionValue(listOption.element, basePath, v)), (v) => listOption.listPreserveFalsyValues ? true : !!v);
|
|
40431
|
-
}
|
|
40432
|
-
return value;
|
|
40433
|
-
} else if (!isString(option.type)) {
|
|
40434
|
-
return option.type.get(isString(value) ? value.toLowerCase() : value);
|
|
40435
|
-
}
|
|
40436
|
-
return normalizeNonListOptionValue(option, basePath, value);
|
|
40437
|
-
}
|
|
40438
40338
|
function normalizeNonListOptionValue(option, basePath, value) {
|
|
40439
40339
|
if (option.isFilePath) {
|
|
40440
40340
|
value = getNormalizedAbsolutePath(value, basePath);
|
|
@@ -40444,29 +40344,29 @@ function normalizeNonListOptionValue(option, basePath, value) {
|
|
|
40444
40344
|
}
|
|
40445
40345
|
return value;
|
|
40446
40346
|
}
|
|
40447
|
-
function validateJsonOptionValue(opt, value, errors) {
|
|
40347
|
+
function validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile) {
|
|
40448
40348
|
var _a2;
|
|
40449
40349
|
if (isNullOrUndefined(value))
|
|
40450
40350
|
return void 0;
|
|
40451
40351
|
const d = (_a2 = opt.extraValidation) == null ? void 0 : _a2.call(opt, value);
|
|
40452
40352
|
if (!d)
|
|
40453
40353
|
return value;
|
|
40454
|
-
errors.push(
|
|
40354
|
+
errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, ...d));
|
|
40455
40355
|
return void 0;
|
|
40456
40356
|
}
|
|
40457
|
-
function convertJsonOptionOfCustomType(opt, value, errors) {
|
|
40357
|
+
function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile) {
|
|
40458
40358
|
if (isNullOrUndefined(value))
|
|
40459
40359
|
return void 0;
|
|
40460
40360
|
const key = value.toLowerCase();
|
|
40461
40361
|
const val = opt.type.get(key);
|
|
40462
40362
|
if (val !== void 0) {
|
|
40463
|
-
return validateJsonOptionValue(opt, val, errors);
|
|
40363
|
+
return validateJsonOptionValue(opt, val, errors, valueExpression, sourceFile);
|
|
40464
40364
|
} else {
|
|
40465
|
-
errors.push(
|
|
40365
|
+
errors.push(createDiagnosticForInvalidCustomType(opt, (message, ...args) => createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, message, ...args)));
|
|
40466
40366
|
}
|
|
40467
40367
|
}
|
|
40468
|
-
function convertJsonOptionOfListType(option, values, basePath, errors) {
|
|
40469
|
-
return filter(map(values, (v) => convertJsonOption(option.element, v, basePath, errors)), (v) => option.listPreserveFalsyValues ? true : !!v);
|
|
40368
|
+
function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
40369
|
+
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);
|
|
40470
40370
|
}
|
|
40471
40371
|
var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/;
|
|
40472
40372
|
var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
|
|
@@ -40575,7 +40475,7 @@ function validateSpecs(specs, errors, disallowTrailingRecursion, jsonSourceFile,
|
|
|
40575
40475
|
});
|
|
40576
40476
|
function createDiagnostic(message, spec) {
|
|
40577
40477
|
const element = getTsConfigPropArrayElementValue(jsonSourceFile, specKey, spec);
|
|
40578
|
-
return
|
|
40478
|
+
return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(jsonSourceFile, element, message, spec);
|
|
40579
40479
|
}
|
|
40580
40480
|
}
|
|
40581
40481
|
function specToDiagnostic(spec, disallowTrailingRecursion) {
|
|
@@ -40686,6 +40586,8 @@ function convertCompilerOptionsForTelemetry(opts) {
|
|
|
40686
40586
|
return out;
|
|
40687
40587
|
}
|
|
40688
40588
|
function getOptionValueWithEmptyStrings(value, option) {
|
|
40589
|
+
if (value === void 0)
|
|
40590
|
+
return value;
|
|
40689
40591
|
switch (option.type) {
|
|
40690
40592
|
case "object":
|
|
40691
40593
|
return "";
|
|
@@ -40700,7 +40602,7 @@ function getOptionValueWithEmptyStrings(value, option) {
|
|
|
40700
40602
|
return getOptionValueWithEmptyStrings(value, option.element);
|
|
40701
40603
|
case "list":
|
|
40702
40604
|
const elementType = option.element;
|
|
40703
|
-
return isArray(value) ? value
|
|
40605
|
+
return isArray(value) ? mapDefined(value, (v) => getOptionValueWithEmptyStrings(v, elementType)) : "";
|
|
40704
40606
|
default:
|
|
40705
40607
|
return forEachEntry(option.type, (optionEnumValue, optionStringValue) => {
|
|
40706
40608
|
if (optionEnumValue === value) {
|
|
@@ -43453,8 +43355,8 @@ function createBinder() {
|
|
|
43453
43355
|
var reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
|
|
43454
43356
|
var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
|
|
43455
43357
|
return bindSourceFile2;
|
|
43456
|
-
function createDiagnosticForNode2(node, message,
|
|
43457
|
-
return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message,
|
|
43358
|
+
function createDiagnosticForNode2(node, message, ...args) {
|
|
43359
|
+
return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, ...args);
|
|
43458
43360
|
}
|
|
43459
43361
|
function bindSourceFile2(f, opts) {
|
|
43460
43362
|
var _a2, _b;
|
|
@@ -43648,7 +43550,7 @@ function createBinder() {
|
|
|
43648
43550
|
const declarationName = getNameOfDeclaration(node) || node;
|
|
43649
43551
|
forEach(symbol.declarations, (declaration, index) => {
|
|
43650
43552
|
const decl = getNameOfDeclaration(declaration) || declaration;
|
|
43651
|
-
const diag3 = createDiagnosticForNode2(decl, message,
|
|
43553
|
+
const diag3 = messageNeedsName ? createDiagnosticForNode2(decl, message, getDisplayName(declaration)) : createDiagnosticForNode2(decl, message);
|
|
43652
43554
|
file.bindDiagnostics.push(
|
|
43653
43555
|
multipleDefaultExports ? addRelatedInfo(diag3, createDiagnosticForNode2(declarationName, index === 0 ? Diagnostics.Another_export_default_is_here : Diagnostics.and_here)) : diag3
|
|
43654
43556
|
);
|
|
@@ -43656,7 +43558,7 @@ function createBinder() {
|
|
|
43656
43558
|
relatedInformation.push(createDiagnosticForNode2(decl, Diagnostics.The_first_export_default_is_here));
|
|
43657
43559
|
}
|
|
43658
43560
|
});
|
|
43659
|
-
const diag2 = createDiagnosticForNode2(declarationName, message,
|
|
43561
|
+
const diag2 = messageNeedsName ? createDiagnosticForNode2(declarationName, message, getDisplayName(node)) : createDiagnosticForNode2(declarationName, message);
|
|
43660
43562
|
file.bindDiagnostics.push(addRelatedInfo(diag2, ...relatedInformation));
|
|
43661
43563
|
symbol = createSymbol(0 /* None */, name);
|
|
43662
43564
|
}
|
|
@@ -45117,9 +45019,9 @@ function createBinder() {
|
|
|
45117
45019
|
}
|
|
45118
45020
|
}
|
|
45119
45021
|
}
|
|
45120
|
-
function errorOnFirstToken(node, message,
|
|
45022
|
+
function errorOnFirstToken(node, message, ...args) {
|
|
45121
45023
|
const span = getSpanOfTokenAtPosition(file, node.pos);
|
|
45122
|
-
file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message,
|
|
45024
|
+
file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, ...args));
|
|
45123
45025
|
}
|
|
45124
45026
|
function errorOrSuggestionOnNode(isError, node, message) {
|
|
45125
45027
|
errorOrSuggestionOnRange(isError, node, node, message);
|
|
@@ -47277,6 +47179,7 @@ function createTypeChecker(host) {
|
|
|
47277
47179
|
var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
|
|
47278
47180
|
var requireSymbol = createSymbol(4 /* Property */, "require");
|
|
47279
47181
|
var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
|
|
47182
|
+
var canCollectSymbolAliasAccessabilityData = !compilerOptions.verbatimModuleSyntax || !!compilerOptions.importsNotUsedAsValues;
|
|
47280
47183
|
var apparentArgumentCount;
|
|
47281
47184
|
const checker = {
|
|
47282
47185
|
getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
|
|
@@ -48104,8 +48007,8 @@ function createTypeChecker(host) {
|
|
|
48104
48007
|
getDiagnostics2(sourceFile, cancellationToken2);
|
|
48105
48008
|
return emitResolver;
|
|
48106
48009
|
}
|
|
48107
|
-
function lookupOrIssueError(location, message,
|
|
48108
|
-
const diagnostic = location ? createDiagnosticForNode(location, message,
|
|
48010
|
+
function lookupOrIssueError(location, message, ...args) {
|
|
48011
|
+
const diagnostic = location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
|
|
48109
48012
|
const existing = diagnostics.lookup(diagnostic);
|
|
48110
48013
|
if (existing) {
|
|
48111
48014
|
return existing;
|
|
@@ -48114,16 +48017,16 @@ function createTypeChecker(host) {
|
|
|
48114
48017
|
return diagnostic;
|
|
48115
48018
|
}
|
|
48116
48019
|
}
|
|
48117
|
-
function errorSkippedOn(key, location, message,
|
|
48118
|
-
const diagnostic = error(location, message,
|
|
48020
|
+
function errorSkippedOn(key, location, message, ...args) {
|
|
48021
|
+
const diagnostic = error(location, message, ...args);
|
|
48119
48022
|
diagnostic.skippedOn = key;
|
|
48120
48023
|
return diagnostic;
|
|
48121
48024
|
}
|
|
48122
|
-
function createError(location, message,
|
|
48123
|
-
return location ? createDiagnosticForNode(location, message,
|
|
48025
|
+
function createError(location, message, ...args) {
|
|
48026
|
+
return location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args);
|
|
48124
48027
|
}
|
|
48125
|
-
function error(location, message,
|
|
48126
|
-
const diagnostic = createError(location, message,
|
|
48028
|
+
function error(location, message, ...args) {
|
|
48029
|
+
const diagnostic = createError(location, message, ...args);
|
|
48127
48030
|
diagnostics.add(diagnostic);
|
|
48128
48031
|
return diagnostic;
|
|
48129
48032
|
}
|
|
@@ -48134,19 +48037,19 @@ function createTypeChecker(host) {
|
|
|
48134
48037
|
suggestionDiagnostics.add({ ...diagnostic, category: 2 /* Suggestion */ });
|
|
48135
48038
|
}
|
|
48136
48039
|
}
|
|
48137
|
-
function errorOrSuggestion(isError, location, message,
|
|
48040
|
+
function errorOrSuggestion(isError, location, message, ...args) {
|
|
48138
48041
|
if (location.pos < 0 || location.end < 0) {
|
|
48139
48042
|
if (!isError) {
|
|
48140
48043
|
return;
|
|
48141
48044
|
}
|
|
48142
48045
|
const file = getSourceFileOfNode(location);
|
|
48143
|
-
addErrorOrSuggestion(isError, "message" in message ? createFileDiagnostic(file, 0, 0, message,
|
|
48046
|
+
addErrorOrSuggestion(isError, "message" in message ? createFileDiagnostic(file, 0, 0, message, ...args) : createDiagnosticForFileFromMessageChain(file, message));
|
|
48144
48047
|
return;
|
|
48145
48048
|
}
|
|
48146
|
-
addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message,
|
|
48049
|
+
addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, ...args) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message));
|
|
48147
48050
|
}
|
|
48148
|
-
function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message,
|
|
48149
|
-
const diagnostic = error(location, message,
|
|
48051
|
+
function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, ...args) {
|
|
48052
|
+
const diagnostic = error(location, message, ...args);
|
|
48150
48053
|
if (maybeMissingAwait) {
|
|
48151
48054
|
const related = createDiagnosticForNode(location, Diagnostics.Did_you_forget_to_use_await);
|
|
48152
48055
|
addRelatedInfo(diagnostic, related);
|
|
@@ -50020,7 +49923,7 @@ function createTypeChecker(host) {
|
|
|
50020
49923
|
return void 0;
|
|
50021
49924
|
}
|
|
50022
49925
|
function markExportAsReferenced(node) {
|
|
50023
|
-
if (
|
|
49926
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
50024
49927
|
return;
|
|
50025
49928
|
}
|
|
50026
49929
|
const symbol = getSymbolOfDeclaration(node);
|
|
@@ -50033,7 +49936,7 @@ function createTypeChecker(host) {
|
|
|
50033
49936
|
}
|
|
50034
49937
|
}
|
|
50035
49938
|
function markAliasSymbolAsReferenced(symbol) {
|
|
50036
|
-
Debug.assert(
|
|
49939
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
50037
49940
|
const links = getSymbolLinks(symbol);
|
|
50038
49941
|
if (!links.referenced) {
|
|
50039
49942
|
links.referenced = true;
|
|
@@ -50164,6 +50067,9 @@ function createTypeChecker(host) {
|
|
|
50164
50067
|
}
|
|
50165
50068
|
}
|
|
50166
50069
|
symbol = getMergedSymbol(getSymbol2(getExportsOfSymbol(namespace), right.escapedText, meaning));
|
|
50070
|
+
if (!symbol && namespace.flags & 2097152 /* Alias */) {
|
|
50071
|
+
symbol = getMergedSymbol(getSymbol2(getExportsOfSymbol(resolveAlias(namespace)), right.escapedText, meaning));
|
|
50072
|
+
}
|
|
50167
50073
|
if (!symbol) {
|
|
50168
50074
|
if (!ignoreErrors) {
|
|
50169
50075
|
const namespaceName = getFullyQualifiedName(namespace);
|
|
@@ -51913,8 +51819,11 @@ function createTypeChecker(host) {
|
|
|
51913
51819
|
}
|
|
51914
51820
|
return typeToTypeNodeHelper(type2, context);
|
|
51915
51821
|
}
|
|
51822
|
+
function isMappedTypeHomomorphic(type2) {
|
|
51823
|
+
return !!getHomomorphicTypeVariable(type2);
|
|
51824
|
+
}
|
|
51916
51825
|
function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) {
|
|
51917
|
-
return
|
|
51826
|
+
return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2);
|
|
51918
51827
|
}
|
|
51919
51828
|
function createMappedTypeNodeFromType(type2) {
|
|
51920
51829
|
Debug.assert(!!(type2.flags & 524288 /* Object */));
|
|
@@ -58318,7 +58227,7 @@ function createTypeChecker(host) {
|
|
|
58318
58227
|
const typeVariable = getHomomorphicTypeVariable(type);
|
|
58319
58228
|
if (typeVariable && !type.declaration.nameType) {
|
|
58320
58229
|
const constraint = getConstraintOfTypeParameter(typeVariable);
|
|
58321
|
-
if (constraint &&
|
|
58230
|
+
if (constraint && everyType(constraint, isArrayOrTupleType)) {
|
|
58322
58231
|
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
58323
58232
|
}
|
|
58324
58233
|
}
|
|
@@ -61121,7 +61030,7 @@ function createTypeChecker(host) {
|
|
|
61121
61030
|
return type;
|
|
61122
61031
|
}
|
|
61123
61032
|
function getStringMappingType(symbol, type) {
|
|
61124
|
-
return type.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapType(type, (t) => getStringMappingType(symbol, t)) : type.flags &
|
|
61033
|
+
return type.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapType(type, (t) => getStringMappingType(symbol, t)) : type.flags & 128 /* StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : type.flags & 134217728 /* TemplateLiteral */ ? getTemplateLiteralType(...applyTemplateStringMapping(symbol, type.texts, type.types)) : (
|
|
61125
61034
|
// Mapping<Mapping<T>> === Mapping<T>
|
|
61126
61035
|
type.flags & 268435456 /* StringMapping */ && symbol === type.symbol ? type : type.flags & (1 /* Any */ | 4 /* String */ | 268435456 /* StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : (
|
|
61127
61036
|
// This handles Mapping<`${number}`> and Mapping<`${bigint}`>
|
|
@@ -62795,7 +62704,13 @@ function createTypeChecker(host) {
|
|
|
62795
62704
|
return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
|
|
62796
62705
|
}
|
|
62797
62706
|
function hasContextSensitiveReturnExpression(node) {
|
|
62798
|
-
|
|
62707
|
+
if (node.typeParameters || getEffectiveReturnTypeNode(node) || !node.body) {
|
|
62708
|
+
return false;
|
|
62709
|
+
}
|
|
62710
|
+
if (node.body.kind !== 239 /* Block */) {
|
|
62711
|
+
return isContextSensitive(node.body);
|
|
62712
|
+
}
|
|
62713
|
+
return !!forEachReturnStatement(node.body, (statement) => !!statement.expression && isContextSensitive(statement.expression));
|
|
62799
62714
|
}
|
|
62800
62715
|
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
|
|
62801
62716
|
return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
|
|
@@ -63464,7 +63379,12 @@ function createTypeChecker(host) {
|
|
|
63464
63379
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
63465
63380
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
63466
63381
|
for (let i = 0; i < paramCount; i++) {
|
|
63467
|
-
const sourceType = i === restIndex ? getRestTypeAtPosition(
|
|
63382
|
+
const sourceType = i === restIndex ? getRestTypeAtPosition(
|
|
63383
|
+
source,
|
|
63384
|
+
i,
|
|
63385
|
+
/*readonly*/
|
|
63386
|
+
true
|
|
63387
|
+
) : tryGetTypeAtPosition(source, i);
|
|
63468
63388
|
const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
63469
63389
|
if (sourceType && targetType) {
|
|
63470
63390
|
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
@@ -63730,7 +63650,7 @@ function createTypeChecker(host) {
|
|
|
63730
63650
|
}
|
|
63731
63651
|
function getNormalizedType(type, writing) {
|
|
63732
63652
|
while (true) {
|
|
63733
|
-
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;
|
|
63653
|
+
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;
|
|
63734
63654
|
if (t === type)
|
|
63735
63655
|
return t;
|
|
63736
63656
|
type = t;
|
|
@@ -63749,6 +63669,11 @@ function createTypeChecker(host) {
|
|
|
63749
63669
|
}
|
|
63750
63670
|
return type;
|
|
63751
63671
|
}
|
|
63672
|
+
function getNormalizedTupleType(type, writing) {
|
|
63673
|
+
const elements = getTypeArguments(type);
|
|
63674
|
+
const normalizedElements = sameMap(elements, (t) => t.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(t, writing) : t);
|
|
63675
|
+
return elements !== normalizedElements ? createNormalizedTupleType(type.target, normalizedElements) : type;
|
|
63676
|
+
}
|
|
63752
63677
|
function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
|
|
63753
63678
|
var _a2;
|
|
63754
63679
|
let errorInfo;
|
|
@@ -63838,10 +63763,10 @@ function createTypeChecker(host) {
|
|
|
63838
63763
|
relatedInfo: relatedInfo == null ? void 0 : relatedInfo.slice()
|
|
63839
63764
|
};
|
|
63840
63765
|
}
|
|
63841
|
-
function reportIncompatibleError(message,
|
|
63766
|
+
function reportIncompatibleError(message, ...args) {
|
|
63842
63767
|
overrideNextErrorInfo++;
|
|
63843
63768
|
lastSkippedInfo = void 0;
|
|
63844
|
-
(incompatibleStack || (incompatibleStack = [])).push([message,
|
|
63769
|
+
(incompatibleStack || (incompatibleStack = [])).push([message, ...args]);
|
|
63845
63770
|
}
|
|
63846
63771
|
function reportIncompatibleStack() {
|
|
63847
63772
|
const stack = incompatibleStack || [];
|
|
@@ -63933,13 +63858,13 @@ function createTypeChecker(host) {
|
|
|
63933
63858
|
);
|
|
63934
63859
|
}
|
|
63935
63860
|
}
|
|
63936
|
-
function reportError(message,
|
|
63861
|
+
function reportError(message, ...args) {
|
|
63937
63862
|
Debug.assert(!!errorNode);
|
|
63938
63863
|
if (incompatibleStack)
|
|
63939
63864
|
reportIncompatibleStack();
|
|
63940
63865
|
if (message.elidedInCompatabilityPyramid)
|
|
63941
63866
|
return;
|
|
63942
|
-
errorInfo = chainDiagnosticMessages(errorInfo, message,
|
|
63867
|
+
errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
|
|
63943
63868
|
}
|
|
63944
63869
|
function associateRelatedInfo(info) {
|
|
63945
63870
|
Debug.assert(!!errorInfo);
|
|
@@ -65226,7 +65151,7 @@ function createTypeChecker(host) {
|
|
|
65226
65151
|
if (varianceResult !== void 0) {
|
|
65227
65152
|
return varianceResult;
|
|
65228
65153
|
}
|
|
65229
|
-
} else if (isReadonlyArrayType(target2) ?
|
|
65154
|
+
} else if (isReadonlyArrayType(target2) ? everyType(source2, isArrayOrTupleType) : isArrayType(target2) && everyType(source2, (t) => isTupleType(t) && !t.target.readonly)) {
|
|
65230
65155
|
if (relation !== identityRelation) {
|
|
65231
65156
|
return isRelatedTo(getIndexTypeOfType(source2, numberType) || anyType, getIndexTypeOfType(target2, numberType) || anyType, 3 /* Both */, reportErrors2);
|
|
65232
65157
|
} else {
|
|
@@ -66109,22 +66034,7 @@ function createTypeChecker(host) {
|
|
|
66109
66034
|
if (match === -1) {
|
|
66110
66035
|
return defaultValue;
|
|
66111
66036
|
}
|
|
66112
|
-
|
|
66113
|
-
/*searchElement*/
|
|
66114
|
-
true,
|
|
66115
|
-
match + 1
|
|
66116
|
-
);
|
|
66117
|
-
while (nextMatch !== -1) {
|
|
66118
|
-
if (!isTypeIdenticalTo(target.types[match], target.types[nextMatch])) {
|
|
66119
|
-
return defaultValue;
|
|
66120
|
-
}
|
|
66121
|
-
nextMatch = discriminable.indexOf(
|
|
66122
|
-
/*searchElement*/
|
|
66123
|
-
true,
|
|
66124
|
-
nextMatch + 1
|
|
66125
|
-
);
|
|
66126
|
-
}
|
|
66127
|
-
return target.types[match];
|
|
66037
|
+
return getUnionType(target.types.filter((_, index) => discriminable[index]));
|
|
66128
66038
|
}
|
|
66129
66039
|
function isWeakType(type) {
|
|
66130
66040
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -66325,7 +66235,7 @@ function createTypeChecker(host) {
|
|
|
66325
66235
|
return type.symbol;
|
|
66326
66236
|
}
|
|
66327
66237
|
if (isTupleType(type)) {
|
|
66328
|
-
return type
|
|
66238
|
+
return type;
|
|
66329
66239
|
}
|
|
66330
66240
|
}
|
|
66331
66241
|
if (type.flags & 262144 /* TypeParameter */) {
|
|
@@ -67724,7 +67634,11 @@ function createTypeChecker(host) {
|
|
|
67724
67634
|
return true;
|
|
67725
67635
|
}
|
|
67726
67636
|
if (constraintType.flags & 262144 /* TypeParameter */) {
|
|
67727
|
-
inferWithPriority(getIndexType(
|
|
67637
|
+
inferWithPriority(getIndexType(
|
|
67638
|
+
source,
|
|
67639
|
+
/*indexFlags*/
|
|
67640
|
+
!!source.pattern ? 2 /* NoIndexSignatures */ : 0 /* None */
|
|
67641
|
+
), constraintType, 32 /* MappedTypeConstraint */);
|
|
67728
67642
|
const extendedConstraint = getConstraintOfType(constraintType);
|
|
67729
67643
|
if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) {
|
|
67730
67644
|
return true;
|
|
@@ -68197,36 +68111,34 @@ function createTypeChecker(host) {
|
|
|
68197
68111
|
return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName : type.flags & 384 /* StringOrNumberLiteral */ ? escapeLeadingUnderscores("" + type.value) : void 0;
|
|
68198
68112
|
}
|
|
68199
68113
|
function tryGetElementAccessExpressionName(node) {
|
|
68200
|
-
|
|
68201
|
-
|
|
68114
|
+
return isStringOrNumericLiteralLike(node.argumentExpression) ? escapeLeadingUnderscores(node.argumentExpression.text) : isEntityNameExpression(node.argumentExpression) ? tryGetNameFromEntityNameExpression(node.argumentExpression) : void 0;
|
|
68115
|
+
}
|
|
68116
|
+
function tryGetNameFromEntityNameExpression(node) {
|
|
68117
|
+
const symbol = resolveEntityName(
|
|
68118
|
+
node,
|
|
68119
|
+
111551 /* Value */,
|
|
68120
|
+
/*ignoreErrors*/
|
|
68121
|
+
true
|
|
68122
|
+
);
|
|
68123
|
+
if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */))
|
|
68124
|
+
return void 0;
|
|
68125
|
+
const declaration = symbol.valueDeclaration;
|
|
68126
|
+
if (declaration === void 0)
|
|
68127
|
+
return void 0;
|
|
68128
|
+
const type = tryGetTypeFromEffectiveTypeNode(declaration);
|
|
68129
|
+
if (type) {
|
|
68130
|
+
const name = tryGetNameFromType(type);
|
|
68131
|
+
if (name !== void 0) {
|
|
68132
|
+
return name;
|
|
68133
|
+
}
|
|
68202
68134
|
}
|
|
68203
|
-
if (
|
|
68204
|
-
const
|
|
68205
|
-
|
|
68206
|
-
|
|
68207
|
-
/*ignoreErrors*/
|
|
68208
|
-
true
|
|
68209
|
-
);
|
|
68210
|
-
if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */))
|
|
68211
|
-
return void 0;
|
|
68212
|
-
const declaration = symbol.valueDeclaration;
|
|
68213
|
-
if (declaration === void 0)
|
|
68214
|
-
return void 0;
|
|
68215
|
-
const type = tryGetTypeFromEffectiveTypeNode(declaration);
|
|
68216
|
-
if (type) {
|
|
68217
|
-
const name = tryGetNameFromType(type);
|
|
68218
|
-
if (name !== void 0) {
|
|
68219
|
-
return name;
|
|
68220
|
-
}
|
|
68135
|
+
if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node)) {
|
|
68136
|
+
const initializer = getEffectiveInitializer(declaration);
|
|
68137
|
+
if (initializer) {
|
|
68138
|
+
return tryGetNameFromType(getTypeOfExpression(initializer));
|
|
68221
68139
|
}
|
|
68222
|
-
if (
|
|
68223
|
-
|
|
68224
|
-
if (initializer) {
|
|
68225
|
-
return tryGetNameFromType(getTypeOfExpression(initializer));
|
|
68226
|
-
}
|
|
68227
|
-
if (isEnumMember(declaration)) {
|
|
68228
|
-
return getTextOfPropertyName(declaration.name);
|
|
68229
|
-
}
|
|
68140
|
+
if (isEnumMember(declaration)) {
|
|
68141
|
+
return getTextOfPropertyName(declaration.name);
|
|
68230
68142
|
}
|
|
68231
68143
|
}
|
|
68232
68144
|
return void 0;
|
|
@@ -70144,7 +70056,7 @@ function createTypeChecker(host) {
|
|
|
70144
70056
|
});
|
|
70145
70057
|
}
|
|
70146
70058
|
function markAliasReferenced(symbol, location) {
|
|
70147
|
-
if (
|
|
70059
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
70148
70060
|
return;
|
|
70149
70061
|
}
|
|
70150
70062
|
if (isNonLocalAlias(
|
|
@@ -71436,7 +71348,11 @@ function createTypeChecker(host) {
|
|
|
71436
71348
|
if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
|
|
71437
71349
|
const apparentType = mapType(
|
|
71438
71350
|
instantiatedType,
|
|
71439
|
-
|
|
71351
|
+
// When obtaining apparent type of *contextual* type we don't want to get apparent type of mapped types.
|
|
71352
|
+
// That would evaluate mapped types with array or tuple type constraints too eagerly
|
|
71353
|
+
// and thus it would prevent `getTypeOfPropertyOfContextualType` from obtaining per-position contextual type for elements of array literal expressions.
|
|
71354
|
+
// Apparent type of other mapped types is already the mapped type itself so we can just avoid calling `getApparentType` here for all mapped types.
|
|
71355
|
+
(t) => getObjectFlags(t) & 32 /* Mapped */ ? t : getApparentType(t),
|
|
71440
71356
|
/*noReductions*/
|
|
71441
71357
|
true
|
|
71442
71358
|
);
|
|
@@ -72701,7 +72617,7 @@ function createTypeChecker(host) {
|
|
|
72701
72617
|
}
|
|
72702
72618
|
if (jsxFactorySym) {
|
|
72703
72619
|
jsxFactorySym.isReferenced = 67108863 /* All */;
|
|
72704
|
-
if (
|
|
72620
|
+
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
72705
72621
|
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
72706
72622
|
}
|
|
72707
72623
|
}
|
|
@@ -74275,16 +74191,16 @@ function createTypeChecker(host) {
|
|
|
74275
74191
|
}
|
|
74276
74192
|
return { start: start2, length: length2, sourceFile };
|
|
74277
74193
|
}
|
|
74278
|
-
function getDiagnosticForCallNode(node, message,
|
|
74194
|
+
function getDiagnosticForCallNode(node, message, ...args) {
|
|
74279
74195
|
if (isCallExpression(node)) {
|
|
74280
74196
|
const { sourceFile, start: start2, length: length2 } = getDiagnosticSpanForCallNode(node);
|
|
74281
74197
|
if ("message" in message) {
|
|
74282
|
-
return createFileDiagnostic(sourceFile, start2, length2, message,
|
|
74198
|
+
return createFileDiagnostic(sourceFile, start2, length2, message, ...args);
|
|
74283
74199
|
}
|
|
74284
74200
|
return createDiagnosticForFileFromMessageChain(sourceFile, message);
|
|
74285
74201
|
} else {
|
|
74286
74202
|
if ("message" in message) {
|
|
74287
|
-
return createDiagnosticForNode(node, message,
|
|
74203
|
+
return createDiagnosticForNode(node, message, ...args);
|
|
74288
74204
|
}
|
|
74289
74205
|
return createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, message);
|
|
74290
74206
|
}
|
|
@@ -74372,11 +74288,8 @@ function createTypeChecker(host) {
|
|
|
74372
74288
|
}
|
|
74373
74289
|
const parameter = (_a2 = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a2.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
|
|
74374
74290
|
if (parameter) {
|
|
74375
|
-
const
|
|
74376
|
-
|
|
74377
|
-
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,
|
|
74378
|
-
!parameter.name ? args.length : !isBindingPattern(parameter.name) ? idText(getFirstIdentifier(parameter.name)) : void 0
|
|
74379
|
-
);
|
|
74291
|
+
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))];
|
|
74292
|
+
const parameterError = createDiagnosticForNode(parameter, ...messageAndArgs);
|
|
74380
74293
|
return addRelatedInfo(diagnostic, parameterError);
|
|
74381
74294
|
}
|
|
74382
74295
|
return diagnostic;
|
|
@@ -75981,12 +75894,12 @@ function createTypeChecker(host) {
|
|
|
75981
75894
|
}
|
|
75982
75895
|
return void 0;
|
|
75983
75896
|
}
|
|
75984
|
-
function getRestTypeAtPosition(source, pos) {
|
|
75897
|
+
function getRestTypeAtPosition(source, pos, readonly = false) {
|
|
75985
75898
|
const parameterCount = getParameterCount(source);
|
|
75986
75899
|
const minArgumentCount = getMinArgumentCount(source);
|
|
75987
75900
|
const restType = getEffectiveRestType(source);
|
|
75988
75901
|
if (restType && pos >= parameterCount - 1) {
|
|
75989
|
-
return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
|
|
75902
|
+
return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType), readonly);
|
|
75990
75903
|
}
|
|
75991
75904
|
const types = [];
|
|
75992
75905
|
const flags = [];
|
|
@@ -76004,13 +75917,7 @@ function createTypeChecker(host) {
|
|
|
76004
75917
|
names.push(name);
|
|
76005
75918
|
}
|
|
76006
75919
|
}
|
|
76007
|
-
return createTupleType(
|
|
76008
|
-
types,
|
|
76009
|
-
flags,
|
|
76010
|
-
/*readonly*/
|
|
76011
|
-
false,
|
|
76012
|
-
length(names) === length(types) ? names : void 0
|
|
76013
|
-
);
|
|
75920
|
+
return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
|
|
76014
75921
|
}
|
|
76015
75922
|
function getParameterCount(signature) {
|
|
76016
75923
|
const length2 = signature.parameters.length;
|
|
@@ -79716,9 +79623,9 @@ function createTypeChecker(host) {
|
|
|
79716
79623
|
}
|
|
79717
79624
|
}
|
|
79718
79625
|
}
|
|
79719
|
-
function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage,
|
|
79626
|
+
function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, ...args) {
|
|
79720
79627
|
const promisedType = getPromisedTypeOfPromise(type, errorNode);
|
|
79721
|
-
return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage,
|
|
79628
|
+
return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, ...args);
|
|
79722
79629
|
}
|
|
79723
79630
|
function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) {
|
|
79724
79631
|
if (isTypeAny(type)) {
|
|
@@ -79781,8 +79688,8 @@ function createTypeChecker(host) {
|
|
|
79781
79688
|
}
|
|
79782
79689
|
return typeAsPromise.promisedTypeOfPromise = getUnionType(map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), 2 /* Subtype */);
|
|
79783
79690
|
}
|
|
79784
|
-
function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage,
|
|
79785
|
-
const awaitedType = withAlias ? getAwaitedType(type, errorNode, diagnosticMessage,
|
|
79691
|
+
function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage, ...args) {
|
|
79692
|
+
const awaitedType = withAlias ? getAwaitedType(type, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args);
|
|
79786
79693
|
return awaitedType || errorType;
|
|
79787
79694
|
}
|
|
79788
79695
|
function isThenableType(type) {
|
|
@@ -79838,11 +79745,11 @@ function createTypeChecker(host) {
|
|
|
79838
79745
|
Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
79839
79746
|
return type;
|
|
79840
79747
|
}
|
|
79841
|
-
function getAwaitedType(type, errorNode, diagnosticMessage,
|
|
79842
|
-
const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage,
|
|
79748
|
+
function getAwaitedType(type, errorNode, diagnosticMessage, ...args) {
|
|
79749
|
+
const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args);
|
|
79843
79750
|
return awaitedType && createAwaitedTypeIfNeeded(awaitedType);
|
|
79844
79751
|
}
|
|
79845
|
-
function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage,
|
|
79752
|
+
function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args) {
|
|
79846
79753
|
if (isTypeAny(type)) {
|
|
79847
79754
|
return type;
|
|
79848
79755
|
}
|
|
@@ -79860,7 +79767,7 @@ function createTypeChecker(host) {
|
|
|
79860
79767
|
}
|
|
79861
79768
|
return void 0;
|
|
79862
79769
|
}
|
|
79863
|
-
const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage,
|
|
79770
|
+
const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias;
|
|
79864
79771
|
awaitedTypeStack.push(type.id);
|
|
79865
79772
|
const mapped = mapType(type, mapper);
|
|
79866
79773
|
awaitedTypeStack.pop();
|
|
@@ -79884,7 +79791,7 @@ function createTypeChecker(host) {
|
|
|
79884
79791
|
return void 0;
|
|
79885
79792
|
}
|
|
79886
79793
|
awaitedTypeStack.push(type.id);
|
|
79887
|
-
const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage,
|
|
79794
|
+
const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, ...args);
|
|
79888
79795
|
awaitedTypeStack.pop();
|
|
79889
79796
|
if (!awaitedType) {
|
|
79890
79797
|
return void 0;
|
|
@@ -79898,7 +79805,7 @@ function createTypeChecker(host) {
|
|
|
79898
79805
|
if (thisTypeForErrorOut.value) {
|
|
79899
79806
|
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));
|
|
79900
79807
|
}
|
|
79901
|
-
chain = chainDiagnosticMessages(chain, diagnosticMessage,
|
|
79808
|
+
chain = chainDiagnosticMessages(chain, diagnosticMessage, ...args);
|
|
79902
79809
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(errorNode), errorNode, chain));
|
|
79903
79810
|
}
|
|
79904
79811
|
return void 0;
|
|
@@ -80076,7 +79983,7 @@ function createTypeChecker(host) {
|
|
|
80076
79983
|
true
|
|
80077
79984
|
);
|
|
80078
79985
|
if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
|
|
80079
|
-
if (
|
|
79986
|
+
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
80080
79987
|
markAliasSymbolAsReferenced(rootSymbol);
|
|
80081
79988
|
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
80082
79989
|
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);
|
|
@@ -80485,9 +80392,8 @@ function createTypeChecker(host) {
|
|
|
80485
80392
|
const sourceFile = getSourceFileOfNode(parent2);
|
|
80486
80393
|
const range = isJSDocTemplateTag(parent2) ? rangeOfNode(parent2) : rangeOfTypeParameters(sourceFile, parent2.typeParameters);
|
|
80487
80394
|
const only = parent2.typeParameters.length === 1;
|
|
80488
|
-
const
|
|
80489
|
-
|
|
80490
|
-
addDiagnostic(typeParameter, 1 /* Parameter */, createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, message, arg0));
|
|
80395
|
+
const messageAndArg = only ? [Diagnostics._0_is_declared_but_its_value_is_never_read, name] : [Diagnostics.All_type_parameters_are_unused];
|
|
80396
|
+
addDiagnostic(typeParameter, 1 /* Parameter */, createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, ...messageAndArg));
|
|
80491
80397
|
}
|
|
80492
80398
|
} else {
|
|
80493
80399
|
addDiagnostic(typeParameter, 1 /* Parameter */, createDiagnosticForNode(typeParameter, Diagnostics._0_is_declared_but_its_value_is_never_read, name));
|
|
@@ -82045,7 +81951,7 @@ function createTypeChecker(host) {
|
|
|
82045
81951
|
forEachKey(catchClause.locals, (caughtName) => {
|
|
82046
81952
|
const blockLocal = blockLocals.get(caughtName);
|
|
82047
81953
|
if ((blockLocal == null ? void 0 : blockLocal.valueDeclaration) && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) {
|
|
82048
|
-
grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName);
|
|
81954
|
+
grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, unescapeLeadingUnderscores(caughtName));
|
|
82049
81955
|
}
|
|
82050
81956
|
});
|
|
82051
81957
|
}
|
|
@@ -83641,6 +83547,9 @@ function createTypeChecker(host) {
|
|
|
83641
83547
|
) && !getSymbolLinks(getSymbolOfDeclaration(statement)).constEnumReferenced;
|
|
83642
83548
|
}
|
|
83643
83549
|
function checkImportsForTypeOnlyConversion(sourceFile) {
|
|
83550
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
83551
|
+
return;
|
|
83552
|
+
}
|
|
83644
83553
|
for (const statement of sourceFile.statements) {
|
|
83645
83554
|
if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) {
|
|
83646
83555
|
error(
|
|
@@ -83726,14 +83635,14 @@ function createTypeChecker(host) {
|
|
|
83726
83635
|
markAliasReferenced(sym, id);
|
|
83727
83636
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
83728
83637
|
checkExpressionCached(id);
|
|
83729
|
-
if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
83638
|
+
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
83730
83639
|
error(
|
|
83731
83640
|
id,
|
|
83732
83641
|
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,
|
|
83733
83642
|
idText(id)
|
|
83734
83643
|
);
|
|
83735
83644
|
}
|
|
83736
|
-
} else if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax) {
|
|
83645
|
+
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
83737
83646
|
error(
|
|
83738
83647
|
id,
|
|
83739
83648
|
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,
|
|
@@ -85070,7 +84979,7 @@ function createTypeChecker(host) {
|
|
|
85070
84979
|
return false;
|
|
85071
84980
|
}
|
|
85072
84981
|
function isValueAliasDeclaration(node) {
|
|
85073
|
-
Debug.assert(
|
|
84982
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
85074
84983
|
switch (node.kind) {
|
|
85075
84984
|
case 269 /* ImportEqualsDeclaration */:
|
|
85076
84985
|
return isAliasResolvedToValue(getSymbolOfDeclaration(node));
|
|
@@ -85111,7 +85020,7 @@ function createTypeChecker(host) {
|
|
|
85111
85020
|
return isConstEnumSymbol(s) || !!s.constEnumOnlyModule;
|
|
85112
85021
|
}
|
|
85113
85022
|
function isReferencedAliasDeclaration(node, checkChildren) {
|
|
85114
|
-
Debug.assert(
|
|
85023
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
85115
85024
|
if (isAliasSymbolDeclaration2(node)) {
|
|
85116
85025
|
const symbol = getSymbolOfDeclaration(node);
|
|
85117
85026
|
const links = symbol && getSymbolLinks(symbol);
|
|
@@ -85449,12 +85358,12 @@ function createTypeChecker(host) {
|
|
|
85449
85358
|
isDeclarationWithCollidingName,
|
|
85450
85359
|
isValueAliasDeclaration: (nodeIn) => {
|
|
85451
85360
|
const node = getParseTreeNode(nodeIn);
|
|
85452
|
-
return node ? isValueAliasDeclaration(node) : true;
|
|
85361
|
+
return node && canCollectSymbolAliasAccessabilityData ? isValueAliasDeclaration(node) : true;
|
|
85453
85362
|
},
|
|
85454
85363
|
hasGlobalName,
|
|
85455
85364
|
isReferencedAliasDeclaration: (nodeIn, checkChildren) => {
|
|
85456
85365
|
const node = getParseTreeNode(nodeIn);
|
|
85457
|
-
return node ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
85366
|
+
return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
85458
85367
|
},
|
|
85459
85368
|
getNodeCheckFlags: (nodeIn) => {
|
|
85460
85369
|
const node = getParseTreeNode(nodeIn);
|
|
@@ -86589,7 +86498,7 @@ function createTypeChecker(host) {
|
|
|
86589
86498
|
throw Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
|
|
86590
86499
|
}
|
|
86591
86500
|
if (!inDestructuring) {
|
|
86592
|
-
const effectiveName =
|
|
86501
|
+
const effectiveName = getEffectivePropertyNameForPropertyNameNode(name);
|
|
86593
86502
|
if (effectiveName === void 0) {
|
|
86594
86503
|
continue;
|
|
86595
86504
|
}
|
|
@@ -87058,12 +86967,12 @@ function createTypeChecker(host) {
|
|
|
87058
86967
|
switch (node.keywordToken) {
|
|
87059
86968
|
case 104 /* NewKeyword */:
|
|
87060
86969
|
if (escapedText !== "target") {
|
|
87061
|
-
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");
|
|
86970
|
+
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");
|
|
87062
86971
|
}
|
|
87063
86972
|
break;
|
|
87064
86973
|
case 101 /* ImportKeyword */:
|
|
87065
86974
|
if (escapedText !== "meta") {
|
|
87066
|
-
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");
|
|
86975
|
+
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");
|
|
87067
86976
|
}
|
|
87068
86977
|
break;
|
|
87069
86978
|
}
|
|
@@ -87071,35 +86980,35 @@ function createTypeChecker(host) {
|
|
|
87071
86980
|
function hasParseDiagnostics(sourceFile) {
|
|
87072
86981
|
return sourceFile.parseDiagnostics.length > 0;
|
|
87073
86982
|
}
|
|
87074
|
-
function grammarErrorOnFirstToken(node, message,
|
|
86983
|
+
function grammarErrorOnFirstToken(node, message, ...args) {
|
|
87075
86984
|
const sourceFile = getSourceFileOfNode(node);
|
|
87076
86985
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
87077
86986
|
const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
87078
|
-
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message,
|
|
86987
|
+
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, ...args));
|
|
87079
86988
|
return true;
|
|
87080
86989
|
}
|
|
87081
86990
|
return false;
|
|
87082
86991
|
}
|
|
87083
|
-
function grammarErrorAtPos(nodeForSourceFile, start2, length2, message,
|
|
86992
|
+
function grammarErrorAtPos(nodeForSourceFile, start2, length2, message, ...args) {
|
|
87084
86993
|
const sourceFile = getSourceFileOfNode(nodeForSourceFile);
|
|
87085
86994
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
87086
|
-
diagnostics.add(createFileDiagnostic(sourceFile, start2, length2, message,
|
|
86995
|
+
diagnostics.add(createFileDiagnostic(sourceFile, start2, length2, message, ...args));
|
|
87087
86996
|
return true;
|
|
87088
86997
|
}
|
|
87089
86998
|
return false;
|
|
87090
86999
|
}
|
|
87091
|
-
function grammarErrorOnNodeSkippedOn(key, node, message,
|
|
87000
|
+
function grammarErrorOnNodeSkippedOn(key, node, message, ...args) {
|
|
87092
87001
|
const sourceFile = getSourceFileOfNode(node);
|
|
87093
87002
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
87094
|
-
errorSkippedOn(key, node, message,
|
|
87003
|
+
errorSkippedOn(key, node, message, ...args);
|
|
87095
87004
|
return true;
|
|
87096
87005
|
}
|
|
87097
87006
|
return false;
|
|
87098
87007
|
}
|
|
87099
|
-
function grammarErrorOnNode(node, message,
|
|
87008
|
+
function grammarErrorOnNode(node, message, ...args) {
|
|
87100
87009
|
const sourceFile = getSourceFileOfNode(node);
|
|
87101
87010
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
87102
|
-
diagnostics.add(createDiagnosticForNode(node, message,
|
|
87011
|
+
diagnostics.add(createDiagnosticForNode(node, message, ...args));
|
|
87103
87012
|
return true;
|
|
87104
87013
|
}
|
|
87105
87014
|
return false;
|
|
@@ -87244,7 +87153,7 @@ function createTypeChecker(host) {
|
|
|
87244
87153
|
}
|
|
87245
87154
|
return false;
|
|
87246
87155
|
}
|
|
87247
|
-
function grammarErrorAfterFirstToken(node, message,
|
|
87156
|
+
function grammarErrorAfterFirstToken(node, message, ...args) {
|
|
87248
87157
|
const sourceFile = getSourceFileOfNode(node);
|
|
87249
87158
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
87250
87159
|
const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
@@ -87254,9 +87163,7 @@ function createTypeChecker(host) {
|
|
|
87254
87163
|
/*length*/
|
|
87255
87164
|
0,
|
|
87256
87165
|
message,
|
|
87257
|
-
|
|
87258
|
-
arg1,
|
|
87259
|
-
arg2
|
|
87166
|
+
...args
|
|
87260
87167
|
));
|
|
87261
87168
|
return true;
|
|
87262
87169
|
}
|
|
@@ -87402,6 +87309,10 @@ function createTypeChecker(host) {
|
|
|
87402
87309
|
}
|
|
87403
87310
|
return void 0;
|
|
87404
87311
|
}
|
|
87312
|
+
function getEffectivePropertyNameForPropertyNameNode(node) {
|
|
87313
|
+
const name = getPropertyNameForPropertyNameNode(node);
|
|
87314
|
+
return name ? name : isComputedPropertyName(node) && isEntityNameExpression(node.expression) ? tryGetNameFromEntityNameExpression(node.expression) : void 0;
|
|
87315
|
+
}
|
|
87405
87316
|
}
|
|
87406
87317
|
function isNotAccessor(declaration) {
|
|
87407
87318
|
return !isAccessor(declaration);
|
|
@@ -111754,8 +111665,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
111754
111665
|
}
|
|
111755
111666
|
}
|
|
111756
111667
|
function createBuildInfo(program, bundle) {
|
|
111757
|
-
|
|
111758
|
-
return { bundle, program, version: version2 };
|
|
111668
|
+
return { bundle, program, version };
|
|
111759
111669
|
}
|
|
111760
111670
|
function getBuildInfoText(buildInfo) {
|
|
111761
111671
|
return JSON.stringify(buildInfo);
|
|
@@ -111843,10 +111753,10 @@ function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
|
|
|
111843
111753
|
/*separateBeginAndEnd*/
|
|
111844
111754
|
true
|
|
111845
111755
|
);
|
|
111846
|
-
|
|
111756
|
+
mark("beforeEmit");
|
|
111847
111757
|
const result = emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers);
|
|
111848
|
-
|
|
111849
|
-
|
|
111758
|
+
mark("afterEmit");
|
|
111759
|
+
measure("Emit", "beforeEmit", "afterEmit");
|
|
111850
111760
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
111851
111761
|
return result;
|
|
111852
111762
|
}
|
|
@@ -115860,12 +115770,12 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115860
115770
|
return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags != null ? flags : 0 /* None */, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix)));
|
|
115861
115771
|
}
|
|
115862
115772
|
function isUniqueName(name, privateName) {
|
|
115863
|
-
return
|
|
115773
|
+
return isFileLevelUniqueNameInCurrentFile(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
|
|
115864
115774
|
}
|
|
115865
115775
|
function isReservedName(name, privateName) {
|
|
115866
115776
|
return privateName ? !!(reservedPrivateNames == null ? void 0 : reservedPrivateNames.has(name)) : !!(reservedNames == null ? void 0 : reservedNames.has(name));
|
|
115867
115777
|
}
|
|
115868
|
-
function
|
|
115778
|
+
function isFileLevelUniqueNameInCurrentFile(name, _isPrivate) {
|
|
115869
115779
|
return currentSourceFile ? isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true;
|
|
115870
115780
|
}
|
|
115871
115781
|
function isUniqueLocalName(name, container) {
|
|
@@ -115984,7 +115894,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115984
115894
|
function makeFileLevelOptimisticUniqueName(name) {
|
|
115985
115895
|
return makeUniqueName2(
|
|
115986
115896
|
name,
|
|
115987
|
-
|
|
115897
|
+
isFileLevelUniqueNameInCurrentFile,
|
|
115988
115898
|
/*optimistic*/
|
|
115989
115899
|
true,
|
|
115990
115900
|
/*scoped*/
|
|
@@ -116164,7 +116074,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
116164
116074
|
case 3 /* Unique */:
|
|
116165
116075
|
return makeUniqueName2(
|
|
116166
116076
|
idText(name),
|
|
116167
|
-
autoGenerate.flags & 32 /* FileLevel */ ?
|
|
116077
|
+
autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueNameInCurrentFile : isUniqueName,
|
|
116168
116078
|
!!(autoGenerate.flags & 16 /* Optimistic */),
|
|
116169
116079
|
!!(autoGenerate.flags & 8 /* ReservedInNestedScopes */),
|
|
116170
116080
|
isPrivateIdentifier(name),
|
|
@@ -119239,12 +119149,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119239
119149
|
}
|
|
119240
119150
|
}
|
|
119241
119151
|
}
|
|
119242
|
-
function createDiagnosticForNodeArray2(nodes, message,
|
|
119152
|
+
function createDiagnosticForNodeArray2(nodes, message, ...args) {
|
|
119243
119153
|
const start2 = nodes.pos;
|
|
119244
|
-
return createFileDiagnostic(sourceFile, start2, nodes.end - start2, message,
|
|
119154
|
+
return createFileDiagnostic(sourceFile, start2, nodes.end - start2, message, ...args);
|
|
119245
119155
|
}
|
|
119246
|
-
function createDiagnosticForNode2(node, message,
|
|
119247
|
-
return createDiagnosticForNodeInSourceFile(sourceFile, node, message,
|
|
119156
|
+
function createDiagnosticForNode2(node, message, ...args) {
|
|
119157
|
+
return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args);
|
|
119248
119158
|
}
|
|
119249
119159
|
});
|
|
119250
119160
|
}
|
|
@@ -119909,11 +119819,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119909
119819
|
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
|
119910
119820
|
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
|
119911
119821
|
const diagnostic = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0;
|
|
119822
|
+
const args = suggestion ? [libName, suggestion] : [libName];
|
|
119912
119823
|
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
119913
119824
|
kind: 0 /* FilePreprocessingReferencedDiagnostic */,
|
|
119914
119825
|
reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index },
|
|
119915
119826
|
diagnostic,
|
|
119916
|
-
args
|
|
119827
|
+
args
|
|
119917
119828
|
});
|
|
119918
119829
|
}
|
|
119919
119830
|
});
|
|
@@ -120378,7 +120289,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120378
120289
|
}
|
|
120379
120290
|
}
|
|
120380
120291
|
function verifyDeprecatedCompilerOptions() {
|
|
120381
|
-
function createDiagnostic(name, value, useInstead, message,
|
|
120292
|
+
function createDiagnostic(name, value, useInstead, message, ...args) {
|
|
120382
120293
|
if (useInstead) {
|
|
120383
120294
|
const details = chainDiagnosticMessages(
|
|
120384
120295
|
/*details*/
|
|
@@ -120386,7 +120297,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120386
120297
|
Diagnostics.Use_0_instead,
|
|
120387
120298
|
useInstead
|
|
120388
120299
|
);
|
|
120389
|
-
const chain = chainDiagnosticMessages(details, message,
|
|
120300
|
+
const chain = chainDiagnosticMessages(details, message, ...args);
|
|
120390
120301
|
createDiagnosticForOption(
|
|
120391
120302
|
/*onKey*/
|
|
120392
120303
|
!value,
|
|
@@ -120403,10 +120314,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120403
120314
|
/*option2*/
|
|
120404
120315
|
void 0,
|
|
120405
120316
|
message,
|
|
120406
|
-
|
|
120407
|
-
arg1,
|
|
120408
|
-
arg2,
|
|
120409
|
-
arg3
|
|
120317
|
+
...args
|
|
120410
120318
|
);
|
|
120411
120319
|
}
|
|
120412
120320
|
}
|
|
@@ -120459,8 +120367,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120459
120367
|
});
|
|
120460
120368
|
}
|
|
120461
120369
|
function verifyDeprecatedProjectReference(ref, parentFile, index) {
|
|
120462
|
-
function createDiagnostic(_name, _value, _useInstead, message,
|
|
120463
|
-
createDiagnosticForReference(parentFile, index, message,
|
|
120370
|
+
function createDiagnostic(_name, _value, _useInstead, message, ...args) {
|
|
120371
|
+
createDiagnosticForReference(parentFile, index, message, ...args);
|
|
120464
120372
|
}
|
|
120465
120373
|
checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
|
|
120466
120374
|
if (ref.prepend) {
|
|
@@ -120642,7 +120550,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120642
120550
|
}
|
|
120643
120551
|
});
|
|
120644
120552
|
}
|
|
120645
|
-
function createDiagnosticForOptionPathKeyValue(key, valueIndex, message,
|
|
120553
|
+
function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
|
|
120646
120554
|
let needCompilerDiagnostic = true;
|
|
120647
120555
|
const pathsSyntax = getOptionPathsSyntax();
|
|
120648
120556
|
for (const pathProp of pathsSyntax) {
|
|
@@ -120650,17 +120558,17 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120650
120558
|
for (const keyProps of getPropertyAssignment(pathProp.initializer, key)) {
|
|
120651
120559
|
const initializer = keyProps.initializer;
|
|
120652
120560
|
if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
|
|
120653
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message,
|
|
120561
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
|
|
120654
120562
|
needCompilerDiagnostic = false;
|
|
120655
120563
|
}
|
|
120656
120564
|
}
|
|
120657
120565
|
}
|
|
120658
120566
|
}
|
|
120659
120567
|
if (needCompilerDiagnostic) {
|
|
120660
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
120568
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
120661
120569
|
}
|
|
120662
120570
|
}
|
|
120663
|
-
function createDiagnosticForOptionPaths(onKey, key, message,
|
|
120571
|
+
function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
|
|
120664
120572
|
let needCompilerDiagnostic = true;
|
|
120665
120573
|
const pathsSyntax = getOptionPathsSyntax();
|
|
120666
120574
|
for (const pathProp of pathsSyntax) {
|
|
@@ -120671,13 +120579,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120671
120579
|
/*key2*/
|
|
120672
120580
|
void 0,
|
|
120673
120581
|
message,
|
|
120674
|
-
|
|
120582
|
+
...args
|
|
120675
120583
|
)) {
|
|
120676
120584
|
needCompilerDiagnostic = false;
|
|
120677
120585
|
}
|
|
120678
120586
|
}
|
|
120679
120587
|
if (needCompilerDiagnostic) {
|
|
120680
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
120588
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
120681
120589
|
}
|
|
120682
120590
|
}
|
|
120683
120591
|
function getOptionsSyntaxByName(name) {
|
|
@@ -120707,7 +120615,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120707
120615
|
option3
|
|
120708
120616
|
);
|
|
120709
120617
|
}
|
|
120710
|
-
function createOptionValueDiagnostic(option1, message,
|
|
120618
|
+
function createOptionValueDiagnostic(option1, message, ...args) {
|
|
120711
120619
|
createDiagnosticForOption(
|
|
120712
120620
|
/*onKey*/
|
|
120713
120621
|
false,
|
|
@@ -120715,29 +120623,28 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120715
120623
|
/*option2*/
|
|
120716
120624
|
void 0,
|
|
120717
120625
|
message,
|
|
120718
|
-
|
|
120719
|
-
arg1
|
|
120626
|
+
...args
|
|
120720
120627
|
);
|
|
120721
120628
|
}
|
|
120722
|
-
function createDiagnosticForReference(sourceFile, index, message,
|
|
120629
|
+
function createDiagnosticForReference(sourceFile, index, message, ...args) {
|
|
120723
120630
|
const referencesSyntax = firstDefined(
|
|
120724
120631
|
getTsConfigPropArray(sourceFile || options.configFile, "references"),
|
|
120725
120632
|
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
120726
120633
|
);
|
|
120727
120634
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
|
120728
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message,
|
|
120635
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
|
|
120729
120636
|
} else {
|
|
120730
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
120637
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
120731
120638
|
}
|
|
120732
120639
|
}
|
|
120733
|
-
function createDiagnosticForOption(onKey, option1, option2, message,
|
|
120640
|
+
function createDiagnosticForOption(onKey, option1, option2, message, ...args) {
|
|
120734
120641
|
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
|
120735
|
-
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message,
|
|
120642
|
+
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, ...args);
|
|
120736
120643
|
if (needCompilerDiagnostic) {
|
|
120737
120644
|
if ("messageText" in message) {
|
|
120738
120645
|
programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
|
|
120739
120646
|
} else {
|
|
120740
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
120647
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
120741
120648
|
}
|
|
120742
120649
|
}
|
|
120743
120650
|
}
|
|
@@ -120756,13 +120663,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120756
120663
|
}
|
|
120757
120664
|
return _compilerOptionsObjectLiteralSyntax || void 0;
|
|
120758
120665
|
}
|
|
120759
|
-
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message,
|
|
120666
|
+
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
|
|
120760
120667
|
const props = getPropertyAssignment(objectLiteral, key1, key2);
|
|
120761
120668
|
for (const prop of props) {
|
|
120762
120669
|
if ("messageText" in message) {
|
|
120763
120670
|
programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
|
|
120764
120671
|
} else {
|
|
120765
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message,
|
|
120672
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
|
|
120766
120673
|
}
|
|
120767
120674
|
}
|
|
120768
120675
|
return !!props.length;
|
|
@@ -121683,16 +121590,16 @@ function convertToDiagnostics(diagnostics, newProgram) {
|
|
|
121683
121590
|
return emptyArray;
|
|
121684
121591
|
let buildInfoDirectory;
|
|
121685
121592
|
return diagnostics.map((diagnostic) => {
|
|
121686
|
-
const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram,
|
|
121593
|
+
const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPathInBuildInfoDirectory);
|
|
121687
121594
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
121688
121595
|
result.reportsDeprecated = diagnostic.reportDeprecated;
|
|
121689
121596
|
result.source = diagnostic.source;
|
|
121690
121597
|
result.skippedOn = diagnostic.skippedOn;
|
|
121691
121598
|
const { relatedInformation } = diagnostic;
|
|
121692
|
-
result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram,
|
|
121599
|
+
result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram, toPathInBuildInfoDirectory)) : [] : void 0;
|
|
121693
121600
|
return result;
|
|
121694
121601
|
});
|
|
121695
|
-
function
|
|
121602
|
+
function toPathInBuildInfoDirectory(path) {
|
|
121696
121603
|
buildInfoDirectory != null ? buildInfoDirectory : buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
|
|
121697
121604
|
return toPath(path, buildInfoDirectory, newProgram.getCanonicalFileName);
|
|
121698
121605
|
}
|
|
@@ -122600,7 +122507,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
122600
122507
|
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
122601
122508
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
122602
122509
|
let state;
|
|
122603
|
-
const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(
|
|
122510
|
+
const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(toPathInBuildInfoDirectory);
|
|
122604
122511
|
let filePathsSetList;
|
|
122605
122512
|
const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0;
|
|
122606
122513
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
@@ -122681,7 +122588,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
122681
122588
|
close: noop,
|
|
122682
122589
|
hasChangedEmitSignature: returnFalse
|
|
122683
122590
|
};
|
|
122684
|
-
function
|
|
122591
|
+
function toPathInBuildInfoDirectory(path) {
|
|
122685
122592
|
return toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
122686
122593
|
}
|
|
122687
122594
|
function toAbsolutePath(path) {
|
|
@@ -123727,15 +123634,13 @@ function getErrorSummaryText(errorCount, filesInError, newLine, host) {
|
|
|
123727
123634
|
const nonNilFiles = filesInError.filter((fileInError) => fileInError !== void 0);
|
|
123728
123635
|
const distinctFileNamesWithLines = nonNilFiles.map((fileInError) => `${fileInError.fileName}:${fileInError.line}`).filter((value, index, self) => self.indexOf(value) === index);
|
|
123729
123636
|
const firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
|
|
123730
|
-
|
|
123731
|
-
|
|
123732
|
-
|
|
123733
|
-
|
|
123734
|
-
|
|
123735
|
-
|
|
123736
|
-
|
|
123737
|
-
distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length
|
|
123738
|
-
);
|
|
123637
|
+
let messageAndArgs;
|
|
123638
|
+
if (errorCount === 1) {
|
|
123639
|
+
messageAndArgs = filesInError[0] !== void 0 ? [Diagnostics.Found_1_error_in_0, firstFileReference] : [Diagnostics.Found_1_error];
|
|
123640
|
+
} else {
|
|
123641
|
+
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];
|
|
123642
|
+
}
|
|
123643
|
+
const d = createCompilerDiagnostic(...messageAndArgs);
|
|
123739
123644
|
const suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "";
|
|
123740
123645
|
return `${newLine}${flattenDiagnosticMessageText(d.messageText, newLine)}${newLine}${newLine}${suffix}`;
|
|
123741
123646
|
}
|
|
@@ -123945,15 +123850,15 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
|
|
|
123945
123850
|
toFileName(referencedResolvedRef.sourceFile.fileName, fileNameConvertor),
|
|
123946
123851
|
options.outFile ? "--outFile" : "--out"
|
|
123947
123852
|
);
|
|
123948
|
-
case 8 /* AutomaticTypeDirectiveFile */:
|
|
123853
|
+
case 8 /* AutomaticTypeDirectiveFile */: {
|
|
123854
|
+
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];
|
|
123949
123855
|
return chainDiagnosticMessages(
|
|
123950
123856
|
/*details*/
|
|
123951
123857
|
void 0,
|
|
123952
|
-
|
|
123953
|
-
reason.typeReference,
|
|
123954
|
-
reason.packageId && packageIdToString(reason.packageId)
|
|
123858
|
+
...messageAndArgs
|
|
123955
123859
|
);
|
|
123956
|
-
|
|
123860
|
+
}
|
|
123861
|
+
case 6 /* LibFile */: {
|
|
123957
123862
|
if (reason.index !== void 0)
|
|
123958
123863
|
return chainDiagnosticMessages(
|
|
123959
123864
|
/*details*/
|
|
@@ -123962,12 +123867,13 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
|
|
|
123962
123867
|
options.lib[reason.index]
|
|
123963
123868
|
);
|
|
123964
123869
|
const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === getEmitScriptTarget(options) ? key : void 0);
|
|
123870
|
+
const messageAndArgs = target ? [Diagnostics.Default_library_for_target_0, target] : [Diagnostics.Default_library];
|
|
123965
123871
|
return chainDiagnosticMessages(
|
|
123966
123872
|
/*details*/
|
|
123967
123873
|
void 0,
|
|
123968
|
-
|
|
123969
|
-
target
|
|
123874
|
+
...messageAndArgs
|
|
123970
123875
|
);
|
|
123876
|
+
}
|
|
123971
123877
|
default:
|
|
123972
123878
|
Debug.assertNever(reason);
|
|
123973
123879
|
}
|
|
@@ -128952,9 +128858,6 @@ function isStringAndEmptyAnonymousObjectIntersection(type) {
|
|
|
128952
128858
|
const { types, checker } = type;
|
|
128953
128859
|
return types.length === 2 && (areIntersectedTypesAvoidingStringReduction(checker, types[0], types[1]) || areIntersectedTypesAvoidingStringReduction(checker, types[1], types[0]));
|
|
128954
128860
|
}
|
|
128955
|
-
function isPunctuation(kind) {
|
|
128956
|
-
return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */;
|
|
128957
|
-
}
|
|
128958
128861
|
function isInsideTemplateLiteral(node, position, sourceFile) {
|
|
128959
128862
|
return isTemplateLiteralKind(node.kind) && (node.getStart(sourceFile) < position && position < node.end) || !!node.isUnterminated && position === node.end;
|
|
128960
128863
|
}
|
|
@@ -134553,6 +134456,234 @@ function cleanText(text) {
|
|
|
134553
134456
|
return text.replace(/\\?(\r?\n|\r|\u2028|\u2029)/g, "");
|
|
134554
134457
|
}
|
|
134555
134458
|
|
|
134459
|
+
// src/services/classifier2020.ts
|
|
134460
|
+
var TokenEncodingConsts = /* @__PURE__ */ ((TokenEncodingConsts2) => {
|
|
134461
|
+
TokenEncodingConsts2[TokenEncodingConsts2["typeOffset"] = 8] = "typeOffset";
|
|
134462
|
+
TokenEncodingConsts2[TokenEncodingConsts2["modifierMask"] = 255] = "modifierMask";
|
|
134463
|
+
return TokenEncodingConsts2;
|
|
134464
|
+
})(TokenEncodingConsts || {});
|
|
134465
|
+
var TokenType = /* @__PURE__ */ ((TokenType2) => {
|
|
134466
|
+
TokenType2[TokenType2["class"] = 0] = "class";
|
|
134467
|
+
TokenType2[TokenType2["enum"] = 1] = "enum";
|
|
134468
|
+
TokenType2[TokenType2["interface"] = 2] = "interface";
|
|
134469
|
+
TokenType2[TokenType2["namespace"] = 3] = "namespace";
|
|
134470
|
+
TokenType2[TokenType2["typeParameter"] = 4] = "typeParameter";
|
|
134471
|
+
TokenType2[TokenType2["type"] = 5] = "type";
|
|
134472
|
+
TokenType2[TokenType2["parameter"] = 6] = "parameter";
|
|
134473
|
+
TokenType2[TokenType2["variable"] = 7] = "variable";
|
|
134474
|
+
TokenType2[TokenType2["enumMember"] = 8] = "enumMember";
|
|
134475
|
+
TokenType2[TokenType2["property"] = 9] = "property";
|
|
134476
|
+
TokenType2[TokenType2["function"] = 10] = "function";
|
|
134477
|
+
TokenType2[TokenType2["member"] = 11] = "member";
|
|
134478
|
+
return TokenType2;
|
|
134479
|
+
})(TokenType || {});
|
|
134480
|
+
var TokenModifier = /* @__PURE__ */ ((TokenModifier2) => {
|
|
134481
|
+
TokenModifier2[TokenModifier2["declaration"] = 0] = "declaration";
|
|
134482
|
+
TokenModifier2[TokenModifier2["static"] = 1] = "static";
|
|
134483
|
+
TokenModifier2[TokenModifier2["async"] = 2] = "async";
|
|
134484
|
+
TokenModifier2[TokenModifier2["readonly"] = 3] = "readonly";
|
|
134485
|
+
TokenModifier2[TokenModifier2["defaultLibrary"] = 4] = "defaultLibrary";
|
|
134486
|
+
TokenModifier2[TokenModifier2["local"] = 5] = "local";
|
|
134487
|
+
return TokenModifier2;
|
|
134488
|
+
})(TokenModifier || {});
|
|
134489
|
+
function getSemanticClassifications2(program, cancellationToken, sourceFile, span) {
|
|
134490
|
+
const classifications = getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span);
|
|
134491
|
+
Debug.assert(classifications.spans.length % 3 === 0);
|
|
134492
|
+
const dense = classifications.spans;
|
|
134493
|
+
const result = [];
|
|
134494
|
+
for (let i = 0; i < dense.length; i += 3) {
|
|
134495
|
+
result.push({
|
|
134496
|
+
textSpan: createTextSpan(dense[i], dense[i + 1]),
|
|
134497
|
+
classificationType: dense[i + 2]
|
|
134498
|
+
});
|
|
134499
|
+
}
|
|
134500
|
+
return result;
|
|
134501
|
+
}
|
|
134502
|
+
function getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span) {
|
|
134503
|
+
return {
|
|
134504
|
+
spans: getSemanticTokens(program, sourceFile, span, cancellationToken),
|
|
134505
|
+
endOfLineState: 0 /* None */
|
|
134506
|
+
};
|
|
134507
|
+
}
|
|
134508
|
+
function getSemanticTokens(program, sourceFile, span, cancellationToken) {
|
|
134509
|
+
const resultTokens = [];
|
|
134510
|
+
const collector = (node, typeIdx, modifierSet) => {
|
|
134511
|
+
resultTokens.push(node.getStart(sourceFile), node.getWidth(sourceFile), (typeIdx + 1 << 8 /* typeOffset */) + modifierSet);
|
|
134512
|
+
};
|
|
134513
|
+
if (program && sourceFile) {
|
|
134514
|
+
collectTokens(program, sourceFile, span, collector, cancellationToken);
|
|
134515
|
+
}
|
|
134516
|
+
return resultTokens;
|
|
134517
|
+
}
|
|
134518
|
+
function collectTokens(program, sourceFile, span, collector, cancellationToken) {
|
|
134519
|
+
const typeChecker = program.getTypeChecker();
|
|
134520
|
+
let inJSXElement = false;
|
|
134521
|
+
function visit(node) {
|
|
134522
|
+
switch (node.kind) {
|
|
134523
|
+
case 265 /* ModuleDeclaration */:
|
|
134524
|
+
case 261 /* ClassDeclaration */:
|
|
134525
|
+
case 262 /* InterfaceDeclaration */:
|
|
134526
|
+
case 260 /* FunctionDeclaration */:
|
|
134527
|
+
case 229 /* ClassExpression */:
|
|
134528
|
+
case 216 /* FunctionExpression */:
|
|
134529
|
+
case 217 /* ArrowFunction */:
|
|
134530
|
+
cancellationToken.throwIfCancellationRequested();
|
|
134531
|
+
}
|
|
134532
|
+
if (!node || !textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) {
|
|
134533
|
+
return;
|
|
134534
|
+
}
|
|
134535
|
+
const prevInJSXElement = inJSXElement;
|
|
134536
|
+
if (isJsxElement(node) || isJsxSelfClosingElement(node)) {
|
|
134537
|
+
inJSXElement = true;
|
|
134538
|
+
}
|
|
134539
|
+
if (isJsxExpression(node)) {
|
|
134540
|
+
inJSXElement = false;
|
|
134541
|
+
}
|
|
134542
|
+
if (isIdentifier(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) {
|
|
134543
|
+
let symbol = typeChecker.getSymbolAtLocation(node);
|
|
134544
|
+
if (symbol) {
|
|
134545
|
+
if (symbol.flags & 2097152 /* Alias */) {
|
|
134546
|
+
symbol = typeChecker.getAliasedSymbol(symbol);
|
|
134547
|
+
}
|
|
134548
|
+
let typeIdx = classifySymbol2(symbol, getMeaningFromLocation(node));
|
|
134549
|
+
if (typeIdx !== void 0) {
|
|
134550
|
+
let modifierSet = 0;
|
|
134551
|
+
if (node.parent) {
|
|
134552
|
+
const parentIsDeclaration = isBindingElement(node.parent) || tokenFromDeclarationMapping.get(node.parent.kind) === typeIdx;
|
|
134553
|
+
if (parentIsDeclaration && node.parent.name === node) {
|
|
134554
|
+
modifierSet = 1 << 0 /* declaration */;
|
|
134555
|
+
}
|
|
134556
|
+
}
|
|
134557
|
+
if (typeIdx === 6 /* parameter */ && isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
|
|
134558
|
+
typeIdx = 9 /* property */;
|
|
134559
|
+
}
|
|
134560
|
+
typeIdx = reclassifyByType(typeChecker, node, typeIdx);
|
|
134561
|
+
const decl = symbol.valueDeclaration;
|
|
134562
|
+
if (decl) {
|
|
134563
|
+
const modifiers = getCombinedModifierFlags(decl);
|
|
134564
|
+
const nodeFlags = getCombinedNodeFlags(decl);
|
|
134565
|
+
if (modifiers & 32 /* Static */) {
|
|
134566
|
+
modifierSet |= 1 << 1 /* static */;
|
|
134567
|
+
}
|
|
134568
|
+
if (modifiers & 512 /* Async */) {
|
|
134569
|
+
modifierSet |= 1 << 2 /* async */;
|
|
134570
|
+
}
|
|
134571
|
+
if (typeIdx !== 0 /* class */ && typeIdx !== 2 /* interface */) {
|
|
134572
|
+
if (modifiers & 64 /* Readonly */ || nodeFlags & 2 /* Const */ || symbol.getFlags() & 8 /* EnumMember */) {
|
|
134573
|
+
modifierSet |= 1 << 3 /* readonly */;
|
|
134574
|
+
}
|
|
134575
|
+
}
|
|
134576
|
+
if ((typeIdx === 7 /* variable */ || typeIdx === 10 /* function */) && isLocalDeclaration(decl, sourceFile)) {
|
|
134577
|
+
modifierSet |= 1 << 5 /* local */;
|
|
134578
|
+
}
|
|
134579
|
+
if (program.isSourceFileDefaultLibrary(decl.getSourceFile())) {
|
|
134580
|
+
modifierSet |= 1 << 4 /* defaultLibrary */;
|
|
134581
|
+
}
|
|
134582
|
+
} else if (symbol.declarations && symbol.declarations.some((d) => program.isSourceFileDefaultLibrary(d.getSourceFile()))) {
|
|
134583
|
+
modifierSet |= 1 << 4 /* defaultLibrary */;
|
|
134584
|
+
}
|
|
134585
|
+
collector(node, typeIdx, modifierSet);
|
|
134586
|
+
}
|
|
134587
|
+
}
|
|
134588
|
+
}
|
|
134589
|
+
forEachChild(node, visit);
|
|
134590
|
+
inJSXElement = prevInJSXElement;
|
|
134591
|
+
}
|
|
134592
|
+
visit(sourceFile);
|
|
134593
|
+
}
|
|
134594
|
+
function classifySymbol2(symbol, meaning) {
|
|
134595
|
+
const flags = symbol.getFlags();
|
|
134596
|
+
if (flags & 32 /* Class */) {
|
|
134597
|
+
return 0 /* class */;
|
|
134598
|
+
} else if (flags & 384 /* Enum */) {
|
|
134599
|
+
return 1 /* enum */;
|
|
134600
|
+
} else if (flags & 524288 /* TypeAlias */) {
|
|
134601
|
+
return 5 /* type */;
|
|
134602
|
+
} else if (flags & 64 /* Interface */) {
|
|
134603
|
+
if (meaning & 2 /* Type */) {
|
|
134604
|
+
return 2 /* interface */;
|
|
134605
|
+
}
|
|
134606
|
+
} else if (flags & 262144 /* TypeParameter */) {
|
|
134607
|
+
return 4 /* typeParameter */;
|
|
134608
|
+
}
|
|
134609
|
+
let decl = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0];
|
|
134610
|
+
if (decl && isBindingElement(decl)) {
|
|
134611
|
+
decl = getDeclarationForBindingElement(decl);
|
|
134612
|
+
}
|
|
134613
|
+
return decl && tokenFromDeclarationMapping.get(decl.kind);
|
|
134614
|
+
}
|
|
134615
|
+
function reclassifyByType(typeChecker, node, typeIdx) {
|
|
134616
|
+
if (typeIdx === 7 /* variable */ || typeIdx === 9 /* property */ || typeIdx === 6 /* parameter */) {
|
|
134617
|
+
const type = typeChecker.getTypeAtLocation(node);
|
|
134618
|
+
if (type) {
|
|
134619
|
+
const test = (condition) => {
|
|
134620
|
+
return condition(type) || type.isUnion() && type.types.some(condition);
|
|
134621
|
+
};
|
|
134622
|
+
if (typeIdx !== 6 /* parameter */ && test((t) => t.getConstructSignatures().length > 0)) {
|
|
134623
|
+
return 0 /* class */;
|
|
134624
|
+
}
|
|
134625
|
+
if (test((t) => t.getCallSignatures().length > 0) && !test((t) => t.getProperties().length > 0) || isExpressionInCallExpression(node)) {
|
|
134626
|
+
return typeIdx === 9 /* property */ ? 11 /* member */ : 10 /* function */;
|
|
134627
|
+
}
|
|
134628
|
+
}
|
|
134629
|
+
}
|
|
134630
|
+
return typeIdx;
|
|
134631
|
+
}
|
|
134632
|
+
function isLocalDeclaration(decl, sourceFile) {
|
|
134633
|
+
if (isBindingElement(decl)) {
|
|
134634
|
+
decl = getDeclarationForBindingElement(decl);
|
|
134635
|
+
}
|
|
134636
|
+
if (isVariableDeclaration(decl)) {
|
|
134637
|
+
return (!isSourceFile(decl.parent.parent.parent) || isCatchClause(decl.parent)) && decl.getSourceFile() === sourceFile;
|
|
134638
|
+
} else if (isFunctionDeclaration(decl)) {
|
|
134639
|
+
return !isSourceFile(decl.parent) && decl.getSourceFile() === sourceFile;
|
|
134640
|
+
}
|
|
134641
|
+
return false;
|
|
134642
|
+
}
|
|
134643
|
+
function getDeclarationForBindingElement(element) {
|
|
134644
|
+
while (true) {
|
|
134645
|
+
if (isBindingElement(element.parent.parent)) {
|
|
134646
|
+
element = element.parent.parent;
|
|
134647
|
+
} else {
|
|
134648
|
+
return element.parent.parent;
|
|
134649
|
+
}
|
|
134650
|
+
}
|
|
134651
|
+
}
|
|
134652
|
+
function inImportClause(node) {
|
|
134653
|
+
const parent2 = node.parent;
|
|
134654
|
+
return parent2 && (isImportClause(parent2) || isImportSpecifier(parent2) || isNamespaceImport(parent2));
|
|
134655
|
+
}
|
|
134656
|
+
function isExpressionInCallExpression(node) {
|
|
134657
|
+
while (isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
|
|
134658
|
+
node = node.parent;
|
|
134659
|
+
}
|
|
134660
|
+
return isCallExpression(node.parent) && node.parent.expression === node;
|
|
134661
|
+
}
|
|
134662
|
+
function isRightSideOfQualifiedNameOrPropertyAccess2(node) {
|
|
134663
|
+
return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node;
|
|
134664
|
+
}
|
|
134665
|
+
var tokenFromDeclarationMapping = /* @__PURE__ */ new Map([
|
|
134666
|
+
[258 /* VariableDeclaration */, 7 /* variable */],
|
|
134667
|
+
[167 /* Parameter */, 6 /* parameter */],
|
|
134668
|
+
[170 /* PropertyDeclaration */, 9 /* property */],
|
|
134669
|
+
[265 /* ModuleDeclaration */, 3 /* namespace */],
|
|
134670
|
+
[264 /* EnumDeclaration */, 1 /* enum */],
|
|
134671
|
+
[303 /* EnumMember */, 8 /* enumMember */],
|
|
134672
|
+
[261 /* ClassDeclaration */, 0 /* class */],
|
|
134673
|
+
[172 /* MethodDeclaration */, 11 /* member */],
|
|
134674
|
+
[260 /* FunctionDeclaration */, 10 /* function */],
|
|
134675
|
+
[216 /* FunctionExpression */, 10 /* function */],
|
|
134676
|
+
[171 /* MethodSignature */, 11 /* member */],
|
|
134677
|
+
[175 /* GetAccessor */, 9 /* property */],
|
|
134678
|
+
[176 /* SetAccessor */, 9 /* property */],
|
|
134679
|
+
[169 /* PropertySignature */, 9 /* property */],
|
|
134680
|
+
[262 /* InterfaceDeclaration */, 2 /* interface */],
|
|
134681
|
+
[263 /* TypeAliasDeclaration */, 5 /* type */],
|
|
134682
|
+
[166 /* TypeParameter */, 4 /* typeParameter */],
|
|
134683
|
+
[300 /* PropertyAssignment */, 9 /* property */],
|
|
134684
|
+
[301 /* ShorthandPropertyAssignment */, 9 /* property */]
|
|
134685
|
+
]);
|
|
134686
|
+
|
|
134556
134687
|
// src/services/services.ts
|
|
134557
134688
|
var servicesVersion = "0.8";
|
|
134558
134689
|
function createNode(kind, pos, end, parent2) {
|
|
@@ -135985,7 +136116,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
135985
136116
|
synchronizeHostData();
|
|
135986
136117
|
const responseFormat = format || "original" /* Original */;
|
|
135987
136118
|
if (responseFormat === "2020" /* TwentyTwenty */) {
|
|
135988
|
-
return
|
|
136119
|
+
return getSemanticClassifications2(program, cancellationToken, getValidSourceFile(fileName), span);
|
|
135989
136120
|
} else {
|
|
135990
136121
|
return getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
|
|
135991
136122
|
}
|
|
@@ -135996,7 +136127,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
135996
136127
|
if (responseFormat === "original" /* Original */) {
|
|
135997
136128
|
return getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
|
|
135998
136129
|
} else {
|
|
135999
|
-
return
|
|
136130
|
+
return getEncodedSemanticClassifications2(program, cancellationToken, getValidSourceFile(fileName), span);
|
|
136000
136131
|
}
|
|
136001
136132
|
}
|
|
136002
136133
|
function getSyntacticClassifications2(fileName, span) {
|
|
@@ -138563,234 +138694,6 @@ __export(ts_classifier_v2020_exports, {
|
|
|
138563
138694
|
getSemanticClassifications: () => getSemanticClassifications2
|
|
138564
138695
|
});
|
|
138565
138696
|
|
|
138566
|
-
// src/services/classifier2020.ts
|
|
138567
|
-
var TokenEncodingConsts = /* @__PURE__ */ ((TokenEncodingConsts2) => {
|
|
138568
|
-
TokenEncodingConsts2[TokenEncodingConsts2["typeOffset"] = 8] = "typeOffset";
|
|
138569
|
-
TokenEncodingConsts2[TokenEncodingConsts2["modifierMask"] = 255] = "modifierMask";
|
|
138570
|
-
return TokenEncodingConsts2;
|
|
138571
|
-
})(TokenEncodingConsts || {});
|
|
138572
|
-
var TokenType = /* @__PURE__ */ ((TokenType2) => {
|
|
138573
|
-
TokenType2[TokenType2["class"] = 0] = "class";
|
|
138574
|
-
TokenType2[TokenType2["enum"] = 1] = "enum";
|
|
138575
|
-
TokenType2[TokenType2["interface"] = 2] = "interface";
|
|
138576
|
-
TokenType2[TokenType2["namespace"] = 3] = "namespace";
|
|
138577
|
-
TokenType2[TokenType2["typeParameter"] = 4] = "typeParameter";
|
|
138578
|
-
TokenType2[TokenType2["type"] = 5] = "type";
|
|
138579
|
-
TokenType2[TokenType2["parameter"] = 6] = "parameter";
|
|
138580
|
-
TokenType2[TokenType2["variable"] = 7] = "variable";
|
|
138581
|
-
TokenType2[TokenType2["enumMember"] = 8] = "enumMember";
|
|
138582
|
-
TokenType2[TokenType2["property"] = 9] = "property";
|
|
138583
|
-
TokenType2[TokenType2["function"] = 10] = "function";
|
|
138584
|
-
TokenType2[TokenType2["member"] = 11] = "member";
|
|
138585
|
-
return TokenType2;
|
|
138586
|
-
})(TokenType || {});
|
|
138587
|
-
var TokenModifier = /* @__PURE__ */ ((TokenModifier2) => {
|
|
138588
|
-
TokenModifier2[TokenModifier2["declaration"] = 0] = "declaration";
|
|
138589
|
-
TokenModifier2[TokenModifier2["static"] = 1] = "static";
|
|
138590
|
-
TokenModifier2[TokenModifier2["async"] = 2] = "async";
|
|
138591
|
-
TokenModifier2[TokenModifier2["readonly"] = 3] = "readonly";
|
|
138592
|
-
TokenModifier2[TokenModifier2["defaultLibrary"] = 4] = "defaultLibrary";
|
|
138593
|
-
TokenModifier2[TokenModifier2["local"] = 5] = "local";
|
|
138594
|
-
return TokenModifier2;
|
|
138595
|
-
})(TokenModifier || {});
|
|
138596
|
-
function getSemanticClassifications2(program, cancellationToken, sourceFile, span) {
|
|
138597
|
-
const classifications = getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span);
|
|
138598
|
-
Debug.assert(classifications.spans.length % 3 === 0);
|
|
138599
|
-
const dense = classifications.spans;
|
|
138600
|
-
const result = [];
|
|
138601
|
-
for (let i = 0; i < dense.length; i += 3) {
|
|
138602
|
-
result.push({
|
|
138603
|
-
textSpan: createTextSpan(dense[i], dense[i + 1]),
|
|
138604
|
-
classificationType: dense[i + 2]
|
|
138605
|
-
});
|
|
138606
|
-
}
|
|
138607
|
-
return result;
|
|
138608
|
-
}
|
|
138609
|
-
function getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span) {
|
|
138610
|
-
return {
|
|
138611
|
-
spans: getSemanticTokens(program, sourceFile, span, cancellationToken),
|
|
138612
|
-
endOfLineState: 0 /* None */
|
|
138613
|
-
};
|
|
138614
|
-
}
|
|
138615
|
-
function getSemanticTokens(program, sourceFile, span, cancellationToken) {
|
|
138616
|
-
const resultTokens = [];
|
|
138617
|
-
const collector = (node, typeIdx, modifierSet) => {
|
|
138618
|
-
resultTokens.push(node.getStart(sourceFile), node.getWidth(sourceFile), (typeIdx + 1 << 8 /* typeOffset */) + modifierSet);
|
|
138619
|
-
};
|
|
138620
|
-
if (program && sourceFile) {
|
|
138621
|
-
collectTokens(program, sourceFile, span, collector, cancellationToken);
|
|
138622
|
-
}
|
|
138623
|
-
return resultTokens;
|
|
138624
|
-
}
|
|
138625
|
-
function collectTokens(program, sourceFile, span, collector, cancellationToken) {
|
|
138626
|
-
const typeChecker = program.getTypeChecker();
|
|
138627
|
-
let inJSXElement = false;
|
|
138628
|
-
function visit(node) {
|
|
138629
|
-
switch (node.kind) {
|
|
138630
|
-
case 265 /* ModuleDeclaration */:
|
|
138631
|
-
case 261 /* ClassDeclaration */:
|
|
138632
|
-
case 262 /* InterfaceDeclaration */:
|
|
138633
|
-
case 260 /* FunctionDeclaration */:
|
|
138634
|
-
case 229 /* ClassExpression */:
|
|
138635
|
-
case 216 /* FunctionExpression */:
|
|
138636
|
-
case 217 /* ArrowFunction */:
|
|
138637
|
-
cancellationToken.throwIfCancellationRequested();
|
|
138638
|
-
}
|
|
138639
|
-
if (!node || !textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) {
|
|
138640
|
-
return;
|
|
138641
|
-
}
|
|
138642
|
-
const prevInJSXElement = inJSXElement;
|
|
138643
|
-
if (isJsxElement(node) || isJsxSelfClosingElement(node)) {
|
|
138644
|
-
inJSXElement = true;
|
|
138645
|
-
}
|
|
138646
|
-
if (isJsxExpression(node)) {
|
|
138647
|
-
inJSXElement = false;
|
|
138648
|
-
}
|
|
138649
|
-
if (isIdentifier(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) {
|
|
138650
|
-
let symbol = typeChecker.getSymbolAtLocation(node);
|
|
138651
|
-
if (symbol) {
|
|
138652
|
-
if (symbol.flags & 2097152 /* Alias */) {
|
|
138653
|
-
symbol = typeChecker.getAliasedSymbol(symbol);
|
|
138654
|
-
}
|
|
138655
|
-
let typeIdx = classifySymbol2(symbol, getMeaningFromLocation(node));
|
|
138656
|
-
if (typeIdx !== void 0) {
|
|
138657
|
-
let modifierSet = 0;
|
|
138658
|
-
if (node.parent) {
|
|
138659
|
-
const parentIsDeclaration = isBindingElement(node.parent) || tokenFromDeclarationMapping.get(node.parent.kind) === typeIdx;
|
|
138660
|
-
if (parentIsDeclaration && node.parent.name === node) {
|
|
138661
|
-
modifierSet = 1 << 0 /* declaration */;
|
|
138662
|
-
}
|
|
138663
|
-
}
|
|
138664
|
-
if (typeIdx === 6 /* parameter */ && isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
|
|
138665
|
-
typeIdx = 9 /* property */;
|
|
138666
|
-
}
|
|
138667
|
-
typeIdx = reclassifyByType(typeChecker, node, typeIdx);
|
|
138668
|
-
const decl = symbol.valueDeclaration;
|
|
138669
|
-
if (decl) {
|
|
138670
|
-
const modifiers = getCombinedModifierFlags(decl);
|
|
138671
|
-
const nodeFlags = getCombinedNodeFlags(decl);
|
|
138672
|
-
if (modifiers & 32 /* Static */) {
|
|
138673
|
-
modifierSet |= 1 << 1 /* static */;
|
|
138674
|
-
}
|
|
138675
|
-
if (modifiers & 512 /* Async */) {
|
|
138676
|
-
modifierSet |= 1 << 2 /* async */;
|
|
138677
|
-
}
|
|
138678
|
-
if (typeIdx !== 0 /* class */ && typeIdx !== 2 /* interface */) {
|
|
138679
|
-
if (modifiers & 64 /* Readonly */ || nodeFlags & 2 /* Const */ || symbol.getFlags() & 8 /* EnumMember */) {
|
|
138680
|
-
modifierSet |= 1 << 3 /* readonly */;
|
|
138681
|
-
}
|
|
138682
|
-
}
|
|
138683
|
-
if ((typeIdx === 7 /* variable */ || typeIdx === 10 /* function */) && isLocalDeclaration(decl, sourceFile)) {
|
|
138684
|
-
modifierSet |= 1 << 5 /* local */;
|
|
138685
|
-
}
|
|
138686
|
-
if (program.isSourceFileDefaultLibrary(decl.getSourceFile())) {
|
|
138687
|
-
modifierSet |= 1 << 4 /* defaultLibrary */;
|
|
138688
|
-
}
|
|
138689
|
-
} else if (symbol.declarations && symbol.declarations.some((d) => program.isSourceFileDefaultLibrary(d.getSourceFile()))) {
|
|
138690
|
-
modifierSet |= 1 << 4 /* defaultLibrary */;
|
|
138691
|
-
}
|
|
138692
|
-
collector(node, typeIdx, modifierSet);
|
|
138693
|
-
}
|
|
138694
|
-
}
|
|
138695
|
-
}
|
|
138696
|
-
forEachChild(node, visit);
|
|
138697
|
-
inJSXElement = prevInJSXElement;
|
|
138698
|
-
}
|
|
138699
|
-
visit(sourceFile);
|
|
138700
|
-
}
|
|
138701
|
-
function classifySymbol2(symbol, meaning) {
|
|
138702
|
-
const flags = symbol.getFlags();
|
|
138703
|
-
if (flags & 32 /* Class */) {
|
|
138704
|
-
return 0 /* class */;
|
|
138705
|
-
} else if (flags & 384 /* Enum */) {
|
|
138706
|
-
return 1 /* enum */;
|
|
138707
|
-
} else if (flags & 524288 /* TypeAlias */) {
|
|
138708
|
-
return 5 /* type */;
|
|
138709
|
-
} else if (flags & 64 /* Interface */) {
|
|
138710
|
-
if (meaning & 2 /* Type */) {
|
|
138711
|
-
return 2 /* interface */;
|
|
138712
|
-
}
|
|
138713
|
-
} else if (flags & 262144 /* TypeParameter */) {
|
|
138714
|
-
return 4 /* typeParameter */;
|
|
138715
|
-
}
|
|
138716
|
-
let decl = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0];
|
|
138717
|
-
if (decl && isBindingElement(decl)) {
|
|
138718
|
-
decl = getDeclarationForBindingElement(decl);
|
|
138719
|
-
}
|
|
138720
|
-
return decl && tokenFromDeclarationMapping.get(decl.kind);
|
|
138721
|
-
}
|
|
138722
|
-
function reclassifyByType(typeChecker, node, typeIdx) {
|
|
138723
|
-
if (typeIdx === 7 /* variable */ || typeIdx === 9 /* property */ || typeIdx === 6 /* parameter */) {
|
|
138724
|
-
const type = typeChecker.getTypeAtLocation(node);
|
|
138725
|
-
if (type) {
|
|
138726
|
-
const test = (condition) => {
|
|
138727
|
-
return condition(type) || type.isUnion() && type.types.some(condition);
|
|
138728
|
-
};
|
|
138729
|
-
if (typeIdx !== 6 /* parameter */ && test((t) => t.getConstructSignatures().length > 0)) {
|
|
138730
|
-
return 0 /* class */;
|
|
138731
|
-
}
|
|
138732
|
-
if (test((t) => t.getCallSignatures().length > 0) && !test((t) => t.getProperties().length > 0) || isExpressionInCallExpression(node)) {
|
|
138733
|
-
return typeIdx === 9 /* property */ ? 11 /* member */ : 10 /* function */;
|
|
138734
|
-
}
|
|
138735
|
-
}
|
|
138736
|
-
}
|
|
138737
|
-
return typeIdx;
|
|
138738
|
-
}
|
|
138739
|
-
function isLocalDeclaration(decl, sourceFile) {
|
|
138740
|
-
if (isBindingElement(decl)) {
|
|
138741
|
-
decl = getDeclarationForBindingElement(decl);
|
|
138742
|
-
}
|
|
138743
|
-
if (isVariableDeclaration(decl)) {
|
|
138744
|
-
return (!isSourceFile(decl.parent.parent.parent) || isCatchClause(decl.parent)) && decl.getSourceFile() === sourceFile;
|
|
138745
|
-
} else if (isFunctionDeclaration(decl)) {
|
|
138746
|
-
return !isSourceFile(decl.parent) && decl.getSourceFile() === sourceFile;
|
|
138747
|
-
}
|
|
138748
|
-
return false;
|
|
138749
|
-
}
|
|
138750
|
-
function getDeclarationForBindingElement(element) {
|
|
138751
|
-
while (true) {
|
|
138752
|
-
if (isBindingElement(element.parent.parent)) {
|
|
138753
|
-
element = element.parent.parent;
|
|
138754
|
-
} else {
|
|
138755
|
-
return element.parent.parent;
|
|
138756
|
-
}
|
|
138757
|
-
}
|
|
138758
|
-
}
|
|
138759
|
-
function inImportClause(node) {
|
|
138760
|
-
const parent2 = node.parent;
|
|
138761
|
-
return parent2 && (isImportClause(parent2) || isImportSpecifier(parent2) || isNamespaceImport(parent2));
|
|
138762
|
-
}
|
|
138763
|
-
function isExpressionInCallExpression(node) {
|
|
138764
|
-
while (isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
|
|
138765
|
-
node = node.parent;
|
|
138766
|
-
}
|
|
138767
|
-
return isCallExpression(node.parent) && node.parent.expression === node;
|
|
138768
|
-
}
|
|
138769
|
-
function isRightSideOfQualifiedNameOrPropertyAccess2(node) {
|
|
138770
|
-
return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node;
|
|
138771
|
-
}
|
|
138772
|
-
var tokenFromDeclarationMapping = /* @__PURE__ */ new Map([
|
|
138773
|
-
[258 /* VariableDeclaration */, 7 /* variable */],
|
|
138774
|
-
[167 /* Parameter */, 6 /* parameter */],
|
|
138775
|
-
[170 /* PropertyDeclaration */, 9 /* property */],
|
|
138776
|
-
[265 /* ModuleDeclaration */, 3 /* namespace */],
|
|
138777
|
-
[264 /* EnumDeclaration */, 1 /* enum */],
|
|
138778
|
-
[303 /* EnumMember */, 8 /* enumMember */],
|
|
138779
|
-
[261 /* ClassDeclaration */, 0 /* class */],
|
|
138780
|
-
[172 /* MethodDeclaration */, 11 /* member */],
|
|
138781
|
-
[260 /* FunctionDeclaration */, 10 /* function */],
|
|
138782
|
-
[216 /* FunctionExpression */, 10 /* function */],
|
|
138783
|
-
[171 /* MethodSignature */, 11 /* member */],
|
|
138784
|
-
[175 /* GetAccessor */, 9 /* property */],
|
|
138785
|
-
[176 /* SetAccessor */, 9 /* property */],
|
|
138786
|
-
[169 /* PropertySignature */, 9 /* property */],
|
|
138787
|
-
[262 /* InterfaceDeclaration */, 2 /* interface */],
|
|
138788
|
-
[263 /* TypeAliasDeclaration */, 5 /* type */],
|
|
138789
|
-
[166 /* TypeParameter */, 4 /* typeParameter */],
|
|
138790
|
-
[300 /* PropertyAssignment */, 9 /* property */],
|
|
138791
|
-
[301 /* ShorthandPropertyAssignment */, 9 /* property */]
|
|
138792
|
-
]);
|
|
138793
|
-
|
|
138794
138697
|
// src/services/_namespaces/ts.codefix.ts
|
|
138795
138698
|
var ts_codefix_exports = {};
|
|
138796
138699
|
__export(ts_codefix_exports, {
|
|
@@ -168092,8 +167995,8 @@ var SmartIndenter;
|
|
|
168092
167995
|
})(SmartIndenter || (SmartIndenter = {}));
|
|
168093
167996
|
|
|
168094
167997
|
// src/server/_namespaces/ts.ts
|
|
168095
|
-
var
|
|
168096
|
-
__export(
|
|
167998
|
+
var ts_exports2 = {};
|
|
167999
|
+
__export(ts_exports2, {
|
|
168097
168000
|
ANONYMOUS: () => ANONYMOUS,
|
|
168098
168001
|
AccessFlags: () => AccessFlags,
|
|
168099
168002
|
AssertionLevel: () => AssertionLevel,
|
|
@@ -168396,8 +168299,8 @@ __export(ts_exports3, {
|
|
|
168396
168299
|
convertCompilerOptionsFromJson: () => convertCompilerOptionsFromJson,
|
|
168397
168300
|
convertJsonOption: () => convertJsonOption,
|
|
168398
168301
|
convertToBase64: () => convertToBase64,
|
|
168302
|
+
convertToJson: () => convertToJson,
|
|
168399
168303
|
convertToObject: () => convertToObject,
|
|
168400
|
-
convertToObjectWorker: () => convertToObjectWorker,
|
|
168401
168304
|
convertToOptionsWithAbsolutePaths: () => convertToOptionsWithAbsolutePaths,
|
|
168402
168305
|
convertToRelativePath: () => convertToRelativePath,
|
|
168403
168306
|
convertToTSConfig: () => convertToTSConfig,
|
|
@@ -169543,6 +169446,7 @@ __export(ts_exports3, {
|
|
|
169543
169446
|
isJsxText: () => isJsxText,
|
|
169544
169447
|
isJumpStatementTarget: () => isJumpStatementTarget,
|
|
169545
169448
|
isKeyword: () => isKeyword,
|
|
169449
|
+
isKeywordOrPunctuation: () => isKeywordOrPunctuation,
|
|
169546
169450
|
isKnownSymbol: () => isKnownSymbol,
|
|
169547
169451
|
isLabelName: () => isLabelName,
|
|
169548
169452
|
isLabelOfLabeledStatement: () => isLabelOfLabeledStatement,
|
|
@@ -173005,7 +172909,7 @@ var Project3 = class {
|
|
|
173005
172909
|
serverHost: this.projectService.host,
|
|
173006
172910
|
session: this.projectService.session
|
|
173007
172911
|
};
|
|
173008
|
-
const pluginModule = pluginModuleFactory({ typescript:
|
|
172912
|
+
const pluginModule = pluginModuleFactory({ typescript: ts_exports2 });
|
|
173009
172913
|
const newLS = pluginModule.create(info);
|
|
173010
172914
|
for (const k of Object.keys(this.languageService)) {
|
|
173011
172915
|
if (!(k in newLS)) {
|
|
@@ -182361,8 +182265,8 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
182361
182265
|
convertCompilerOptionsFromJson,
|
|
182362
182266
|
convertJsonOption,
|
|
182363
182267
|
convertToBase64,
|
|
182268
|
+
convertToJson,
|
|
182364
182269
|
convertToObject,
|
|
182365
|
-
convertToObjectWorker,
|
|
182366
182270
|
convertToOptionsWithAbsolutePaths,
|
|
182367
182271
|
convertToRelativePath,
|
|
182368
182272
|
convertToTSConfig,
|
|
@@ -183508,6 +183412,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
183508
183412
|
isJsxText,
|
|
183509
183413
|
isJumpStatementTarget,
|
|
183510
183414
|
isKeyword,
|
|
183415
|
+
isKeywordOrPunctuation,
|
|
183511
183416
|
isKnownSymbol,
|
|
183512
183417
|
isLabelName,
|
|
183513
183418
|
isLabelOfLabeledStatement,
|