typescript 4.9.0-dev.20220929 → 4.9.0-dev.20221001
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/protocol.d.ts +7 -0
- package/lib/tsc.js +113 -53
- package/lib/tsserver.js +201 -75
- package/lib/tsserverlibrary.d.ts +14 -0
- package/lib/tsserverlibrary.js +201 -75
- package/lib/typescript.d.ts +7 -0
- package/lib/typescript.js +192 -73
- package/lib/typescriptServices.d.ts +7 -0
- package/lib/typescriptServices.js +192 -73
- package/lib/typingsInstaller.js +142 -56
- package/package.json +2 -2
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 = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
112
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221001");
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -11378,7 +11378,7 @@ var ts;
|
|
|
11378
11378
|
return -1;
|
|
11379
11379
|
}
|
|
11380
11380
|
function peekExtendedUnicodeEscape() {
|
|
11381
|
-
if (
|
|
11381
|
+
if (codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) {
|
|
11382
11382
|
var start_2 = pos;
|
|
11383
11383
|
pos += 3;
|
|
11384
11384
|
var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false);
|
|
@@ -23159,7 +23159,7 @@ var ts;
|
|
|
23159
23159
|
return node;
|
|
23160
23160
|
}
|
|
23161
23161
|
// @api
|
|
23162
|
-
function createIdentifier(text, typeArguments, originalKeywordKind) {
|
|
23162
|
+
function createIdentifier(text, typeArguments, originalKeywordKind, hasExtendedUnicodeEscape) {
|
|
23163
23163
|
var node = createBaseIdentifier(text, originalKeywordKind);
|
|
23164
23164
|
if (typeArguments) {
|
|
23165
23165
|
// NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations
|
|
@@ -23168,6 +23168,10 @@ var ts;
|
|
|
23168
23168
|
if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) {
|
|
23169
23169
|
node.transformFlags |= 67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */;
|
|
23170
23170
|
}
|
|
23171
|
+
if (hasExtendedUnicodeEscape) {
|
|
23172
|
+
node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape;
|
|
23173
|
+
node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */;
|
|
23174
|
+
}
|
|
23171
23175
|
return node;
|
|
23172
23176
|
}
|
|
23173
23177
|
// @api
|
|
@@ -33102,8 +33106,9 @@ var ts;
|
|
|
33102
33106
|
// Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker
|
|
33103
33107
|
var originalKeywordKind = token();
|
|
33104
33108
|
var text = internIdentifier(scanner.getTokenValue());
|
|
33109
|
+
var hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape();
|
|
33105
33110
|
nextTokenWithoutCheck();
|
|
33106
|
-
return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind), pos);
|
|
33111
|
+
return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind, hasExtendedUnicodeEscape), pos);
|
|
33107
33112
|
}
|
|
33108
33113
|
if (token() === 80 /* SyntaxKind.PrivateIdentifier */) {
|
|
33109
33114
|
parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
@@ -49498,6 +49503,12 @@ var ts;
|
|
|
49498
49503
|
getOptionalType: function () { return optionalType; },
|
|
49499
49504
|
getPromiseType: function () { return getGlobalPromiseType(/*reportErrors*/ false); },
|
|
49500
49505
|
getPromiseLikeType: function () { return getGlobalPromiseLikeType(/*reportErrors*/ false); },
|
|
49506
|
+
getAsyncIterableType: function () {
|
|
49507
|
+
var type = getGlobalAsyncIterableType(/*reportErrors*/ false);
|
|
49508
|
+
if (type === emptyGenericType)
|
|
49509
|
+
return undefined;
|
|
49510
|
+
return type;
|
|
49511
|
+
},
|
|
49501
49512
|
isSymbolAccessible: isSymbolAccessible,
|
|
49502
49513
|
isArrayType: isArrayType,
|
|
49503
49514
|
isTupleType: isTupleType,
|
|
@@ -50335,9 +50346,9 @@ var ts;
|
|
|
50335
50346
|
return symbol;
|
|
50336
50347
|
}
|
|
50337
50348
|
if (symbol.flags & 2097152 /* SymbolFlags.Alias */) {
|
|
50338
|
-
var
|
|
50339
|
-
//
|
|
50340
|
-
if (
|
|
50349
|
+
var targetFlags = getAllSymbolFlags(symbol);
|
|
50350
|
+
// `targetFlags` will be `SymbolFlags.All` if an error occurred in alias resolution; this avoids cascading errors
|
|
50351
|
+
if (targetFlags & meaning) {
|
|
50341
50352
|
return symbol;
|
|
50342
50353
|
}
|
|
50343
50354
|
}
|
|
@@ -50970,8 +50981,8 @@ var ts;
|
|
|
50970
50981
|
!checkAndReportErrorForExtendingInterface(errorLocation) &&
|
|
50971
50982
|
!checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
|
|
50972
50983
|
!checkAndReportErrorForExportingPrimitiveType(errorLocation, name) &&
|
|
50984
|
+
!checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) &&
|
|
50973
50985
|
!checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) &&
|
|
50974
|
-
!checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
|
|
50975
50986
|
!checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
|
|
50976
50987
|
var suggestion = void 0;
|
|
50977
50988
|
var suggestedLib = void 0;
|
|
@@ -51058,7 +51069,7 @@ var ts;
|
|
|
51058
51069
|
}
|
|
51059
51070
|
}
|
|
51060
51071
|
if (result && errorLocation && meaning & 111551 /* SymbolFlags.Value */ && result.flags & 2097152 /* SymbolFlags.Alias */ && !(result.flags & 111551 /* SymbolFlags.Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
51061
|
-
var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result);
|
|
51072
|
+
var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* SymbolFlags.Value */);
|
|
51062
51073
|
if (typeOnlyDeclaration) {
|
|
51063
51074
|
var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */
|
|
51064
51075
|
? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
|
|
@@ -51221,7 +51232,7 @@ var ts;
|
|
|
51221
51232
|
return false;
|
|
51222
51233
|
}
|
|
51223
51234
|
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
|
|
51224
|
-
if (meaning &
|
|
51235
|
+
if (meaning & 111551 /* SymbolFlags.Value */) {
|
|
51225
51236
|
if (isPrimitiveTypeName(name)) {
|
|
51226
51237
|
if (isExtendedByInterface(errorLocation)) {
|
|
51227
51238
|
error(errorLocation, ts.Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, ts.unescapeLeadingUnderscores(name));
|
|
@@ -51232,7 +51243,8 @@ var ts;
|
|
|
51232
51243
|
return true;
|
|
51233
51244
|
}
|
|
51234
51245
|
var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
|
|
51235
|
-
|
|
51246
|
+
var allFlags = symbol && getAllSymbolFlags(symbol);
|
|
51247
|
+
if (symbol && allFlags !== undefined && !(allFlags & 111551 /* SymbolFlags.Value */)) {
|
|
51236
51248
|
var rawName = ts.unescapeLeadingUnderscores(name);
|
|
51237
51249
|
if (isES2015OrLaterConstructorName(name)) {
|
|
51238
51250
|
error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later, rawName);
|
|
@@ -51280,16 +51292,16 @@ var ts;
|
|
|
51280
51292
|
}
|
|
51281
51293
|
return false;
|
|
51282
51294
|
}
|
|
51283
|
-
function
|
|
51284
|
-
if (meaning & (111551 /* SymbolFlags.Value */ & ~
|
|
51285
|
-
var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule
|
|
51295
|
+
function checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) {
|
|
51296
|
+
if (meaning & (111551 /* SymbolFlags.Value */ & ~788968 /* SymbolFlags.Type */)) {
|
|
51297
|
+
var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
|
|
51286
51298
|
if (symbol) {
|
|
51287
51299
|
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name));
|
|
51288
51300
|
return true;
|
|
51289
51301
|
}
|
|
51290
51302
|
}
|
|
51291
|
-
else if (meaning & (788968 /* SymbolFlags.Type */ & ~
|
|
51292
|
-
var symbol = resolveSymbol(resolveName(errorLocation, name,
|
|
51303
|
+
else if (meaning & (788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */)) {
|
|
51304
|
+
var symbol = resolveSymbol(resolveName(errorLocation, name, 1536 /* SymbolFlags.Module */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
|
|
51293
51305
|
if (symbol) {
|
|
51294
51306
|
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name));
|
|
51295
51307
|
return true;
|
|
@@ -51879,6 +51891,52 @@ var ts;
|
|
|
51879
51891
|
}
|
|
51880
51892
|
return undefined;
|
|
51881
51893
|
}
|
|
51894
|
+
/**
|
|
51895
|
+
* Gets combined flags of a `symbol` and all alias targets it resolves to. `resolveAlias`
|
|
51896
|
+
* is typically recursive over chains of aliases, but stops mid-chain if an alias is merged
|
|
51897
|
+
* with another exported symbol, e.g.
|
|
51898
|
+
* ```ts
|
|
51899
|
+
* // a.ts
|
|
51900
|
+
* export const a = 0;
|
|
51901
|
+
* // b.ts
|
|
51902
|
+
* export { a } from "./a";
|
|
51903
|
+
* export type a = number;
|
|
51904
|
+
* // c.ts
|
|
51905
|
+
* import { a } from "./b";
|
|
51906
|
+
* ```
|
|
51907
|
+
* Calling `resolveAlias` on the `a` in c.ts would stop at the merged symbol exported
|
|
51908
|
+
* from b.ts, even though there is still more alias to resolve. Consequently, if we were
|
|
51909
|
+
* trying to determine if the `a` in c.ts has a value meaning, looking at the flags on
|
|
51910
|
+
* the local symbol and on the symbol returned by `resolveAlias` is not enough.
|
|
51911
|
+
* @returns SymbolFlags.All if `symbol` is an alias that ultimately resolves to `unknown`;
|
|
51912
|
+
* combined flags of all alias targets otherwise.
|
|
51913
|
+
*/
|
|
51914
|
+
function getAllSymbolFlags(symbol) {
|
|
51915
|
+
var flags = symbol.flags;
|
|
51916
|
+
var seenSymbols;
|
|
51917
|
+
while (symbol.flags & 2097152 /* SymbolFlags.Alias */) {
|
|
51918
|
+
var target = resolveAlias(symbol);
|
|
51919
|
+
if (target === unknownSymbol) {
|
|
51920
|
+
return 67108863 /* SymbolFlags.All */;
|
|
51921
|
+
}
|
|
51922
|
+
// Optimizations - try to avoid creating or adding to
|
|
51923
|
+
// `seenSymbols` if possible
|
|
51924
|
+
if (target === symbol || (seenSymbols === null || seenSymbols === void 0 ? void 0 : seenSymbols.has(target))) {
|
|
51925
|
+
break;
|
|
51926
|
+
}
|
|
51927
|
+
if (target.flags & 2097152 /* SymbolFlags.Alias */) {
|
|
51928
|
+
if (seenSymbols) {
|
|
51929
|
+
seenSymbols.add(target);
|
|
51930
|
+
}
|
|
51931
|
+
else {
|
|
51932
|
+
seenSymbols = new ts.Set([symbol, target]);
|
|
51933
|
+
}
|
|
51934
|
+
}
|
|
51935
|
+
flags |= target.flags;
|
|
51936
|
+
symbol = target;
|
|
51937
|
+
}
|
|
51938
|
+
return flags;
|
|
51939
|
+
}
|
|
51882
51940
|
/**
|
|
51883
51941
|
* Marks a symbol as type-only if its declaration is syntactically type-only.
|
|
51884
51942
|
* If it is not itself marked type-only, but resolves to a type-only alias
|
|
@@ -51924,19 +51982,25 @@ var ts;
|
|
|
51924
51982
|
return !!aliasDeclarationLinks.typeOnlyDeclaration;
|
|
51925
51983
|
}
|
|
51926
51984
|
/** Indicates that a symbol directly or indirectly resolves to a type-only import or export. */
|
|
51927
|
-
function getTypeOnlyAliasDeclaration(symbol) {
|
|
51985
|
+
function getTypeOnlyAliasDeclaration(symbol, include) {
|
|
51928
51986
|
if (!(symbol.flags & 2097152 /* SymbolFlags.Alias */)) {
|
|
51929
51987
|
return undefined;
|
|
51930
51988
|
}
|
|
51931
51989
|
var links = getSymbolLinks(symbol);
|
|
51932
|
-
|
|
51990
|
+
if (include === undefined) {
|
|
51991
|
+
return links.typeOnlyDeclaration || undefined;
|
|
51992
|
+
}
|
|
51993
|
+
if (links.typeOnlyDeclaration) {
|
|
51994
|
+
return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : undefined;
|
|
51995
|
+
}
|
|
51996
|
+
return undefined;
|
|
51933
51997
|
}
|
|
51934
51998
|
function markExportAsReferenced(node) {
|
|
51935
51999
|
var symbol = getSymbolOfNode(node);
|
|
51936
52000
|
var target = resolveAlias(symbol);
|
|
51937
52001
|
if (target) {
|
|
51938
52002
|
var markAlias = target === unknownSymbol ||
|
|
51939
|
-
((target
|
|
52003
|
+
((getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */));
|
|
51940
52004
|
if (markAlias) {
|
|
51941
52005
|
markAliasSymbolAsReferenced(symbol);
|
|
51942
52006
|
}
|
|
@@ -51956,8 +52020,7 @@ var ts;
|
|
|
51956
52020
|
// This way a chain of imports can be elided if ultimately the final input is only used in a type
|
|
51957
52021
|
// position.
|
|
51958
52022
|
if (ts.isInternalModuleImportEqualsDeclaration(node)) {
|
|
51959
|
-
|
|
51960
|
-
if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) {
|
|
52023
|
+
if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551 /* SymbolFlags.Value */) {
|
|
51961
52024
|
// import foo = <symbol>
|
|
51962
52025
|
checkExpressionCached(node.moduleReference);
|
|
51963
52026
|
}
|
|
@@ -52779,7 +52842,7 @@ var ts;
|
|
|
52779
52842
|
}
|
|
52780
52843
|
function symbolIsValue(symbol, includeTypeOnlyMembers) {
|
|
52781
52844
|
return !!(symbol.flags & 111551 /* SymbolFlags.Value */ ||
|
|
52782
|
-
symbol.flags & 2097152 /* SymbolFlags.Alias */ &&
|
|
52845
|
+
symbol.flags & 2097152 /* SymbolFlags.Alias */ && getAllSymbolFlags(symbol) & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol)));
|
|
52783
52846
|
}
|
|
52784
52847
|
function findConstructorDeclaration(node) {
|
|
52785
52848
|
var members = node.members;
|
|
@@ -53048,8 +53111,10 @@ var ts;
|
|
|
53048
53111
|
return true;
|
|
53049
53112
|
}
|
|
53050
53113
|
// Qualify if the symbol from symbol table has same meaning as expected
|
|
53051
|
-
|
|
53052
|
-
|
|
53114
|
+
var shouldResolveAlias = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */));
|
|
53115
|
+
symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
|
|
53116
|
+
var flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags;
|
|
53117
|
+
if (flags & meaning) {
|
|
53053
53118
|
qualify = true;
|
|
53054
53119
|
return true;
|
|
53055
53120
|
}
|
|
@@ -55706,7 +55771,7 @@ var ts;
|
|
|
55706
55771
|
return !symbol.exports ? [] : ts.filter(ts.arrayFrom(symbol.exports.values()), isNamespaceMember);
|
|
55707
55772
|
}
|
|
55708
55773
|
function isTypeOnlyNamespace(symbol) {
|
|
55709
|
-
return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m)
|
|
55774
|
+
return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* SymbolFlags.Value */); });
|
|
55710
55775
|
}
|
|
55711
55776
|
function serializeModule(symbol, symbolName, modifierFlags) {
|
|
55712
55777
|
var members = getNamespaceMembersForSerialization(symbol);
|
|
@@ -57926,7 +57991,7 @@ var ts;
|
|
|
57926
57991
|
links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol)
|
|
57927
57992
|
: isDuplicatedCommonJSExport(symbol.declarations) ? autoType
|
|
57928
57993
|
: declaredType ? declaredType
|
|
57929
|
-
: targetSymbol
|
|
57994
|
+
: getAllSymbolFlags(targetSymbol) & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol)
|
|
57930
57995
|
: errorType;
|
|
57931
57996
|
}
|
|
57932
57997
|
return links.type;
|
|
@@ -60279,7 +60344,7 @@ var ts;
|
|
|
60279
60344
|
var indexTypes;
|
|
60280
60345
|
var isUnion = containingType.flags & 1048576 /* TypeFlags.Union */;
|
|
60281
60346
|
// Flags we want to propagate to the result if they exist in all source symbols
|
|
60282
|
-
var optionalFlag
|
|
60347
|
+
var optionalFlag;
|
|
60283
60348
|
var syntheticFlag = 4 /* CheckFlags.SyntheticMethod */;
|
|
60284
60349
|
var checkFlags = isUnion ? 0 : 8 /* CheckFlags.Readonly */;
|
|
60285
60350
|
var mergedInstantiations = false;
|
|
@@ -60290,11 +60355,14 @@ var ts;
|
|
|
60290
60355
|
var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment);
|
|
60291
60356
|
var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0;
|
|
60292
60357
|
if (prop) {
|
|
60293
|
-
if (
|
|
60294
|
-
optionalFlag
|
|
60295
|
-
|
|
60296
|
-
|
|
60297
|
-
|
|
60358
|
+
if (prop.flags & 106500 /* SymbolFlags.ClassMember */) {
|
|
60359
|
+
optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : (optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */);
|
|
60360
|
+
if (isUnion) {
|
|
60361
|
+
optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */);
|
|
60362
|
+
}
|
|
60363
|
+
else {
|
|
60364
|
+
optionalFlag &= prop.flags;
|
|
60365
|
+
}
|
|
60298
60366
|
}
|
|
60299
60367
|
if (!singleProp) {
|
|
60300
60368
|
singleProp = prop;
|
|
@@ -60413,7 +60481,7 @@ var ts;
|
|
|
60413
60481
|
propTypes.push(type);
|
|
60414
60482
|
}
|
|
60415
60483
|
ts.addRange(propTypes, indexTypes);
|
|
60416
|
-
var result = createSymbol(4 /* SymbolFlags.Property */ | optionalFlag, name, syntheticFlag | checkFlags);
|
|
60484
|
+
var result = createSymbol(4 /* SymbolFlags.Property */ | (optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : 0), name, syntheticFlag | checkFlags);
|
|
60417
60485
|
result.containingType = containingType;
|
|
60418
60486
|
if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
|
|
60419
60487
|
result.valueDeclaration = firstValueDeclaration;
|
|
@@ -67680,7 +67748,7 @@ var ts;
|
|
|
67680
67748
|
return 0 /* Ternary.False */;
|
|
67681
67749
|
}
|
|
67682
67750
|
// When checking for comparability, be more lenient with optional properties.
|
|
67683
|
-
if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) {
|
|
67751
|
+
if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && targetProp.flags & 106500 /* SymbolFlags.ClassMember */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) {
|
|
67684
67752
|
// TypeScript 1.0 spec (April 2014): 3.8.3
|
|
67685
67753
|
// S is a subtype of a type T, and T is a supertype of S if ...
|
|
67686
67754
|
// S' and T are object types and, for each member M in T..
|
|
@@ -72952,9 +73020,9 @@ var ts;
|
|
|
72952
73020
|
});
|
|
72953
73021
|
}
|
|
72954
73022
|
function markAliasReferenced(symbol, location) {
|
|
72955
|
-
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) {
|
|
73023
|
+
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
|
|
72956
73024
|
var target = resolveAlias(symbol);
|
|
72957
|
-
if (target
|
|
73025
|
+
if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
|
|
72958
73026
|
// An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled
|
|
72959
73027
|
// (because the const enum value will not be inlined), or if (2) the alias is an export
|
|
72960
73028
|
// of a const enum declaration that will be preserved.
|
|
@@ -74370,9 +74438,10 @@ var ts;
|
|
|
74370
74438
|
function instantiateContextualType(contextualType, node, contextFlags) {
|
|
74371
74439
|
if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* TypeFlags.Instantiable */)) {
|
|
74372
74440
|
var inferenceContext = getInferenceContext(node);
|
|
74373
|
-
// If no inferences have been made,
|
|
74374
|
-
//
|
|
74375
|
-
|
|
74441
|
+
// If no inferences have been made, and none of the type parameters for which we are inferring
|
|
74442
|
+
// specify default types, nothing is gained from instantiating as type parameters would just be
|
|
74443
|
+
// replaced with their constraints similar to the apparent type.
|
|
74444
|
+
if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) {
|
|
74376
74445
|
// For contextual signatures we incorporate all inferences made so far, e.g. from return
|
|
74377
74446
|
// types as well as arguments to the left in a function call.
|
|
74378
74447
|
return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
|
|
@@ -78846,7 +78915,7 @@ var ts;
|
|
|
78846
78915
|
if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) {
|
|
78847
78916
|
symbol = resolveAlias(symbol);
|
|
78848
78917
|
}
|
|
78849
|
-
return !!(symbol && (symbol
|
|
78918
|
+
return !!(symbol && (getAllSymbolFlags(symbol) & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */);
|
|
78850
78919
|
}
|
|
78851
78920
|
return false;
|
|
78852
78921
|
}
|
|
@@ -81220,6 +81289,9 @@ var ts;
|
|
|
81220
81289
|
function hasInferenceCandidates(info) {
|
|
81221
81290
|
return !!(info.candidates || info.contraCandidates);
|
|
81222
81291
|
}
|
|
81292
|
+
function hasInferenceCandidatesOrDefault(info) {
|
|
81293
|
+
return !!(info.candidates || info.contraCandidates || hasTypeParameterDefault(info.typeParameter));
|
|
81294
|
+
}
|
|
81223
81295
|
function hasOverlappingInferences(a, b) {
|
|
81224
81296
|
for (var i = 0; i < a.length; i++) {
|
|
81225
81297
|
if (hasInferenceCandidates(a[i]) && hasInferenceCandidates(b[i])) {
|
|
@@ -85021,7 +85093,16 @@ var ts;
|
|
|
85021
85093
|
var message = allowAsyncIterables
|
|
85022
85094
|
? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator
|
|
85023
85095
|
: ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator;
|
|
85024
|
-
|
|
85096
|
+
var suggestAwait =
|
|
85097
|
+
// for (const x of Promise<...>) or [...Promise<...>]
|
|
85098
|
+
!!getAwaitedTypeOfPromise(type)
|
|
85099
|
+
// for (const x of AsyncIterable<...>)
|
|
85100
|
+
|| (!allowAsyncIterables &&
|
|
85101
|
+
ts.isForOfStatement(errorNode.parent) &&
|
|
85102
|
+
errorNode.parent.expression === errorNode &&
|
|
85103
|
+
getGlobalAsyncIterableType(/** reportErrors */ false) !== emptyGenericType &&
|
|
85104
|
+
isTypeAssignableTo(type, getGlobalAsyncIterableType(/** reportErrors */ false)));
|
|
85105
|
+
return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
|
|
85025
85106
|
}
|
|
85026
85107
|
/**
|
|
85027
85108
|
* Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type.
|
|
@@ -86872,10 +86953,11 @@ var ts;
|
|
|
86872
86953
|
}
|
|
86873
86954
|
return;
|
|
86874
86955
|
}
|
|
86956
|
+
var targetFlags = getAllSymbolFlags(target);
|
|
86875
86957
|
var excludedMeanings = (symbol.flags & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */) ? 111551 /* SymbolFlags.Value */ : 0) |
|
|
86876
86958
|
(symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) |
|
|
86877
86959
|
(symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0);
|
|
86878
|
-
if (
|
|
86960
|
+
if (targetFlags & excludedMeanings) {
|
|
86879
86961
|
var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ?
|
|
86880
86962
|
ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
|
|
86881
86963
|
ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
|
|
@@ -86885,7 +86967,7 @@ var ts;
|
|
|
86885
86967
|
&& !ts.isTypeOnlyImportOrExportDeclaration(node)
|
|
86886
86968
|
&& !(node.flags & 16777216 /* NodeFlags.Ambient */)) {
|
|
86887
86969
|
var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
|
|
86888
|
-
var isType = !(
|
|
86970
|
+
var isType = !(targetFlags & 111551 /* SymbolFlags.Value */);
|
|
86889
86971
|
if (isType || typeOnlyAlias) {
|
|
86890
86972
|
switch (node.kind) {
|
|
86891
86973
|
case 270 /* SyntaxKind.ImportClause */:
|
|
@@ -87045,14 +87127,15 @@ var ts;
|
|
|
87045
87127
|
if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) {
|
|
87046
87128
|
var target = resolveAlias(getSymbolOfNode(node));
|
|
87047
87129
|
if (target !== unknownSymbol) {
|
|
87048
|
-
|
|
87130
|
+
var targetFlags = getAllSymbolFlags(target);
|
|
87131
|
+
if (targetFlags & 111551 /* SymbolFlags.Value */) {
|
|
87049
87132
|
// Target is a value symbol, check that it is not hidden by a local declaration with the same name
|
|
87050
87133
|
var moduleName = ts.getFirstIdentifier(node.moduleReference);
|
|
87051
87134
|
if (!(resolveEntityName(moduleName, 111551 /* SymbolFlags.Value */ | 1920 /* SymbolFlags.Namespace */).flags & 1920 /* SymbolFlags.Namespace */)) {
|
|
87052
87135
|
error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));
|
|
87053
87136
|
}
|
|
87054
87137
|
}
|
|
87055
|
-
if (
|
|
87138
|
+
if (targetFlags & 788968 /* SymbolFlags.Type */) {
|
|
87056
87139
|
checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);
|
|
87057
87140
|
}
|
|
87058
87141
|
}
|
|
@@ -87191,7 +87274,7 @@ var ts;
|
|
|
87191
87274
|
markExportAsReferenced(node);
|
|
87192
87275
|
}
|
|
87193
87276
|
var target = symbol && (symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol);
|
|
87194
|
-
if (!target || target
|
|
87277
|
+
if (!target || getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
|
|
87195
87278
|
checkExpressionCached(node.propertyName || node.name);
|
|
87196
87279
|
}
|
|
87197
87280
|
}
|
|
@@ -87238,7 +87321,7 @@ var ts;
|
|
|
87238
87321
|
markAliasReferenced(sym, id);
|
|
87239
87322
|
// If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`)
|
|
87240
87323
|
var target = sym.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(sym) : sym;
|
|
87241
|
-
if (target
|
|
87324
|
+
if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
|
|
87242
87325
|
// However if it is a value, we need to check it's being used correctly
|
|
87243
87326
|
checkExpressionCached(node.expression);
|
|
87244
87327
|
}
|
|
@@ -88560,7 +88643,7 @@ var ts;
|
|
|
88560
88643
|
return symbolLinks.exportsSomeValue;
|
|
88561
88644
|
function isValue(s) {
|
|
88562
88645
|
s = resolveSymbol(s);
|
|
88563
|
-
return s && !!(s
|
|
88646
|
+
return s && !!(getAllSymbolFlags(s) & 111551 /* SymbolFlags.Value */);
|
|
88564
88647
|
}
|
|
88565
88648
|
}
|
|
88566
88649
|
function isNameOfModuleOrEnumDeclaration(node) {
|
|
@@ -88613,7 +88696,7 @@ var ts;
|
|
|
88613
88696
|
var symbol = getReferencedValueOrAliasSymbol(node);
|
|
88614
88697
|
// We should only get the declaration of an alias if there isn't a local value
|
|
88615
88698
|
// declaration for the symbol
|
|
88616
|
-
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) {
|
|
88699
|
+
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
|
|
88617
88700
|
return getDeclarationOfAliasSymbol(symbol);
|
|
88618
88701
|
}
|
|
88619
88702
|
}
|
|
@@ -88701,7 +88784,7 @@ var ts;
|
|
|
88701
88784
|
case 273 /* SyntaxKind.ImportSpecifier */:
|
|
88702
88785
|
case 278 /* SyntaxKind.ExportSpecifier */:
|
|
88703
88786
|
var symbol = getSymbolOfNode(node);
|
|
88704
|
-
return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol);
|
|
88787
|
+
return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */);
|
|
88705
88788
|
case 275 /* SyntaxKind.ExportDeclaration */:
|
|
88706
88789
|
var exportClause = node.exportClause;
|
|
88707
88790
|
return !!exportClause && (ts.isNamespaceExport(exportClause) ||
|
|
@@ -88723,6 +88806,7 @@ var ts;
|
|
|
88723
88806
|
return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference);
|
|
88724
88807
|
}
|
|
88725
88808
|
function isAliasResolvedToValue(symbol) {
|
|
88809
|
+
var _a;
|
|
88726
88810
|
if (!symbol) {
|
|
88727
88811
|
return false;
|
|
88728
88812
|
}
|
|
@@ -88732,7 +88816,7 @@ var ts;
|
|
|
88732
88816
|
}
|
|
88733
88817
|
// const enums and modules that contain only const enums are not considered values from the emit perspective
|
|
88734
88818
|
// unless 'preserveConstEnums' option is set to true
|
|
88735
|
-
return !!(target
|
|
88819
|
+
return !!(((_a = getAllSymbolFlags(target)) !== null && _a !== void 0 ? _a : -1) & 111551 /* SymbolFlags.Value */) &&
|
|
88736
88820
|
(ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target));
|
|
88737
88821
|
}
|
|
88738
88822
|
function isConstEnumOrConstEnumOnlyModule(s) {
|
|
@@ -88747,7 +88831,7 @@ var ts;
|
|
|
88747
88831
|
}
|
|
88748
88832
|
var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217
|
|
88749
88833
|
if (target && ts.getEffectiveModifierFlags(node) & 1 /* ModifierFlags.Export */ &&
|
|
88750
|
-
target
|
|
88834
|
+
getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */ &&
|
|
88751
88835
|
(ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
|
|
88752
88836
|
// An `export import ... =` of a value symbol is always considered referenced
|
|
88753
88837
|
return true;
|
|
@@ -101240,11 +101324,13 @@ var ts;
|
|
|
101240
101324
|
return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context);
|
|
101241
101325
|
}
|
|
101242
101326
|
function visitIdentifier(node) {
|
|
101243
|
-
if (
|
|
101244
|
-
|
|
101327
|
+
if (convertedLoopState) {
|
|
101328
|
+
if (resolver.isArgumentsLocalBinding(node)) {
|
|
101329
|
+
return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments"));
|
|
101330
|
+
}
|
|
101245
101331
|
}
|
|
101246
|
-
if (
|
|
101247
|
-
return
|
|
101332
|
+
if (node.hasExtendedUnicodeEscape) {
|
|
101333
|
+
return ts.setOriginalNode(ts.setTextRange(factory.createIdentifier(ts.unescapeLeadingUnderscores(node.escapedText)), node), node);
|
|
101248
101334
|
}
|
|
101249
101335
|
return node;
|
|
101250
101336
|
}
|
|
@@ -128784,6 +128870,12 @@ var ts;
|
|
|
128784
128870
|
SemanticClassificationFormat["Original"] = "original";
|
|
128785
128871
|
SemanticClassificationFormat["TwentyTwenty"] = "2020";
|
|
128786
128872
|
})(SemanticClassificationFormat = ts.SemanticClassificationFormat || (ts.SemanticClassificationFormat = {}));
|
|
128873
|
+
var OrganizeImportsMode;
|
|
128874
|
+
(function (OrganizeImportsMode) {
|
|
128875
|
+
OrganizeImportsMode["All"] = "All";
|
|
128876
|
+
OrganizeImportsMode["SortAndCombine"] = "SortAndCombine";
|
|
128877
|
+
OrganizeImportsMode["RemoveUnused"] = "RemoveUnused";
|
|
128878
|
+
})(OrganizeImportsMode = ts.OrganizeImportsMode || (ts.OrganizeImportsMode = {}));
|
|
128787
128879
|
var CompletionTriggerKind;
|
|
128788
128880
|
(function (CompletionTriggerKind) {
|
|
128789
128881
|
/** Completion was triggered by typing an identifier, manual invocation (e.g Ctrl+Space) or via API. */
|
|
@@ -144539,23 +144631,39 @@ var ts;
|
|
|
144539
144631
|
* 2) Coalescing imports from the same module
|
|
144540
144632
|
* 3) Sorting imports
|
|
144541
144633
|
*/
|
|
144542
|
-
function organizeImports(sourceFile, formatContext, host, program, preferences,
|
|
144634
|
+
function organizeImports(sourceFile, formatContext, host, program, preferences, mode) {
|
|
144543
144635
|
var changeTracker = ts.textChanges.ChangeTracker.fromContext({ host: host, formatContext: formatContext, preferences: preferences });
|
|
144544
|
-
var
|
|
144636
|
+
var shouldSort = mode === "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ || mode === "All" /* OrganizeImportsMode.All */;
|
|
144637
|
+
var shouldCombine = shouldSort; // These are currently inseparable, but I draw a distinction for clarity and in case we add modes in the future.
|
|
144638
|
+
var shouldRemove = mode === "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */ || mode === "All" /* OrganizeImportsMode.All */;
|
|
144639
|
+
var maybeRemove = shouldRemove ? removeUnusedImports : ts.identity;
|
|
144640
|
+
var maybeCoalesce = shouldCombine ? coalesceImports : ts.identity;
|
|
144641
|
+
var processImportsOfSameModuleSpecifier = function (importGroup) {
|
|
144642
|
+
var processedDeclarations = maybeCoalesce(maybeRemove(importGroup, sourceFile, program));
|
|
144643
|
+
return shouldSort
|
|
144644
|
+
? ts.stableSort(processedDeclarations, function (s1, s2) { return compareImportsOrRequireStatements(s1, s2); })
|
|
144645
|
+
: processedDeclarations;
|
|
144646
|
+
};
|
|
144545
144647
|
// All of the old ImportDeclarations in the file, in syntactic order.
|
|
144546
144648
|
var topLevelImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, sourceFile.statements.filter(ts.isImportDeclaration));
|
|
144547
|
-
topLevelImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl,
|
|
144548
|
-
//
|
|
144549
|
-
|
|
144550
|
-
|
|
144649
|
+
topLevelImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); });
|
|
144650
|
+
// Exports are always used
|
|
144651
|
+
if (mode !== "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */) {
|
|
144652
|
+
// All of the old ExportDeclarations in the file, in syntactic order.
|
|
144653
|
+
var topLevelExportDecls = sourceFile.statements.filter(ts.isExportDeclaration);
|
|
144654
|
+
organizeImportsWorker(topLevelExportDecls, coalesceExports);
|
|
144655
|
+
}
|
|
144551
144656
|
for (var _i = 0, _a = sourceFile.statements.filter(ts.isAmbientModule); _i < _a.length; _i++) {
|
|
144552
144657
|
var ambientModule = _a[_i];
|
|
144553
144658
|
if (!ambientModule.body)
|
|
144554
144659
|
continue;
|
|
144555
144660
|
var ambientModuleImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(ts.isImportDeclaration));
|
|
144556
|
-
ambientModuleImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl,
|
|
144557
|
-
|
|
144558
|
-
|
|
144661
|
+
ambientModuleImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); });
|
|
144662
|
+
// Exports are always used
|
|
144663
|
+
if (mode !== "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */) {
|
|
144664
|
+
var ambientModuleExportDecls = ambientModule.body.statements.filter(ts.isExportDeclaration);
|
|
144665
|
+
organizeImportsWorker(ambientModuleExportDecls, coalesceExports);
|
|
144666
|
+
}
|
|
144559
144667
|
}
|
|
144560
144668
|
return changeTracker.getChanges();
|
|
144561
144669
|
function organizeImportsWorker(oldImportDecls, coalesce) {
|
|
@@ -144568,8 +144676,12 @@ var ts;
|
|
|
144568
144676
|
// Consider: we could do a more careful check that this trivia is actually a header,
|
|
144569
144677
|
// but the consequences of being wrong are very minor.
|
|
144570
144678
|
ts.suppressLeadingTrivia(oldImportDecls[0]);
|
|
144571
|
-
var oldImportGroups =
|
|
144572
|
-
|
|
144679
|
+
var oldImportGroups = shouldCombine
|
|
144680
|
+
? ts.group(oldImportDecls, function (importDecl) { return getExternalModuleName(importDecl.moduleSpecifier); })
|
|
144681
|
+
: [oldImportDecls];
|
|
144682
|
+
var sortedImportGroups = shouldSort
|
|
144683
|
+
? ts.stableSort(oldImportGroups, function (group1, group2) { return compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier); })
|
|
144684
|
+
: oldImportGroups;
|
|
144573
144685
|
var newImportDecls = ts.flatMap(sortedImportGroups, function (importGroup) {
|
|
144574
144686
|
return getExternalModuleName(importGroup[0].moduleSpecifier)
|
|
144575
144687
|
? coalesce(importGroup)
|
|
@@ -144633,11 +144745,7 @@ var ts;
|
|
|
144633
144745
|
}
|
|
144634
144746
|
return false;
|
|
144635
144747
|
}
|
|
144636
|
-
function removeUnusedImports(oldImports, sourceFile, program
|
|
144637
|
-
// As a precaution, consider unused import detection to be destructive (GH #43051)
|
|
144638
|
-
if (skipDestructiveCodeActions) {
|
|
144639
|
-
return oldImports;
|
|
144640
|
-
}
|
|
144748
|
+
function removeUnusedImports(oldImports, sourceFile, program) {
|
|
144641
144749
|
var typeChecker = program.getTypeChecker();
|
|
144642
144750
|
var compilerOptions = program.getCompilerOptions();
|
|
144643
144751
|
var jsxNamespace = typeChecker.getJsxNamespace(sourceFile);
|
|
@@ -153670,6 +153778,15 @@ var ts;
|
|
|
153670
153778
|
});
|
|
153671
153779
|
}
|
|
153672
153780
|
function makeChange(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) {
|
|
153781
|
+
if (ts.isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) {
|
|
153782
|
+
var exprType = checker.getTypeAtLocation(insertionSite);
|
|
153783
|
+
var asyncIter = checker.getAsyncIterableType();
|
|
153784
|
+
if (asyncIter && checker.isTypeAssignableTo(exprType, asyncIter)) {
|
|
153785
|
+
var forOf = insertionSite.parent;
|
|
153786
|
+
changeTracker.replaceNode(sourceFile, forOf, ts.factory.updateForOfStatement(forOf, ts.factory.createToken(133 /* SyntaxKind.AwaitKeyword */), forOf.initializer, forOf.expression, forOf.statement));
|
|
153787
|
+
return;
|
|
153788
|
+
}
|
|
153789
|
+
}
|
|
153673
153790
|
if (ts.isBinaryExpression(insertionSite)) {
|
|
153674
153791
|
for (var _i = 0, _a = [insertionSite.left, insertionSite.right]; _i < _a.length; _i++) {
|
|
153675
153792
|
var side = _a[_i];
|
|
@@ -169025,12 +169142,14 @@ var ts;
|
|
|
169025
169142
|
return ts.codefix.getAllFixes({ fixId: fixId, sourceFile: sourceFile, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences });
|
|
169026
169143
|
}
|
|
169027
169144
|
function organizeImports(args, formatOptions, preferences) {
|
|
169145
|
+
var _a;
|
|
169028
169146
|
if (preferences === void 0) { preferences = ts.emptyOptions; }
|
|
169029
169147
|
synchronizeHostData();
|
|
169030
169148
|
ts.Debug.assert(args.type === "file");
|
|
169031
169149
|
var sourceFile = getValidSourceFile(args.fileName);
|
|
169032
169150
|
var formatContext = ts.formatting.getFormatContext(formatOptions, host);
|
|
169033
|
-
|
|
169151
|
+
var mode = (_a = args.mode) !== null && _a !== void 0 ? _a : (args.skipDestructiveCodeActions ? "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ : "All" /* OrganizeImportsMode.All */);
|
|
169152
|
+
return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, mode);
|
|
169034
169153
|
}
|
|
169035
169154
|
function getEditsForFileRename(oldFilePath, newFilePath, formatOptions, preferences) {
|
|
169036
169155
|
if (preferences === void 0) { preferences = ts.emptyOptions; }
|
|
@@ -172029,6 +172148,12 @@ var ts;
|
|
|
172029
172148
|
CommandTypes["ProvideInlayHints"] = "provideInlayHints";
|
|
172030
172149
|
// NOTE: If updating this, be sure to also update `allCommandNames` in `testRunner/unittests/tsserver/session.ts`.
|
|
172031
172150
|
})(CommandTypes = protocol.CommandTypes || (protocol.CommandTypes = {}));
|
|
172151
|
+
var OrganizeImportsMode;
|
|
172152
|
+
(function (OrganizeImportsMode) {
|
|
172153
|
+
OrganizeImportsMode["All"] = "All";
|
|
172154
|
+
OrganizeImportsMode["SortAndCombine"] = "SortAndCombine";
|
|
172155
|
+
OrganizeImportsMode["RemoveUnused"] = "RemoveUnused";
|
|
172156
|
+
})(OrganizeImportsMode = protocol.OrganizeImportsMode || (protocol.OrganizeImportsMode = {}));
|
|
172032
172157
|
var WatchFileKind;
|
|
172033
172158
|
(function (WatchFileKind) {
|
|
172034
172159
|
WatchFileKind["FixedPollingInterval"] = "FixedPollingInterval";
|
|
@@ -181192,11 +181317,12 @@ var ts;
|
|
|
181192
181317
|
}
|
|
181193
181318
|
};
|
|
181194
181319
|
Session.prototype.organizeImports = function (args, simplifiedResult) {
|
|
181320
|
+
var _a;
|
|
181195
181321
|
ts.Debug.assert(args.scope.type === "file");
|
|
181196
|
-
var
|
|
181322
|
+
var _b = this.getFileAndProject(args.scope.args), file = _b.file, project = _b.project;
|
|
181197
181323
|
var changes = project.getLanguageService().organizeImports({
|
|
181198
181324
|
fileName: file,
|
|
181199
|
-
|
|
181325
|
+
mode: (_a = args.mode) !== null && _a !== void 0 ? _a : (args.skipDestructiveCodeActions ? "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ : undefined),
|
|
181200
181326
|
type: "file",
|
|
181201
181327
|
}, this.getFormatOptions(file), this.getPreferences(file));
|
|
181202
181328
|
if (simplifiedResult) {
|