typescript 4.8.0-dev.20220629 → 4.8.0-dev.20220630
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 +35 -7
- package/lib/tsserver.js +63 -36
- package/lib/tsserverlibrary.js +63 -36
- package/lib/typescript.js +63 -36
- package/lib/typescriptServices.js +63 -36
- package/lib/typingsInstaller.js +35 -7
- package/package.json +1 -1
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.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220630";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -2667,6 +2667,22 @@ var ts;
|
|
|
2667
2667
|
return wrapFunction(deprecation, func);
|
|
2668
2668
|
}
|
|
2669
2669
|
Debug.deprecate = deprecate;
|
|
2670
|
+
function formatVariance(varianceFlags) {
|
|
2671
|
+
var variance = varianceFlags & 7;
|
|
2672
|
+
var result = variance === 0 ? "in out" :
|
|
2673
|
+
variance === 3 ? "[bivariant]" :
|
|
2674
|
+
variance === 2 ? "in" :
|
|
2675
|
+
variance === 1 ? "out" :
|
|
2676
|
+
variance === 4 ? "[independent]" : "";
|
|
2677
|
+
if (varianceFlags & 8) {
|
|
2678
|
+
result += " (unmeasurable)";
|
|
2679
|
+
}
|
|
2680
|
+
else if (varianceFlags & 16) {
|
|
2681
|
+
result += " (unreliable)";
|
|
2682
|
+
}
|
|
2683
|
+
return result;
|
|
2684
|
+
}
|
|
2685
|
+
Debug.formatVariance = formatVariance;
|
|
2670
2686
|
})(Debug = ts.Debug || (ts.Debug = {}));
|
|
2671
2687
|
})(ts || (ts = {}));
|
|
2672
2688
|
var ts;
|
|
@@ -3239,9 +3255,9 @@ var ts;
|
|
|
3239
3255
|
eventStack.push({ phase: phase, name: name, args: args, time: 1000 * ts.timestamp(), separateBeginAndEnd: separateBeginAndEnd });
|
|
3240
3256
|
}
|
|
3241
3257
|
tracingEnabled.push = push;
|
|
3242
|
-
function pop() {
|
|
3258
|
+
function pop(results) {
|
|
3243
3259
|
ts.Debug.assert(eventStack.length > 0);
|
|
3244
|
-
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp());
|
|
3260
|
+
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp(), results);
|
|
3245
3261
|
eventStack.length--;
|
|
3246
3262
|
}
|
|
3247
3263
|
tracingEnabled.pop = pop;
|
|
@@ -3254,13 +3270,14 @@ var ts;
|
|
|
3254
3270
|
}
|
|
3255
3271
|
tracingEnabled.popAll = popAll;
|
|
3256
3272
|
var sampleInterval = 1000 * 10;
|
|
3257
|
-
function writeStackEvent(index, endTime) {
|
|
3273
|
+
function writeStackEvent(index, endTime, results) {
|
|
3258
3274
|
var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd;
|
|
3259
3275
|
if (separateBeginAndEnd) {
|
|
3276
|
+
ts.Debug.assert(!results, "`results` are not supported for events with `separateBeginAndEnd`");
|
|
3260
3277
|
writeEvent("E", phase, name, args, undefined, endTime);
|
|
3261
3278
|
}
|
|
3262
3279
|
else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
|
|
3263
|
-
writeEvent("X", phase, name, args, "\"dur\":" + (endTime - time), time);
|
|
3280
|
+
writeEvent("X", phase, name, __assign(__assign({}, args), { results: results }), "\"dur\":" + (endTime - time), time);
|
|
3264
3281
|
}
|
|
3265
3282
|
}
|
|
3266
3283
|
function writeEvent(eventType, phase, name, args, extras, time) {
|
|
@@ -56296,7 +56313,7 @@ var ts;
|
|
|
56296
56313
|
_loop_22(tp);
|
|
56297
56314
|
}
|
|
56298
56315
|
links.variances = variances;
|
|
56299
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
56316
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
56300
56317
|
}
|
|
56301
56318
|
return links.variances;
|
|
56302
56319
|
}
|
|
@@ -67584,12 +67601,14 @@ var ts;
|
|
|
67584
67601
|
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
67585
67602
|
}
|
|
67586
67603
|
else if (modifiers === 32768 || modifiers === 65536) {
|
|
67604
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
67587
67605
|
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
67588
67606
|
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
67589
67607
|
var saveVarianceTypeParameter = typeParameter;
|
|
67590
67608
|
varianceTypeParameter = typeParameter;
|
|
67591
67609
|
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
67592
67610
|
varianceTypeParameter = saveVarianceTypeParameter;
|
|
67611
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
67593
67612
|
}
|
|
67594
67613
|
}
|
|
67595
67614
|
}
|
|
@@ -68798,8 +68817,17 @@ var ts;
|
|
|
68798
68817
|
return typeAsAwaitable.awaitedTypeOfType;
|
|
68799
68818
|
}
|
|
68800
68819
|
if (type.flags & 1048576) {
|
|
68820
|
+
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
68821
|
+
if (errorNode) {
|
|
68822
|
+
error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
68823
|
+
}
|
|
68824
|
+
return undefined;
|
|
68825
|
+
}
|
|
68801
68826
|
var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
|
|
68802
|
-
|
|
68827
|
+
awaitedTypeStack.push(type.id);
|
|
68828
|
+
var mapped = mapType(type, mapper);
|
|
68829
|
+
awaitedTypeStack.pop();
|
|
68830
|
+
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
68803
68831
|
}
|
|
68804
68832
|
var thisTypeForErrorOut = { value: undefined };
|
|
68805
68833
|
var promisedType = getPromisedTypeOfPromise(type, undefined, thisTypeForErrorOut);
|
package/lib/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
112
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220630";
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -3124,6 +3124,22 @@ var ts;
|
|
|
3124
3124
|
return wrapFunction(deprecation, func);
|
|
3125
3125
|
}
|
|
3126
3126
|
Debug.deprecate = deprecate;
|
|
3127
|
+
function formatVariance(varianceFlags) {
|
|
3128
|
+
var variance = varianceFlags & 7 /* VarianceMask */;
|
|
3129
|
+
var result = variance === 0 /* Invariant */ ? "in out" :
|
|
3130
|
+
variance === 3 /* Bivariant */ ? "[bivariant]" :
|
|
3131
|
+
variance === 2 /* Contravariant */ ? "in" :
|
|
3132
|
+
variance === 1 /* Covariant */ ? "out" :
|
|
3133
|
+
variance === 4 /* Independent */ ? "[independent]" : "";
|
|
3134
|
+
if (varianceFlags & 8 /* Unmeasurable */) {
|
|
3135
|
+
result += " (unmeasurable)";
|
|
3136
|
+
}
|
|
3137
|
+
else if (varianceFlags & 16 /* Unreliable */) {
|
|
3138
|
+
result += " (unreliable)";
|
|
3139
|
+
}
|
|
3140
|
+
return result;
|
|
3141
|
+
}
|
|
3142
|
+
Debug.formatVariance = formatVariance;
|
|
3127
3143
|
})(Debug = ts.Debug || (ts.Debug = {}));
|
|
3128
3144
|
})(ts || (ts = {}));
|
|
3129
3145
|
/* @internal */
|
|
@@ -3865,9 +3881,9 @@ var ts;
|
|
|
3865
3881
|
eventStack.push({ phase: phase, name: name, args: args, time: 1000 * ts.timestamp(), separateBeginAndEnd: separateBeginAndEnd });
|
|
3866
3882
|
}
|
|
3867
3883
|
tracingEnabled.push = push;
|
|
3868
|
-
function pop() {
|
|
3884
|
+
function pop(results) {
|
|
3869
3885
|
ts.Debug.assert(eventStack.length > 0);
|
|
3870
|
-
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp());
|
|
3886
|
+
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp(), results);
|
|
3871
3887
|
eventStack.length--;
|
|
3872
3888
|
}
|
|
3873
3889
|
tracingEnabled.pop = pop;
|
|
@@ -3881,14 +3897,15 @@ var ts;
|
|
|
3881
3897
|
tracingEnabled.popAll = popAll;
|
|
3882
3898
|
// sample every 10ms
|
|
3883
3899
|
var sampleInterval = 1000 * 10;
|
|
3884
|
-
function writeStackEvent(index, endTime) {
|
|
3900
|
+
function writeStackEvent(index, endTime, results) {
|
|
3885
3901
|
var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd;
|
|
3886
3902
|
if (separateBeginAndEnd) {
|
|
3903
|
+
ts.Debug.assert(!results, "`results` are not supported for events with `separateBeginAndEnd`");
|
|
3887
3904
|
writeEvent("E", phase, name, args, /*extras*/ undefined, endTime);
|
|
3888
3905
|
}
|
|
3889
3906
|
// test if [time,endTime) straddles a sampling point
|
|
3890
3907
|
else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
|
|
3891
|
-
writeEvent("X", phase, name, args, "\"dur\":" + (endTime - time), time);
|
|
3908
|
+
writeEvent("X", phase, name, __assign(__assign({}, args), { results: results }), "\"dur\":" + (endTime - time), time);
|
|
3892
3909
|
}
|
|
3893
3910
|
}
|
|
3894
3911
|
function writeEvent(eventType, phase, name, args, extras, time) {
|
|
@@ -67504,7 +67521,7 @@ var ts;
|
|
|
67504
67521
|
_loop_22(tp);
|
|
67505
67522
|
}
|
|
67506
67523
|
links.variances = variances;
|
|
67507
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
67524
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
67508
67525
|
}
|
|
67509
67526
|
return links.variances;
|
|
67510
67527
|
}
|
|
@@ -80585,12 +80602,14 @@ var ts;
|
|
|
80585
80602
|
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
80586
80603
|
}
|
|
80587
80604
|
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
80605
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
80588
80606
|
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
80589
80607
|
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
80590
80608
|
var saveVarianceTypeParameter = typeParameter;
|
|
80591
80609
|
varianceTypeParameter = typeParameter;
|
|
80592
80610
|
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
80593
80611
|
varianceTypeParameter = saveVarianceTypeParameter;
|
|
80612
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
80594
80613
|
}
|
|
80595
80614
|
}
|
|
80596
80615
|
}
|
|
@@ -81986,8 +82005,17 @@ var ts;
|
|
|
81986
82005
|
}
|
|
81987
82006
|
// For a union, get a union of the awaited types of each constituent.
|
|
81988
82007
|
if (type.flags & 1048576 /* Union */) {
|
|
82008
|
+
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
82009
|
+
if (errorNode) {
|
|
82010
|
+
error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
82011
|
+
}
|
|
82012
|
+
return undefined;
|
|
82013
|
+
}
|
|
81989
82014
|
var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
|
|
81990
|
-
|
|
82015
|
+
awaitedTypeStack.push(type.id);
|
|
82016
|
+
var mapped = mapType(type, mapper);
|
|
82017
|
+
awaitedTypeStack.pop();
|
|
82018
|
+
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
81991
82019
|
}
|
|
81992
82020
|
var thisTypeForErrorOut = { value: undefined };
|
|
81993
82021
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
@@ -133362,37 +133390,36 @@ var ts;
|
|
|
133362
133390
|
}
|
|
133363
133391
|
}
|
|
133364
133392
|
var entries = ts.createSortedArray();
|
|
133365
|
-
|
|
133366
|
-
|
|
133367
|
-
|
|
133368
|
-
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
133369
|
-
}
|
|
133370
|
-
else {
|
|
133371
|
-
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
133372
|
-
return undefined;
|
|
133373
|
-
}
|
|
133374
|
-
getCompletionEntriesFromSymbols(symbols, entries,
|
|
133375
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
133393
|
+
var isChecked = isCheckedFile(sourceFile, compilerOptions);
|
|
133394
|
+
if (isChecked && !isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
133395
|
+
return undefined;
|
|
133376
133396
|
}
|
|
133397
|
+
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
133398
|
+
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
133377
133399
|
if (keywordFilters !== 0 /* None */) {
|
|
133378
|
-
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
133379
133400
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
133380
133401
|
var keywordEntry = _a[_i];
|
|
133381
|
-
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !
|
|
133402
|
+
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !uniqueNames.has(keywordEntry.name)) {
|
|
133403
|
+
uniqueNames.add(keywordEntry.name);
|
|
133382
133404
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133383
133405
|
}
|
|
133384
133406
|
}
|
|
133385
133407
|
}
|
|
133386
|
-
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
133387
133408
|
for (var _b = 0, _c = getContextualKeywords(contextToken, position); _b < _c.length; _b++) {
|
|
133388
133409
|
var keywordEntry = _c[_b];
|
|
133389
|
-
if (!
|
|
133410
|
+
if (!uniqueNames.has(keywordEntry.name)) {
|
|
133411
|
+
uniqueNames.add(keywordEntry.name);
|
|
133390
133412
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133391
133413
|
}
|
|
133392
133414
|
}
|
|
133393
133415
|
for (var _d = 0, literals_1 = literals; _d < literals_1.length; _d++) {
|
|
133394
133416
|
var literal = literals_1[_d];
|
|
133395
|
-
|
|
133417
|
+
var literalEntry = createCompletionEntryForLiteral(sourceFile, preferences, literal);
|
|
133418
|
+
uniqueNames.add(literalEntry.name);
|
|
133419
|
+
ts.insertSorted(entries, literalEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133420
|
+
}
|
|
133421
|
+
if (!isChecked) {
|
|
133422
|
+
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
133396
133423
|
}
|
|
133397
133424
|
return {
|
|
133398
133425
|
flags: completionData.flags,
|
|
@@ -133404,8 +133431,8 @@ var ts;
|
|
|
133404
133431
|
entries: entries,
|
|
133405
133432
|
};
|
|
133406
133433
|
}
|
|
133407
|
-
function
|
|
133408
|
-
return ts.isSourceFileJS(sourceFile)
|
|
133434
|
+
function isCheckedFile(sourceFile, compilerOptions) {
|
|
133435
|
+
return !ts.isSourceFileJS(sourceFile) || !!ts.isCheckJsEnabledForFile(sourceFile, compilerOptions);
|
|
133409
133436
|
}
|
|
133410
133437
|
function isMemberCompletionKind(kind) {
|
|
133411
133438
|
switch (kind) {
|
|
@@ -134363,7 +134390,7 @@ var ts;
|
|
|
134363
134390
|
}
|
|
134364
134391
|
function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) {
|
|
134365
134392
|
var typeChecker = program.getTypeChecker();
|
|
134366
|
-
var
|
|
134393
|
+
var inCheckedFile = isCheckedFile(sourceFile, compilerOptions);
|
|
134367
134394
|
var start = ts.timestamp();
|
|
134368
134395
|
var currentToken = ts.getTokenAtPosition(sourceFile, position); // TODO: GH#15853
|
|
134369
134396
|
// We will check for jsdoc comments with insideComment and getJsDocTagAtPosition. (TODO: that seems rather inefficient to check the same thing so many times.)
|
|
@@ -134779,15 +134806,7 @@ var ts;
|
|
|
134779
134806
|
isNewIdentifierLocation = true;
|
|
134780
134807
|
}
|
|
134781
134808
|
var propertyAccess = node.kind === 200 /* ImportType */ ? node : node.parent;
|
|
134782
|
-
if (
|
|
134783
|
-
// In javascript files, for union types, we don't just get the members that
|
|
134784
|
-
// the individual types have in common, we also include all the members that
|
|
134785
|
-
// each individual type has. This is because we're going to add all identifiers
|
|
134786
|
-
// anyways. So we might as well elevate the members that were at least part
|
|
134787
|
-
// of the individual types to a higher status since we know what they are.
|
|
134788
|
-
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
134789
|
-
}
|
|
134790
|
-
else {
|
|
134809
|
+
if (inCheckedFile) {
|
|
134791
134810
|
for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {
|
|
134792
134811
|
var symbol = _a[_i];
|
|
134793
134812
|
if (typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, symbol)) {
|
|
@@ -134795,6 +134814,14 @@ var ts;
|
|
|
134795
134814
|
}
|
|
134796
134815
|
}
|
|
134797
134816
|
}
|
|
134817
|
+
else {
|
|
134818
|
+
// In javascript files, for union types, we don't just get the members that
|
|
134819
|
+
// the individual types have in common, we also include all the members that
|
|
134820
|
+
// each individual type has. This is because we're going to add all identifiers
|
|
134821
|
+
// anyways. So we might as well elevate the members that were at least part
|
|
134822
|
+
// of the individual types to a higher status since we know what they are.
|
|
134823
|
+
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
134824
|
+
}
|
|
134798
134825
|
if (insertAwait && preferences.includeCompletionsWithInsertText) {
|
|
134799
134826
|
var promiseType = typeChecker.getPromisedTypeOfPromise(type);
|
|
134800
134827
|
if (promiseType) {
|
|
@@ -155157,7 +155184,7 @@ var ts;
|
|
|
155157
155184
|
if (!newConstraint)
|
|
155158
155185
|
return;
|
|
155159
155186
|
var newConstraintText = newConstraint[1];
|
|
155160
|
-
changes.insertText(related.file,
|
|
155187
|
+
changes.insertText(related.file, decl.name.end, " extends " + newConstraintText);
|
|
155161
155188
|
}
|
|
155162
155189
|
function findAncestorMatchingSpan(sourceFile, span) {
|
|
155163
155190
|
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -303,7 +303,7 @@ var ts;
|
|
|
303
303
|
// The following is baselined as a literal template type without intervention
|
|
304
304
|
/** The version of the TypeScript compiler release */
|
|
305
305
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
306
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
306
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220630";
|
|
307
307
|
/* @internal */
|
|
308
308
|
var Comparison;
|
|
309
309
|
(function (Comparison) {
|
|
@@ -3318,6 +3318,22 @@ var ts;
|
|
|
3318
3318
|
return wrapFunction(deprecation, func);
|
|
3319
3319
|
}
|
|
3320
3320
|
Debug.deprecate = deprecate;
|
|
3321
|
+
function formatVariance(varianceFlags) {
|
|
3322
|
+
var variance = varianceFlags & 7 /* VarianceMask */;
|
|
3323
|
+
var result = variance === 0 /* Invariant */ ? "in out" :
|
|
3324
|
+
variance === 3 /* Bivariant */ ? "[bivariant]" :
|
|
3325
|
+
variance === 2 /* Contravariant */ ? "in" :
|
|
3326
|
+
variance === 1 /* Covariant */ ? "out" :
|
|
3327
|
+
variance === 4 /* Independent */ ? "[independent]" : "";
|
|
3328
|
+
if (varianceFlags & 8 /* Unmeasurable */) {
|
|
3329
|
+
result += " (unmeasurable)";
|
|
3330
|
+
}
|
|
3331
|
+
else if (varianceFlags & 16 /* Unreliable */) {
|
|
3332
|
+
result += " (unreliable)";
|
|
3333
|
+
}
|
|
3334
|
+
return result;
|
|
3335
|
+
}
|
|
3336
|
+
Debug.formatVariance = formatVariance;
|
|
3321
3337
|
})(Debug = ts.Debug || (ts.Debug = {}));
|
|
3322
3338
|
})(ts || (ts = {}));
|
|
3323
3339
|
/* @internal */
|
|
@@ -4059,9 +4075,9 @@ var ts;
|
|
|
4059
4075
|
eventStack.push({ phase: phase, name: name, args: args, time: 1000 * ts.timestamp(), separateBeginAndEnd: separateBeginAndEnd });
|
|
4060
4076
|
}
|
|
4061
4077
|
tracingEnabled.push = push;
|
|
4062
|
-
function pop() {
|
|
4078
|
+
function pop(results) {
|
|
4063
4079
|
ts.Debug.assert(eventStack.length > 0);
|
|
4064
|
-
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp());
|
|
4080
|
+
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp(), results);
|
|
4065
4081
|
eventStack.length--;
|
|
4066
4082
|
}
|
|
4067
4083
|
tracingEnabled.pop = pop;
|
|
@@ -4075,14 +4091,15 @@ var ts;
|
|
|
4075
4091
|
tracingEnabled.popAll = popAll;
|
|
4076
4092
|
// sample every 10ms
|
|
4077
4093
|
var sampleInterval = 1000 * 10;
|
|
4078
|
-
function writeStackEvent(index, endTime) {
|
|
4094
|
+
function writeStackEvent(index, endTime, results) {
|
|
4079
4095
|
var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd;
|
|
4080
4096
|
if (separateBeginAndEnd) {
|
|
4097
|
+
ts.Debug.assert(!results, "`results` are not supported for events with `separateBeginAndEnd`");
|
|
4081
4098
|
writeEvent("E", phase, name, args, /*extras*/ undefined, endTime);
|
|
4082
4099
|
}
|
|
4083
4100
|
// test if [time,endTime) straddles a sampling point
|
|
4084
4101
|
else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
|
|
4085
|
-
writeEvent("X", phase, name, args, "\"dur\":" + (endTime - time), time);
|
|
4102
|
+
writeEvent("X", phase, name, __assign(__assign({}, args), { results: results }), "\"dur\":" + (endTime - time), time);
|
|
4086
4103
|
}
|
|
4087
4104
|
}
|
|
4088
4105
|
function writeEvent(eventType, phase, name, args, extras, time) {
|
|
@@ -67698,7 +67715,7 @@ var ts;
|
|
|
67698
67715
|
_loop_22(tp);
|
|
67699
67716
|
}
|
|
67700
67717
|
links.variances = variances;
|
|
67701
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
67718
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
67702
67719
|
}
|
|
67703
67720
|
return links.variances;
|
|
67704
67721
|
}
|
|
@@ -80779,12 +80796,14 @@ var ts;
|
|
|
80779
80796
|
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
80780
80797
|
}
|
|
80781
80798
|
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
80799
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
80782
80800
|
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
80783
80801
|
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
80784
80802
|
var saveVarianceTypeParameter = typeParameter;
|
|
80785
80803
|
varianceTypeParameter = typeParameter;
|
|
80786
80804
|
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
80787
80805
|
varianceTypeParameter = saveVarianceTypeParameter;
|
|
80806
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
80788
80807
|
}
|
|
80789
80808
|
}
|
|
80790
80809
|
}
|
|
@@ -82180,8 +82199,17 @@ var ts;
|
|
|
82180
82199
|
}
|
|
82181
82200
|
// For a union, get a union of the awaited types of each constituent.
|
|
82182
82201
|
if (type.flags & 1048576 /* Union */) {
|
|
82202
|
+
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
82203
|
+
if (errorNode) {
|
|
82204
|
+
error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
82205
|
+
}
|
|
82206
|
+
return undefined;
|
|
82207
|
+
}
|
|
82183
82208
|
var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
|
|
82184
|
-
|
|
82209
|
+
awaitedTypeStack.push(type.id);
|
|
82210
|
+
var mapped = mapType(type, mapper);
|
|
82211
|
+
awaitedTypeStack.pop();
|
|
82212
|
+
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
82185
82213
|
}
|
|
82186
82214
|
var thisTypeForErrorOut = { value: undefined };
|
|
82187
82215
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
@@ -133975,37 +134003,36 @@ var ts;
|
|
|
133975
134003
|
}
|
|
133976
134004
|
}
|
|
133977
134005
|
var entries = ts.createSortedArray();
|
|
133978
|
-
|
|
133979
|
-
|
|
133980
|
-
|
|
133981
|
-
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
133982
|
-
}
|
|
133983
|
-
else {
|
|
133984
|
-
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
133985
|
-
return undefined;
|
|
133986
|
-
}
|
|
133987
|
-
getCompletionEntriesFromSymbols(symbols, entries,
|
|
133988
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
134006
|
+
var isChecked = isCheckedFile(sourceFile, compilerOptions);
|
|
134007
|
+
if (isChecked && !isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
134008
|
+
return undefined;
|
|
133989
134009
|
}
|
|
134010
|
+
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
134011
|
+
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
133990
134012
|
if (keywordFilters !== 0 /* None */) {
|
|
133991
|
-
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
133992
134013
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
133993
134014
|
var keywordEntry = _a[_i];
|
|
133994
|
-
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !
|
|
134015
|
+
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !uniqueNames.has(keywordEntry.name)) {
|
|
134016
|
+
uniqueNames.add(keywordEntry.name);
|
|
133995
134017
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133996
134018
|
}
|
|
133997
134019
|
}
|
|
133998
134020
|
}
|
|
133999
|
-
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
134000
134021
|
for (var _b = 0, _c = getContextualKeywords(contextToken, position); _b < _c.length; _b++) {
|
|
134001
134022
|
var keywordEntry = _c[_b];
|
|
134002
|
-
if (!
|
|
134023
|
+
if (!uniqueNames.has(keywordEntry.name)) {
|
|
134024
|
+
uniqueNames.add(keywordEntry.name);
|
|
134003
134025
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
134004
134026
|
}
|
|
134005
134027
|
}
|
|
134006
134028
|
for (var _d = 0, literals_1 = literals; _d < literals_1.length; _d++) {
|
|
134007
134029
|
var literal = literals_1[_d];
|
|
134008
|
-
|
|
134030
|
+
var literalEntry = createCompletionEntryForLiteral(sourceFile, preferences, literal);
|
|
134031
|
+
uniqueNames.add(literalEntry.name);
|
|
134032
|
+
ts.insertSorted(entries, literalEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
134033
|
+
}
|
|
134034
|
+
if (!isChecked) {
|
|
134035
|
+
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
134009
134036
|
}
|
|
134010
134037
|
return {
|
|
134011
134038
|
flags: completionData.flags,
|
|
@@ -134017,8 +134044,8 @@ var ts;
|
|
|
134017
134044
|
entries: entries,
|
|
134018
134045
|
};
|
|
134019
134046
|
}
|
|
134020
|
-
function
|
|
134021
|
-
return ts.isSourceFileJS(sourceFile)
|
|
134047
|
+
function isCheckedFile(sourceFile, compilerOptions) {
|
|
134048
|
+
return !ts.isSourceFileJS(sourceFile) || !!ts.isCheckJsEnabledForFile(sourceFile, compilerOptions);
|
|
134022
134049
|
}
|
|
134023
134050
|
function isMemberCompletionKind(kind) {
|
|
134024
134051
|
switch (kind) {
|
|
@@ -134976,7 +135003,7 @@ var ts;
|
|
|
134976
135003
|
}
|
|
134977
135004
|
function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) {
|
|
134978
135005
|
var typeChecker = program.getTypeChecker();
|
|
134979
|
-
var
|
|
135006
|
+
var inCheckedFile = isCheckedFile(sourceFile, compilerOptions);
|
|
134980
135007
|
var start = ts.timestamp();
|
|
134981
135008
|
var currentToken = ts.getTokenAtPosition(sourceFile, position); // TODO: GH#15853
|
|
134982
135009
|
// We will check for jsdoc comments with insideComment and getJsDocTagAtPosition. (TODO: that seems rather inefficient to check the same thing so many times.)
|
|
@@ -135392,15 +135419,7 @@ var ts;
|
|
|
135392
135419
|
isNewIdentifierLocation = true;
|
|
135393
135420
|
}
|
|
135394
135421
|
var propertyAccess = node.kind === 200 /* ImportType */ ? node : node.parent;
|
|
135395
|
-
if (
|
|
135396
|
-
// In javascript files, for union types, we don't just get the members that
|
|
135397
|
-
// the individual types have in common, we also include all the members that
|
|
135398
|
-
// each individual type has. This is because we're going to add all identifiers
|
|
135399
|
-
// anyways. So we might as well elevate the members that were at least part
|
|
135400
|
-
// of the individual types to a higher status since we know what they are.
|
|
135401
|
-
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
135402
|
-
}
|
|
135403
|
-
else {
|
|
135422
|
+
if (inCheckedFile) {
|
|
135404
135423
|
for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {
|
|
135405
135424
|
var symbol = _a[_i];
|
|
135406
135425
|
if (typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, symbol)) {
|
|
@@ -135408,6 +135427,14 @@ var ts;
|
|
|
135408
135427
|
}
|
|
135409
135428
|
}
|
|
135410
135429
|
}
|
|
135430
|
+
else {
|
|
135431
|
+
// In javascript files, for union types, we don't just get the members that
|
|
135432
|
+
// the individual types have in common, we also include all the members that
|
|
135433
|
+
// each individual type has. This is because we're going to add all identifiers
|
|
135434
|
+
// anyways. So we might as well elevate the members that were at least part
|
|
135435
|
+
// of the individual types to a higher status since we know what they are.
|
|
135436
|
+
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
135437
|
+
}
|
|
135411
135438
|
if (insertAwait && preferences.includeCompletionsWithInsertText) {
|
|
135412
135439
|
var promiseType = typeChecker.getPromisedTypeOfPromise(type);
|
|
135413
135440
|
if (promiseType) {
|
|
@@ -155770,7 +155797,7 @@ var ts;
|
|
|
155770
155797
|
if (!newConstraint)
|
|
155771
155798
|
return;
|
|
155772
155799
|
var newConstraintText = newConstraint[1];
|
|
155773
|
-
changes.insertText(related.file,
|
|
155800
|
+
changes.insertText(related.file, decl.name.end, " extends " + newConstraintText);
|
|
155774
155801
|
}
|
|
155775
155802
|
function findAncestorMatchingSpan(sourceFile, span) {
|
|
155776
155803
|
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
package/lib/typescript.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220630";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -3309,6 +3309,22 @@ var ts;
|
|
|
3309
3309
|
return wrapFunction(deprecation, func);
|
|
3310
3310
|
}
|
|
3311
3311
|
Debug.deprecate = deprecate;
|
|
3312
|
+
function formatVariance(varianceFlags) {
|
|
3313
|
+
var variance = varianceFlags & 7 /* VarianceMask */;
|
|
3314
|
+
var result = variance === 0 /* Invariant */ ? "in out" :
|
|
3315
|
+
variance === 3 /* Bivariant */ ? "[bivariant]" :
|
|
3316
|
+
variance === 2 /* Contravariant */ ? "in" :
|
|
3317
|
+
variance === 1 /* Covariant */ ? "out" :
|
|
3318
|
+
variance === 4 /* Independent */ ? "[independent]" : "";
|
|
3319
|
+
if (varianceFlags & 8 /* Unmeasurable */) {
|
|
3320
|
+
result += " (unmeasurable)";
|
|
3321
|
+
}
|
|
3322
|
+
else if (varianceFlags & 16 /* Unreliable */) {
|
|
3323
|
+
result += " (unreliable)";
|
|
3324
|
+
}
|
|
3325
|
+
return result;
|
|
3326
|
+
}
|
|
3327
|
+
Debug.formatVariance = formatVariance;
|
|
3312
3328
|
})(Debug = ts.Debug || (ts.Debug = {}));
|
|
3313
3329
|
})(ts || (ts = {}));
|
|
3314
3330
|
/* @internal */
|
|
@@ -4050,9 +4066,9 @@ var ts;
|
|
|
4050
4066
|
eventStack.push({ phase: phase, name: name, args: args, time: 1000 * ts.timestamp(), separateBeginAndEnd: separateBeginAndEnd });
|
|
4051
4067
|
}
|
|
4052
4068
|
tracingEnabled.push = push;
|
|
4053
|
-
function pop() {
|
|
4069
|
+
function pop(results) {
|
|
4054
4070
|
ts.Debug.assert(eventStack.length > 0);
|
|
4055
|
-
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp());
|
|
4071
|
+
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp(), results);
|
|
4056
4072
|
eventStack.length--;
|
|
4057
4073
|
}
|
|
4058
4074
|
tracingEnabled.pop = pop;
|
|
@@ -4066,14 +4082,15 @@ var ts;
|
|
|
4066
4082
|
tracingEnabled.popAll = popAll;
|
|
4067
4083
|
// sample every 10ms
|
|
4068
4084
|
var sampleInterval = 1000 * 10;
|
|
4069
|
-
function writeStackEvent(index, endTime) {
|
|
4085
|
+
function writeStackEvent(index, endTime, results) {
|
|
4070
4086
|
var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd;
|
|
4071
4087
|
if (separateBeginAndEnd) {
|
|
4088
|
+
ts.Debug.assert(!results, "`results` are not supported for events with `separateBeginAndEnd`");
|
|
4072
4089
|
writeEvent("E", phase, name, args, /*extras*/ undefined, endTime);
|
|
4073
4090
|
}
|
|
4074
4091
|
// test if [time,endTime) straddles a sampling point
|
|
4075
4092
|
else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
|
|
4076
|
-
writeEvent("X", phase, name, args, "\"dur\":" + (endTime - time), time);
|
|
4093
|
+
writeEvent("X", phase, name, __assign(__assign({}, args), { results: results }), "\"dur\":" + (endTime - time), time);
|
|
4077
4094
|
}
|
|
4078
4095
|
}
|
|
4079
4096
|
function writeEvent(eventType, phase, name, args, extras, time) {
|
|
@@ -67689,7 +67706,7 @@ var ts;
|
|
|
67689
67706
|
_loop_22(tp);
|
|
67690
67707
|
}
|
|
67691
67708
|
links.variances = variances;
|
|
67692
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
67709
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
67693
67710
|
}
|
|
67694
67711
|
return links.variances;
|
|
67695
67712
|
}
|
|
@@ -80770,12 +80787,14 @@ var ts;
|
|
|
80770
80787
|
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
80771
80788
|
}
|
|
80772
80789
|
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
80790
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
80773
80791
|
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
80774
80792
|
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
80775
80793
|
var saveVarianceTypeParameter = typeParameter;
|
|
80776
80794
|
varianceTypeParameter = typeParameter;
|
|
80777
80795
|
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
80778
80796
|
varianceTypeParameter = saveVarianceTypeParameter;
|
|
80797
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
80779
80798
|
}
|
|
80780
80799
|
}
|
|
80781
80800
|
}
|
|
@@ -82171,8 +82190,17 @@ var ts;
|
|
|
82171
82190
|
}
|
|
82172
82191
|
// For a union, get a union of the awaited types of each constituent.
|
|
82173
82192
|
if (type.flags & 1048576 /* Union */) {
|
|
82193
|
+
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
82194
|
+
if (errorNode) {
|
|
82195
|
+
error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
82196
|
+
}
|
|
82197
|
+
return undefined;
|
|
82198
|
+
}
|
|
82174
82199
|
var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
|
|
82175
|
-
|
|
82200
|
+
awaitedTypeStack.push(type.id);
|
|
82201
|
+
var mapped = mapType(type, mapper);
|
|
82202
|
+
awaitedTypeStack.pop();
|
|
82203
|
+
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
82176
82204
|
}
|
|
82177
82205
|
var thisTypeForErrorOut = { value: undefined };
|
|
82178
82206
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
@@ -133966,37 +133994,36 @@ var ts;
|
|
|
133966
133994
|
}
|
|
133967
133995
|
}
|
|
133968
133996
|
var entries = ts.createSortedArray();
|
|
133969
|
-
|
|
133970
|
-
|
|
133971
|
-
|
|
133972
|
-
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
133973
|
-
}
|
|
133974
|
-
else {
|
|
133975
|
-
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
133976
|
-
return undefined;
|
|
133977
|
-
}
|
|
133978
|
-
getCompletionEntriesFromSymbols(symbols, entries,
|
|
133979
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
133997
|
+
var isChecked = isCheckedFile(sourceFile, compilerOptions);
|
|
133998
|
+
if (isChecked && !isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
133999
|
+
return undefined;
|
|
133980
134000
|
}
|
|
134001
|
+
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
134002
|
+
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
133981
134003
|
if (keywordFilters !== 0 /* None */) {
|
|
133982
|
-
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
133983
134004
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
133984
134005
|
var keywordEntry = _a[_i];
|
|
133985
|
-
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !
|
|
134006
|
+
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !uniqueNames.has(keywordEntry.name)) {
|
|
134007
|
+
uniqueNames.add(keywordEntry.name);
|
|
133986
134008
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133987
134009
|
}
|
|
133988
134010
|
}
|
|
133989
134011
|
}
|
|
133990
|
-
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
133991
134012
|
for (var _b = 0, _c = getContextualKeywords(contextToken, position); _b < _c.length; _b++) {
|
|
133992
134013
|
var keywordEntry = _c[_b];
|
|
133993
|
-
if (!
|
|
134014
|
+
if (!uniqueNames.has(keywordEntry.name)) {
|
|
134015
|
+
uniqueNames.add(keywordEntry.name);
|
|
133994
134016
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133995
134017
|
}
|
|
133996
134018
|
}
|
|
133997
134019
|
for (var _d = 0, literals_1 = literals; _d < literals_1.length; _d++) {
|
|
133998
134020
|
var literal = literals_1[_d];
|
|
133999
|
-
|
|
134021
|
+
var literalEntry = createCompletionEntryForLiteral(sourceFile, preferences, literal);
|
|
134022
|
+
uniqueNames.add(literalEntry.name);
|
|
134023
|
+
ts.insertSorted(entries, literalEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
134024
|
+
}
|
|
134025
|
+
if (!isChecked) {
|
|
134026
|
+
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
134000
134027
|
}
|
|
134001
134028
|
return {
|
|
134002
134029
|
flags: completionData.flags,
|
|
@@ -134008,8 +134035,8 @@ var ts;
|
|
|
134008
134035
|
entries: entries,
|
|
134009
134036
|
};
|
|
134010
134037
|
}
|
|
134011
|
-
function
|
|
134012
|
-
return ts.isSourceFileJS(sourceFile)
|
|
134038
|
+
function isCheckedFile(sourceFile, compilerOptions) {
|
|
134039
|
+
return !ts.isSourceFileJS(sourceFile) || !!ts.isCheckJsEnabledForFile(sourceFile, compilerOptions);
|
|
134013
134040
|
}
|
|
134014
134041
|
function isMemberCompletionKind(kind) {
|
|
134015
134042
|
switch (kind) {
|
|
@@ -134967,7 +134994,7 @@ var ts;
|
|
|
134967
134994
|
}
|
|
134968
134995
|
function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) {
|
|
134969
134996
|
var typeChecker = program.getTypeChecker();
|
|
134970
|
-
var
|
|
134997
|
+
var inCheckedFile = isCheckedFile(sourceFile, compilerOptions);
|
|
134971
134998
|
var start = ts.timestamp();
|
|
134972
134999
|
var currentToken = ts.getTokenAtPosition(sourceFile, position); // TODO: GH#15853
|
|
134973
135000
|
// We will check for jsdoc comments with insideComment and getJsDocTagAtPosition. (TODO: that seems rather inefficient to check the same thing so many times.)
|
|
@@ -135383,15 +135410,7 @@ var ts;
|
|
|
135383
135410
|
isNewIdentifierLocation = true;
|
|
135384
135411
|
}
|
|
135385
135412
|
var propertyAccess = node.kind === 200 /* ImportType */ ? node : node.parent;
|
|
135386
|
-
if (
|
|
135387
|
-
// In javascript files, for union types, we don't just get the members that
|
|
135388
|
-
// the individual types have in common, we also include all the members that
|
|
135389
|
-
// each individual type has. This is because we're going to add all identifiers
|
|
135390
|
-
// anyways. So we might as well elevate the members that were at least part
|
|
135391
|
-
// of the individual types to a higher status since we know what they are.
|
|
135392
|
-
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
135393
|
-
}
|
|
135394
|
-
else {
|
|
135413
|
+
if (inCheckedFile) {
|
|
135395
135414
|
for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {
|
|
135396
135415
|
var symbol = _a[_i];
|
|
135397
135416
|
if (typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, symbol)) {
|
|
@@ -135399,6 +135418,14 @@ var ts;
|
|
|
135399
135418
|
}
|
|
135400
135419
|
}
|
|
135401
135420
|
}
|
|
135421
|
+
else {
|
|
135422
|
+
// In javascript files, for union types, we don't just get the members that
|
|
135423
|
+
// the individual types have in common, we also include all the members that
|
|
135424
|
+
// each individual type has. This is because we're going to add all identifiers
|
|
135425
|
+
// anyways. So we might as well elevate the members that were at least part
|
|
135426
|
+
// of the individual types to a higher status since we know what they are.
|
|
135427
|
+
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
135428
|
+
}
|
|
135402
135429
|
if (insertAwait && preferences.includeCompletionsWithInsertText) {
|
|
135403
135430
|
var promiseType = typeChecker.getPromisedTypeOfPromise(type);
|
|
135404
135431
|
if (promiseType) {
|
|
@@ -155761,7 +155788,7 @@ var ts;
|
|
|
155761
155788
|
if (!newConstraint)
|
|
155762
155789
|
return;
|
|
155763
155790
|
var newConstraintText = newConstraint[1];
|
|
155764
|
-
changes.insertText(related.file,
|
|
155791
|
+
changes.insertText(related.file, decl.name.end, " extends " + newConstraintText);
|
|
155765
155792
|
}
|
|
155766
155793
|
function findAncestorMatchingSpan(sourceFile, span) {
|
|
155767
155794
|
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220630";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -3309,6 +3309,22 @@ var ts;
|
|
|
3309
3309
|
return wrapFunction(deprecation, func);
|
|
3310
3310
|
}
|
|
3311
3311
|
Debug.deprecate = deprecate;
|
|
3312
|
+
function formatVariance(varianceFlags) {
|
|
3313
|
+
var variance = varianceFlags & 7 /* VarianceMask */;
|
|
3314
|
+
var result = variance === 0 /* Invariant */ ? "in out" :
|
|
3315
|
+
variance === 3 /* Bivariant */ ? "[bivariant]" :
|
|
3316
|
+
variance === 2 /* Contravariant */ ? "in" :
|
|
3317
|
+
variance === 1 /* Covariant */ ? "out" :
|
|
3318
|
+
variance === 4 /* Independent */ ? "[independent]" : "";
|
|
3319
|
+
if (varianceFlags & 8 /* Unmeasurable */) {
|
|
3320
|
+
result += " (unmeasurable)";
|
|
3321
|
+
}
|
|
3322
|
+
else if (varianceFlags & 16 /* Unreliable */) {
|
|
3323
|
+
result += " (unreliable)";
|
|
3324
|
+
}
|
|
3325
|
+
return result;
|
|
3326
|
+
}
|
|
3327
|
+
Debug.formatVariance = formatVariance;
|
|
3312
3328
|
})(Debug = ts.Debug || (ts.Debug = {}));
|
|
3313
3329
|
})(ts || (ts = {}));
|
|
3314
3330
|
/* @internal */
|
|
@@ -4050,9 +4066,9 @@ var ts;
|
|
|
4050
4066
|
eventStack.push({ phase: phase, name: name, args: args, time: 1000 * ts.timestamp(), separateBeginAndEnd: separateBeginAndEnd });
|
|
4051
4067
|
}
|
|
4052
4068
|
tracingEnabled.push = push;
|
|
4053
|
-
function pop() {
|
|
4069
|
+
function pop(results) {
|
|
4054
4070
|
ts.Debug.assert(eventStack.length > 0);
|
|
4055
|
-
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp());
|
|
4071
|
+
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp(), results);
|
|
4056
4072
|
eventStack.length--;
|
|
4057
4073
|
}
|
|
4058
4074
|
tracingEnabled.pop = pop;
|
|
@@ -4066,14 +4082,15 @@ var ts;
|
|
|
4066
4082
|
tracingEnabled.popAll = popAll;
|
|
4067
4083
|
// sample every 10ms
|
|
4068
4084
|
var sampleInterval = 1000 * 10;
|
|
4069
|
-
function writeStackEvent(index, endTime) {
|
|
4085
|
+
function writeStackEvent(index, endTime, results) {
|
|
4070
4086
|
var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd;
|
|
4071
4087
|
if (separateBeginAndEnd) {
|
|
4088
|
+
ts.Debug.assert(!results, "`results` are not supported for events with `separateBeginAndEnd`");
|
|
4072
4089
|
writeEvent("E", phase, name, args, /*extras*/ undefined, endTime);
|
|
4073
4090
|
}
|
|
4074
4091
|
// test if [time,endTime) straddles a sampling point
|
|
4075
4092
|
else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
|
|
4076
|
-
writeEvent("X", phase, name, args, "\"dur\":" + (endTime - time), time);
|
|
4093
|
+
writeEvent("X", phase, name, __assign(__assign({}, args), { results: results }), "\"dur\":" + (endTime - time), time);
|
|
4077
4094
|
}
|
|
4078
4095
|
}
|
|
4079
4096
|
function writeEvent(eventType, phase, name, args, extras, time) {
|
|
@@ -67689,7 +67706,7 @@ var ts;
|
|
|
67689
67706
|
_loop_22(tp);
|
|
67690
67707
|
}
|
|
67691
67708
|
links.variances = variances;
|
|
67692
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
67709
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
67693
67710
|
}
|
|
67694
67711
|
return links.variances;
|
|
67695
67712
|
}
|
|
@@ -80770,12 +80787,14 @@ var ts;
|
|
|
80770
80787
|
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
80771
80788
|
}
|
|
80772
80789
|
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
80790
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
80773
80791
|
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
80774
80792
|
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
80775
80793
|
var saveVarianceTypeParameter = typeParameter;
|
|
80776
80794
|
varianceTypeParameter = typeParameter;
|
|
80777
80795
|
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
80778
80796
|
varianceTypeParameter = saveVarianceTypeParameter;
|
|
80797
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
80779
80798
|
}
|
|
80780
80799
|
}
|
|
80781
80800
|
}
|
|
@@ -82171,8 +82190,17 @@ var ts;
|
|
|
82171
82190
|
}
|
|
82172
82191
|
// For a union, get a union of the awaited types of each constituent.
|
|
82173
82192
|
if (type.flags & 1048576 /* Union */) {
|
|
82193
|
+
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
82194
|
+
if (errorNode) {
|
|
82195
|
+
error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
82196
|
+
}
|
|
82197
|
+
return undefined;
|
|
82198
|
+
}
|
|
82174
82199
|
var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
|
|
82175
|
-
|
|
82200
|
+
awaitedTypeStack.push(type.id);
|
|
82201
|
+
var mapped = mapType(type, mapper);
|
|
82202
|
+
awaitedTypeStack.pop();
|
|
82203
|
+
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
82176
82204
|
}
|
|
82177
82205
|
var thisTypeForErrorOut = { value: undefined };
|
|
82178
82206
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
@@ -133966,37 +133994,36 @@ var ts;
|
|
|
133966
133994
|
}
|
|
133967
133995
|
}
|
|
133968
133996
|
var entries = ts.createSortedArray();
|
|
133969
|
-
|
|
133970
|
-
|
|
133971
|
-
|
|
133972
|
-
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
133973
|
-
}
|
|
133974
|
-
else {
|
|
133975
|
-
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
133976
|
-
return undefined;
|
|
133977
|
-
}
|
|
133978
|
-
getCompletionEntriesFromSymbols(symbols, entries,
|
|
133979
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
133997
|
+
var isChecked = isCheckedFile(sourceFile, compilerOptions);
|
|
133998
|
+
if (isChecked && !isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
133999
|
+
return undefined;
|
|
133980
134000
|
}
|
|
134001
|
+
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
134002
|
+
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
133981
134003
|
if (keywordFilters !== 0 /* None */) {
|
|
133982
|
-
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
133983
134004
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
133984
134005
|
var keywordEntry = _a[_i];
|
|
133985
|
-
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !
|
|
134006
|
+
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !uniqueNames.has(keywordEntry.name)) {
|
|
134007
|
+
uniqueNames.add(keywordEntry.name);
|
|
133986
134008
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133987
134009
|
}
|
|
133988
134010
|
}
|
|
133989
134011
|
}
|
|
133990
|
-
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
133991
134012
|
for (var _b = 0, _c = getContextualKeywords(contextToken, position); _b < _c.length; _b++) {
|
|
133992
134013
|
var keywordEntry = _c[_b];
|
|
133993
|
-
if (!
|
|
134014
|
+
if (!uniqueNames.has(keywordEntry.name)) {
|
|
134015
|
+
uniqueNames.add(keywordEntry.name);
|
|
133994
134016
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133995
134017
|
}
|
|
133996
134018
|
}
|
|
133997
134019
|
for (var _d = 0, literals_1 = literals; _d < literals_1.length; _d++) {
|
|
133998
134020
|
var literal = literals_1[_d];
|
|
133999
|
-
|
|
134021
|
+
var literalEntry = createCompletionEntryForLiteral(sourceFile, preferences, literal);
|
|
134022
|
+
uniqueNames.add(literalEntry.name);
|
|
134023
|
+
ts.insertSorted(entries, literalEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
134024
|
+
}
|
|
134025
|
+
if (!isChecked) {
|
|
134026
|
+
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
134000
134027
|
}
|
|
134001
134028
|
return {
|
|
134002
134029
|
flags: completionData.flags,
|
|
@@ -134008,8 +134035,8 @@ var ts;
|
|
|
134008
134035
|
entries: entries,
|
|
134009
134036
|
};
|
|
134010
134037
|
}
|
|
134011
|
-
function
|
|
134012
|
-
return ts.isSourceFileJS(sourceFile)
|
|
134038
|
+
function isCheckedFile(sourceFile, compilerOptions) {
|
|
134039
|
+
return !ts.isSourceFileJS(sourceFile) || !!ts.isCheckJsEnabledForFile(sourceFile, compilerOptions);
|
|
134013
134040
|
}
|
|
134014
134041
|
function isMemberCompletionKind(kind) {
|
|
134015
134042
|
switch (kind) {
|
|
@@ -134967,7 +134994,7 @@ var ts;
|
|
|
134967
134994
|
}
|
|
134968
134995
|
function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) {
|
|
134969
134996
|
var typeChecker = program.getTypeChecker();
|
|
134970
|
-
var
|
|
134997
|
+
var inCheckedFile = isCheckedFile(sourceFile, compilerOptions);
|
|
134971
134998
|
var start = ts.timestamp();
|
|
134972
134999
|
var currentToken = ts.getTokenAtPosition(sourceFile, position); // TODO: GH#15853
|
|
134973
135000
|
// We will check for jsdoc comments with insideComment and getJsDocTagAtPosition. (TODO: that seems rather inefficient to check the same thing so many times.)
|
|
@@ -135383,15 +135410,7 @@ var ts;
|
|
|
135383
135410
|
isNewIdentifierLocation = true;
|
|
135384
135411
|
}
|
|
135385
135412
|
var propertyAccess = node.kind === 200 /* ImportType */ ? node : node.parent;
|
|
135386
|
-
if (
|
|
135387
|
-
// In javascript files, for union types, we don't just get the members that
|
|
135388
|
-
// the individual types have in common, we also include all the members that
|
|
135389
|
-
// each individual type has. This is because we're going to add all identifiers
|
|
135390
|
-
// anyways. So we might as well elevate the members that were at least part
|
|
135391
|
-
// of the individual types to a higher status since we know what they are.
|
|
135392
|
-
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
135393
|
-
}
|
|
135394
|
-
else {
|
|
135413
|
+
if (inCheckedFile) {
|
|
135395
135414
|
for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {
|
|
135396
135415
|
var symbol = _a[_i];
|
|
135397
135416
|
if (typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, symbol)) {
|
|
@@ -135399,6 +135418,14 @@ var ts;
|
|
|
135399
135418
|
}
|
|
135400
135419
|
}
|
|
135401
135420
|
}
|
|
135421
|
+
else {
|
|
135422
|
+
// In javascript files, for union types, we don't just get the members that
|
|
135423
|
+
// the individual types have in common, we also include all the members that
|
|
135424
|
+
// each individual type has. This is because we're going to add all identifiers
|
|
135425
|
+
// anyways. So we might as well elevate the members that were at least part
|
|
135426
|
+
// of the individual types to a higher status since we know what they are.
|
|
135427
|
+
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
135428
|
+
}
|
|
135402
135429
|
if (insertAwait && preferences.includeCompletionsWithInsertText) {
|
|
135403
135430
|
var promiseType = typeChecker.getPromisedTypeOfPromise(type);
|
|
135404
135431
|
if (promiseType) {
|
|
@@ -155761,7 +155788,7 @@ var ts;
|
|
|
155761
155788
|
if (!newConstraint)
|
|
155762
155789
|
return;
|
|
155763
155790
|
var newConstraintText = newConstraint[1];
|
|
155764
|
-
changes.insertText(related.file,
|
|
155791
|
+
changes.insertText(related.file, decl.name.end, " extends " + newConstraintText);
|
|
155765
155792
|
}
|
|
155766
155793
|
function findAncestorMatchingSpan(sourceFile, span) {
|
|
155767
155794
|
var token = ts.getTokenAtPosition(sourceFile, span.start);
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220630";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -3104,6 +3104,22 @@ var ts;
|
|
|
3104
3104
|
return wrapFunction(deprecation, func);
|
|
3105
3105
|
}
|
|
3106
3106
|
Debug.deprecate = deprecate;
|
|
3107
|
+
function formatVariance(varianceFlags) {
|
|
3108
|
+
var variance = varianceFlags & 7 /* VarianceMask */;
|
|
3109
|
+
var result = variance === 0 /* Invariant */ ? "in out" :
|
|
3110
|
+
variance === 3 /* Bivariant */ ? "[bivariant]" :
|
|
3111
|
+
variance === 2 /* Contravariant */ ? "in" :
|
|
3112
|
+
variance === 1 /* Covariant */ ? "out" :
|
|
3113
|
+
variance === 4 /* Independent */ ? "[independent]" : "";
|
|
3114
|
+
if (varianceFlags & 8 /* Unmeasurable */) {
|
|
3115
|
+
result += " (unmeasurable)";
|
|
3116
|
+
}
|
|
3117
|
+
else if (varianceFlags & 16 /* Unreliable */) {
|
|
3118
|
+
result += " (unreliable)";
|
|
3119
|
+
}
|
|
3120
|
+
return result;
|
|
3121
|
+
}
|
|
3122
|
+
Debug.formatVariance = formatVariance;
|
|
3107
3123
|
})(Debug = ts.Debug || (ts.Debug = {}));
|
|
3108
3124
|
})(ts || (ts = {}));
|
|
3109
3125
|
/* @internal */
|
|
@@ -3845,9 +3861,9 @@ var ts;
|
|
|
3845
3861
|
eventStack.push({ phase: phase, name: name, args: args, time: 1000 * ts.timestamp(), separateBeginAndEnd: separateBeginAndEnd });
|
|
3846
3862
|
}
|
|
3847
3863
|
tracingEnabled.push = push;
|
|
3848
|
-
function pop() {
|
|
3864
|
+
function pop(results) {
|
|
3849
3865
|
ts.Debug.assert(eventStack.length > 0);
|
|
3850
|
-
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp());
|
|
3866
|
+
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp(), results);
|
|
3851
3867
|
eventStack.length--;
|
|
3852
3868
|
}
|
|
3853
3869
|
tracingEnabled.pop = pop;
|
|
@@ -3861,14 +3877,15 @@ var ts;
|
|
|
3861
3877
|
tracingEnabled.popAll = popAll;
|
|
3862
3878
|
// sample every 10ms
|
|
3863
3879
|
var sampleInterval = 1000 * 10;
|
|
3864
|
-
function writeStackEvent(index, endTime) {
|
|
3880
|
+
function writeStackEvent(index, endTime, results) {
|
|
3865
3881
|
var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd;
|
|
3866
3882
|
if (separateBeginAndEnd) {
|
|
3883
|
+
ts.Debug.assert(!results, "`results` are not supported for events with `separateBeginAndEnd`");
|
|
3867
3884
|
writeEvent("E", phase, name, args, /*extras*/ undefined, endTime);
|
|
3868
3885
|
}
|
|
3869
3886
|
// test if [time,endTime) straddles a sampling point
|
|
3870
3887
|
else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
|
|
3871
|
-
writeEvent("X", phase, name, args, "\"dur\":" + (endTime - time), time);
|
|
3888
|
+
writeEvent("X", phase, name, __assign(__assign({}, args), { results: results }), "\"dur\":" + (endTime - time), time);
|
|
3872
3889
|
}
|
|
3873
3890
|
}
|
|
3874
3891
|
function writeEvent(eventType, phase, name, args, extras, time) {
|
|
@@ -67484,7 +67501,7 @@ var ts;
|
|
|
67484
67501
|
_loop_22(tp);
|
|
67485
67502
|
}
|
|
67486
67503
|
links.variances = variances;
|
|
67487
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
67504
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
67488
67505
|
}
|
|
67489
67506
|
return links.variances;
|
|
67490
67507
|
}
|
|
@@ -80565,12 +80582,14 @@ var ts;
|
|
|
80565
80582
|
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
80566
80583
|
}
|
|
80567
80584
|
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
80585
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
80568
80586
|
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
80569
80587
|
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
80570
80588
|
var saveVarianceTypeParameter = typeParameter;
|
|
80571
80589
|
varianceTypeParameter = typeParameter;
|
|
80572
80590
|
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
80573
80591
|
varianceTypeParameter = saveVarianceTypeParameter;
|
|
80592
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
80574
80593
|
}
|
|
80575
80594
|
}
|
|
80576
80595
|
}
|
|
@@ -81966,8 +81985,17 @@ var ts;
|
|
|
81966
81985
|
}
|
|
81967
81986
|
// For a union, get a union of the awaited types of each constituent.
|
|
81968
81987
|
if (type.flags & 1048576 /* Union */) {
|
|
81988
|
+
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
81989
|
+
if (errorNode) {
|
|
81990
|
+
error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
81991
|
+
}
|
|
81992
|
+
return undefined;
|
|
81993
|
+
}
|
|
81969
81994
|
var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
|
|
81970
|
-
|
|
81995
|
+
awaitedTypeStack.push(type.id);
|
|
81996
|
+
var mapped = mapType(type, mapper);
|
|
81997
|
+
awaitedTypeStack.pop();
|
|
81998
|
+
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
81971
81999
|
}
|
|
81972
82000
|
var thisTypeForErrorOut = { value: undefined };
|
|
81973
82001
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.8.0-dev.
|
|
5
|
+
"version": "4.8.0-dev.20220630",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|