typescript 5.3.0-dev.20230914 → 5.3.0-dev.20230916

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 = `${versionMajorMinor}.0-dev.20230914`;
21
+ var version = `${versionMajorMinor}.0-dev.20230916`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -8717,7 +8717,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8717
8717
  start2 = pos;
8718
8718
  continue;
8719
8719
  }
8720
- if (isLineBreak(ch) && !jsxAttributeString) {
8720
+ if ((ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */) && !jsxAttributeString) {
8721
8721
  result += text.substring(start2, pos);
8722
8722
  tokenFlags |= 4 /* Unterminated */;
8723
8723
  error(Diagnostics.Unterminated_string_literal);
@@ -17296,8 +17296,9 @@ function isFunctionExpressionOrArrowFunction(node) {
17296
17296
  function isNumericLiteralName(name) {
17297
17297
  return (+name).toString() === name;
17298
17298
  }
17299
- function createPropertyNameNodeForIdentifierOrLiteral(name, target, singleQuote, stringNamed) {
17300
- return isIdentifierText(name, target) ? factory.createIdentifier(name) : !stringNamed && isNumericLiteralName(name) && +name >= 0 ? factory.createNumericLiteral(+name) : factory.createStringLiteral(name, !!singleQuote);
17299
+ function createPropertyNameNodeForIdentifierOrLiteral(name, target, singleQuote, stringNamed, isMethod) {
17300
+ const isMethodNamedNew = isMethod && name === "new";
17301
+ return !isMethodNamedNew && isIdentifierText(name, target) ? factory.createIdentifier(name) : !stringNamed && !isMethodNamedNew && isNumericLiteralName(name) && +name >= 0 ? factory.createNumericLiteral(+name) : factory.createStringLiteral(name, !!singleQuote);
17301
17302
  }
17302
17303
  function isThisTypeParameter(type) {
17303
17304
  return !!(type.flags & 262144 /* TypeParameter */ && type.isThisType);
@@ -49256,14 +49257,15 @@ function createTypeChecker(host) {
49256
49257
  function getPropertyNameNodeForSymbol(symbol, context) {
49257
49258
  const stringNamed = !!length(symbol.declarations) && every(symbol.declarations, isStringNamed);
49258
49259
  const singleQuote = !!length(symbol.declarations) && every(symbol.declarations, isSingleQuotedStringNamed);
49259
- const fromNameType = getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed);
49260
+ const isMethod = !!(symbol.flags & 8192 /* Method */);
49261
+ const fromNameType = getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed, isMethod);
49260
49262
  if (fromNameType) {
49261
49263
  return fromNameType;
49262
49264
  }
49263
49265
  const rawName = unescapeLeadingUnderscores(symbol.escapedName);
49264
- return createPropertyNameNodeForIdentifierOrLiteral(rawName, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed);
49266
+ return createPropertyNameNodeForIdentifierOrLiteral(rawName, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
49265
49267
  }
49266
- function getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed) {
49268
+ function getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed, isMethod) {
49267
49269
  const nameType = getSymbolLinks(symbol).nameType;
49268
49270
  if (nameType) {
49269
49271
  if (nameType.flags & 384 /* StringOrNumberLiteral */) {
@@ -49274,7 +49276,7 @@ function createTypeChecker(host) {
49274
49276
  if (isNumericLiteralName(name) && startsWith(name, "-")) {
49275
49277
  return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(+name))));
49276
49278
  }
49277
- return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions));
49279
+ return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
49278
49280
  }
49279
49281
  if (nameType.flags & 8192 /* UniqueESSymbol */) {
49280
49282
  return factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, 111551 /* Value */));
@@ -51377,10 +51379,6 @@ function createTypeChecker(host) {
51377
51379
  const prop = getPropertyOfType(type, name);
51378
51380
  return prop ? getTypeOfSymbol(prop) : void 0;
51379
51381
  }
51380
- function getTypeOfPropertyOrIndexSignature(type, name) {
51381
- var _a;
51382
- return getTypeOfPropertyOfType(type, name) || ((_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) || unknownType;
51383
- }
51384
51382
  function getTypeOfPropertyOrIndexSignatureOfType(type, name) {
51385
51383
  var _a;
51386
51384
  let propType;
@@ -51519,9 +51517,14 @@ function createTypeChecker(host) {
51519
51517
  function getTypeForBindingElement(declaration) {
51520
51518
  const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
51521
51519
  const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
51522
- return parentType && getBindingElementTypeFromParentType(declaration, parentType);
51520
+ return parentType && getBindingElementTypeFromParentType(
51521
+ declaration,
51522
+ parentType,
51523
+ /*noTupleBoundsCheck*/
51524
+ false
51525
+ );
51523
51526
  }
51524
- function getBindingElementTypeFromParentType(declaration, parentType) {
51527
+ function getBindingElementTypeFromParentType(declaration, parentType, noTupleBoundsCheck) {
51525
51528
  if (isTypeAny(parentType)) {
51526
51529
  return parentType;
51527
51530
  }
@@ -51560,7 +51563,7 @@ function createTypeChecker(host) {
51560
51563
  type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType);
51561
51564
  } else if (isArrayLikeType(parentType)) {
51562
51565
  const indexType = getNumberLiteralType(index);
51563
- const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(declaration) ? 16 /* NoTupleBoundsCheck */ : 0);
51566
+ const accessFlags = 32 /* ExpressionPosition */ | (noTupleBoundsCheck || hasDefaultValue(declaration) ? 16 /* NoTupleBoundsCheck */ : 0);
51564
51567
  const declaredType = getIndexedAccessTypeOrUndefined(parentType, indexType, accessFlags, declaration.name) || errorType;
51565
51568
  type = getFlowTypeOfDestructuring(declaration, declaredType);
51566
51569
  } else {
@@ -65731,7 +65734,7 @@ function createTypeChecker(host) {
65731
65734
  propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
65732
65735
  const narrowedPropType = narrowType2(propType);
65733
65736
  return filterType(type, (t) => {
65734
- const discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
65737
+ const discriminantType = getTypeOfPropertyOrIndexSignatureOfType(t, propName) || unknownType;
65735
65738
  return !(discriminantType.flags & 131072 /* Never */) && !(narrowedPropType.flags & 131072 /* Never */) && areTypesComparable(narrowedPropType, discriminantType);
65736
65739
  });
65737
65740
  }
@@ -66448,7 +66451,12 @@ function createTypeChecker(host) {
66448
66451
  if (narrowedType.flags & 131072 /* Never */) {
66449
66452
  return neverType;
66450
66453
  }
66451
- return getBindingElementTypeFromParentType(declaration, narrowedType);
66454
+ return getBindingElementTypeFromParentType(
66455
+ declaration,
66456
+ narrowedType,
66457
+ /*noTupleBoundsCheck*/
66458
+ true
66459
+ );
66452
66460
  }
66453
66461
  }
66454
66462
  }
@@ -66972,6 +66980,9 @@ function createTypeChecker(host) {
66972
66980
  error(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class);
66973
66981
  return errorType;
66974
66982
  }
66983
+ if (classDeclarationExtendsNull(classLikeDeclaration)) {
66984
+ return isCallExpression2 ? errorType : nullWideningType;
66985
+ }
66975
66986
  const classType = getDeclaredTypeOfSymbol(getSymbolOfDeclaration(classLikeDeclaration));
66976
66987
  const baseClassType = classType && getBaseTypes(classType)[0];
66977
66988
  if (!baseClassType) {
@@ -72502,7 +72513,12 @@ function createTypeChecker(host) {
72502
72513
  function assignBindingElementTypes(pattern, parentType) {
72503
72514
  for (const element of pattern.elements) {
72504
72515
  if (!isOmittedExpression(element)) {
72505
- const type = getBindingElementTypeFromParentType(element, parentType);
72516
+ const type = getBindingElementTypeFromParentType(
72517
+ element,
72518
+ parentType,
72519
+ /*noTupleBoundsCheck*/
72520
+ false
72521
+ );
72506
72522
  if (element.name.kind === 80 /* Identifier */) {
72507
72523
  getSymbolLinks(getSymbolOfDeclaration(element)).type = type;
72508
72524
  } else {
@@ -112972,6 +112988,16 @@ function createPrinter(printerOptions = {}, handlers = {}) {
112972
112988
  increaseIndent();
112973
112989
  shouldDecreaseIndentAfterEmit = true;
112974
112990
  }
112991
+ if (shouldEmitInterveningComments && format & 60 /* DelimitersMask */ && !positionIsSynthesized(child.pos)) {
112992
+ const commentRange = getCommentRange(child);
112993
+ emitTrailingCommentsOfPosition(
112994
+ commentRange.pos,
112995
+ /*prefixSpace*/
112996
+ !!(format & 512 /* SpaceBetweenSiblings */),
112997
+ /*forceNoNewline*/
112998
+ true
112999
+ );
113000
+ }
112975
113001
  writeLine(separatingLineTerminatorCount);
112976
113002
  shouldEmitInterveningComments = false;
112977
113003
  } else if (previousSibling && format & 512 /* SpaceBetweenSiblings */) {
@@ -120509,19 +120535,22 @@ function removeIgnoredPath(path) {
120509
120535
  function perceivedOsRootLengthForWatching(pathComponents2, length2) {
120510
120536
  if (length2 <= 1)
120511
120537
  return 1;
120512
- let userCheckIndex = 1;
120538
+ let indexAfterOsRoot = 1;
120513
120539
  let isDosStyle = pathComponents2[0].search(/[a-zA-Z]:/) === 0;
120514
120540
  if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
120515
120541
  pathComponents2[1].search(/[a-zA-Z]\$$/) === 0) {
120516
120542
  if (length2 === 2)
120517
120543
  return 2;
120518
- userCheckIndex = 2;
120544
+ indexAfterOsRoot = 2;
120519
120545
  isDosStyle = true;
120520
120546
  }
120521
- if (isDosStyle && !pathComponents2[userCheckIndex].match(/^users$/i)) {
120522
- return userCheckIndex;
120547
+ if (isDosStyle && !pathComponents2[indexAfterOsRoot].match(/^users$/i)) {
120548
+ return indexAfterOsRoot;
120549
+ }
120550
+ if (pathComponents2[indexAfterOsRoot].match(/^workspaces$/i)) {
120551
+ return indexAfterOsRoot + 1;
120523
120552
  }
120524
- return userCheckIndex + 2;
120553
+ return indexAfterOsRoot + 2;
120525
120554
  }
120526
120555
  function canWatchDirectoryOrFile(pathComponents2, length2) {
120527
120556
  if (length2 === void 0)
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 = `${versionMajorMinor}.0-dev.20230914`;
2331
+ var version = `${versionMajorMinor}.0-dev.20230916`;
2332
2332
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2333
2333
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2334
2334
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -12258,7 +12258,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12258
12258
  start3 = pos;
12259
12259
  continue;
12260
12260
  }
12261
- if (isLineBreak(ch) && !jsxAttributeString) {
12261
+ if ((ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */) && !jsxAttributeString) {
12262
12262
  result += text.substring(start3, pos);
12263
12263
  tokenFlags |= 4 /* Unterminated */;
12264
12264
  error2(Diagnostics.Unterminated_string_literal);
@@ -21481,8 +21481,9 @@ function escapeSnippetText(text) {
21481
21481
  function isNumericLiteralName(name) {
21482
21482
  return (+name).toString() === name;
21483
21483
  }
21484
- function createPropertyNameNodeForIdentifierOrLiteral(name, target, singleQuote, stringNamed) {
21485
- return isIdentifierText(name, target) ? factory.createIdentifier(name) : !stringNamed && isNumericLiteralName(name) && +name >= 0 ? factory.createNumericLiteral(+name) : factory.createStringLiteral(name, !!singleQuote);
21484
+ function createPropertyNameNodeForIdentifierOrLiteral(name, target, singleQuote, stringNamed, isMethod) {
21485
+ const isMethodNamedNew = isMethod && name === "new";
21486
+ return !isMethodNamedNew && isIdentifierText(name, target) ? factory.createIdentifier(name) : !stringNamed && !isMethodNamedNew && isNumericLiteralName(name) && +name >= 0 ? factory.createNumericLiteral(+name) : factory.createStringLiteral(name, !!singleQuote);
21486
21487
  }
21487
21488
  function isThisTypeParameter(type) {
21488
21489
  return !!(type.flags & 262144 /* TypeParameter */ && type.isThisType);
@@ -53956,14 +53957,15 @@ function createTypeChecker(host) {
53956
53957
  function getPropertyNameNodeForSymbol(symbol, context) {
53957
53958
  const stringNamed = !!length(symbol.declarations) && every(symbol.declarations, isStringNamed);
53958
53959
  const singleQuote = !!length(symbol.declarations) && every(symbol.declarations, isSingleQuotedStringNamed);
53959
- const fromNameType = getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed);
53960
+ const isMethod = !!(symbol.flags & 8192 /* Method */);
53961
+ const fromNameType = getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed, isMethod);
53960
53962
  if (fromNameType) {
53961
53963
  return fromNameType;
53962
53964
  }
53963
53965
  const rawName = unescapeLeadingUnderscores(symbol.escapedName);
53964
- return createPropertyNameNodeForIdentifierOrLiteral(rawName, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed);
53966
+ return createPropertyNameNodeForIdentifierOrLiteral(rawName, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
53965
53967
  }
53966
- function getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed) {
53968
+ function getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed, isMethod) {
53967
53969
  const nameType = getSymbolLinks(symbol).nameType;
53968
53970
  if (nameType) {
53969
53971
  if (nameType.flags & 384 /* StringOrNumberLiteral */) {
@@ -53974,7 +53976,7 @@ function createTypeChecker(host) {
53974
53976
  if (isNumericLiteralName(name) && startsWith(name, "-")) {
53975
53977
  return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(+name))));
53976
53978
  }
53977
- return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions));
53979
+ return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
53978
53980
  }
53979
53981
  if (nameType.flags & 8192 /* UniqueESSymbol */) {
53980
53982
  return factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, 111551 /* Value */));
@@ -56077,10 +56079,6 @@ function createTypeChecker(host) {
56077
56079
  const prop = getPropertyOfType(type, name);
56078
56080
  return prop ? getTypeOfSymbol(prop) : void 0;
56079
56081
  }
56080
- function getTypeOfPropertyOrIndexSignature(type, name) {
56081
- var _a;
56082
- return getTypeOfPropertyOfType(type, name) || ((_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) || unknownType;
56083
- }
56084
56082
  function getTypeOfPropertyOrIndexSignatureOfType(type, name) {
56085
56083
  var _a;
56086
56084
  let propType;
@@ -56219,9 +56217,14 @@ function createTypeChecker(host) {
56219
56217
  function getTypeForBindingElement(declaration) {
56220
56218
  const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
56221
56219
  const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
56222
- return parentType && getBindingElementTypeFromParentType(declaration, parentType);
56220
+ return parentType && getBindingElementTypeFromParentType(
56221
+ declaration,
56222
+ parentType,
56223
+ /*noTupleBoundsCheck*/
56224
+ false
56225
+ );
56223
56226
  }
56224
- function getBindingElementTypeFromParentType(declaration, parentType) {
56227
+ function getBindingElementTypeFromParentType(declaration, parentType, noTupleBoundsCheck) {
56225
56228
  if (isTypeAny(parentType)) {
56226
56229
  return parentType;
56227
56230
  }
@@ -56260,7 +56263,7 @@ function createTypeChecker(host) {
56260
56263
  type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType);
56261
56264
  } else if (isArrayLikeType(parentType)) {
56262
56265
  const indexType = getNumberLiteralType(index);
56263
- const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(declaration) ? 16 /* NoTupleBoundsCheck */ : 0);
56266
+ const accessFlags = 32 /* ExpressionPosition */ | (noTupleBoundsCheck || hasDefaultValue(declaration) ? 16 /* NoTupleBoundsCheck */ : 0);
56264
56267
  const declaredType = getIndexedAccessTypeOrUndefined(parentType, indexType, accessFlags, declaration.name) || errorType;
56265
56268
  type = getFlowTypeOfDestructuring(declaration, declaredType);
56266
56269
  } else {
@@ -70431,7 +70434,7 @@ function createTypeChecker(host) {
70431
70434
  propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
70432
70435
  const narrowedPropType = narrowType2(propType);
70433
70436
  return filterType(type, (t) => {
70434
- const discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
70437
+ const discriminantType = getTypeOfPropertyOrIndexSignatureOfType(t, propName) || unknownType;
70435
70438
  return !(discriminantType.flags & 131072 /* Never */) && !(narrowedPropType.flags & 131072 /* Never */) && areTypesComparable(narrowedPropType, discriminantType);
70436
70439
  });
70437
70440
  }
@@ -71148,7 +71151,12 @@ function createTypeChecker(host) {
71148
71151
  if (narrowedType.flags & 131072 /* Never */) {
71149
71152
  return neverType;
71150
71153
  }
71151
- return getBindingElementTypeFromParentType(declaration, narrowedType);
71154
+ return getBindingElementTypeFromParentType(
71155
+ declaration,
71156
+ narrowedType,
71157
+ /*noTupleBoundsCheck*/
71158
+ true
71159
+ );
71152
71160
  }
71153
71161
  }
71154
71162
  }
@@ -71672,6 +71680,9 @@ function createTypeChecker(host) {
71672
71680
  error2(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class);
71673
71681
  return errorType;
71674
71682
  }
71683
+ if (classDeclarationExtendsNull(classLikeDeclaration)) {
71684
+ return isCallExpression2 ? errorType : nullWideningType;
71685
+ }
71675
71686
  const classType = getDeclaredTypeOfSymbol(getSymbolOfDeclaration(classLikeDeclaration));
71676
71687
  const baseClassType = classType && getBaseTypes(classType)[0];
71677
71688
  if (!baseClassType) {
@@ -77202,7 +77213,12 @@ function createTypeChecker(host) {
77202
77213
  function assignBindingElementTypes(pattern, parentType) {
77203
77214
  for (const element of pattern.elements) {
77204
77215
  if (!isOmittedExpression(element)) {
77205
- const type = getBindingElementTypeFromParentType(element, parentType);
77216
+ const type = getBindingElementTypeFromParentType(
77217
+ element,
77218
+ parentType,
77219
+ /*noTupleBoundsCheck*/
77220
+ false
77221
+ );
77206
77222
  if (element.name.kind === 80 /* Identifier */) {
77207
77223
  getSymbolLinks(getSymbolOfDeclaration(element)).type = type;
77208
77224
  } else {
@@ -117854,6 +117870,16 @@ function createPrinter(printerOptions = {}, handlers = {}) {
117854
117870
  increaseIndent();
117855
117871
  shouldDecreaseIndentAfterEmit = true;
117856
117872
  }
117873
+ if (shouldEmitInterveningComments && format & 60 /* DelimitersMask */ && !positionIsSynthesized(child.pos)) {
117874
+ const commentRange = getCommentRange(child);
117875
+ emitTrailingCommentsOfPosition(
117876
+ commentRange.pos,
117877
+ /*prefixSpace*/
117878
+ !!(format & 512 /* SpaceBetweenSiblings */),
117879
+ /*forceNoNewline*/
117880
+ true
117881
+ );
117882
+ }
117857
117883
  writeLine(separatingLineTerminatorCount);
117858
117884
  shouldEmitInterveningComments = false;
117859
117885
  } else if (previousSibling && format & 512 /* SpaceBetweenSiblings */) {
@@ -125477,19 +125503,22 @@ function removeIgnoredPath(path) {
125477
125503
  function perceivedOsRootLengthForWatching(pathComponents2, length2) {
125478
125504
  if (length2 <= 1)
125479
125505
  return 1;
125480
- let userCheckIndex = 1;
125506
+ let indexAfterOsRoot = 1;
125481
125507
  let isDosStyle = pathComponents2[0].search(/[a-zA-Z]:/) === 0;
125482
125508
  if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
125483
125509
  pathComponents2[1].search(/[a-zA-Z]\$$/) === 0) {
125484
125510
  if (length2 === 2)
125485
125511
  return 2;
125486
- userCheckIndex = 2;
125512
+ indexAfterOsRoot = 2;
125487
125513
  isDosStyle = true;
125488
125514
  }
125489
- if (isDosStyle && !pathComponents2[userCheckIndex].match(/^users$/i)) {
125490
- return userCheckIndex;
125515
+ if (isDosStyle && !pathComponents2[indexAfterOsRoot].match(/^users$/i)) {
125516
+ return indexAfterOsRoot;
125517
+ }
125518
+ if (pathComponents2[indexAfterOsRoot].match(/^workspaces$/i)) {
125519
+ return indexAfterOsRoot + 1;
125491
125520
  }
125492
- return userCheckIndex + 2;
125521
+ return indexAfterOsRoot + 2;
125493
125522
  }
125494
125523
  function canWatchDirectoryOrFile(pathComponents2, length2) {
125495
125524
  if (length2 === void 0)
@@ -152932,7 +152961,15 @@ function createPropertyNameFromSymbol(symbol, target, quotePreference, checker)
152932
152961
  if (prop && isComputedPropertyName(prop))
152933
152962
  return prop;
152934
152963
  }
152935
- return createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* Single */);
152964
+ return createPropertyNameNodeForIdentifierOrLiteral(
152965
+ symbol.name,
152966
+ target,
152967
+ quotePreference === 0 /* Single */,
152968
+ /*stringNamed*/
152969
+ false,
152970
+ /*isMethod*/
152971
+ false
152972
+ );
152936
152973
  }
152937
152974
  function findScope(node) {
152938
152975
  if (findAncestor(node, isJsxExpression)) {
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-dev.20230914`;
38
+ version = `${versionMajorMinor}.0-dev.20230916`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -9880,7 +9880,7 @@ ${lanes.join("\n")}
9880
9880
  start2 = pos;
9881
9881
  continue;
9882
9882
  }
9883
- if (isLineBreak(ch) && !jsxAttributeString) {
9883
+ if ((ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */) && !jsxAttributeString) {
9884
9884
  result += text.substring(start2, pos);
9885
9885
  tokenFlags |= 4 /* Unterminated */;
9886
9886
  error2(Diagnostics.Unterminated_string_literal);
@@ -18708,8 +18708,9 @@ ${lanes.join("\n")}
18708
18708
  function isNumericLiteralName(name) {
18709
18709
  return (+name).toString() === name;
18710
18710
  }
18711
- function createPropertyNameNodeForIdentifierOrLiteral(name, target, singleQuote, stringNamed) {
18712
- return isIdentifierText(name, target) ? factory.createIdentifier(name) : !stringNamed && isNumericLiteralName(name) && +name >= 0 ? factory.createNumericLiteral(+name) : factory.createStringLiteral(name, !!singleQuote);
18711
+ function createPropertyNameNodeForIdentifierOrLiteral(name, target, singleQuote, stringNamed, isMethod) {
18712
+ const isMethodNamedNew = isMethod && name === "new";
18713
+ return !isMethodNamedNew && isIdentifierText(name, target) ? factory.createIdentifier(name) : !stringNamed && !isMethodNamedNew && isNumericLiteralName(name) && +name >= 0 ? factory.createNumericLiteral(+name) : factory.createStringLiteral(name, !!singleQuote);
18713
18714
  }
18714
18715
  function isThisTypeParameter(type) {
18715
18716
  return !!(type.flags & 262144 /* TypeParameter */ && type.isThisType);
@@ -51722,14 +51723,15 @@ ${lanes.join("\n")}
51722
51723
  function getPropertyNameNodeForSymbol(symbol, context) {
51723
51724
  const stringNamed = !!length(symbol.declarations) && every(symbol.declarations, isStringNamed);
51724
51725
  const singleQuote = !!length(symbol.declarations) && every(symbol.declarations, isSingleQuotedStringNamed);
51725
- const fromNameType = getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed);
51726
+ const isMethod = !!(symbol.flags & 8192 /* Method */);
51727
+ const fromNameType = getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed, isMethod);
51726
51728
  if (fromNameType) {
51727
51729
  return fromNameType;
51728
51730
  }
51729
51731
  const rawName = unescapeLeadingUnderscores(symbol.escapedName);
51730
- return createPropertyNameNodeForIdentifierOrLiteral(rawName, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed);
51732
+ return createPropertyNameNodeForIdentifierOrLiteral(rawName, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
51731
51733
  }
51732
- function getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed) {
51734
+ function getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed, isMethod) {
51733
51735
  const nameType = getSymbolLinks(symbol).nameType;
51734
51736
  if (nameType) {
51735
51737
  if (nameType.flags & 384 /* StringOrNumberLiteral */) {
@@ -51740,7 +51742,7 @@ ${lanes.join("\n")}
51740
51742
  if (isNumericLiteralName(name) && startsWith(name, "-")) {
51741
51743
  return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(+name))));
51742
51744
  }
51743
- return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions));
51745
+ return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
51744
51746
  }
51745
51747
  if (nameType.flags & 8192 /* UniqueESSymbol */) {
51746
51748
  return factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, 111551 /* Value */));
@@ -53843,10 +53845,6 @@ ${lanes.join("\n")}
53843
53845
  const prop = getPropertyOfType(type, name);
53844
53846
  return prop ? getTypeOfSymbol(prop) : void 0;
53845
53847
  }
53846
- function getTypeOfPropertyOrIndexSignature(type, name) {
53847
- var _a;
53848
- return getTypeOfPropertyOfType(type, name) || ((_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) || unknownType;
53849
- }
53850
53848
  function getTypeOfPropertyOrIndexSignatureOfType(type, name) {
53851
53849
  var _a;
53852
53850
  let propType;
@@ -53985,9 +53983,14 @@ ${lanes.join("\n")}
53985
53983
  function getTypeForBindingElement(declaration) {
53986
53984
  const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
53987
53985
  const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
53988
- return parentType && getBindingElementTypeFromParentType(declaration, parentType);
53986
+ return parentType && getBindingElementTypeFromParentType(
53987
+ declaration,
53988
+ parentType,
53989
+ /*noTupleBoundsCheck*/
53990
+ false
53991
+ );
53989
53992
  }
53990
- function getBindingElementTypeFromParentType(declaration, parentType) {
53993
+ function getBindingElementTypeFromParentType(declaration, parentType, noTupleBoundsCheck) {
53991
53994
  if (isTypeAny(parentType)) {
53992
53995
  return parentType;
53993
53996
  }
@@ -54026,7 +54029,7 @@ ${lanes.join("\n")}
54026
54029
  type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType);
54027
54030
  } else if (isArrayLikeType(parentType)) {
54028
54031
  const indexType = getNumberLiteralType(index);
54029
- const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(declaration) ? 16 /* NoTupleBoundsCheck */ : 0);
54032
+ const accessFlags = 32 /* ExpressionPosition */ | (noTupleBoundsCheck || hasDefaultValue(declaration) ? 16 /* NoTupleBoundsCheck */ : 0);
54030
54033
  const declaredType = getIndexedAccessTypeOrUndefined(parentType, indexType, accessFlags, declaration.name) || errorType;
54031
54034
  type = getFlowTypeOfDestructuring(declaration, declaredType);
54032
54035
  } else {
@@ -68197,7 +68200,7 @@ ${lanes.join("\n")}
68197
68200
  propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
68198
68201
  const narrowedPropType = narrowType2(propType);
68199
68202
  return filterType(type, (t) => {
68200
- const discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
68203
+ const discriminantType = getTypeOfPropertyOrIndexSignatureOfType(t, propName) || unknownType;
68201
68204
  return !(discriminantType.flags & 131072 /* Never */) && !(narrowedPropType.flags & 131072 /* Never */) && areTypesComparable(narrowedPropType, discriminantType);
68202
68205
  });
68203
68206
  }
@@ -68914,7 +68917,12 @@ ${lanes.join("\n")}
68914
68917
  if (narrowedType.flags & 131072 /* Never */) {
68915
68918
  return neverType;
68916
68919
  }
68917
- return getBindingElementTypeFromParentType(declaration, narrowedType);
68920
+ return getBindingElementTypeFromParentType(
68921
+ declaration,
68922
+ narrowedType,
68923
+ /*noTupleBoundsCheck*/
68924
+ true
68925
+ );
68918
68926
  }
68919
68927
  }
68920
68928
  }
@@ -69438,6 +69446,9 @@ ${lanes.join("\n")}
69438
69446
  error2(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class);
69439
69447
  return errorType;
69440
69448
  }
69449
+ if (classDeclarationExtendsNull(classLikeDeclaration)) {
69450
+ return isCallExpression2 ? errorType : nullWideningType;
69451
+ }
69441
69452
  const classType = getDeclaredTypeOfSymbol(getSymbolOfDeclaration(classLikeDeclaration));
69442
69453
  const baseClassType = classType && getBaseTypes(classType)[0];
69443
69454
  if (!baseClassType) {
@@ -74968,7 +74979,12 @@ ${lanes.join("\n")}
74968
74979
  function assignBindingElementTypes(pattern, parentType) {
74969
74980
  for (const element of pattern.elements) {
74970
74981
  if (!isOmittedExpression(element)) {
74971
- const type = getBindingElementTypeFromParentType(element, parentType);
74982
+ const type = getBindingElementTypeFromParentType(
74983
+ element,
74984
+ parentType,
74985
+ /*noTupleBoundsCheck*/
74986
+ false
74987
+ );
74972
74988
  if (element.name.kind === 80 /* Identifier */) {
74973
74989
  getSymbolLinks(getSymbolOfDeclaration(element)).type = type;
74974
74990
  } else {
@@ -115898,6 +115914,16 @@ ${lanes.join("\n")}
115898
115914
  increaseIndent();
115899
115915
  shouldDecreaseIndentAfterEmit = true;
115900
115916
  }
115917
+ if (shouldEmitInterveningComments && format & 60 /* DelimitersMask */ && !positionIsSynthesized(child.pos)) {
115918
+ const commentRange = getCommentRange(child);
115919
+ emitTrailingCommentsOfPosition(
115920
+ commentRange.pos,
115921
+ /*prefixSpace*/
115922
+ !!(format & 512 /* SpaceBetweenSiblings */),
115923
+ /*forceNoNewline*/
115924
+ true
115925
+ );
115926
+ }
115901
115927
  writeLine(separatingLineTerminatorCount);
115902
115928
  shouldEmitInterveningComments = false;
115903
115929
  } else if (previousSibling && format & 512 /* SpaceBetweenSiblings */) {
@@ -123620,19 +123646,22 @@ ${lanes.join("\n")}
123620
123646
  function perceivedOsRootLengthForWatching(pathComponents2, length2) {
123621
123647
  if (length2 <= 1)
123622
123648
  return 1;
123623
- let userCheckIndex = 1;
123649
+ let indexAfterOsRoot = 1;
123624
123650
  let isDosStyle = pathComponents2[0].search(/[a-zA-Z]:/) === 0;
123625
123651
  if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
123626
123652
  pathComponents2[1].search(/[a-zA-Z]\$$/) === 0) {
123627
123653
  if (length2 === 2)
123628
123654
  return 2;
123629
- userCheckIndex = 2;
123655
+ indexAfterOsRoot = 2;
123630
123656
  isDosStyle = true;
123631
123657
  }
123632
- if (isDosStyle && !pathComponents2[userCheckIndex].match(/^users$/i)) {
123633
- return userCheckIndex;
123658
+ if (isDosStyle && !pathComponents2[indexAfterOsRoot].match(/^users$/i)) {
123659
+ return indexAfterOsRoot;
123660
+ }
123661
+ if (pathComponents2[indexAfterOsRoot].match(/^workspaces$/i)) {
123662
+ return indexAfterOsRoot + 1;
123634
123663
  }
123635
- return userCheckIndex + 2;
123664
+ return indexAfterOsRoot + 2;
123636
123665
  }
123637
123666
  function canWatchDirectoryOrFile(pathComponents2, length2) {
123638
123667
  if (length2 === void 0)
@@ -151692,7 +151721,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
151692
151721
  if (prop && isComputedPropertyName(prop))
151693
151722
  return prop;
151694
151723
  }
151695
- return createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* Single */);
151724
+ return createPropertyNameNodeForIdentifierOrLiteral(
151725
+ symbol.name,
151726
+ target,
151727
+ quotePreference === 0 /* Single */,
151728
+ /*stringNamed*/
151729
+ false,
151730
+ /*isMethod*/
151731
+ false
151732
+ );
151696
151733
  }
151697
151734
  function findScope(node) {
151698
151735
  if (findAncestor(node, isJsxExpression)) {
@@ -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-dev.20230914`;
57
+ var version = `${versionMajorMinor}.0-dev.20230916`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -8037,7 +8037,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8037
8037
  start2 = pos;
8038
8038
  continue;
8039
8039
  }
8040
- if (isLineBreak(ch) && !jsxAttributeString) {
8040
+ if ((ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */) && !jsxAttributeString) {
8041
8041
  result += text.substring(start2, pos);
8042
8042
  tokenFlags |= 4 /* Unterminated */;
8043
8043
  error(Diagnostics.Unterminated_string_literal);
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.0-dev.20230914",
5
+ "version": "5.3.0-dev.20230916",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -75,6 +75,7 @@
75
75
  "mocha-fivemat-progress-reporter": "^0.1.0",
76
76
  "ms": "^2.1.3",
77
77
  "node-fetch": "^3.2.10",
78
+ "playwright": "^1.38.0",
78
79
  "source-map-support": "^0.5.21",
79
80
  "tslib": "^2.5.0",
80
81
  "typescript": "^5.0.2",
@@ -112,5 +113,5 @@
112
113
  "node": "20.1.0",
113
114
  "npm": "8.19.4"
114
115
  },
115
- "gitHead": "a563de9e4918f6ef614069c0bb9202e9bd303e0b"
116
+ "gitHead": "89ab23a64941f7da4ca141fb9de89fcfeab7b7e5"
116
117
  }