@typescript-deploys/pr-build 5.3.0-pr-55860-30 → 5.3.0-pr-55867-7
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/tsc.js +135 -73
- package/lib/tsserver.js +160 -1024
- package/lib/typescript.d.ts +4 -1
- package/lib/typescript.js +158 -1028
- package/lib/typingsInstaller.js +6 -6
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -61,7 +61,6 @@ __export(server_exports, {
|
|
|
61
61
|
ConfigFileProgramReloadLevel: () => ConfigFileProgramReloadLevel,
|
|
62
62
|
ContainerFlags: () => ContainerFlags,
|
|
63
63
|
ContextFlags: () => ContextFlags,
|
|
64
|
-
CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter,
|
|
65
64
|
Debug: () => Debug,
|
|
66
65
|
DiagnosticCategory: () => DiagnosticCategory,
|
|
67
66
|
Diagnostics: () => Diagnostics,
|
|
@@ -110,7 +109,6 @@ __export(server_exports, {
|
|
|
110
109
|
JsxFlags: () => JsxFlags,
|
|
111
110
|
JsxReferenceKind: () => JsxReferenceKind,
|
|
112
111
|
LanguageServiceMode: () => LanguageServiceMode,
|
|
113
|
-
LanguageServiceShimHostAdapter: () => LanguageServiceShimHostAdapter,
|
|
114
112
|
LanguageVariant: () => LanguageVariant,
|
|
115
113
|
LexicalEnvironmentFlags: () => LexicalEnvironmentFlags,
|
|
116
114
|
ListFormat: () => ListFormat,
|
|
@@ -184,7 +182,6 @@ __export(server_exports, {
|
|
|
184
182
|
TypeMapKind: () => TypeMapKind,
|
|
185
183
|
TypePredicateKind: () => TypePredicateKind,
|
|
186
184
|
TypeReferenceSerializationKind: () => TypeReferenceSerializationKind,
|
|
187
|
-
TypeScriptServicesFactory: () => TypeScriptServicesFactory,
|
|
188
185
|
UnionReduction: () => UnionReduction,
|
|
189
186
|
UpToDateStatusType: () => UpToDateStatusType,
|
|
190
187
|
VarianceFlags: () => VarianceFlags,
|
|
@@ -1447,6 +1444,7 @@ __export(server_exports, {
|
|
|
1447
1444
|
isInsideJsxElementOrAttribute: () => isInsideJsxElementOrAttribute,
|
|
1448
1445
|
isInsideNodeModules: () => isInsideNodeModules,
|
|
1449
1446
|
isInsideTemplateLiteral: () => isInsideTemplateLiteral,
|
|
1447
|
+
isInstanceOfExpression: () => isInstanceOfExpression,
|
|
1450
1448
|
isInstantiatedModule: () => isInstantiatedModule,
|
|
1451
1449
|
isInterfaceDeclaration: () => isInterfaceDeclaration,
|
|
1452
1450
|
isInternalDeclaration: () => isInternalDeclaration,
|
|
@@ -1704,6 +1702,7 @@ __export(server_exports, {
|
|
|
1704
1702
|
isReturnStatement: () => isReturnStatement,
|
|
1705
1703
|
isReturnStatementWithFixablePromiseHandler: () => isReturnStatementWithFixablePromiseHandler,
|
|
1706
1704
|
isRightSideOfAccessExpression: () => isRightSideOfAccessExpression,
|
|
1705
|
+
isRightSideOfInstanceofExpression: () => isRightSideOfInstanceofExpression,
|
|
1707
1706
|
isRightSideOfPropertyAccess: () => isRightSideOfPropertyAccess,
|
|
1708
1707
|
isRightSideOfQualifiedName: () => isRightSideOfQualifiedName,
|
|
1709
1708
|
isRightSideOfQualifiedNameOrPropertyAccess: () => isRightSideOfQualifiedNameOrPropertyAccess,
|
|
@@ -2028,7 +2027,6 @@ __export(server_exports, {
|
|
|
2028
2027
|
readJson: () => readJson,
|
|
2029
2028
|
readJsonConfigFile: () => readJsonConfigFile,
|
|
2030
2029
|
readJsonOrUndefined: () => readJsonOrUndefined,
|
|
2031
|
-
realizeDiagnostics: () => realizeDiagnostics,
|
|
2032
2030
|
reduceEachLeadingCommentRange: () => reduceEachLeadingCommentRange,
|
|
2033
2031
|
reduceEachTrailingCommentRange: () => reduceEachTrailingCommentRange,
|
|
2034
2032
|
reduceLeft: () => reduceLeft,
|
|
@@ -2330,7 +2328,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2330
2328
|
|
|
2331
2329
|
// src/compiler/corePublic.ts
|
|
2332
2330
|
var versionMajorMinor = "5.3";
|
|
2333
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2331
|
+
var version = `${versionMajorMinor}.0-insiders.20230929`;
|
|
2334
2332
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2335
2333
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2336
2334
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7427,12 +7425,12 @@ var commentPragmas = {
|
|
|
7427
7425
|
kind: 4 /* MultiLine */
|
|
7428
7426
|
}
|
|
7429
7427
|
};
|
|
7430
|
-
var JSDocParsingMode = /* @__PURE__ */ ((
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
return
|
|
7428
|
+
var JSDocParsingMode = /* @__PURE__ */ ((JSDocParsingMode6) => {
|
|
7429
|
+
JSDocParsingMode6[JSDocParsingMode6["ParseAll"] = 0] = "ParseAll";
|
|
7430
|
+
JSDocParsingMode6[JSDocParsingMode6["ParseNone"] = 1] = "ParseNone";
|
|
7431
|
+
JSDocParsingMode6[JSDocParsingMode6["ParseForTypeErrors"] = 2] = "ParseForTypeErrors";
|
|
7432
|
+
JSDocParsingMode6[JSDocParsingMode6["ParseForTypeInfo"] = 3] = "ParseForTypeInfo";
|
|
7433
|
+
return JSDocParsingMode6;
|
|
7436
7434
|
})(JSDocParsingMode || {});
|
|
7437
7435
|
|
|
7438
7436
|
// src/compiler/sys.ts
|
|
@@ -9732,7 +9730,7 @@ var Diagnostics = {
|
|
|
9732
9730
|
An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2356, 1 /* Error */, "An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type_2356", "An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
9733
9731
|
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, 1 /* Error */, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."),
|
|
9734
9732
|
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, 1 /* Error */, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),
|
|
9735
|
-
|
|
9733
|
+
The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_a_class_function_or_other_type_assignable_to_the_Function_interface_type_or_an_object_type_with_a_Symbol_hasInstance_method: diag(2359, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_a_class_function_or_other_2359", "The right-hand side of an 'instanceof' expression must be either of type 'any', a class, function, or other type assignable to the 'Function' interface type, or an object type with a 'Symbol.hasInstance' method."),
|
|
9736
9734
|
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, 1 /* Error */, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
9737
9735
|
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, 1 /* Error */, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
9738
9736
|
The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, 1 /* Error */, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."),
|
|
@@ -10181,7 +10179,8 @@ var Diagnostics = {
|
|
|
10181
10179
|
Import_attributes_cannot_be_used_with_type_only_imports_or_exports: diag(2857, 1 /* Error */, "Import_attributes_cannot_be_used_with_type_only_imports_or_exports_2857", "Import attributes cannot be used with type-only imports or exports."),
|
|
10182
10180
|
Import_attribute_values_must_be_string_literal_expressions: diag(2858, 1 /* Error */, "Import_attribute_values_must_be_string_literal_expressions_2858", "Import attribute values must be string literal expressions."),
|
|
10183
10181
|
Excessive_complexity_comparing_types_0_and_1: diag(2859, 1 /* Error */, "Excessive_complexity_comparing_types_0_and_1_2859", "Excessive complexity comparing types '{0}' and '{1}'."),
|
|
10184
|
-
|
|
10182
|
+
The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method: diag(2860, 1 /* Error */, "The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_2860", "The left-hand side of an 'instanceof' expression must be assignable to the first argument of the right-hand side's '[Symbol.hasInstance]' method."),
|
|
10183
|
+
An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_hand_side_of_an_instanceof_expression: diag(2861, 1 /* Error */, "An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_han_2861", "An object's '[Symbol.hasInstance]' method must return a boolean value for it to be used on the right-hand side of an 'instanceof' expression."),
|
|
10185
10184
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
10186
10185
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
10187
10186
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -14488,6 +14487,13 @@ function isAutoAccessorPropertyDeclaration(node) {
|
|
|
14488
14487
|
return isPropertyDeclaration(node) && hasAccessorModifier(node);
|
|
14489
14488
|
}
|
|
14490
14489
|
function isClassFieldAndNotAutoAccessor(node) {
|
|
14490
|
+
if (isInJSFile(node) && isExpandoPropertyDeclaration(node)) {
|
|
14491
|
+
return (!isBindableStaticAccessExpression(node) || !isPrototypeAccess(node.expression)) && !isBindableStaticNameExpression(
|
|
14492
|
+
node,
|
|
14493
|
+
/*excludeThisKeyword*/
|
|
14494
|
+
true
|
|
14495
|
+
);
|
|
14496
|
+
}
|
|
14491
14497
|
return node.parent && isClassLike(node.parent) && isPropertyDeclaration(node) && !hasAccessorModifier(node);
|
|
14492
14498
|
}
|
|
14493
14499
|
function isMethodOrAccessor(node) {
|
|
@@ -16920,6 +16926,8 @@ function getInvokedExpression(node) {
|
|
|
16920
16926
|
case 286 /* JsxOpeningElement */:
|
|
16921
16927
|
case 285 /* JsxSelfClosingElement */:
|
|
16922
16928
|
return node.tagName;
|
|
16929
|
+
case 226 /* BinaryExpression */:
|
|
16930
|
+
return node.right;
|
|
16923
16931
|
default:
|
|
16924
16932
|
return node.expression;
|
|
16925
16933
|
}
|
|
@@ -19576,6 +19584,12 @@ function isRightSideOfAccessExpression(node) {
|
|
|
19576
19584
|
function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) {
|
|
19577
19585
|
return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node || isJSDocMemberName(node.parent) && node.parent.right === node;
|
|
19578
19586
|
}
|
|
19587
|
+
function isInstanceOfExpression(node) {
|
|
19588
|
+
return isBinaryExpression(node) && node.operatorToken.kind === 104 /* InstanceOfKeyword */;
|
|
19589
|
+
}
|
|
19590
|
+
function isRightSideOfInstanceofExpression(node) {
|
|
19591
|
+
return isInstanceOfExpression(node.parent) && node === node.parent.right;
|
|
19592
|
+
}
|
|
19579
19593
|
function isEmptyObjectLiteral(expression) {
|
|
19580
19594
|
return expression.kind === 210 /* ObjectLiteralExpression */ && expression.properties.length === 0;
|
|
19581
19595
|
}
|
|
@@ -47784,9 +47798,8 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
|
|
|
47784
47798
|
CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
47785
47799
|
CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
47786
47800
|
CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
|
|
47787
|
-
CheckMode3[CheckMode3["
|
|
47788
|
-
CheckMode3[CheckMode3["
|
|
47789
|
-
CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
|
|
47801
|
+
CheckMode3[CheckMode3["RestBindingElement"] = 32] = "RestBindingElement";
|
|
47802
|
+
CheckMode3[CheckMode3["TypeOnly"] = 64] = "TypeOnly";
|
|
47790
47803
|
return CheckMode3;
|
|
47791
47804
|
})(CheckMode || {});
|
|
47792
47805
|
var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
@@ -48273,7 +48286,7 @@ function createTypeChecker(host) {
|
|
|
48273
48286
|
candidates,
|
|
48274
48287
|
/*argumentCount*/
|
|
48275
48288
|
void 0,
|
|
48276
|
-
|
|
48289
|
+
0 /* Normal */
|
|
48277
48290
|
));
|
|
48278
48291
|
for (const candidate of candidates) {
|
|
48279
48292
|
candidatesSet.add(candidate);
|
|
@@ -48783,7 +48796,6 @@ function createTypeChecker(host) {
|
|
|
48783
48796
|
var potentialReflectCollisions = [];
|
|
48784
48797
|
var potentialUnusedRenamedBindingElementsInTypes = [];
|
|
48785
48798
|
var awaitedTypeStack = [];
|
|
48786
|
-
var ambiguousVariableDeclarationsWhenWidened = [];
|
|
48787
48799
|
var diagnostics = createDiagnosticCollection();
|
|
48788
48800
|
var suggestionDiagnostics = createDiagnosticCollection();
|
|
48789
48801
|
var typeofType = createTypeofType();
|
|
@@ -56309,7 +56321,7 @@ function createTypeChecker(host) {
|
|
|
56309
56321
|
return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
|
|
56310
56322
|
}
|
|
56311
56323
|
function getTypeForBindingElement(declaration) {
|
|
56312
|
-
const checkMode = declaration.dotDotDotToken ?
|
|
56324
|
+
const checkMode = declaration.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */;
|
|
56313
56325
|
const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
56314
56326
|
return parentType && getBindingElementTypeFromParentType(
|
|
56315
56327
|
declaration,
|
|
@@ -68476,7 +68488,7 @@ function createTypeChecker(host) {
|
|
|
68476
68488
|
if (!couldContainTypeVariables(target)) {
|
|
68477
68489
|
return;
|
|
68478
68490
|
}
|
|
68479
|
-
if (source === wildcardType) {
|
|
68491
|
+
if (source === wildcardType || source === blockedStringType) {
|
|
68480
68492
|
const savePropagationType = propagationType;
|
|
68481
68493
|
propagationType = source;
|
|
68482
68494
|
inferFromTypes(target, target);
|
|
@@ -68533,6 +68545,10 @@ function createTypeChecker(host) {
|
|
|
68533
68545
|
return;
|
|
68534
68546
|
}
|
|
68535
68547
|
if (!inference.isFixed) {
|
|
68548
|
+
const candidate = propagationType || source;
|
|
68549
|
+
if (candidate === blockedStringType) {
|
|
68550
|
+
return;
|
|
68551
|
+
}
|
|
68536
68552
|
if (inference.priority === void 0 || priority < inference.priority) {
|
|
68537
68553
|
inference.candidates = void 0;
|
|
68538
68554
|
inference.contraCandidates = void 0;
|
|
@@ -68540,7 +68556,6 @@ function createTypeChecker(host) {
|
|
|
68540
68556
|
inference.priority = priority;
|
|
68541
68557
|
}
|
|
68542
68558
|
if (priority === inference.priority) {
|
|
68543
|
-
const candidate = propagationType || source;
|
|
68544
68559
|
if (contravariant && !bivariant) {
|
|
68545
68560
|
if (!contains(inference.contraCandidates, candidate)) {
|
|
68546
68561
|
inference.contraCandidates = append(inference.contraCandidates, candidate);
|
|
@@ -69112,7 +69127,7 @@ function createTypeChecker(host) {
|
|
|
69112
69127
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
69113
69128
|
if (constraint) {
|
|
69114
69129
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
69115
|
-
if (!inferredType ||
|
|
69130
|
+
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
69116
69131
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
69117
69132
|
}
|
|
69118
69133
|
}
|
|
@@ -69963,7 +69978,10 @@ function createTypeChecker(host) {
|
|
|
69963
69978
|
let signature = links.effectsSignature;
|
|
69964
69979
|
if (signature === void 0) {
|
|
69965
69980
|
let funcType;
|
|
69966
|
-
if (node
|
|
69981
|
+
if (isBinaryExpression(node)) {
|
|
69982
|
+
const rightType = checkNonNullExpression(node.right);
|
|
69983
|
+
funcType = getSymbolHasInstanceMethodOfObjectType(rightType);
|
|
69984
|
+
} else if (node.parent.kind === 244 /* ExpressionStatement */) {
|
|
69967
69985
|
funcType = getTypeOfDottedName(
|
|
69968
69986
|
node.expression,
|
|
69969
69987
|
/*diagnostic*/
|
|
@@ -70987,7 +71005,22 @@ function createTypeChecker(host) {
|
|
|
70987
71005
|
}
|
|
70988
71006
|
return type;
|
|
70989
71007
|
}
|
|
70990
|
-
const
|
|
71008
|
+
const right = expr.right;
|
|
71009
|
+
const rightType = getTypeOfExpression(right);
|
|
71010
|
+
if (!isTypeDerivedFrom(rightType, globalObjectType)) {
|
|
71011
|
+
return type;
|
|
71012
|
+
}
|
|
71013
|
+
const signature = getEffectsSignature(expr);
|
|
71014
|
+
const predicate = signature && getTypePredicateOfSignature(signature);
|
|
71015
|
+
if (predicate && predicate.kind === 1 /* Identifier */ && predicate.parameterIndex === 0) {
|
|
71016
|
+
return getNarrowedType(
|
|
71017
|
+
type,
|
|
71018
|
+
predicate.type,
|
|
71019
|
+
assumeTrue,
|
|
71020
|
+
/*checkDerived*/
|
|
71021
|
+
true
|
|
71022
|
+
);
|
|
71023
|
+
}
|
|
70991
71024
|
if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
|
|
70992
71025
|
return type;
|
|
70993
71026
|
}
|
|
@@ -71239,7 +71272,7 @@ function createTypeChecker(host) {
|
|
|
71239
71272
|
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
71240
71273
|
}
|
|
71241
71274
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
71242
|
-
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode &
|
|
71275
|
+
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 32 /* RestBindingElement */ ? getContextualType2(node, 8 /* SkipBindingPatterns */) : getContextualType2(
|
|
71243
71276
|
node,
|
|
71244
71277
|
/*contextFlags*/
|
|
71245
71278
|
void 0
|
|
@@ -71999,7 +72032,7 @@ function createTypeChecker(host) {
|
|
|
71999
72032
|
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
72000
72033
|
const parent2 = declaration.parent.parent;
|
|
72001
72034
|
const name = declaration.propertyName || declaration.name;
|
|
72002
|
-
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 208 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ?
|
|
72035
|
+
const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 208 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */);
|
|
72003
72036
|
if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
|
|
72004
72037
|
return void 0;
|
|
72005
72038
|
if (parent2.name.kind === 207 /* ArrayBindingPattern */) {
|
|
@@ -74845,7 +74878,9 @@ function createTypeChecker(host) {
|
|
|
74845
74878
|
checkExpression(node.template);
|
|
74846
74879
|
} else if (isJsxOpeningLikeElement(node)) {
|
|
74847
74880
|
checkExpression(node.attributes);
|
|
74848
|
-
} else if (node
|
|
74881
|
+
} else if (isBinaryExpression(node)) {
|
|
74882
|
+
checkExpression(node.left);
|
|
74883
|
+
} else if (isCallOrNewExpression(node)) {
|
|
74849
74884
|
forEach(node.arguments, (argument) => {
|
|
74850
74885
|
checkExpression(argument);
|
|
74851
74886
|
});
|
|
@@ -74918,6 +74953,8 @@ function createTypeChecker(host) {
|
|
|
74918
74953
|
}
|
|
74919
74954
|
} else if (node.kind === 170 /* Decorator */) {
|
|
74920
74955
|
argCount = getDecoratorArgumentCount(node, signature);
|
|
74956
|
+
} else if (node.kind === 226 /* BinaryExpression */) {
|
|
74957
|
+
argCount = 1;
|
|
74921
74958
|
} else if (isJsxOpeningLikeElement(node)) {
|
|
74922
74959
|
callIsIncomplete = node.attributes.end === node.end;
|
|
74923
74960
|
if (callIsIncomplete) {
|
|
@@ -75017,13 +75054,13 @@ function createTypeChecker(host) {
|
|
|
75017
75054
|
return voidType;
|
|
75018
75055
|
}
|
|
75019
75056
|
const thisArgumentType = checkExpression(thisArgumentNode);
|
|
75020
|
-
return isOptionalChainRoot(thisArgumentNode.parent) ? getNonNullableType(thisArgumentType) : isOptionalChain(thisArgumentNode.parent) ? removeOptionalTypeMarker(thisArgumentType) : thisArgumentType;
|
|
75057
|
+
return isRightSideOfInstanceofExpression(thisArgumentNode) ? thisArgumentType : isOptionalChainRoot(thisArgumentNode.parent) ? getNonNullableType(thisArgumentType) : isOptionalChain(thisArgumentNode.parent) ? removeOptionalTypeMarker(thisArgumentType) : thisArgumentType;
|
|
75021
75058
|
}
|
|
75022
75059
|
function inferTypeArguments(node, signature, args, checkMode, context) {
|
|
75023
75060
|
if (isJsxOpeningLikeElement(node)) {
|
|
75024
75061
|
return inferJsxTypeArguments(node, signature, checkMode, context);
|
|
75025
75062
|
}
|
|
75026
|
-
if (node.kind !== 170 /* Decorator */) {
|
|
75063
|
+
if (node.kind !== 170 /* Decorator */ && node.kind !== 226 /* BinaryExpression */) {
|
|
75027
75064
|
const skipBindingPatterns = every(signature.typeParameters, (p) => !!getDefaultFromTypeParameter(p));
|
|
75028
75065
|
const contextualType = getContextualType2(node, skipBindingPatterns ? 8 /* SkipBindingPatterns */ : 0 /* None */);
|
|
75029
75066
|
if (contextualType) {
|
|
@@ -75060,7 +75097,7 @@ function createTypeChecker(host) {
|
|
|
75060
75097
|
}
|
|
75061
75098
|
for (let i = 0; i < argCount; i++) {
|
|
75062
75099
|
const arg = args[i];
|
|
75063
|
-
if (arg.kind !== 232 /* OmittedExpression */
|
|
75100
|
+
if (arg.kind !== 232 /* OmittedExpression */) {
|
|
75064
75101
|
const paramType = getTypeAtPosition(signature, i);
|
|
75065
75102
|
if (couldContainTypeVariables(paramType)) {
|
|
75066
75103
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -75352,6 +75389,9 @@ function createTypeChecker(host) {
|
|
|
75352
75389
|
}
|
|
75353
75390
|
}
|
|
75354
75391
|
function getThisArgumentOfCall(node) {
|
|
75392
|
+
if (node.kind === 226 /* BinaryExpression */) {
|
|
75393
|
+
return node.right;
|
|
75394
|
+
}
|
|
75355
75395
|
const expression = node.kind === 213 /* CallExpression */ ? node.expression : node.kind === 215 /* TaggedTemplateExpression */ ? node.tag : node.kind === 170 /* Decorator */ && !legacyDecorators ? node.expression : void 0;
|
|
75356
75396
|
if (expression) {
|
|
75357
75397
|
const callee = skipOuterExpressions(expression);
|
|
@@ -75380,6 +75420,9 @@ function createTypeChecker(host) {
|
|
|
75380
75420
|
if (node.kind === 170 /* Decorator */) {
|
|
75381
75421
|
return getEffectiveDecoratorArguments(node);
|
|
75382
75422
|
}
|
|
75423
|
+
if (node.kind === 226 /* BinaryExpression */) {
|
|
75424
|
+
return [node.left];
|
|
75425
|
+
}
|
|
75383
75426
|
if (isJsxOpeningLikeElement(node)) {
|
|
75384
75427
|
return node.attributes.properties.length > 0 || isJsxOpeningElement(node) && node.parent.children.length > 0 ? [node.attributes] : emptyArray;
|
|
75385
75428
|
}
|
|
@@ -75649,9 +75692,10 @@ function createTypeChecker(host) {
|
|
|
75649
75692
|
const isTaggedTemplate = node.kind === 215 /* TaggedTemplateExpression */;
|
|
75650
75693
|
const isDecorator2 = node.kind === 170 /* Decorator */;
|
|
75651
75694
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
75695
|
+
const isInstanceof = node.kind === 226 /* BinaryExpression */;
|
|
75652
75696
|
const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
|
|
75653
75697
|
let typeArguments;
|
|
75654
|
-
if (!isDecorator2 && !isSuperCall(node)) {
|
|
75698
|
+
if (!isDecorator2 && !isInstanceof && !isSuperCall(node)) {
|
|
75655
75699
|
typeArguments = node.typeArguments;
|
|
75656
75700
|
if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 108 /* SuperKeyword */) {
|
|
75657
75701
|
forEach(typeArguments, checkSourceElement);
|
|
@@ -75663,7 +75707,6 @@ function createTypeChecker(host) {
|
|
|
75663
75707
|
const args = getEffectiveCallArguments(node);
|
|
75664
75708
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
75665
75709
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
75666
|
-
argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
75667
75710
|
let candidatesForArgumentError;
|
|
75668
75711
|
let candidateForArgumentArityError;
|
|
75669
75712
|
let candidateForTypeArgumentError;
|
|
@@ -75681,6 +75724,9 @@ function createTypeChecker(host) {
|
|
|
75681
75724
|
result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
|
|
75682
75725
|
getNodeLinks(node).resolvedSignature = result;
|
|
75683
75726
|
if (reportErrors2) {
|
|
75727
|
+
if (!headMessage && isInstanceof) {
|
|
75728
|
+
headMessage = Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method;
|
|
75729
|
+
}
|
|
75684
75730
|
if (candidatesForArgumentError) {
|
|
75685
75731
|
if (candidatesForArgumentError.length === 1 || candidatesForArgumentError.length > 3) {
|
|
75686
75732
|
const last2 = candidatesForArgumentError[candidatesForArgumentError.length - 1];
|
|
@@ -76467,6 +76513,30 @@ function createTypeChecker(host) {
|
|
|
76467
76513
|
}
|
|
76468
76514
|
return resolveCall(node, signatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
76469
76515
|
}
|
|
76516
|
+
function resolveInstanceofExpression(node, candidatesOutArray, checkMode) {
|
|
76517
|
+
const rightType = checkExpression(node.right);
|
|
76518
|
+
if (!isTypeAny(rightType)) {
|
|
76519
|
+
const hasInstanceMethodType = getSymbolHasInstanceMethodOfObjectType(rightType);
|
|
76520
|
+
if (hasInstanceMethodType) {
|
|
76521
|
+
const apparentType = getApparentType(hasInstanceMethodType);
|
|
76522
|
+
if (isErrorType(apparentType)) {
|
|
76523
|
+
return resolveErrorCall(node);
|
|
76524
|
+
}
|
|
76525
|
+
const callSignatures = getSignaturesOfType(apparentType, 0 /* Call */);
|
|
76526
|
+
const constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */);
|
|
76527
|
+
if (isUntypedFunctionCall(hasInstanceMethodType, apparentType, callSignatures.length, constructSignatures.length)) {
|
|
76528
|
+
return resolveUntypedCall(node);
|
|
76529
|
+
}
|
|
76530
|
+
if (callSignatures.length) {
|
|
76531
|
+
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */);
|
|
76532
|
+
}
|
|
76533
|
+
} else if (!(typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
76534
|
+
error2(node.right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_a_class_function_or_other_type_assignable_to_the_Function_interface_type_or_an_object_type_with_a_Symbol_hasInstance_method);
|
|
76535
|
+
return resolveErrorCall(node);
|
|
76536
|
+
}
|
|
76537
|
+
}
|
|
76538
|
+
return anySignature;
|
|
76539
|
+
}
|
|
76470
76540
|
function isPotentiallyUncalledDecorator(decorator, signatures) {
|
|
76471
76541
|
return signatures.length && every(signatures, (signature) => signature.minArgumentCount === 0 && !signatureHasRestParameter(signature) && signature.parameters.length < getDecoratorArgumentCount(decorator, signature));
|
|
76472
76542
|
}
|
|
@@ -76483,6 +76553,8 @@ function createTypeChecker(host) {
|
|
|
76483
76553
|
case 286 /* JsxOpeningElement */:
|
|
76484
76554
|
case 285 /* JsxSelfClosingElement */:
|
|
76485
76555
|
return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
|
|
76556
|
+
case 226 /* BinaryExpression */:
|
|
76557
|
+
return resolveInstanceofExpression(node, candidatesOutArray, checkMode);
|
|
76486
76558
|
}
|
|
76487
76559
|
Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
|
|
76488
76560
|
}
|
|
@@ -78441,16 +78513,35 @@ function createTypeChecker(host) {
|
|
|
78441
78513
|
function isConstEnumSymbol(symbol) {
|
|
78442
78514
|
return (symbol.flags & 128 /* ConstEnum */) !== 0;
|
|
78443
78515
|
}
|
|
78444
|
-
function
|
|
78516
|
+
function getSymbolHasInstanceMethodOfObjectType(type) {
|
|
78517
|
+
const hasInstancePropertyName = getPropertyNameForKnownSymbolName("hasInstance");
|
|
78518
|
+
const hasInstanceProperty = getPropertyOfObjectType(type, hasInstancePropertyName);
|
|
78519
|
+
if (hasInstanceProperty) {
|
|
78520
|
+
const hasInstancePropertyType = getTypeOfSymbol(hasInstanceProperty);
|
|
78521
|
+
if (hasInstancePropertyType && getSignaturesOfType(hasInstancePropertyType, 0 /* Call */).length !== 0) {
|
|
78522
|
+
return hasInstancePropertyType;
|
|
78523
|
+
}
|
|
78524
|
+
}
|
|
78525
|
+
}
|
|
78526
|
+
function checkInstanceOfExpression(left, right, leftType, rightType, checkMode) {
|
|
78445
78527
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
78446
78528
|
return silentNeverType;
|
|
78447
78529
|
}
|
|
78448
78530
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) {
|
|
78449
78531
|
error2(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
78450
78532
|
}
|
|
78451
|
-
|
|
78452
|
-
|
|
78533
|
+
Debug.assert(isInstanceOfExpression(left.parent));
|
|
78534
|
+
const signature = getResolvedSignature(
|
|
78535
|
+
left.parent,
|
|
78536
|
+
/*candidatesOutArray*/
|
|
78537
|
+
void 0,
|
|
78538
|
+
checkMode
|
|
78539
|
+
);
|
|
78540
|
+
if (signature === resolvingSignature) {
|
|
78541
|
+
return silentNeverType;
|
|
78453
78542
|
}
|
|
78543
|
+
const returnType = getReturnTypeOfSignature(signature);
|
|
78544
|
+
checkTypeAssignableTo(returnType, booleanType, right, Diagnostics.An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_hand_side_of_an_instanceof_expression);
|
|
78454
78545
|
return booleanType;
|
|
78455
78546
|
}
|
|
78456
78547
|
function hasEmptyObjectIntersection(type) {
|
|
@@ -78988,7 +79079,7 @@ function createTypeChecker(host) {
|
|
|
78988
79079
|
case 36 /* ExclamationEqualsToken */:
|
|
78989
79080
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
78990
79081
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
78991
|
-
if (!(checkMode && checkMode &
|
|
79082
|
+
if (!(checkMode && checkMode & 64 /* TypeOnly */)) {
|
|
78992
79083
|
if ((isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) && // only report for === and !== in JS, not == or !=
|
|
78993
79084
|
(!isInJSFile(left) || (operator === 37 /* EqualsEqualsEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */))) {
|
|
78994
79085
|
const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
|
|
@@ -78999,7 +79090,7 @@ function createTypeChecker(host) {
|
|
|
78999
79090
|
}
|
|
79000
79091
|
return booleanType;
|
|
79001
79092
|
case 104 /* InstanceOfKeyword */:
|
|
79002
|
-
return checkInstanceOfExpression(left, right, leftType, rightType);
|
|
79093
|
+
return checkInstanceOfExpression(left, right, leftType, rightType, checkMode);
|
|
79003
79094
|
case 103 /* InKeyword */:
|
|
79004
79095
|
return checkInExpression(left, right, leftType, rightType);
|
|
79005
79096
|
case 56 /* AmpersandAmpersandToken */:
|
|
@@ -79636,7 +79727,7 @@ function createTypeChecker(host) {
|
|
|
79636
79727
|
}
|
|
79637
79728
|
}
|
|
79638
79729
|
const startInvocationCount = flowInvocationCount;
|
|
79639
|
-
const type = checkExpression(node,
|
|
79730
|
+
const type = checkExpression(node, 64 /* TypeOnly */);
|
|
79640
79731
|
if (flowInvocationCount !== startInvocationCount) {
|
|
79641
79732
|
const cache = flowTypeCache || (flowTypeCache = []);
|
|
79642
79733
|
cache[getNodeId(node)] = type;
|
|
@@ -82102,7 +82193,7 @@ function createTypeChecker(host) {
|
|
|
82102
82193
|
checkComputedPropertyName(node.propertyName);
|
|
82103
82194
|
}
|
|
82104
82195
|
const parent2 = node.parent.parent;
|
|
82105
|
-
const parentCheckMode = node.dotDotDotToken ?
|
|
82196
|
+
const parentCheckMode = node.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */;
|
|
82106
82197
|
const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
|
|
82107
82198
|
const name = node.propertyName || node.name;
|
|
82108
82199
|
if (parentType && !isBindingPattern(name)) {
|
|
@@ -82243,29 +82334,6 @@ function createTypeChecker(host) {
|
|
|
82243
82334
|
}
|
|
82244
82335
|
checkCollisionsForDeclarationName(node, node.name);
|
|
82245
82336
|
}
|
|
82246
|
-
function canHaveLiteralInitializer2(node2) {
|
|
82247
|
-
switch (node2.kind) {
|
|
82248
|
-
case 172 /* PropertyDeclaration */:
|
|
82249
|
-
case 171 /* PropertySignature */:
|
|
82250
|
-
return !hasEffectiveModifier(node2, 8 /* Private */);
|
|
82251
|
-
case 169 /* Parameter */:
|
|
82252
|
-
case 260 /* VariableDeclaration */:
|
|
82253
|
-
return true;
|
|
82254
|
-
}
|
|
82255
|
-
return false;
|
|
82256
|
-
}
|
|
82257
|
-
function shouldPrintWithInitializer(node2) {
|
|
82258
|
-
return canHaveLiteralInitializer2(node2) && isLiteralConstDeclaration(node2);
|
|
82259
|
-
}
|
|
82260
|
-
function isPrivateDeclaration(node2) {
|
|
82261
|
-
return hasEffectiveModifier(node2, 8 /* Private */) || isPrivateIdentifierClassElementDeclaration(node2);
|
|
82262
|
-
}
|
|
82263
|
-
if (getEmitDeclarations(compilerOptions) && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) && !shouldPrintWithInitializer(node) && !isPrivateDeclaration(node)) {
|
|
82264
|
-
const widenedLiteralType = getWidenedLiteralType(type);
|
|
82265
|
-
if (!isTypeIdenticalTo(type, widenedLiteralType)) {
|
|
82266
|
-
ambiguousVariableDeclarationsWhenWidened.push([node, type, widenedLiteralType]);
|
|
82267
|
-
}
|
|
82268
|
-
}
|
|
82269
82337
|
}
|
|
82270
82338
|
function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) {
|
|
82271
82339
|
const nextDeclarationName = getNameOfDeclaration(nextDeclaration);
|
|
@@ -85434,6 +85502,12 @@ function createTypeChecker(host) {
|
|
|
85434
85502
|
case 234 /* AsExpression */:
|
|
85435
85503
|
case 217 /* ParenthesizedExpression */:
|
|
85436
85504
|
checkAssertionDeferred(node);
|
|
85505
|
+
break;
|
|
85506
|
+
case 226 /* BinaryExpression */:
|
|
85507
|
+
if (isInstanceOfExpression(node)) {
|
|
85508
|
+
resolveUntypedCall(node);
|
|
85509
|
+
}
|
|
85510
|
+
break;
|
|
85437
85511
|
}
|
|
85438
85512
|
currentNode = saveCurrentNode;
|
|
85439
85513
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
@@ -85481,7 +85555,6 @@ function createTypeChecker(host) {
|
|
|
85481
85555
|
clear(potentialWeakMapSetCollisions);
|
|
85482
85556
|
clear(potentialReflectCollisions);
|
|
85483
85557
|
clear(potentialUnusedRenamedBindingElementsInTypes);
|
|
85484
|
-
clear(ambiguousVariableDeclarationsWhenWidened);
|
|
85485
85558
|
forEach(node.statements, checkSourceElement);
|
|
85486
85559
|
checkSourceElement(node.endOfFileToken);
|
|
85487
85560
|
checkDeferredNodes(node);
|
|
@@ -85500,23 +85573,6 @@ function createTypeChecker(host) {
|
|
|
85500
85573
|
checkPotentialUncheckedRenamedBindingElementsInTypes();
|
|
85501
85574
|
}
|
|
85502
85575
|
});
|
|
85503
|
-
addLazyDiagnostic(() => {
|
|
85504
|
-
function isVisibleExternally(elem) {
|
|
85505
|
-
if (isOmittedExpression(elem)) {
|
|
85506
|
-
return false;
|
|
85507
|
-
}
|
|
85508
|
-
if (isBindingPattern(elem.name)) {
|
|
85509
|
-
return some(elem.name.elements, isVisibleExternally);
|
|
85510
|
-
} else {
|
|
85511
|
-
return isDeclarationVisible(elem);
|
|
85512
|
-
}
|
|
85513
|
-
}
|
|
85514
|
-
for (const [node2, type, widenedLiteralType] of ambiguousVariableDeclarationsWhenWidened) {
|
|
85515
|
-
if (isVisibleExternally(node2)) {
|
|
85516
|
-
error2(node2.name, Diagnostics.The_type_of_this_declaration_is_ambiguous_and_may_be_observed_as_either_0_or_1, typeToString(widenedLiteralType), typeToString(type));
|
|
85517
|
-
}
|
|
85518
|
-
}
|
|
85519
|
-
});
|
|
85520
85576
|
if (compilerOptions.importsNotUsedAsValues === 2 /* Error */ && !node.isDeclarationFile && isExternalModule(node)) {
|
|
85521
85577
|
checkImportsForTypeOnlyConversion(node);
|
|
85522
85578
|
}
|
|
@@ -85539,9 +85595,6 @@ function createTypeChecker(host) {
|
|
|
85539
85595
|
forEach(potentialReflectCollisions, checkReflectCollision);
|
|
85540
85596
|
clear(potentialReflectCollisions);
|
|
85541
85597
|
}
|
|
85542
|
-
if (ambiguousVariableDeclarationsWhenWidened.length) {
|
|
85543
|
-
clear(ambiguousVariableDeclarationsWhenWidened);
|
|
85544
|
-
}
|
|
85545
85598
|
links.flags |= 1 /* TypeChecked */;
|
|
85546
85599
|
}
|
|
85547
85600
|
}
|
|
@@ -86071,6 +86124,13 @@ function createTypeChecker(host) {
|
|
|
86071
86124
|
case 102 /* ImportKeyword */:
|
|
86072
86125
|
case 105 /* NewKeyword */:
|
|
86073
86126
|
return isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : void 0;
|
|
86127
|
+
case 104 /* InstanceOfKeyword */:
|
|
86128
|
+
if (isBinaryExpression(node.parent)) {
|
|
86129
|
+
const type = getTypeOfExpression(node.parent.right);
|
|
86130
|
+
const hasInstanceMethodType = getSymbolHasInstanceMethodOfObjectType(type);
|
|
86131
|
+
return (hasInstanceMethodType == null ? void 0 : hasInstanceMethodType.symbol) ?? type.symbol;
|
|
86132
|
+
}
|
|
86133
|
+
return void 0;
|
|
86074
86134
|
case 236 /* MetaProperty */:
|
|
86075
86135
|
return checkExpression(node).symbol;
|
|
86076
86136
|
case 295 /* JsxNamespacedName */:
|
|
@@ -130541,10 +130601,10 @@ var LanguageServiceMode = /* @__PURE__ */ ((LanguageServiceMode2) => {
|
|
|
130541
130601
|
return LanguageServiceMode2;
|
|
130542
130602
|
})(LanguageServiceMode || {});
|
|
130543
130603
|
var emptyOptions = {};
|
|
130544
|
-
var SemanticClassificationFormat = /* @__PURE__ */ ((
|
|
130545
|
-
|
|
130546
|
-
|
|
130547
|
-
return
|
|
130604
|
+
var SemanticClassificationFormat = /* @__PURE__ */ ((SemanticClassificationFormat2) => {
|
|
130605
|
+
SemanticClassificationFormat2["Original"] = "original";
|
|
130606
|
+
SemanticClassificationFormat2["TwentyTwenty"] = "2020";
|
|
130607
|
+
return SemanticClassificationFormat2;
|
|
130548
130608
|
})(SemanticClassificationFormat || {});
|
|
130549
130609
|
var OrganizeImportsMode = /* @__PURE__ */ ((OrganizeImportsMode3) => {
|
|
130550
130610
|
OrganizeImportsMode3["All"] = "All";
|
|
@@ -130661,15 +130721,15 @@ var OutputFileType = /* @__PURE__ */ ((OutputFileType2) => {
|
|
|
130661
130721
|
OutputFileType2[OutputFileType2["Declaration"] = 2] = "Declaration";
|
|
130662
130722
|
return OutputFileType2;
|
|
130663
130723
|
})(OutputFileType || {});
|
|
130664
|
-
var EndOfLineState = /* @__PURE__ */ ((
|
|
130665
|
-
|
|
130666
|
-
|
|
130667
|
-
|
|
130668
|
-
|
|
130669
|
-
|
|
130670
|
-
|
|
130671
|
-
|
|
130672
|
-
return
|
|
130724
|
+
var EndOfLineState = /* @__PURE__ */ ((EndOfLineState2) => {
|
|
130725
|
+
EndOfLineState2[EndOfLineState2["None"] = 0] = "None";
|
|
130726
|
+
EndOfLineState2[EndOfLineState2["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia";
|
|
130727
|
+
EndOfLineState2[EndOfLineState2["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral";
|
|
130728
|
+
EndOfLineState2[EndOfLineState2["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral";
|
|
130729
|
+
EndOfLineState2[EndOfLineState2["InTemplateHeadOrNoSubstitutionTemplate"] = 4] = "InTemplateHeadOrNoSubstitutionTemplate";
|
|
130730
|
+
EndOfLineState2[EndOfLineState2["InTemplateMiddleOrTail"] = 5] = "InTemplateMiddleOrTail";
|
|
130731
|
+
EndOfLineState2[EndOfLineState2["InTemplateSubstitutionPosition"] = 6] = "InTemplateSubstitutionPosition";
|
|
130732
|
+
return EndOfLineState2;
|
|
130673
130733
|
})(EndOfLineState || {});
|
|
130674
130734
|
var TokenClass = /* @__PURE__ */ ((TokenClass2) => {
|
|
130675
130735
|
TokenClass2[TokenClass2["Punctuation"] = 0] = "Punctuation";
|
|
@@ -145478,926 +145538,6 @@ function transform(source, transformers, compilerOptions) {
|
|
|
145478
145538
|
return result;
|
|
145479
145539
|
}
|
|
145480
145540
|
|
|
145481
|
-
// src/services/shims.ts
|
|
145482
|
-
var debugObjectHost = function() {
|
|
145483
|
-
return this;
|
|
145484
|
-
}();
|
|
145485
|
-
function logInternalError(logger, err) {
|
|
145486
|
-
if (logger) {
|
|
145487
|
-
logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message);
|
|
145488
|
-
}
|
|
145489
|
-
}
|
|
145490
|
-
var ScriptSnapshotShimAdapter = class {
|
|
145491
|
-
constructor(scriptSnapshotShim) {
|
|
145492
|
-
this.scriptSnapshotShim = scriptSnapshotShim;
|
|
145493
|
-
}
|
|
145494
|
-
getText(start2, end) {
|
|
145495
|
-
return this.scriptSnapshotShim.getText(start2, end);
|
|
145496
|
-
}
|
|
145497
|
-
getLength() {
|
|
145498
|
-
return this.scriptSnapshotShim.getLength();
|
|
145499
|
-
}
|
|
145500
|
-
getChangeRange(oldSnapshot) {
|
|
145501
|
-
const oldSnapshotShim = oldSnapshot;
|
|
145502
|
-
const encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim);
|
|
145503
|
-
if (encoded === null) {
|
|
145504
|
-
return null;
|
|
145505
|
-
}
|
|
145506
|
-
const decoded = JSON.parse(encoded);
|
|
145507
|
-
return createTextChangeRange(
|
|
145508
|
-
createTextSpan(decoded.span.start, decoded.span.length),
|
|
145509
|
-
decoded.newLength
|
|
145510
|
-
);
|
|
145511
|
-
}
|
|
145512
|
-
dispose() {
|
|
145513
|
-
if ("dispose" in this.scriptSnapshotShim) {
|
|
145514
|
-
this.scriptSnapshotShim.dispose();
|
|
145515
|
-
}
|
|
145516
|
-
}
|
|
145517
|
-
};
|
|
145518
|
-
var LanguageServiceShimHostAdapter = class {
|
|
145519
|
-
constructor(shimHost) {
|
|
145520
|
-
this.shimHost = shimHost;
|
|
145521
|
-
this.loggingEnabled = false;
|
|
145522
|
-
this.tracingEnabled = false;
|
|
145523
|
-
if ("getModuleResolutionsForFile" in this.shimHost) {
|
|
145524
|
-
this.resolveModuleNames = (moduleNames, containingFile) => {
|
|
145525
|
-
const resolutionsInFile = JSON.parse(this.shimHost.getModuleResolutionsForFile(containingFile));
|
|
145526
|
-
return map(moduleNames, (name) => {
|
|
145527
|
-
const result = getProperty(resolutionsInFile, name);
|
|
145528
|
-
return result ? { resolvedFileName: result, extension: extensionFromPath(result), isExternalLibraryImport: false } : void 0;
|
|
145529
|
-
});
|
|
145530
|
-
};
|
|
145531
|
-
}
|
|
145532
|
-
if ("directoryExists" in this.shimHost) {
|
|
145533
|
-
this.directoryExists = (directoryName) => this.shimHost.directoryExists(directoryName);
|
|
145534
|
-
}
|
|
145535
|
-
if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) {
|
|
145536
|
-
this.resolveTypeReferenceDirectives = (typeDirectiveNames, containingFile) => {
|
|
145537
|
-
const typeDirectivesForFile = JSON.parse(this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile));
|
|
145538
|
-
return map(typeDirectiveNames, (name) => getProperty(typeDirectivesForFile, isString(name) ? name : toFileNameLowerCase(name.fileName)));
|
|
145539
|
-
};
|
|
145540
|
-
}
|
|
145541
|
-
if ("jsDocParsingMode" in this.shimHost) {
|
|
145542
|
-
this.jsDocParsingMode = this.shimHost.jsDocParsingMode;
|
|
145543
|
-
}
|
|
145544
|
-
}
|
|
145545
|
-
log(s) {
|
|
145546
|
-
if (this.loggingEnabled) {
|
|
145547
|
-
this.shimHost.log(s);
|
|
145548
|
-
}
|
|
145549
|
-
}
|
|
145550
|
-
trace(s) {
|
|
145551
|
-
if (this.tracingEnabled) {
|
|
145552
|
-
this.shimHost.trace(s);
|
|
145553
|
-
}
|
|
145554
|
-
}
|
|
145555
|
-
error(s) {
|
|
145556
|
-
this.shimHost.error(s);
|
|
145557
|
-
}
|
|
145558
|
-
getProjectVersion() {
|
|
145559
|
-
if (!this.shimHost.getProjectVersion) {
|
|
145560
|
-
return void 0;
|
|
145561
|
-
}
|
|
145562
|
-
return this.shimHost.getProjectVersion();
|
|
145563
|
-
}
|
|
145564
|
-
getTypeRootsVersion() {
|
|
145565
|
-
if (!this.shimHost.getTypeRootsVersion) {
|
|
145566
|
-
return 0;
|
|
145567
|
-
}
|
|
145568
|
-
return this.shimHost.getTypeRootsVersion();
|
|
145569
|
-
}
|
|
145570
|
-
useCaseSensitiveFileNames() {
|
|
145571
|
-
return this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false;
|
|
145572
|
-
}
|
|
145573
|
-
getCompilationSettings() {
|
|
145574
|
-
const settingsJson = this.shimHost.getCompilationSettings();
|
|
145575
|
-
if (settingsJson === null || settingsJson === "") {
|
|
145576
|
-
throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings");
|
|
145577
|
-
}
|
|
145578
|
-
const compilerOptions = JSON.parse(settingsJson);
|
|
145579
|
-
compilerOptions.allowNonTsExtensions = true;
|
|
145580
|
-
return compilerOptions;
|
|
145581
|
-
}
|
|
145582
|
-
getScriptFileNames() {
|
|
145583
|
-
const encoded = this.shimHost.getScriptFileNames();
|
|
145584
|
-
return JSON.parse(encoded);
|
|
145585
|
-
}
|
|
145586
|
-
getScriptSnapshot(fileName) {
|
|
145587
|
-
const scriptSnapshot = this.shimHost.getScriptSnapshot(fileName);
|
|
145588
|
-
return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot);
|
|
145589
|
-
}
|
|
145590
|
-
getScriptKind(fileName) {
|
|
145591
|
-
if ("getScriptKind" in this.shimHost) {
|
|
145592
|
-
return this.shimHost.getScriptKind(fileName);
|
|
145593
|
-
} else {
|
|
145594
|
-
return 0 /* Unknown */;
|
|
145595
|
-
}
|
|
145596
|
-
}
|
|
145597
|
-
getScriptVersion(fileName) {
|
|
145598
|
-
return this.shimHost.getScriptVersion(fileName);
|
|
145599
|
-
}
|
|
145600
|
-
getLocalizedDiagnosticMessages() {
|
|
145601
|
-
const diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages();
|
|
145602
|
-
if (diagnosticMessagesJson === null || diagnosticMessagesJson === "") {
|
|
145603
|
-
return null;
|
|
145604
|
-
}
|
|
145605
|
-
try {
|
|
145606
|
-
return JSON.parse(diagnosticMessagesJson);
|
|
145607
|
-
} catch (e) {
|
|
145608
|
-
this.log(e.description || "diagnosticMessages.generated.json has invalid JSON format");
|
|
145609
|
-
return null;
|
|
145610
|
-
}
|
|
145611
|
-
}
|
|
145612
|
-
getCancellationToken() {
|
|
145613
|
-
const hostCancellationToken = this.shimHost.getCancellationToken();
|
|
145614
|
-
return new ThrottledCancellationToken(hostCancellationToken);
|
|
145615
|
-
}
|
|
145616
|
-
getCurrentDirectory() {
|
|
145617
|
-
return this.shimHost.getCurrentDirectory();
|
|
145618
|
-
}
|
|
145619
|
-
getDirectories(path) {
|
|
145620
|
-
return JSON.parse(this.shimHost.getDirectories(path));
|
|
145621
|
-
}
|
|
145622
|
-
getDefaultLibFileName(options) {
|
|
145623
|
-
return this.shimHost.getDefaultLibFileName(JSON.stringify(options));
|
|
145624
|
-
}
|
|
145625
|
-
readDirectory(path, extensions, exclude, include, depth) {
|
|
145626
|
-
const pattern = getFileMatcherPatterns(path, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory());
|
|
145627
|
-
return JSON.parse(this.shimHost.readDirectory(
|
|
145628
|
-
path,
|
|
145629
|
-
JSON.stringify(extensions),
|
|
145630
|
-
JSON.stringify(pattern.basePaths),
|
|
145631
|
-
pattern.excludePattern,
|
|
145632
|
-
pattern.includeFilePattern,
|
|
145633
|
-
pattern.includeDirectoryPattern,
|
|
145634
|
-
depth
|
|
145635
|
-
));
|
|
145636
|
-
}
|
|
145637
|
-
readFile(path, encoding) {
|
|
145638
|
-
return this.shimHost.readFile(path, encoding);
|
|
145639
|
-
}
|
|
145640
|
-
fileExists(path) {
|
|
145641
|
-
return this.shimHost.fileExists(path);
|
|
145642
|
-
}
|
|
145643
|
-
};
|
|
145644
|
-
var CoreServicesShimHostAdapter = class {
|
|
145645
|
-
constructor(shimHost) {
|
|
145646
|
-
this.shimHost = shimHost;
|
|
145647
|
-
this.useCaseSensitiveFileNames = this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false;
|
|
145648
|
-
if ("directoryExists" in this.shimHost) {
|
|
145649
|
-
this.directoryExists = (directoryName) => this.shimHost.directoryExists(directoryName);
|
|
145650
|
-
} else {
|
|
145651
|
-
this.directoryExists = void 0;
|
|
145652
|
-
}
|
|
145653
|
-
if ("realpath" in this.shimHost) {
|
|
145654
|
-
this.realpath = (path) => this.shimHost.realpath(path);
|
|
145655
|
-
} else {
|
|
145656
|
-
this.realpath = void 0;
|
|
145657
|
-
}
|
|
145658
|
-
}
|
|
145659
|
-
readDirectory(rootDir, extensions, exclude, include, depth) {
|
|
145660
|
-
const pattern = getFileMatcherPatterns(rootDir, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory());
|
|
145661
|
-
return JSON.parse(this.shimHost.readDirectory(
|
|
145662
|
-
rootDir,
|
|
145663
|
-
JSON.stringify(extensions),
|
|
145664
|
-
JSON.stringify(pattern.basePaths),
|
|
145665
|
-
pattern.excludePattern,
|
|
145666
|
-
pattern.includeFilePattern,
|
|
145667
|
-
pattern.includeDirectoryPattern,
|
|
145668
|
-
depth
|
|
145669
|
-
));
|
|
145670
|
-
}
|
|
145671
|
-
fileExists(fileName) {
|
|
145672
|
-
return this.shimHost.fileExists(fileName);
|
|
145673
|
-
}
|
|
145674
|
-
readFile(fileName) {
|
|
145675
|
-
return this.shimHost.readFile(fileName);
|
|
145676
|
-
}
|
|
145677
|
-
getDirectories(path) {
|
|
145678
|
-
return JSON.parse(this.shimHost.getDirectories(path));
|
|
145679
|
-
}
|
|
145680
|
-
};
|
|
145681
|
-
function simpleForwardCall(logger, actionDescription2, action, logPerformance) {
|
|
145682
|
-
let start2;
|
|
145683
|
-
if (logPerformance) {
|
|
145684
|
-
logger.log(actionDescription2);
|
|
145685
|
-
start2 = timestamp();
|
|
145686
|
-
}
|
|
145687
|
-
const result = action();
|
|
145688
|
-
if (logPerformance) {
|
|
145689
|
-
const end = timestamp();
|
|
145690
|
-
logger.log(`${actionDescription2} completed in ${end - start2} msec`);
|
|
145691
|
-
if (isString(result)) {
|
|
145692
|
-
let str = result;
|
|
145693
|
-
if (str.length > 128) {
|
|
145694
|
-
str = str.substring(0, 128) + "...";
|
|
145695
|
-
}
|
|
145696
|
-
logger.log(` result.length=${str.length}, result='${JSON.stringify(str)}'`);
|
|
145697
|
-
}
|
|
145698
|
-
}
|
|
145699
|
-
return result;
|
|
145700
|
-
}
|
|
145701
|
-
function forwardJSONCall(logger, actionDescription2, action, logPerformance) {
|
|
145702
|
-
return forwardCall(
|
|
145703
|
-
logger,
|
|
145704
|
-
actionDescription2,
|
|
145705
|
-
/*returnJson*/
|
|
145706
|
-
true,
|
|
145707
|
-
action,
|
|
145708
|
-
logPerformance
|
|
145709
|
-
);
|
|
145710
|
-
}
|
|
145711
|
-
function forwardCall(logger, actionDescription2, returnJson, action, logPerformance) {
|
|
145712
|
-
try {
|
|
145713
|
-
const result = simpleForwardCall(logger, actionDescription2, action, logPerformance);
|
|
145714
|
-
return returnJson ? JSON.stringify({ result }) : result;
|
|
145715
|
-
} catch (err) {
|
|
145716
|
-
if (err instanceof OperationCanceledException) {
|
|
145717
|
-
return JSON.stringify({ canceled: true });
|
|
145718
|
-
}
|
|
145719
|
-
logInternalError(logger, err);
|
|
145720
|
-
err.description = actionDescription2;
|
|
145721
|
-
return JSON.stringify({ error: err });
|
|
145722
|
-
}
|
|
145723
|
-
}
|
|
145724
|
-
var ShimBase = class {
|
|
145725
|
-
constructor(factory2) {
|
|
145726
|
-
this.factory = factory2;
|
|
145727
|
-
factory2.registerShim(this);
|
|
145728
|
-
}
|
|
145729
|
-
dispose(_dummy) {
|
|
145730
|
-
this.factory.unregisterShim(this);
|
|
145731
|
-
}
|
|
145732
|
-
};
|
|
145733
|
-
function realizeDiagnostics(diagnostics, newLine) {
|
|
145734
|
-
return diagnostics.map((d) => realizeDiagnostic(d, newLine));
|
|
145735
|
-
}
|
|
145736
|
-
function realizeDiagnostic(diagnostic, newLine) {
|
|
145737
|
-
return {
|
|
145738
|
-
message: flattenDiagnosticMessageText(diagnostic.messageText, newLine),
|
|
145739
|
-
start: diagnostic.start,
|
|
145740
|
-
// TODO: GH#18217
|
|
145741
|
-
length: diagnostic.length,
|
|
145742
|
-
// TODO: GH#18217
|
|
145743
|
-
category: diagnosticCategoryName(diagnostic),
|
|
145744
|
-
code: diagnostic.code,
|
|
145745
|
-
reportsUnnecessary: diagnostic.reportsUnnecessary,
|
|
145746
|
-
reportsDeprecated: diagnostic.reportsDeprecated
|
|
145747
|
-
};
|
|
145748
|
-
}
|
|
145749
|
-
var LanguageServiceShimObject = class extends ShimBase {
|
|
145750
|
-
constructor(factory2, host, languageService) {
|
|
145751
|
-
super(factory2);
|
|
145752
|
-
this.host = host;
|
|
145753
|
-
this.languageService = languageService;
|
|
145754
|
-
this.logPerformance = false;
|
|
145755
|
-
this.logger = this.host;
|
|
145756
|
-
}
|
|
145757
|
-
forwardJSONCall(actionDescription2, action) {
|
|
145758
|
-
return forwardJSONCall(this.logger, actionDescription2, action, this.logPerformance);
|
|
145759
|
-
}
|
|
145760
|
-
/// DISPOSE
|
|
145761
|
-
/**
|
|
145762
|
-
* Ensure (almost) deterministic release of internal Javascript resources when
|
|
145763
|
-
* some external native objects holds onto us (e.g. Com/Interop).
|
|
145764
|
-
*/
|
|
145765
|
-
dispose(dummy) {
|
|
145766
|
-
this.logger.log("dispose()");
|
|
145767
|
-
this.languageService.dispose();
|
|
145768
|
-
this.languageService = null;
|
|
145769
|
-
if (debugObjectHost && debugObjectHost.CollectGarbage) {
|
|
145770
|
-
debugObjectHost.CollectGarbage();
|
|
145771
|
-
this.logger.log("CollectGarbage()");
|
|
145772
|
-
}
|
|
145773
|
-
this.logger = null;
|
|
145774
|
-
super.dispose(dummy);
|
|
145775
|
-
}
|
|
145776
|
-
/// REFRESH
|
|
145777
|
-
/**
|
|
145778
|
-
* Update the list of scripts known to the compiler
|
|
145779
|
-
*/
|
|
145780
|
-
refresh(throwOnError) {
|
|
145781
|
-
this.forwardJSONCall(
|
|
145782
|
-
`refresh(${throwOnError})`,
|
|
145783
|
-
() => null
|
|
145784
|
-
// eslint-disable-line no-null/no-null
|
|
145785
|
-
);
|
|
145786
|
-
}
|
|
145787
|
-
cleanupSemanticCache() {
|
|
145788
|
-
this.forwardJSONCall(
|
|
145789
|
-
"cleanupSemanticCache()",
|
|
145790
|
-
() => {
|
|
145791
|
-
this.languageService.cleanupSemanticCache();
|
|
145792
|
-
return null;
|
|
145793
|
-
}
|
|
145794
|
-
);
|
|
145795
|
-
}
|
|
145796
|
-
realizeDiagnostics(diagnostics) {
|
|
145797
|
-
const newLine = getNewLineOrDefaultFromHost(
|
|
145798
|
-
this.host,
|
|
145799
|
-
/*formatSettings*/
|
|
145800
|
-
void 0
|
|
145801
|
-
);
|
|
145802
|
-
return realizeDiagnostics(diagnostics, newLine);
|
|
145803
|
-
}
|
|
145804
|
-
getSyntacticClassifications(fileName, start2, length2) {
|
|
145805
|
-
return this.forwardJSONCall(
|
|
145806
|
-
`getSyntacticClassifications('${fileName}', ${start2}, ${length2})`,
|
|
145807
|
-
() => this.languageService.getSyntacticClassifications(fileName, createTextSpan(start2, length2))
|
|
145808
|
-
);
|
|
145809
|
-
}
|
|
145810
|
-
getSemanticClassifications(fileName, start2, length2) {
|
|
145811
|
-
return this.forwardJSONCall(
|
|
145812
|
-
`getSemanticClassifications('${fileName}', ${start2}, ${length2})`,
|
|
145813
|
-
() => this.languageService.getSemanticClassifications(fileName, createTextSpan(start2, length2))
|
|
145814
|
-
);
|
|
145815
|
-
}
|
|
145816
|
-
getEncodedSyntacticClassifications(fileName, start2, length2) {
|
|
145817
|
-
return this.forwardJSONCall(
|
|
145818
|
-
`getEncodedSyntacticClassifications('${fileName}', ${start2}, ${length2})`,
|
|
145819
|
-
// directly serialize the spans out to a string. This is much faster to decode
|
|
145820
|
-
// on the managed side versus a full JSON array.
|
|
145821
|
-
() => convertClassifications(this.languageService.getEncodedSyntacticClassifications(fileName, createTextSpan(start2, length2)))
|
|
145822
|
-
);
|
|
145823
|
-
}
|
|
145824
|
-
getEncodedSemanticClassifications(fileName, start2, length2) {
|
|
145825
|
-
return this.forwardJSONCall(
|
|
145826
|
-
`getEncodedSemanticClassifications('${fileName}', ${start2}, ${length2})`,
|
|
145827
|
-
// directly serialize the spans out to a string. This is much faster to decode
|
|
145828
|
-
// on the managed side versus a full JSON array.
|
|
145829
|
-
() => convertClassifications(this.languageService.getEncodedSemanticClassifications(fileName, createTextSpan(start2, length2)))
|
|
145830
|
-
);
|
|
145831
|
-
}
|
|
145832
|
-
getSyntacticDiagnostics(fileName) {
|
|
145833
|
-
return this.forwardJSONCall(
|
|
145834
|
-
`getSyntacticDiagnostics('${fileName}')`,
|
|
145835
|
-
() => {
|
|
145836
|
-
const diagnostics = this.languageService.getSyntacticDiagnostics(fileName);
|
|
145837
|
-
return this.realizeDiagnostics(diagnostics);
|
|
145838
|
-
}
|
|
145839
|
-
);
|
|
145840
|
-
}
|
|
145841
|
-
getSemanticDiagnostics(fileName) {
|
|
145842
|
-
return this.forwardJSONCall(
|
|
145843
|
-
`getSemanticDiagnostics('${fileName}')`,
|
|
145844
|
-
() => {
|
|
145845
|
-
const diagnostics = this.languageService.getSemanticDiagnostics(fileName);
|
|
145846
|
-
return this.realizeDiagnostics(diagnostics);
|
|
145847
|
-
}
|
|
145848
|
-
);
|
|
145849
|
-
}
|
|
145850
|
-
getSuggestionDiagnostics(fileName) {
|
|
145851
|
-
return this.forwardJSONCall(`getSuggestionDiagnostics('${fileName}')`, () => this.realizeDiagnostics(this.languageService.getSuggestionDiagnostics(fileName)));
|
|
145852
|
-
}
|
|
145853
|
-
getCompilerOptionsDiagnostics() {
|
|
145854
|
-
return this.forwardJSONCall(
|
|
145855
|
-
"getCompilerOptionsDiagnostics()",
|
|
145856
|
-
() => {
|
|
145857
|
-
const diagnostics = this.languageService.getCompilerOptionsDiagnostics();
|
|
145858
|
-
return this.realizeDiagnostics(diagnostics);
|
|
145859
|
-
}
|
|
145860
|
-
);
|
|
145861
|
-
}
|
|
145862
|
-
/// QUICKINFO
|
|
145863
|
-
/**
|
|
145864
|
-
* Computes a string representation of the type at the requested position
|
|
145865
|
-
* in the active file.
|
|
145866
|
-
*/
|
|
145867
|
-
getQuickInfoAtPosition(fileName, position) {
|
|
145868
|
-
return this.forwardJSONCall(
|
|
145869
|
-
`getQuickInfoAtPosition('${fileName}', ${position})`,
|
|
145870
|
-
() => this.languageService.getQuickInfoAtPosition(fileName, position)
|
|
145871
|
-
);
|
|
145872
|
-
}
|
|
145873
|
-
/// NAMEORDOTTEDNAMESPAN
|
|
145874
|
-
/**
|
|
145875
|
-
* Computes span information of the name or dotted name at the requested position
|
|
145876
|
-
* in the active file.
|
|
145877
|
-
*/
|
|
145878
|
-
getNameOrDottedNameSpan(fileName, startPos, endPos) {
|
|
145879
|
-
return this.forwardJSONCall(
|
|
145880
|
-
`getNameOrDottedNameSpan('${fileName}', ${startPos}, ${endPos})`,
|
|
145881
|
-
() => this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos)
|
|
145882
|
-
);
|
|
145883
|
-
}
|
|
145884
|
-
/**
|
|
145885
|
-
* STATEMENTSPAN
|
|
145886
|
-
* Computes span information of statement at the requested position in the active file.
|
|
145887
|
-
*/
|
|
145888
|
-
getBreakpointStatementAtPosition(fileName, position) {
|
|
145889
|
-
return this.forwardJSONCall(
|
|
145890
|
-
`getBreakpointStatementAtPosition('${fileName}', ${position})`,
|
|
145891
|
-
() => this.languageService.getBreakpointStatementAtPosition(fileName, position)
|
|
145892
|
-
);
|
|
145893
|
-
}
|
|
145894
|
-
/// SIGNATUREHELP
|
|
145895
|
-
getSignatureHelpItems(fileName, position, options) {
|
|
145896
|
-
return this.forwardJSONCall(
|
|
145897
|
-
`getSignatureHelpItems('${fileName}', ${position})`,
|
|
145898
|
-
() => this.languageService.getSignatureHelpItems(fileName, position, options)
|
|
145899
|
-
);
|
|
145900
|
-
}
|
|
145901
|
-
/// GOTO DEFINITION
|
|
145902
|
-
/**
|
|
145903
|
-
* Computes the definition location and file for the symbol
|
|
145904
|
-
* at the requested position.
|
|
145905
|
-
*/
|
|
145906
|
-
getDefinitionAtPosition(fileName, position) {
|
|
145907
|
-
return this.forwardJSONCall(
|
|
145908
|
-
`getDefinitionAtPosition('${fileName}', ${position})`,
|
|
145909
|
-
() => this.languageService.getDefinitionAtPosition(fileName, position)
|
|
145910
|
-
);
|
|
145911
|
-
}
|
|
145912
|
-
/**
|
|
145913
|
-
* Computes the definition location and file for the symbol
|
|
145914
|
-
* at the requested position.
|
|
145915
|
-
*/
|
|
145916
|
-
getDefinitionAndBoundSpan(fileName, position) {
|
|
145917
|
-
return this.forwardJSONCall(
|
|
145918
|
-
`getDefinitionAndBoundSpan('${fileName}', ${position})`,
|
|
145919
|
-
() => this.languageService.getDefinitionAndBoundSpan(fileName, position)
|
|
145920
|
-
);
|
|
145921
|
-
}
|
|
145922
|
-
/// GOTO Type
|
|
145923
|
-
/**
|
|
145924
|
-
* Computes the definition location of the type of the symbol
|
|
145925
|
-
* at the requested position.
|
|
145926
|
-
*/
|
|
145927
|
-
getTypeDefinitionAtPosition(fileName, position) {
|
|
145928
|
-
return this.forwardJSONCall(
|
|
145929
|
-
`getTypeDefinitionAtPosition('${fileName}', ${position})`,
|
|
145930
|
-
() => this.languageService.getTypeDefinitionAtPosition(fileName, position)
|
|
145931
|
-
);
|
|
145932
|
-
}
|
|
145933
|
-
/// GOTO Implementation
|
|
145934
|
-
/**
|
|
145935
|
-
* Computes the implementation location of the symbol
|
|
145936
|
-
* at the requested position.
|
|
145937
|
-
*/
|
|
145938
|
-
getImplementationAtPosition(fileName, position) {
|
|
145939
|
-
return this.forwardJSONCall(
|
|
145940
|
-
`getImplementationAtPosition('${fileName}', ${position})`,
|
|
145941
|
-
() => this.languageService.getImplementationAtPosition(fileName, position)
|
|
145942
|
-
);
|
|
145943
|
-
}
|
|
145944
|
-
getRenameInfo(fileName, position, preferences) {
|
|
145945
|
-
return this.forwardJSONCall(
|
|
145946
|
-
`getRenameInfo('${fileName}', ${position})`,
|
|
145947
|
-
() => this.languageService.getRenameInfo(fileName, position, preferences)
|
|
145948
|
-
);
|
|
145949
|
-
}
|
|
145950
|
-
getSmartSelectionRange(fileName, position) {
|
|
145951
|
-
return this.forwardJSONCall(
|
|
145952
|
-
`getSmartSelectionRange('${fileName}', ${position})`,
|
|
145953
|
-
() => this.languageService.getSmartSelectionRange(fileName, position)
|
|
145954
|
-
);
|
|
145955
|
-
}
|
|
145956
|
-
findRenameLocations(fileName, position, findInStrings, findInComments, preferences) {
|
|
145957
|
-
return this.forwardJSONCall(
|
|
145958
|
-
`findRenameLocations('${fileName}', ${position}, ${findInStrings}, ${findInComments})`,
|
|
145959
|
-
() => this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments, preferences)
|
|
145960
|
-
);
|
|
145961
|
-
}
|
|
145962
|
-
/// GET BRACE MATCHING
|
|
145963
|
-
getBraceMatchingAtPosition(fileName, position) {
|
|
145964
|
-
return this.forwardJSONCall(
|
|
145965
|
-
`getBraceMatchingAtPosition('${fileName}', ${position})`,
|
|
145966
|
-
() => this.languageService.getBraceMatchingAtPosition(fileName, position)
|
|
145967
|
-
);
|
|
145968
|
-
}
|
|
145969
|
-
isValidBraceCompletionAtPosition(fileName, position, openingBrace) {
|
|
145970
|
-
return this.forwardJSONCall(
|
|
145971
|
-
`isValidBraceCompletionAtPosition('${fileName}', ${position}, ${openingBrace})`,
|
|
145972
|
-
() => this.languageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace)
|
|
145973
|
-
);
|
|
145974
|
-
}
|
|
145975
|
-
getSpanOfEnclosingComment(fileName, position, onlyMultiLine) {
|
|
145976
|
-
return this.forwardJSONCall(
|
|
145977
|
-
`getSpanOfEnclosingComment('${fileName}', ${position})`,
|
|
145978
|
-
() => this.languageService.getSpanOfEnclosingComment(fileName, position, onlyMultiLine)
|
|
145979
|
-
);
|
|
145980
|
-
}
|
|
145981
|
-
/// GET SMART INDENT
|
|
145982
|
-
getIndentationAtPosition(fileName, position, options) {
|
|
145983
|
-
return this.forwardJSONCall(
|
|
145984
|
-
`getIndentationAtPosition('${fileName}', ${position})`,
|
|
145985
|
-
() => {
|
|
145986
|
-
const localOptions = JSON.parse(options);
|
|
145987
|
-
return this.languageService.getIndentationAtPosition(fileName, position, localOptions);
|
|
145988
|
-
}
|
|
145989
|
-
);
|
|
145990
|
-
}
|
|
145991
|
-
/// GET REFERENCES
|
|
145992
|
-
getReferencesAtPosition(fileName, position) {
|
|
145993
|
-
return this.forwardJSONCall(
|
|
145994
|
-
`getReferencesAtPosition('${fileName}', ${position})`,
|
|
145995
|
-
() => this.languageService.getReferencesAtPosition(fileName, position)
|
|
145996
|
-
);
|
|
145997
|
-
}
|
|
145998
|
-
findReferences(fileName, position) {
|
|
145999
|
-
return this.forwardJSONCall(
|
|
146000
|
-
`findReferences('${fileName}', ${position})`,
|
|
146001
|
-
() => this.languageService.findReferences(fileName, position)
|
|
146002
|
-
);
|
|
146003
|
-
}
|
|
146004
|
-
getFileReferences(fileName) {
|
|
146005
|
-
return this.forwardJSONCall(
|
|
146006
|
-
`getFileReferences('${fileName})`,
|
|
146007
|
-
() => this.languageService.getFileReferences(fileName)
|
|
146008
|
-
);
|
|
146009
|
-
}
|
|
146010
|
-
getDocumentHighlights(fileName, position, filesToSearch) {
|
|
146011
|
-
return this.forwardJSONCall(
|
|
146012
|
-
`getDocumentHighlights('${fileName}', ${position})`,
|
|
146013
|
-
() => {
|
|
146014
|
-
const results = this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch));
|
|
146015
|
-
const normalizedName = toFileNameLowerCase(normalizeSlashes(fileName));
|
|
146016
|
-
return filter(results, (r) => toFileNameLowerCase(normalizeSlashes(r.fileName)) === normalizedName);
|
|
146017
|
-
}
|
|
146018
|
-
);
|
|
146019
|
-
}
|
|
146020
|
-
/// COMPLETION LISTS
|
|
146021
|
-
/**
|
|
146022
|
-
* Get a string based representation of the completions
|
|
146023
|
-
* to provide at the given source position and providing a member completion
|
|
146024
|
-
* list if requested.
|
|
146025
|
-
*/
|
|
146026
|
-
getCompletionsAtPosition(fileName, position, preferences, formattingSettings) {
|
|
146027
|
-
return this.forwardJSONCall(
|
|
146028
|
-
`getCompletionsAtPosition('${fileName}', ${position}, ${preferences}, ${formattingSettings})`,
|
|
146029
|
-
() => this.languageService.getCompletionsAtPosition(fileName, position, preferences, formattingSettings)
|
|
146030
|
-
);
|
|
146031
|
-
}
|
|
146032
|
-
/** Get a string based representation of a completion list entry details */
|
|
146033
|
-
getCompletionEntryDetails(fileName, position, entryName, formatOptions, source, preferences, data) {
|
|
146034
|
-
return this.forwardJSONCall(
|
|
146035
|
-
`getCompletionEntryDetails('${fileName}', ${position}, '${entryName}')`,
|
|
146036
|
-
() => {
|
|
146037
|
-
const localOptions = formatOptions === void 0 ? void 0 : JSON.parse(formatOptions);
|
|
146038
|
-
return this.languageService.getCompletionEntryDetails(fileName, position, entryName, localOptions, source, preferences, data);
|
|
146039
|
-
}
|
|
146040
|
-
);
|
|
146041
|
-
}
|
|
146042
|
-
getFormattingEditsForRange(fileName, start2, end, options) {
|
|
146043
|
-
return this.forwardJSONCall(
|
|
146044
|
-
`getFormattingEditsForRange('${fileName}', ${start2}, ${end})`,
|
|
146045
|
-
() => {
|
|
146046
|
-
const localOptions = JSON.parse(options);
|
|
146047
|
-
return this.languageService.getFormattingEditsForRange(fileName, start2, end, localOptions);
|
|
146048
|
-
}
|
|
146049
|
-
);
|
|
146050
|
-
}
|
|
146051
|
-
getFormattingEditsForDocument(fileName, options) {
|
|
146052
|
-
return this.forwardJSONCall(
|
|
146053
|
-
`getFormattingEditsForDocument('${fileName}')`,
|
|
146054
|
-
() => {
|
|
146055
|
-
const localOptions = JSON.parse(options);
|
|
146056
|
-
return this.languageService.getFormattingEditsForDocument(fileName, localOptions);
|
|
146057
|
-
}
|
|
146058
|
-
);
|
|
146059
|
-
}
|
|
146060
|
-
getFormattingEditsAfterKeystroke(fileName, position, key, options) {
|
|
146061
|
-
return this.forwardJSONCall(
|
|
146062
|
-
`getFormattingEditsAfterKeystroke('${fileName}', ${position}, '${key}')`,
|
|
146063
|
-
() => {
|
|
146064
|
-
const localOptions = JSON.parse(options);
|
|
146065
|
-
return this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions);
|
|
146066
|
-
}
|
|
146067
|
-
);
|
|
146068
|
-
}
|
|
146069
|
-
getDocCommentTemplateAtPosition(fileName, position, options, formatOptions) {
|
|
146070
|
-
return this.forwardJSONCall(
|
|
146071
|
-
`getDocCommentTemplateAtPosition('${fileName}', ${position})`,
|
|
146072
|
-
() => this.languageService.getDocCommentTemplateAtPosition(fileName, position, options, formatOptions)
|
|
146073
|
-
);
|
|
146074
|
-
}
|
|
146075
|
-
/// NAVIGATE TO
|
|
146076
|
-
/** Return a list of symbols that are interesting to navigate to */
|
|
146077
|
-
getNavigateToItems(searchValue, maxResultCount, fileName) {
|
|
146078
|
-
return this.forwardJSONCall(
|
|
146079
|
-
`getNavigateToItems('${searchValue}', ${maxResultCount}, ${fileName})`,
|
|
146080
|
-
() => this.languageService.getNavigateToItems(searchValue, maxResultCount, fileName)
|
|
146081
|
-
);
|
|
146082
|
-
}
|
|
146083
|
-
getNavigationBarItems(fileName) {
|
|
146084
|
-
return this.forwardJSONCall(
|
|
146085
|
-
`getNavigationBarItems('${fileName}')`,
|
|
146086
|
-
() => this.languageService.getNavigationBarItems(fileName)
|
|
146087
|
-
);
|
|
146088
|
-
}
|
|
146089
|
-
getNavigationTree(fileName) {
|
|
146090
|
-
return this.forwardJSONCall(
|
|
146091
|
-
`getNavigationTree('${fileName}')`,
|
|
146092
|
-
() => this.languageService.getNavigationTree(fileName)
|
|
146093
|
-
);
|
|
146094
|
-
}
|
|
146095
|
-
getOutliningSpans(fileName) {
|
|
146096
|
-
return this.forwardJSONCall(
|
|
146097
|
-
`getOutliningSpans('${fileName}')`,
|
|
146098
|
-
() => this.languageService.getOutliningSpans(fileName)
|
|
146099
|
-
);
|
|
146100
|
-
}
|
|
146101
|
-
getTodoComments(fileName, descriptors) {
|
|
146102
|
-
return this.forwardJSONCall(
|
|
146103
|
-
`getTodoComments('${fileName}')`,
|
|
146104
|
-
() => this.languageService.getTodoComments(fileName, JSON.parse(descriptors))
|
|
146105
|
-
);
|
|
146106
|
-
}
|
|
146107
|
-
/// CALL HIERARCHY
|
|
146108
|
-
prepareCallHierarchy(fileName, position) {
|
|
146109
|
-
return this.forwardJSONCall(
|
|
146110
|
-
`prepareCallHierarchy('${fileName}', ${position})`,
|
|
146111
|
-
() => this.languageService.prepareCallHierarchy(fileName, position)
|
|
146112
|
-
);
|
|
146113
|
-
}
|
|
146114
|
-
provideCallHierarchyIncomingCalls(fileName, position) {
|
|
146115
|
-
return this.forwardJSONCall(
|
|
146116
|
-
`provideCallHierarchyIncomingCalls('${fileName}', ${position})`,
|
|
146117
|
-
() => this.languageService.provideCallHierarchyIncomingCalls(fileName, position)
|
|
146118
|
-
);
|
|
146119
|
-
}
|
|
146120
|
-
provideCallHierarchyOutgoingCalls(fileName, position) {
|
|
146121
|
-
return this.forwardJSONCall(
|
|
146122
|
-
`provideCallHierarchyOutgoingCalls('${fileName}', ${position})`,
|
|
146123
|
-
() => this.languageService.provideCallHierarchyOutgoingCalls(fileName, position)
|
|
146124
|
-
);
|
|
146125
|
-
}
|
|
146126
|
-
provideInlayHints(fileName, span, preference) {
|
|
146127
|
-
return this.forwardJSONCall(
|
|
146128
|
-
`provideInlayHints('${fileName}', '${JSON.stringify(span)}', ${JSON.stringify(preference)})`,
|
|
146129
|
-
() => this.languageService.provideInlayHints(fileName, span, preference)
|
|
146130
|
-
);
|
|
146131
|
-
}
|
|
146132
|
-
/// Emit
|
|
146133
|
-
getEmitOutput(fileName) {
|
|
146134
|
-
return this.forwardJSONCall(
|
|
146135
|
-
`getEmitOutput('${fileName}')`,
|
|
146136
|
-
() => {
|
|
146137
|
-
const { diagnostics, ...rest } = this.languageService.getEmitOutput(fileName);
|
|
146138
|
-
return { ...rest, diagnostics: this.realizeDiagnostics(diagnostics) };
|
|
146139
|
-
}
|
|
146140
|
-
);
|
|
146141
|
-
}
|
|
146142
|
-
getEmitOutputObject(fileName) {
|
|
146143
|
-
return forwardCall(
|
|
146144
|
-
this.logger,
|
|
146145
|
-
`getEmitOutput('${fileName}')`,
|
|
146146
|
-
/*returnJson*/
|
|
146147
|
-
false,
|
|
146148
|
-
() => this.languageService.getEmitOutput(fileName),
|
|
146149
|
-
this.logPerformance
|
|
146150
|
-
);
|
|
146151
|
-
}
|
|
146152
|
-
toggleLineComment(fileName, textRange) {
|
|
146153
|
-
return this.forwardJSONCall(
|
|
146154
|
-
`toggleLineComment('${fileName}', '${JSON.stringify(textRange)}')`,
|
|
146155
|
-
() => this.languageService.toggleLineComment(fileName, textRange)
|
|
146156
|
-
);
|
|
146157
|
-
}
|
|
146158
|
-
toggleMultilineComment(fileName, textRange) {
|
|
146159
|
-
return this.forwardJSONCall(
|
|
146160
|
-
`toggleMultilineComment('${fileName}', '${JSON.stringify(textRange)}')`,
|
|
146161
|
-
() => this.languageService.toggleMultilineComment(fileName, textRange)
|
|
146162
|
-
);
|
|
146163
|
-
}
|
|
146164
|
-
commentSelection(fileName, textRange) {
|
|
146165
|
-
return this.forwardJSONCall(
|
|
146166
|
-
`commentSelection('${fileName}', '${JSON.stringify(textRange)}')`,
|
|
146167
|
-
() => this.languageService.commentSelection(fileName, textRange)
|
|
146168
|
-
);
|
|
146169
|
-
}
|
|
146170
|
-
uncommentSelection(fileName, textRange) {
|
|
146171
|
-
return this.forwardJSONCall(
|
|
146172
|
-
`uncommentSelection('${fileName}', '${JSON.stringify(textRange)}')`,
|
|
146173
|
-
() => this.languageService.uncommentSelection(fileName, textRange)
|
|
146174
|
-
);
|
|
146175
|
-
}
|
|
146176
|
-
};
|
|
146177
|
-
function convertClassifications(classifications) {
|
|
146178
|
-
return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState };
|
|
146179
|
-
}
|
|
146180
|
-
var ClassifierShimObject = class extends ShimBase {
|
|
146181
|
-
constructor(factory2, logger) {
|
|
146182
|
-
super(factory2);
|
|
146183
|
-
this.logger = logger;
|
|
146184
|
-
this.logPerformance = false;
|
|
146185
|
-
this.classifier = createClassifier();
|
|
146186
|
-
}
|
|
146187
|
-
getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent = false) {
|
|
146188
|
-
return forwardJSONCall(this.logger, "getEncodedLexicalClassifications", () => convertClassifications(this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)), this.logPerformance);
|
|
146189
|
-
}
|
|
146190
|
-
/// COLORIZATION
|
|
146191
|
-
getClassificationsForLine(text, lexState, classifyKeywordsInGenerics = false) {
|
|
146192
|
-
const classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics);
|
|
146193
|
-
let result = "";
|
|
146194
|
-
for (const item of classification.entries) {
|
|
146195
|
-
result += item.length + "\n";
|
|
146196
|
-
result += item.classification + "\n";
|
|
146197
|
-
}
|
|
146198
|
-
result += classification.finalLexState;
|
|
146199
|
-
return result;
|
|
146200
|
-
}
|
|
146201
|
-
};
|
|
146202
|
-
var CoreServicesShimObject = class extends ShimBase {
|
|
146203
|
-
constructor(factory2, logger, host) {
|
|
146204
|
-
super(factory2);
|
|
146205
|
-
this.logger = logger;
|
|
146206
|
-
this.host = host;
|
|
146207
|
-
this.logPerformance = false;
|
|
146208
|
-
}
|
|
146209
|
-
forwardJSONCall(actionDescription2, action) {
|
|
146210
|
-
return forwardJSONCall(this.logger, actionDescription2, action, this.logPerformance);
|
|
146211
|
-
}
|
|
146212
|
-
resolveModuleName(fileName, moduleName, compilerOptionsJson) {
|
|
146213
|
-
return this.forwardJSONCall(`resolveModuleName('${fileName}')`, () => {
|
|
146214
|
-
const compilerOptions = JSON.parse(compilerOptionsJson);
|
|
146215
|
-
const result = resolveModuleName(moduleName, normalizeSlashes(fileName), compilerOptions, this.host);
|
|
146216
|
-
let resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : void 0;
|
|
146217
|
-
if (result.resolvedModule && result.resolvedModule.extension !== ".ts" /* Ts */ && result.resolvedModule.extension !== ".tsx" /* Tsx */ && result.resolvedModule.extension !== ".d.ts" /* Dts */) {
|
|
146218
|
-
resolvedFileName = void 0;
|
|
146219
|
-
}
|
|
146220
|
-
return {
|
|
146221
|
-
resolvedFileName,
|
|
146222
|
-
failedLookupLocations: result.failedLookupLocations,
|
|
146223
|
-
affectingLocations: result.affectingLocations
|
|
146224
|
-
};
|
|
146225
|
-
});
|
|
146226
|
-
}
|
|
146227
|
-
resolveTypeReferenceDirective(fileName, typeReferenceDirective, compilerOptionsJson) {
|
|
146228
|
-
return this.forwardJSONCall(`resolveTypeReferenceDirective(${fileName})`, () => {
|
|
146229
|
-
const compilerOptions = JSON.parse(compilerOptionsJson);
|
|
146230
|
-
const result = resolveTypeReferenceDirective(typeReferenceDirective, normalizeSlashes(fileName), compilerOptions, this.host);
|
|
146231
|
-
return {
|
|
146232
|
-
resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : void 0,
|
|
146233
|
-
primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true,
|
|
146234
|
-
failedLookupLocations: result.failedLookupLocations
|
|
146235
|
-
};
|
|
146236
|
-
});
|
|
146237
|
-
}
|
|
146238
|
-
getPreProcessedFileInfo(fileName, sourceTextSnapshot) {
|
|
146239
|
-
return this.forwardJSONCall(
|
|
146240
|
-
`getPreProcessedFileInfo('${fileName}')`,
|
|
146241
|
-
() => {
|
|
146242
|
-
const result = preProcessFile(
|
|
146243
|
-
getSnapshotText(sourceTextSnapshot),
|
|
146244
|
-
/*readImportFiles*/
|
|
146245
|
-
true,
|
|
146246
|
-
/*detectJavaScriptImports*/
|
|
146247
|
-
true
|
|
146248
|
-
);
|
|
146249
|
-
return {
|
|
146250
|
-
referencedFiles: this.convertFileReferences(result.referencedFiles),
|
|
146251
|
-
importedFiles: this.convertFileReferences(result.importedFiles),
|
|
146252
|
-
ambientExternalModules: result.ambientExternalModules,
|
|
146253
|
-
isLibFile: result.isLibFile,
|
|
146254
|
-
typeReferenceDirectives: this.convertFileReferences(result.typeReferenceDirectives),
|
|
146255
|
-
libReferenceDirectives: this.convertFileReferences(result.libReferenceDirectives)
|
|
146256
|
-
};
|
|
146257
|
-
}
|
|
146258
|
-
);
|
|
146259
|
-
}
|
|
146260
|
-
getAutomaticTypeDirectiveNames(compilerOptionsJson) {
|
|
146261
|
-
return this.forwardJSONCall(
|
|
146262
|
-
`getAutomaticTypeDirectiveNames('${compilerOptionsJson}')`,
|
|
146263
|
-
() => {
|
|
146264
|
-
const compilerOptions = JSON.parse(compilerOptionsJson);
|
|
146265
|
-
return getAutomaticTypeDirectiveNames(compilerOptions, this.host);
|
|
146266
|
-
}
|
|
146267
|
-
);
|
|
146268
|
-
}
|
|
146269
|
-
convertFileReferences(refs) {
|
|
146270
|
-
if (!refs) {
|
|
146271
|
-
return void 0;
|
|
146272
|
-
}
|
|
146273
|
-
const result = [];
|
|
146274
|
-
for (const ref of refs) {
|
|
146275
|
-
result.push({
|
|
146276
|
-
path: normalizeSlashes(ref.fileName),
|
|
146277
|
-
position: ref.pos,
|
|
146278
|
-
length: ref.end - ref.pos
|
|
146279
|
-
});
|
|
146280
|
-
}
|
|
146281
|
-
return result;
|
|
146282
|
-
}
|
|
146283
|
-
getTSConfigFileInfo(fileName, sourceTextSnapshot) {
|
|
146284
|
-
return this.forwardJSONCall(
|
|
146285
|
-
`getTSConfigFileInfo('${fileName}')`,
|
|
146286
|
-
() => {
|
|
146287
|
-
const result = parseJsonText(fileName, getSnapshotText(sourceTextSnapshot));
|
|
146288
|
-
const normalizedFileName = normalizeSlashes(fileName);
|
|
146289
|
-
const configFile = parseJsonSourceFileConfigFileContent(
|
|
146290
|
-
result,
|
|
146291
|
-
this.host,
|
|
146292
|
-
getDirectoryPath(normalizedFileName),
|
|
146293
|
-
/*existingOptions*/
|
|
146294
|
-
{},
|
|
146295
|
-
normalizedFileName
|
|
146296
|
-
);
|
|
146297
|
-
return {
|
|
146298
|
-
options: configFile.options,
|
|
146299
|
-
typeAcquisition: configFile.typeAcquisition,
|
|
146300
|
-
files: configFile.fileNames,
|
|
146301
|
-
raw: configFile.raw,
|
|
146302
|
-
errors: realizeDiagnostics([...result.parseDiagnostics, ...configFile.errors], "\r\n")
|
|
146303
|
-
};
|
|
146304
|
-
}
|
|
146305
|
-
);
|
|
146306
|
-
}
|
|
146307
|
-
getDefaultCompilationSettings() {
|
|
146308
|
-
return this.forwardJSONCall(
|
|
146309
|
-
"getDefaultCompilationSettings()",
|
|
146310
|
-
() => getDefaultCompilerOptions2()
|
|
146311
|
-
);
|
|
146312
|
-
}
|
|
146313
|
-
discoverTypings(discoverTypingsJson) {
|
|
146314
|
-
const getCanonicalFileName = createGetCanonicalFileName(
|
|
146315
|
-
/*useCaseSensitiveFileNames*/
|
|
146316
|
-
false
|
|
146317
|
-
);
|
|
146318
|
-
return this.forwardJSONCall("discoverTypings()", () => {
|
|
146319
|
-
const info = JSON.parse(discoverTypingsJson);
|
|
146320
|
-
if (this.safeList === void 0) {
|
|
146321
|
-
this.safeList = ts_JsTyping_exports.loadSafeList(this.host, toPath(info.safeListPath, info.safeListPath, getCanonicalFileName));
|
|
146322
|
-
}
|
|
146323
|
-
return ts_JsTyping_exports.discoverTypings(
|
|
146324
|
-
this.host,
|
|
146325
|
-
(msg) => this.logger.log(msg),
|
|
146326
|
-
info.fileNames,
|
|
146327
|
-
toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName),
|
|
146328
|
-
this.safeList,
|
|
146329
|
-
info.packageNameToTypingLocation,
|
|
146330
|
-
info.typeAcquisition,
|
|
146331
|
-
info.unresolvedImports,
|
|
146332
|
-
info.typesRegistry,
|
|
146333
|
-
emptyOptions
|
|
146334
|
-
);
|
|
146335
|
-
});
|
|
146336
|
-
}
|
|
146337
|
-
};
|
|
146338
|
-
var TypeScriptServicesFactory = class {
|
|
146339
|
-
constructor() {
|
|
146340
|
-
this._shims = [];
|
|
146341
|
-
}
|
|
146342
|
-
/*
|
|
146343
|
-
* Returns script API version.
|
|
146344
|
-
*/
|
|
146345
|
-
getServicesVersion() {
|
|
146346
|
-
return servicesVersion;
|
|
146347
|
-
}
|
|
146348
|
-
createLanguageServiceShim(host) {
|
|
146349
|
-
try {
|
|
146350
|
-
if (this.documentRegistry === void 0) {
|
|
146351
|
-
this.documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory());
|
|
146352
|
-
}
|
|
146353
|
-
const hostAdapter = new LanguageServiceShimHostAdapter(host);
|
|
146354
|
-
const languageService = createLanguageService(
|
|
146355
|
-
hostAdapter,
|
|
146356
|
-
this.documentRegistry,
|
|
146357
|
-
/*syntaxOnlyOrLanguageServiceMode*/
|
|
146358
|
-
false
|
|
146359
|
-
);
|
|
146360
|
-
return new LanguageServiceShimObject(this, host, languageService);
|
|
146361
|
-
} catch (err) {
|
|
146362
|
-
logInternalError(host, err);
|
|
146363
|
-
throw err;
|
|
146364
|
-
}
|
|
146365
|
-
}
|
|
146366
|
-
createClassifierShim(logger) {
|
|
146367
|
-
try {
|
|
146368
|
-
return new ClassifierShimObject(this, logger);
|
|
146369
|
-
} catch (err) {
|
|
146370
|
-
logInternalError(logger, err);
|
|
146371
|
-
throw err;
|
|
146372
|
-
}
|
|
146373
|
-
}
|
|
146374
|
-
createCoreServicesShim(host) {
|
|
146375
|
-
try {
|
|
146376
|
-
const adapter = new CoreServicesShimHostAdapter(host);
|
|
146377
|
-
return new CoreServicesShimObject(this, host, adapter);
|
|
146378
|
-
} catch (err) {
|
|
146379
|
-
logInternalError(host, err);
|
|
146380
|
-
throw err;
|
|
146381
|
-
}
|
|
146382
|
-
}
|
|
146383
|
-
close() {
|
|
146384
|
-
clear(this._shims);
|
|
146385
|
-
this.documentRegistry = void 0;
|
|
146386
|
-
}
|
|
146387
|
-
registerShim(shim) {
|
|
146388
|
-
this._shims.push(shim);
|
|
146389
|
-
}
|
|
146390
|
-
unregisterShim(shim) {
|
|
146391
|
-
for (let i = 0; i < this._shims.length; i++) {
|
|
146392
|
-
if (this._shims[i] === shim) {
|
|
146393
|
-
delete this._shims[i];
|
|
146394
|
-
return;
|
|
146395
|
-
}
|
|
146396
|
-
}
|
|
146397
|
-
throw new Error("Invalid operation");
|
|
146398
|
-
}
|
|
146399
|
-
};
|
|
146400
|
-
|
|
146401
145541
|
// src/services/_namespaces/ts.BreakpointResolver.ts
|
|
146402
145542
|
var ts_BreakpointResolver_exports = {};
|
|
146403
145543
|
__export(ts_BreakpointResolver_exports, {
|
|
@@ -172796,7 +171936,6 @@ __export(ts_exports2, {
|
|
|
172796
171936
|
ConfigFileProgramReloadLevel: () => ConfigFileProgramReloadLevel,
|
|
172797
171937
|
ContainerFlags: () => ContainerFlags,
|
|
172798
171938
|
ContextFlags: () => ContextFlags,
|
|
172799
|
-
CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter,
|
|
172800
171939
|
Debug: () => Debug,
|
|
172801
171940
|
DiagnosticCategory: () => DiagnosticCategory,
|
|
172802
171941
|
Diagnostics: () => Diagnostics,
|
|
@@ -172845,7 +171984,6 @@ __export(ts_exports2, {
|
|
|
172845
171984
|
JsxFlags: () => JsxFlags,
|
|
172846
171985
|
JsxReferenceKind: () => JsxReferenceKind,
|
|
172847
171986
|
LanguageServiceMode: () => LanguageServiceMode,
|
|
172848
|
-
LanguageServiceShimHostAdapter: () => LanguageServiceShimHostAdapter,
|
|
172849
171987
|
LanguageVariant: () => LanguageVariant,
|
|
172850
171988
|
LexicalEnvironmentFlags: () => LexicalEnvironmentFlags,
|
|
172851
171989
|
ListFormat: () => ListFormat,
|
|
@@ -172919,7 +172057,6 @@ __export(ts_exports2, {
|
|
|
172919
172057
|
TypeMapKind: () => TypeMapKind,
|
|
172920
172058
|
TypePredicateKind: () => TypePredicateKind,
|
|
172921
172059
|
TypeReferenceSerializationKind: () => TypeReferenceSerializationKind,
|
|
172922
|
-
TypeScriptServicesFactory: () => TypeScriptServicesFactory,
|
|
172923
172060
|
UnionReduction: () => UnionReduction,
|
|
172924
172061
|
UpToDateStatusType: () => UpToDateStatusType,
|
|
172925
172062
|
VarianceFlags: () => VarianceFlags,
|
|
@@ -174182,6 +173319,7 @@ __export(ts_exports2, {
|
|
|
174182
173319
|
isInsideJsxElementOrAttribute: () => isInsideJsxElementOrAttribute,
|
|
174183
173320
|
isInsideNodeModules: () => isInsideNodeModules,
|
|
174184
173321
|
isInsideTemplateLiteral: () => isInsideTemplateLiteral,
|
|
173322
|
+
isInstanceOfExpression: () => isInstanceOfExpression,
|
|
174185
173323
|
isInstantiatedModule: () => isInstantiatedModule,
|
|
174186
173324
|
isInterfaceDeclaration: () => isInterfaceDeclaration,
|
|
174187
173325
|
isInternalDeclaration: () => isInternalDeclaration,
|
|
@@ -174439,6 +173577,7 @@ __export(ts_exports2, {
|
|
|
174439
173577
|
isReturnStatement: () => isReturnStatement,
|
|
174440
173578
|
isReturnStatementWithFixablePromiseHandler: () => isReturnStatementWithFixablePromiseHandler,
|
|
174441
173579
|
isRightSideOfAccessExpression: () => isRightSideOfAccessExpression,
|
|
173580
|
+
isRightSideOfInstanceofExpression: () => isRightSideOfInstanceofExpression,
|
|
174442
173581
|
isRightSideOfPropertyAccess: () => isRightSideOfPropertyAccess,
|
|
174443
173582
|
isRightSideOfQualifiedName: () => isRightSideOfQualifiedName,
|
|
174444
173583
|
isRightSideOfQualifiedNameOrPropertyAccess: () => isRightSideOfQualifiedNameOrPropertyAccess,
|
|
@@ -174763,7 +173902,6 @@ __export(ts_exports2, {
|
|
|
174763
173902
|
readJson: () => readJson,
|
|
174764
173903
|
readJsonConfigFile: () => readJsonConfigFile,
|
|
174765
173904
|
readJsonOrUndefined: () => readJsonOrUndefined,
|
|
174766
|
-
realizeDiagnostics: () => realizeDiagnostics,
|
|
174767
173905
|
reduceEachLeadingCommentRange: () => reduceEachLeadingCommentRange,
|
|
174768
173906
|
reduceEachTrailingCommentRange: () => reduceEachTrailingCommentRange,
|
|
174769
173907
|
reduceLeft: () => reduceLeft,
|
|
@@ -187477,7 +186615,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
187477
186615
|
ConfigFileProgramReloadLevel,
|
|
187478
186616
|
ContainerFlags,
|
|
187479
186617
|
ContextFlags,
|
|
187480
|
-
CoreServicesShimHostAdapter,
|
|
187481
186618
|
Debug,
|
|
187482
186619
|
DiagnosticCategory,
|
|
187483
186620
|
Diagnostics,
|
|
@@ -187526,7 +186663,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
187526
186663
|
JsxFlags,
|
|
187527
186664
|
JsxReferenceKind,
|
|
187528
186665
|
LanguageServiceMode,
|
|
187529
|
-
LanguageServiceShimHostAdapter,
|
|
187530
186666
|
LanguageVariant,
|
|
187531
186667
|
LexicalEnvironmentFlags,
|
|
187532
186668
|
ListFormat,
|
|
@@ -187600,7 +186736,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
187600
186736
|
TypeMapKind,
|
|
187601
186737
|
TypePredicateKind,
|
|
187602
186738
|
TypeReferenceSerializationKind,
|
|
187603
|
-
TypeScriptServicesFactory,
|
|
187604
186739
|
UnionReduction,
|
|
187605
186740
|
UpToDateStatusType,
|
|
187606
186741
|
VarianceFlags,
|
|
@@ -188863,6 +187998,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
188863
187998
|
isInsideJsxElementOrAttribute,
|
|
188864
187999
|
isInsideNodeModules,
|
|
188865
188000
|
isInsideTemplateLiteral,
|
|
188001
|
+
isInstanceOfExpression,
|
|
188866
188002
|
isInstantiatedModule,
|
|
188867
188003
|
isInterfaceDeclaration,
|
|
188868
188004
|
isInternalDeclaration,
|
|
@@ -189120,6 +188256,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
189120
188256
|
isReturnStatement,
|
|
189121
188257
|
isReturnStatementWithFixablePromiseHandler,
|
|
189122
188258
|
isRightSideOfAccessExpression,
|
|
188259
|
+
isRightSideOfInstanceofExpression,
|
|
189123
188260
|
isRightSideOfPropertyAccess,
|
|
189124
188261
|
isRightSideOfQualifiedName,
|
|
189125
188262
|
isRightSideOfQualifiedNameOrPropertyAccess,
|
|
@@ -189444,7 +188581,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
189444
188581
|
readJson,
|
|
189445
188582
|
readJsonConfigFile,
|
|
189446
188583
|
readJsonOrUndefined,
|
|
189447
|
-
realizeDiagnostics,
|
|
189448
188584
|
reduceEachLeadingCommentRange,
|
|
189449
188585
|
reduceEachTrailingCommentRange,
|
|
189450
188586
|
reduceLeft,
|