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/protocol.d.ts
CHANGED
|
@@ -1825,6 +1825,7 @@ declare namespace ts.server.protocol {
|
|
|
1825
1825
|
body?: CompletionInfo;
|
|
1826
1826
|
}
|
|
1827
1827
|
interface CompletionInfo {
|
|
1828
|
+
readonly flags?: number;
|
|
1828
1829
|
readonly isGlobalCompletion: boolean;
|
|
1829
1830
|
readonly isMemberCompletion: boolean;
|
|
1830
1831
|
readonly isNewIdentifierLocation: boolean;
|
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.7";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220428";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -6057,6 +6057,7 @@ var ts;
|
|
|
6057
6057
|
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}'."),
|
|
6058
6058
|
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"),
|
|
6059
6059
|
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."),
|
|
6060
|
+
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."),
|
|
6060
6061
|
Initializer_for_property_0: diag(2811, ts.DiagnosticCategory.Error, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
|
|
6061
6062
|
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'."),
|
|
6062
6063
|
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}'."),
|
|
@@ -30687,7 +30688,8 @@ var ts;
|
|
|
30687
30688
|
if (!comment) {
|
|
30688
30689
|
comment = parseTrailingTagComments(start, getNodePos(), indent, indentText);
|
|
30689
30690
|
}
|
|
30690
|
-
|
|
30691
|
+
var end = comment !== undefined ? getNodePos() : typeExpression.end;
|
|
30692
|
+
return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start, end);
|
|
30691
30693
|
}
|
|
30692
30694
|
function escapedTextsEqual(a, b) {
|
|
30693
30695
|
while (!ts.isIdentifier(a) || !ts.isIdentifier(b)) {
|
|
@@ -39568,6 +39570,7 @@ var ts;
|
|
|
39568
39570
|
var keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
|
|
39569
39571
|
var numberOrBigIntType = getUnionType([numberType, bigintType]);
|
|
39570
39572
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
39573
|
+
var numericStringType = getTemplateLiteralType(["", ""], [numberType]);
|
|
39571
39574
|
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? getRestrictiveTypeParameter(t) : t; });
|
|
39572
39575
|
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? wildcardType : t; });
|
|
39573
39576
|
var uniqueLiteralType = createIntrinsicType(131072, "never");
|
|
@@ -42162,7 +42165,7 @@ var ts;
|
|
|
42162
42165
|
}
|
|
42163
42166
|
}
|
|
42164
42167
|
function getExportSymbolOfValueSymbolIfExported(symbol) {
|
|
42165
|
-
return getMergedSymbol(symbol && (symbol.flags & 1048576) !== 0
|
|
42168
|
+
return getMergedSymbol(symbol && (symbol.flags & 1048576) !== 0 && symbol.exportSymbol || symbol);
|
|
42166
42169
|
}
|
|
42167
42170
|
function symbolIsValue(symbol) {
|
|
42168
42171
|
return !!(symbol.flags & 111551 || symbol.flags & 2097152 && resolveAlias(symbol).flags & 111551 && !getTypeOnlyAliasDeclaration(symbol));
|
|
@@ -48557,7 +48560,7 @@ var ts;
|
|
|
48557
48560
|
var typeVariable = getHomomorphicTypeVariable(type);
|
|
48558
48561
|
if (typeVariable && !type.declaration.nameType) {
|
|
48559
48562
|
var constraint = getConstraintOfTypeParameter(typeVariable);
|
|
48560
|
-
if (constraint && (
|
|
48563
|
+
if (constraint && isArrayOrTupleType(constraint)) {
|
|
48561
48564
|
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
48562
48565
|
}
|
|
48563
48566
|
}
|
|
@@ -48866,7 +48869,7 @@ var ts;
|
|
|
48866
48869
|
function isApplicableIndexType(source, target) {
|
|
48867
48870
|
return isTypeAssignableTo(source, target) ||
|
|
48868
48871
|
target === stringType && isTypeAssignableTo(source, numberType) ||
|
|
48869
|
-
target === numberType && !!(source.flags & 128) && ts.isNumericLiteralName(source.value);
|
|
48872
|
+
target === numberType && (source === numericStringType || !!(source.flags & 128) && ts.isNumericLiteralName(source.value));
|
|
48870
48873
|
}
|
|
48871
48874
|
function getIndexInfosOfStructuredType(type) {
|
|
48872
48875
|
if (type.flags & 3670016) {
|
|
@@ -49772,6 +49775,18 @@ var ts;
|
|
|
49772
49775
|
constraints = ts.append(constraints, constraint);
|
|
49773
49776
|
}
|
|
49774
49777
|
}
|
|
49778
|
+
else if (type.flags & 262144 && parent.kind === 195 && node === parent.type) {
|
|
49779
|
+
var mappedType = getTypeFromTypeNode(parent);
|
|
49780
|
+
if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
|
|
49781
|
+
var typeParameter = getHomomorphicTypeVariable(mappedType);
|
|
49782
|
+
if (typeParameter) {
|
|
49783
|
+
var constraint = getConstraintOfTypeParameter(typeParameter);
|
|
49784
|
+
if (constraint && everyType(constraint, isArrayOrTupleType)) {
|
|
49785
|
+
constraints = ts.append(constraints, getUnionType([numberType, numericStringType]));
|
|
49786
|
+
}
|
|
49787
|
+
}
|
|
49788
|
+
}
|
|
49789
|
+
}
|
|
49775
49790
|
node = parent;
|
|
49776
49791
|
}
|
|
49777
49792
|
return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type;
|
|
@@ -50658,7 +50673,7 @@ var ts;
|
|
|
50658
50673
|
while (i > 0) {
|
|
50659
50674
|
i--;
|
|
50660
50675
|
var t = types[i];
|
|
50661
|
-
var remove = t.flags & 4 && includes & 128 ||
|
|
50676
|
+
var remove = t.flags & 4 && includes & (128 | 134217728 | 268435456) ||
|
|
50662
50677
|
t.flags & 8 && includes & 256 ||
|
|
50663
50678
|
t.flags & 64 && includes & 2048 ||
|
|
50664
50679
|
t.flags & 4096 && includes & 8192;
|
|
@@ -50781,7 +50796,7 @@ var ts;
|
|
|
50781
50796
|
if (!strictNullChecks && includes & 98304) {
|
|
50782
50797
|
return includes & 32768 ? undefinedType : nullType;
|
|
50783
50798
|
}
|
|
50784
|
-
if (includes & 4 && includes & 128 ||
|
|
50799
|
+
if (includes & 4 && includes & (128 | 134217728 | 268435456) ||
|
|
50785
50800
|
includes & 8 && includes & 256 ||
|
|
50786
50801
|
includes & 64 && includes & 2048 ||
|
|
50787
50802
|
includes & 4096 && includes & 8192) {
|
|
@@ -52449,7 +52464,7 @@ var ts;
|
|
|
52449
52464
|
if (!type.declaration.nameType) {
|
|
52450
52465
|
var constraint = void 0;
|
|
52451
52466
|
if (isArrayType(t) || t.flags & 1 && findResolutionCycleStartIndex(typeVariable, 4) < 0 &&
|
|
52452
|
-
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint,
|
|
52467
|
+
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
52453
52468
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
52454
52469
|
}
|
|
52455
52470
|
if (isGenericTupleType(t)) {
|
|
@@ -53744,7 +53759,7 @@ var ts;
|
|
|
53744
53759
|
}
|
|
53745
53760
|
return false;
|
|
53746
53761
|
}
|
|
53747
|
-
return
|
|
53762
|
+
return isArrayOrTupleType(target);
|
|
53748
53763
|
}
|
|
53749
53764
|
if (isReadonlyArrayType(source) && isMutableArrayOrTuple(target)) {
|
|
53750
53765
|
if (reportErrors) {
|
|
@@ -53840,7 +53855,7 @@ var ts;
|
|
|
53840
53855
|
unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) :
|
|
53841
53856
|
recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags);
|
|
53842
53857
|
if (result_7 && !inPropertyCheck && (target.flags & 2097152 && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
|
|
53843
|
-
isNonGenericObjectType(target) && !
|
|
53858
|
+
isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 && getApparentType(source).flags & 3670016 && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144); }))) {
|
|
53844
53859
|
inPropertyCheck = true;
|
|
53845
53860
|
result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4, recursionFlags);
|
|
53846
53861
|
inPropertyCheck = false;
|
|
@@ -54659,7 +54674,7 @@ var ts;
|
|
|
54659
54674
|
return varianceResult;
|
|
54660
54675
|
}
|
|
54661
54676
|
}
|
|
54662
|
-
else if (isReadonlyArrayType(target) ?
|
|
54677
|
+
else if (isReadonlyArrayType(target) ? isArrayOrTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
|
|
54663
54678
|
if (relation !== identityRelation) {
|
|
54664
54679
|
return isRelatedTo(getIndexTypeOfType(source, numberType) || anyType, getIndexTypeOfType(target, numberType) || anyType, 3, reportErrors);
|
|
54665
54680
|
}
|
|
@@ -54953,7 +54968,7 @@ var ts;
|
|
|
54953
54968
|
}
|
|
54954
54969
|
var result = -1;
|
|
54955
54970
|
if (isTupleType(target)) {
|
|
54956
|
-
if (
|
|
54971
|
+
if (isArrayOrTupleType(source)) {
|
|
54957
54972
|
if (!target.target.readonly && (isReadonlyArrayType(source) || isTupleType(source) && source.target.readonly)) {
|
|
54958
54973
|
return 0;
|
|
54959
54974
|
}
|
|
@@ -55800,6 +55815,9 @@ var ts;
|
|
|
55800
55815
|
function isReadonlyArrayType(type) {
|
|
55801
55816
|
return !!(ts.getObjectFlags(type) & 4) && type.target === globalReadonlyArrayType;
|
|
55802
55817
|
}
|
|
55818
|
+
function isArrayOrTupleType(type) {
|
|
55819
|
+
return isArrayType(type) || isTupleType(type);
|
|
55820
|
+
}
|
|
55803
55821
|
function isMutableArrayOrTuple(type) {
|
|
55804
55822
|
return isArrayType(type) && !isReadonlyArrayType(type) || isTupleType(type) && !type.target.readonly;
|
|
55805
55823
|
}
|
|
@@ -56197,7 +56215,7 @@ var ts;
|
|
|
56197
56215
|
else if (type.flags & 2097152) {
|
|
56198
56216
|
result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
|
|
56199
56217
|
}
|
|
56200
|
-
else if (
|
|
56218
|
+
else if (isArrayOrTupleType(type)) {
|
|
56201
56219
|
result = createTypeReference(type.target, ts.sameMap(getTypeArguments(type), getWidenedType));
|
|
56202
56220
|
}
|
|
56203
56221
|
if (result && context === undefined) {
|
|
@@ -56223,7 +56241,7 @@ var ts;
|
|
|
56223
56241
|
}
|
|
56224
56242
|
}
|
|
56225
56243
|
}
|
|
56226
|
-
if (
|
|
56244
|
+
if (isArrayOrTupleType(type)) {
|
|
56227
56245
|
for (var _b = 0, _c = getTypeArguments(type); _b < _c.length; _b++) {
|
|
56228
56246
|
var t = _c[_b];
|
|
56229
56247
|
if (reportWideningErrorsInType(t)) {
|
|
@@ -57125,7 +57143,7 @@ var ts;
|
|
|
57125
57143
|
}
|
|
57126
57144
|
}
|
|
57127
57145
|
if (!typesDefinitelyUnrelated(source, target)) {
|
|
57128
|
-
if (
|
|
57146
|
+
if (isArrayOrTupleType(source)) {
|
|
57129
57147
|
if (isTupleType(target)) {
|
|
57130
57148
|
var sourceArity = getTypeReferenceArity(source);
|
|
57131
57149
|
var targetArity = getTypeReferenceArity(target);
|
|
@@ -63130,8 +63148,14 @@ var ts;
|
|
|
63130
63148
|
var parameterRange = hasRestParameter ? min
|
|
63131
63149
|
: min < max ? min + "-" + max
|
|
63132
63150
|
: min;
|
|
63133
|
-
var
|
|
63134
|
-
|
|
63151
|
+
var isVoidPromiseError = !hasRestParameter && parameterRange === 1 && args.length === 0 && isPromiseResolveArityError(node);
|
|
63152
|
+
if (isVoidPromiseError && ts.isInJSFile(node)) {
|
|
63153
|
+
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);
|
|
63154
|
+
}
|
|
63155
|
+
var error = hasRestParameter
|
|
63156
|
+
? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1
|
|
63157
|
+
: isVoidPromiseError
|
|
63158
|
+
? ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise
|
|
63135
63159
|
: ts.Diagnostics.Expected_0_arguments_but_got_1;
|
|
63136
63160
|
if (min < args.length && args.length < max) {
|
|
63137
63161
|
return getDiagnosticForCallNode(node, ts.Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, args.length, maxBelow, minAbove);
|
|
@@ -88938,6 +88962,8 @@ var ts;
|
|
|
88938
88962
|
var varDecl = factory.createVariableDeclaration(newId, undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), undefined);
|
|
88939
88963
|
errorFallbackNode = undefined;
|
|
88940
88964
|
var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135)] : [], factory.createVariableDeclarationList([varDecl], 2));
|
|
88965
|
+
preserveJsDoc(statement, input);
|
|
88966
|
+
ts.removeAllComments(input);
|
|
88941
88967
|
return [statement, factory.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
|
|
88942
88968
|
}
|
|
88943
88969
|
}
|
|
@@ -103507,7 +103533,7 @@ var ts;
|
|
|
103507
103533
|
if (!state.watch || !state.lastCachedPackageJsonLookups)
|
|
103508
103534
|
return;
|
|
103509
103535
|
ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
|
|
103510
|
-
createNewValue: function (path, _input) { return state.watchFile(path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.
|
|
103536
|
+
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); },
|
|
103511
103537
|
onDeleteValue: ts.closeFileWatcher,
|
|
103512
103538
|
});
|
|
103513
103539
|
}
|