typescript 4.7.0-dev.20220425 → 4.7.0-dev.20220428
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/protocol.d.ts +1 -0
- package/lib/tsc.js +44 -18
- package/lib/tsserver.js +156 -60
- package/lib/tsserverlibrary.d.ts +12 -0
- package/lib/tsserverlibrary.js +156 -60
- package/lib/typescript.d.ts +11 -0
- package/lib/typescript.js +149 -53
- package/lib/typescriptServices.d.ts +11 -0
- package/lib/typescriptServices.js +149 -53
- package/lib/typingsInstaller.js +47 -19
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220428";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -8872,6 +8872,7 @@ var ts;
|
|
|
8872
8872
|
This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, ts.DiagnosticCategory.Error, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
|
|
8873
8873
|
A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, ts.DiagnosticCategory.Error, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
|
|
8874
8874
|
Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses: diag(2809, ts.DiagnosticCategory.Error, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses."),
|
|
8875
|
+
Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments: diag(2810, ts.DiagnosticCategory.Error, "Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810", "Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),
|
|
8875
8876
|
Initializer_for_property_0: diag(2811, ts.DiagnosticCategory.Error, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
|
|
8876
8877
|
Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
|
|
8877
8878
|
Class_declaration_cannot_implement_overload_list_for_0: diag(2813, ts.DiagnosticCategory.Error, "Class_declaration_cannot_implement_overload_list_for_0_2813", "Class declaration cannot implement overload list for '{0}'."),
|
|
@@ -37962,7 +37963,8 @@ var ts;
|
|
|
37962
37963
|
if (!comment) {
|
|
37963
37964
|
comment = parseTrailingTagComments(start, getNodePos(), indent, indentText);
|
|
37964
37965
|
}
|
|
37965
|
-
|
|
37966
|
+
var end = comment !== undefined ? getNodePos() : typeExpression.end;
|
|
37967
|
+
return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start, end);
|
|
37966
37968
|
}
|
|
37967
37969
|
function escapedTextsEqual(a, b) {
|
|
37968
37970
|
while (!ts.isIdentifier(a) || !ts.isIdentifier(b)) {
|
|
@@ -48336,6 +48338,7 @@ var ts;
|
|
|
48336
48338
|
var keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
|
|
48337
48339
|
var numberOrBigIntType = getUnionType([numberType, bigintType]);
|
|
48338
48340
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
48341
|
+
var numericStringType = getTemplateLiteralType(["", ""], [numberType]); // The `${number}` type
|
|
48339
48342
|
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
|
|
48340
48343
|
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
|
|
48341
48344
|
var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
|
|
@@ -51317,7 +51320,7 @@ var ts;
|
|
|
51317
51320
|
}
|
|
51318
51321
|
}
|
|
51319
51322
|
function getExportSymbolOfValueSymbolIfExported(symbol) {
|
|
51320
|
-
return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0
|
|
51323
|
+
return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
|
|
51321
51324
|
}
|
|
51322
51325
|
function symbolIsValue(symbol) {
|
|
51323
51326
|
return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */ && !getTypeOnlyAliasDeclaration(symbol));
|
|
@@ -58720,7 +58723,7 @@ var ts;
|
|
|
58720
58723
|
var typeVariable = getHomomorphicTypeVariable(type);
|
|
58721
58724
|
if (typeVariable && !type.declaration.nameType) {
|
|
58722
58725
|
var constraint = getConstraintOfTypeParameter(typeVariable);
|
|
58723
|
-
if (constraint && (
|
|
58726
|
+
if (constraint && isArrayOrTupleType(constraint)) {
|
|
58724
58727
|
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
58725
58728
|
}
|
|
58726
58729
|
}
|
|
@@ -59082,10 +59085,10 @@ var ts;
|
|
|
59082
59085
|
}
|
|
59083
59086
|
function isApplicableIndexType(source, target) {
|
|
59084
59087
|
// A 'string' index signature applies to types assignable to 'string' or 'number', and a 'number' index
|
|
59085
|
-
// signature applies to types assignable to 'number' and numeric string literal types.
|
|
59088
|
+
// signature applies to types assignable to 'number', `${number}` and numeric string literal types.
|
|
59086
59089
|
return isTypeAssignableTo(source, target) ||
|
|
59087
59090
|
target === stringType && isTypeAssignableTo(source, numberType) ||
|
|
59088
|
-
target === numberType && !!(source.flags & 128 /* StringLiteral */) && ts.isNumericLiteralName(source.value);
|
|
59091
|
+
target === numberType && (source === numericStringType || !!(source.flags & 128 /* StringLiteral */) && ts.isNumericLiteralName(source.value));
|
|
59089
59092
|
}
|
|
59090
59093
|
function getIndexInfosOfStructuredType(type) {
|
|
59091
59094
|
if (type.flags & 3670016 /* StructuredType */) {
|
|
@@ -60101,6 +60104,20 @@ var ts;
|
|
|
60101
60104
|
constraints = ts.append(constraints, constraint);
|
|
60102
60105
|
}
|
|
60103
60106
|
}
|
|
60107
|
+
// Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the
|
|
60108
|
+
// template type XXX, K has an added constraint of number | `${number}`.
|
|
60109
|
+
else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 195 /* MappedType */ && node === parent.type) {
|
|
60110
|
+
var mappedType = getTypeFromTypeNode(parent);
|
|
60111
|
+
if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
|
|
60112
|
+
var typeParameter = getHomomorphicTypeVariable(mappedType);
|
|
60113
|
+
if (typeParameter) {
|
|
60114
|
+
var constraint = getConstraintOfTypeParameter(typeParameter);
|
|
60115
|
+
if (constraint && everyType(constraint, isArrayOrTupleType)) {
|
|
60116
|
+
constraints = ts.append(constraints, getUnionType([numberType, numericStringType]));
|
|
60117
|
+
}
|
|
60118
|
+
}
|
|
60119
|
+
}
|
|
60120
|
+
}
|
|
60104
60121
|
node = parent;
|
|
60105
60122
|
}
|
|
60106
60123
|
return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type;
|
|
@@ -61068,7 +61085,7 @@ var ts;
|
|
|
61068
61085
|
while (i > 0) {
|
|
61069
61086
|
i--;
|
|
61070
61087
|
var t = types[i];
|
|
61071
|
-
var remove = t.flags & 4 /* String */ && includes & 128 /* StringLiteral */ ||
|
|
61088
|
+
var remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
|
|
61072
61089
|
t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
|
|
61073
61090
|
t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
|
|
61074
61091
|
t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */;
|
|
@@ -61227,7 +61244,7 @@ var ts;
|
|
|
61227
61244
|
if (!strictNullChecks && includes & 98304 /* Nullable */) {
|
|
61228
61245
|
return includes & 32768 /* Undefined */ ? undefinedType : nullType;
|
|
61229
61246
|
}
|
|
61230
|
-
if (includes & 4 /* String */ && includes & 128 /* StringLiteral */ ||
|
|
61247
|
+
if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
|
|
61231
61248
|
includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
|
|
61232
61249
|
includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
|
|
61233
61250
|
includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */) {
|
|
@@ -63111,7 +63128,7 @@ var ts;
|
|
|
63111
63128
|
if (!type.declaration.nameType) {
|
|
63112
63129
|
var constraint = void 0;
|
|
63113
63130
|
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 &&
|
|
63114
|
-
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint,
|
|
63131
|
+
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
63115
63132
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
63116
63133
|
}
|
|
63117
63134
|
if (isGenericTupleType(t)) {
|
|
@@ -64549,7 +64566,7 @@ var ts;
|
|
|
64549
64566
|
}
|
|
64550
64567
|
return false;
|
|
64551
64568
|
}
|
|
64552
|
-
return
|
|
64569
|
+
return isArrayOrTupleType(target);
|
|
64553
64570
|
}
|
|
64554
64571
|
if (isReadonlyArrayType(source) && isMutableArrayOrTuple(target)) {
|
|
64555
64572
|
if (reportErrors) {
|
|
@@ -64679,7 +64696,7 @@ var ts;
|
|
|
64679
64696
|
// We suppress recursive intersection property checks because they can generate lots of work when relating
|
|
64680
64697
|
// recursive intersections that are structurally similar but not exactly identical. See #37854.
|
|
64681
64698
|
if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
|
|
64682
|
-
isNonGenericObjectType(target) && !
|
|
64699
|
+
isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* Intersection */ && getApparentType(source).flags & 3670016 /* StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* NonInferrableType */); }))) {
|
|
64683
64700
|
inPropertyCheck = true;
|
|
64684
64701
|
result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* PropertyCheck */, recursionFlags);
|
|
64685
64702
|
inPropertyCheck = false;
|
|
@@ -65667,7 +65684,7 @@ var ts;
|
|
|
65667
65684
|
return varianceResult;
|
|
65668
65685
|
}
|
|
65669
65686
|
}
|
|
65670
|
-
else if (isReadonlyArrayType(target) ?
|
|
65687
|
+
else if (isReadonlyArrayType(target) ? isArrayOrTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
|
|
65671
65688
|
if (relation !== identityRelation) {
|
|
65672
65689
|
return isRelatedTo(getIndexTypeOfType(source, numberType) || anyType, getIndexTypeOfType(target, numberType) || anyType, 3 /* Both */, reportErrors);
|
|
65673
65690
|
}
|
|
@@ -66043,7 +66060,7 @@ var ts;
|
|
|
66043
66060
|
}
|
|
66044
66061
|
var result = -1 /* True */;
|
|
66045
66062
|
if (isTupleType(target)) {
|
|
66046
|
-
if (
|
|
66063
|
+
if (isArrayOrTupleType(source)) {
|
|
66047
66064
|
if (!target.target.readonly && (isReadonlyArrayType(source) || isTupleType(source) && source.target.readonly)) {
|
|
66048
66065
|
return 0 /* False */;
|
|
66049
66066
|
}
|
|
@@ -67004,6 +67021,9 @@ var ts;
|
|
|
67004
67021
|
function isReadonlyArrayType(type) {
|
|
67005
67022
|
return !!(ts.getObjectFlags(type) & 4 /* Reference */) && type.target === globalReadonlyArrayType;
|
|
67006
67023
|
}
|
|
67024
|
+
function isArrayOrTupleType(type) {
|
|
67025
|
+
return isArrayType(type) || isTupleType(type);
|
|
67026
|
+
}
|
|
67007
67027
|
function isMutableArrayOrTuple(type) {
|
|
67008
67028
|
return isArrayType(type) && !isReadonlyArrayType(type) || isTupleType(type) && !type.target.readonly;
|
|
67009
67029
|
}
|
|
@@ -67455,7 +67475,7 @@ var ts;
|
|
|
67455
67475
|
else if (type.flags & 2097152 /* Intersection */) {
|
|
67456
67476
|
result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
|
|
67457
67477
|
}
|
|
67458
|
-
else if (
|
|
67478
|
+
else if (isArrayOrTupleType(type)) {
|
|
67459
67479
|
result = createTypeReference(type.target, ts.sameMap(getTypeArguments(type), getWidenedType));
|
|
67460
67480
|
}
|
|
67461
67481
|
if (result && context === undefined) {
|
|
@@ -67492,7 +67512,7 @@ var ts;
|
|
|
67492
67512
|
}
|
|
67493
67513
|
}
|
|
67494
67514
|
}
|
|
67495
|
-
if (
|
|
67515
|
+
if (isArrayOrTupleType(type)) {
|
|
67496
67516
|
for (var _b = 0, _c = getTypeArguments(type); _b < _c.length; _b++) {
|
|
67497
67517
|
var t = _c[_b];
|
|
67498
67518
|
if (reportWideningErrorsInType(t)) {
|
|
@@ -68553,7 +68573,7 @@ var ts;
|
|
|
68553
68573
|
}
|
|
68554
68574
|
// Infer from the members of source and target only if the two types are possibly related
|
|
68555
68575
|
if (!typesDefinitelyUnrelated(source, target)) {
|
|
68556
|
-
if (
|
|
68576
|
+
if (isArrayOrTupleType(source)) {
|
|
68557
68577
|
if (isTupleType(target)) {
|
|
68558
68578
|
var sourceArity = getTypeReferenceArity(source);
|
|
68559
68579
|
var targetArity = getTypeReferenceArity(target);
|
|
@@ -75574,8 +75594,14 @@ var ts;
|
|
|
75574
75594
|
var parameterRange = hasRestParameter ? min
|
|
75575
75595
|
: min < max ? min + "-" + max
|
|
75576
75596
|
: min;
|
|
75577
|
-
var
|
|
75578
|
-
|
|
75597
|
+
var isVoidPromiseError = !hasRestParameter && parameterRange === 1 && args.length === 0 && isPromiseResolveArityError(node);
|
|
75598
|
+
if (isVoidPromiseError && ts.isInJSFile(node)) {
|
|
75599
|
+
return getDiagnosticForCallNode(node, ts.Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments);
|
|
75600
|
+
}
|
|
75601
|
+
var error = hasRestParameter
|
|
75602
|
+
? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1
|
|
75603
|
+
: isVoidPromiseError
|
|
75604
|
+
? ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise
|
|
75579
75605
|
: ts.Diagnostics.Expected_0_arguments_but_got_1;
|
|
75580
75606
|
if (min < args.length && args.length < max) {
|
|
75581
75607
|
// between min and max, but with no matching overload
|
|
@@ -108498,6 +108524,8 @@ var ts;
|
|
|
108498
108524
|
var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
|
|
108499
108525
|
errorFallbackNode = undefined;
|
|
108500
108526
|
var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* Const */));
|
|
108527
|
+
preserveJsDoc(statement, input);
|
|
108528
|
+
ts.removeAllComments(input);
|
|
108501
108529
|
return [statement, factory.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
|
|
108502
108530
|
}
|
|
108503
108531
|
}
|
|
@@ -124882,7 +124910,7 @@ var ts;
|
|
|
124882
124910
|
if (!state.watch || !state.lastCachedPackageJsonLookups)
|
|
124883
124911
|
return;
|
|
124884
124912
|
ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
|
|
124885
|
-
createNewValue: function (path, _input) { return state.watchFile(path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.
|
|
124913
|
+
createNewValue: function (path, _input) { return state.watchFile(path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.None); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.PackageJson, resolved); },
|
|
124886
124914
|
onDeleteValue: ts.closeFileWatcher,
|
|
124887
124915
|
});
|
|
124888
124916
|
}
|
|
@@ -125210,6 +125238,17 @@ var ts;
|
|
|
125210
125238
|
SymbolDisplayPartKind[SymbolDisplayPartKind["linkName"] = 23] = "linkName";
|
|
125211
125239
|
SymbolDisplayPartKind[SymbolDisplayPartKind["linkText"] = 24] = "linkText";
|
|
125212
125240
|
})(SymbolDisplayPartKind = ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {}));
|
|
125241
|
+
// Do not change existing values, as they exist in telemetry.
|
|
125242
|
+
var CompletionInfoFlags;
|
|
125243
|
+
(function (CompletionInfoFlags) {
|
|
125244
|
+
CompletionInfoFlags[CompletionInfoFlags["None"] = 0] = "None";
|
|
125245
|
+
CompletionInfoFlags[CompletionInfoFlags["MayIncludeAutoImports"] = 1] = "MayIncludeAutoImports";
|
|
125246
|
+
CompletionInfoFlags[CompletionInfoFlags["IsImportStatementCompletion"] = 2] = "IsImportStatementCompletion";
|
|
125247
|
+
CompletionInfoFlags[CompletionInfoFlags["IsContinuation"] = 4] = "IsContinuation";
|
|
125248
|
+
CompletionInfoFlags[CompletionInfoFlags["ResolvedModuleSpecifiers"] = 8] = "ResolvedModuleSpecifiers";
|
|
125249
|
+
CompletionInfoFlags[CompletionInfoFlags["ResolvedModuleSpecifiersBeyondLimit"] = 16] = "ResolvedModuleSpecifiersBeyondLimit";
|
|
125250
|
+
CompletionInfoFlags[CompletionInfoFlags["MayIncludeMethodSnippets"] = 32] = "MayIncludeMethodSnippets";
|
|
125251
|
+
})(CompletionInfoFlags = ts.CompletionInfoFlags || (ts.CompletionInfoFlags = {}));
|
|
125213
125252
|
var OutliningSpanKind;
|
|
125214
125253
|
(function (OutliningSpanKind) {
|
|
125215
125254
|
/** Single or multi-line comments */
|
|
@@ -127222,6 +127261,14 @@ var ts;
|
|
|
127222
127261
|
return __assign(__assign({}, createModuleSpecifierResolutionHost(program, host)), { getCommonSourceDirectory: function () { return program.getCommonSourceDirectory(); } });
|
|
127223
127262
|
}
|
|
127224
127263
|
ts.getModuleSpecifierResolverHost = getModuleSpecifierResolverHost;
|
|
127264
|
+
function moduleResolutionRespectsExports(moduleResolution) {
|
|
127265
|
+
return moduleResolution >= ts.ModuleResolutionKind.Node12 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127266
|
+
}
|
|
127267
|
+
ts.moduleResolutionRespectsExports = moduleResolutionRespectsExports;
|
|
127268
|
+
function moduleResolutionUsesNodeModules(moduleResolution) {
|
|
127269
|
+
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.Node12 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127270
|
+
}
|
|
127271
|
+
ts.moduleResolutionUsesNodeModules = moduleResolutionUsesNodeModules;
|
|
127225
127272
|
function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
|
|
127226
127273
|
return defaultImport || namedImports && namedImports.length ? makeImport(defaultImport, namedImports, moduleSpecifier, quotePreference) : undefined;
|
|
127227
127274
|
}
|
|
@@ -128825,8 +128872,8 @@ var ts;
|
|
|
128825
128872
|
if (from === to)
|
|
128826
128873
|
return false;
|
|
128827
128874
|
var cachedResult = moduleSpecifierCache === null || moduleSpecifierCache === void 0 ? void 0 : moduleSpecifierCache.get(from.path, to.path, preferences, {});
|
|
128828
|
-
if ((cachedResult === null || cachedResult === void 0 ? void 0 : cachedResult.
|
|
128829
|
-
return cachedResult.
|
|
128875
|
+
if ((cachedResult === null || cachedResult === void 0 ? void 0 : cachedResult.isBlockedByPackageJsonDependencies) !== undefined) {
|
|
128876
|
+
return !cachedResult.isBlockedByPackageJsonDependencies;
|
|
128830
128877
|
}
|
|
128831
128878
|
var getCanonicalFileName = ts.hostGetCanonicalFileName(moduleSpecifierResolutionHost);
|
|
128832
128879
|
var globalTypingsCache = (_a = moduleSpecifierResolutionHost.getGlobalTypingsCacheLocation) === null || _a === void 0 ? void 0 : _a.call(moduleSpecifierResolutionHost);
|
|
@@ -128840,7 +128887,7 @@ var ts;
|
|
|
128840
128887
|
});
|
|
128841
128888
|
if (packageJsonFilter) {
|
|
128842
128889
|
var isAutoImportable = hasImportablePath && packageJsonFilter.allowsImportingSourceFile(to, moduleSpecifierResolutionHost);
|
|
128843
|
-
moduleSpecifierCache === null || moduleSpecifierCache === void 0 ? void 0 : moduleSpecifierCache.
|
|
128890
|
+
moduleSpecifierCache === null || moduleSpecifierCache === void 0 ? void 0 : moduleSpecifierCache.setBlockedByPackageJsonDependencies(from.path, to.path, preferences, {}, !isAutoImportable);
|
|
128844
128891
|
return isAutoImportable;
|
|
128845
128892
|
}
|
|
128846
128893
|
return hasImportablePath;
|
|
@@ -131119,15 +131166,26 @@ var ts;
|
|
|
131119
131166
|
var _a, _b, _c;
|
|
131120
131167
|
var start = ts.timestamp();
|
|
131121
131168
|
var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
131122
|
-
|
|
131169
|
+
// Under `--moduleResolution nodenext`, we have to resolve module specifiers up front, because
|
|
131170
|
+
// package.json exports can mean we *can't* resolve a module specifier (that doesn't include a
|
|
131171
|
+
// relative path into node_modules), and we want to filter those completions out entirely.
|
|
131172
|
+
// Import statement completions always need specifier resolution because the module specifier is
|
|
131173
|
+
// part of their `insertText`, not the `codeActions` creating edits away from the cursor.
|
|
131174
|
+
var needsFullResolution = isForImportStatementCompletion || ts.moduleResolutionRespectsExports(ts.getEmitModuleResolutionKind(program.getCompilerOptions()));
|
|
131175
|
+
var skippedAny = false;
|
|
131123
131176
|
var ambientCount = 0;
|
|
131124
131177
|
var resolvedCount = 0;
|
|
131125
131178
|
var resolvedFromCacheCount = 0;
|
|
131126
131179
|
var cacheAttemptCount = 0;
|
|
131127
|
-
var result = cb({
|
|
131180
|
+
var result = cb({
|
|
131181
|
+
tryResolve: tryResolve,
|
|
131182
|
+
skippedAny: function () { return skippedAny; },
|
|
131183
|
+
resolvedAny: function () { return resolvedCount > 0; },
|
|
131184
|
+
resolvedBeyondLimit: function () { return resolvedCount > Completions.moduleSpecifierResolutionLimit; },
|
|
131185
|
+
});
|
|
131128
131186
|
var hitRateMessage = cacheAttemptCount ? " (" + (resolvedFromCacheCount / cacheAttemptCount * 100).toFixed(1) + "% hit rate)" : "";
|
|
131129
131187
|
(_a = host.log) === null || _a === void 0 ? void 0 : _a.call(host, logPrefix + ": resolved " + resolvedCount + " module specifiers, plus " + ambientCount + " ambient and " + resolvedFromCacheCount + " from cache" + hitRateMessage);
|
|
131130
|
-
(_b = host.log) === null || _b === void 0 ? void 0 : _b.call(host, logPrefix + ": response is " + (
|
|
131188
|
+
(_b = host.log) === null || _b === void 0 ? void 0 : _b.call(host, logPrefix + ": response is " + (skippedAny ? "incomplete" : "complete"));
|
|
131131
131189
|
(_c = host.log) === null || _c === void 0 ? void 0 : _c.call(host, logPrefix + ": " + (ts.timestamp() - start));
|
|
131132
131190
|
return result;
|
|
131133
131191
|
function tryResolve(exportInfo, symbolName, isFromAmbientModule) {
|
|
@@ -131136,22 +131194,22 @@ var ts;
|
|
|
131136
131194
|
if (result_1) {
|
|
131137
131195
|
ambientCount++;
|
|
131138
131196
|
}
|
|
131139
|
-
return result_1;
|
|
131197
|
+
return result_1 || "failed";
|
|
131140
131198
|
}
|
|
131141
|
-
var shouldResolveModuleSpecifier =
|
|
131199
|
+
var shouldResolveModuleSpecifier = needsFullResolution || preferences.allowIncompleteCompletions && resolvedCount < Completions.moduleSpecifierResolutionLimit;
|
|
131142
131200
|
var shouldGetModuleSpecifierFromCache = !shouldResolveModuleSpecifier && preferences.allowIncompleteCompletions && cacheAttemptCount < Completions.moduleSpecifierResolutionCacheAttemptLimit;
|
|
131143
131201
|
var result = (shouldResolveModuleSpecifier || shouldGetModuleSpecifierFromCache)
|
|
131144
131202
|
? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
|
|
131145
131203
|
: undefined;
|
|
131146
131204
|
if (!shouldResolveModuleSpecifier && !shouldGetModuleSpecifierFromCache || shouldGetModuleSpecifierFromCache && !result) {
|
|
131147
|
-
|
|
131205
|
+
skippedAny = true;
|
|
131148
131206
|
}
|
|
131149
131207
|
resolvedCount += (result === null || result === void 0 ? void 0 : result.computedWithoutCacheCount) || 0;
|
|
131150
|
-
resolvedFromCacheCount += exportInfo.length -
|
|
131208
|
+
resolvedFromCacheCount += exportInfo.length - ((result === null || result === void 0 ? void 0 : result.computedWithoutCacheCount) || 0);
|
|
131151
131209
|
if (shouldGetModuleSpecifierFromCache) {
|
|
131152
131210
|
cacheAttemptCount++;
|
|
131153
131211
|
}
|
|
131154
|
-
return result;
|
|
131212
|
+
return result || (needsFullResolution ? "failed" : "skipped");
|
|
131155
131213
|
}
|
|
131156
131214
|
}
|
|
131157
131215
|
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext) {
|
|
@@ -131249,6 +131307,7 @@ var ts;
|
|
|
131249
131307
|
var newEntries = resolvingModuleSpecifiers("continuePreviousIncompleteResponse", host, program, file, location.getStart(), preferences,
|
|
131250
131308
|
/*isForImportStatementCompletion*/ false, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
|
|
131251
131309
|
var entries = ts.mapDefined(previousResponse.entries, function (entry) {
|
|
131310
|
+
var _a;
|
|
131252
131311
|
if (!entry.hasAction || !entry.source || !entry.data || completionEntryDataIsResolved(entry.data)) {
|
|
131253
131312
|
// Not an auto import or already resolved; keep as is
|
|
131254
131313
|
return entry;
|
|
@@ -131260,8 +131319,12 @@ var ts;
|
|
|
131260
131319
|
var origin = ts.Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host)).origin;
|
|
131261
131320
|
var info = exportMap.get(file.path, entry.data.exportMapKey);
|
|
131262
131321
|
var result = info && context.tryResolve(info, entry.name, !ts.isExternalModuleNameRelative(ts.stripQuotes(origin.moduleSymbol.name)));
|
|
131263
|
-
if (
|
|
131322
|
+
if (result === "skipped")
|
|
131264
131323
|
return entry;
|
|
131324
|
+
if (!result || result === "failed") {
|
|
131325
|
+
(_a = host.log) === null || _a === void 0 ? void 0 : _a.call(host, "Unexpected failure resolving auto import for '" + entry.name + "' from '" + entry.source + "'");
|
|
131326
|
+
return undefined;
|
|
131327
|
+
}
|
|
131265
131328
|
var newOrigin = __assign(__assign({}, origin), { kind: 32 /* ResolvedExport */, moduleSpecifier: result.moduleSpecifier });
|
|
131266
131329
|
// Mutating for performance... feels sketchy but nobody else uses the cache,
|
|
131267
131330
|
// so why bother allocating a bunch of new objects?
|
|
@@ -131270,12 +131333,13 @@ var ts;
|
|
|
131270
131333
|
entry.sourceDisplay = [ts.textPart(newOrigin.moduleSpecifier)];
|
|
131271
131334
|
return entry;
|
|
131272
131335
|
});
|
|
131273
|
-
if (!context.
|
|
131336
|
+
if (!context.skippedAny()) {
|
|
131274
131337
|
previousResponse.isIncomplete = undefined;
|
|
131275
131338
|
}
|
|
131276
131339
|
return entries;
|
|
131277
131340
|
});
|
|
131278
131341
|
previousResponse.entries = newEntries;
|
|
131342
|
+
previousResponse.flags = (previousResponse.flags || 0) | 4 /* IsContinuation */;
|
|
131279
131343
|
return previousResponse;
|
|
131280
131344
|
}
|
|
131281
131345
|
function jsdocCompletionInfo(entries) {
|
|
@@ -131357,12 +131421,13 @@ var ts;
|
|
|
131357
131421
|
ts.insertSorted(entries, createCompletionEntryForLiteral(sourceFile, preferences, literal), compareCompletionEntries, /*allowDuplicates*/ true);
|
|
131358
131422
|
}
|
|
131359
131423
|
return {
|
|
131424
|
+
flags: completionData.flags,
|
|
131360
131425
|
isGlobalCompletion: isInSnippetScope,
|
|
131361
131426
|
isIncomplete: preferences.allowIncompleteCompletions && hasUnresolvedAutoImports ? true : undefined,
|
|
131362
131427
|
isMemberCompletion: isMemberCompletionKind(completionKind),
|
|
131363
131428
|
isNewIdentifierLocation: isNewIdentifierLocation,
|
|
131364
131429
|
optionalReplacementSpan: getOptionalReplacementSpan(location),
|
|
131365
|
-
entries: entries
|
|
131430
|
+
entries: entries,
|
|
131366
131431
|
};
|
|
131367
131432
|
}
|
|
131368
131433
|
function isUncheckedFile(sourceFile, compilerOptions) {
|
|
@@ -132419,6 +132484,7 @@ var ts;
|
|
|
132419
132484
|
var location = ts.getTouchingPropertyName(sourceFile, position);
|
|
132420
132485
|
var keywordFilters = 0 /* None */;
|
|
132421
132486
|
var isNewIdentifierLocation = false;
|
|
132487
|
+
var flags = 0 /* None */;
|
|
132422
132488
|
if (contextToken) {
|
|
132423
132489
|
var importStatementCompletion = getImportStatementCompletionInfo(contextToken);
|
|
132424
132490
|
isNewIdentifierLocation = importStatementCompletion.isNewIdentifierLocation;
|
|
@@ -132438,6 +132504,7 @@ var ts;
|
|
|
132438
132504
|
// is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients
|
|
132439
132505
|
// to opt in with the `includeCompletionsForImportStatements` user preference.
|
|
132440
132506
|
importCompletionNode = importStatementCompletion.replacementNode;
|
|
132507
|
+
flags |= 2 /* IsImportStatementCompletion */;
|
|
132441
132508
|
}
|
|
132442
132509
|
// Bail out if this is a known invalid completion location
|
|
132443
132510
|
if (!importCompletionNode && isCompletionListBlocker(contextToken)) {
|
|
@@ -132630,6 +132697,7 @@ var ts;
|
|
|
132630
132697
|
isRightOfOpenTag: isRightOfOpenTag,
|
|
132631
132698
|
importCompletionNode: importCompletionNode,
|
|
132632
132699
|
hasUnresolvedAutoImports: hasUnresolvedAutoImports,
|
|
132700
|
+
flags: flags,
|
|
132633
132701
|
};
|
|
132634
132702
|
function isTagWithTypeExpression(tag) {
|
|
132635
132703
|
switch (tag.kind) {
|
|
@@ -133039,6 +133107,7 @@ var ts;
|
|
|
133039
133107
|
// Asking for completion details for an item that is not an auto-import
|
|
133040
133108
|
return;
|
|
133041
133109
|
}
|
|
133110
|
+
flags |= 1 /* MayIncludeAutoImports */;
|
|
133042
133111
|
// import { type | -> token text should be blank
|
|
133043
133112
|
var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken
|
|
133044
133113
|
&& importCompletionNode
|
|
@@ -133069,16 +133138,36 @@ var ts;
|
|
|
133069
133138
|
return true;
|
|
133070
133139
|
return charactersFuzzyMatchInString(symbolName, lowerCaseTokenText);
|
|
133071
133140
|
}, function (info, symbolName, isFromAmbientModule, exportMapKey) {
|
|
133141
|
+
var _a;
|
|
133072
133142
|
if (detailsEntryId && !ts.some(info, function (i) { return detailsEntryId.source === ts.stripQuotes(i.moduleSymbol.name); })) {
|
|
133073
133143
|
return;
|
|
133074
133144
|
}
|
|
133075
|
-
|
|
133076
|
-
|
|
133145
|
+
// Do a relatively cheap check to bail early if all re-exports are non-importable
|
|
133146
|
+
// due to file location or package.json dependency filtering. For non-node12+
|
|
133147
|
+
// module resolution modes, getting past this point guarantees that we'll be
|
|
133148
|
+
// able to generate a suitable module specifier, so we can safely show a completion,
|
|
133149
|
+
// even if we defer computing the module specifier.
|
|
133150
|
+
var firstImportableExportInfo = ts.find(info, isImportableExportInfo);
|
|
133151
|
+
if (!firstImportableExportInfo) {
|
|
133152
|
+
return;
|
|
133153
|
+
}
|
|
133154
|
+
// In node12+, module specifier resolution can fail due to modules being blocked
|
|
133155
|
+
// by package.json `exports`. If that happens, don't show a completion item.
|
|
133156
|
+
// N.B. in this resolution mode we always try to resolve module specifiers here,
|
|
133157
|
+
// because we have to know now if it's going to fail so we can omit the completion
|
|
133158
|
+
// from the list.
|
|
133159
|
+
var result = context.tryResolve(info, symbolName, isFromAmbientModule) || {};
|
|
133160
|
+
if (result === "failed")
|
|
133077
133161
|
return;
|
|
133162
|
+
// If we skipped resolving module specifiers, our selection of which ExportInfo
|
|
133163
|
+
// to use here is arbitrary, since the info shown in the completion list derived from
|
|
133164
|
+
// it should be identical regardless of which one is used. During the subsequent
|
|
133165
|
+
// `CompletionEntryDetails` request, we'll get all the ExportInfos again and pick
|
|
133166
|
+
// the best one based on the module specifier it produces.
|
|
133167
|
+
var exportInfo = firstImportableExportInfo, moduleSpecifier;
|
|
133168
|
+
if (result !== "skipped") {
|
|
133169
|
+
(_a = result.exportInfo, exportInfo = _a === void 0 ? firstImportableExportInfo : _a, moduleSpecifier = result.moduleSpecifier);
|
|
133078
133170
|
}
|
|
133079
|
-
// If we don't need to resolve module specifiers, we can use any re-export that is importable at all
|
|
133080
|
-
// (We need to ensure that at least one is importable to show a completion.)
|
|
133081
|
-
var _a = context.tryResolve(info, symbolName, isFromAmbientModule) || {}, _b = _a.exportInfo, exportInfo = _b === void 0 ? defaultExportInfo : _b, moduleSpecifier = _a.moduleSpecifier;
|
|
133082
133171
|
var isDefaultExport = exportInfo.exportKind === 1 /* Default */;
|
|
133083
133172
|
var symbol = isDefaultExport && ts.getLocalSymbolForExportDefault(exportInfo.symbol) || exportInfo.symbol;
|
|
133084
133173
|
pushAutoImportSymbol(symbol, {
|
|
@@ -133093,7 +133182,9 @@ var ts;
|
|
|
133093
133182
|
isFromPackageJson: exportInfo.isFromPackageJson,
|
|
133094
133183
|
});
|
|
133095
133184
|
});
|
|
133096
|
-
hasUnresolvedAutoImports = context.
|
|
133185
|
+
hasUnresolvedAutoImports = context.skippedAny();
|
|
133186
|
+
flags |= context.resolvedAny() ? 8 /* ResolvedModuleSpecifiers */ : 0;
|
|
133187
|
+
flags |= context.resolvedBeyondLimit() ? 16 /* ResolvedModuleSpecifiersBeyondLimit */ : 0;
|
|
133097
133188
|
});
|
|
133098
133189
|
function isImportableExportInfo(info) {
|
|
133099
133190
|
var moduleFile = ts.tryCast(info.moduleSymbol.valueDeclaration, ts.isSourceFile);
|
|
@@ -133141,6 +133232,7 @@ var ts;
|
|
|
133141
133232
|
return;
|
|
133142
133233
|
}
|
|
133143
133234
|
var origin = __assign({ kind: 128 /* ObjectLiteralMethod */ }, entryProps);
|
|
133235
|
+
flags |= 32 /* MayIncludeMethodSnippets */;
|
|
133144
133236
|
symbolToOriginInfoMap[symbols.length] = origin;
|
|
133145
133237
|
symbols.push(member);
|
|
133146
133238
|
});
|
|
@@ -133337,7 +133429,7 @@ var ts;
|
|
|
133337
133429
|
// through type declaration or inference.
|
|
133338
133430
|
// Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
|
|
133339
133431
|
// type of parameter will flow in from the contextual type of the function
|
|
133340
|
-
var canGetType = ts.hasInitializer(rootDeclaration) || ts.
|
|
133432
|
+
var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 244 /* ForOfStatement */;
|
|
133341
133433
|
if (!canGetType && rootDeclaration.kind === 164 /* Parameter */) {
|
|
133342
133434
|
if (ts.isExpression(rootDeclaration.parent)) {
|
|
133343
133435
|
canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);
|
|
@@ -134612,6 +134704,8 @@ var ts;
|
|
|
134612
134704
|
return highlightSpans(getAsyncAndAwaitOccurrences(node));
|
|
134613
134705
|
case 125 /* YieldKeyword */:
|
|
134614
134706
|
return highlightSpans(getYieldOccurrences(node));
|
|
134707
|
+
case 101 /* InKeyword */:
|
|
134708
|
+
return undefined;
|
|
134615
134709
|
default:
|
|
134616
134710
|
return ts.isModifierKind(node.kind) && (ts.isDeclaration(node.parent) || ts.isVariableStatement(node.parent))
|
|
134617
134711
|
? highlightSpans(getModifierOccurrences(node.kind, node.parent))
|
|
@@ -152334,6 +152428,7 @@ var ts;
|
|
|
152334
152428
|
var compilerOptions = program.getCompilerOptions();
|
|
152335
152429
|
var moduleSpecifierResolutionHost = ts.createModuleSpecifierResolutionHost(program, host);
|
|
152336
152430
|
var getChecker = ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); });
|
|
152431
|
+
var rejectNodeModulesRelativePaths = ts.moduleResolutionUsesNodeModules(ts.getEmitModuleResolutionKind(compilerOptions));
|
|
152337
152432
|
var getModuleSpecifiers = fromCacheOnly
|
|
152338
152433
|
? function (moduleSymbol) { return ({ moduleSpecifiers: ts.moduleSpecifiers.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }); }
|
|
152339
152434
|
: function (moduleSymbol, checker) { return ts.moduleSpecifiers.getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, sourceFile, moduleSpecifierResolutionHost, preferences); };
|
|
@@ -152344,19 +152439,19 @@ var ts;
|
|
|
152344
152439
|
var importedSymbolHasValueMeaning = !!(exportInfo.targetFlags & 111551 /* Value */);
|
|
152345
152440
|
var addAsTypeOnly = getAddAsTypeOnly(isValidTypeOnlyUseSite, /*isForNewImportDeclaration*/ true, exportInfo.symbol, exportInfo.targetFlags, checker, compilerOptions);
|
|
152346
152441
|
computedWithoutCacheCount += computedWithoutCache ? 1 : 0;
|
|
152347
|
-
return moduleSpecifiers
|
|
152348
|
-
|
|
152349
|
-
|
|
152350
|
-
? { kind: 1 /* JsdocTypeImport */, moduleSpecifier: moduleSpecifier, position: position, exportInfo: exportInfo, isReExport: i > 0 }
|
|
152351
|
-
|
|
152352
|
-
|
|
152353
|
-
|
|
152354
|
-
|
|
152355
|
-
|
|
152356
|
-
|
|
152357
|
-
|
|
152358
|
-
|
|
152359
|
-
|
|
152442
|
+
return ts.mapDefined(moduleSpecifiers, function (moduleSpecifier) {
|
|
152443
|
+
return rejectNodeModulesRelativePaths && ts.pathContainsNodeModules(moduleSpecifier) ? undefined :
|
|
152444
|
+
// `position` should only be undefined at a missing jsx namespace, in which case we shouldn't be looking for pure types.
|
|
152445
|
+
!importedSymbolHasValueMeaning && isJs && position !== undefined ? { kind: 1 /* JsdocTypeImport */, moduleSpecifier: moduleSpecifier, position: position, exportInfo: exportInfo, isReExport: i > 0 } :
|
|
152446
|
+
{
|
|
152447
|
+
kind: 3 /* AddNew */,
|
|
152448
|
+
moduleSpecifier: moduleSpecifier,
|
|
152449
|
+
importKind: getImportKind(sourceFile, exportInfo.exportKind, compilerOptions),
|
|
152450
|
+
useRequire: useRequire,
|
|
152451
|
+
addAsTypeOnly: addAsTypeOnly,
|
|
152452
|
+
exportInfo: exportInfo,
|
|
152453
|
+
isReExport: i > 0,
|
|
152454
|
+
};
|
|
152360
152455
|
});
|
|
152361
152456
|
});
|
|
152362
152457
|
return { computedWithoutCacheCount: computedWithoutCacheCount, fixes: fixes };
|
|
@@ -157929,6 +158024,7 @@ var ts;
|
|
|
157929
158024
|
var fixName = "addVoidToPromise";
|
|
157930
158025
|
var fixId = "addVoidToPromise";
|
|
157931
158026
|
var errorCodes = [
|
|
158027
|
+
ts.Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code,
|
|
157932
158028
|
ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
|
|
157933
158029
|
];
|
|
157934
158030
|
codefix.registerCodeFix({
|
|
@@ -173912,7 +174008,7 @@ var ts;
|
|
|
173912
174008
|
return cache.get(toFileName);
|
|
173913
174009
|
},
|
|
173914
174010
|
set: function (fromFileName, toFileName, preferences, options, modulePaths, moduleSpecifiers) {
|
|
173915
|
-
ensureCache(fromFileName, preferences, options).set(toFileName, createInfo(modulePaths, moduleSpecifiers, /*
|
|
174011
|
+
ensureCache(fromFileName, preferences, options).set(toFileName, createInfo(modulePaths, moduleSpecifiers, /*isBlockedByPackageJsonDependencies*/ false));
|
|
173916
174012
|
// If any module specifiers were generated based off paths in node_modules,
|
|
173917
174013
|
// a package.json file in that package was read and is an input to the cached.
|
|
173918
174014
|
// Instead of watching each individual package.json file, set up a wildcard
|
|
@@ -173938,17 +174034,17 @@ var ts;
|
|
|
173938
174034
|
info.modulePaths = modulePaths;
|
|
173939
174035
|
}
|
|
173940
174036
|
else {
|
|
173941
|
-
cache.set(toFileName, createInfo(modulePaths, /*moduleSpecifiers*/ undefined, /*
|
|
174037
|
+
cache.set(toFileName, createInfo(modulePaths, /*moduleSpecifiers*/ undefined, /*isBlockedByPackageJsonDependencies*/ undefined));
|
|
173942
174038
|
}
|
|
173943
174039
|
},
|
|
173944
|
-
|
|
174040
|
+
setBlockedByPackageJsonDependencies: function (fromFileName, toFileName, preferences, options, isBlockedByPackageJsonDependencies) {
|
|
173945
174041
|
var cache = ensureCache(fromFileName, preferences, options);
|
|
173946
174042
|
var info = cache.get(toFileName);
|
|
173947
174043
|
if (info) {
|
|
173948
|
-
info.
|
|
174044
|
+
info.isBlockedByPackageJsonDependencies = isBlockedByPackageJsonDependencies;
|
|
173949
174045
|
}
|
|
173950
174046
|
else {
|
|
173951
|
-
cache.set(toFileName, createInfo(/*modulePaths*/ undefined, /*moduleSpecifiers*/ undefined,
|
|
174047
|
+
cache.set(toFileName, createInfo(/*modulePaths*/ undefined, /*moduleSpecifiers*/ undefined, isBlockedByPackageJsonDependencies));
|
|
173952
174048
|
}
|
|
173953
174049
|
},
|
|
173954
174050
|
clear: function () {
|
|
@@ -173976,8 +174072,8 @@ var ts;
|
|
|
173976
174072
|
function key(fromFileName, preferences, options) {
|
|
173977
174073
|
return fromFileName + "," + preferences.importModuleSpecifierEnding + "," + preferences.importModuleSpecifierPreference + "," + options.overrideImportMode;
|
|
173978
174074
|
}
|
|
173979
|
-
function createInfo(modulePaths, moduleSpecifiers,
|
|
173980
|
-
return { modulePaths: modulePaths, moduleSpecifiers: moduleSpecifiers,
|
|
174075
|
+
function createInfo(modulePaths, moduleSpecifiers, isBlockedByPackageJsonDependencies) {
|
|
174076
|
+
return { modulePaths: modulePaths, moduleSpecifiers: moduleSpecifiers, isBlockedByPackageJsonDependencies: isBlockedByPackageJsonDependencies };
|
|
173981
174077
|
}
|
|
173982
174078
|
}
|
|
173983
174079
|
server.createModuleSpecifierCache = createModuleSpecifierCache;
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -6435,7 +6435,18 @@ declare namespace ts {
|
|
|
6435
6435
|
argumentIndex: number;
|
|
6436
6436
|
argumentCount: number;
|
|
6437
6437
|
}
|
|
6438
|
+
enum CompletionInfoFlags {
|
|
6439
|
+
None = 0,
|
|
6440
|
+
MayIncludeAutoImports = 1,
|
|
6441
|
+
IsImportStatementCompletion = 2,
|
|
6442
|
+
IsContinuation = 4,
|
|
6443
|
+
ResolvedModuleSpecifiers = 8,
|
|
6444
|
+
ResolvedModuleSpecifiersBeyondLimit = 16,
|
|
6445
|
+
MayIncludeMethodSnippets = 32
|
|
6446
|
+
}
|
|
6438
6447
|
interface CompletionInfo {
|
|
6448
|
+
/** For performance telemetry. */
|
|
6449
|
+
flags?: CompletionInfoFlags;
|
|
6439
6450
|
/** Not true for all global completions. This will be true if the enclosing scope matches a few syntax kinds. See `isSnippetScope`. */
|
|
6440
6451
|
isGlobalCompletion: boolean;
|
|
6441
6452
|
isMemberCompletion: boolean;
|
|
@@ -8823,6 +8834,7 @@ declare namespace ts.server.protocol {
|
|
|
8823
8834
|
body?: CompletionInfo;
|
|
8824
8835
|
}
|
|
8825
8836
|
interface CompletionInfo {
|
|
8837
|
+
readonly flags?: number;
|
|
8826
8838
|
readonly isGlobalCompletion: boolean;
|
|
8827
8839
|
readonly isMemberCompletion: boolean;
|
|
8828
8840
|
readonly isNewIdentifierLocation: boolean;
|