typescript 4.9.0-dev.20220929 → 4.9.0-dev.20220930

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.
@@ -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.20220929");
92
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220930");
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -49478,6 +49478,12 @@ var ts;
49478
49478
  getOptionalType: function () { return optionalType; },
49479
49479
  getPromiseType: function () { return getGlobalPromiseType(/*reportErrors*/ false); },
49480
49480
  getPromiseLikeType: function () { return getGlobalPromiseLikeType(/*reportErrors*/ false); },
49481
+ getAsyncIterableType: function () {
49482
+ var type = getGlobalAsyncIterableType(/*reportErrors*/ false);
49483
+ if (type === emptyGenericType)
49484
+ return undefined;
49485
+ return type;
49486
+ },
49481
49487
  isSymbolAccessible: isSymbolAccessible,
49482
49488
  isArrayType: isArrayType,
49483
49489
  isTupleType: isTupleType,
@@ -50315,9 +50321,9 @@ var ts;
50315
50321
  return symbol;
50316
50322
  }
50317
50323
  if (symbol.flags & 2097152 /* SymbolFlags.Alias */) {
50318
- var target = resolveAlias(symbol);
50319
- // Unknown symbol means an error occurred in alias resolution, treat it as positive answer to avoid cascading errors
50320
- if (target === unknownSymbol || target.flags & meaning) {
50324
+ var targetFlags = getAllSymbolFlags(symbol);
50325
+ // `targetFlags` will be `SymbolFlags.All` if an error occurred in alias resolution; this avoids cascading errors
50326
+ if (targetFlags & meaning) {
50321
50327
  return symbol;
50322
50328
  }
50323
50329
  }
@@ -50950,8 +50956,8 @@ var ts;
50950
50956
  !checkAndReportErrorForExtendingInterface(errorLocation) &&
50951
50957
  !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
50952
50958
  !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) &&
50959
+ !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) &&
50953
50960
  !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) &&
50954
- !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
50955
50961
  !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
50956
50962
  var suggestion = void 0;
50957
50963
  var suggestedLib = void 0;
@@ -51038,7 +51044,7 @@ var ts;
51038
51044
  }
51039
51045
  }
51040
51046
  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);
51047
+ var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* SymbolFlags.Value */);
51042
51048
  if (typeOnlyDeclaration) {
51043
51049
  var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */
51044
51050
  ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
@@ -51201,7 +51207,7 @@ var ts;
51201
51207
  return false;
51202
51208
  }
51203
51209
  function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
51204
- if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */)) {
51210
+ if (meaning & 111551 /* SymbolFlags.Value */) {
51205
51211
  if (isPrimitiveTypeName(name)) {
51206
51212
  if (isExtendedByInterface(errorLocation)) {
51207
51213
  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 +51218,8 @@ var ts;
51212
51218
  return true;
51213
51219
  }
51214
51220
  var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
51215
- if (symbol && !(symbol.flags & 1024 /* SymbolFlags.NamespaceModule */)) {
51221
+ var allFlags = symbol && getAllSymbolFlags(symbol);
51222
+ if (symbol && allFlags !== undefined && !(allFlags & 111551 /* SymbolFlags.Value */)) {
51216
51223
  var rawName = ts.unescapeLeadingUnderscores(name);
51217
51224
  if (isES2015OrLaterConstructorName(name)) {
51218
51225
  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 +51267,16 @@ var ts;
51260
51267
  }
51261
51268
  return false;
51262
51269
  }
51263
- function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) {
51264
- if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~788968 /* SymbolFlags.Type */)) {
51265
- var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
51270
+ function checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) {
51271
+ if (meaning & (111551 /* SymbolFlags.Value */ & ~788968 /* SymbolFlags.Type */)) {
51272
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
51266
51273
  if (symbol) {
51267
51274
  error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name));
51268
51275
  return true;
51269
51276
  }
51270
51277
  }
51271
- else if (meaning & (788968 /* SymbolFlags.Type */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */)) {
51272
- var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* SymbolFlags.ValueModule */ | 1024 /* SymbolFlags.NamespaceModule */) & ~788968 /* SymbolFlags.Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
51278
+ else if (meaning & (788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */)) {
51279
+ var symbol = resolveSymbol(resolveName(errorLocation, name, 1536 /* SymbolFlags.Module */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
51273
51280
  if (symbol) {
51274
51281
  error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name));
51275
51282
  return true;
@@ -51859,6 +51866,52 @@ var ts;
51859
51866
  }
51860
51867
  return undefined;
51861
51868
  }
