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
|
@@ -99,7 +99,7 @@ var ts;
|
|
|
99
99
|
// The following is baselined as a literal template type without intervention
|
|
100
100
|
/** The version of the TypeScript compiler release */
|
|
101
101
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
102
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
102
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221001");
|
|
103
103
|
/* @internal */
|
|
104
104
|
var Comparison;
|
|
105
105
|
(function (Comparison) {
|
|
@@ -11368,7 +11368,7 @@ var ts;
|
|
|
11368
11368
|
return -1;
|
|
11369
11369
|
}
|
|
11370
11370
|
function peekExtendedUnicodeEscape() {
|
|
11371
|
-
if (
|
|
11371
|
+
if (codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) {
|
|
11372
11372
|
var start_2 = pos;
|
|
11373
11373
|
pos += 3;
|
|
11374
11374
|
var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false);
|
|
@@ -23149,7 +23149,7 @@ var ts;
|
|
|
23149
23149
|
return node;
|
|
23150
23150
|
}
|
|
23151
23151
|
// @api
|
|
23152
|
-
function createIdentifier(text, typeArguments, originalKeywordKind) {
|
|
23152
|
+
function createIdentifier(text, typeArguments, originalKeywordKind, hasExtendedUnicodeEscape) {
|
|
23153
23153
|
var node = createBaseIdentifier(text, originalKeywordKind);
|
|
23154
23154
|
if (typeArguments) {
|
|
23155
23155
|
// NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations
|
|
@@ -23158,6 +23158,10 @@ var ts;
|
|
|
23158
23158
|
if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) {
|
|
23159
23159
|
node.transformFlags |= 67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */;
|
|
23160
23160
|
}
|
|
23161
|
+
if (hasExtendedUnicodeEscape) {
|
|
23162
|
+
node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape;
|
|
23163
|
+
node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */;
|
|
23164
|
+
}
|
|
23161
23165
|
return node;
|
|
23162
23166
|
}
|
|
23163
23167
|
// @api
|
|
@@ -33092,8 +33096,9 @@ var ts;
|
|
|
33092
33096
|
// Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker
|
|
33093
33097
|
var originalKeywordKind = token();
|
|
33094
33098
|
var text = internIdentifier(scanner.getTokenValue());
|
|
33099
|
+
var hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape();
|
|
33095
33100
|
nextTokenWithoutCheck();
|
|
33096
|
-
return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind), pos);
|
|
33101
|
+
return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind, hasExtendedUnicodeEscape), pos);
|
|
33097
33102
|
}
|
|
33098
33103
|
if (token() === 80 /* SyntaxKind.PrivateIdentifier */) {
|
|
33099
33104
|
parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
@@ -49488,6 +49493,12 @@ var ts;
|
|
|
49488
49493
|
getOptionalType: function () { return optionalType; },
|
|
49489
49494
|
getPromiseType: function () { return getGlobalPromiseType(/*reportErrors*/ false); },
|
|
49490
49495
|
getPromiseLikeType: function () { return getGlobalPromiseLikeType(/*reportErrors*/ false); },
|
|
49496
|
+
getAsyncIterableType: function () {
|
|
49497
|
+
var type = getGlobalAsyncIterableType(/*reportErrors*/ false);
|
|
49498
|
+
if (type === emptyGenericType)
|
|
49499
|
+
return undefined;
|
|
49500
|
+
return type;
|
|
49501
|
+
},
|
|
49491
49502
|
isSymbolAccessible: isSymbolAccessible,
|
|
49492
49503
|
isArrayType: isArrayType,
|
|
49493
49504
|
isTupleType: isTupleType,
|
|
@@ -50325,9 +50336,9 @@ var ts;
|
|
|
50325
50336
|
return symbol;
|
|
50326
50337
|
}
|
|
50327
50338
|
if (symbol.flags & 2097152 /* SymbolFlags.Alias */) {
|
|
50328
|
-
var
|
|
50329
|
-
//
|
|
50330
|
-
if (
|
|
50339
|
+
var targetFlags = getAllSymbolFlags(symbol);
|
|
50340
|
+
// `targetFlags` will be `SymbolFlags.All` if an error occurred in alias resolution; this avoids cascading errors
|
|
50341
|
+
if (targetFlags & meaning) {
|
|
50331
50342
|
return symbol;
|
|
50332
50343
|
}
|
|
50333
50344
|
}
|
|
@@ -50960,8 +50971,8 @@ var ts;
|
|
|
50960
50971
|
!checkAndReportErrorForExtendingInterface(errorLocation) &&
|
|
50961
50972
|
!checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
|
|
50962
50973
|
!checkAndReportErrorForExportingPrimitiveType(errorLocation, name) &&
|
|
50974
|
+
!checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) &&
|
|
50963
50975
|
!checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) &&
|
|
50964
|
-
!checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
|
|
50965
50976
|
!checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
|
|
50966
50977
|
var suggestion = void 0;
|
|
50967
50978
|
var suggestedLib = void 0;
|
|
@@ -51048,7 +51059,7 @@ var ts;
|
|
|
51048
51059
|
}
|
|
51049
51060
|
}
|
|
51050
51061
|
if (result && errorLocation && meaning & 111551 /* SymbolFlags.Value */ && result.flags & 2097152 /* SymbolFlags.Alias */ && !(result.flags & 111551 /* SymbolFlags.Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
51051
|
-
var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result);
|
|
51062
|
+
var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* SymbolFlags.Value */);
|
|
51052
51063
|
if (typeOnlyDeclaration) {
|
|
51053
51064
|
var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */
|
|
51054
51065
|
? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
|
|
@@ -51211,7 +51222,7 @@ var ts;
|
|
|
51211
51222
|
return false;
|
|
51212
51223
|
}
|
|
51213
51224
|
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
|
|
51214
|
-
if (meaning &
|
|
51225
|
+
if (meaning & 111551 /* SymbolFlags.Value */) {
|
|
51215
51226
|
if (isPrimitiveTypeName(name)) {
|
|
51216
51227
|
if (isExtendedByInterface(errorLocation)) {
|
|
51217
51228
|
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));
|
|
@@ -51222,7 +51233,8 @@ var ts;
|
|
|
51222
51233
|
return true;
|
|
51223
51234
|
}
|
|
51224
51235
|
var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
|
|
51225
|
-
|
|
51236
|
+
var allFlags = symbol && getAllSymbolFlags(symbol);
|
|
51237
|
+
if (symbol && allFlags !== undefined && !(allFlags & 111551 /* SymbolFlags.Value */)) {
|
|
51226
51238
|
var rawName = ts.unescapeLeadingUnderscores(name);
|
|
51227
51239
|
if (isES2015OrLaterConstructorName(name)) {
|
|
51228
51240
|
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);
|
|
@@ -51270,16 +51282,16 @@ var ts;
|
|
|
51270
51282
|
}
|
|
51271
51283
|
return false;
|
|
51272
51284
|
}
|
|
51273
|
-
function
|
|
51274
|
-
if (meaning & (111551 /* SymbolFlags.Value */ & ~
|
|
51275
|
-
var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule
|
|
51285
|
+
function checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) {
|
|
51286
|
+
if (meaning & (111551 /* SymbolFlags.Value */ & ~788968 /* SymbolFlags.Type */)) {
|
|
51287
|
+
var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
|
|
51276
51288
|
if (symbol) {
|
|
51277
51289
|
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name));
|
|
51278
51290
|
return true;
|
|
51279
51291
|
}
|
|
51280
51292
|
}
|
|
51281
|
-
else if (meaning & (788968 /* SymbolFlags.Type */ & ~
|
|
51282
|
-
var symbol = resolveSymbol(resolveName(errorLocation, name,
|
|
51293
|
+
else if (meaning & (788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */)) {
|
|
51294
|
+
var symbol = resolveSymbol(resolveName(errorLocation, name, 1536 /* SymbolFlags.Module */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
|
|
51283
51295
|
if (symbol) {
|
|
51284
51296
|
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name));
|
|
51285
51297
|
return true;
|
|
@@ -51869,6 +51881,52 @@ var ts;
|
|
|
51869
51881
|
}
|
|
51870
51882
|
return undefined;
|
|
51871
51883
|
}
|
|
51884
|
+
/**
|
|
51885
|
+
* Gets combined flags of a `symbol` and all alias targets it resolves to. `resolveAlias`
|
|
51886
|
+
* is typically recursive over chains of aliases, but stops mid-chain if an alias is merged
|
|
51887
|
+
* with another exported symbol, e.g.
|
|
51888
|
+
* ```ts
|
|
51889
|
+
* // a.ts
|
|
51890
|
+
* export const a = 0;
|
|
51891
|
+
* // b.ts
|
|
51892
|
+
* export { a } from "./a";
|
|
51893
|
+
* export type a = number;
|
|
51894
|
+
* // c.ts
|
|
51895
|
+
* import { a } from "./b";
|
|
51896
|
+
* ```
|
|
51897
|
+
* Calling `resolveAlias` on the `a` in c.ts would stop at the merged symbol exported
|
|
51898
|
+
* from b.ts, even though there is still more alias to resolve. Consequently, if we were
|
|
51899
|
+
* trying to determine if the `a` in c.ts has a value meaning, looking at the flags on
|
|
51900
|
+
* the local symbol and on the symbol returned by `resolveAlias` is not enough.
|
|
51901
|
+
* @returns SymbolFlags.All if `symbol` is an alias that ultimately resolves to `unknown`;
|
|
51902
|
+
* combined flags of all alias targets otherwise.
|
|
51903
|
+
*/
|
|
51904
|
+
function getAllSymbolFlags(symbol) {
|
|
51905
|
+
var flags = symbol.flags;
|
|
51906
|
+
var seenSymbols;
|
|
51907
|
+
while (symbol.flags & 2097152 /* SymbolFlags.Alias */) {
|
|
51908
|
+
var target = resolveAlias(symbol);
|
|
51909
|
+
if (target === unknownSymbol) {
|
|
51910
|
+
return 67108863 /* SymbolFlags.All */;
|
|
51911
|
+
}
|
|
51912
|
+
// Optimizations - try to avoid creating or adding to
|
|
51913
|
+
// `seenSymbols` if possible
|
|
51914
|
+
if (target === symbol || (seenSymbols === null || seenSymbols === void 0 ? void 0 : seenSymbols.has(target))) {
|
|
51915
|
+
break;
|
|
51916
|
+
}
|
|
51917
|
+
if (target.flags & 2097152 /* SymbolFlags.Alias */) {
|
|
51918
|
+
if (seenSymbols) {
|
|
51919
|
+
seenSymbols.add(target);
|
|
51920
|
+
}
|
|
51921
|
+
else {
|
|
51922
|
+
seenSymbols = new ts.Set([symbol, target]);
|
|
51923
|
+
}
|
|
51924
|
+
}
|
|
51925
|
+
flags |= target.flags;
|
|
51926
|
+
symbol = target;
|
|
51927
|
+
}
|
|
51928
|
+
return flags;
|
|
51929
|
+
}
|
|
51872
51930
|
/**
|
|
51873
51931
|
* Marks a symbol as type-only if its declaration is syntactically type-only.
|
|
51874
51932
|
* If it is not itself marked type-only, but resolves to a type-only alias
|
|
@@ -51914,19 +51972,25 @@ var ts;
|
|
|
51914
51972
|
return !!aliasDeclarationLinks.typeOnlyDeclaration;
|
|
51915
51973
|
}
|
|
51916
51974
|
/** Indicates that a symbol directly or indirectly resolves to a type-only import or export. */
|
|
51917
|
-
function getTypeOnlyAliasDeclaration(symbol) {
|
|
51975
|
+
function getTypeOnlyAliasDeclaration(symbol, include) {
|
|
51918
51976
|
if (!(symbol.flags & 2097152 /* SymbolFlags.Alias */)) {
|
|
51919
51977
|
return undefined;
|
|
51920
51978
|
}
|
|
51921
51979
|
var links = getSymbolLinks(symbol);
|
|
51922
|
-
|
|
51980
|
+
if (include === undefined) {
|
|
51981
|
+
return links.typeOnlyDeclaration || undefined;
|
|
51982
|
+
}
|
|
51983
|
+
if (links.typeOnlyDeclaration) {
|
|
51984
|
+
return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : undefined;
|
|
51985
|
+
}
|
|
51986
|
+
return undefined;
|
|
51923
51987
|
}
|
|
51924
51988
|
function markExportAsReferenced(node) {
|
|
51925
51989
|
var symbol = getSymbolOfNode(node);
|
|
51926
51990
|
var target = resolveAlias(symbol);
|
|
51927
51991
|
if (target) {
|
|
51928
51992
|
var markAlias = target === unknownSymbol ||
|
|
51929
|
-
((target
|
|
51993
|
+
((getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */));
|
|
51930
51994
|
if (markAlias) {
|
|
51931
51995
|
markAliasSymbolAsReferenced(symbol);
|
|
51932
51996
|
}
|
|
@@ -51946,8 +52010,7 @@ var ts;
|
|
|
51946
52010
|
// This way a chain of imports can be elided if ultimately the final input is only used in a type
|
|
51947
52011
|
// position.
|
|
51948
52012
|
if (ts.isInternalModuleImportEqualsDeclaration(node)) {
|
|
51949
|
-
|
|
51950
|
-
if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) {
|
|
52013
|
+
if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551 /* SymbolFlags.Value */) {
|
|
51951
52014
|
// import foo = <symbol>
|
|
51952
52015
|
checkExpressionCached(node.moduleReference);
|
|
51953
52016
|
}
|
|
@@ -52769,7 +52832,7 @@ var ts;
|
|
|
52769
52832
|
}
|
|
52770
52833
|
function symbolIsValue(symbol, includeTypeOnlyMembers) {
|
|
52771
52834
|
return !!(symbol.flags & 111551 /* SymbolFlags.Value */ ||
|
|
52772
|
-
symbol.flags & 2097152 /* SymbolFlags.Alias */ &&
|
|
52835
|
+
symbol.flags & 2097152 /* SymbolFlags.Alias */ && getAllSymbolFlags(symbol) & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol)));
|
|
52773
52836
|
}
|
|
52774
52837
|
function findConstructorDeclaration(node) {
|
|
52775
52838
|
var members = node.members;
|
|
@@ -53038,8 +53101,10 @@ var ts;
|
|
|
53038
53101
|
return true;
|
|
53039
53102
|
}
|
|
53040
53103
|
// Qualify if the symbol from symbol table has same meaning as expected
|
|
53041
|
-
|
|
53042
|
-
|
|
53104
|
+
var shouldResolveAlias = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */));
|
|
53105
|
+
symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
|
|
53106
|
+
var flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags;
|
|
53107
|
+
if (flags & meaning) {
|
|
53043
53108
|
qualify = true;
|
|
53044
53109
|
return true;
|
|
53045
53110
|
}
|
|
@@ -55696,7 +55761,7 @@ var ts;
|
|
|
55696
55761
|
return !symbol.exports ? [] : ts.filter(ts.arrayFrom(symbol.exports.values()), isNamespaceMember);
|
|
55697
55762
|
}
|
|
55698
55763
|
function isTypeOnlyNamespace(symbol) {
|
|
55699
|
-
return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m)
|
|
55764
|
+
return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* SymbolFlags.Value */); });
|
|
55700
55765
|
}
|
|
55701
55766
|
function serializeModule(symbol, symbolName, modifierFlags) {
|
|
55702
55767
|
var members = getNamespaceMembersForSerialization(symbol);
|
|
@@ -57916,7 +57981,7 @@ var ts;
|
|
|
57916
57981
|
links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol)
|
|
57917
57982
|
: isDuplicatedCommonJSExport(symbol.declarations) ? autoType
|
|
57918
57983
|
: declaredType ? declaredType
|
|
57919
|
-
: targetSymbol
|
|
57984
|
+
: getAllSymbolFlags(targetSymbol) & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol)
|
|
57920
57985
|
: errorType;
|
|
57921
57986
|
}
|
|
57922
57987
|
return links.type;
|
|
@@ -60269,7 +60334,7 @@ var ts;
|
|
|
60269
60334
|
var indexTypes;
|
|
60270
60335
|
var isUnion = containingType.flags & 1048576 /* TypeFlags.Union */;
|
|
60271
60336
|
// Flags we want to propagate to the result if they exist in all source symbols
|
|
60272
|
-
var optionalFlag
|
|
60337
|
+
var optionalFlag;
|
|
60273
60338
|
var syntheticFlag = 4 /* CheckFlags.SyntheticMethod */;
|
|
60274
60339
|
var checkFlags = isUnion ? 0 : 8 /* CheckFlags.Readonly */;
|
|
60275
60340
|
var mergedInstantiations = false;
|
|
@@ -60280,11 +60345,14 @@ var ts;
|
|
|
60280
60345
|
var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment);
|
|
60281
60346
|
var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0;
|
|
60282
60347
|
if (prop) {
|
|
60283
|
-
if (
|
|
60284
|
-
optionalFlag
|
|
60285
|
-
|
|
60286
|
-
|
|
60287
|
-
|
|
60348
|
+
if (prop.flags & 106500 /* SymbolFlags.ClassMember */) {
|
|
60349
|
+
optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : (optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */);
|
|
60350
|
+
if (isUnion) {
|
|
60351
|
+
optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */);
|
|
60352
|
+
}
|
|
60353
|
+
else {
|
|
60354
|
+
optionalFlag &= prop.flags;
|
|
60355
|
+
}
|
|
60288
60356
|
}
|
|
60289
60357
|
if (!singleProp) {
|
|
60290
60358
|
singleProp = prop;
|
|
@@ -60403,7 +60471,7 @@ var ts;
|
|
|
60403
60471
|
propTypes.push(type);
|
|
60404
60472
|
}
|
|
60405
60473
|
ts.addRange(propTypes, indexTypes);
|
|
60406
|
-
var result = createSymbol(4 /* SymbolFlags.Property */ | optionalFlag, name, syntheticFlag | checkFlags);
|
|
60474
|
+
var result = createSymbol(4 /* SymbolFlags.Property */ | (optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : 0), name, syntheticFlag | checkFlags);
|
|
60407
60475
|
result.containingType = containingType;
|
|
60408
60476
|
if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
|
|
60409
60477
|
result.valueDeclaration = firstValueDeclaration;
|
|
@@ -67670,7 +67738,7 @@ var ts;
|
|
|
67670
67738
|
return 0 /* Ternary.False */;
|
|
67671
67739
|
}
|
|
67672
67740
|
// When checking for comparability, be more lenient with optional properties.
|
|
67673
|
-
if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) {
|
|
67741
|
+
if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && targetProp.flags & 106500 /* SymbolFlags.ClassMember */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) {
|
|
67674
67742
|
// TypeScript 1.0 spec (April 2014): 3.8.3
|
|
67675
67743
|
// S is a subtype of a type T, and T is a supertype of S if ...
|
|
67676
67744
|
// S' and T are object types and, for each member M in T..
|
|
@@ -72942,9 +73010,9 @@ var ts;
|
|
|
72942
73010
|
});
|
|
72943
73011
|
}
|
|
72944
73012
|
function markAliasReferenced(symbol, location) {
|
|
72945
|
-
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) {
|
|
73013
|
+
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
|
|
72946
73014
|
var target = resolveAlias(symbol);
|
|
72947
|
-
if (target
|
|
73015
|
+
if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
|
|
72948
73016
|
// An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled
|
|
72949
73017
|
// (because the const enum value will not be inlined), or if (2) the alias is an export
|
|
72950
73018
|
// of a const enum declaration that will be preserved.
|
|
@@ -74360,9 +74428,10 @@ var ts;
|
|
|
74360
74428
|
function instantiateContextualType(contextualType, node, contextFlags) {
|
|
74361
74429
|
if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* TypeFlags.Instantiable */)) {
|
|
74362
74430
|
var inferenceContext = getInferenceContext(node);
|
|
74363
|
-
// If no inferences have been made,
|
|
74364
|
-
//
|
|
74365
|
-
|
|
74431
|
+
// If no inferences have been made, and none of the type parameters for which we are inferring
|
|
74432
|
+
// specify default types, nothing is gained from instantiating as type parameters would just be
|
|
74433
|
+
// replaced with their constraints similar to the apparent type.
|
|
74434
|
+
if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) {
|
|
74366
74435
|
// For contextual signatures we incorporate all inferences made so far, e.g. from return
|
|
74367
74436
|
// types as well as arguments to the left in a function call.
|
|
74368
74437
|
return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
|
|
@@ -78836,7 +78905,7 @@ var ts;
|
|
|
78836
78905
|
if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) {
|
|
78837
78906
|
symbol = resolveAlias(symbol);
|
|
78838
78907
|
}
|
|
78839
|
-
return !!(symbol && (symbol
|
|
78908
|
+
return !!(symbol && (getAllSymbolFlags(symbol) & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */);
|
|
78840
78909
|
}
|
|
78841
78910
|
return false;
|
|
78842
78911
|
}
|
|
@@ -81210,6 +81279,9 @@ var ts;
|
|
|
81210
81279
|
function hasInferenceCandidates(info) {
|
|
81211
81280
|
return !!(info.candidates || info.contraCandidates);
|
|
81212
81281
|
}
|
|
81282
|
+
function hasInferenceCandidatesOrDefault(info) {
|
|
81283
|
+
return !!(info.candidates || info.contraCandidates || hasTypeParameterDefault(info.typeParameter));
|
|
81284
|
+
}
|
|
81213
81285
|
function hasOverlappingInferences(a, b) {
|
|
81214
81286
|
for (var i = 0; i < a.length; i++) {
|
|
81215
81287
|
if (hasInferenceCandidates(a[i]) && hasInferenceCandidates(b[i])) {
|
|
@@ -85011,7 +85083,16 @@ var ts;
|
|
|
85011
85083
|
var message = allowAsyncIterables
|
|
85012
85084
|
? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator
|
|
85013
85085
|
: ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator;
|
|
85014
|
-
|
|
85086
|
+
var suggestAwait =
|
|
85087
|
+
// for (const x of Promise<...>) or [...Promise<...>]
|
|
85088
|
+
!!getAwaitedTypeOfPromise(type)
|
|
85089
|
+
// for (const x of AsyncIterable<...>)
|
|
85090
|
+
|| (!allowAsyncIterables &&
|
|
85091
|
+
ts.isForOfStatement(errorNode.parent) &&
|
|
85092
|
+
errorNode.parent.expression === errorNode &&
|
|
85093
|
+
getGlobalAsyncIterableType(/** reportErrors */ false) !== emptyGenericType &&
|
|
85094
|
+
isTypeAssignableTo(type, getGlobalAsyncIterableType(/** reportErrors */ false)));
|
|
85095
|
+
return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
|
|
85015
85096
|
}
|
|
85016
85097
|
/**
|
|
85017
85098
|
* Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type.
|
|
@@ -86862,10 +86943,11 @@ var ts;
|
|
|
86862
86943
|
}
|
|
86863
86944
|
return;
|
|
86864
86945
|
}
|
|
86946
|
+
var targetFlags = getAllSymbolFlags(target);
|
|
86865
86947
|
var excludedMeanings = (symbol.flags & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */) ? 111551 /* SymbolFlags.Value */ : 0) |
|
|
86866
86948
|
(symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) |
|
|
86867
86949
|
(symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0);
|
|
86868
|
-
if (
|
|
86950
|
+
if (targetFlags & excludedMeanings) {
|
|
86869
86951
|
var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ?
|
|
86870
86952
|
ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
|
|
86871
86953
|
ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
|
|
@@ -86875,7 +86957,7 @@ var ts;
|
|
|
86875
86957
|
&& !ts.isTypeOnlyImportOrExportDeclaration(node)
|
|
86876
86958
|
&& !(node.flags & 16777216 /* NodeFlags.Ambient */)) {
|
|
86877
86959
|
var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
|
|
86878
|
-
var isType = !(
|
|
86960
|
+
var isType = !(targetFlags & 111551 /* SymbolFlags.Value */);
|
|
86879
86961
|
if (isType || typeOnlyAlias) {
|
|
86880
86962
|
switch (node.kind) {
|
|
86881
86963
|
case 270 /* SyntaxKind.ImportClause */:
|
|
@@ -87035,14 +87117,15 @@ var ts;
|
|
|
87035
87117
|
if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) {
|
|
87036
87118
|
var target = resolveAlias(getSymbolOfNode(node));
|
|
87037
87119
|
if (target !== unknownSymbol) {
|
|
87038
|
-
|
|
87120
|
+
var targetFlags = getAllSymbolFlags(target);
|
|
87121
|
+
if (targetFlags & 111551 /* SymbolFlags.Value */) {
|
|
87039
87122
|
// Target is a value symbol, check that it is not hidden by a local declaration with the same name
|
|
87040
87123
|
var moduleName = ts.getFirstIdentifier(node.moduleReference);
|
|
87041
87124
|
if (!(resolveEntityName(moduleName, 111551 /* SymbolFlags.Value */ | 1920 /* SymbolFlags.Namespace */).flags & 1920 /* SymbolFlags.Namespace */)) {
|
|
87042
87125
|
error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));
|
|
87043
87126
|
}
|
|
87044
87127
|
}
|
|
87045
|
-
if (
|
|
87128
|
+
if (targetFlags & 788968 /* SymbolFlags.Type */) {
|
|
87046
87129
|
checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);
|
|
87047
87130
|
}
|
|
87048
87131
|
}
|
|
@@ -87181,7 +87264,7 @@ var ts;
|
|
|
87181
87264
|
markExportAsReferenced(node);
|
|
87182
87265
|
}
|
|
87183
87266
|
var target = symbol && (symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol);
|
|
87184
|
-
if (!target || target
|
|
87267
|
+
if (!target || getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
|
|
87185
87268
|
checkExpressionCached(node.propertyName || node.name);
|
|
87186
87269
|
}
|
|
87187
87270
|
}
|
|
@@ -87228,7 +87311,7 @@ var ts;
|
|
|
87228
87311
|
markAliasReferenced(sym, id);
|
|
87229
87312
|
// If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`)
|
|
87230
87313
|
var target = sym.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(sym) : sym;
|
|
87231
|
-
if (target
|
|
87314
|
+
if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
|
|
87232
87315
|
// However if it is a value, we need to check it's being used correctly
|
|
87233
87316
|
checkExpressionCached(node.expression);
|
|
87234
87317
|
}
|
|
@@ -88550,7 +88633,7 @@ var ts;
|
|
|
88550
88633
|
return symbolLinks.exportsSomeValue;
|
|
88551
88634
|
function isValue(s) {
|
|
88552
88635
|
s = resolveSymbol(s);
|
|
88553
|
-
return s && !!(s
|
|
88636
|
+
return s && !!(getAllSymbolFlags(s) & 111551 /* SymbolFlags.Value */);
|
|
88554
88637
|
}
|
|
88555
88638
|
}
|
|
88556
88639
|
function isNameOfModuleOrEnumDeclaration(node) {
|
|
@@ -88603,7 +88686,7 @@ var ts;
|
|
|
88603
88686
|
var symbol = getReferencedValueOrAliasSymbol(node);
|
|
88604
88687
|
// We should only get the declaration of an alias if there isn't a local value
|
|
88605
88688
|
// declaration for the symbol
|
|
88606
|
-
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) {
|
|
88689
|
+
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
|
|
88607
88690
|
return getDeclarationOfAliasSymbol(symbol);
|
|
88608
88691
|
}
|
|
88609
88692
|
}
|
|
@@ -88691,7 +88774,7 @@ var ts;
|
|
|
88691
88774
|
case 273 /* SyntaxKind.ImportSpecifier */:
|
|
88692
88775
|
case 278 /* SyntaxKind.ExportSpecifier */:
|
|
88693
88776
|
var symbol = getSymbolOfNode(node);
|
|
88694
|
-
return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol);
|
|
88777
|
+
return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */);
|
|
88695
88778
|
case 275 /* SyntaxKind.ExportDeclaration */:
|
|
88696
88779
|
var exportClause = node.exportClause;
|
|
88697
88780
|
return !!exportClause && (ts.isNamespaceExport(exportClause) ||
|
|
@@ -88713,6 +88796,7 @@ var ts;
|
|
|
88713
88796
|
return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference);
|
|
88714
88797
|
}
|
|
88715
88798
|
function isAliasResolvedToValue(symbol) {
|
|
88799
|
+
var _a;
|
|
88716
88800
|
if (!symbol) {
|
|
88717
88801
|
return false;
|
|
88718
88802
|
}
|
|
@@ -88722,7 +88806,7 @@ var ts;
|
|
|
88722
88806
|
}
|
|
88723
88807
|
// const enums and modules that contain only const enums are not considered values from the emit perspective
|
|
88724
88808
|
// unless 'preserveConstEnums' option is set to true
|
|
88725
|
-
return !!(target
|
|
88809
|
+
return !!(((_a = getAllSymbolFlags(target)) !== null && _a !== void 0 ? _a : -1) & 111551 /* SymbolFlags.Value */) &&
|
|
88726
88810
|
(ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target));
|
|
88727
88811
|
}
|
|
88728
88812
|
function isConstEnumOrConstEnumOnlyModule(s) {
|
|
@@ -88737,7 +88821,7 @@ var ts;
|
|
|
88737
88821
|
}
|
|
88738
88822
|
var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217
|
|
88739
88823
|
if (target && ts.getEffectiveModifierFlags(node) & 1 /* ModifierFlags.Export */ &&
|
|
88740
|
-
target
|
|
88824
|
+
getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */ &&
|
|
88741
88825
|
(ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
|
|
88742
88826
|
// An `export import ... =` of a value symbol is always considered referenced
|
|
88743
88827
|
return true;
|
|
@@ -101230,11 +101314,13 @@ var ts;
|
|
|
101230
101314
|
return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context);
|
|
101231
101315
|
}
|
|
101232
101316
|
function visitIdentifier(node) {
|
|
101233
|
-
if (
|
|
101234
|
-
|
|
101317
|
+
if (convertedLoopState) {
|
|
101318
|
+
if (resolver.isArgumentsLocalBinding(node)) {
|
|
101319
|
+
return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments"));
|
|
101320
|
+
}
|
|
101235
101321
|
}
|
|
101236
|
-
if (
|
|
101237
|
-
return
|
|
101322
|
+
if (node.hasExtendedUnicodeEscape) {
|
|
101323
|
+
return ts.setOriginalNode(ts.setTextRange(factory.createIdentifier(ts.unescapeLeadingUnderscores(node.escapedText)), node), node);
|
|
101238
101324
|
}
|
|
101239
101325
|
return node;
|
|
101240
101326
|
}
|
|
@@ -129193,6 +129279,12 @@ var ts;
|
|
|
129193
129279
|
SemanticClassificationFormat["Original"] = "original";
|
|
129194
129280
|
SemanticClassificationFormat["TwentyTwenty"] = "2020";
|
|
129195
129281
|
})(SemanticClassificationFormat = ts.SemanticClassificationFormat || (ts.SemanticClassificationFormat = {}));
|
|
129282
|
+
var OrganizeImportsMode;
|
|
129283
|
+
(function (OrganizeImportsMode) {
|
|
129284
|
+
OrganizeImportsMode["All"] = "All";
|
|
129285
|
+
OrganizeImportsMode["SortAndCombine"] = "SortAndCombine";
|
|
129286
|
+
OrganizeImportsMode["RemoveUnused"] = "RemoveUnused";
|
|
129287
|
+
})(OrganizeImportsMode = ts.OrganizeImportsMode || (ts.OrganizeImportsMode = {}));
|
|
129196
129288
|
var CompletionTriggerKind;
|
|
129197
129289
|
(function (CompletionTriggerKind) {
|
|
129198
129290
|
/** Completion was triggered by typing an identifier, manual invocation (e.g Ctrl+Space) or via API. */
|
|
@@ -144948,23 +145040,39 @@ var ts;
|
|
|
144948
145040
|
* 2) Coalescing imports from the same module
|
|
144949
145041
|
* 3) Sorting imports
|
|
144950
145042
|
*/
|
|
144951
|
-
function organizeImports(sourceFile, formatContext, host, program, preferences,
|
|
145043
|
+
function organizeImports(sourceFile, formatContext, host, program, preferences, mode) {
|
|
144952
145044
|
var changeTracker = ts.textChanges.ChangeTracker.fromContext({ host: host, formatContext: formatContext, preferences: preferences });
|
|
144953
|
-
var
|
|
145045
|
+
var shouldSort = mode === "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ || mode === "All" /* OrganizeImportsMode.All */;
|
|
145046
|
+
var shouldCombine = shouldSort; // These are currently inseparable, but I draw a distinction for clarity and in case we add modes in the future.
|
|
145047
|
+
var shouldRemove = mode === "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */ || mode === "All" /* OrganizeImportsMode.All */;
|
|
145048
|
+
var maybeRemove = shouldRemove ? removeUnusedImports : ts.identity;
|
|
145049
|
+
var maybeCoalesce = shouldCombine ? coalesceImports : ts.identity;
|
|
145050
|
+
var processImportsOfSameModuleSpecifier = function (importGroup) {
|
|
145051
|
+
var processedDeclarations = maybeCoalesce(maybeRemove(importGroup, sourceFile, program));
|
|
145052
|
+
return shouldSort
|
|
145053
|
+
? ts.stableSort(processedDeclarations, function (s1, s2) { return compareImportsOrRequireStatements(s1, s2); })
|
|
145054
|
+
: processedDeclarations;
|
|
145055
|
+
};
|
|
144954
145056
|
// All of the old ImportDeclarations in the file, in syntactic order.
|
|
144955
145057
|
var topLevelImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, sourceFile.statements.filter(ts.isImportDeclaration));
|
|
144956
|
-
topLevelImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl,
|
|
144957
|
-
//
|
|
144958
|
-
|
|
144959
|
-
|
|
145058
|
+
topLevelImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); });
|
|
145059
|
+
// Exports are always used
|
|
145060
|
+
if (mode !== "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */) {
|
|
145061
|
+
// All of the old ExportDeclarations in the file, in syntactic order.
|
|
145062
|
+
var topLevelExportDecls = sourceFile.statements.filter(ts.isExportDeclaration);
|
|
145063
|
+
organizeImportsWorker(topLevelExportDecls, coalesceExports);
|
|
145064
|
+
}
|
|
144960
145065
|
for (var _i = 0, _a = sourceFile.statements.filter(ts.isAmbientModule); _i < _a.length; _i++) {
|
|
144961
145066
|
var ambientModule = _a[_i];
|
|
144962
145067
|
if (!ambientModule.body)
|
|
144963
145068
|
continue;
|
|
144964
145069
|
var ambientModuleImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(ts.isImportDeclaration));
|
|
144965
|
-
ambientModuleImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl,
|
|
144966
|
-
|
|
144967
|
-
|
|
145070
|
+
ambientModuleImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); });
|
|
145071
|
+
// Exports are always used
|
|
145072
|
+
if (mode !== "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */) {
|
|
145073
|
+
var ambientModuleExportDecls = ambientModule.body.statements.filter(ts.isExportDeclaration);
|
|
145074
|
+
organizeImportsWorker(ambientModuleExportDecls, coalesceExports);
|
|
145075
|
+
}
|
|
144968
145076
|
}
|
|
144969
145077
|
return changeTracker.getChanges();
|
|
144970
145078
|
function organizeImportsWorker(oldImportDecls, coalesce) {
|
|
@@ -144977,8 +145085,12 @@ var ts;
|
|
|
144977
145085
|
// Consider: we could do a more careful check that this trivia is actually a header,
|
|
144978
145086
|
// but the consequences of being wrong are very minor.
|
|
144979
145087
|
ts.suppressLeadingTrivia(oldImportDecls[0]);
|
|
144980
|
-
var oldImportGroups =
|
|
144981
|
-
|
|
145088
|
+
var oldImportGroups = shouldCombine
|
|
145089
|
+
? ts.group(oldImportDecls, function (importDecl) { return getExternalModuleName(importDecl.moduleSpecifier); })
|
|
145090
|
+
: [oldImportDecls];
|
|
145091
|
+
var sortedImportGroups = shouldSort
|
|
145092
|
+
? ts.stableSort(oldImportGroups, function (group1, group2) { return compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier); })
|
|
145093
|
+
: oldImportGroups;
|
|
144982
145094
|
var newImportDecls = ts.flatMap(sortedImportGroups, function (importGroup) {
|
|
144983
145095
|
return getExternalModuleName(importGroup[0].moduleSpecifier)
|
|
144984
145096
|
? coalesce(importGroup)
|
|
@@ -145042,11 +145154,7 @@ var ts;
|
|
|
145042
145154
|
}
|
|
145043
145155
|
return false;
|
|
145044
145156
|
}
|
|
145045
|
-
function removeUnusedImports(oldImports, sourceFile, program
|
|
145046
|
-
// As a precaution, consider unused import detection to be destructive (GH #43051)
|
|
145047
|
-
if (skipDestructiveCodeActions) {
|
|
145048
|
-
return oldImports;
|
|
145049
|
-
}
|
|
145157
|
+
function removeUnusedImports(oldImports, sourceFile, program) {
|
|
145050
145158
|
var typeChecker = program.getTypeChecker();
|
|
145051
145159
|
var compilerOptions = program.getCompilerOptions();
|
|
145052
145160
|
var jsxNamespace = typeChecker.getJsxNamespace(sourceFile);
|
|
@@ -154079,6 +154187,15 @@ var ts;
|
|
|
154079
154187
|
});
|
|
154080
154188
|
}
|
|
154081
154189
|
function makeChange(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) {
|
|
154190
|
+
if (ts.isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) {
|
|
154191
|
+
var exprType = checker.getTypeAtLocation(insertionSite);
|
|
154192
|
+
var asyncIter = checker.getAsyncIterableType();
|
|
154193
|
+
if (asyncIter && checker.isTypeAssignableTo(exprType, asyncIter)) {
|
|
154194
|
+
var forOf = insertionSite.parent;
|
|
154195
|
+
changeTracker.replaceNode(sourceFile, forOf, ts.factory.updateForOfStatement(forOf, ts.factory.createToken(133 /* SyntaxKind.AwaitKeyword */), forOf.initializer, forOf.expression, forOf.statement));
|
|
154196
|
+
return;
|
|
154197
|
+
}
|
|
154198
|
+
}
|
|
154082
154199
|
if (ts.isBinaryExpression(insertionSite)) {
|
|
154083
154200
|
for (var _i = 0, _a = [insertionSite.left, insertionSite.right]; _i < _a.length; _i++) {
|
|
154084
154201
|
var side = _a[_i];
|
|
@@ -169434,12 +169551,14 @@ var ts;
|
|
|
169434
169551
|
return ts.codefix.getAllFixes({ fixId: fixId, sourceFile: sourceFile, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences });
|
|
169435
169552
|
}
|
|
169436
169553
|
function organizeImports(args, formatOptions, preferences) {
|
|
169554
|
+
var _a;
|
|
169437
169555
|
if (preferences === void 0) { preferences = ts.emptyOptions; }
|
|
169438
169556
|
synchronizeHostData();
|
|
169439
169557
|
ts.Debug.assert(args.type === "file");
|
|
169440
169558
|
var sourceFile = getValidSourceFile(args.fileName);
|
|
169441
169559
|
var formatContext = ts.formatting.getFormatContext(formatOptions, host);
|
|
169442
|
-
|
|
169560
|
+
var mode = (_a = args.mode) !== null && _a !== void 0 ? _a : (args.skipDestructiveCodeActions ? "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ : "All" /* OrganizeImportsMode.All */);
|
|
169561
|
+
return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, mode);
|
|
169443
169562
|
}
|
|
169444
169563
|
function getEditsForFileRename(oldFilePath, newFilePath, formatOptions, preferences) {
|
|
169445
169564
|
if (preferences === void 0) { preferences = ts.emptyOptions; }
|