typescript 5.1.0-dev.20230319 → 5.1.0-dev.20230321
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.decorators.legacy.d.ts +1 -1
- package/lib/tsc.js +459 -560
- package/lib/tsserver.js +699 -771
- package/lib/tsserverlibrary.d.ts +6 -6
- package/lib/tsserverlibrary.js +710 -790
- package/lib/typescript.d.ts +6 -6
- package/lib/typescript.js +705 -786
- package/lib/typingsInstaller.js +75 -256
- package/package.json +2 -2
package/lib/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";
|
|
@@ -6632,7 +6633,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
6632
6633
|
TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
|
|
6633
6634
|
TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
|
|
6634
6635
|
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
|
|
6635
|
-
TypeFlags2[TypeFlags2["ObjectFlagsType"] =
|
|
6636
|
+
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
|
|
6636
6637
|
TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
|
|
6637
6638
|
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
|
|
6638
6639
|
TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
|
|
@@ -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
|
}
|
|
@@ -19713,7 +19721,7 @@ function getClassLikeDeclarationOfSymbol(symbol) {
|
|
|
19713
19721
|
return (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isClassLike);
|
|
19714
19722
|
}
|
|
19715
19723
|
function getObjectFlags(type) {
|
|
19716
|
-
return type.flags &
|
|
19724
|
+
return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0;
|
|
19717
19725
|
}
|
|
19718
19726
|
function forSomeAncestorDirectory(directory, callback) {
|
|
19719
19727
|
return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
|
|
@@ -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
|
}
|
|
@@ -61085,31 +60994,21 @@ function createTypeChecker(host) {
|
|
|
61085
60994
|
}
|
|
61086
60995
|
return type;
|
|
61087
60996
|
function addSpans(texts2, types2) {
|
|
61088
|
-
const isTextsArray = isArray(texts2);
|
|
61089
60997
|
for (let i = 0; i < types2.length; i++) {
|
|
61090
60998
|
const t = types2[i];
|
|
61091
|
-
const addText = isTextsArray ? texts2[i + 1] : texts2;
|
|
61092
60999
|
if (t.flags & (2944 /* Literal */ | 65536 /* Null */ | 32768 /* Undefined */)) {
|
|
61093
61000
|
text += getTemplateStringForType(t) || "";
|
|
61094
|
-
text +=
|
|
61095
|
-
if (!isTextsArray)
|
|
61096
|
-
return true;
|
|
61001
|
+
text += texts2[i + 1];
|
|
61097
61002
|
} else if (t.flags & 134217728 /* TemplateLiteral */) {
|
|
61098
61003
|
text += t.texts[0];
|
|
61099
61004
|
if (!addSpans(t.texts, t.types))
|
|
61100
61005
|
return false;
|
|
61101
|
-
text +=
|
|
61102
|
-
if (!isTextsArray)
|
|
61103
|
-
return true;
|
|
61006
|
+
text += texts2[i + 1];
|
|
61104
61007
|
} else if (isGenericIndexType(t) || isPatternLiteralPlaceholderType(t)) {
|
|
61105
61008
|
newTypes.push(t);
|
|
61106
61009
|
newTexts.push(text);
|
|
61107
|
-
text =
|
|
61108
|
-
} else
|
|
61109
|
-
const added = addSpans(texts2[i + 1], t.types);
|
|
61110
|
-
if (!added)
|
|
61111
|
-
return false;
|
|
61112
|
-
} else if (isTextsArray) {
|
|
61010
|
+
text = texts2[i + 1];
|
|
61011
|
+
} else {
|
|
61113
61012
|
return false;
|
|
61114
61013
|
}
|
|
61115
61014
|
}
|
|
@@ -61121,6 +61020,11 @@ function createTypeChecker(host) {
|
|
|
61121
61020
|
}
|
|
61122
61021
|
function createTemplateLiteralType(texts, types) {
|
|
61123
61022
|
const type = createType(134217728 /* TemplateLiteral */);
|
|
61023
|
+
type.objectFlags = getPropagatingFlagsOfTypes(
|
|
61024
|
+
types,
|
|
61025
|
+
/*excludeKinds*/
|
|
61026
|
+
98304 /* Nullable */
|
|
61027
|
+
);
|
|
61124
61028
|
type.texts = texts;
|
|
61125
61029
|
type.types = types;
|
|
61126
61030
|
return type;
|
|
@@ -61420,6 +61324,9 @@ function createTypeChecker(host) {
|
|
|
61420
61324
|
return accessNode.kind === 210 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.kind === 197 /* IndexedAccessType */ ? accessNode.indexType : accessNode.kind === 165 /* ComputedPropertyName */ ? accessNode.expression : accessNode;
|
|
61421
61325
|
}
|
|
61422
61326
|
function isPatternLiteralPlaceholderType(type) {
|
|
61327
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
61328
|
+
return some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 65536 /* Null */ | 32768 /* Undefined */)) || isPatternLiteralPlaceholderType(t));
|
|
61329
|
+
}
|
|
61423
61330
|
return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
|
|
61424
61331
|
}
|
|
61425
61332
|
function isPatternLiteralType(type) {
|
|
@@ -61435,7 +61342,7 @@ function createTypeChecker(host) {
|
|
|
61435
61342
|
return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
|
|
61436
61343
|
}
|
|
61437
61344
|
function getGenericObjectFlags(type) {
|
|
61438
|
-
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
61345
|
+
if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
|
|
61439
61346
|
if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
|
|
61440
61347
|
type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
|
|
61441
61348
|
}
|
|
@@ -61447,7 +61354,7 @@ function createTypeChecker(host) {
|
|
|
61447
61354
|
}
|
|
61448
61355
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
61449
61356
|
}
|
|
61450
|
-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ |
|
|
61357
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
61451
61358
|
}
|
|
61452
61359
|
function getSimplifiedType(type, writing) {
|
|
61453
61360
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -62461,6 +62368,9 @@ function createTypeChecker(host) {
|
|
|
62461
62368
|
if (!result) {
|
|
62462
62369
|
const newMapper = createTypeMapper(typeParameters, typeArguments);
|
|
62463
62370
|
result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
|
|
62371
|
+
if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
62372
|
+
result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
62373
|
+
}
|
|
62464
62374
|
target.instantiations.set(id, result);
|
|
62465
62375
|
}
|
|
62466
62376
|
return result;
|
|
@@ -62589,7 +62499,7 @@ function createTypeChecker(host) {
|
|
|
62589
62499
|
) : strictNullChecks && modifiers & 8 /* ExcludeOptional */ && isOptional ? getTypeWithFacts(propType, 524288 /* NEUndefined */) : propType;
|
|
62590
62500
|
}
|
|
62591
62501
|
function instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
62592
|
-
const result = createObjectType(type.objectFlags | 64 /* Instantiated */, type.symbol);
|
|
62502
|
+
const result = createObjectType(type.objectFlags & ~(524288 /* CouldContainTypeVariablesComputed */ | 1048576 /* CouldContainTypeVariables */) | 64 /* Instantiated */, type.symbol);
|
|
62593
62503
|
if (type.objectFlags & 32 /* Mapped */) {
|
|
62594
62504
|
result.declaration = type.declaration;
|
|
62595
62505
|
const origTypeParameter = getTypeParameterFromMappedType(type);
|
|
@@ -62794,7 +62704,13 @@ function createTypeChecker(host) {
|
|
|
62794
62704
|
return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
|
|
62795
62705
|
}
|
|
62796
62706
|
function hasContextSensitiveReturnExpression(node) {
|
|
62797
|
-
|
|
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));
|
|
62798
62714
|
}
|
|
62799
62715
|
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
|
|
62800
62716
|
return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
|
|
@@ -63463,7 +63379,12 @@ function createTypeChecker(host) {
|
|
|
63463
63379
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
63464
63380
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
63465
63381
|
for (let i = 0; i < paramCount; i++) {
|
|
63466
|
-
const sourceType = i === restIndex ? getRestTypeAtPosition(
|
|
63382
|
+
const sourceType = i === restIndex ? getRestTypeAtPosition(
|
|
63383
|
+
source,
|
|
63384
|
+
i,
|
|
63385
|
+
/*readonly*/
|
|
63386
|
+
true
|
|
63387
|
+
) : tryGetTypeAtPosition(source, i);
|
|
63467
63388
|
const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
63468
63389
|
if (sourceType && targetType) {
|
|
63469
63390
|
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
@@ -63729,7 +63650,7 @@ function createTypeChecker(host) {
|
|
|
63729
63650
|
}
|
|
63730
63651
|
function getNormalizedType(type, writing) {
|
|
63731
63652
|
while (true) {
|
|
63732
|
-
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;
|
|
63733
63654
|
if (t === type)
|
|
63734
63655
|
return t;
|
|
63735
63656
|
type = t;
|
|
@@ -63748,6 +63669,11 @@ function createTypeChecker(host) {
|
|
|
63748
63669
|
}
|
|
63749
63670
|
return type;
|
|
63750
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
|
+
}
|
|
63751
63677
|
function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
|
|
63752
63678
|
var _a2;
|
|
63753
63679
|
let errorInfo;
|
|
@@ -63837,10 +63763,10 @@ function createTypeChecker(host) {
|
|
|
63837
63763
|
relatedInfo: relatedInfo == null ? void 0 : relatedInfo.slice()
|
|
63838
63764
|
};
|
|
63839
63765
|
}
|
|
63840
|
-
function reportIncompatibleError(message,
|
|
63766
|
+
function reportIncompatibleError(message, ...args) {
|
|
63841
63767
|
overrideNextErrorInfo++;
|
|
63842
63768
|
lastSkippedInfo = void 0;
|
|
63843
|
-
(incompatibleStack || (incompatibleStack = [])).push([message,
|
|
63769
|
+
(incompatibleStack || (incompatibleStack = [])).push([message, ...args]);
|
|
63844
63770
|
}
|
|
63845
63771
|
function reportIncompatibleStack() {
|
|
63846
63772
|
const stack = incompatibleStack || [];
|
|
@@ -63932,13 +63858,13 @@ function createTypeChecker(host) {
|
|
|
63932
63858
|
);
|
|
63933
63859
|
}
|
|
63934
63860
|
}
|
|
63935
|
-
function reportError(message,
|
|
63861
|
+
function reportError(message, ...args) {
|
|
63936
63862
|
Debug.assert(!!errorNode);
|
|
63937
63863
|
if (incompatibleStack)
|
|
63938
63864
|
reportIncompatibleStack();
|
|
63939
63865
|
if (message.elidedInCompatabilityPyramid)
|
|
63940
63866
|
return;
|
|
63941
|
-
errorInfo = chainDiagnosticMessages(errorInfo, message,
|
|
63867
|
+
errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
|
|
63942
63868
|
}
|
|
63943
63869
|
function associateRelatedInfo(info) {
|
|
63944
63870
|
Debug.assert(!!errorInfo);
|
|
@@ -65225,7 +65151,7 @@ function createTypeChecker(host) {
|
|
|
65225
65151
|
if (varianceResult !== void 0) {
|
|
65226
65152
|
return varianceResult;
|
|
65227
65153
|
}
|
|
65228
|
-
} else if (isReadonlyArrayType(target2) ?
|
|
65154
|
+
} else if (isReadonlyArrayType(target2) ? everyType(source2, isArrayOrTupleType) : isArrayType(target2) && everyType(source2, (t) => isTupleType(t) && !t.target.readonly)) {
|
|
65229
65155
|
if (relation !== identityRelation) {
|
|
65230
65156
|
return isRelatedTo(getIndexTypeOfType(source2, numberType) || anyType, getIndexTypeOfType(target2, numberType) || anyType, 3 /* Both */, reportErrors2);
|
|
65231
65157
|
} else {
|
|
@@ -66108,22 +66034,7 @@ function createTypeChecker(host) {
|
|
|
66108
66034
|
if (match === -1) {
|
|
66109
66035
|
return defaultValue;
|
|
66110
66036
|
}
|
|
66111
|
-
|
|
66112
|
-
/*searchElement*/
|
|
66113
|
-
true,
|
|
66114
|
-
match + 1
|
|
66115
|
-
);
|
|
66116
|
-
while (nextMatch !== -1) {
|
|
66117
|
-
if (!isTypeIdenticalTo(target.types[match], target.types[nextMatch])) {
|
|
66118
|
-
return defaultValue;
|
|
66119
|
-
}
|
|
66120
|
-
nextMatch = discriminable.indexOf(
|
|
66121
|
-
/*searchElement*/
|
|
66122
|
-
true,
|
|
66123
|
-
nextMatch + 1
|
|
66124
|
-
);
|
|
66125
|
-
}
|
|
66126
|
-
return target.types[match];
|
|
66037
|
+
return getUnionType(target.types.filter((_, index) => discriminable[index]));
|
|
66127
66038
|
}
|
|
66128
66039
|
function isWeakType(type) {
|
|
66129
66040
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -66324,7 +66235,7 @@ function createTypeChecker(host) {
|
|
|
66324
66235
|
return type.symbol;
|
|
66325
66236
|
}
|
|
66326
66237
|
if (isTupleType(type)) {
|
|
66327
|
-
return type
|
|
66238
|
+
return type;
|
|
66328
66239
|
}
|
|
66329
66240
|
}
|
|
66330
66241
|
if (type.flags & 262144 /* TypeParameter */) {
|
|
@@ -67097,8 +67008,8 @@ function createTypeChecker(host) {
|
|
|
67097
67008
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
67098
67009
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
67099
67010
|
}
|
|
67100
|
-
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node ||
|
|
67101
|
-
if (type.flags &
|
|
67011
|
+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
67012
|
+
if (type.flags & 138117121 /* ObjectFlagsType */) {
|
|
67102
67013
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
67103
67014
|
}
|
|
67104
67015
|
return result;
|
|
@@ -67723,7 +67634,11 @@ function createTypeChecker(host) {
|
|
|
67723
67634
|
return true;
|
|
67724
67635
|
}
|
|
67725
67636
|
if (constraintType.flags & 262144 /* TypeParameter */) {
|
|
67726
|
-
inferWithPriority(getIndexType(
|
|
67637
|
+
inferWithPriority(getIndexType(
|
|
67638
|
+
source,
|
|
67639
|
+
/*indexFlags*/
|
|
67640
|
+
!!source.pattern ? 2 /* NoIndexSignatures */ : 0 /* None */
|
|
67641
|
+
), constraintType, 32 /* MappedTypeConstraint */);
|
|
67727
67642
|
const extendedConstraint = getConstraintOfType(constraintType);
|
|
67728
67643
|
if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) {
|
|
67729
67644
|
return true;
|
|
@@ -68196,36 +68111,34 @@ function createTypeChecker(host) {
|
|
|
68196
68111
|
return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName : type.flags & 384 /* StringOrNumberLiteral */ ? escapeLeadingUnderscores("" + type.value) : void 0;
|
|
68197
68112
|
}
|
|
68198
68113
|
function tryGetElementAccessExpressionName(node) {
|
|
68199
|
-
|
|
68200
|
-
|
|
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
|
+
}
|
|
68201
68134
|
}
|
|
68202
|
-
if (
|
|
68203
|
-
const
|
|
68204
|
-
|
|
68205
|
-
|
|
68206
|
-
/*ignoreErrors*/
|
|
68207
|
-
true
|
|
68208
|
-
);
|
|
68209
|
-
if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */))
|
|
68210
|
-
return void 0;
|
|
68211
|
-
const declaration = symbol.valueDeclaration;
|
|
68212
|
-
if (declaration === void 0)
|
|
68213
|
-
return void 0;
|
|
68214
|
-
const type = tryGetTypeFromEffectiveTypeNode(declaration);
|
|
68215
|
-
if (type) {
|
|
68216
|
-
const name = tryGetNameFromType(type);
|
|
68217
|
-
if (name !== void 0) {
|
|
68218
|
-
return name;
|
|
68219
|
-
}
|
|
68135
|
+
if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node)) {
|
|
68136
|
+
const initializer = getEffectiveInitializer(declaration);
|
|
68137
|
+
if (initializer) {
|
|
68138
|
+
return tryGetNameFromType(getTypeOfExpression(initializer));
|
|
68220
68139
|
}
|
|
68221
|
-
if (
|
|
68222
|
-
|
|
68223
|
-
if (initializer) {
|
|
68224
|
-
return tryGetNameFromType(getTypeOfExpression(initializer));
|
|
68225
|
-
}
|
|
68226
|
-
if (isEnumMember(declaration)) {
|
|
68227
|
-
return getTextOfPropertyName(declaration.name);
|
|
68228
|
-
}
|
|
68140
|
+
if (isEnumMember(declaration)) {
|
|
68141
|
+
return getTextOfPropertyName(declaration.name);
|
|
68229
68142
|
}
|
|
68230
68143
|
}
|
|
68231
68144
|
return void 0;
|
|
@@ -70143,7 +70056,7 @@ function createTypeChecker(host) {
|
|
|
70143
70056
|
});
|
|
70144
70057
|
}
|
|
70145
70058
|
function markAliasReferenced(symbol, location) {
|
|
70146
|
-
if (
|
|
70059
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
70147
70060
|
return;
|
|
70148
70061
|
}
|
|
70149
70062
|
if (isNonLocalAlias(
|
|
@@ -71281,30 +71194,52 @@ function createTypeChecker(host) {
|
|
|
71281
71194
|
}
|
|
71282
71195
|
return void 0;
|
|
71283
71196
|
}
|
|
71284
|
-
function
|
|
71285
|
-
|
|
71286
|
-
|
|
71287
|
-
|
|
71288
|
-
|
|
71289
|
-
|
|
71290
|
-
|
|
71291
|
-
|
|
71292
|
-
|
|
71293
|
-
|
|
71294
|
-
|
|
71295
|
-
|
|
71296
|
-
|
|
71297
|
-
|
|
71298
|
-
t
|
|
71299
|
-
|
|
71300
|
-
|
|
71301
|
-
|
|
71302
|
-
|
|
71303
|
-
|
|
71304
|
-
|
|
71197
|
+
function getSpreadIndices(elements) {
|
|
71198
|
+
let first2, last2;
|
|
71199
|
+
for (let i = 0; i < elements.length; i++) {
|
|
71200
|
+
if (isSpreadElement(elements[i])) {
|
|
71201
|
+
first2 != null ? first2 : first2 = i;
|
|
71202
|
+
last2 = i;
|
|
71203
|
+
}
|
|
71204
|
+
}
|
|
71205
|
+
return { first: first2, last: last2 };
|
|
71206
|
+
}
|
|
71207
|
+
function getContextualTypeForElementExpression(type, index, length2, firstSpreadIndex, lastSpreadIndex) {
|
|
71208
|
+
return type && mapType(
|
|
71209
|
+
type,
|
|
71210
|
+
(t) => {
|
|
71211
|
+
if (isTupleType(t)) {
|
|
71212
|
+
if ((firstSpreadIndex === void 0 || index < firstSpreadIndex) && index < t.target.fixedLength) {
|
|
71213
|
+
return getTypeArguments(t)[index];
|
|
71214
|
+
}
|
|
71215
|
+
const offset = length2 !== void 0 && (lastSpreadIndex === void 0 || index > lastSpreadIndex) ? length2 - index : 0;
|
|
71216
|
+
const fixedEndLength = offset > 0 && t.target.hasRestElement ? getEndElementCount(t.target, 3 /* Fixed */) : 0;
|
|
71217
|
+
if (offset > 0 && offset <= fixedEndLength) {
|
|
71218
|
+
return getTypeArguments(t)[getTypeReferenceArity(t) - offset];
|
|
71219
|
+
}
|
|
71220
|
+
return getElementTypeOfSliceOfTupleType(
|
|
71221
|
+
t,
|
|
71222
|
+
firstSpreadIndex === void 0 ? t.target.fixedLength : Math.min(t.target.fixedLength, firstSpreadIndex),
|
|
71223
|
+
length2 === void 0 || lastSpreadIndex === void 0 ? fixedEndLength : Math.min(fixedEndLength, length2 - lastSpreadIndex),
|
|
71224
|
+
/*writing*/
|
|
71225
|
+
false,
|
|
71226
|
+
/*noReductions*/
|
|
71227
|
+
true
|
|
71228
|
+
);
|
|
71229
|
+
}
|
|
71230
|
+
return (!firstSpreadIndex || index < firstSpreadIndex) && getTypeOfPropertyOfContextualType(t, "" + index) || getIteratedTypeOrElementType(
|
|
71231
|
+
1 /* Element */,
|
|
71232
|
+
t,
|
|
71233
|
+
undefinedType,
|
|
71234
|
+
/*errorNode*/
|
|
71235
|
+
void 0,
|
|
71236
|
+
/*checkAssignability*/
|
|
71237
|
+
false
|
|
71238
|
+
);
|
|
71239
|
+
},
|
|
71305
71240
|
/*noReductions*/
|
|
71306
71241
|
true
|
|
71307
|
-
)
|
|
71242
|
+
);
|
|
71308
71243
|
}
|
|
71309
71244
|
function getContextualTypeForConditionalOperand(node, contextFlags) {
|
|
71310
71245
|
const conditional = node.parent;
|
|
@@ -71413,7 +71348,11 @@ function createTypeChecker(host) {
|
|
|
71413
71348
|
if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
|
|
71414
71349
|
const apparentType = mapType(
|
|
71415
71350
|
instantiatedType,
|
|
71416
|
-
|
|
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),
|
|
71417
71356
|
/*noReductions*/
|
|
71418
71357
|
true
|
|
71419
71358
|
);
|
|
@@ -71491,9 +71430,9 @@ function createTypeChecker(host) {
|
|
|
71491
71430
|
case 207 /* ArrayLiteralExpression */: {
|
|
71492
71431
|
const arrayLiteral = parent2;
|
|
71493
71432
|
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
|
|
71494
|
-
const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
|
|
71495
71433
|
const elementIndex = indexOfNode(arrayLiteral.elements, node);
|
|
71496
|
-
|
|
71434
|
+
const spreadIndices = (_b = (_a2 = getNodeLinks(arrayLiteral)).spreadIndices) != null ? _b : _a2.spreadIndices = getSpreadIndices(arrayLiteral.elements);
|
|
71435
|
+
return getContextualTypeForElementExpression(type, elementIndex, arrayLiteral.elements.length, spreadIndices.first, spreadIndices.last);
|
|
71497
71436
|
}
|
|
71498
71437
|
case 225 /* ConditionalExpression */:
|
|
71499
71438
|
return getContextualTypeForConditionalOperand(node, contextFlags);
|
|
@@ -72678,7 +72617,7 @@ function createTypeChecker(host) {
|
|
|
72678
72617
|
}
|
|
72679
72618
|
if (jsxFactorySym) {
|
|
72680
72619
|
jsxFactorySym.isReferenced = 67108863 /* All */;
|
|
72681
|
-
if (
|
|
72620
|
+
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
72682
72621
|
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
72683
72622
|
}
|
|
72684
72623
|
}
|
|
@@ -73905,7 +73844,7 @@ function createTypeChecker(host) {
|
|
|
73905
73844
|
flags.push(4 /* Rest */);
|
|
73906
73845
|
}
|
|
73907
73846
|
} else {
|
|
73908
|
-
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
73847
|
+
const contextualType = isTupleType(restType) ? getContextualTypeForElementExpression(restType, i - index, argCount - index) || unknownType : getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
73909
73848
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
73910
73849
|
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 402784252 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
73911
73850
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
@@ -74252,16 +74191,16 @@ function createTypeChecker(host) {
|
|
|
74252
74191
|
}
|
|
74253
74192
|
return { start: start2, length: length2, sourceFile };
|
|
74254
74193
|
}
|
|
74255
|
-
function getDiagnosticForCallNode(node, message,
|
|
74194
|
+
function getDiagnosticForCallNode(node, message, ...args) {
|
|
74256
74195
|
if (isCallExpression(node)) {
|
|
74257
74196
|
const { sourceFile, start: start2, length: length2 } = getDiagnosticSpanForCallNode(node);
|
|
74258
74197
|
if ("message" in message) {
|
|
74259
|
-
return createFileDiagnostic(sourceFile, start2, length2, message,
|
|
74198
|
+
return createFileDiagnostic(sourceFile, start2, length2, message, ...args);
|
|
74260
74199
|
}
|
|
74261
74200
|
return createDiagnosticForFileFromMessageChain(sourceFile, message);
|
|
74262
74201
|
} else {
|
|
74263
74202
|
if ("message" in message) {
|
|
74264
|
-
return createDiagnosticForNode(node, message,
|
|
74203
|
+
return createDiagnosticForNode(node, message, ...args);
|
|
74265
74204
|
}
|
|
74266
74205
|
return createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, message);
|
|
74267
74206
|
}
|
|
@@ -74349,11 +74288,8 @@ function createTypeChecker(host) {
|
|
|
74349
74288
|
}
|
|
74350
74289
|
const parameter = (_a2 = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a2.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
|
|
74351
74290
|
if (parameter) {
|
|
74352
|
-
const
|
|
74353
|
-
|
|
74354
|
-
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,
|
|
74355
|
-
!parameter.name ? args.length : !isBindingPattern(parameter.name) ? idText(getFirstIdentifier(parameter.name)) : void 0
|
|
74356
|
-
);
|
|
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);
|
|
74357
74293
|
return addRelatedInfo(diagnostic, parameterError);
|
|
74358
74294
|
}
|
|
74359
74295
|
return diagnostic;
|
|
@@ -75958,12 +75894,12 @@ function createTypeChecker(host) {
|
|
|
75958
75894
|
}
|
|
75959
75895
|
return void 0;
|
|
75960
75896
|
}
|
|
75961
|
-
function getRestTypeAtPosition(source, pos) {
|
|
75897
|
+
function getRestTypeAtPosition(source, pos, readonly = false) {
|
|
75962
75898
|
const parameterCount = getParameterCount(source);
|
|
75963
75899
|
const minArgumentCount = getMinArgumentCount(source);
|
|
75964
75900
|
const restType = getEffectiveRestType(source);
|
|
75965
75901
|
if (restType && pos >= parameterCount - 1) {
|
|
75966
|
-
return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
|
|
75902
|
+
return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType), readonly);
|
|
75967
75903
|
}
|
|
75968
75904
|
const types = [];
|
|
75969
75905
|
const flags = [];
|
|
@@ -75981,13 +75917,7 @@ function createTypeChecker(host) {
|
|
|
75981
75917
|
names.push(name);
|
|
75982
75918
|
}
|
|
75983
75919
|
}
|
|
75984
|
-
return createTupleType(
|
|
75985
|
-
types,
|
|
75986
|
-
flags,
|
|
75987
|
-
/*readonly*/
|
|
75988
|
-
false,
|
|
75989
|
-
length(names) === length(types) ? names : void 0
|
|
75990
|
-
);
|
|
75920
|
+
return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
|
|
75991
75921
|
}
|
|
75992
75922
|
function getParameterCount(signature) {
|
|
75993
75923
|
const length2 = signature.parameters.length;
|
|
@@ -79693,9 +79623,9 @@ function createTypeChecker(host) {
|
|
|
79693
79623
|
}
|
|
79694
79624
|
}
|
|
79695
79625
|
}
|
|
79696
|
-
function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage,
|
|
79626
|
+
function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, ...args) {
|
|
79697
79627
|
const promisedType = getPromisedTypeOfPromise(type, errorNode);
|
|
79698
|
-
return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage,
|
|
79628
|
+
return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, ...args);
|
|
79699
79629
|
}
|
|
79700
79630
|
function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) {
|
|
79701
79631
|
if (isTypeAny(type)) {
|
|
@@ -79758,8 +79688,8 @@ function createTypeChecker(host) {
|
|
|
79758
79688
|
}
|
|
79759
79689
|
return typeAsPromise.promisedTypeOfPromise = getUnionType(map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), 2 /* Subtype */);
|
|
79760
79690
|
}
|
|
79761
|
-
function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage,
|
|
79762
|
-
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);
|
|
79763
79693
|
return awaitedType || errorType;
|
|
79764
79694
|
}
|
|
79765
79695
|
function isThenableType(type) {
|
|
@@ -79815,11 +79745,11 @@ function createTypeChecker(host) {
|
|
|
79815
79745
|
Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
79816
79746
|
return type;
|
|
79817
79747
|
}
|
|
79818
|
-
function getAwaitedType(type, errorNode, diagnosticMessage,
|
|
79819
|
-
const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage,
|
|
79748
|
+
function getAwaitedType(type, errorNode, diagnosticMessage, ...args) {
|
|
79749
|
+
const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args);
|
|
79820
79750
|
return awaitedType && createAwaitedTypeIfNeeded(awaitedType);
|
|
79821
79751
|
}
|
|
79822
|
-
function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage,
|
|
79752
|
+
function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args) {
|
|
79823
79753
|
if (isTypeAny(type)) {
|
|
79824
79754
|
return type;
|
|
79825
79755
|
}
|
|
@@ -79837,7 +79767,7 @@ function createTypeChecker(host) {
|
|
|
79837
79767
|
}
|
|
79838
79768
|
return void 0;
|
|
79839
79769
|
}
|
|
79840
|
-
const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage,
|
|
79770
|
+
const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias;
|
|
79841
79771
|
awaitedTypeStack.push(type.id);
|
|
79842
79772
|
const mapped = mapType(type, mapper);
|
|
79843
79773
|
awaitedTypeStack.pop();
|
|
@@ -79861,7 +79791,7 @@ function createTypeChecker(host) {
|
|
|
79861
79791
|
return void 0;
|
|
79862
79792
|
}
|
|
79863
79793
|
awaitedTypeStack.push(type.id);
|
|
79864
|
-
const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage,
|
|
79794
|
+
const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, ...args);
|
|
79865
79795
|
awaitedTypeStack.pop();
|
|
79866
79796
|
if (!awaitedType) {
|
|
79867
79797
|
return void 0;
|
|
@@ -79875,7 +79805,7 @@ function createTypeChecker(host) {
|
|
|
79875
79805
|
if (thisTypeForErrorOut.value) {
|
|
79876
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));
|
|
79877
79807
|
}
|
|
79878
|
-
chain = chainDiagnosticMessages(chain, diagnosticMessage,
|
|
79808
|
+
chain = chainDiagnosticMessages(chain, diagnosticMessage, ...args);
|
|
79879
79809
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(errorNode), errorNode, chain));
|
|
79880
79810
|
}
|
|
79881
79811
|
return void 0;
|
|
@@ -80053,7 +79983,7 @@ function createTypeChecker(host) {
|
|
|
80053
79983
|
true
|
|
80054
79984
|
);
|
|
80055
79985
|
if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
|
|
80056
|
-
if (
|
|
79986
|
+
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
80057
79987
|
markAliasSymbolAsReferenced(rootSymbol);
|
|
80058
79988
|
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
80059
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);
|
|
@@ -80462,9 +80392,8 @@ function createTypeChecker(host) {
|
|
|
80462
80392
|
const sourceFile = getSourceFileOfNode(parent2);
|
|
80463
80393
|
const range = isJSDocTemplateTag(parent2) ? rangeOfNode(parent2) : rangeOfTypeParameters(sourceFile, parent2.typeParameters);
|
|
80464
80394
|
const only = parent2.typeParameters.length === 1;
|
|
80465
|
-
const
|
|
80466
|
-
|
|
80467
|
-
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));
|
|
80468
80397
|
}
|
|
80469
80398
|
} else {
|
|
80470
80399
|
addDiagnostic(typeParameter, 1 /* Parameter */, createDiagnosticForNode(typeParameter, Diagnostics._0_is_declared_but_its_value_is_never_read, name));
|
|
@@ -82022,7 +81951,7 @@ function createTypeChecker(host) {
|
|
|
82022
81951
|
forEachKey(catchClause.locals, (caughtName) => {
|
|
82023
81952
|
const blockLocal = blockLocals.get(caughtName);
|
|
82024
81953
|
if ((blockLocal == null ? void 0 : blockLocal.valueDeclaration) && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) {
|
|
82025
|
-
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));
|
|
82026
81955
|
}
|
|
82027
81956
|
});
|
|
82028
81957
|
}
|
|
@@ -83618,6 +83547,9 @@ function createTypeChecker(host) {
|
|
|
83618
83547
|
) && !getSymbolLinks(getSymbolOfDeclaration(statement)).constEnumReferenced;
|
|
83619
83548
|
}
|
|
83620
83549
|
function checkImportsForTypeOnlyConversion(sourceFile) {
|
|
83550
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
83551
|
+
return;
|
|
83552
|
+
}
|
|
83621
83553
|
for (const statement of sourceFile.statements) {
|
|
83622
83554
|
if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) {
|
|
83623
83555
|
error(
|
|
@@ -83703,14 +83635,14 @@ function createTypeChecker(host) {
|
|
|
83703
83635
|
markAliasReferenced(sym, id);
|
|
83704
83636
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
83705
83637
|
checkExpressionCached(id);
|
|
83706
|
-
if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
83638
|
+
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
83707
83639
|
error(
|
|
83708
83640
|
id,
|
|
83709
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,
|
|
83710
83642
|
idText(id)
|
|
83711
83643
|
);
|
|
83712
83644
|
}
|
|
83713
|
-
} else if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax) {
|
|
83645
|
+
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
83714
83646
|
error(
|
|
83715
83647
|
id,
|
|
83716
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,
|
|
@@ -85047,7 +84979,7 @@ function createTypeChecker(host) {
|
|
|
85047
84979
|
return false;
|
|
85048
84980
|
}
|
|
85049
84981
|
function isValueAliasDeclaration(node) {
|
|
85050
|
-
Debug.assert(
|
|
84982
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
85051
84983
|
switch (node.kind) {
|
|
85052
84984
|
case 269 /* ImportEqualsDeclaration */:
|
|
85053
84985
|
return isAliasResolvedToValue(getSymbolOfDeclaration(node));
|
|
@@ -85088,7 +85020,7 @@ function createTypeChecker(host) {
|
|
|
85088
85020
|
return isConstEnumSymbol(s) || !!s.constEnumOnlyModule;
|
|
85089
85021
|
}
|
|
85090
85022
|
function isReferencedAliasDeclaration(node, checkChildren) {
|
|
85091
|
-
Debug.assert(
|
|
85023
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
85092
85024
|
if (isAliasSymbolDeclaration2(node)) {
|
|
85093
85025
|
const symbol = getSymbolOfDeclaration(node);
|
|
85094
85026
|
const links = symbol && getSymbolLinks(symbol);
|
|
@@ -85426,12 +85358,12 @@ function createTypeChecker(host) {
|
|
|
85426
85358
|
isDeclarationWithCollidingName,
|
|
85427
85359
|
isValueAliasDeclaration: (nodeIn) => {
|
|
85428
85360
|
const node = getParseTreeNode(nodeIn);
|
|
85429
|
-
return node ? isValueAliasDeclaration(node) : true;
|
|
85361
|
+
return node && canCollectSymbolAliasAccessabilityData ? isValueAliasDeclaration(node) : true;
|
|
85430
85362
|
},
|
|
85431
85363
|
hasGlobalName,
|
|
85432
85364
|
isReferencedAliasDeclaration: (nodeIn, checkChildren) => {
|
|
85433
85365
|
const node = getParseTreeNode(nodeIn);
|
|
85434
|
-
return node ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
85366
|
+
return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true;
|
|
85435
85367
|
},
|
|
85436
85368
|
getNodeCheckFlags: (nodeIn) => {
|
|
85437
85369
|
const node = getParseTreeNode(nodeIn);
|
|
@@ -86566,7 +86498,7 @@ function createTypeChecker(host) {
|
|
|
86566
86498
|
throw Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind);
|
|
86567
86499
|
}
|
|
86568
86500
|
if (!inDestructuring) {
|
|
86569
|
-
const effectiveName =
|
|
86501
|
+
const effectiveName = getEffectivePropertyNameForPropertyNameNode(name);
|
|
86570
86502
|
if (effectiveName === void 0) {
|
|
86571
86503
|
continue;
|
|
86572
86504
|
}
|
|
@@ -87035,12 +86967,12 @@ function createTypeChecker(host) {
|
|
|
87035
86967
|
switch (node.keywordToken) {
|
|
87036
86968
|
case 104 /* NewKeyword */:
|
|
87037
86969
|
if (escapedText !== "target") {
|
|
87038
|
-
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");
|
|
87039
86971
|
}
|
|
87040
86972
|
break;
|
|
87041
86973
|
case 101 /* ImportKeyword */:
|
|
87042
86974
|
if (escapedText !== "meta") {
|
|
87043
|
-
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");
|
|
87044
86976
|
}
|
|
87045
86977
|
break;
|
|
87046
86978
|
}
|
|
@@ -87048,35 +86980,35 @@ function createTypeChecker(host) {
|
|
|
87048
86980
|
function hasParseDiagnostics(sourceFile) {
|
|
87049
86981
|
return sourceFile.parseDiagnostics.length > 0;
|
|
87050
86982
|
}
|
|
87051
|
-
function grammarErrorOnFirstToken(node, message,
|
|
86983
|
+
function grammarErrorOnFirstToken(node, message, ...args) {
|
|
87052
86984
|
const sourceFile = getSourceFileOfNode(node);
|
|
87053
86985
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
87054
86986
|
const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
87055
|
-
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message,
|
|
86987
|
+
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, ...args));
|
|
87056
86988
|
return true;
|
|
87057
86989
|
}
|
|
87058
86990
|
return false;
|
|
87059
86991
|
}
|
|
87060
|
-
function grammarErrorAtPos(nodeForSourceFile, start2, length2, message,
|
|
86992
|
+
function grammarErrorAtPos(nodeForSourceFile, start2, length2, message, ...args) {
|
|
87061
86993
|
const sourceFile = getSourceFileOfNode(nodeForSourceFile);
|
|
87062
86994
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
87063
|
-
diagnostics.add(createFileDiagnostic(sourceFile, start2, length2, message,
|
|
86995
|
+
diagnostics.add(createFileDiagnostic(sourceFile, start2, length2, message, ...args));
|
|
87064
86996
|
return true;
|
|
87065
86997
|
}
|
|
87066
86998
|
return false;
|
|
87067
86999
|
}
|
|
87068
|
-
function grammarErrorOnNodeSkippedOn(key, node, message,
|
|
87000
|
+
function grammarErrorOnNodeSkippedOn(key, node, message, ...args) {
|
|
87069
87001
|
const sourceFile = getSourceFileOfNode(node);
|
|
87070
87002
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
87071
|
-
errorSkippedOn(key, node, message,
|
|
87003
|
+
errorSkippedOn(key, node, message, ...args);
|
|
87072
87004
|
return true;
|
|
87073
87005
|
}
|
|
87074
87006
|
return false;
|
|
87075
87007
|
}
|
|
87076
|
-
function grammarErrorOnNode(node, message,
|
|
87008
|
+
function grammarErrorOnNode(node, message, ...args) {
|
|
87077
87009
|
const sourceFile = getSourceFileOfNode(node);
|
|
87078
87010
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
87079
|
-
diagnostics.add(createDiagnosticForNode(node, message,
|
|
87011
|
+
diagnostics.add(createDiagnosticForNode(node, message, ...args));
|
|
87080
87012
|
return true;
|
|
87081
87013
|
}
|
|
87082
87014
|
return false;
|
|
@@ -87221,7 +87153,7 @@ function createTypeChecker(host) {
|
|
|
87221
87153
|
}
|
|
87222
87154
|
return false;
|
|
87223
87155
|
}
|
|
87224
|
-
function grammarErrorAfterFirstToken(node, message,
|
|
87156
|
+
function grammarErrorAfterFirstToken(node, message, ...args) {
|
|
87225
87157
|
const sourceFile = getSourceFileOfNode(node);
|
|
87226
87158
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
87227
87159
|
const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
@@ -87231,9 +87163,7 @@ function createTypeChecker(host) {
|
|
|
87231
87163
|
/*length*/
|
|
87232
87164
|
0,
|
|
87233
87165
|
message,
|
|
87234
|
-
|
|
87235
|
-
arg1,
|
|
87236
|
-
arg2
|
|
87166
|
+
...args
|
|
87237
87167
|
));
|
|
87238
87168
|
return true;
|
|
87239
87169
|
}
|
|
@@ -87379,6 +87309,10 @@ function createTypeChecker(host) {
|
|
|
87379
87309
|
}
|
|
87380
87310
|
return void 0;
|
|
87381
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
|
+
}
|
|
87382
87316
|
}
|
|
87383
87317
|
function isNotAccessor(declaration) {
|
|
87384
87318
|
return !isAccessor(declaration);
|
|
@@ -111731,8 +111665,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
111731
111665
|
}
|
|
111732
111666
|
}
|
|
111733
111667
|
function createBuildInfo(program, bundle) {
|
|
111734
|
-
|
|
111735
|
-
return { bundle, program, version: version2 };
|
|
111668
|
+
return { bundle, program, version };
|
|
111736
111669
|
}
|
|
111737
111670
|
function getBuildInfoText(buildInfo) {
|
|
111738
111671
|
return JSON.stringify(buildInfo);
|
|
@@ -111820,10 +111753,10 @@ function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
|
|
|
111820
111753
|
/*separateBeginAndEnd*/
|
|
111821
111754
|
true
|
|
111822
111755
|
);
|
|
111823
|
-
|
|
111756
|
+
mark("beforeEmit");
|
|
111824
111757
|
const result = emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers);
|
|
111825
|
-
|
|
111826
|
-
|
|
111758
|
+
mark("afterEmit");
|
|
111759
|
+
measure("Emit", "beforeEmit", "afterEmit");
|
|
111827
111760
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
111828
111761
|
return result;
|
|
111829
111762
|
}
|
|
@@ -115837,12 +115770,12 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115837
115770
|
return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags != null ? flags : 0 /* None */, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix)));
|
|
115838
115771
|
}
|
|
115839
115772
|
function isUniqueName(name, privateName) {
|
|
115840
|
-
return
|
|
115773
|
+
return isFileLevelUniqueNameInCurrentFile(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
|
|
115841
115774
|
}
|
|
115842
115775
|
function isReservedName(name, privateName) {
|
|
115843
115776
|
return privateName ? !!(reservedPrivateNames == null ? void 0 : reservedPrivateNames.has(name)) : !!(reservedNames == null ? void 0 : reservedNames.has(name));
|
|
115844
115777
|
}
|
|
115845
|
-
function
|
|
115778
|
+
function isFileLevelUniqueNameInCurrentFile(name, _isPrivate) {
|
|
115846
115779
|
return currentSourceFile ? isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true;
|
|
115847
115780
|
}
|
|
115848
115781
|
function isUniqueLocalName(name, container) {
|
|
@@ -115961,7 +115894,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115961
115894
|
function makeFileLevelOptimisticUniqueName(name) {
|
|
115962
115895
|
return makeUniqueName2(
|
|
115963
115896
|
name,
|
|
115964
|
-
|
|
115897
|
+
isFileLevelUniqueNameInCurrentFile,
|
|
115965
115898
|
/*optimistic*/
|
|
115966
115899
|
true,
|
|
115967
115900
|
/*scoped*/
|
|
@@ -116141,7 +116074,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
116141
116074
|
case 3 /* Unique */:
|
|
116142
116075
|
return makeUniqueName2(
|
|
116143
116076
|
idText(name),
|
|
116144
|
-
autoGenerate.flags & 32 /* FileLevel */ ?
|
|
116077
|
+
autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueNameInCurrentFile : isUniqueName,
|
|
116145
116078
|
!!(autoGenerate.flags & 16 /* Optimistic */),
|
|
116146
116079
|
!!(autoGenerate.flags & 8 /* ReservedInNestedScopes */),
|
|
116147
116080
|
isPrivateIdentifier(name),
|
|
@@ -119216,12 +119149,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119216
119149
|
}
|
|
119217
119150
|
}
|
|
119218
119151
|
}
|
|
119219
|
-
function createDiagnosticForNodeArray2(nodes, message,
|
|
119152
|
+
function createDiagnosticForNodeArray2(nodes, message, ...args) {
|
|
119220
119153
|
const start2 = nodes.pos;
|
|
119221
|
-
return createFileDiagnostic(sourceFile, start2, nodes.end - start2, message,
|
|
119154
|
+
return createFileDiagnostic(sourceFile, start2, nodes.end - start2, message, ...args);
|
|
119222
119155
|
}
|
|
119223
|
-
function createDiagnosticForNode2(node, message,
|
|
119224
|
-
return createDiagnosticForNodeInSourceFile(sourceFile, node, message,
|
|
119156
|
+
function createDiagnosticForNode2(node, message, ...args) {
|
|
119157
|
+
return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args);
|
|
119225
119158
|
}
|
|
119226
119159
|
});
|
|
119227
119160
|
}
|
|
@@ -119886,11 +119819,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119886
119819
|
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
|
119887
119820
|
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
|
119888
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];
|
|
119889
119823
|
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
119890
119824
|
kind: 0 /* FilePreprocessingReferencedDiagnostic */,
|
|
119891
119825
|
reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index },
|
|
119892
119826
|
diagnostic,
|
|
119893
|
-
args
|
|
119827
|
+
args
|
|
119894
119828
|
});
|
|
119895
119829
|
}
|
|
119896
119830
|
});
|
|
@@ -120355,7 +120289,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120355
120289
|
}
|
|
120356
120290
|
}
|
|
120357
120291
|
function verifyDeprecatedCompilerOptions() {
|
|
120358
|
-
function createDiagnostic(name, value, useInstead, message,
|
|
120292
|
+
function createDiagnostic(name, value, useInstead, message, ...args) {
|
|
120359
120293
|
if (useInstead) {
|
|
120360
120294
|
const details = chainDiagnosticMessages(
|
|
120361
120295
|
/*details*/
|
|
@@ -120363,7 +120297,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120363
120297
|
Diagnostics.Use_0_instead,
|
|
120364
120298
|
useInstead
|
|
120365
120299
|
);
|
|
120366
|
-
const chain = chainDiagnosticMessages(details, message,
|
|
120300
|
+
const chain = chainDiagnosticMessages(details, message, ...args);
|
|
120367
120301
|
createDiagnosticForOption(
|
|
120368
120302
|
/*onKey*/
|
|
120369
120303
|
!value,
|
|
@@ -120380,10 +120314,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120380
120314
|
/*option2*/
|
|
120381
120315
|
void 0,
|
|
120382
120316
|
message,
|
|
120383
|
-
|
|
120384
|
-
arg1,
|
|
120385
|
-
arg2,
|
|
120386
|
-
arg3
|
|
120317
|
+
...args
|
|
120387
120318
|
);
|
|
120388
120319
|
}
|
|
120389
120320
|
}
|
|
@@ -120436,8 +120367,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120436
120367
|
});
|
|
120437
120368
|
}
|
|
120438
120369
|
function verifyDeprecatedProjectReference(ref, parentFile, index) {
|
|
120439
|
-
function createDiagnostic(_name, _value, _useInstead, message,
|
|
120440
|
-
createDiagnosticForReference(parentFile, index, message,
|
|
120370
|
+
function createDiagnostic(_name, _value, _useInstead, message, ...args) {
|
|
120371
|
+
createDiagnosticForReference(parentFile, index, message, ...args);
|
|
120441
120372
|
}
|
|
120442
120373
|
checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
|
|
120443
120374
|
if (ref.prepend) {
|
|
@@ -120619,7 +120550,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120619
120550
|
}
|
|
120620
120551
|
});
|
|
120621
120552
|
}
|
|
120622
|
-
function createDiagnosticForOptionPathKeyValue(key, valueIndex, message,
|
|
120553
|
+
function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
|
|
120623
120554
|
let needCompilerDiagnostic = true;
|
|
120624
120555
|
const pathsSyntax = getOptionPathsSyntax();
|
|
120625
120556
|
for (const pathProp of pathsSyntax) {
|
|
@@ -120627,17 +120558,17 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120627
120558
|
for (const keyProps of getPropertyAssignment(pathProp.initializer, key)) {
|
|
120628
120559
|
const initializer = keyProps.initializer;
|
|
120629
120560
|
if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
|
|
120630
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message,
|
|
120561
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
|
|
120631
120562
|
needCompilerDiagnostic = false;
|
|
120632
120563
|
}
|
|
120633
120564
|
}
|
|
120634
120565
|
}
|
|
120635
120566
|
}
|
|
120636
120567
|
if (needCompilerDiagnostic) {
|
|
120637
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
120568
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
120638
120569
|
}
|
|
120639
120570
|
}
|
|
120640
|
-
function createDiagnosticForOptionPaths(onKey, key, message,
|
|
120571
|
+
function createDiagnosticForOptionPaths(onKey, key, message, ...args) {
|
|
120641
120572
|
let needCompilerDiagnostic = true;
|
|
120642
120573
|
const pathsSyntax = getOptionPathsSyntax();
|
|
120643
120574
|
for (const pathProp of pathsSyntax) {
|
|
@@ -120648,13 +120579,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120648
120579
|
/*key2*/
|
|
120649
120580
|
void 0,
|
|
120650
120581
|
message,
|
|
120651
|
-
|
|
120582
|
+
...args
|
|
120652
120583
|
)) {
|
|
120653
120584
|
needCompilerDiagnostic = false;
|
|
120654
120585
|
}
|
|
120655
120586
|
}
|
|
120656
120587
|
if (needCompilerDiagnostic) {
|
|
120657
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
120588
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
120658
120589
|
}
|
|
120659
120590
|
}
|
|
120660
120591
|
function getOptionsSyntaxByName(name) {
|
|
@@ -120684,7 +120615,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120684
120615
|
option3
|
|
120685
120616
|
);
|
|
120686
120617
|
}
|
|
120687
|
-
function createOptionValueDiagnostic(option1, message,
|
|
120618
|
+
function createOptionValueDiagnostic(option1, message, ...args) {
|
|
120688
120619
|
createDiagnosticForOption(
|
|
120689
120620
|
/*onKey*/
|
|
120690
120621
|
false,
|
|
@@ -120692,29 +120623,28 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120692
120623
|
/*option2*/
|
|
120693
120624
|
void 0,
|
|
120694
120625
|
message,
|
|
120695
|
-
|
|
120696
|
-
arg1
|
|
120626
|
+
...args
|
|
120697
120627
|
);
|
|
120698
120628
|
}
|
|
120699
|
-
function createDiagnosticForReference(sourceFile, index, message,
|
|
120629
|
+
function createDiagnosticForReference(sourceFile, index, message, ...args) {
|
|
120700
120630
|
const referencesSyntax = firstDefined(
|
|
120701
120631
|
getTsConfigPropArray(sourceFile || options.configFile, "references"),
|
|
120702
120632
|
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
120703
120633
|
);
|
|
120704
120634
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
|
120705
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message,
|
|
120635
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
|
|
120706
120636
|
} else {
|
|
120707
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
120637
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
120708
120638
|
}
|
|
120709
120639
|
}
|
|
120710
|
-
function createDiagnosticForOption(onKey, option1, option2, message,
|
|
120640
|
+
function createDiagnosticForOption(onKey, option1, option2, message, ...args) {
|
|
120711
120641
|
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
|
120712
|
-
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message,
|
|
120642
|
+
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, ...args);
|
|
120713
120643
|
if (needCompilerDiagnostic) {
|
|
120714
120644
|
if ("messageText" in message) {
|
|
120715
120645
|
programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
|
|
120716
120646
|
} else {
|
|
120717
|
-
programDiagnostics.add(createCompilerDiagnostic(message,
|
|
120647
|
+
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
|
|
120718
120648
|
}
|
|
120719
120649
|
}
|
|
120720
120650
|
}
|
|
@@ -120733,13 +120663,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120733
120663
|
}
|
|
120734
120664
|
return _compilerOptionsObjectLiteralSyntax || void 0;
|
|
120735
120665
|
}
|
|
120736
|
-
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message,
|
|
120666
|
+
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) {
|
|
120737
120667
|
const props = getPropertyAssignment(objectLiteral, key1, key2);
|
|
120738
120668
|
for (const prop of props) {
|
|
120739
120669
|
if ("messageText" in message) {
|
|
120740
120670
|
programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
|
|
120741
120671
|
} else {
|
|
120742
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message,
|
|
120672
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
|
|
120743
120673
|
}
|
|
120744
120674
|
}
|
|
120745
120675
|
return !!props.length;
|
|
@@ -121660,16 +121590,16 @@ function convertToDiagnostics(diagnostics, newProgram) {
|
|
|
121660
121590
|
return emptyArray;
|
|
121661
121591
|
let buildInfoDirectory;
|
|
121662
121592
|
return diagnostics.map((diagnostic) => {
|
|
121663
|
-
const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram,
|
|
121593
|
+
const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPathInBuildInfoDirectory);
|
|
121664
121594
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
121665
121595
|
result.reportsDeprecated = diagnostic.reportDeprecated;
|
|
121666
121596
|
result.source = diagnostic.source;
|
|
121667
121597
|
result.skippedOn = diagnostic.skippedOn;
|
|
121668
121598
|
const { relatedInformation } = diagnostic;
|
|
121669
|
-
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;
|
|
121670
121600
|
return result;
|
|
121671
121601
|
});
|
|
121672
|
-
function
|
|
121602
|
+
function toPathInBuildInfoDirectory(path) {
|
|
121673
121603
|
buildInfoDirectory != null ? buildInfoDirectory : buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
|
|
121674
121604
|
return toPath(path, buildInfoDirectory, newProgram.getCanonicalFileName);
|
|
121675
121605
|
}
|
|
@@ -122577,7 +122507,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
122577
122507
|
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
122578
122508
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
122579
122509
|
let state;
|
|
122580
|
-
const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(
|
|
122510
|
+
const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(toPathInBuildInfoDirectory);
|
|
122581
122511
|
let filePathsSetList;
|
|
122582
122512
|
const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0;
|
|
122583
122513
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
@@ -122658,7 +122588,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
122658
122588
|
close: noop,
|
|
122659
122589
|
hasChangedEmitSignature: returnFalse
|
|
122660
122590
|
};
|
|
122661
|
-
function
|
|
122591
|
+
function toPathInBuildInfoDirectory(path) {
|
|
122662
122592
|
return toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
122663
122593
|
}
|
|
122664
122594
|
function toAbsolutePath(path) {
|
|
@@ -123704,15 +123634,13 @@ function getErrorSummaryText(errorCount, filesInError, newLine, host) {
|
|
|
123704
123634
|
const nonNilFiles = filesInError.filter((fileInError) => fileInError !== void 0);
|
|
123705
123635
|
const distinctFileNamesWithLines = nonNilFiles.map((fileInError) => `${fileInError.fileName}:${fileInError.line}`).filter((value, index, self) => self.indexOf(value) === index);
|
|
123706
123636
|
const firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
|
|
123707
|
-
|
|
123708
|
-
|
|
123709
|
-
|
|
123710
|
-
|
|
123711
|
-
|
|
123712
|
-
|
|
123713
|
-
|
|
123714
|
-
distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length
|
|
123715
|
-
);
|
|
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);
|
|
123716
123644
|
const suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "";
|
|
123717
123645
|
return `${newLine}${flattenDiagnosticMessageText(d.messageText, newLine)}${newLine}${newLine}${suffix}`;
|
|
123718
123646
|
}
|
|
@@ -123922,15 +123850,15 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
|
|
|
123922
123850
|
toFileName(referencedResolvedRef.sourceFile.fileName, fileNameConvertor),
|
|
123923
123851
|
options.outFile ? "--outFile" : "--out"
|
|
123924
123852
|
);
|
|
123925
|
-
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];
|
|
123926
123855
|
return chainDiagnosticMessages(
|
|
123927
123856
|
/*details*/
|
|
123928
123857
|
void 0,
|
|
123929
|
-
|
|
123930
|
-
reason.typeReference,
|
|
123931
|
-
reason.packageId && packageIdToString(reason.packageId)
|
|
123858
|
+
...messageAndArgs
|
|
123932
123859
|
);
|
|
123933
|
-
|
|
123860
|
+
}
|
|
123861
|
+
case 6 /* LibFile */: {
|
|
123934
123862
|
if (reason.index !== void 0)
|
|
123935
123863
|
return chainDiagnosticMessages(
|
|
123936
123864
|
/*details*/
|
|
@@ -123939,12 +123867,13 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
|
|
|
123939
123867
|
options.lib[reason.index]
|
|
123940
123868
|
);
|
|
123941
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];
|
|
123942
123871
|
return chainDiagnosticMessages(
|
|
123943
123872
|
/*details*/
|
|
123944
123873
|
void 0,
|
|
123945
|
-
|
|
123946
|
-
target
|
|
123874
|
+
...messageAndArgs
|
|
123947
123875
|
);
|
|
123876
|
+
}
|
|
123948
123877
|
default:
|
|
123949
123878
|
Debug.assertNever(reason);
|
|
123950
123879
|
}
|
|
@@ -128929,9 +128858,6 @@ function isStringAndEmptyAnonymousObjectIntersection(type) {
|
|
|
128929
128858
|
const { types, checker } = type;
|
|
128930
128859
|
return types.length === 2 && (areIntersectedTypesAvoidingStringReduction(checker, types[0], types[1]) || areIntersectedTypesAvoidingStringReduction(checker, types[1], types[0]));
|
|
128931
128860
|
}
|
|
128932
|
-
function isPunctuation(kind) {
|
|
128933
|
-
return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */;
|
|
128934
|
-
}
|
|
128935
128861
|
function isInsideTemplateLiteral(node, position, sourceFile) {
|
|
128936
128862
|
return isTemplateLiteralKind(node.kind) && (node.getStart(sourceFile) < position && position < node.end) || !!node.isUnterminated && position === node.end;
|
|
128937
128863
|
}
|
|
@@ -134530,6 +134456,234 @@ function cleanText(text) {
|
|
|
134530
134456
|
return text.replace(/\\?(\r?\n|\r|\u2028|\u2029)/g, "");
|
|
134531
134457
|
}
|
|
134532
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
|
+
|
|
134533
134687
|
// src/services/services.ts
|
|
134534
134688
|
var servicesVersion = "0.8";
|
|
134535
134689
|
function createNode(kind, pos, end, parent2) {
|
|
@@ -135962,7 +136116,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
135962
136116
|
synchronizeHostData();
|
|
135963
136117
|
const responseFormat = format || "original" /* Original */;
|
|
135964
136118
|
if (responseFormat === "2020" /* TwentyTwenty */) {
|
|
135965
|
-
return
|
|
136119
|
+
return getSemanticClassifications2(program, cancellationToken, getValidSourceFile(fileName), span);
|
|
135966
136120
|
} else {
|
|
135967
136121
|
return getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
|
|
135968
136122
|
}
|
|
@@ -135973,7 +136127,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
135973
136127
|
if (responseFormat === "original" /* Original */) {
|
|
135974
136128
|
return getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
|
|
135975
136129
|
} else {
|
|
135976
|
-
return
|
|
136130
|
+
return getEncodedSemanticClassifications2(program, cancellationToken, getValidSourceFile(fileName), span);
|
|
135977
136131
|
}
|
|
135978
136132
|
}
|
|
135979
136133
|
function getSyntacticClassifications2(fileName, span) {
|
|
@@ -138540,234 +138694,6 @@ __export(ts_classifier_v2020_exports, {
|
|
|
138540
138694
|
getSemanticClassifications: () => getSemanticClassifications2
|
|
138541
138695
|
});
|
|
138542
138696
|
|
|
138543
|
-
// src/services/classifier2020.ts
|
|
138544
|
-
var TokenEncodingConsts = /* @__PURE__ */ ((TokenEncodingConsts2) => {
|
|
138545
|
-
TokenEncodingConsts2[TokenEncodingConsts2["typeOffset"] = 8] = "typeOffset";
|
|
138546
|
-
TokenEncodingConsts2[TokenEncodingConsts2["modifierMask"] = 255] = "modifierMask";
|
|
138547
|
-
return TokenEncodingConsts2;
|
|
138548
|
-
})(TokenEncodingConsts || {});
|
|
138549
|
-
var TokenType = /* @__PURE__ */ ((TokenType2) => {
|
|
138550
|
-
TokenType2[TokenType2["class"] = 0] = "class";
|
|
138551
|
-
TokenType2[TokenType2["enum"] = 1] = "enum";
|
|
138552
|
-
TokenType2[TokenType2["interface"] = 2] = "interface";
|
|
138553
|
-
TokenType2[TokenType2["namespace"] = 3] = "namespace";
|
|
138554
|
-
TokenType2[TokenType2["typeParameter"] = 4] = "typeParameter";
|
|
138555
|
-
TokenType2[TokenType2["type"] = 5] = "type";
|
|
138556
|
-
TokenType2[TokenType2["parameter"] = 6] = "parameter";
|
|
138557
|
-
TokenType2[TokenType2["variable"] = 7] = "variable";
|
|
138558
|
-
TokenType2[TokenType2["enumMember"] = 8] = "enumMember";
|
|
138559
|
-
TokenType2[TokenType2["property"] = 9] = "property";
|
|
138560
|
-
TokenType2[TokenType2["function"] = 10] = "function";
|
|
138561
|
-
TokenType2[TokenType2["member"] = 11] = "member";
|
|
138562
|
-
return TokenType2;
|
|
138563
|
-
})(TokenType || {});
|
|
138564
|
-
var TokenModifier = /* @__PURE__ */ ((TokenModifier2) => {
|
|
138565
|
-
TokenModifier2[TokenModifier2["declaration"] = 0] = "declaration";
|
|
138566
|
-
TokenModifier2[TokenModifier2["static"] = 1] = "static";
|
|
138567
|
-
TokenModifier2[TokenModifier2["async"] = 2] = "async";
|
|
138568
|
-
TokenModifier2[TokenModifier2["readonly"] = 3] = "readonly";
|
|
138569
|
-
TokenModifier2[TokenModifier2["defaultLibrary"] = 4] = "defaultLibrary";
|
|
138570
|
-
TokenModifier2[TokenModifier2["local"] = 5] = "local";
|
|
138571
|
-
return TokenModifier2;
|
|
138572
|
-
})(TokenModifier || {});
|
|
138573
|
-
function getSemanticClassifications2(program, cancellationToken, sourceFile, span) {
|
|
138574
|
-
const classifications = getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span);
|
|
138575
|
-
Debug.assert(classifications.spans.length % 3 === 0);
|
|
138576
|
-
const dense = classifications.spans;
|
|
138577
|
-
const result = [];
|
|
138578
|
-
for (let i = 0; i < dense.length; i += 3) {
|
|
138579
|
-
result.push({
|
|
138580
|
-
textSpan: createTextSpan(dense[i], dense[i + 1]),
|
|
138581
|
-
classificationType: dense[i + 2]
|
|
138582
|
-
});
|
|
138583
|
-
}
|
|
138584
|
-
return result;
|
|
138585
|
-
}
|
|
138586
|
-
function getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span) {
|
|
138587
|
-
return {
|
|
138588
|
-
spans: getSemanticTokens(program, sourceFile, span, cancellationToken),
|
|
138589
|
-
endOfLineState: 0 /* None */
|
|
138590
|
-
};
|
|
138591
|
-
}
|
|
138592
|
-
function getSemanticTokens(program, sourceFile, span, cancellationToken) {
|
|
138593
|
-
const resultTokens = [];
|
|
138594
|
-
const collector = (node, typeIdx, modifierSet) => {
|
|
138595
|
-
resultTokens.push(node.getStart(sourceFile), node.getWidth(sourceFile), (typeIdx + 1 << 8 /* typeOffset */) + modifierSet);
|
|
138596
|
-
};
|
|
138597
|
-
if (program && sourceFile) {
|
|
138598
|
-
collectTokens(program, sourceFile, span, collector, cancellationToken);
|
|
138599
|
-
}
|
|
138600
|
-
return resultTokens;
|
|
138601
|
-
}
|
|
138602
|
-
function collectTokens(program, sourceFile, span, collector, cancellationToken) {
|
|
138603
|
-
const typeChecker = program.getTypeChecker();
|
|
138604
|
-
let inJSXElement = false;
|
|
138605
|
-
function visit(node) {
|
|
138606
|
-
switch (node.kind) {
|
|
138607
|
-
case 265 /* ModuleDeclaration */:
|
|
138608
|
-
case 261 /* ClassDeclaration */:
|
|
138609
|
-
case 262 /* InterfaceDeclaration */:
|
|
138610
|
-
case 260 /* FunctionDeclaration */:
|
|
138611
|
-
case 229 /* ClassExpression */:
|
|
138612
|
-
case 216 /* FunctionExpression */:
|
|
138613
|
-
case 217 /* ArrowFunction */:
|
|
138614
|
-
cancellationToken.throwIfCancellationRequested();
|
|
138615
|
-
}
|
|
138616
|
-
if (!node || !textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) {
|
|
138617
|
-
return;
|
|
138618
|
-
}
|
|
138619
|
-
const prevInJSXElement = inJSXElement;
|
|
138620
|
-
if (isJsxElement(node) || isJsxSelfClosingElement(node)) {
|
|
138621
|
-
inJSXElement = true;
|
|
138622
|
-
}
|
|
138623
|
-
if (isJsxExpression(node)) {
|
|
138624
|
-
inJSXElement = false;
|
|
138625
|
-
}
|
|
138626
|
-
if (isIdentifier(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) {
|
|
138627
|
-
let symbol = typeChecker.getSymbolAtLocation(node);
|
|
138628
|
-
if (symbol) {
|
|
138629
|
-
if (symbol.flags & 2097152 /* Alias */) {
|
|
138630
|
-
symbol = typeChecker.getAliasedSymbol(symbol);
|
|
138631
|
-
}
|
|
138632
|
-
let typeIdx = classifySymbol2(symbol, getMeaningFromLocation(node));
|
|
138633
|
-
if (typeIdx !== void 0) {
|
|
138634
|
-
let modifierSet = 0;
|
|
138635
|
-
if (node.parent) {
|
|
138636
|
-
const parentIsDeclaration = isBindingElement(node.parent) || tokenFromDeclarationMapping.get(node.parent.kind) === typeIdx;
|
|
138637
|
-
if (parentIsDeclaration && node.parent.name === node) {
|
|
138638
|
-
modifierSet = 1 << 0 /* declaration */;
|
|
138639
|
-
}
|
|
138640
|
-
}
|
|
138641
|
-
if (typeIdx === 6 /* parameter */ && isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
|
|
138642
|
-
typeIdx = 9 /* property */;
|
|
138643
|
-
}
|
|
138644
|
-
typeIdx = reclassifyByType(typeChecker, node, typeIdx);
|
|
138645
|
-
const decl = symbol.valueDeclaration;
|
|
138646
|
-
if (decl) {
|
|
138647
|
-
const modifiers = getCombinedModifierFlags(decl);
|
|
138648
|
-
const nodeFlags = getCombinedNodeFlags(decl);
|
|
138649
|
-
if (modifiers & 32 /* Static */) {
|
|
138650
|
-
modifierSet |= 1 << 1 /* static */;
|
|
138651
|
-
}
|
|
138652
|
-
if (modifiers & 512 /* Async */) {
|
|
138653
|
-
modifierSet |= 1 << 2 /* async */;
|
|
138654
|
-
}
|
|
138655
|
-
if (typeIdx !== 0 /* class */ && typeIdx !== 2 /* interface */) {
|
|
138656
|
-
if (modifiers & 64 /* Readonly */ || nodeFlags & 2 /* Const */ || symbol.getFlags() & 8 /* EnumMember */) {
|
|
138657
|
-
modifierSet |= 1 << 3 /* readonly */;
|
|
138658
|
-
}
|
|
138659
|
-
}
|
|
138660
|
-
if ((typeIdx === 7 /* variable */ || typeIdx === 10 /* function */) && isLocalDeclaration(decl, sourceFile)) {
|
|
138661
|
-
modifierSet |= 1 << 5 /* local */;
|
|
138662
|
-
}
|
|
138663
|
-
if (program.isSourceFileDefaultLibrary(decl.getSourceFile())) {
|
|
138664
|
-
modifierSet |= 1 << 4 /* defaultLibrary */;
|
|
138665
|
-
}
|
|
138666
|
-
} else if (symbol.declarations && symbol.declarations.some((d) => program.isSourceFileDefaultLibrary(d.getSourceFile()))) {
|
|
138667
|
-
modifierSet |= 1 << 4 /* defaultLibrary */;
|
|
138668
|
-
}
|
|
138669
|
-
collector(node, typeIdx, modifierSet);
|
|
138670
|
-
}
|
|
138671
|
-
}
|
|
138672
|
-
}
|
|
138673
|
-
forEachChild(node, visit);
|
|
138674
|
-
inJSXElement = prevInJSXElement;
|
|
138675
|
-
}
|
|
138676
|
-
visit(sourceFile);
|
|
138677
|
-
}
|
|
138678
|
-
function classifySymbol2(symbol, meaning) {
|
|
138679
|
-
const flags = symbol.getFlags();
|
|
138680
|
-
if (flags & 32 /* Class */) {
|
|
138681
|
-
return 0 /* class */;
|
|
138682
|
-
} else if (flags & 384 /* Enum */) {
|
|
138683
|
-
return 1 /* enum */;
|
|
138684
|
-
} else if (flags & 524288 /* TypeAlias */) {
|
|
138685
|
-
return 5 /* type */;
|
|
138686
|
-
} else if (flags & 64 /* Interface */) {
|
|
138687
|
-
if (meaning & 2 /* Type */) {
|
|
138688
|
-
return 2 /* interface */;
|
|
138689
|
-
}
|
|
138690
|
-
} else if (flags & 262144 /* TypeParameter */) {
|
|
138691
|
-
return 4 /* typeParameter */;
|
|
138692
|
-
}
|
|
138693
|
-
let decl = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0];
|
|
138694
|
-
if (decl && isBindingElement(decl)) {
|
|
138695
|
-
decl = getDeclarationForBindingElement(decl);
|
|
138696
|
-
}
|
|
138697
|
-
return decl && tokenFromDeclarationMapping.get(decl.kind);
|
|
138698
|
-
}
|
|
138699
|
-
function reclassifyByType(typeChecker, node, typeIdx) {
|
|
138700
|
-
if (typeIdx === 7 /* variable */ || typeIdx === 9 /* property */ || typeIdx === 6 /* parameter */) {
|
|
138701
|
-
const type = typeChecker.getTypeAtLocation(node);
|
|
138702
|
-
if (type) {
|
|
138703
|
-
const test = (condition) => {
|
|
138704
|
-
return condition(type) || type.isUnion() && type.types.some(condition);
|
|
138705
|
-
};
|
|
138706
|
-
if (typeIdx !== 6 /* parameter */ && test((t) => t.getConstructSignatures().length > 0)) {
|
|
138707
|
-
return 0 /* class */;
|
|
138708
|
-
}
|
|
138709
|
-
if (test((t) => t.getCallSignatures().length > 0) && !test((t) => t.getProperties().length > 0) || isExpressionInCallExpression(node)) {
|
|
138710
|
-
return typeIdx === 9 /* property */ ? 11 /* member */ : 10 /* function */;
|
|
138711
|
-
}
|
|
138712
|
-
}
|
|
138713
|
-
}
|
|
138714
|
-
return typeIdx;
|
|
138715
|
-
}
|
|
138716
|
-
function isLocalDeclaration(decl, sourceFile) {
|
|
138717
|
-
if (isBindingElement(decl)) {
|
|
138718
|
-
decl = getDeclarationForBindingElement(decl);
|
|
138719
|
-
}
|
|
138720
|
-
if (isVariableDeclaration(decl)) {
|
|
138721
|
-
return (!isSourceFile(decl.parent.parent.parent) || isCatchClause(decl.parent)) && decl.getSourceFile() === sourceFile;
|
|
138722
|
-
} else if (isFunctionDeclaration(decl)) {
|
|
138723
|
-
return !isSourceFile(decl.parent) && decl.getSourceFile() === sourceFile;
|
|
138724
|
-
}
|
|
138725
|
-
return false;
|
|
138726
|
-
}
|
|
138727
|
-
function getDeclarationForBindingElement(element) {
|
|
138728
|
-
while (true) {
|
|
138729
|
-
if (isBindingElement(element.parent.parent)) {
|
|
138730
|
-
element = element.parent.parent;
|
|
138731
|
-
} else {
|
|
138732
|
-
return element.parent.parent;
|
|
138733
|
-
}
|
|
138734
|
-
}
|
|
138735
|
-
}
|
|
138736
|
-
function inImportClause(node) {
|
|
138737
|
-
const parent2 = node.parent;
|
|
138738
|
-
return parent2 && (isImportClause(parent2) || isImportSpecifier(parent2) || isNamespaceImport(parent2));
|
|
138739
|
-
}
|
|
138740
|
-
function isExpressionInCallExpression(node) {
|
|
138741
|
-
while (isRightSideOfQualifiedNameOrPropertyAccess2(node)) {
|
|
138742
|
-
node = node.parent;
|
|
138743
|
-
}
|
|
138744
|
-
return isCallExpression(node.parent) && node.parent.expression === node;
|
|
138745
|
-
}
|
|
138746
|
-
function isRightSideOfQualifiedNameOrPropertyAccess2(node) {
|
|
138747
|
-
return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node;
|
|
138748
|
-
}
|
|
138749
|
-
var tokenFromDeclarationMapping = /* @__PURE__ */ new Map([
|
|
138750
|
-
[258 /* VariableDeclaration */, 7 /* variable */],
|
|
138751
|
-
[167 /* Parameter */, 6 /* parameter */],
|
|
138752
|
-
[170 /* PropertyDeclaration */, 9 /* property */],
|
|
138753
|
-
[265 /* ModuleDeclaration */, 3 /* namespace */],
|
|
138754
|
-
[264 /* EnumDeclaration */, 1 /* enum */],
|
|
138755
|
-
[303 /* EnumMember */, 8 /* enumMember */],
|
|
138756
|
-
[261 /* ClassDeclaration */, 0 /* class */],
|
|
138757
|
-
[172 /* MethodDeclaration */, 11 /* member */],
|
|
138758
|
-
[260 /* FunctionDeclaration */, 10 /* function */],
|
|
138759
|
-
[216 /* FunctionExpression */, 10 /* function */],
|
|
138760
|
-
[171 /* MethodSignature */, 11 /* member */],
|
|
138761
|
-
[175 /* GetAccessor */, 9 /* property */],
|
|
138762
|
-
[176 /* SetAccessor */, 9 /* property */],
|
|
138763
|
-
[169 /* PropertySignature */, 9 /* property */],
|
|
138764
|
-
[262 /* InterfaceDeclaration */, 2 /* interface */],
|
|
138765
|
-
[263 /* TypeAliasDeclaration */, 5 /* type */],
|
|
138766
|
-
[166 /* TypeParameter */, 4 /* typeParameter */],
|
|
138767
|
-
[300 /* PropertyAssignment */, 9 /* property */],
|
|
138768
|
-
[301 /* ShorthandPropertyAssignment */, 9 /* property */]
|
|
138769
|
-
]);
|
|
138770
|
-
|
|
138771
138697
|
// src/services/_namespaces/ts.codefix.ts
|
|
138772
138698
|
var ts_codefix_exports = {};
|
|
138773
138699
|
__export(ts_codefix_exports, {
|
|
@@ -168069,8 +167995,8 @@ var SmartIndenter;
|
|
|
168069
167995
|
})(SmartIndenter || (SmartIndenter = {}));
|
|
168070
167996
|
|
|
168071
167997
|
// src/server/_namespaces/ts.ts
|
|
168072
|
-
var
|
|
168073
|
-
__export(
|
|
167998
|
+
var ts_exports2 = {};
|
|
167999
|
+
__export(ts_exports2, {
|
|
168074
168000
|
ANONYMOUS: () => ANONYMOUS,
|
|
168075
168001
|
AccessFlags: () => AccessFlags,
|
|
168076
168002
|
AssertionLevel: () => AssertionLevel,
|
|
@@ -168373,8 +168299,8 @@ __export(ts_exports3, {
|
|
|
168373
168299
|
convertCompilerOptionsFromJson: () => convertCompilerOptionsFromJson,
|
|
168374
168300
|
convertJsonOption: () => convertJsonOption,
|
|
168375
168301
|
convertToBase64: () => convertToBase64,
|
|
168302
|
+
convertToJson: () => convertToJson,
|
|
168376
168303
|
convertToObject: () => convertToObject,
|
|
168377
|
-
convertToObjectWorker: () => convertToObjectWorker,
|
|
168378
168304
|
convertToOptionsWithAbsolutePaths: () => convertToOptionsWithAbsolutePaths,
|
|
168379
168305
|
convertToRelativePath: () => convertToRelativePath,
|
|
168380
168306
|
convertToTSConfig: () => convertToTSConfig,
|
|
@@ -169520,6 +169446,7 @@ __export(ts_exports3, {
|
|
|
169520
169446
|
isJsxText: () => isJsxText,
|
|
169521
169447
|
isJumpStatementTarget: () => isJumpStatementTarget,
|
|
169522
169448
|
isKeyword: () => isKeyword,
|
|
169449
|
+
isKeywordOrPunctuation: () => isKeywordOrPunctuation,
|
|
169523
169450
|
isKnownSymbol: () => isKnownSymbol,
|
|
169524
169451
|
isLabelName: () => isLabelName,
|
|
169525
169452
|
isLabelOfLabeledStatement: () => isLabelOfLabeledStatement,
|
|
@@ -172982,7 +172909,7 @@ var Project3 = class {
|
|
|
172982
172909
|
serverHost: this.projectService.host,
|
|
172983
172910
|
session: this.projectService.session
|
|
172984
172911
|
};
|
|
172985
|
-
const pluginModule = pluginModuleFactory({ typescript:
|
|
172912
|
+
const pluginModule = pluginModuleFactory({ typescript: ts_exports2 });
|
|
172986
172913
|
const newLS = pluginModule.create(info);
|
|
172987
172914
|
for (const k of Object.keys(this.languageService)) {
|
|
172988
172915
|
if (!(k in newLS)) {
|
|
@@ -182338,8 +182265,8 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
182338
182265
|
convertCompilerOptionsFromJson,
|
|
182339
182266
|
convertJsonOption,
|
|
182340
182267
|
convertToBase64,
|
|
182268
|
+
convertToJson,
|
|
182341
182269
|
convertToObject,
|
|
182342
|
-
convertToObjectWorker,
|
|
182343
182270
|
convertToOptionsWithAbsolutePaths,
|
|
182344
182271
|
convertToRelativePath,
|
|
182345
182272
|
convertToTSConfig,
|
|
@@ -183485,6 +183412,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
183485
183412
|
isJsxText,
|
|
183486
183413
|
isJumpStatementTarget,
|
|
183487
183414
|
isKeyword,
|
|
183415
|
+
isKeywordOrPunctuation,
|
|
183488
183416
|
isKnownSymbol,
|
|
183489
183417
|
isLabelName,
|
|
183490
183418
|
isLabelOfLabeledStatement,
|