51869
+ /**
51870
+ * Gets combined flags of a `symbol` and all alias targets it resolves to. `resolveAlias`
51871
+ * is typically recursive over chains of aliases, but stops mid-chain if an alias is merged
51872
+ * with another exported symbol, e.g.
51873
+ * ```ts
51874
+ * // a.ts
51875
+ * export const a = 0;
51876
+ * // b.ts
51877
+ * export { a } from "./a";
51878
+ * export type a = number;
51879
+ * // c.ts
51880
+ * import { a } from "./b";
51881
+ * ```
51882
+ * Calling `resolveAlias` on the `a` in c.ts would stop at the merged symbol exported
51883
+ * from b.ts, even though there is still more alias to resolve. Consequently, if we were
51884
+ * trying to determine if the `a` in c.ts has a value meaning, looking at the flags on
51885
+ * the local symbol and on the symbol returned by `resolveAlias` is not enough.
51886
+ * @returns SymbolFlags.All if `symbol` is an alias that ultimately resolves to `unknown`;
51887
+ * combined flags of all alias targets otherwise.
51888
+ */
51889
+ function getAllSymbolFlags(symbol) {
51890
+ var flags = symbol.flags;
51891
+ var seenSymbols;
51892
+ while (symbol.flags & 2097152 /* SymbolFlags.Alias */) {
51893
+ var target = resolveAlias(symbol);
51894
+ if (target === unknownSymbol) {
51895
+ return 67108863 /* SymbolFlags.All */;
51896
+ }
51897
+ // Optimizations - try to avoid creating or adding to
51898
+ // `seenSymbols` if possible
51899
+ if (target === symbol || (seenSymbols === null || seenSymbols === void 0 ? void 0 : seenSymbols.has(target))) {
51900
+ break;
51901
+ }
51902
+ if (target.flags & 2097152 /* SymbolFlags.Alias */) {
51903
+ if (seenSymbols) {
51904
+ seenSymbols.add(target);
51905
+ }
51906
+ else {
51907
+ seenSymbols = new ts.Set([symbol, target]);
51908
+ }
51909
+ }
51910
+ flags |= target.flags;
51911
+ symbol = target;
51912
+ }
51913
+ return flags;
51914
+ }
51862
51915
  /**
51863
51916
  * Marks a symbol as type-only if its declaration is syntactically type-only.
51864
51917
  * If it is not itself marked type-only, but resolves to a type-only alias
@@ -51904,19 +51957,25 @@ var ts;
51904
51957
  return !!aliasDeclarationLinks.typeOnlyDeclaration;
51905
51958
  }
51906
51959
  /** Indicates that a symbol directly or indirectly resolves to a type-only import or export. */
51907
- function getTypeOnlyAliasDeclaration(symbol) {
51960
+ function getTypeOnlyAliasDeclaration(symbol, include) {
51908
51961
  if (!(symbol.flags & 2097152 /* SymbolFlags.Alias */)) {
51909
51962
  return undefined;
51910
51963
  }
51911
51964
  var links = getSymbolLinks(symbol);
51912
- return links.typeOnlyDeclaration || undefined;
51965
+ if (include === undefined) {
51966
+ return links.typeOnlyDeclaration || undefined;
51967
+ }
51968
+ if (links.typeOnlyDeclaration) {
51969
+ return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : undefined;
51970
+ }
51971
+ return undefined;
51913
51972
  }
51914
51973
  function markExportAsReferenced(node) {
51915
51974
  var symbol = getSymbolOfNode(node);
51916
51975
  var target = resolveAlias(symbol);
51917
51976
  if (target) {
51918
51977
  var markAlias = target === unknownSymbol ||
51919
- ((target.flags & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol));
51978
+ ((getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */));
51920
51979
  if (markAlias) {
51921
51980
  markAliasSymbolAsReferenced(symbol);
51922
51981
  }
@@ -51936,8 +51995,7 @@ var ts;
51936
51995
  // This way a chain of imports can be elided if ultimately the final input is only used in a type
51937
51996
  // position.
51938
51997
  if (ts.isInternalModuleImportEqualsDeclaration(node)) {
51939
- var target = resolveSymbol(symbol);
51940
- if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) {
51998
+ if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551 /* SymbolFlags.Value */) {
51941
51999
  // import foo = <symbol>
51942
52000
  checkExpressionCached(node.moduleReference);
51943
52001
  }
@@ -52759,7 +52817,7 @@ var ts;
52759
52817
  }
52760
52818
  function symbolIsValue(symbol, includeTypeOnlyMembers) {
52761
52819
  return !!(symbol.flags & 111551 /* SymbolFlags.Value */ ||
52762
- symbol.flags & 2097152 /* SymbolFlags.Alias */ && resolveAlias(symbol).flags & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol)));
52820
+ symbol.flags & 2097152 /* SymbolFlags.Alias */ && getAllSymbolFlags(symbol) & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol)));
52763
52821
  }
