@typescript-deploys/pr-build 4.6.0-pr-47552-4 → 4.6.0-pr-47548-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es5.d.ts +5 -0
- package/lib/tsc.js +15 -3
- package/lib/tsserver.js +42 -170
- package/lib/tsserverlibrary.d.ts +3 -7
- package/lib/tsserverlibrary.js +42 -170
- package/lib/typescript.d.ts +3 -7
- package/lib/typescript.js +42 -170
- package/lib/typescriptServices.d.ts +3 -7
- package/lib/typescriptServices.js +42 -170
- package/lib/typingsInstaller.js +15 -3
- package/package.json +1 -1
package/lib/lib.es5.d.ts
CHANGED
|
@@ -1625,6 +1625,11 @@ type Uncapitalize<S extends string> = intrinsic;
|
|
|
1625
1625
|
*/
|
|
1626
1626
|
interface ThisType<T> { }
|
|
1627
1627
|
|
|
1628
|
+
/**
|
|
1629
|
+
* Marker for yield expressions return types
|
|
1630
|
+
*/
|
|
1631
|
+
interface YieldType<T> { }
|
|
1632
|
+
|
|
1628
1633
|
/**
|
|
1629
1634
|
* Represents a raw buffer of binary data, which is used to store data for the
|
|
1630
1635
|
* different typed arrays. ArrayBuffers cannot be read from or written to directly,
|
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.6";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220124";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
function tryGetNativeMap() {
|
|
@@ -6681,8 +6681,6 @@ var ts;
|
|
|
6681
6681
|
Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
|
|
6682
6682
|
Declare_a_private_field_named_0: diag(90053, ts.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."),
|
|
6683
6683
|
Includes_imports_of_types_referenced_by_0: diag(90054, ts.DiagnosticCategory.Message, "Includes_imports_of_types_referenced_by_0_90054", "Includes imports of types referenced by '{0}'"),
|
|
6684
|
-
Remove_type_from_import_declaration_from_0: diag(90055, ts.DiagnosticCategory.Message, "Remove_type_from_import_declaration_from_0_90055", "Remove 'type' from import declaration from \"{0}\""),
|
|
6685
|
-
Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""),
|
|
6686
6684
|
Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
|
|
6687
6685
|
Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
|
|
6688
6686
|
Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
|
|
@@ -38905,6 +38903,7 @@ var ts;
|
|
|
38905
38903
|
var globalBooleanType;
|
|
38906
38904
|
var globalRegExpType;
|
|
38907
38905
|
var globalThisType;
|
|
38906
|
+
var globalYieldType;
|
|
38908
38907
|
var anyArrayType;
|
|
38909
38908
|
var autoArrayType;
|
|
38910
38909
|
var anyReadonlyArrayType;
|
|
@@ -58928,6 +58927,14 @@ var ts;
|
|
|
58928
58927
|
return t.flags & 2097152 ? ts.forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t);
|
|
58929
58928
|
});
|
|
58930
58929
|
}
|
|
58930
|
+
function getYieldTypeArgument(type) {
|
|
58931
|
+
return ts.getObjectFlags(type) & 4 && type.target === globalYieldType ? getTypeArguments(type)[0] : undefined;
|
|
58932
|
+
}
|
|
58933
|
+
function getYieldTypeFromContextualType(type) {
|
|
58934
|
+
return mapType(type, function (t) {
|
|
58935
|
+
return t.flags & 2097152 ? ts.forEach(t.types, getYieldTypeArgument) : getYieldTypeArgument(t);
|
|
58936
|
+
});
|
|
58937
|
+
}
|
|
58931
58938
|
function getContextualThisParameterType(func) {
|
|
58932
58939
|
if (func.kind === 213) {
|
|
58933
58940
|
return undefined;
|
|
@@ -64938,6 +64945,10 @@ var ts;
|
|
|
64938
64945
|
return getIterationTypeOfIterable(use, 1, yieldExpressionType, node.expression)
|
|
64939
64946
|
|| anyType;
|
|
64940
64947
|
}
|
|
64948
|
+
var suggestedReturnType = yieldedType && getYieldTypeFromContextualType(yieldedType);
|
|
64949
|
+
if (suggestedReturnType) {
|
|
64950
|
+
return suggestedReturnType;
|
|
64951
|
+
}
|
|
64941
64952
|
else if (returnType) {
|
|
64942
64953
|
return getIterationTypeOfGeneratorFunctionReturnType(2, returnType, isAsync)
|
|
64943
64954
|
|| anyType;
|
|
@@ -71729,6 +71740,7 @@ var ts;
|
|
|
71729
71740
|
globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray", 1) || globalArrayType;
|
|
71730
71741
|
anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType;
|
|
71731
71742
|
globalThisType = getGlobalTypeOrUndefined("ThisType", 1);
|
|
71743
|
+
globalYieldType = getGlobalTypeOrUndefined("YieldType", 1);
|
|
71732
71744
|
if (augmentations) {
|
|
71733
71745
|
for (var _h = 0, augmentations_2 = augmentations; _h < augmentations_2.length; _h++) {
|
|
71734
71746
|
var list = augmentations_2[_h];
|
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-insiders.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220124";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -9467,8 +9467,6 @@ var ts;
|
|
|
9467
9467
|
Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
|
|
9468
9468
|
Declare_a_private_field_named_0: diag(90053, ts.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."),
|
|
9469
9469
|
Includes_imports_of_types_referenced_by_0: diag(90054, ts.DiagnosticCategory.Message, "Includes_imports_of_types_referenced_by_0_90054", "Includes imports of types referenced by '{0}'"),
|
|
9470
|
-
Remove_type_from_import_declaration_from_0: diag(90055, ts.DiagnosticCategory.Message, "Remove_type_from_import_declaration_from_0_90055", "Remove 'type' from import declaration from \"{0}\""),
|
|
9471
|
-
Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""),
|
|
9472
9470
|
Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
|
|
9473
9471
|
Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
|
|
9474
9472
|
Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
|
|
@@ -47509,6 +47507,7 @@ var ts;
|
|
|
47509
47507
|
var globalBooleanType;
|
|
47510
47508
|
var globalRegExpType;
|
|
47511
47509
|
var globalThisType;
|
|
47510
|
+
var globalYieldType;
|
|
47512
47511
|
var anyArrayType;
|
|
47513
47512
|
var autoArrayType;
|
|
47514
47513
|
var anyReadonlyArrayType;
|
|
@@ -70601,6 +70600,14 @@ var ts;
|
|
|
70601
70600
|
return t.flags & 2097152 /* Intersection */ ? ts.forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t);
|
|
70602
70601
|
});
|
|
70603
70602
|
}
|
|
70603
|
+
function getYieldTypeArgument(type) {
|
|
70604
|
+
return ts.getObjectFlags(type) & 4 /* Reference */ && type.target === globalYieldType ? getTypeArguments(type)[0] : undefined;
|
|
70605
|
+
}
|
|
70606
|
+
function getYieldTypeFromContextualType(type) {
|
|
70607
|
+
return mapType(type, function (t) {
|
|
70608
|
+
return t.flags & 2097152 /* Intersection */ ? ts.forEach(t.types, getYieldTypeArgument) : getYieldTypeArgument(t);
|
|
70609
|
+
});
|
|
70610
|
+
}
|
|
70604
70611
|
function getContextualThisParameterType(func) {
|
|
70605
70612
|
if (func.kind === 213 /* ArrowFunction */) {
|
|
70606
70613
|
return undefined;
|
|
@@ -77544,6 +77551,10 @@ var ts;
|
|
|
77544
77551
|
return getIterationTypeOfIterable(use, 1 /* Return */, yieldExpressionType, node.expression)
|
|
77545
77552
|
|| anyType;
|
|
77546
77553
|
}
|
|
77554
|
+
var suggestedReturnType = yieldedType && getYieldTypeFromContextualType(yieldedType);
|
|
77555
|
+
if (suggestedReturnType) {
|
|
77556
|
+
return suggestedReturnType;
|
|
77557
|
+
}
|
|
77547
77558
|
else if (returnType) {
|
|
77548
77559
|
return getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, isAsync)
|
|
77549
77560
|
|| anyType;
|
|
@@ -85482,6 +85493,7 @@ var ts;
|
|
|
85482
85493
|
globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray", /*arity*/ 1) || globalArrayType;
|
|
85483
85494
|
anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType;
|
|
85484
85495
|
globalThisType = getGlobalTypeOrUndefined("ThisType", /*arity*/ 1);
|
|
85496
|
+
globalYieldType = getGlobalTypeOrUndefined("YieldType", /*arity*/ 1);
|
|
85485
85497
|
if (augmentations) {
|
|
85486
85498
|
// merge _nonglobal_ module augmentations.
|
|
85487
85499
|
// this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed
|
|
@@ -128962,8 +128974,6 @@ var ts;
|
|
|
128962
128974
|
CompletionSource["ThisProperty"] = "ThisProperty/";
|
|
128963
128975
|
/** Auto-import that comes attached to a class member snippet */
|
|
128964
128976
|
CompletionSource["ClassMemberSnippet"] = "ClassMemberSnippet/";
|
|
128965
|
-
/** A type-only import that needs to be promoted in order to be used at the completion location */
|
|
128966
|
-
CompletionSource["TypeOnlyAlias"] = "TypeOnlyAlias/";
|
|
128967
128977
|
})(CompletionSource = Completions.CompletionSource || (Completions.CompletionSource = {}));
|
|
128968
128978
|
var SymbolOriginInfoKind;
|
|
128969
128979
|
(function (SymbolOriginInfoKind) {
|
|
@@ -128973,7 +128983,6 @@ var ts;
|
|
|
128973
128983
|
SymbolOriginInfoKind[SymbolOriginInfoKind["Promise"] = 8] = "Promise";
|
|
128974
128984
|
SymbolOriginInfoKind[SymbolOriginInfoKind["Nullable"] = 16] = "Nullable";
|
|
128975
128985
|
SymbolOriginInfoKind[SymbolOriginInfoKind["ResolvedExport"] = 32] = "ResolvedExport";
|
|
128976
|
-
SymbolOriginInfoKind[SymbolOriginInfoKind["TypeOnlyAlias"] = 64] = "TypeOnlyAlias";
|
|
128977
128986
|
SymbolOriginInfoKind[SymbolOriginInfoKind["SymbolMemberNoExport"] = 2] = "SymbolMemberNoExport";
|
|
128978
128987
|
SymbolOriginInfoKind[SymbolOriginInfoKind["SymbolMemberExport"] = 6] = "SymbolMemberExport";
|
|
128979
128988
|
})(SymbolOriginInfoKind || (SymbolOriginInfoKind = {}));
|
|
@@ -129001,9 +129010,6 @@ var ts;
|
|
|
129001
129010
|
function originIsNullableMember(origin) {
|
|
129002
129011
|
return !!(origin.kind & 16 /* Nullable */);
|
|
129003
129012
|
}
|
|
129004
|
-
function originIsTypeOnlyAlias(origin) {
|
|
129005
|
-
return !!(origin && origin.kind & 64 /* TypeOnlyAlias */);
|
|
129006
|
-
}
|
|
129007
129013
|
var KeywordCompletionFilters;
|
|
129008
129014
|
(function (KeywordCompletionFilters) {
|
|
129009
129015
|
KeywordCompletionFilters[KeywordCompletionFilters["None"] = 0] = "None";
|
|
@@ -129408,9 +129414,6 @@ var ts;
|
|
|
129408
129414
|
isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
|
|
129409
129415
|
}
|
|
129410
129416
|
}
|
|
129411
|
-
if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
|
|
129412
|
-
hasAction = true;
|
|
129413
|
-
}
|
|
129414
129417
|
if (preferences.includeCompletionsWithClassMemberSnippets &&
|
|
129415
129418
|
preferences.includeCompletionsWithInsertText &&
|
|
129416
129419
|
completionKind === 3 /* MemberLike */ &&
|
|
@@ -129755,9 +129758,6 @@ var ts;
|
|
|
129755
129758
|
if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 1 /* ThisType */) {
|
|
129756
129759
|
return CompletionSource.ThisProperty;
|
|
129757
129760
|
}
|
|
129758
|
-
if ((origin === null || origin === void 0 ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
|
|
129759
|
-
return CompletionSource.TypeOnlyAlias;
|
|
129760
|
-
}
|
|
129761
129761
|
}
|
|
129762
129762
|
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap, isJsxIdentifierExpected, isRightOfOpenTag) {
|
|
129763
129763
|
var _a;
|
|
@@ -129785,7 +129785,7 @@ var ts;
|
|
|
129785
129785
|
continue;
|
|
129786
129786
|
}
|
|
129787
129787
|
/** True for locals; false for globals, module exports from other files, `this.` completions. */
|
|
129788
|
-
var shouldShadowLaterSymbols =
|
|
129788
|
+
var shouldShadowLaterSymbols = !origin && !(symbol.parent === undefined && !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === location.getSourceFile(); }));
|
|
129789
129789
|
uniques.set(name, shouldShadowLaterSymbols);
|
|
129790
129790
|
ts.insertSorted(entries, entry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
129791
129791
|
}
|
|
@@ -129798,7 +129798,6 @@ var ts;
|
|
|
129798
129798
|
add: function (name) { return uniques.set(name, true); },
|
|
129799
129799
|
};
|
|
129800
129800
|
function shouldIncludeSymbol(symbol, symbolToSortTextIdMap) {
|
|
129801
|
-
var allFlags = symbol.flags;
|
|
129802
129801
|
if (!ts.isSourceFile(location)) {
|
|
129803
129802
|
// export = /**/ here we want to get all meanings, so any symbol is ok
|
|
129804
129803
|
if (ts.isExportAssignment(location.parent)) {
|
|
@@ -129824,10 +129823,11 @@ var ts;
|
|
|
129824
129823
|
|| symbolToSortTextIdMap[ts.getSymbolId(symbolOrigin)] === 11 /* LocationPriority */)) {
|
|
129825
129824
|
return false;
|
|
129826
129825
|
}
|
|
129827
|
-
|
|
129826
|
+
// Continue with origin symbol
|
|
129827
|
+
symbol = symbolOrigin;
|
|
129828
129828
|
// import m = /**/ <-- It can only access namespace (if typing import = x. this would get member symbols and not namespace)
|
|
129829
129829
|
if (ts.isInRightSideOfInternalImportEqualsDeclaration(location)) {
|
|
129830
|
-
return !!(
|
|
129830
|
+
return !!(symbol.flags & 1920 /* Namespace */);
|
|
129831
129831
|
}
|
|
129832
129832
|
if (isTypeOnlyLocation) {
|
|
129833
129833
|
// It's a type, but you can reach it by namespace.type as well
|
|
@@ -129835,7 +129835,7 @@ var ts;
|
|
|
129835
129835
|
}
|
|
129836
129836
|
}
|
|
129837
129837
|
// expressions are value space (which includes the value namespaces)
|
|
129838
|
-
return !!(
|
|
129838
|
+
return !!(ts.getCombinedLocalAndExportSymbolFlags(symbol) & 111551 /* Value */);
|
|
129839
129839
|
}
|
|
129840
129840
|
}
|
|
129841
129841
|
Completions.getCompletionEntriesFromSymbols = getCompletionEntriesFromSymbols;
|
|
@@ -129988,11 +129988,6 @@ var ts;
|
|
|
129988
129988
|
};
|
|
129989
129989
|
}
|
|
129990
129990
|
}
|
|
129991
|
-
if (originIsTypeOnlyAlias(origin)) {
|
|
129992
|
-
var codeAction_1 = ts.codefix.getPromoteTypeOnlyCompletionAction(sourceFile, origin.declaration.name, program, host, formatContext, preferences);
|
|
129993
|
-
ts.Debug.assertIsDefined(codeAction_1, "Expected to have a code action for promoting type-only alias");
|
|
129994
|
-
return { codeActions: [codeAction_1], sourceDisplay: undefined };
|
|
129995
|
-
}
|
|
129996
129991
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
129997
129992
|
return { codeActions: undefined, sourceDisplay: undefined };
|
|
129998
129993
|
}
|
|
@@ -130669,29 +130664,21 @@ var ts;
|
|
|
130669
130664
|
var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;
|
|
130670
130665
|
isInSnippetScope = isSnippetScope(scopeNode);
|
|
130671
130666
|
var symbolMeanings = (isTypeOnlyLocation ? 0 /* None */ : 111551 /* Value */) | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
|
|
130672
|
-
var typeOnlyAliasNeedsPromotion = previousToken && !ts.isValidTypeOnlyAliasUseSite(previousToken);
|
|
130673
130667
|
symbols = ts.concatenate(symbols, typeChecker.getSymbolsInScope(scopeNode, symbolMeanings));
|
|
130674
130668
|
ts.Debug.assertEachIsDefined(symbols, "getSymbolsInScope() should all be defined");
|
|
130675
|
-
for (var
|
|
130676
|
-
var symbol =
|
|
130669
|
+
for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
|
|
130670
|
+
var symbol = symbols_1[_i];
|
|
130677
130671
|
if (!typeChecker.isArgumentsSymbol(symbol) &&
|
|
130678
130672
|
!ts.some(symbol.declarations, function (d) { return d.getSourceFile() === sourceFile; })) {
|
|
130679
130673
|
symbolToSortTextIdMap[ts.getSymbolId(symbol)] = 15 /* GlobalsOrKeywords */;
|
|
130680
130674
|
}
|
|
130681
|
-
if (typeOnlyAliasNeedsPromotion && !(symbol.flags & 111551 /* Value */)) {
|
|
130682
|
-
var typeOnlyAliasDeclaration = symbol.declarations && ts.find(symbol.declarations, ts.isTypeOnlyImportOrExportDeclaration);
|
|
130683
|
-
if (typeOnlyAliasDeclaration) {
|
|
130684
|
-
var origin = { kind: 64 /* TypeOnlyAlias */, declaration: typeOnlyAliasDeclaration };
|
|
130685
|
-
symbolToOriginInfoMap[i] = origin;
|
|
130686
|
-
}
|
|
130687
|
-
}
|
|
130688
130675
|
}
|
|
130689
130676
|
// Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions`
|
|
130690
130677
|
if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 303 /* SourceFile */) {
|
|
130691
130678
|
var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false);
|
|
130692
130679
|
if (thisType && !isProbablyGlobalType(thisType, sourceFile, typeChecker)) {
|
|
130693
|
-
for (var
|
|
130694
|
-
var symbol = _a
|
|
130680
|
+
for (var _a = 0, _b = getPropertiesForCompletion(thisType, typeChecker); _a < _b.length; _a++) {
|
|
130681
|
+
var symbol = _b[_a];
|
|
130695
130682
|
symbolToOriginInfoMap[symbols.length] = { kind: 1 /* ThisType */ };
|
|
130696
130683
|
symbols.push(symbol);
|
|
130697
130684
|
symbolToSortTextIdMap[ts.getSymbolId(symbol)] = 14 /* SuggestedClassMembers */;
|
|
@@ -132090,14 +132077,10 @@ var ts;
|
|
|
132090
132077
|
/** True if symbol is a type or a module containing at least one type. */
|
|
132091
132078
|
function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) {
|
|
132092
132079
|
if (seenModules === void 0) { seenModules = new ts.Map(); }
|
|
132093
|
-
|
|
132094
|
-
|
|
132095
|
-
|
|
132096
|
-
|
|
132097
|
-
return !!(symbol.flags & 788968 /* Type */) || checker.isUnknownSymbol(symbol) ||
|
|
132098
|
-
!!(symbol.flags & 1536 /* Module */) && ts.addToSeen(seenModules, ts.getSymbolId(symbol)) &&
|
|
132099
|
-
checker.getExportsOfModule(symbol).some(function (e) { return symbolCanBeReferencedAtTypeLocation(e, checker, seenModules); });
|
|
132100
|
-
}
|
|
132080
|
+
var sym = ts.skipAlias(symbol.exportSymbol || symbol, checker);
|
|
132081
|
+
return !!(sym.flags & 788968 /* Type */) || checker.isUnknownSymbol(sym) ||
|
|
132082
|
+
!!(sym.flags & 1536 /* Module */) && ts.addToSeen(seenModules, ts.getSymbolId(sym)) &&
|
|
132083
|
+
checker.getExportsOfModule(sym).some(function (e) { return symbolCanBeReferencedAtTypeLocation(e, checker, seenModules); });
|
|
132101
132084
|
}
|
|
132102
132085
|
function isDeprecated(symbol, checker) {
|
|
132103
132086
|
var declarations = ts.skipAlias(symbol, checker).declarations;
|
|
@@ -134351,8 +134334,8 @@ var ts;
|
|
|
134351
134334
|
var sourceId = ts.getNodeId(sourceFile);
|
|
134352
134335
|
var seenSymbols = this.sourceFileToSeenSymbols[sourceId] || (this.sourceFileToSeenSymbols[sourceId] = new ts.Set());
|
|
134353
134336
|
var anyNewSymbols = false;
|
|
134354
|
-
for (var _i = 0,
|
|
134355
|
-
var sym =
|
|
134337
|
+
for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
|
|
134338
|
+
var sym = symbols_2[_i];
|
|
134356
134339
|
anyNewSymbols = ts.tryAddToSet(seenSymbols, ts.getSymbolId(sym)) || anyNewSymbols;
|
|
134357
134340
|
}
|
|
134358
134341
|
return anyNewSymbols;
|
|
@@ -145204,7 +145187,6 @@ var ts;
|
|
|
145204
145187
|
ChangeTracker.prototype.delete = function (sourceFile, node) {
|
|
145205
145188
|
this.deletedNodes.push({ sourceFile: sourceFile, node: node });
|
|
145206
145189
|
};
|
|
145207
|
-
/** Stop! Consider using `delete` instead, which has logic for deleting nodes from delimited lists. */
|
|
145208
145190
|
ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) {
|
|
145209
145191
|
if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; }
|
|
145210
145192
|
this.deleteRange(sourceFile, getAdjustedRange(sourceFile, node, node, options));
|
|
@@ -145608,15 +145590,6 @@ var ts;
|
|
|
145608
145590
|
ChangeTracker.prototype.insertExportModifier = function (sourceFile, node) {
|
|
145609
145591
|
this.insertText(sourceFile, node.getStart(sourceFile), "export ");
|
|
145610
145592
|
};
|
|
145611
|
-
ChangeTracker.prototype.insertImportSpecifierAtIndex = function (sourceFile, importSpecifier, namedImports, index) {
|
|
145612
|
-
var prevSpecifier = namedImports.elements[index - 1];
|
|
145613
|
-
if (prevSpecifier) {
|
|
145614
|
-
this.insertNodeInListAfter(sourceFile, prevSpecifier, importSpecifier);
|
|
145615
|
-
}
|
|
145616
|
-
else {
|
|
145617
|
-
this.insertNodeBefore(sourceFile, namedImports.elements[0], importSpecifier, !ts.positionsAreOnSameLine(namedImports.elements[0].getStart(), namedImports.parent.parent.getStart(), sourceFile));
|
|
145618
|
-
}
|
|
145619
|
-
};
|
|
145620
145593
|
/**
|
|
145621
145594
|
* This function should be used to insert nodes in lists when nodes don't carry separators as the part of the node range,
|
|
145622
145595
|
* i.e. arguments in arguments lists, parameters in parameter lists etc.
|
|
@@ -149119,8 +149092,7 @@ var ts;
|
|
|
149119
149092
|
ts.Diagnostics.Cannot_find_namespace_0.code,
|
|
149120
149093
|
ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code,
|
|
149121
149094
|
ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here.code,
|
|
149122
|
-
ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code
|
|
149123
|
-
ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code,
|
|
149095
|
+
ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code
|
|
149124
149096
|
];
|
|
149125
149097
|
codefix.registerCodeFix({
|
|
149126
149098
|
errorCodes: errorCodes,
|
|
@@ -149225,9 +149197,6 @@ var ts;
|
|
|
149225
149197
|
}
|
|
149226
149198
|
break;
|
|
149227
149199
|
}
|
|
149228
|
-
case 4 /* PromoteTypeOnly */:
|
|
149229
|
-
// Excluding from fix-all
|
|
149230
|
-
break;
|
|
149231
149200
|
default:
|
|
149232
149201
|
ts.Debug.assertNever(fix, "fix wasn't never - got kind " + fix.kind);
|
|
149233
149202
|
}
|
|
@@ -149319,7 +149288,6 @@ var ts;
|
|
|
149319
149288
|
ImportFixKind[ImportFixKind["JsdocTypeImport"] = 1] = "JsdocTypeImport";
|
|
149320
149289
|
ImportFixKind[ImportFixKind["AddToExisting"] = 2] = "AddToExisting";
|
|
149321
149290
|
ImportFixKind[ImportFixKind["AddNew"] = 3] = "AddNew";
|
|
149322
|
-
ImportFixKind[ImportFixKind["PromoteTypeOnly"] = 4] = "PromoteTypeOnly";
|
|
149323
149291
|
})(ImportFixKind || (ImportFixKind = {}));
|
|
149324
149292
|
// These should not be combined as bitflags, but are given powers of 2 values to
|
|
149325
149293
|
// easily detect conflicts between `NotAllowed` and `Required` by giving them a unique sum.
|
|
@@ -149345,13 +149313,6 @@ var ts;
|
|
|
149345
149313
|
};
|
|
149346
149314
|
}
|
|
149347
149315
|
codefix.getImportCompletionAction = getImportCompletionAction;
|
|
149348
|
-
function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) {
|
|
149349
|
-
var compilerOptions = program.getCompilerOptions();
|
|
149350
|
-
var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions);
|
|
149351
|
-
var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program);
|
|
149352
|
-
return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, 1 /* Double */, compilerOptions));
|
|
149353
|
-
}
|
|
149354
|
-
codefix.getPromoteTypeOnlyCompletionAction = getPromoteTypeOnlyCompletionAction;
|
|
149355
149316
|
function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
|
|
149356
149317
|
ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; }), "Some exportInfo should match the specified moduleSymbol");
|
|
149357
149318
|
var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
@@ -149632,18 +149593,9 @@ var ts;
|
|
|
149632
149593
|
}
|
|
149633
149594
|
function getFixesInfo(context, errorCode, pos, useAutoImportProvider) {
|
|
149634
149595
|
var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos);
|
|
149635
|
-
|
|
149636
|
-
|
|
149637
|
-
|
|
149638
|
-
if (!ts.isIdentifier(symbolToken)) {
|
|
149639
|
-
return undefined;
|
|
149640
|
-
}
|
|
149641
|
-
if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) {
|
|
149642
|
-
var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions());
|
|
149643
|
-
var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program);
|
|
149644
|
-
return fix && { fixes: [fix], symbolName: symbolName_1 };
|
|
149645
|
-
}
|
|
149646
|
-
var info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
|
|
149596
|
+
var info = errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code
|
|
149597
|
+
? getFixesInfoForUMDImport(context, symbolToken)
|
|
149598
|
+
: ts.isIdentifier(symbolToken) ? getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider) : undefined;
|
|
149647
149599
|
var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
|
|
149648
149600
|
return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter) });
|
|
149649
149601
|
}
|
|
@@ -149767,16 +149719,6 @@ var ts;
|
|
|
149767
149719
|
}));
|
|
149768
149720
|
return { fixes: fixes, symbolName: symbolName };
|
|
149769
149721
|
}
|
|
149770
|
-
function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) {
|
|
149771
|
-
var checker = program.getTypeChecker();
|
|
149772
|
-
var symbol = checker.resolveName(symbolName, symbolToken, 111551 /* Value */, /*excludeGlobals*/ true);
|
|
149773
|
-
if (!symbol)
|
|
149774
|
-
return undefined;
|
|
149775
|
-
var typeOnlyAliasDeclaration = checker.getTypeOnlyAliasDeclaration(symbol);
|
|
149776
|
-
if (!typeOnlyAliasDeclaration || ts.getSourceFileOfNode(typeOnlyAliasDeclaration) !== sourceFile)
|
|
149777
|
-
return undefined;
|
|
149778
|
-
return { kind: 4 /* PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration };
|
|
149779
|
-
}
|
|
149780
149722
|
function jsxModeNeedsExplicitImport(jsx) {
|
|
149781
149723
|
return jsx === 2 /* React */ || jsx === 3 /* ReactNative */;
|
|
149782
149724
|
}
|
|
@@ -149784,18 +149726,12 @@ var ts;
|
|
|
149784
149726
|
var parent = symbolToken.parent;
|
|
149785
149727
|
if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && jsxModeNeedsExplicitImport(compilerOptions.jsx)) {
|
|
149786
149728
|
var jsxNamespace = checker.getJsxNamespace(sourceFile);
|
|
149787
|
-
if (
|
|
149729
|
+
if (ts.isIntrinsicJsxName(symbolToken.text) || !checker.resolveName(jsxNamespace, parent, 111551 /* Value */, /*excludeGlobals*/ true)) {
|
|
149788
149730
|
return jsxNamespace;
|
|
149789
149731
|
}
|
|
149790
149732
|
}
|
|
149791
149733
|
return symbolToken.text;
|
|
149792
149734
|
}
|
|
149793
|
-
function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) {
|
|
149794
|
-
if (ts.isIntrinsicJsxName(symbolToken.text))
|
|
149795
|
-
return true; // If we were triggered by a matching error code on an intrinsic, the error must have been about missing the JSX factory
|
|
149796
|
-
var namespaceSymbol = checker.resolveName(jsxNamespace, symbolToken, 111551 /* Value */, /*excludeGlobals*/ true);
|
|
149797
|
-
return !namespaceSymbol || ts.some(namespaceSymbol.declarations, ts.isTypeOnlyImportOrExportDeclaration) && !(namespaceSymbol.flags & 111551 /* Value */);
|
|
149798
|
-
}
|
|
149799
149735
|
// Returns a map from an exported symbol's ID to a list of every way it's (re-)exported.
|
|
149800
149736
|
function getExportInfos(symbolName, currentTokenMeaning, cancellationToken, fromFile, program, useAutoImportProvider, host, preferences) {
|
|
149801
149737
|
var _a;
|
|
@@ -149894,80 +149830,10 @@ var ts;
|
|
|
149894
149830
|
ts.insertImports(changes, sourceFile, getDeclarations(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport), /*blankLineBetween*/ true);
|
|
149895
149831
|
return [importKind === 1 /* Default */ ? ts.Diagnostics.Import_default_0_from_module_1 : ts.Diagnostics.Import_0_from_module_1, symbolName, moduleSpecifier];
|
|
149896
149832
|
}
|
|
149897
|
-
case 4 /* PromoteTypeOnly */: {
|
|
149898
|
-
var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration;
|
|
149899
|
-
var promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile);
|
|
149900
|
-
return promotedDeclaration.kind === 269 /* ImportSpecifier */
|
|
149901
|
-
? [ts.Diagnostics.Remove_type_from_import_of_0_from_1, symbolName, getModuleSpecifierText(promotedDeclaration.parent.parent)]
|
|
149902
|
-
: [ts.Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)];
|
|
149903
|
-
}
|
|
149904
149833
|
default:
|
|
149905
149834
|
return ts.Debug.assertNever(fix, "Unexpected fix kind " + fix.kind);
|
|
149906
149835
|
}
|
|
149907
149836
|
}
|
|
149908
|
-
function getModuleSpecifierText(promotedDeclaration) {
|
|
149909
|
-
var _a, _b;
|
|
149910
|
-
return promotedDeclaration.kind === 264 /* ImportEqualsDeclaration */
|
|
149911
|
-
? ((_b = ts.tryCast((_a = ts.tryCast(promotedDeclaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression, ts.isStringLiteralLike)) === null || _b === void 0 ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText()
|
|
149912
|
-
: ts.cast(promotedDeclaration.parent.moduleSpecifier, ts.isStringLiteral).text;
|
|
149913
|
-
}
|
|
149914
|
-
function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile) {
|
|
149915
|
-
// See comment in `doAddExistingFix` on constant with the same name.
|
|
149916
|
-
var convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules;
|
|
149917
|
-
switch (aliasDeclaration.kind) {
|
|
149918
|
-
case 269 /* ImportSpecifier */:
|
|
149919
|
-
if (aliasDeclaration.isTypeOnly) {
|
|
149920
|
-
if (aliasDeclaration.parent.elements.length > 1 && ts.OrganizeImports.importSpecifiersAreSorted(aliasDeclaration.parent.elements)) {
|
|
149921
|
-
changes.delete(sourceFile, aliasDeclaration);
|
|
149922
|
-
var newSpecifier = ts.factory.updateImportSpecifier(aliasDeclaration, /*isTypeOnly*/ false, aliasDeclaration.propertyName, aliasDeclaration.name);
|
|
149923
|
-
var insertionIndex = ts.OrganizeImports.getImportSpecifierInsertionIndex(aliasDeclaration.parent.elements, newSpecifier);
|
|
149924
|
-
changes.insertImportSpecifierAtIndex(sourceFile, newSpecifier, aliasDeclaration.parent, insertionIndex);
|
|
149925
|
-
}
|
|
149926
|
-
else {
|
|
149927
|
-
changes.deleteRange(sourceFile, aliasDeclaration.getFirstToken());
|
|
149928
|
-
}
|
|
149929
|
-
return aliasDeclaration;
|
|
149930
|
-
}
|
|
149931
|
-
else {
|
|
149932
|
-
ts.Debug.assert(aliasDeclaration.parent.parent.isTypeOnly);
|
|
149933
|
-
promoteImportClause(aliasDeclaration.parent.parent);
|
|
149934
|
-
return aliasDeclaration.parent.parent;
|
|
149935
|
-
}
|
|
149936
|
-
case 266 /* ImportClause */:
|
|
149937
|
-
promoteImportClause(aliasDeclaration);
|
|
149938
|
-
return aliasDeclaration;
|
|
149939
|
-
case 267 /* NamespaceImport */:
|
|
149940
|
-
promoteImportClause(aliasDeclaration.parent);
|
|
149941
|
-
return aliasDeclaration.parent;
|
|
149942
|
-
case 264 /* ImportEqualsDeclaration */:
|
|
149943
|
-
changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1));
|
|
149944
|
-
return aliasDeclaration;
|
|
149945
|
-
default:
|
|
149946
|
-
ts.Debug.failBadSyntaxKind(aliasDeclaration);
|
|
149947
|
-
}
|
|
149948
|
-
function promoteImportClause(importClause) {
|
|
149949
|
-
changes.delete(sourceFile, ts.getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
|
|
149950
|
-
if (convertExistingToTypeOnly) {
|
|
149951
|
-
var namedImports = ts.tryCast(importClause.namedBindings, ts.isNamedImports);
|
|
149952
|
-
if (namedImports && namedImports.elements.length > 1) {
|
|
149953
|
-
if (ts.OrganizeImports.importSpecifiersAreSorted(namedImports.elements) &&
|
|
149954
|
-
aliasDeclaration.kind === 269 /* ImportSpecifier */ &&
|
|
149955
|
-
namedImports.elements.indexOf(aliasDeclaration) !== 0) {
|
|
149956
|
-
// The import specifier being promoted will be the only non-type-only,
|
|
149957
|
-
// import in the NamedImports, so it should be moved to the front.
|
|
149958
|
-
changes.delete(sourceFile, aliasDeclaration);
|
|
149959
|
-
changes.insertImportSpecifierAtIndex(sourceFile, aliasDeclaration, namedImports, 0);
|
|
149960
|
-
}
|
|
149961
|
-
for (var _i = 0, _a = namedImports.elements; _i < _a.length; _i++) {
|
|
149962
|
-
var element = _a[_i];
|
|
149963
|
-
if (element !== aliasDeclaration && !element.isTypeOnly) {
|
|
149964
|
-
changes.insertModifierBefore(sourceFile, 151 /* TypeKeyword */, element);
|
|
149965
|
-
}
|
|
149966
|
-
}
|
|
149967
|
-
}
|
|
149968
|
-
}
|
|
149969
|
-
}
|
|
149970
|
-
}
|
|
149971
149837
|
function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions) {
|
|
149972
149838
|
var _a;
|
|
149973
149839
|
if (clause.kind === 200 /* ObjectBindingPattern */) {
|
|
@@ -150005,7 +149871,13 @@ var ts;
|
|
|
150005
149871
|
var insertionIndex = convertExistingToTypeOnly && !spec.isTypeOnly
|
|
150006
149872
|
? 0
|
|
150007
149873
|
: ts.OrganizeImports.getImportSpecifierInsertionIndex(existingSpecifiers, spec);
|
|
150008
|
-
|
|
149874
|
+
var prevSpecifier = clause.namedBindings.elements[insertionIndex - 1];
|
|
149875
|
+
if (prevSpecifier) {
|
|
149876
|
+
changes.insertNodeInListAfter(sourceFile, prevSpecifier, spec);
|
|
149877
|
+
}
|
|
149878
|
+
else {
|
|
149879
|
+
changes.insertNodeBefore(sourceFile, existingSpecifiers[0], spec, !ts.positionsAreOnSameLine(existingSpecifiers[0].getStart(), clause.parent.getStart(), sourceFile));
|
|
149880
|
+
}
|
|
150009
149881
|
}
|
|
150010
149882
|
}
|
|
150011
149883
|
else if (existingSpecifiers === null || existingSpecifiers === void 0 ? void 0 : existingSpecifiers.length) {
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -1720,23 +1720,19 @@ declare namespace ts {
|
|
|
1720
1720
|
readonly parent: ImportClause & {
|
|
1721
1721
|
readonly isTypeOnly: true;
|
|
1722
1722
|
};
|
|
1723
|
-
} | ImportSpecifier &
|
|
1724
|
-
readonly isTypeOnly: true;
|
|
1725
|
-
} | {
|
|
1723
|
+
} | ImportSpecifier & {
|
|
1726
1724
|
readonly parent: NamedImports & {
|
|
1727
1725
|
readonly parent: ImportClause & {
|
|
1728
1726
|
readonly isTypeOnly: true;
|
|
1729
1727
|
};
|
|
1730
1728
|
};
|
|
1731
|
-
}
|
|
1732
|
-
readonly isTypeOnly: true;
|
|
1733
|
-
} | {
|
|
1729
|
+
} | ExportSpecifier & {
|
|
1734
1730
|
readonly parent: NamedExports & {
|
|
1735
1731
|
readonly parent: ExportDeclaration & {
|
|
1736
1732
|
readonly isTypeOnly: true;
|
|
1737
1733
|
};
|
|
1738
1734
|
};
|
|
1739
|
-
}
|
|
1735
|
+
};
|
|
1740
1736
|
/**
|
|
1741
1737
|
* This is either an `export =` or an `export default` declaration.
|
|
1742
1738
|
* Unless `isExportEquals` is set, this node was parsed as an `export default`.
|