@typescript-deploys/pr-build 5.3.0-pr-55452-4 → 5.3.0-pr-55459-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/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 = `${versionMajorMinor}.0-insiders.20230821`;
38
+ version = `${versionMajorMinor}.0-insiders.20230822`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -19303,9 +19303,6 @@ ${lanes.join("\n")}
19303
19303
  }
19304
19304
  return Debug.fail();
19305
19305
  }
19306
- function isNamedTupleMemberName(node) {
19307
- return node.kind === 80 /* Identifier */ || node.kind === 203 /* TemplateLiteralType */ || node.kind === 15 /* NoSubstitutionTemplateLiteral */;
19308
- }
19309
19306
  var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashLibReferenceRegEx, fullTripleSlashAMDReferencePathRegEx, fullTripleSlashAMDModuleRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, extensionsNotSupportingExtensionlessResolution, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
19310
19307
  var init_utilities = __esm({
19311
19308
  "src/compiler/utilities.ts"() {
@@ -31129,29 +31126,21 @@ ${lanes.join("\n")}
31129
31126
  }
31130
31127
  return type;
31131
31128
  }
31132
- function isTokenColonOrQuestionColon() {
31133
- return token() === 59 /* ColonToken */ || token() === 58 /* QuestionToken */ && nextToken() === 59 /* ColonToken */;
31129
+ function isNextTokenColonOrQuestionColon() {
31130
+ return nextToken() === 59 /* ColonToken */ || token() === 58 /* QuestionToken */ && nextToken() === 59 /* ColonToken */;
31134
31131
  }
31135
31132
  function isTupleElementName() {
31136
31133
  if (token() === 26 /* DotDotDotToken */) {
31137
- nextToken();
31138
- }
31139
- if (token() === 16 /* TemplateHead */) {
31140
- parseTemplateType();
31141
- return isTokenColonOrQuestionColon();
31142
- }
31143
- if (tokenIsIdentifierOrKeyword(token()) || token() === 15 /* NoSubstitutionTemplateLiteral */) {
31144
- nextToken();
31145
- return isTokenColonOrQuestionColon();
31134
+ return tokenIsIdentifierOrKeyword(nextToken()) && isNextTokenColonOrQuestionColon();
31146
31135
  }
31147
- return false;
31136
+ return tokenIsIdentifierOrKeyword(token()) && isNextTokenColonOrQuestionColon();
31148
31137
  }
31149
31138
  function parseTupleElementNameOrTupleElementType() {
31150
31139
  if (lookAhead(isTupleElementName)) {
31151
31140
  const pos = getNodePos();
31152
31141
  const hasJSDoc = hasPrecedingJSDocComment();
31153
31142
  const dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
31154
- const name = token() === 15 /* NoSubstitutionTemplateLiteral */ ? parseLiteralLikeNode(token()) : token() === 16 /* TemplateHead */ ? parseTemplateType() : parseIdentifierName();
31143
+ const name = parseIdentifierName();
31155
31144
  const questionToken = parseOptionalToken(58 /* QuestionToken */);
31156
31145
  parseExpected(59 /* ColonToken */);
31157
31146
  const type = parseTupleElementType();
@@ -50561,11 +50550,10 @@ ${lanes.join("\n")}
50561
50550
  for (let i = 0; i < tupleConstituentNodes.length; i++) {
50562
50551
  const flags = type2.target.elementFlags[i];
50563
50552
  const labeledElementDeclaration = labeledElementDeclarations == null ? void 0 : labeledElementDeclarations[i];
50564
- const label = labeledElementDeclaration && getTupleElementLabel(type2, labeledElementDeclaration);
50565
- if (label) {
50553
+ if (labeledElementDeclaration) {
50566
50554
  tupleConstituentNodes[i] = factory.createNamedTupleMember(
50567
50555
  flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
50568
- factory.createIdentifier(unescapeLeadingUnderscores(label)),
50556
+ factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
50569
50557
  flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
50570
50558
  flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
50571
50559
  );
@@ -53893,7 +53881,7 @@ ${lanes.join("\n")}
53893
53881
  const pattern = declaration.parent;
53894
53882
  if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
53895
53883
  parentType = getNonNullableType(parentType);
53896
- } else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536 /* EQUndefined */)) {
53884
+ } else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
53897
53885
  parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
53898
53886
  }
53899
53887
  let type;
@@ -53936,7 +53924,7 @@ ${lanes.join("\n")}
53936
53924
  return type;
53937
53925
  }
53938
53926
  if (getEffectiveTypeAnnotationNode(walkUpBindingElementsAndPatterns(declaration))) {
53939
- return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
53927
+ return strictNullChecks && !hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
53940
53928
  }
53941
53929
  return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
53942
53930
  }
@@ -55765,7 +55753,7 @@ ${lanes.join("\n")}
55765
55753
  function getUniqAssociatedNamesFromTupleType(type, restName) {
55766
55754
  const associatedNamesMap = /* @__PURE__ */ new Map();
55767
55755
  return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
55768
- const name = getTupleElementLabel(type, labeledElement, i, restName);
55756
+ const name = getTupleElementLabel(labeledElement, i, restName);
55769
55757
  const prevCounter = associatedNamesMap.get(name);
55770
55758
  if (prevCounter === void 0) {
55771
55759
  associatedNamesMap.set(name, 1);
@@ -57221,7 +57209,7 @@ ${lanes.join("\n")}
57221
57209
  }
57222
57210
  const iife = getImmediatelyInvokedFunctionExpression(node.parent);
57223
57211
  if (iife) {
57224
- return !node.type && !node.dotDotDotToken && node.parent.parameters.indexOf(node) >= iife.arguments.length;
57212
+ return !node.type && !node.dotDotDotToken && node.parent.parameters.indexOf(node) >= getEffectiveCallArguments(iife).length;
57225
57213
  }
57226
57214
  return false;
57227
57215
  }
@@ -62044,7 +62032,7 @@ ${lanes.join("\n")}
62044
62032
  if (sourceType && targetType) {
62045
62033
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
62046
62034
  const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
62047
- const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && (getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
62035
+ const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getOnlyTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getOnlyTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
62048
62036
  let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
62049
62037
  sourceType,
62050
62038
  targetType,
@@ -65201,7 +65189,7 @@ ${lanes.join("\n")}
65201
65189
  return value.base10Value === "0";
65202
65190
  }
65203
65191
  function removeDefinitelyFalsyTypes(type) {
65204
- return filterType(type, (t) => !!(getTypeFacts(t) & 4194304 /* Truthy */));
65192
+ return filterType(type, (t) => hasTypeFacts(t, 4194304 /* Truthy */));
65205
65193
  }
65206
65194
  function extractDefinitelyFalsyTypes(type) {
65207
65195
  return mapType(type, getDefinitelyFalsyPartOfType);
@@ -66944,7 +66932,13 @@ ${lanes.join("\n")}
66944
66932
  const resolved = resolveStructuredTypeMembers(type);
66945
66933
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
66946
66934
  }
66947
- function getTypeFacts(type) {
66935
+ function getOnlyTypeFacts(type, mask2) {
66936
+ return getTypeFactsWorker(type, mask2) & mask2;
66937
+ }
66938
+ function hasTypeFacts(type, mask2) {
66939
+ return getOnlyTypeFacts(type, mask2) !== 0;
66940
+ }
66941
+ function getTypeFactsWorker(type, callerOnlyNeeds) {
66948
66942
  if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
66949
66943
  type = getBaseConstraintOfType(type) || unknownType;
66950
66944
  }
@@ -66977,6 +66971,10 @@ ${lanes.join("\n")}
66977
66971
  return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
66978
66972
  }
66979
66973
  if (flags & 524288 /* Object */) {
66974
+ const possibleFacts = strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ | 7880640 /* FunctionStrictFacts */ | 7888800 /* ObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ | 16728e3 /* FunctionFacts */ | 16736160 /* ObjectFacts */;
66975
+ if ((callerOnlyNeeds & possibleFacts) === 0) {
66976
+ return 0;
66977
+ }
66980
66978
  return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
66981
66979
  }
66982
66980
  if (flags & 16384 /* Void */) {
@@ -66998,20 +66996,20 @@ ${lanes.join("\n")}
66998
66996
  return 0 /* None */;
66999
66997
  }
67000
66998
  if (flags & 1048576 /* Union */) {
67001
- return reduceLeft(type.types, (facts, t) => facts | getTypeFacts(t), 0 /* None */);
66999
+ return reduceLeft(type.types, (facts, t) => facts | getTypeFactsWorker(t, callerOnlyNeeds), 0 /* None */);
67002
67000
  }
67003
67001
  if (flags & 2097152 /* Intersection */) {
67004
- return getIntersectionTypeFacts(type);
67002
+ return getIntersectionTypeFacts(type, callerOnlyNeeds);
67005
67003
  }
67006
67004
  return 83886079 /* UnknownFacts */;
67007
67005
  }
67008
- function getIntersectionTypeFacts(type) {
67006
+ function getIntersectionTypeFacts(type, callerOnlyNeeds) {
67009
67007
  const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */);
67010
67008
  let oredFacts = 0 /* None */;
67011
67009
  let andedFacts = 134217727 /* All */;
67012
67010
  for (const t of type.types) {
67013
67011
  if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
67014
- const f = getTypeFacts(t);
67012
+ const f = getTypeFactsWorker(t, callerOnlyNeeds);
67015
67013
  oredFacts |= f;
67016
67014
  andedFacts &= f;
67017
67015
  }
@@ -67019,19 +67017,19 @@ ${lanes.join("\n")}
67019
67017
  return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
67020
67018
  }
67021
67019
  function getTypeWithFacts(type, include) {
67022
- return filterType(type, (t) => (getTypeFacts(t) & include) !== 0);
67020
+ return filterType(type, (t) => hasTypeFacts(t, include));
67023
67021
  }
67024
67022
  function getAdjustedTypeWithFacts(type, facts) {
67025
67023
  const reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
67026
67024
  if (strictNullChecks) {
67027
67025
  switch (facts) {
67028
67026
  case 524288 /* NEUndefined */:
67029
- return mapType(reduced, (t) => getTypeFacts(t) & 65536 /* EQUndefined */ ? getIntersectionType([t, getTypeFacts(t) & 131072 /* EQNull */ && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
67027
+ return mapType(reduced, (t) => hasTypeFacts(t, 65536 /* EQUndefined */) ? getIntersectionType([t, hasTypeFacts(t, 131072 /* EQNull */) && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
67030
67028
  case 1048576 /* NENull */:
67031
- return mapType(reduced, (t) => getTypeFacts(t) & 131072 /* EQNull */ ? getIntersectionType([t, getTypeFacts(t) & 65536 /* EQUndefined */ && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
67029
+ return mapType(reduced, (t) => hasTypeFacts(t, 131072 /* EQNull */) ? getIntersectionType([t, hasTypeFacts(t, 65536 /* EQUndefined */) && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
67032
67030
  case 2097152 /* NEUndefinedOrNull */:
67033
67031
  case 4194304 /* Truthy */:
67034
- return mapType(reduced, (t) => getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t);
67032
+ return mapType(reduced, (t) => hasTypeFacts(t, 262144 /* EQUndefinedOrNull */) ? getGlobalNonNullableTypeInstantiation(t) : t);
67035
67033
  }
67036
67034
  }
67037
67035
  return reduced;
@@ -68368,14 +68366,14 @@ ${lanes.join("\n")}
68368
68366
  // the constituent based on its type facts. We use the strict subtype relation because it treats `object`
68369
68367
  // as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
68370
68368
  // but are classified as "function" according to `typeof`.
68371
- isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : (
68369
+ isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? hasTypeFacts(t, facts) ? t : neverType : (
68372
68370
  // We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
68373
68371
  // type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
68374
68372
  isTypeSubtypeOf(impliedType, t) ? impliedType : (
68375
68373
  // Neither the constituent nor the implied type is a subtype of the other, however their domains may still
68376
68374
  // overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
68377
68375
  // possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
68378
- getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType
68376
+ hasTypeFacts(t, facts) ? getIntersectionType([t, impliedType]) : neverType
68379
68377
  )
68380
68378
  )
68381
68379
  ));
@@ -68389,7 +68387,7 @@ ${lanes.join("\n")}
68389
68387
  const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
68390
68388
  if (hasDefaultClause) {
68391
68389
  const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
68392
- return filterType(type, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
68390
+ return filterType(type, (t) => getOnlyTypeFacts(t, notEqualFacts) === notEqualFacts);
68393
68391
  }
68394
68392
  const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
68395
68393
  return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
@@ -68527,7 +68525,7 @@ ${lanes.join("\n")}
68527
68525
  false
68528
68526
  );
68529
68527
  }
68530
- if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
68528
+ if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !hasTypeFacts(predicate.type, 65536 /* EQUndefined */)) {
68531
68529
  type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
68532
68530
  }
68533
68531
  const access = getDiscriminantPropertyAccess(predicateArgument, type);
@@ -68661,7 +68659,7 @@ ${lanes.join("\n")}
68661
68659
  reportCircularityError(declaration.symbol);
68662
68660
  return true;
68663
68661
  }
68664
- const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
68662
+ const containsUndefined = !!hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */);
68665
68663
  if (!popTypeResolution()) {
68666
68664
  reportCircularityError(declaration.symbol);
68667
68665
  return true;
@@ -68671,7 +68669,7 @@ ${lanes.join("\n")}
68671
68669
  return links.parameterInitializerContainsUndefined;
68672
68670
  }
68673
68671
  function removeOptionalityFromDeclaredType(declaredType, declaration) {
68674
- const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
68672
+ const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && hasTypeFacts(declaredType, 16777216 /* IsUndefined */) && !parameterInitializerContainsUndefined(declaration);
68675
68673
  return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
68676
68674
  }
68677
68675
  function isConstraintPosition(type, node) {
@@ -71501,7 +71499,7 @@ ${lanes.join("\n")}
71501
71499
  return checkNonNullType(checkExpression(node), node);
71502
71500
  }
71503
71501
  function isNullableType(type) {
71504
- return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
71502
+ return hasTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
71505
71503
  }
71506
71504
  function getNonNullableTypeIfNeeded(type) {
71507
71505
  return isNullableType(type) ? getNonNullableType(type) : type;
@@ -71547,7 +71545,7 @@ ${lanes.join("\n")}
71547
71545
  error2(node, Diagnostics.Object_is_of_type_unknown);
71548
71546
  return errorType;
71549
71547
  }
71550
- const facts = getTypeFacts(type);
71548
+ const facts = getOnlyTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
71551
71549
  if (facts & 50331648 /* IsUndefinedOrNull */) {
71552
71550
  reportError(node, facts);
71553
71551
  const t = getNonNullableType(type);
@@ -74521,27 +74519,20 @@ ${lanes.join("\n")}
74521
74519
  return node.name.escapedText === "meta" ? getGlobalImportMetaType() : errorType;
74522
74520
  }
74523
74521
  function getTypeOfParameter(symbol) {
74524
- const type = getTypeOfSymbol(symbol);
74525
- if (strictNullChecks) {
74526
- const declaration = symbol.valueDeclaration;
74527
- if (declaration && hasInitializer(declaration)) {
74528
- return getOptionalType(type);
74529
- }
74530
- }
74531
- return type;
74522
+ const declaration = symbol.valueDeclaration;
74523
+ return addOptionality(
74524
+ getTypeOfSymbol(symbol),
74525
+ /*isProperty*/
74526
+ false,
74527
+ /*isOptional*/
74528
+ !!declaration && (hasInitializer(declaration) || isOptionalDeclaration(declaration))
74529
+ );
74532
74530
  }
74533
- function getTupleElementLabel(tupleType, d, index, restParameterName = "arg") {
74531
+ function getTupleElementLabel(d, index, restParameterName = "arg") {
74534
74532
  if (!d) {
74535
74533
  return `${restParameterName}_${index}`;
74536
74534
  }
74537
- Debug.assert(!isBindingPattern(d.name));
74538
- if (d.name.kind === 203 /* TemplateLiteralType */) {
74539
- const label = instantiateType(getTypeFromTypeNode(d.name), tupleType.mapper);
74540
- return label.flags & 128 /* StringLiteral */ ? escapeLeadingUnderscores(label.value) : typeof index === "number" ? `${restParameterName}_${index}` : void 0;
74541
- }
74542
- if (d.name.kind === 15 /* NoSubstitutionTemplateLiteral */) {
74543
- return escapeLeadingUnderscores(d.name.text);
74544
- }
74535
+ Debug.assert(isIdentifier(d.name));
74545
74536
  return d.name.escapedText;
74546
74537
  }
74547
74538
  function getParameterNameAtPosition(signature, pos, overrideRestType) {
@@ -74554,7 +74545,7 @@ ${lanes.join("\n")}
74554
74545
  if (isTupleType(restType)) {
74555
74546
  const associatedNames = restType.target.labeledElementDeclarations;
74556
74547
  const index = pos - paramCount;
74557
- return getTupleElementLabel(restType, associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
74548
+ return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
74558
74549
  }
74559
74550
  return restParameter.escapedName;
74560
74551
  }
@@ -74584,7 +74575,8 @@ ${lanes.join("\n")}
74584
74575
  const index = pos - paramCount;
74585
74576
  const associatedName = associatedNames == null ? void 0 : associatedNames[index];
74586
74577
  const isRestTupleElement = !!(associatedName == null ? void 0 : associatedName.dotDotDotToken);
74587
- if (associatedName && isIdentifier(associatedName.name)) {
74578
+ if (associatedName) {
74579
+ Debug.assert(isIdentifier(associatedName.name));
74588
74580
  return { parameter: associatedName.name, parameterName: associatedName.name.escapedText, isRestParameter: isRestTupleElement };
74589
74581
  }
74590
74582
  return void 0;
@@ -74801,23 +74793,29 @@ ${lanes.join("\n")}
74801
74793
  assignParameterType(parameter);
74802
74794
  }
74803
74795
  }
74804
- function assignParameterType(parameter, type) {
74796
+ function assignParameterType(parameter, contextualType) {
74805
74797
  const links = getSymbolLinks(parameter);
74806
74798
  if (!links.type) {
74807
74799
  const declaration = parameter.valueDeclaration;
74808
- links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration(
74809
- declaration,
74810
- /*reportErrors*/
74811
- true
74812
- ) : getTypeOfSymbol(parameter));
74800
+ links.type = addOptionality(
74801
+ contextualType || (declaration ? getWidenedTypeForVariableLikeDeclaration(
74802
+ declaration,
74803
+ /*reportErrors*/
74804
+ true
74805
+ ) : getTypeOfSymbol(parameter)),
74806
+ /*isProperty*/
74807
+ false,
74808
+ /*isOptional*/
74809
+ !!declaration && !declaration.initializer && isOptionalDeclaration(declaration)
74810
+ );
74813
74811
  if (declaration && declaration.name.kind !== 80 /* Identifier */) {
74814
74812
  if (links.type === unknownType) {
74815
74813
  links.type = getTypeFromBindingPattern(declaration.name);
74816
74814
  }
74817
74815
  assignBindingElementTypes(declaration.name, links.type);
74818
74816
  }
74819
- } else if (type) {
74820
- Debug.assertEqual(links.type, type, "Parameter symbol already has a cached type which differs from newly assigned type");
74817
+ } else if (contextualType) {
74818
+ Debug.assertEqual(links.type, contextualType, "Parameter symbol already has a cached type which differs from newly assigned type");
74821
74819
  }
74822
74820
  }
74823
74821
  function assignBindingElementTypes(pattern, parentType) {
@@ -75327,7 +75325,7 @@ ${lanes.join("\n")}
75327
75325
  if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
75328
75326
  return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
75329
75327
  }
75330
- return !someType(operandConstraint, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
75328
+ return !someType(operandConstraint, (t) => getOnlyTypeFacts(t, notEqualFacts) === notEqualFacts);
75331
75329
  }
75332
75330
  const type = checkExpressionCached(node.expression);
75333
75331
  if (!isLiteralType(type)) {
@@ -75652,7 +75650,7 @@ ${lanes.join("\n")}
75652
75650
  }
75653
75651
  function checkDeleteExpressionMustBeOptional(expr, symbol) {
75654
75652
  const type = getTypeOfSymbol(symbol);
75655
- if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
75653
+ if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : hasTypeFacts(type, 16777216 /* IsUndefined */))) {
75656
75654
  error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
75657
75655
  }
75658
75656
  }
@@ -75787,7 +75785,7 @@ ${lanes.join("\n")}
75787
75785
  return getUnaryResultType(operandType);
75788
75786
  case 54 /* ExclamationToken */:
75789
75787
  checkTruthinessOfType(operandType, node.operand);
75790
- const facts = getTypeFacts(operandType) & (4194304 /* Truthy */ | 8388608 /* Falsy */);
75788
+ const facts = getOnlyTypeFacts(operandType, 4194304 /* Truthy */ | 8388608 /* Falsy */);
75791
75789
  return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
75792
75790
  case 46 /* PlusPlusToken */:
75793
75791
  case 47 /* MinusMinusToken */:
@@ -76018,7 +76016,7 @@ ${lanes.join("\n")}
76018
76016
  if (exprOrAssignment.kind === 304 /* ShorthandPropertyAssignment */) {
76019
76017
  const prop = exprOrAssignment;
76020
76018
  if (prop.objectAssignmentInitializer) {
76021
- if (strictNullChecks && !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
76019
+ if (strictNullChecks && !hasTypeFacts(checkExpression(prop.objectAssignmentInitializer), 16777216 /* IsUndefined */)) {
76022
76020
  sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
76023
76021
  }
76024
76022
  checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
@@ -76430,7 +76428,7 @@ ${lanes.join("\n")}
76430
76428
  return checkInExpression(left, right, leftType, rightType);
76431
76429
  case 56 /* AmpersandAmpersandToken */:
76432
76430
  case 77 /* AmpersandAmpersandEqualsToken */: {
76433
- const resultType2 = getTypeFacts(leftType) & 4194304 /* Truthy */ ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
76431
+ const resultType2 = hasTypeFacts(leftType, 4194304 /* Truthy */) ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
76434
76432
  if (operator === 77 /* AmpersandAmpersandEqualsToken */) {
76435
76433
  checkAssignmentOperator(rightType);
76436
76434
  }
@@ -76438,7 +76436,7 @@ ${lanes.join("\n")}
76438
76436
  }
76439
76437
  case 57 /* BarBarToken */:
76440
76438
  case 76 /* BarBarEqualsToken */: {
76441
- const resultType2 = getTypeFacts(leftType) & 8388608 /* Falsy */ ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
76439
+ const resultType2 = hasTypeFacts(leftType, 8388608 /* Falsy */) ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
76442
76440
  if (operator === 76 /* BarBarEqualsToken */) {
76443
76441
  checkAssignmentOperator(rightType);
76444
76442
  }
@@ -76446,7 +76444,7 @@ ${lanes.join("\n")}
76446
76444
  }
76447
76445
  case 61 /* QuestionQuestionToken */:
76448
76446
  case 78 /* QuestionQuestionEqualsToken */: {
76449
- const resultType2 = getTypeFacts(leftType) & 262144 /* EQUndefinedOrNull */ ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
76447
+ const resultType2 = hasTypeFacts(leftType, 262144 /* EQUndefinedOrNull */) ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
76450
76448
  if (operator === 78 /* QuestionQuestionEqualsToken */) {
76451
76449
  checkAssignmentOperator(rightType);
76452
76450
  }
@@ -78082,9 +78080,6 @@ ${lanes.join("\n")}
78082
78080
  if (node.type.kind === 191 /* RestType */) {
78083
78081
  grammarErrorOnNode(node.type, Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type);
78084
78082
  }
78085
- if (node.name.kind === 203 /* TemplateLiteralType */) {
78086
- checkSourceElement(node.name);
78087
- }
78088
78083
  checkSourceElement(node.type);
78089
78084
  getTypeFromTypeNode(node);
78090
78085
  }
@@ -79766,7 +79761,7 @@ ${lanes.join("\n")}
79766
79761
  }
79767
79762
  const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
79768
79763
  const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
79769
- if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
79764
+ if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
79770
79765
  return;
79771
79766
  const callSignatures = getSignaturesOfType(type, 0 /* Call */);
79772
79767
  const isPromise = !!getAwaitedTypeOfPromise(type);
@@ -87039,7 +87034,7 @@ ${lanes.join("\n")}
87039
87034
  return context.factory.updateNamedTupleMember(
87040
87035
  node,
87041
87036
  tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken,
87042
- Debug.checkDefined(nodeVisitor(node.name, visitor, isNamedTupleMemberName)),
87037
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)),
87043
87038
  tokenVisitor ? nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken) : node.questionToken,
87044
87039
  Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
87045
87040
  );
@@ -184649,7 +184644,6 @@ ${e.message}`;
184649
184644
  isNamedImports: () => isNamedImports,
184650
184645
  isNamedImportsOrExports: () => isNamedImportsOrExports,
184651
184646
  isNamedTupleMember: () => isNamedTupleMember,
184652
- isNamedTupleMemberName: () => isNamedTupleMemberName,
184653
184647
  isNamespaceBody: () => isNamespaceBody,
184654
184648
  isNamespaceExport: () => isNamespaceExport,
184655
184649
  isNamespaceExportDeclaration: () => isNamespaceExportDeclaration,
@@ -187059,7 +187053,6 @@ ${e.message}`;
187059
187053
  isNamedImports: () => isNamedImports,
187060
187054
  isNamedImportsOrExports: () => isNamedImportsOrExports,
187061
187055
  isNamedTupleMember: () => isNamedTupleMember,
187062
- isNamedTupleMemberName: () => isNamedTupleMemberName,
187063
187056
  isNamespaceBody: () => isNamespaceBody,
187064
187057
  isNamespaceExport: () => isNamespaceExport,
187065
187058
  isNamespaceExportDeclaration: () => isNamespaceExportDeclaration,
@@ -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 = `${versionMajorMinor}.0-insiders.20230821`;
57
+ var version = `${versionMajorMinor}.0-insiders.20230822`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -11742,9 +11742,6 @@ function getEscapedTextOfJsxNamespacedName(node) {
11742
11742
  function getTextOfJsxNamespacedName(node) {
11743
11743
  return `${idText(node.namespace)}:${idText(node.name)}`;
11744
11744
  }
11745
- function isNamedTupleMemberName(node) {
11746
- return node.kind === 80 /* Identifier */ || node.kind === 203 /* TemplateLiteralType */ || node.kind === 15 /* NoSubstitutionTemplateLiteral */;
11747
- }
11748
11745
 
11749
11746
  // src/compiler/factory/baseNodeFactory.ts
11750
11747
  function createBaseNodeFactory() {
@@ -20517,29 +20514,21 @@ var Parser;
20517
20514
  }
20518
20515
  return type;
20519
20516
  }
20520
- function isTokenColonOrQuestionColon() {
20521
- return token() === 59 /* ColonToken */ || token() === 58 /* QuestionToken */ && nextToken() === 59 /* ColonToken */;
20517
+ function isNextTokenColonOrQuestionColon() {
20518
+ return nextToken() === 59 /* ColonToken */ || token() === 58 /* QuestionToken */ && nextToken() === 59 /* ColonToken */;
20522
20519
  }
20523
20520
  function isTupleElementName() {
20524
20521
  if (token() === 26 /* DotDotDotToken */) {
20525
- nextToken();
20526
- }
20527
- if (token() === 16 /* TemplateHead */) {
20528
- parseTemplateType();
20529
- return isTokenColonOrQuestionColon();
20530
- }
20531
- if (tokenIsIdentifierOrKeyword(token()) || token() === 15 /* NoSubstitutionTemplateLiteral */) {
20532
- nextToken();
20533
- return isTokenColonOrQuestionColon();
20522
+ return tokenIsIdentifierOrKeyword(nextToken()) && isNextTokenColonOrQuestionColon();
20534
20523
  }
20535
- return false;
20524
+ return tokenIsIdentifierOrKeyword(token()) && isNextTokenColonOrQuestionColon();
20536
20525
  }
20537
20526
  function parseTupleElementNameOrTupleElementType() {
20538
20527
  if (lookAhead(isTupleElementName)) {
20539
20528
  const pos = getNodePos();
20540
20529
  const hasJSDoc = hasPrecedingJSDocComment();
20541
20530
  const dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
20542
- const name = token() === 15 /* NoSubstitutionTemplateLiteral */ ? parseLiteralLikeNode(token()) : token() === 16 /* TemplateHead */ ? parseTemplateType() : parseIdentifierName();
20531
+ const name = parseIdentifierName();
20543
20532
  const questionToken = parseOptionalToken(58 /* QuestionToken */);
20544
20533
  parseExpected(59 /* ColonToken */);
20545
20534
  const type = parseTupleElementType();
@@ -29692,7 +29681,7 @@ var visitEachChildTable = {
29692
29681
  return context.factory.updateNamedTupleMember(
29693
29682
  node,
29694
29683
  tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken,
29695
- Debug.checkDefined(nodeVisitor(node.name, visitor, isNamedTupleMemberName)),
29684
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)),
29696
29685
  tokenVisitor ? nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken) : node.questionToken,
29697
29686
  Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
29698
29687
  );
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.3.0-pr-55452-4",
5
+ "version": "5.3.0-pr-55459-3",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -116,5 +116,5 @@
116
116
  "node": "20.1.0",
117
117
  "npm": "8.19.4"
118
118
  },
119
- "gitHead": "58d231b23ea90cb6256dc152cc6c4efcb41fc2af"
119
+ "gitHead": "b0d71ce9f63cc73c46d03076e74a95943720149b"
120
120
  }