typescript 5.3.1-rc → 5.3.3

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/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.3";
21
- var version = "5.3.1-rc";
21
+ var version = "5.3.3";
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -3678,7 +3678,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
3678
3678
  TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
3679
3679
  TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
3680
3680
  TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
3681
- TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
3681
+ TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
3682
3682
  TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
3683
3683
  TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
3684
3684
  TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
@@ -10961,7 +10961,7 @@ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
10961
10961
  return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */ || kind === 205 /* ImportType */;
10962
10962
  }
10963
10963
  function isCallLikeOrFunctionLikeExpression(node) {
10964
- return isCallLikeExpression(node) || isFunctionLike(node);
10964
+ return isCallLikeExpression(node) || isFunctionExpressionOrArrowFunction(node);
10965
10965
  }
10966
10966
  function isCallLikeExpression(node) {
10967
10967
  switch (node.kind) {
@@ -15971,7 +15971,7 @@ function getClassLikeDeclarationOfSymbol(symbol) {
15971
15971
  return (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike);
15972
15972
  }
15973
15973
  function getObjectFlags(type) {
15974
- return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0;
15974
+ return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
15975
15975
  }
15976
15976
  function isUMDExportSymbol(symbol) {
15977
15977
  return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
@@ -18823,10 +18823,8 @@ function createNodeFactory(flags, baseFactory2) {
18823
18823
  return update(updated, original);
18824
18824
  }
18825
18825
  function createNumericLiteral(value, numericLiteralFlags = 0 /* None */) {
18826
- const text = typeof value === "number" ? value + "" : value;
18827
- Debug.assert(text.charCodeAt(0) !== 45 /* minus */, "Negative numbers should be created in combination with createPrefixUnaryExpression");
18828
18826
  const node = createBaseDeclaration(9 /* NumericLiteral */);
18829
- node.text = text;
18827
+ node.text = typeof value === "number" ? value + "" : value;
18830
18828
  node.numericLiteralFlags = numericLiteralFlags;
18831
18829
  if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */)
18832
18830
  node.transformFlags |= 1024 /* ContainsES2015 */;
@@ -43682,7 +43680,7 @@ function createTypeChecker(host) {
43682
43680
  const nodeLinks2 = getNodeLinks(node);
43683
43681
  cachedResolvedSignatures.push([nodeLinks2, nodeLinks2.resolvedSignature]);
43684
43682
  nodeLinks2.resolvedSignature = void 0;
43685
- if (isFunctionLike(node)) {
43683
+ if (isFunctionExpressionOrArrowFunction(node)) {
43686
43684
  const symbolLinks2 = getSymbolLinks(getSymbolOfDeclaration(node));
43687
43685
  const type = symbolLinks2.type;
43688
43686
  cachedTypes2.push([symbolLinks2, type]);
@@ -48243,6 +48241,8 @@ function createTypeChecker(host) {
48243
48241
  context.symbolDepth.set(id, depth + 1);
48244
48242
  }
48245
48243
  context.visitedTypes.add(typeId);
48244
+ const prevTrackedSymbols = context.trackedSymbols;
48245
+ context.trackedSymbols = void 0;
48246
48246
  const startLength = context.approximateLength;
48247
48247
  const result = transform(type2);
48248
48248
  const addedLength = context.approximateLength - startLength;
@@ -48258,6 +48258,7 @@ function createTypeChecker(host) {
48258
48258
  if (id) {
48259
48259
  context.symbolDepth.set(id, depth);
48260
48260
  }
48261
+ context.trackedSymbols = prevTrackedSymbols;
48261
48262
  return result;
48262
48263
  function deepCloneOrReuseNode(node) {
48263
48264
  if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) {
@@ -48560,7 +48561,7 @@ function createTypeChecker(host) {
48560
48561
  context.approximateLength += symbolName(propertySymbol).length + 1;
48561
48562
  if (propertySymbol.flags & 98304 /* Accessor */) {
48562
48563
  const writeType = getWriteTypeOfSymbol(propertySymbol);
48563
- if (propertyType !== writeType) {
48564
+ if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
48564
48565
  const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
48565
48566
  const getterSignature = getSignatureFromDeclaration(getterDeclaration);
48566
48567
  typeElements.push(
@@ -49483,7 +49484,7 @@ function createTypeChecker(host) {
49483
49484
  return factory.createStringLiteral(name, !!singleQuote);
49484
49485
  }
49485
49486
  if (isNumericLiteralName(name) && startsWith(name, "-")) {
49486
- return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(+name))));
49487
+ return factory.createComputedPropertyName(factory.createNumericLiteral(+name));
49487
49488
  }
49488
49489
  return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
49489
49490
  }
@@ -56943,7 +56944,7 @@ function createTypeChecker(host) {
56943
56944
  }
56944
56945
  }
56945
56946
  function removeStringLiteralsMatchedByTemplateLiterals(types) {
56946
- const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types)));
56947
+ const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
56947
56948
  if (templates.length) {
56948
56949
  let i = types.length;
56949
56950
  while (i > 0) {
@@ -57343,19 +57344,14 @@ function createTypeChecker(host) {
57343
57344
  function getConstituentCountOfTypes(types) {
57344
57345
  return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
57345
57346
  }
57346
- function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
57347
- if (types.length !== 2) {
57348
- return false;
57349
- }
57350
- const [t1, t2] = types;
57351
- return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
57352
- }
57353
57347
  function getTypeFromIntersectionTypeNode(node) {
57354
57348
  const links = getNodeLinks(node);
57355
57349
  if (!links.resolvedType) {
57356
57350
  const aliasSymbol = getAliasSymbolForTypeNode(node);
57357
57351
  const types = map(node.types, getTypeFromTypeNode);
57358
- const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
57352
+ const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
57353
+ const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
57354
+ const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
57359
57355
  links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
57360
57356
  }
57361
57357
  return links.resolvedType;
@@ -57567,11 +57563,6 @@ function createTypeChecker(host) {
57567
57563
  }
57568
57564
  function createTemplateLiteralType(texts, types) {
57569
57565
  const type = createType(134217728 /* TemplateLiteral */);
57570
- type.objectFlags = getPropagatingFlagsOfTypes(
57571
- types,
57572
- /*excludeKinds*/
57573
- 98304 /* Nullable */
57574
- );
57575
57566
  type.texts = texts;
57576
57567
  type.types = types;
57577
57568
  return type;
@@ -57866,7 +57857,15 @@ function createTypeChecker(host) {
57866
57857
  }
57867
57858
  function isPatternLiteralPlaceholderType(type) {
57868
57859
  if (type.flags & 2097152 /* Intersection */) {
57869
- return !isGenericType(type) && some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 98304 /* Nullable */)) || isPatternLiteralPlaceholderType(t));
57860
+ let seenPlaceholder = false;
57861
+ for (const t of type.types) {
57862
+ if (t.flags & (2944 /* Literal */ | 98304 /* Nullable */) || isPatternLiteralPlaceholderType(t)) {
57863
+ seenPlaceholder = true;
57864
+ } else if (!(t.flags & 524288 /* Object */)) {
57865
+ return false;
57866
+ }
57867
+ }
57868
+ return seenPlaceholder;
57870
57869
  }
57871
57870
  return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
57872
57871
  }
@@ -57883,7 +57882,7 @@ function createTypeChecker(host) {
57883
57882
  return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
57884
57883
  }
57885
57884
  function getGenericObjectFlags(type) {
57886
- if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
57885
+ if (type.flags & 3145728 /* UnionOrIntersection */) {
57887
57886
  if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
57888
57887
  type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
57889
57888
  }
@@ -57895,7 +57894,7 @@ function createTypeChecker(host) {
57895
57894
  }
57896
57895
  return type.objectFlags & 12582912 /* IsGenericType */;
57897
57896
  }
57898
- return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
57897
+ return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
57899
57898
  }
57900
57899
  function getSimplifiedType(type, writing) {
57901
57900
  return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -58921,7 +58920,7 @@ function createTypeChecker(host) {
58921
58920
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
58922
58921
  target.instantiations.set(id, result);
58923
58922
  const resultObjectFlags = getObjectFlags(result);
58924
- if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58923
+ if (result.flags & 3899393 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58925
58924
  const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
58926
58925
  if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
58927
58926
  if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
@@ -63635,8 +63634,8 @@ function createTypeChecker(host) {
63635
63634
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
63636
63635
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
63637
63636
  }
63638
- const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
63639
- if (type.flags & 138117121 /* ObjectFlagsType */) {
63637
+ const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
63638
+ if (type.flags & 3899393 /* ObjectFlagsType */) {
63640
63639
  type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
63641
63640
  }
63642
63641
  return result;
@@ -66154,10 +66153,10 @@ function createTypeChecker(host) {
66154
66153
  if (isMatchingConstructorReference(right)) {
66155
66154
  return narrowTypeByConstructor(type, operator, left, assumeTrue);
66156
66155
  }
66157
- if (isBooleanLiteral(right)) {
66156
+ if (isBooleanLiteral(right) && !isAccessExpression(left)) {
66158
66157
  return narrowTypeByBooleanComparison(type, left, right, operator, assumeTrue);
66159
66158
  }
66160
- if (isBooleanLiteral(left)) {
66159
+ if (isBooleanLiteral(left) && !isAccessExpression(right)) {
66161
66160
  return narrowTypeByBooleanComparison(type, right, left, operator, assumeTrue);
66162
66161
  }
66163
66162
  break;
@@ -75350,14 +75349,9 @@ function createTypeChecker(host) {
75350
75349
  case 15 /* NoSubstitutionTemplateLiteral */:
75351
75350
  case 11 /* StringLiteral */:
75352
75351
  return hasSkipDirectInferenceFlag(node) ? blockedStringType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
75353
- case 9 /* NumericLiteral */: {
75352
+ case 9 /* NumericLiteral */:
75354
75353
  checkGrammarNumericLiteral(node);
75355
- const value = +node.text;
75356
- if (!isFinite(value)) {
75357
- return numberType;
75358
- }
75359
- return getFreshTypeOfLiteralType(getNumberLiteralType(value));
75360
- }
75354
+ return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
75361
75355
  case 10 /* BigIntLiteral */:
75362
75356
  checkGrammarBigIntLiteral(node);
75363
75357
  return getFreshTypeOfLiteralType(getBigIntLiteralType({
@@ -82022,7 +82016,7 @@ function createTypeChecker(host) {
82022
82016
  }
82023
82017
  const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol));
82024
82018
  if (target === unknownSymbol) {
82025
- return true;
82019
+ return !excludeTypeOnlyValues || !getTypeOnlyAliasDeclaration(symbol);
82026
82020
  }
82027
82021
  return !!(getSymbolFlags(
82028
82022
  symbol,
@@ -82358,7 +82352,7 @@ function createTypeChecker(host) {
82358
82352
  if (enumResult)
82359
82353
  return enumResult;
82360
82354
  const literalValue = type.value;
82361
- return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "string" ? factory.createStringLiteral(literalValue) : literalValue < 0 ? factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(literalValue))) : factory.createNumericLiteral(literalValue);
82355
+ return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "number" ? factory.createNumericLiteral(literalValue) : factory.createStringLiteral(literalValue);
82362
82356
  }
82363
82357
  function createLiteralConstValue(node, tracker) {
82364
82358
  const type = getTypeOfSymbol(getSymbolOfDeclaration(node));
@@ -88781,7 +88775,7 @@ function transformTypeScript(context) {
88781
88775
  function transformEnumMemberDeclarationValue(member) {
88782
88776
  const value = resolver.getConstantValue(member);
88783
88777
  if (value !== void 0) {
88784
- return typeof value === "string" ? factory2.createStringLiteral(value) : value < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(value))) : factory2.createNumericLiteral(value);
88778
+ return typeof value === "string" ? factory2.createStringLiteral(value) : factory2.createNumericLiteral(value);
88785
88779
  } else {
88786
88780
  enableSubstitutionForNonQualifiedEnumMembers();
88787
88781
  if (member.initializer) {
@@ -102959,7 +102953,7 @@ function transformGenerators(context) {
102959
102953
  if (labelExpressions === void 0) {
102960
102954
  labelExpressions = [];
102961
102955
  }
102962
- const expression = factory2.createNumericLiteral(Number.MAX_SAFE_INTEGER);
102956
+ const expression = factory2.createNumericLiteral(-1);
102963
102957
  if (labelExpressions[label] === void 0) {
102964
102958
  labelExpressions[label] = [expression];
102965
102959
  } else {
@@ -108834,8 +108828,7 @@ function transformDeclarations(context) {
108834
108828
  if (shouldStripInternal(m))
108835
108829
  return;
108836
108830
  const constValue = resolver.getConstantValue(m);
108837
- const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(constValue))) : factory2.createNumericLiteral(constValue);
108838
- return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m);
108831
+ return preserveJsDoc(factory2.updateEnumMember(m, m.name, constValue !== void 0 ? typeof constValue === "string" ? factory2.createStringLiteral(constValue) : factory2.createNumericLiteral(constValue) : void 0), m);
108839
108832
  }))
108840
108833
  ));
108841
108834
  }
package/lib/tsserver.js CHANGED
@@ -2328,7 +2328,7 @@ module.exports = __toCommonJS(server_exports);
2328
2328
 
2329
2329
  // src/compiler/corePublic.ts
2330
2330
  var versionMajorMinor = "5.3";
2331
- var version = "5.3.1-rc";
2331
+ var version = "5.3.3";
2332
2332
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2333
2333
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2334
2334
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6670,7 +6670,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
6670
6670
  TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
6671
6671
  TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
6672
6672
  TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
6673
- TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
6673
+ TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
6674
6674
  TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
6675
6675
  TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
6676
6676
  TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
@@ -14639,7 +14639,7 @@ function isPropertyAccessOrQualifiedName(node) {
14639
14639
  return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */;
14640
14640
  }
14641
14641
  function isCallLikeOrFunctionLikeExpression(node) {
14642
- return isCallLikeExpression(node) || isFunctionLike(node);
14642
+ return isCallLikeExpression(node) || isFunctionExpressionOrArrowFunction(node);
14643
14643
  }
14644
14644
  function isCallLikeExpression(node) {
14645
14645
  switch (node.kind) {
@@ -20036,7 +20036,7 @@ function getClassLikeDeclarationOfSymbol(symbol) {
20036
20036
  return (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike);
20037
20037
  }
20038
20038
  function getObjectFlags(type) {
20039
- return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0;
20039
+ return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
20040
20040
  }
20041
20041
  function forSomeAncestorDirectory(directory, callback) {
20042
20042
  return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
@@ -23031,10 +23031,8 @@ function createNodeFactory(flags, baseFactory2) {
23031
23031
  return update(updated, original);
23032
23032
  }
23033
23033
  function createNumericLiteral(value, numericLiteralFlags = 0 /* None */) {
23034
- const text = typeof value === "number" ? value + "" : value;
23035
- Debug.assert(text.charCodeAt(0) !== 45 /* minus */, "Negative numbers should be created in combination with createPrefixUnaryExpression");
23036
23034
  const node = createBaseDeclaration(9 /* NumericLiteral */);
23037
- node.text = text;
23035
+ node.text = typeof value === "number" ? value + "" : value;
23038
23036
  node.numericLiteralFlags = numericLiteralFlags;
23039
23037
  if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */)
23040
23038
  node.transformFlags |= 1024 /* ContainsES2015 */;
@@ -48386,7 +48384,7 @@ function createTypeChecker(host) {
48386
48384
  const nodeLinks2 = getNodeLinks(node);
48387
48385
  cachedResolvedSignatures.push([nodeLinks2, nodeLinks2.resolvedSignature]);
48388
48386
  nodeLinks2.resolvedSignature = void 0;
48389
- if (isFunctionLike(node)) {
48387
+ if (isFunctionExpressionOrArrowFunction(node)) {
48390
48388
  const symbolLinks2 = getSymbolLinks(getSymbolOfDeclaration(node));
48391
48389
  const type = symbolLinks2.type;
48392
48390
  cachedTypes2.push([symbolLinks2, type]);
@@ -52947,6 +52945,8 @@ function createTypeChecker(host) {
52947
52945
  context.symbolDepth.set(id, depth + 1);
52948
52946
  }
52949
52947
  context.visitedTypes.add(typeId);
52948
+ const prevTrackedSymbols = context.trackedSymbols;
52949
+ context.trackedSymbols = void 0;
52950
52950
  const startLength = context.approximateLength;
52951
52951
  const result = transform2(type2);
52952
52952
  const addedLength = context.approximateLength - startLength;
@@ -52962,6 +52962,7 @@ function createTypeChecker(host) {
52962
52962
  if (id) {
52963
52963
  context.symbolDepth.set(id, depth);
52964
52964
  }
52965
+ context.trackedSymbols = prevTrackedSymbols;
52965
52966
  return result;
52966
52967
  function deepCloneOrReuseNode(node) {
52967
52968
  if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) {
@@ -53264,7 +53265,7 @@ function createTypeChecker(host) {
53264
53265
  context.approximateLength += symbolName(propertySymbol).length + 1;
53265
53266
  if (propertySymbol.flags & 98304 /* Accessor */) {
53266
53267
  const writeType = getWriteTypeOfSymbol(propertySymbol);
53267
- if (propertyType !== writeType) {
53268
+ if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
53268
53269
  const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
53269
53270
  const getterSignature = getSignatureFromDeclaration(getterDeclaration);
53270
53271
  typeElements.push(
@@ -54187,7 +54188,7 @@ function createTypeChecker(host) {
54187
54188
  return factory.createStringLiteral(name, !!singleQuote);
54188
54189
  }
54189
54190
  if (isNumericLiteralName(name) && startsWith(name, "-")) {
54190
- return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(+name))));
54191
+ return factory.createComputedPropertyName(factory.createNumericLiteral(+name));
54191
54192
  }
54192
54193
  return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
54193
54194
  }
@@ -61647,7 +61648,7 @@ function createTypeChecker(host) {
61647
61648
  }
61648
61649
  }
61649
61650
  function removeStringLiteralsMatchedByTemplateLiterals(types) {
61650
- const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types)));
61651
+ const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
61651
61652
  if (templates.length) {
61652
61653
  let i = types.length;
61653
61654
  while (i > 0) {
@@ -62047,19 +62048,14 @@ function createTypeChecker(host) {
62047
62048
  function getConstituentCountOfTypes(types) {
62048
62049
  return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
62049
62050
  }
62050
- function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
62051
- if (types.length !== 2) {
62052
- return false;
62053
- }
62054
- const [t1, t2] = types;
62055
- return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
62056
- }
62057
62051
  function getTypeFromIntersectionTypeNode(node) {
62058
62052
  const links = getNodeLinks(node);
62059
62053
  if (!links.resolvedType) {
62060
62054
  const aliasSymbol = getAliasSymbolForTypeNode(node);
62061
62055
  const types = map(node.types, getTypeFromTypeNode);
62062
- const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
62056
+ const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
62057
+ const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
62058
+ const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
62063
62059
  links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
62064
62060
  }
62065
62061
  return links.resolvedType;
@@ -62271,11 +62267,6 @@ function createTypeChecker(host) {
62271
62267
  }
62272
62268
  function createTemplateLiteralType(texts, types) {
62273
62269
  const type = createType(134217728 /* TemplateLiteral */);
62274
- type.objectFlags = getPropagatingFlagsOfTypes(
62275
- types,
62276
- /*excludeKinds*/
62277
- 98304 /* Nullable */
62278
- );
62279
62270
  type.texts = texts;
62280
62271
  type.types = types;
62281
62272
  return type;
@@ -62570,7 +62561,15 @@ function createTypeChecker(host) {
62570
62561
  }
62571
62562
  function isPatternLiteralPlaceholderType(type) {
62572
62563
  if (type.flags & 2097152 /* Intersection */) {
62573
- return !isGenericType(type) && some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 98304 /* Nullable */)) || isPatternLiteralPlaceholderType(t));
62564
+ let seenPlaceholder = false;
62565
+ for (const t of type.types) {
62566
+ if (t.flags & (2944 /* Literal */ | 98304 /* Nullable */) || isPatternLiteralPlaceholderType(t)) {
62567
+ seenPlaceholder = true;
62568
+ } else if (!(t.flags & 524288 /* Object */)) {
62569
+ return false;
62570
+ }
62571
+ }
62572
+ return seenPlaceholder;
62574
62573
  }
62575
62574
  return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
62576
62575
  }
@@ -62587,7 +62586,7 @@ function createTypeChecker(host) {
62587
62586
  return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
62588
62587
  }
62589
62588
  function getGenericObjectFlags(type) {
62590
- if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
62589
+ if (type.flags & 3145728 /* UnionOrIntersection */) {
62591
62590
  if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
62592
62591
  type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
62593
62592
  }
@@ -62599,7 +62598,7 @@ function createTypeChecker(host) {
62599
62598
  }
62600
62599
  return type.objectFlags & 12582912 /* IsGenericType */;
62601
62600
  }
62602
- return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
62601
+ return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
62603
62602
  }
62604
62603
  function getSimplifiedType(type, writing) {
62605
62604
  return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -63625,7 +63624,7 @@ function createTypeChecker(host) {
63625
63624
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
63626
63625
  target.instantiations.set(id, result);
63627
63626
  const resultObjectFlags = getObjectFlags(result);
63628
- if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
63627
+ if (result.flags & 3899393 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
63629
63628
  const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
63630
63629
  if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
63631
63630
  if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
@@ -68339,8 +68338,8 @@ function createTypeChecker(host) {
68339
68338
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
68340
68339
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
68341
68340
  }
68342
- const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
68343
- if (type.flags & 138117121 /* ObjectFlagsType */) {
68341
+ const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
68342
+ if (type.flags & 3899393 /* ObjectFlagsType */) {
68344
68343
  type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
68345
68344
  }
68346
68345
  return result;
@@ -70858,10 +70857,10 @@ function createTypeChecker(host) {
70858
70857
  if (isMatchingConstructorReference(right)) {
70859
70858
  return narrowTypeByConstructor(type, operator, left, assumeTrue);
70860
70859
  }
70861
- if (isBooleanLiteral(right)) {
70860
+ if (isBooleanLiteral(right) && !isAccessExpression(left)) {
70862
70861
  return narrowTypeByBooleanComparison(type, left, right, operator, assumeTrue);
70863
70862
  }
70864
- if (isBooleanLiteral(left)) {
70863
+ if (isBooleanLiteral(left) && !isAccessExpression(right)) {
70865
70864
  return narrowTypeByBooleanComparison(type, right, left, operator, assumeTrue);
70866
70865
  }
70867
70866
  break;
@@ -80054,14 +80053,9 @@ function createTypeChecker(host) {
80054
80053
  case 15 /* NoSubstitutionTemplateLiteral */:
80055
80054
  case 11 /* StringLiteral */:
80056
80055
  return hasSkipDirectInferenceFlag(node) ? blockedStringType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
80057
- case 9 /* NumericLiteral */: {
80056
+ case 9 /* NumericLiteral */:
80058
80057
  checkGrammarNumericLiteral(node);
80059
- const value = +node.text;
80060
- if (!isFinite(value)) {
80061
- return numberType;
80062
- }
80063
- return getFreshTypeOfLiteralType(getNumberLiteralType(value));
80064
- }
80058
+ return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
80065
80059
  case 10 /* BigIntLiteral */:
80066
80060
  checkGrammarBigIntLiteral(node);
80067
80061
  return getFreshTypeOfLiteralType(getBigIntLiteralType({
@@ -86726,7 +86720,7 @@ function createTypeChecker(host) {
86726
86720
  }
86727
86721
  const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol));
86728
86722
  if (target === unknownSymbol) {
86729
- return true;
86723
+ return !excludeTypeOnlyValues || !getTypeOnlyAliasDeclaration(symbol);
86730
86724
  }
86731
86725
  return !!(getSymbolFlags(
86732
86726
  symbol,
@@ -87062,7 +87056,7 @@ function createTypeChecker(host) {
87062
87056
  if (enumResult)
87063
87057
  return enumResult;
87064
87058
  const literalValue = type.value;
87065
- return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "string" ? factory.createStringLiteral(literalValue) : literalValue < 0 ? factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(literalValue))) : factory.createNumericLiteral(literalValue);
87059
+ return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "number" ? factory.createNumericLiteral(literalValue) : factory.createStringLiteral(literalValue);
87066
87060
  }
87067
87061
  function createLiteralConstValue(node, tracker) {
87068
87062
  const type = getTypeOfSymbol(getSymbolOfDeclaration(node));
@@ -93656,7 +93650,7 @@ function transformTypeScript(context) {
93656
93650
  function transformEnumMemberDeclarationValue(member) {
93657
93651
  const value = resolver.getConstantValue(member);
93658
93652
  if (value !== void 0) {
93659
- return typeof value === "string" ? factory2.createStringLiteral(value) : value < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(value))) : factory2.createNumericLiteral(value);
93653
+ return typeof value === "string" ? factory2.createStringLiteral(value) : factory2.createNumericLiteral(value);
93660
93654
  } else {
93661
93655
  enableSubstitutionForNonQualifiedEnumMembers();
93662
93656
  if (member.initializer) {
@@ -107834,7 +107828,7 @@ function transformGenerators(context) {
107834
107828
  if (labelExpressions === void 0) {
107835
107829
  labelExpressions = [];
107836
107830
  }
107837
- const expression = factory2.createNumericLiteral(Number.MAX_SAFE_INTEGER);
107831
+ const expression = factory2.createNumericLiteral(-1);
107838
107832
  if (labelExpressions[label] === void 0) {
107839
107833
  labelExpressions[label] = [expression];
107840
107834
  } else {
@@ -113709,8 +113703,7 @@ function transformDeclarations(context) {
113709
113703
  if (shouldStripInternal(m))
113710
113704
  return;
113711
113705
  const constValue = resolver.getConstantValue(m);
113712
- const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(constValue))) : factory2.createNumericLiteral(constValue);
113713
- return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m);
113706
+ return preserveJsDoc(factory2.updateEnumMember(m, m.name, constValue !== void 0 ? typeof constValue === "string" ? factory2.createStringLiteral(constValue) : factory2.createNumericLiteral(constValue) : void 0), m);
113714
113707
  }))
113715
113708
  ));
113716
113709
  }
@@ -137316,7 +137309,7 @@ function transpileModule(input, transpileOptions) {
137316
137309
  options
137317
137310
  ),
137318
137311
  setExternalModuleIndicator: getSetExternalModuleIndicator(options),
137319
- jsDocParsingMode: 1 /* ParseNone */
137312
+ jsDocParsingMode: transpileOptions.jsDocParsingMode ?? 0 /* ParseAll */
137320
137313
  }
137321
137314
  );
137322
137315
  if (transpileOptions.moduleName) {
@@ -6018,9 +6018,11 @@ declare namespace ts {
6018
6018
  /** @deprecated */
6019
6019
  type AssertionKey = ImportAttributeName;
6020
6020
  /** @deprecated */
6021
- type AssertEntry = ImportAttribute;
6021
+ interface AssertEntry extends ImportAttribute {
6022
+ }
6022
6023
  /** @deprecated */
6023
- type AssertClause = ImportAttributes;
6024
+ interface AssertClause extends ImportAttributes {
6025
+ }
6024
6026
  type ImportAttributeName = Identifier | StringLiteral;
6025
6027
  interface ImportAttribute extends Node {
6026
6028
  readonly kind: SyntaxKind.ImportAttribute;
@@ -10416,7 +10418,7 @@ declare namespace ts {
10416
10418
  installPackage?(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
10417
10419
  writeFile?(fileName: string, content: string): void;
10418
10420
  getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
10419
- jsDocParsingMode?: JSDocParsingMode;
10421
+ jsDocParsingMode?: JSDocParsingMode | undefined;
10420
10422
  }
10421
10423
  type WithMetadata<T> = T & {
10422
10424
  metadata?: unknown;
@@ -11612,6 +11614,7 @@ declare namespace ts {
11612
11614
  moduleName?: string;
11613
11615
  renamedDependencies?: MapLike<string>;
11614
11616
  transformers?: CustomTransformers;
11617
+ jsDocParsingMode?: JSDocParsingMode;
11615
11618
  }
11616
11619
  interface TranspileOutput {
11617
11620
  outputText: string;
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.3";
38
- version = "5.3.1-rc";
38
+ version = "5.3.3";
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -4435,7 +4435,7 @@ ${lanes.join("\n")}
4435
4435
  TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
4436
4436
  TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
4437
4437
  TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
4438
- TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
4438
+ TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
4439
4439
  TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
4440
4440
  TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
4441
4441
  TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
@@ -12428,7 +12428,7 @@ ${lanes.join("\n")}
12428
12428
  return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */;
12429
12429
  }
12430
12430
  function isCallLikeOrFunctionLikeExpression(node) {
12431
- return isCallLikeExpression(node) || isFunctionLike(node);
12431
+ return isCallLikeExpression(node) || isFunctionExpressionOrArrowFunction(node);
12432
12432
  }
12433
12433
  function isCallLikeExpression(node) {
12434
12434
  switch (node.kind) {
@@ -17337,7 +17337,7 @@ ${lanes.join("\n")}
17337
17337
  return (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike);
17338
17338
  }
17339
17339
  function getObjectFlags(type) {
17340
- return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0;
17340
+ return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
17341
17341
  }
17342
17342
  function forSomeAncestorDirectory(directory, callback) {
17343
17343
  return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
@@ -20845,10 +20845,8 @@ ${lanes.join("\n")}
20845
20845
  return update(updated, original);
20846
20846
  }
20847
20847
  function createNumericLiteral(value, numericLiteralFlags = 0 /* None */) {
20848
- const text = typeof value === "number" ? value + "" : value;
20849
- Debug.assert(text.charCodeAt(0) !== 45 /* minus */, "Negative numbers should be created in combination with createPrefixUnaryExpression");
20850
20848
  const node = createBaseDeclaration(9 /* NumericLiteral */);
20851
- node.text = text;
20849
+ node.text = typeof value === "number" ? value + "" : value;
20852
20850
  node.numericLiteralFlags = numericLiteralFlags;
20853
20851
  if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */)
20854
20852
  node.transformFlags |= 1024 /* ContainsES2015 */;
@@ -46153,7 +46151,7 @@ ${lanes.join("\n")}
46153
46151
  const nodeLinks2 = getNodeLinks(node);
46154
46152
  cachedResolvedSignatures.push([nodeLinks2, nodeLinks2.resolvedSignature]);
46155
46153
  nodeLinks2.resolvedSignature = void 0;
46156
- if (isFunctionLike(node)) {
46154
+ if (isFunctionExpressionOrArrowFunction(node)) {
46157
46155
  const symbolLinks2 = getSymbolLinks(getSymbolOfDeclaration(node));
46158
46156
  const type = symbolLinks2.type;
46159
46157
  cachedTypes2.push([symbolLinks2, type]);
@@ -50714,6 +50712,8 @@ ${lanes.join("\n")}
50714
50712
  context.symbolDepth.set(id, depth + 1);
50715
50713
  }
50716
50714
  context.visitedTypes.add(typeId);
50715
+ const prevTrackedSymbols = context.trackedSymbols;
50716
+ context.trackedSymbols = void 0;
50717
50717
  const startLength = context.approximateLength;
50718
50718
  const result = transform2(type2);
50719
50719
  const addedLength = context.approximateLength - startLength;
@@ -50729,6 +50729,7 @@ ${lanes.join("\n")}
50729
50729
  if (id) {
50730
50730
  context.symbolDepth.set(id, depth);
50731
50731
  }
50732
+ context.trackedSymbols = prevTrackedSymbols;
50732
50733
  return result;
50733
50734
  function deepCloneOrReuseNode(node) {
50734
50735
  if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) {
@@ -51031,7 +51032,7 @@ ${lanes.join("\n")}
51031
51032
  context.approximateLength += symbolName(propertySymbol).length + 1;
51032
51033
  if (propertySymbol.flags & 98304 /* Accessor */) {
51033
51034
  const writeType = getWriteTypeOfSymbol(propertySymbol);
51034
- if (propertyType !== writeType) {
51035
+ if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
51035
51036
  const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
51036
51037
  const getterSignature = getSignatureFromDeclaration(getterDeclaration);
51037
51038
  typeElements.push(
@@ -51954,7 +51955,7 @@ ${lanes.join("\n")}
51954
51955
  return factory.createStringLiteral(name, !!singleQuote);
51955
51956
  }
51956
51957
  if (isNumericLiteralName(name) && startsWith(name, "-")) {
51957
- return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(+name))));
51958
+ return factory.createComputedPropertyName(factory.createNumericLiteral(+name));
51958
51959
  }
51959
51960
  return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
51960
51961
  }
@@ -59414,7 +59415,7 @@ ${lanes.join("\n")}
59414
59415
  }
59415
59416
  }
59416
59417
  function removeStringLiteralsMatchedByTemplateLiterals(types) {
59417
- const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types)));
59418
+ const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
59418
59419
  if (templates.length) {
59419
59420
  let i = types.length;
59420
59421
  while (i > 0) {
@@ -59814,19 +59815,14 @@ ${lanes.join("\n")}
59814
59815
  function getConstituentCountOfTypes(types) {
59815
59816
  return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
59816
59817
  }
59817
- function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
59818
- if (types.length !== 2) {
59819
- return false;
59820
- }
59821
- const [t1, t2] = types;
59822
- return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
59823
- }
59824
59818
  function getTypeFromIntersectionTypeNode(node) {
59825
59819
  const links = getNodeLinks(node);
59826
59820
  if (!links.resolvedType) {
59827
59821
  const aliasSymbol = getAliasSymbolForTypeNode(node);
59828
59822
  const types = map(node.types, getTypeFromTypeNode);
59829
- const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
59823
+ const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
59824
+ const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
59825
+ const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
59830
59826
  links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
59831
59827
  }
59832
59828
  return links.resolvedType;
@@ -60038,11 +60034,6 @@ ${lanes.join("\n")}
60038
60034
  }
60039
60035
  function createTemplateLiteralType(texts, types) {
60040
60036
  const type = createType(134217728 /* TemplateLiteral */);
60041
- type.objectFlags = getPropagatingFlagsOfTypes(
60042
- types,
60043
- /*excludeKinds*/
60044
- 98304 /* Nullable */
60045
- );
60046
60037
  type.texts = texts;
60047
60038
  type.types = types;
60048
60039
  return type;
@@ -60337,7 +60328,15 @@ ${lanes.join("\n")}
60337
60328
  }
60338
60329
  function isPatternLiteralPlaceholderType(type) {
60339
60330
  if (type.flags & 2097152 /* Intersection */) {
60340
- return !isGenericType(type) && some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 98304 /* Nullable */)) || isPatternLiteralPlaceholderType(t));
60331
+ let seenPlaceholder = false;
60332
+ for (const t of type.types) {
60333
+ if (t.flags & (2944 /* Literal */ | 98304 /* Nullable */) || isPatternLiteralPlaceholderType(t)) {
60334
+ seenPlaceholder = true;
60335
+ } else if (!(t.flags & 524288 /* Object */)) {
60336
+ return false;
60337
+ }
60338
+ }
60339
+ return seenPlaceholder;
60341
60340
  }
60342
60341
  return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
60343
60342
  }
@@ -60354,7 +60353,7 @@ ${lanes.join("\n")}
60354
60353
  return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
60355
60354
  }
60356
60355
  function getGenericObjectFlags(type) {
60357
- if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
60356
+ if (type.flags & 3145728 /* UnionOrIntersection */) {
60358
60357
  if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
60359
60358
  type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
60360
60359
  }
@@ -60366,7 +60365,7 @@ ${lanes.join("\n")}
60366
60365
  }
60367
60366
  return type.objectFlags & 12582912 /* IsGenericType */;
60368
60367
  }
60369
- return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
60368
+ return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
60370
60369
  }
60371
60370
  function getSimplifiedType(type, writing) {
60372
60371
  return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -61392,7 +61391,7 @@ ${lanes.join("\n")}
61392
61391
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
61393
61392
  target.instantiations.set(id, result);
61394
61393
  const resultObjectFlags = getObjectFlags(result);
61395
- if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
61394
+ if (result.flags & 3899393 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
61396
61395
  const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
61397
61396
  if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
61398
61397
  if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
@@ -66106,8 +66105,8 @@ ${lanes.join("\n")}
66106
66105
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
66107
66106
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
66108
66107
  }
66109
- const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
66110
- if (type.flags & 138117121 /* ObjectFlagsType */) {
66108
+ const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
66109
+ if (type.flags & 3899393 /* ObjectFlagsType */) {
66111
66110
  type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
66112
66111
  }
66113
66112
  return result;
@@ -68625,10 +68624,10 @@ ${lanes.join("\n")}
68625
68624
  if (isMatchingConstructorReference(right)) {
68626
68625
  return narrowTypeByConstructor(type, operator, left, assumeTrue);
68627
68626
  }
68628
- if (isBooleanLiteral(right)) {
68627
+ if (isBooleanLiteral(right) && !isAccessExpression(left)) {
68629
68628
  return narrowTypeByBooleanComparison(type, left, right, operator, assumeTrue);
68630
68629
  }
68631
- if (isBooleanLiteral(left)) {
68630
+ if (isBooleanLiteral(left) && !isAccessExpression(right)) {
68632
68631
  return narrowTypeByBooleanComparison(type, right, left, operator, assumeTrue);
68633
68632
  }
68634
68633
  break;
@@ -77821,14 +77820,9 @@ ${lanes.join("\n")}
77821
77820
  case 15 /* NoSubstitutionTemplateLiteral */:
77822
77821
  case 11 /* StringLiteral */:
77823
77822
  return hasSkipDirectInferenceFlag(node) ? blockedStringType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
77824
- case 9 /* NumericLiteral */: {
77823
+ case 9 /* NumericLiteral */:
77825
77824
  checkGrammarNumericLiteral(node);
77826
- const value = +node.text;
77827
- if (!isFinite(value)) {
77828
- return numberType;
77829
- }
77830
- return getFreshTypeOfLiteralType(getNumberLiteralType(value));
77831
- }
77825
+ return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
77832
77826
  case 10 /* BigIntLiteral */:
77833
77827
  checkGrammarBigIntLiteral(node);
77834
77828
  return getFreshTypeOfLiteralType(getBigIntLiteralType({
@@ -84493,7 +84487,7 @@ ${lanes.join("\n")}
84493
84487
  }
84494
84488
  const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol));
84495
84489
  if (target === unknownSymbol) {
84496
- return true;
84490
+ return !excludeTypeOnlyValues || !getTypeOnlyAliasDeclaration(symbol);
84497
84491
  }
84498
84492
  return !!(getSymbolFlags(
84499
84493
  symbol,
@@ -84829,7 +84823,7 @@ ${lanes.join("\n")}
84829
84823
  if (enumResult)
84830
84824
  return enumResult;
84831
84825
  const literalValue = type.value;
84832
- return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "string" ? factory.createStringLiteral(literalValue) : literalValue < 0 ? factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(literalValue))) : factory.createNumericLiteral(literalValue);
84826
+ return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "number" ? factory.createNumericLiteral(literalValue) : factory.createStringLiteral(literalValue);
84833
84827
  }
84834
84828
  function createLiteralConstValue(node, tracker) {
84835
84829
  const type = getTypeOfSymbol(getSymbolOfDeclaration(node));
@@ -91603,7 +91597,7 @@ ${lanes.join("\n")}
91603
91597
  function transformEnumMemberDeclarationValue(member) {
91604
91598
  const value = resolver.getConstantValue(member);
91605
91599
  if (value !== void 0) {
91606
- return typeof value === "string" ? factory2.createStringLiteral(value) : value < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(value))) : factory2.createNumericLiteral(value);
91600
+ return typeof value === "string" ? factory2.createStringLiteral(value) : factory2.createNumericLiteral(value);
91607
91601
  } else {
91608
91602
  enableSubstitutionForNonQualifiedEnumMembers();
91609
91603
  if (member.initializer) {
@@ -105874,7 +105868,7 @@ ${lanes.join("\n")}
105874
105868
  if (labelExpressions === void 0) {
105875
105869
  labelExpressions = [];
105876
105870
  }
105877
- const expression = factory2.createNumericLiteral(Number.MAX_SAFE_INTEGER);
105871
+ const expression = factory2.createNumericLiteral(-1);
105878
105872
  if (labelExpressions[label] === void 0) {
105879
105873
  labelExpressions[label] = [expression];
105880
105874
  } else {
@@ -111785,8 +111779,7 @@ ${lanes.join("\n")}
111785
111779
  if (shouldStripInternal(m))
111786
111780
  return;
111787
111781
  const constValue = resolver.getConstantValue(m);
111788
- const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(constValue))) : factory2.createNumericLiteral(constValue);
111789
- return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m);
111782
+ return preserveJsDoc(factory2.updateEnumMember(m, m.name, constValue !== void 0 ? typeof constValue === "string" ? factory2.createStringLiteral(constValue) : factory2.createNumericLiteral(constValue) : void 0), m);
111790
111783
  }))
111791
111784
  ));
111792
111785
  }
@@ -135685,7 +135678,7 @@ ${lanes.join("\n")}
135685
135678
  options
135686
135679
  ),
135687
135680
  setExternalModuleIndicator: getSetExternalModuleIndicator(options),
135688
- jsDocParsingMode: 1 /* ParseNone */
135681
+ jsDocParsingMode: transpileOptions.jsDocParsingMode ?? 0 /* ParseAll */
135689
135682
  }
135690
135683
  );
135691
135684
  if (transpileOptions.moduleName) {
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.3";
57
- var version = "5.3.1-rc";
57
+ var version = "5.3.3";
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -3112,7 +3112,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
3112
3112
  TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
3113
3113
  TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
3114
3114
  TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
3115
- TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
3115
+ TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
3116
3116
  TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
3117
3117
  TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
3118
3118
  TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
@@ -13041,10 +13041,8 @@ function createNodeFactory(flags, baseFactory2) {
13041
13041
  return update(updated, original);
13042
13042
  }
13043
13043
  function createNumericLiteral(value, numericLiteralFlags = 0 /* None */) {
13044
- const text = typeof value === "number" ? value + "" : value;
13045
- Debug.assert(text.charCodeAt(0) !== 45 /* minus */, "Negative numbers should be created in combination with createPrefixUnaryExpression");
13046
13044
  const node = createBaseDeclaration(9 /* NumericLiteral */);
13047
- node.text = text;
13045
+ node.text = typeof value === "number" ? value + "" : value;
13048
13046
  node.numericLiteralFlags = numericLiteralFlags;
13049
13047
  if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */)
13050
13048
  node.transformFlags |= 1024 /* ContainsES2015 */;
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": "5.3.1-rc",
5
+ "version": "5.3.3",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [