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/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
92
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221001");
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -11358,7 +11358,7 @@ var ts;
|
|
|
11358
11358
|
return -1;
|
|
11359
11359
|
}
|
|
11360
11360
|
function peekExtendedUnicodeEscape() {
|
|
11361
|
-
if (
|
|
11361
|
+
if (codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) {
|
|
11362
11362
|
var start_2 = pos;
|
|
11363
11363
|
pos += 3;
|
|
11364
11364
|
var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false);
|
|
@@ -23139,7 +23139,7 @@ var ts;
|
|
|
23139
23139
|
return node;
|
|
23140
23140
|
}
|
|
23141
23141
|
// @api
|
|
23142
|
-
function createIdentifier(text, typeArguments, originalKeywordKind) {
|
|
23142
|
+
function createIdentifier(text, typeArguments, originalKeywordKind, hasExtendedUnicodeEscape) {
|
|
23143
23143
|
var node = createBaseIdentifier(text, originalKeywordKind);
|
|
23144
23144
|
if (typeArguments) {
|
|
23145
23145
|
// NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations
|
|
@@ -23148,6 +23148,10 @@ var ts;
|
|
|
23148
23148
|
if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) {
|
|
23149
23149
|
node.transformFlags |= 67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */;
|
|
23150
23150
|
}
|
|
23151
|
+
if (hasExtendedUnicodeEscape) {
|
|
23152
|
+
node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape;
|
|
23153
|
+
node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */;
|
|
23154
|
+
}
|
|
23151
23155
|
return node;
|
|
23152
23156
|
}
|
|
23153
23157
|
// @api
|
|
@@ -33082,8 +33086,9 @@ var ts;
|
|
|
33082
33086
|
// Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker
|
|
33083
33087
|
var originalKeywordKind = token();
|
|
33084
33088
|
var text = internIdentifier(scanner.getTokenValue());
|
|
33089
|
+
var hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape();
|
|
33085
33090
|
nextTokenWithoutCheck();
|
|
33086
|
-
return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind), pos);
|
|
33091
|
+
return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind, hasExtendedUnicodeEscape), pos);
|
|
33087
33092
|
}
|
|
33088
33093
|
if (token() === 80 /* SyntaxKind.PrivateIdentifier */) {
|
|
33089
33094
|
parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
@@ -49478,6 +49483,12 @@ var ts;
|
|
|
49478
49483
|
getOptionalType: function () { return optionalType; },
|
|
49479
49484
|
getPromiseType: function () { return getGlobalPromiseType(/*reportErrors*/ false); },
|
|
49480
49485
|
getPromiseLikeType: function () { return getGlobalPromiseLikeType(/*reportErrors*/ false); },
|
|
49486
|
+
getAsyncIterableType: function () {
|
|
49487
|
+
var type = getGlobalAsyncIterableType(/*reportErrors*/ false);
|
|
49488
|
+
if (type === emptyGenericType)
|
|
49489
|
+
return undefined;
|
|
49490
|
+
return type;
|
|
49491
|
+
},
|
|
49481
49492
|
isSymbolAccessible: isSymbolAccessible,
|
|
49482
49493
|
isArrayType: isArrayType,
|
|
49483
49494
|
isTupleType: isTupleType,
|
|
@@ -50315,9 +50326,9 @@ var ts;
|
|
|
50315
50326
|
return symbol;
|
|
50316
50327
|
}
|
|
50317
50328
|
if (symbol.flags & 2097152 /* SymbolFlags.Alias */) {
|
|
50318
|
-
var
|
|
50319
|
-
//
|
|
50320
|
-
if (
|
|
50329
|
+
var targetFlags = getAllSymbolFlags(symbol);
|
|
50330
|
+
// `targetFlags` will be `SymbolFlags.All` if an error occurred in alias resolution; this avoids cascading errors
|
|
50331
|
+
if (targetFlags & meaning) {
|
|
50321
50332
|
return symbol;
|
|
50322
50333
|
}
|
|
50323
50334
|
}
|
|
@@ -50950,8 +50961,8 @@ var ts;
|
|
|
50950
50961
|
!checkAndReportErrorForExtendingInterface(errorLocation) &&
|
|
50951
50962
|
!checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
|
|
50952
50963
|
!checkAndReportErrorForExportingPrimitiveType(errorLocation, name) &&
|
|
50964
|
+
!checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) &&
|
|
50953
50965
|
!checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) &&
|
|
50954
|
-
!checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
|
|
50955
50966
|
!checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
|
|
50956
50967
|
var suggestion = void 0;
|
|
50957
50968
|
var suggestedLib = void 0;
|
|
@@ -51038,7 +51049,7 @@ var ts;
|
|
|
51038
51049
|
}
|
|
51039
51050
|
}
|
|
51040
51051
|
if (result && errorLocation && meaning & 111551 /* SymbolFlags.Value */ && result.flags & 2097152 /* SymbolFlags.Alias */ && !(result.flags & 111551 /* SymbolFlags.Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
51041
|
-
var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result);
|
|
51052
|
+
var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* SymbolFlags.Value */);
|
|
51042
51053
|
if (typeOnlyDeclaration) {
|
|
51043
51054
|
var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */
|
|
51044
51055
|
? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
|
|
@@ -51201,7 +51212,7 @@ var ts;
|
|
|
51201
51212
|
return false;
|
|
51202
51213
|
}
|
|
51203
51214
|
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
|
|
51204
|
-
if (meaning &
|
|
51215
|
+
if (meaning & 111551 /* SymbolFlags.Value */) {
|
|
51205
51216
|
if (isPrimitiveTypeName(name)) {
|
|
51206
51217
|
if (isExtendedByInterface(errorLocation)) {
|
|
51207
51218
|
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));
|
|
@@ -51212,7 +51223,8 @@ var ts;
|
|
|
51212
51223
|
return true;
|
|
51213
51224
|
}
|
|
51214
51225
|
var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
|
|
51215
|
-
|
|
51226
|
+
var allFlags = symbol && getAllSymbolFlags(symbol);
|
|
51227
|
+
if (symbol && allFlags !== undefined && !(allFlags & 111551 /* SymbolFlags.Value */)) {
|
|
51216
51228
|
var rawName = ts.unescapeLeadingUnderscores(name);
|
|
51217
51229
|
if (isES2015OrLaterConstructorName(name)) {
|
|
51218
51230
|
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);
|
|
@@ -51260,16 +51272,16 @@ var ts;
|
|
|
51260
51272
|
}
|
|
51261
51273
|
return false;
|
|
51262
51274
|
}
|
|
51263
|
-
function
|
|
51264
|
-
if (meaning & (111551 /* SymbolFlags.Value */ & ~
|
|
51265
|
-
var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule
|
|
51275
|
+
function checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) {
|
|
51276
|
+
if (meaning & (111551 /* SymbolFlags.Value */ & ~788968 /* SymbolFlags.Type */)) {
|
|
51277
|
+
var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
|
|
51266
51278
|
if (symbol) {
|
|
51267
51279
|
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name));
|
|
51268
51280
|
return true;
|
|
51269
51281
|
}
|
|
51270
51282
|
}
|
|
51271
|
-
else if (meaning & (788968 /* SymbolFlags.Type */ & ~
|
|
51272
|
-
var symbol = resolveSymbol(resolveName(errorLocation, name,
|
|
51283
|
+
else if (meaning & (788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */)) {
|
|
51284
|
+
var symbol = resolveSymbol(resolveName(errorLocation, name, 1536 /* SymbolFlags.Module */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
|
|
51273
51285
|
if (symbol) {
|
|
51274
51286
|
error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name));
|
|
51275
51287
|
return true;
|
|
@@ -51859,6 +51871,52 @@ var ts;
|
|
|
51859
51871
|
}
|
|
51860
51872
|
return undefined;
|
|
51861
51873
|
}
|
|
51874
|
+
/**
|
|
51875
|
+
* Gets combined flags of a `symbol` and all alias targets it resolves to. `resolveAlias`
|
|
51876
|
+
* is typically recursive over chains of aliases, but stops mid-chain if an alias is merged
|
|
51877
|
+
* with another exported symbol, e.g.
|
|
51878
|
+
* ```ts
|
|
51879
|
+
* // a.ts
|
|
51880
|
+
* export const a = 0;
|
|
51881
|
+
* // b.ts
|
|
51882
|
+
* export { a } from "./a";
|
|
51883
|
+
* export type a = number;
|
|
51884
|
+
* // c.ts
|
|
51885
|
+
* import { a } from "./b";
|
|
51886
|
+
* ```
|
|
51887
|
+
* Calling `resolveAlias` on the `a` in c.ts would stop at the merged symbol exported
|
|
51888
|
+
* from b.ts, even though there is still more alias to resolve. Consequently, if we were
|
|
51889
|
+
* trying to determine if the `a` in c.ts has a value meaning, looking at the flags on
|
|
51890
|
+
* the local symbol and on the symbol returned by `resolveAlias` is not enough.
|
|
51891
|
+
* @returns SymbolFlags.All if `symbol` is an alias that ultimately resolves to `unknown`;
|
|
51892
|
+
* combined flags of all alias targets otherwise.
|
|
51893
|
+
*/
|
|
51894
|
+
function getAllSymbolFlags(symbol) {
|
|
51895
|
+
var flags = symbol.flags;
|
|
51896
|
+
var seenSymbols;
|
|
51897
|
+
while (symbol.flags & 2097152 /* SymbolFlags.Alias */) {
|
|
51898
|
+
var target = resolveAlias(symbol);
|
|
51899
|
+
if (target === unknownSymbol) {
|
|
51900
|
+
return 67108863 /* SymbolFlags.All */;
|
|
51901
|
+
}
|
|
51902
|
+
// Optimizations - try to avoid creating or adding to
|
|
51903
|
+
// `seenSymbols` if possible
|
|
51904
|
+
if (target === symbol || (seenSymbols === null || seenSymbols === void 0 ? void 0 : seenSymbols.has(target))) {
|
|
51905
|
+
break;
|
|
51906
|
+
}
|
|
51907
|
+
if (target.flags & 2097152 /* SymbolFlags.Alias */) {
|
|
51908
|
+
if (seenSymbols) {
|
|
51909
|
+
seenSymbols.add(target);
|
|
51910
|
+
}
|
|
51911
|
+
else {
|
|
51912
|
+
seenSymbols = new ts.Set([symbol, target]);
|
|
51913
|
+
}
|
|
51914
|
+
}
|
|
51915
|
+
flags |= target.flags;
|
|
51916
|
+
symbol = target;
|
|
51917
|
+
}
|
|
51918
|
+
return flags;
|
|
51919
|
+
}
|
|
51862
51920
|
/**
|
|
51863
51921
|
* Marks a symbol as type-only if its declaration is syntactically type-only.
|
|
51864
51922
|
* If it is not itself marked type-only, but resolves to a type-only alias
|
|
@@ -51904,19 +51962,25 @@ var ts;
|
|
|
51904
51962
|
return !!aliasDeclarationLinks.typeOnlyDeclaration;
|
|
51905
51963
|
}
|
|
51906
51964
|
/** Indicates that a symbol directly or indirectly resolves to a type-only import or export. */
|
|
51907
|
-
function getTypeOnlyAliasDeclaration(symbol) {
|
|
51965
|
+
function getTypeOnlyAliasDeclaration(symbol, include) {
|
|
51908
51966
|
if (!(symbol.flags & 2097152 /* SymbolFlags.Alias */)) {
|
|
51909
51967
|
return undefined;
|
|
51910
51968
|
}
|
|
51911
51969
|
var links = getSymbolLinks(symbol);
|
|
51912
|
-
|
|
51970
|
+
if (include === undefined) {
|
|
51971
|
+
return links.typeOnlyDeclaration || undefined;
|
|
51972
|
+
}
|
|
51973
|
+
if (links.typeOnlyDeclaration) {
|
|
51974
|
+
return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : undefined;
|
|
51975
|
+
}
|
|
51976
|
+
return undefined;
|
|
51913
51977
|
}
|
|
51914
51978
|
function markExportAsReferenced(node) {
|
|
51915
51979
|
var symbol = getSymbolOfNode(node);
|
|
51916
51980
|
var target = resolveAlias(symbol);
|
|
51917
51981
|
if (target) {
|
|
51918
51982
|
var markAlias = target === unknownSymbol ||
|
|
51919
|
-
((target
|
|
51983
|
+
((getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */));
|
|
51920
51984
|
if (markAlias) {
|
|
51921
51985
|
markAliasSymbolAsReferenced(symbol);
|
|
51922
51986
|
}
|
|
@@ -51936,8 +52000,7 @@ var ts;
|
|
|
51936
52000
|
// This way a chain of imports can be elided if ultimately the final input is only used in a type
|
|
51937
52001
|
// position.
|
|
51938
52002
|
if (ts.isInternalModuleImportEqualsDeclaration(node)) {
|
|
51939
|
-
|
|
51940
|
-
if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) {
|
|
52003
|
+
if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551 /* SymbolFlags.Value */) {
|
|
51941
52004
|
// import foo = <symbol>
|
|
51942
52005
|
checkExpressionCached(node.moduleReference);
|
|
51943
52006
|
}
|
|
@@ -52759,7 +52822,7 @@ var ts;
|
|
|
52759
52822
|
}
|
|
52760
52823
|
function symbolIsValue(symbol, includeTypeOnlyMembers) {
|
|
52761
52824
|
return !!(symbol.flags & 111551 /* SymbolFlags.Value */ ||
|
|
52762
|
-
symbol.flags & 2097152 /* SymbolFlags.Alias */ &&
|
|
52825
|
+
symbol.flags & 2097152 /* SymbolFlags.Alias */ && getAllSymbolFlags(symbol) & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol)));
|
|
52763
52826
|
}
|
|
52764
52827
|
function findConstructorDeclaration(node) {
|
|
52765
52828
|
var members = node.members;
|
|
@@ -53028,8 +53091,10 @@ var ts;
|
|
|
53028
53091
|
return true;
|
|
53029
53092
|
}
|
|
53030
53093
|
// Qualify if the symbol from symbol table has same meaning as expected
|
|
53031
|
-
|
|
53032
|
-
|
|
53094
|
+
var shouldResolveAlias = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */));
|
|
53095
|
+
symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
|
|
53096
|
+
var flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags;
|
|
53097
|
+
if (flags & meaning) {
|
|
53033
53098
|
qualify = true;
|
|
53034
53099
|
return true;
|
|
53035
53100
|
}
|
|
@@ -55686,7 +55751,7 @@ var ts;
|
|
|
55686
55751
|
return !symbol.exports ? [] : ts.filter(ts.arrayFrom(symbol.exports.values()), isNamespaceMember);
|
|
55687
55752
|
}
|
|
55688
55753
|
function isTypeOnlyNamespace(symbol) {
|
|
55689
|
-
return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m)
|
|
55754
|
+
return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* SymbolFlags.Value */); });
|
|
55690
55755
|
}
|
|
55691
55756
|
function serializeModule(symbol, symbolName, modifierFlags) {
|
|
55692
55757
|
var members = getNamespaceMembersForSerialization(symbol);
|
|
@@ -57906,7 +57971,7 @@ var ts;
|
|
|
57906
57971
|
links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol)
|
|
57907
57972
|
: isDuplicatedCommonJSExport(symbol.declarations) ? autoType
|
|
57908
57973
|
: declaredType ? declaredType
|
|
57909
|
-
: targetSymbol
|
|
57974
|
+
: getAllSymbolFlags(targetSymbol) & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol)
|
|
57910
57975
|
: errorType;
|
|
57911
57976
|
}
|
|
57912
57977
|
return links.type;
|
|
@@ -60259,7 +60324,7 @@ var ts;
|
|
|
60259
60324
|
var indexTypes;
|
|
60260
60325
|
var isUnion = containingType.flags & 1048576 /* TypeFlags.Union */;
|
|
60261
60326
|
// Flags we want to propagate to the result if they exist in all source symbols
|
|
60262
|
-
var optionalFlag
|
|
60327
|
+
var optionalFlag;
|
|
60263
60328
|
var syntheticFlag = 4 /* CheckFlags.SyntheticMethod */;
|
|
60264
60329
|
var checkFlags = isUnion ? 0 : 8 /* CheckFlags.Readonly */;
|
|
60265
60330
|
var mergedInstantiations = false;
|
|
@@ -60270,11 +60335,14 @@ var ts;
|
|
|
60270
60335
|
var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment);
|
|
60271
60336
|
var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0;
|
|
60272
60337
|
if (prop) {
|
|
60273
|
-
if (
|
|
60274
|
-
optionalFlag
|
|
60275
|
-
|
|
60276
|
-
|
|
60277
|
-
|
|
60338
|
+
if (prop.flags & 106500 /* SymbolFlags.ClassMember */) {
|
|
60339
|
+
optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : (optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */);
|
|
60340
|
+
if (isUnion) {
|
|
60341
|
+
optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */);
|
|
60342
|
+
}
|
|
60343
|
+
else {
|
|
60344
|
+
optionalFlag &= prop.flags;
|
|
60345
|
+
}
|
|
60278
60346
|
}
|
|
60279
60347
|
if (!singleProp) {
|
|
60280
60348
|
singleProp = prop;
|
|
@@ -60393,7 +60461,7 @@ var ts;
|
|
|
60393
60461
|
propTypes.push(type);
|
|
60394
60462
|
}
|
|
60395
60463
|
ts.addRange(propTypes, indexTypes);
|
|
60396
|
-
var result = createSymbol(4 /* SymbolFlags.Property */ | optionalFlag, name, syntheticFlag | checkFlags);
|
|
60464
|
+
var result = createSymbol(4 /* SymbolFlags.Property */ | (optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : 0), name, syntheticFlag | checkFlags);
|
|
60397
60465
|
result.containingType = containingType;
|
|
60398
60466
|
if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
|
|
60399
60467
|
result.valueDeclaration = firstValueDeclaration;
|
|
@@ -67660,7 +67728,7 @@ var ts;
|
|
|
67660
67728
|
return 0 /* Ternary.False */;
|
|
67661
67729
|
}
|
|
67662
67730
|
// When checking for comparability, be more lenient with optional properties.
|
|
67663
|
-
if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) {
|
|
67731
|
+
if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && targetProp.flags & 106500 /* SymbolFlags.ClassMember */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) {
|
|
67664
67732
|
// TypeScript 1.0 spec (April 2014): 3.8.3
|
|
67665
67733
|
// S is a subtype of a type T, and T is a supertype of S if ...
|
|
67666
67734
|
// S' and T are object types and, for each member M in T..
|
|
@@ -72932,9 +73000,9 @@ var ts;
|
|
|
72932
73000
|
});
|
|
72933
73001
|
}
|
|
72934
73002
|
function markAliasReferenced(symbol, location) {
|
|
72935
|
-
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) {
|
|
73003
|
+
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
|
|
72936
73004
|
var target = resolveAlias(symbol);
|
|
72937
|
-
if (target
|
|
73005
|
+
if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
|
|
72938
73006
|
// An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled
|
|
72939
73007
|
// (because the const enum value will not be inlined), or if (2) the alias is an export
|
|
72940
73008
|
// of a const enum declaration that will be preserved.
|
|
@@ -74350,9 +74418,10 @@ var ts;
|
|
|
74350
74418
|
function instantiateContextualType(contextualType, node, contextFlags) {
|
|
74351
74419
|
if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* TypeFlags.Instantiable */)) {
|
|
74352
74420
|
var inferenceContext = getInferenceContext(node);
|
|
74353
|
-
// If no inferences have been made,
|
|
74354
|
-
//
|
|
74355
|
-
|
|
74421
|
+
// If no inferences have been made, and none of the type parameters for which we are inferring
|
|
74422
|
+
// specify default types, nothing is gained from instantiating as type parameters would just be
|
|
74423
|
+
// replaced with their constraints similar to the apparent type.
|
|
74424
|
+
if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) {
|
|
74356
74425
|
// For contextual signatures we incorporate all inferences made so far, e.g. from return
|
|
74357
74426
|
// types as well as arguments to the left in a function call.
|
|
74358
74427
|
return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
|
|
@@ -78826,7 +78895,7 @@ var ts;
|
|
|
78826
78895
|
if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) {
|
|
78827
78896
|
symbol = resolveAlias(symbol);
|
|
78828
78897
|
}
|
|
78829
|
-
return !!(symbol && (symbol
|
|
78898
|
+
return !!(symbol && (getAllSymbolFlags(symbol) & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */);
|
|
78830
78899
|
}
|
|
78831
78900
|
return false;
|
|
78832
78901
|
}
|
|
@@ -81200,6 +81269,9 @@ var ts;
|
|
|
81200
81269
|
function hasInferenceCandidates(info) {
|
|
81201
81270
|
return !!(info.candidates || info.contraCandidates);
|
|
81202
81271
|
}
|
|
81272
|
+
function hasInferenceCandidatesOrDefault(info) {
|
|
81273
|
+
return !!(info.candidates || info.contraCandidates || hasTypeParameterDefault(info.typeParameter));
|
|
81274
|
+
}
|
|
81203
81275
|
function hasOverlappingInferences(a, b) {
|
|
81204
81276
|
for (var i = 0; i < a.length; i++) {
|
|
81205
81277
|
if (hasInferenceCandidates(a[i]) && hasInferenceCandidates(b[i])) {
|
|
@@ -85001,7 +85073,16 @@ var ts;
|
|
|
85001
85073
|
var message = allowAsyncIterables
|
|
85002
85074
|
? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator
|
|
85003
85075
|
: ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator;
|
|
85004
|
-
|
|
85076
|
+
var suggestAwait =
|
|
85077
|
+
// for (const x of Promise<...>) or [...Promise<...>]
|
|
85078
|
+
!!getAwaitedTypeOfPromise(type)
|
|
85079
|
+
// for (const x of AsyncIterable<...>)
|
|
85080
|
+
|| (!allowAsyncIterables &&
|
|
85081
|
+
ts.isForOfStatement(errorNode.parent) &&
|
|
85082
|
+
errorNode.parent.expression === errorNode &&
|
|
85083
|
+
getGlobalAsyncIterableType(/** reportErrors */ false) !== emptyGenericType &&
|
|
85084
|
+
isTypeAssignableTo(type, getGlobalAsyncIterableType(/** reportErrors */ false)));
|
|
85085
|
+
return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
|
|
85005
85086
|
}
|
|
85006
85087
|
/**
|
|
85007
85088
|
* Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type.
|
|
@@ -86852,10 +86933,11 @@ var ts;
|
|
|
86852
86933
|
}
|
|
86853
86934
|
return;
|
|
86854
86935
|
}
|
|
86936
|
+
var targetFlags = getAllSymbolFlags(target);
|
|
86855
86937
|
var excludedMeanings = (symbol.flags & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */) ? 111551 /* SymbolFlags.Value */ : 0) |
|
|
86856
86938
|
(symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) |
|
|
86857
86939
|
(symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0);
|
|
86858
|
-
if (
|
|
86940
|
+
if (targetFlags & excludedMeanings) {
|
|
86859
86941
|
var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ?
|
|
86860
86942
|
ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
|
|
86861
86943
|
ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
|
|
@@ -86865,7 +86947,7 @@ var ts;
|
|
|
86865
86947
|
&& !ts.isTypeOnlyImportOrExportDeclaration(node)
|
|
86866
86948
|
&& !(node.flags & 16777216 /* NodeFlags.Ambient */)) {
|
|
86867
86949
|
var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
|
|
86868
|
-
var isType = !(
|
|
86950
|
+
var isType = !(targetFlags & 111551 /* SymbolFlags.Value */);
|
|
86869
86951
|
if (isType || typeOnlyAlias) {
|
|
86870
86952
|
switch (node.kind) {
|
|
86871
86953
|
case 270 /* SyntaxKind.ImportClause */:
|
|
@@ -87025,14 +87107,15 @@ var ts;
|
|
|
87025
87107
|
if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) {
|
|
87026
87108
|
var target = resolveAlias(getSymbolOfNode(node));
|
|
87027
87109
|
if (target !== unknownSymbol) {
|
|
87028
|
-
|
|
87110
|
+
var targetFlags = getAllSymbolFlags(target);
|
|
87111
|
+
if (targetFlags & 111551 /* SymbolFlags.Value */) {
|
|
87029
87112
|
// Target is a value symbol, check that it is not hidden by a local declaration with the same name
|
|
87030
87113
|
var moduleName = ts.getFirstIdentifier(node.moduleReference);
|
|
87031
87114
|
if (!(resolveEntityName(moduleName, 111551 /* SymbolFlags.Value */ | 1920 /* SymbolFlags.Namespace */).flags & 1920 /* SymbolFlags.Namespace */)) {
|
|
87032
87115
|
error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));
|
|
87033
87116
|
}
|
|
87034
87117
|
}
|
|
87035
|
-
if (
|
|
87118
|
+
if (targetFlags & 788968 /* SymbolFlags.Type */) {
|
|
87036
87119
|
checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);
|
|
87037
87120
|
}
|
|
87038
87121
|
}
|
|
@@ -87171,7 +87254,7 @@ var ts;
|
|
|
87171
87254
|
markExportAsReferenced(node);
|
|
87172
87255
|
}
|
|
87173
87256
|
var target = symbol && (symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol);
|
|
87174
|
-
if (!target || target
|
|
87257
|
+
if (!target || getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
|
|
87175
87258
|
checkExpressionCached(node.propertyName || node.name);
|
|
87176
87259
|
}
|
|
87177
87260
|
}
|
|
@@ -87218,7 +87301,7 @@ var ts;
|
|
|
87218
87301
|
markAliasReferenced(sym, id);
|
|
87219
87302
|
// If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`)
|
|
87220
87303
|
var target = sym.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(sym) : sym;
|
|
87221
|
-
if (target
|
|
87304
|
+
if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
|
|
87222
87305
|
// However if it is a value, we need to check it's being used correctly
|
|
87223
87306
|
checkExpressionCached(node.expression);
|
|
87224
87307
|
}
|
|
@@ -88540,7 +88623,7 @@ var ts;
|
|
|
88540
88623
|
return symbolLinks.exportsSomeValue;
|
|
88541
88624
|
function isValue(s) {
|
|
88542
88625
|
s = resolveSymbol(s);
|
|
88543
|
-
return s && !!(s
|
|
88626
|
+
return s && !!(getAllSymbolFlags(s) & 111551 /* SymbolFlags.Value */);
|
|
88544
88627
|
}
|
|
88545
88628
|
}
|
|
88546
88629
|
function isNameOfModuleOrEnumDeclaration(node) {
|
|
@@ -88593,7 +88676,7 @@ var ts;
|
|
|
88593
88676
|
var symbol = getReferencedValueOrAliasSymbol(node);
|
|
88594
88677
|
// We should only get the declaration of an alias if there isn't a local value
|
|
88595
88678
|
// declaration for the symbol
|
|
88596
|
-
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) {
|
|
88679
|
+
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
|
|
88597
88680
|
return getDeclarationOfAliasSymbol(symbol);
|
|
88598
88681
|
}
|
|
88599
88682
|
}
|
|
@@ -88681,7 +88764,7 @@ var ts;
|
|
|
88681
88764
|
case 273 /* SyntaxKind.ImportSpecifier */:
|
|
88682
88765
|
case 278 /* SyntaxKind.ExportSpecifier */:
|
|
88683
88766
|
var symbol = getSymbolOfNode(node);
|
|
88684
|
-
return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol);
|
|
88767
|
+
return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */);
|
|
88685
88768
|
case 275 /* SyntaxKind.ExportDeclaration */:
|
|
88686
88769
|
var exportClause = node.exportClause;
|
|
88687
88770
|
return !!exportClause && (ts.isNamespaceExport(exportClause) ||
|
|
@@ -88703,6 +88786,7 @@ var ts;
|
|
|
88703
88786
|
return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference);
|
|
88704
88787
|
}
|
|
88705
88788
|
function isAliasResolvedToValue(symbol) {
|
|
88789
|
+
var _a;
|
|
88706
88790
|
if (!symbol) {
|
|
88707
88791
|
return false;
|
|
88708
88792
|
}
|
|
@@ -88712,7 +88796,7 @@ var ts;
|
|
|
88712
88796
|
}
|
|
88713
88797
|
// const enums and modules that contain only const enums are not considered values from the emit perspective
|
|
88714
88798
|
// unless 'preserveConstEnums' option is set to true
|
|
88715
|
-
return !!(target
|
|
88799
|
+
return !!(((_a = getAllSymbolFlags(target)) !== null && _a !== void 0 ? _a : -1) & 111551 /* SymbolFlags.Value */) &&
|
|
88716
88800
|
(ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target));
|
|
88717
88801
|
}
|
|
88718
88802
|
function isConstEnumOrConstEnumOnlyModule(s) {
|
|
@@ -88727,7 +88811,7 @@ var ts;
|
|
|
88727
88811
|
}
|
|
88728
88812
|
var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217
|
|
88729
88813
|
if (target && ts.getEffectiveModifierFlags(node) & 1 /* ModifierFlags.Export */ &&
|
|
88730
|
-
target
|
|
88814
|
+
getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */ &&
|
|
88731
88815
|
(ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
|
|
88732
88816
|
// An `export import ... =` of a value symbol is always considered referenced
|
|
88733
88817
|
return true;
|
|
@@ -101220,11 +101304,13 @@ var ts;
|
|
|
101220
101304
|
return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context);
|
|
101221
101305
|
}
|
|
101222
101306
|
function visitIdentifier(node) {
|
|
101223
|
-
if (
|
|
101224
|
-
|
|
101307
|
+
if (convertedLoopState) {
|
|
101308
|
+
if (resolver.isArgumentsLocalBinding(node)) {
|
|
101309
|
+
return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments"));
|
|
101310
|
+
}
|
|
101225
101311
|
}
|
|
101226
|
-
if (
|
|
101227
|
-
return
|
|
101312
|
+
if (node.hasExtendedUnicodeEscape) {
|
|
101313
|
+
return ts.setOriginalNode(ts.setTextRange(factory.createIdentifier(ts.unescapeLeadingUnderscores(node.escapedText)), node), node);
|
|
101228
101314
|
}
|
|
101229
101315
|
return node;
|
|
101230
101316
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.9.0-dev.
|
|
5
|
+
"version": "4.9.0-dev.20221001",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"ms": "^2.1.3",
|
|
90
90
|
"node-fetch": "^2.6.7",
|
|
91
91
|
"source-map-support": "latest",
|
|
92
|
-
"typescript": "^4.8.
|
|
92
|
+
"typescript": "^4.8.4",
|
|
93
93
|
"vinyl": "latest",
|
|
94
94
|
"which": "^2.0.2",
|
|
95
95
|
"xml2js": "^0.4.23"
|