typescript 5.0.0-dev.20230217 → 5.0.0-dev.20230218

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
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.0";
26
- var version = `${versionMajorMinor}.0-dev.20230217`;
26
+ var version = `${versionMajorMinor}.0-dev.20230218`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -8467,18 +8467,18 @@ function isIdentifierText(name, languageVersion, identifierVariant) {
8467
8467
  return true;
8468
8468
  }
8469
8469
  function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Standard */, textInitial, onError, start, length2) {
8470
- let text = textInitial;
8471
- let pos;
8472
- let end;
8473
- let startPos;
8474
- let tokenPos;
8475
- let token;
8476
- let tokenValue;
8477
- let tokenFlags;
8478
- let commentDirectives;
8479
- let inJSDocType = 0;
8470
+ var text = textInitial;
8471
+ var pos;
8472
+ var end;
8473
+ var startPos;
8474
+ var tokenPos;
8475
+ var token;
8476
+ var tokenValue;
8477
+ var tokenFlags;
8478
+ var commentDirectives;
8479
+ var inJSDocType = 0;
8480
8480
  setText(text, start, length2);
8481
- const scanner = {
8481
+ var scanner = {
8482
8482
  getStartPos: () => startPos,
8483
8483
  getTextPos: () => pos,
8484
8484
  getToken: () => token,
@@ -26008,22 +26008,22 @@ function isExternalModule(file) {
26008
26008
  }
26009
26009
  var Parser;
26010
26010
  ((Parser2) => {
26011
- const scanner = createScanner(
26011
+ var scanner = createScanner(
26012
26012
  99 /* Latest */,
26013
26013
  /*skipTrivia*/
26014
26014
  true
26015
26015
  );
26016
- const disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
26017
- let NodeConstructor2;
26018
- let TokenConstructor2;
26019
- let IdentifierConstructor2;
26020
- let PrivateIdentifierConstructor2;
26021
- let SourceFileConstructor2;
26016
+ var disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
26017
+ var NodeConstructor2;
26018
+ var TokenConstructor2;
26019
+ var IdentifierConstructor2;
26020
+ var PrivateIdentifierConstructor2;
26021
+ var SourceFileConstructor2;
26022
26022
  function countNode(node) {
26023
26023
  nodeCount++;
26024
26024
  return node;
26025
26025
  }
26026
- const baseNodeFactory = {
26026
+ var baseNodeFactory = {
26027
26027
  createBaseSourceFileNode: (kind) => countNode(new SourceFileConstructor2(
26028
26028
  kind,
26029
26029
  /*pos*/
@@ -26060,25 +26060,25 @@ var Parser;
26060
26060
  0
26061
26061
  ))
26062
26062
  };
26063
- const factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
26064
- let fileName;
26065
- let sourceFlags;
26066
- let sourceText;
26067
- let languageVersion;
26068
- let scriptKind;
26069
- let languageVariant;
26070
- let parseDiagnostics;
26071
- let jsDocDiagnostics;
26072
- let syntaxCursor;
26073
- let currentToken;
26074
- let nodeCount;
26075
- let identifiers;
26076
- let identifierCount;
26077
- let parsingContext;
26078
- let notParenthesizedArrow;
26079
- let contextFlags;
26080
- let topLevel = true;
26081
- let parseErrorBeforeNextFinishedNode = false;
26063
+ var factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
26064
+ var fileName;
26065
+ var sourceFlags;
26066
+ var sourceText;
26067
+ var languageVersion;
26068
+ var scriptKind;
26069
+ var languageVariant;
26070
+ var parseDiagnostics;
26071
+ var jsDocDiagnostics;
26072
+ var syntaxCursor;
26073
+ var currentToken;
26074
+ var nodeCount;
26075
+ var identifiers;
26076
+ var identifierCount;
26077
+ var parsingContext;
26078
+ var notParenthesizedArrow;
26079
+ var contextFlags;
26080
+ var topLevel = true;
26081
+ var parseErrorBeforeNextFinishedNode = false;
26082
26082
  function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride) {
26083
26083
  var _a2;
26084
26084
  scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
@@ -29585,13 +29585,9 @@ var Parser;
29585
29585
  function parseJsxClosingFragment(inExpressionContext) {
29586
29586
  const pos = getNodePos();
29587
29587
  parseExpected(30 /* LessThanSlashToken */);
29588
- if (tokenIsIdentifierOrKeyword(token())) {
29589
- parseErrorAtRange(parseJsxElementName(), Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
29590
- }
29591
29588
  if (parseExpected(
29592
29589
  31 /* GreaterThanToken */,
29593
- /*diagnostic*/
29594
- void 0,
29590
+ Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment,
29595
29591
  /*shouldAdvance*/
29596
29592
  false
29597
29593
  )) {
@@ -47292,7 +47288,7 @@ function createTypeChecker(host) {
47292
47288
  return result;
47293
47289
  }
47294
47290
  function createAnonymousTypeNode(type2) {
47295
- var _a3;
47291
+ var _a3, _b2;
47296
47292
  const typeId = type2.id;
47297
47293
  const symbol = type2.symbol;
47298
47294
  if (symbol) {
@@ -47318,6 +47314,20 @@ function createTypeChecker(host) {
47318
47314
  return visitAndTransformType(type2, createTypeNodeFromObjectType);
47319
47315
  }
47320
47316
  } else {
47317
+ const isInstantiationExpressionType = !!(getObjectFlags(type2) & 8388608 /* InstantiationExpressionType */);
47318
+ if (isInstantiationExpressionType) {
47319
+ const instantiationExpressionType = type2;
47320
+ if (isTypeQueryNode(instantiationExpressionType.node)) {
47321
+ const typeNode = serializeExistingTypeNode(context, instantiationExpressionType.node);
47322
+ if (typeNode) {
47323
+ return typeNode;
47324
+ }
47325
+ }
47326
+ if ((_b2 = context.visitedTypes) == null ? void 0 : _b2.has(typeId)) {
47327
+ return createElidedInformationPlaceholder(context);
47328
+ }
47329
+ return visitAndTransformType(type2, createTypeNodeFromObjectType);
47330
+ }
47321
47331
  return createTypeNodeFromObjectType(type2);
47322
47332
  }
47323
47333
  function shouldWriteTypeOfFunctionSymbol() {
@@ -47826,7 +47836,7 @@ function createTypeChecker(host) {
47826
47836
  );
47827
47837
  }
47828
47838
  function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
47829
- var _a2, _b, _c, _d;
47839
+ var _a2, _b, _c, _d, _e;
47830
47840
  const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
47831
47841
  if (suppressAny)
47832
47842
  context.flags &= ~256 /* SuppressAnyReturnType */;
@@ -47843,6 +47853,39 @@ function createTypeChecker(host) {
47843
47853
  /*skipUnionExpanding*/
47844
47854
  true
47845
47855
  )[0];
47856
+ let cleanup;
47857
+ if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
47858
+ const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : void 0;
47859
+ Debug.assertOptionalNode(existingFakeScope, isBlock);
47860
+ const locals = (_a2 = existingFakeScope == null ? void 0 : existingFakeScope.locals) != null ? _a2 : createSymbolTable();
47861
+ let newLocals;
47862
+ for (const param of expandedParams) {
47863
+ if (!locals.has(param.escapedName)) {
47864
+ newLocals = append(newLocals, param.escapedName);
47865
+ locals.set(param.escapedName, param);
47866
+ }
47867
+ }
47868
+ if (newLocals) {
47869
+ let removeNewLocals2 = function() {
47870
+ forEach(newLocals, (s) => locals.delete(s));
47871
+ };
47872
+ var removeNewLocals = removeNewLocals2;
47873
+ if (existingFakeScope) {
47874
+ cleanup = removeNewLocals2;
47875
+ } else {
47876
+ const fakeScope = parseNodeFactory.createBlock(emptyArray);
47877
+ getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
47878
+ fakeScope.locals = locals;
47879
+ const saveEnclosingDeclaration = context.enclosingDeclaration;
47880
+ setParent(fakeScope, saveEnclosingDeclaration);
47881
+ context.enclosingDeclaration = fakeScope;
47882
+ cleanup = () => {
47883
+ context.enclosingDeclaration = saveEnclosingDeclaration;
47884
+ removeNewLocals2();
47885
+ };
47886
+ }
47887
+ }
47888
+ }
47846
47889
  const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 173 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
47847
47890
  const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
47848
47891
  if (thisParameter) {
@@ -47868,11 +47911,11 @@ function createTypeChecker(host) {
47868
47911
  const flags = modifiersToFlags(modifiers);
47869
47912
  modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
47870
47913
  }
47871
- const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_a2 = options == null ? void 0 : options.name) != null ? _a2 : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
47914
+ const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
47872
47915
  modifiers,
47873
47916
  /*asteriskToken*/
47874
47917
  void 0,
47875
- (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""),
47918
+ (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
47876
47919
  /*questionToken*/
47877
47920
  void 0,
47878
47921
  typeParameters,
@@ -47887,14 +47930,14 @@ function createTypeChecker(host) {
47887
47930
  void 0
47888
47931
  ) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
47889
47932
  modifiers,
47890
- (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
47933
+ (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
47891
47934
  parameters,
47892
47935
  returnTypeNode,
47893
47936
  /*body*/
47894
47937
  void 0
47895
47938
  ) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
47896
47939
  modifiers,
47897
- (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
47940
+ (_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
47898
47941
  parameters,
47899
47942
  /*body*/
47900
47943
  void 0
@@ -47929,6 +47972,7 @@ function createTypeChecker(host) {
47929
47972
  if (typeArguments) {
47930
47973
  node.typeArguments = factory.createNodeArray(typeArguments);
47931
47974
  }
47975
+ cleanup == null ? void 0 : cleanup();
47932
47976
  return node;
47933
47977
  }
47934
47978
  function tryGetThisParameterDeclaration(signature, context) {
@@ -48543,9 +48587,12 @@ function createTypeChecker(host) {
48543
48587
  function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
48544
48588
  return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
48545
48589
  }
48590
+ function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
48591
+ return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
48592
+ }
48546
48593
  function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
48547
48594
  if (!isErrorType(type) && enclosingDeclaration) {
48548
- const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
48595
+ const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
48549
48596
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
48550
48597
  const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
48551
48598
  if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
@@ -48577,7 +48624,8 @@ function createTypeChecker(host) {
48577
48624
  function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
48578
48625
  if (!isErrorType(type) && context.enclosingDeclaration) {
48579
48626
  const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
48580
- if (!!findAncestor(annotation, (n) => n === context.enclosingDeclaration) && annotation) {
48627
+ const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
48628
+ if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
48581
48629
  const annotated = getTypeFromTypeNode(annotation);
48582
48630
  const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
48583
48631
  if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
@@ -77822,20 +77870,19 @@ function createTypeChecker(host) {
77822
77870
  }
77823
77871
  }
77824
77872
  }
77825
- function getMemberOverrideModifierStatus(node, member) {
77873
+ function getMemberOverrideModifierStatus(node, member, memberSymbol) {
77826
77874
  if (!member.name) {
77827
77875
  return 0 /* Ok */;
77828
77876
  }
77829
- const symbol = getSymbolOfDeclaration(node);
77830
- const type = getDeclaredTypeOfSymbol(symbol);
77877
+ const classSymbol = getSymbolOfDeclaration(node);
77878
+ const type = getDeclaredTypeOfSymbol(classSymbol);
77831
77879
  const typeWithThis = getTypeWithThisArgument(type);
77832
- const staticType = getTypeOfSymbol(symbol);
77880
+ const staticType = getTypeOfSymbol(classSymbol);
77833
77881
  const baseTypeNode = getEffectiveBaseTypeNode(node);
77834
77882
  const baseTypes = baseTypeNode && getBaseTypes(type);
77835
77883
  const baseWithThis = (baseTypes == null ? void 0 : baseTypes.length) ? getTypeWithThisArgument(first(baseTypes), type.thisType) : void 0;
77836
77884
  const baseStaticType = getBaseConstructorTypeOfClass(type);
77837
77885
  const memberHasOverrideModifier = member.parent ? hasOverrideModifier(member) : hasSyntacticModifier(member, 16384 /* Override */);
77838
- const memberName = unescapeLeadingUnderscores(getTextOfPropertyName(member.name));
77839
77886
  return checkMemberForOverrideModifier(
77840
77887
  node,
77841
77888
  staticType,
@@ -77848,7 +77895,7 @@ function createTypeChecker(host) {
77848
77895
  isStatic(member),
77849
77896
  /* memberIsParameterProperty */
77850
77897
  false,
77851
- memberName
77898
+ symbolName(memberSymbol)
77852
77899
  );
77853
77900
  }
77854
77901
  function getTargetSymbol(s) {