52764
52822
  function findConstructorDeclaration(node) {
52765
52823
  var members = node.members;
@@ -53028,8 +53086,10 @@ var ts;
53028
53086
  return true;
53029
53087
  }
53030
53088
  // Qualify if the symbol from symbol table has same meaning as expected
53031
- symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
53032
- if (symbolFromSymbolTable.flags & meaning) {
53089
+ var shouldResolveAlias = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */));
53090
+ symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
53091
+ var flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags;
53092
+ if (flags & meaning) {
53033
53093
  qualify = true;
53034
53094
  return true;
53035
53095
  }
@@ -55686,7 +55746,7 @@ var ts;
55686
55746
  return !symbol.exports ? [] : ts.filter(ts.arrayFrom(symbol.exports.values()), isNamespaceMember);
55687
55747
  }
55688
55748
  function isTypeOnlyNamespace(symbol) {
55689
- return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551 /* SymbolFlags.Value */); });
55749
+ return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* SymbolFlags.Value */); });
55690
55750
  }
55691
55751
  function serializeModule(symbol, symbolName, modifierFlags) {
55692
55752
  var members = getNamespaceMembersForSerialization(symbol);
@@ -57906,7 +57966,7 @@ var ts;
57906
57966
  links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol)
57907
57967
  : isDuplicatedCommonJSExport(symbol.declarations) ? autoType
57908
57968
  : declaredType ? declaredType
57909
- : targetSymbol.flags & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol)
57969
+ : getAllSymbolFlags(targetSymbol) & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol)
57910
57970
  : errorType;
57911
57971
  }
57912
57972
  return links.type;
@@ -60259,7 +60319,7 @@ var ts;
60259
60319
  var indexTypes;
60260
60320
  var isUnion = containingType.flags & 1048576 /* TypeFlags.Union */;
60261
60321
  // Flags we want to propagate to the result if they exist in all source symbols
60262
- var optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */;
60322
+ var optionalFlag;
60263
60323
  var syntheticFlag = 4 /* CheckFlags.SyntheticMethod */;
60264
60324
  var checkFlags = isUnion ? 0 : 8 /* CheckFlags.Readonly */;
60265
60325
  var mergedInstantiations = false;
@@ -60270,11 +60330,14 @@ var ts;
60270
60330
  var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment);
60271
60331
  var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0;
60272
60332
  if (prop) {
60273
- if (isUnion) {
60274
- optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */);
60275
- }
60276
- else {
60277
- optionalFlag &= prop.flags;
60333
+ if (prop.flags & 106500 /* SymbolFlags.ClassMember */) {
60334
+ optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : (optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */);
60335
+ if (isUnion) {
60336
+ optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */);
60337
+ }
60338
+ else {
60339
+ optionalFlag &= prop.flags;
60340
+ }
60278
60341
  }
60279
60342
  if (!singleProp) {
60280
60343
  singleProp = prop;
@@ -60393,7 +60456,7 @@ var ts;
60393
60456
  propTypes.push(type);
60394
60457
  }
60395
60458
  ts.addRange(propTypes, indexTypes);
60396
- var result = createSymbol(4 /* SymbolFlags.Property */ | optionalFlag, name, syntheticFlag | checkFlags);
60459
+ var result = createSymbol(4 /* SymbolFlags.Property */ | (optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : 0), name, syntheticFlag | checkFlags);
60397
60460
  result.containingType = containingType;
60398
60461
  if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
60399
60462
  result.valueDeclaration = firstValueDeclaration;
@@ -67660,7 +67723,7 @@ var ts;
67660
67723
  return 0 /* Ternary.False */;
67661
67724
  }
67662
67725
  // When checking for comparability, be more lenient with optional properties.
67663
- if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) {
67726
+ if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && targetProp.flags & 106500 /* SymbolFlags.ClassMember */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) {
67664
67727
  // TypeScript 1.0 spec (April 2014): 3.8.3
67665
67728
  // S is a subtype of a type T, and T is a supertype of S if ...
67666
67729
  // S' and T are object types and, for each member M in T..
@@ -72932,9 +72995,9 @@ var ts;
72932
72995
  });
72933
72996
  }
72934
72997
  function markAliasReferenced(symbol, location) {
72935
- if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) {
72998
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
72936
72999
  var target = resolveAlias(symbol);
72937
- if (target.flags & 111551 /* SymbolFlags.Value */) {
73000
+ if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
72938
73001
  // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled
72939
73002
  // (because the const enum value will not be inlined), or if (2) the alias is an export
72940
73003
  // of a const enum declaration that will be preserved.
@@ -78826,7 +78889,7 @@ var ts;
78826
78889
  if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) {
78827
78890
  symbol = resolveAlias(symbol);
78828
78891
  }
78829
- return !!(symbol && (symbol.flags & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */);
78892
+ return !!(symbol && (getAllSymbolFlags(symbol) & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */);
78830
78893
  }
78831
78894
  return false;
78832
78895
  }
@@ -85001,7 +85064,16 @@ var ts;
85001
85064
  var message = allowAsyncIterables
85002
85065
  ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator
85003
85066
  : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator;
85004
- return errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type));
85067
+ var suggestAwait =
85068
+ // for (const x of Promise<...>) or [...Promise<...>]
85069
+ !!getAwaitedTypeOfPromise(type)
85070
+ // for (const x of AsyncIterable<...>)
85071
+ || (!allowAsyncIterables &&
85072
+ ts.isForOfStatement(errorNode.parent) &&
85073
+ errorNode.parent.expression === errorNode &&
85074
+ getGlobalAsyncIterableType(/** reportErrors */ false) !== emptyGenericType &&
85075
+ isTypeAssignableTo(type, getGlobalAsyncIterableType(/** reportErrors */ false)));
85076
+ return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
85005
85077
  }
85006
85078
  /**
85007
85079
  * Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type.
@@ -86852,10 +86924,11 @@ var ts;
86852
86924
  }
86853
86925
  return;
86854
86926
  }
86927
+ var targetFlags = getAllSymbolFlags(target);
86855
86928
  var excludedMeanings = (symbol.flags & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */) ? 111551 /* SymbolFlags.Value */ : 0) |
86856
86929
  (symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) |
86857
86930
  (symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0);
86858
- if (target.flags & excludedMeanings) {
86931
+ if (targetFlags & excludedMeanings) {
86859
86932
  var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ?
86860
86933
  ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
86861
86934
  ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
@@ -86865,7 +86938,7 @@ var ts;
86865
86938
  && !ts.isTypeOnlyImportOrExportDeclaration(node)
86866
86939
  && !(node.flags & 16777216 /* NodeFlags.Ambient */)) {
86867
86940
  var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
86868
- var isType = !(target.flags & 111551 /* SymbolFlags.Value */);
86941
+ var isType = !(targetFlags & 111551 /* SymbolFlags.Value */);
86869
86942
  if (isType || typeOnlyAlias) {
86870
86943
  switch (node.kind) {
86871
86944
  case 270 /* SyntaxKind.ImportClause */:
@@ -87025,14 +87098,15 @@ var ts;
87025
87098
  if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) {
87026
87099
  var target = resolveAlias(getSymbolOfNode(node));
87027
87100
  if (target !== unknownSymbol) {
87028
- if (target.flags & 111551 /* SymbolFlags.Value */) {
87101
+ var targetFlags = getAllSymbolFlags(target);
87102
+ if (targetFlags & 111551 /* SymbolFlags.Value */) {
87029
87103
  // Target is a value symbol, check that it is not hidden by a local declaration with the same name
87030
87104
  var moduleName = ts.getFirstIdentifier(node.moduleReference);
87031
87105
  if (!(resolveEntityName(moduleName, 111551 /* SymbolFlags.Value */ | 1920 /* SymbolFlags.Namespace */).flags & 1920 /* SymbolFlags.Namespace */)) {
87032
87106
  error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName));
87033
87107
  }
87034
87108
  }
87035
- if (target.flags & 788968 /* SymbolFlags.Type */) {
87109
+ if (targetFlags & 788968 /* SymbolFlags.Type */) {
87036
87110
  checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0);
87037
87111
  }
87038
87112
  }
@@ -87171,7 +87245,7 @@ var ts;
87171
87245
  markExportAsReferenced(node);
87172
87246
  }
87173
87247
  var target = symbol && (symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol);
87174
- if (!target || target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) {
87248
+ if (!target || getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
87175
87249
  checkExpressionCached(node.propertyName || node.name);
87176
87250
  }
87177
87251
  }
@@ -87218,7 +87292,7 @@ var ts;
87218
87292
  markAliasReferenced(sym, id);
87219
87293
  // If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`)
87220
87294
  var target = sym.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(sym) : sym;
87221
- if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) {
87295
+ if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) {
87222
87296
  // However if it is a value, we need to check it's being used correctly
87223
87297
  checkExpressionCached(node.expression);
87224
87298
  }
@@ -88540,7 +88614,7 @@ var ts;
88540
88614
  return symbolLinks.exportsSomeValue;
88541
88615
  function isValue(s) {
88542
88616
  s = resolveSymbol(s);
88543
- return s && !!(s.flags & 111551 /* SymbolFlags.Value */);
88617
+ return s && !!(getAllSymbolFlags(s) & 111551 /* SymbolFlags.Value */);
88544
88618
  }
88545
88619
  }
88546
88620
  function isNameOfModuleOrEnumDeclaration(node) {
@@ -88593,7 +88667,7 @@ var ts;
88593
88667
  var symbol = getReferencedValueOrAliasSymbol(node);
88594
88668
  // We should only get the declaration of an alias if there isn't a local value
88595
88669
  // declaration for the symbol
88596
- if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) {
88670
+ if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) {
88597
88671
  return getDeclarationOfAliasSymbol(symbol);
88598
88672
  }
88599
88673
  }
@@ -88681,7 +88755,7 @@ var ts;
88681
88755
  case 273 /* SyntaxKind.ImportSpecifier */:
88682
88756
  case 278 /* SyntaxKind.ExportSpecifier */:
88683
88757
  var symbol = getSymbolOfNode(node);
88684
- return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol);
88758
+ return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */);
88685
88759
  case 275 /* SyntaxKind.ExportDeclaration */:
88686
88760
  var exportClause = node.exportClause;
88687
88761
  return !!exportClause && (ts.isNamespaceExport(exportClause) ||
@@ -88703,6 +88777,7 @@ var ts;
88703
88777
  return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference);
88704
88778
  }
88705
88779
  function isAliasResolvedToValue(symbol) {
88780
+ var _a;
88706
88781
  if (!symbol) {
88707
88782
  return false;
88708
88783
  }
@@ -88712,7 +88787,7 @@ var ts;
88712
88787
  }
88713
88788
  // const enums and modules that contain only const enums are not considered values from the emit perspective
88714
88789
  // unless 'preserveConstEnums' option is set to true
88715
- return !!(target.flags & 111551 /* SymbolFlags.Value */) &&
88790
+ return !!(((_a = getAllSymbolFlags(target)) !== null && _a !== void 0 ? _a : -1) & 111551 /* SymbolFlags.Value */) &&
88716
88791
  (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target));
88717
88792
  }
88718
88793
  function isConstEnumOrConstEnumOnlyModule(s) {
@@ -88727,7 +88802,7 @@ var ts;
88727
88802
  }
88728
88803
  var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217
88729
88804
  if (target && ts.getEffectiveModifierFlags(node) & 1 /* ModifierFlags.Export */ &&
88730
- target.flags & 111551 /* SymbolFlags.Value */ &&
88805
+ getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */ &&
88731
88806
  (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
88732
88807
  // An `export import ... =` of a value symbol is always considered referenced
88733
88808
  return true;
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.20220929",
5
+ "version": "4.9.0-dev.20220930",
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.3",
92
+ "typescript": "^4.8.4",
93
93
  "vinyl": "latest",
94
94
  "which": "^2.0.2",
95
95
  "xml2js": "^0.4.23"