typescript 4.6.0-dev.20211117 → 4.6.0-dev.20211121

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
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.6";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20211117";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20211121";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  function tryGetNativeMap() {
@@ -108,20 +108,6 @@ var ts;
108
108
  ts.emptyArray = [];
109
109
  ts.emptyMap = new ts.Map();
110
110
  ts.emptySet = new ts.Set();
111
- function createMap() {
112
- return new ts.Map();
113
- }
114
- ts.createMap = createMap;
115
- function createMapFromTemplate(template) {
116
- var map = new ts.Map();
117
- for (var key in template) {
118
- if (hasOwnProperty.call(template, key)) {
119
- map.set(key, template[key]);
120
- }
121
- }
122
- return map;
123
- }
124
- ts.createMapFromTemplate = createMapFromTemplate;
125
111
  function length(array) {
126
112
  return array ? array.length : 0;
127
113
  }
@@ -2005,7 +1991,6 @@ var ts;
2005
1991
  return value;
2006
1992
  }
2007
1993
  Debug.checkDefined = checkDefined;
2008
- Debug.assertDefined = checkDefined;
2009
1994
  function assertEachIsDefined(value, message, stackCrawlMark) {
2010
1995
  for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
2011
1996
  var v = value_1[_i];
@@ -2018,7 +2003,6 @@ var ts;
2018
2003
  return value;
2019
2004
  }
2020
2005
  Debug.checkEachDefined = checkEachDefined;
2021
- Debug.assertEachDefined = checkEachDefined;
2022
2006
  function assertNever(member, message, stackCrawlMark) {
2023
2007
  if (message === void 0) { message = "Illegal value:"; }
2024
2008
  var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
@@ -10501,14 +10485,6 @@ var ts;
10501
10485
  return undefined;
10502
10486
  }
10503
10487
  ts.getDeclarationOfKind = getDeclarationOfKind;
10504
- function createUnderscoreEscapedMap() {
10505
- return new ts.Map();
10506
- }
10507
- ts.createUnderscoreEscapedMap = createUnderscoreEscapedMap;
10508
- function hasEntries(map) {
10509
- return !!map && !!map.size;
10510
- }
10511
- ts.hasEntries = hasEntries;
10512
10488
  function createSymbolTable(symbols) {
10513
10489
  var result = new ts.Map();
10514
10490
  if (symbols) {
@@ -21313,7 +21289,7 @@ var ts;
21313
21289
  sourceMapText = mapTextOrStripInternal;
21314
21290
  }
21315
21291
  var node = oldFileOfCurrentEmit ?
21316
- parseOldFileOfCurrentEmit(ts.Debug.assertDefined(bundleFileInfo)) :
21292
+ parseOldFileOfCurrentEmit(ts.Debug.checkDefined(bundleFileInfo)) :
21317
21293
  parseUnparsedSourceFile(bundleFileInfo, stripInternal, length);
21318
21294
  node.fileName = fileName;
21319
21295
  node.sourceMapPath = sourceMapPath;
@@ -21458,13 +21434,13 @@ var ts;
21458
21434
  };
21459
21435
  node.javascriptPath = declarationTextOrJavascriptPath;
21460
21436
  node.javascriptMapPath = javascriptMapPath;
21461
- node.declarationPath = ts.Debug.assertDefined(javascriptMapTextOrDeclarationPath);
21437
+ node.declarationPath = ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath);
21462
21438
  node.declarationMapPath = declarationMapPath;
21463
21439
  node.buildInfoPath = declarationMapTextOrBuildInfoPath;
21464
21440
  Object.defineProperties(node, {
21465
21441
  javascriptText: { get: function () { return definedTextGetter_1(declarationTextOrJavascriptPath); } },
21466
21442
  javascriptMapText: { get: function () { return textGetter_1(javascriptMapPath); } },
21467
- declarationText: { get: function () { return definedTextGetter_1(ts.Debug.assertDefined(javascriptMapTextOrDeclarationPath)); } },
21443
+ declarationText: { get: function () { return definedTextGetter_1(ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath)); } },
21468
21444
  declarationMapText: { get: function () { return textGetter_1(declarationMapPath); } },
21469
21445
  buildInfo: { get: function () { return getAndCacheBuildInfo_1(function () { return textGetter_1(declarationMapTextOrBuildInfoPath); }); } }
21470
21446
  });
@@ -42581,8 +42557,8 @@ var ts;
42581
42557
  }
42582
42558
  var expandedParams = getExpandedParameters(signature, true)[0];
42583
42559
  var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 170, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
42584
- if (signature.thisParameter) {
42585
- var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context);
42560
+ var thisParameter = tryGetThisParameterDeclaration(signature, context);
42561
+ if (thisParameter) {
42586
42562
  parameters.unshift(thisParameter);
42587
42563
  }
42588
42564
  var returnTypeNode;
@@ -42631,6 +42607,17 @@ var ts;
42631
42607
  }
42632
42608
  return node;
42633
42609
  }
42610
+ function tryGetThisParameterDeclaration(signature, context) {
42611
+ if (signature.thisParameter) {
42612
+ return symbolToParameterDeclaration(signature.thisParameter, context);
42613
+ }
42614
+ if (signature.declaration) {
42615
+ var thisTag = ts.getJSDocThisTag(signature.declaration);
42616
+ if (thisTag && thisTag.typeExpression) {
42617
+ return ts.factory.createParameterDeclaration(undefined, undefined, undefined, "this", undefined, typeToTypeNodeHelper(getTypeFromTypeNode(thisTag.typeExpression), context));
42618
+ }
42619
+ }
42620
+ }
42634
42621
  function typeParameterToDeclarationWithConstraint(type, context, constraintNode) {
42635
42622
  var savedContextFlags = context.flags;
42636
42623
  context.flags &= ~512;
@@ -43041,10 +43028,8 @@ var ts;
43041
43028
  firstChar = symbolName.charCodeAt(0);
43042
43029
  }
43043
43030
  var expression = void 0;
43044
- if (ts.isSingleOrDoubleQuote(firstChar)) {
43045
- expression = ts.factory.createStringLiteral(symbolName
43046
- .substring(1, symbolName.length - 1)
43047
- .replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39);
43031
+ if (ts.isSingleOrDoubleQuote(firstChar) && !(symbol.flags & 8)) {
43032
+ expression = ts.factory.createStringLiteral(ts.stripQuotes(symbolName).replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39);
43048
43033
  }
43049
43034
  else if (("" + +symbolName) === symbolName) {
43050
43035
  expression = ts.factory.createNumericLiteral(+symbolName);
@@ -78595,7 +78580,7 @@ var ts;
78595
78580
  function visitYieldExpression(node) {
78596
78581
  if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) {
78597
78582
  if (node.asteriskToken) {
78598
- var expression = ts.visitNode(ts.Debug.assertDefined(node.expression), visitor, ts.isExpression);
78583
+ var expression = ts.visitNode(ts.Debug.checkDefined(node.expression), visitor, ts.isExpression);
78599
78584
  return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(undefined, emitHelpers().createAwaitHelper(factory.updateYieldExpression(node, node.asteriskToken, ts.setTextRange(emitHelpers().createAsyncDelegatorHelper(ts.setTextRange(emitHelpers().createAsyncValuesHelper(expression), expression)), expression)))), node), node);
78600
78585
  }
78601
78586
  return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(undefined, createDownlevelAwait(node.expression
@@ -79393,11 +79378,11 @@ var ts;
79393
79378
  return existing.name;
79394
79379
  }
79395
79380
  if (!currentFileState.utilizedImplicitRuntimeImports) {
79396
- currentFileState.utilizedImplicitRuntimeImports = ts.createMap();
79381
+ currentFileState.utilizedImplicitRuntimeImports = new ts.Map();
79397
79382
  }
79398
79383
  var specifierSourceImports = currentFileState.utilizedImplicitRuntimeImports.get(importSource);
79399
79384
  if (!specifierSourceImports) {
79400
- specifierSourceImports = ts.createMap();
79385
+ specifierSourceImports = new ts.Map();
79401
79386
  currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports);
79402
79387
  }
79403
79388
  var generatedName = factory.createUniqueName("_" + name, 16 | 32 | 64);
@@ -93675,6 +93660,23 @@ var ts;
93675
93660
  }
93676
93661
  }
93677
93662
  ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
93663
+ ts.plainJSErrors = new ts.Set([
93664
+ ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
93665
+ ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
93666
+ ts.Diagnostics.Another_export_default_is_here.code,
93667
+ ts.Diagnostics.The_first_export_default_is_here.code,
93668
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
93669
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
93670
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
93671
+ ts.Diagnostics.constructor_is_a_reserved_word.code,
93672
+ ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode.code,
93673
+ ts.Diagnostics.Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode.code,
93674
+ ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
93675
+ ts.Diagnostics.Invalid_use_of_0_in_strict_mode.code,
93676
+ ts.Diagnostics.A_label_is_not_allowed_here.code,
93677
+ ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
93678
+ ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
93679
+ ]);
93678
93680
  function shouldProgramCreateNewSourceFiles(program, newOptions) {
93679
93681
  if (!program)
93680
93682
  return false;
@@ -94217,6 +94219,7 @@ var ts;
94217
94219
  newSourceFile.originalFileName = oldSourceFile.originalFileName;
94218
94220
  newSourceFile.resolvedPath = oldSourceFile.resolvedPath;
94219
94221
  newSourceFile.fileName = oldSourceFile.fileName;
94222
+ newSourceFile.impliedNodeFormat = oldSourceFile.impliedNodeFormat;
94220
94223
  var packageName = oldProgram.sourceFileToPackageName.get(oldSourceFile.path);
94221
94224
  if (packageName !== undefined) {
94222
94225
  var prevKind = seenPackageNames.get(packageName);
@@ -94521,13 +94524,18 @@ var ts;
94521
94524
  }
94522
94525
  var typeChecker = getDiagnosticsProducingTypeChecker();
94523
94526
  ts.Debug.assert(!!sourceFile.bindDiagnostics);
94524
- var isCheckJs = ts.isCheckJsEnabledForFile(sourceFile, options);
94527
+ var isJs = sourceFile.scriptKind === 1 || sourceFile.scriptKind === 2;
94528
+ var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
94529
+ var isPlainJs = isJs && !sourceFile.checkJsDirective && options.checkJs === undefined;
94525
94530
  var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
94526
94531
  var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 || sourceFile.scriptKind === 4
94527
- || sourceFile.scriptKind === 5 || isCheckJs || sourceFile.scriptKind === 7);
94532
+ || sourceFile.scriptKind === 5 || isPlainJs || isCheckJs || sourceFile.scriptKind === 7);
94528
94533
  var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
94529
- var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
94530
- return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
94534
+ var checkDiagnostics = includeBindAndCheckDiagnostics && !isPlainJs ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
94535
+ if (isPlainJs) {
94536
+ bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
94537
+ }
94538
+ return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
94531
94539
  });
94532
94540
  }
94533
94541
  function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics) {
@@ -97910,7 +97918,7 @@ var ts;
97910
97918
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
97911
97919
  if (resolution.refCount) {
97912
97920
  resolution.refCount++;
97913
- ts.Debug.assertDefined(resolution.files);
97921
+ ts.Debug.assertIsDefined(resolution.files);
97914
97922
  }
97915
97923
  else {
97916
97924
  resolution.refCount = 1;
@@ -97975,7 +97983,7 @@ var ts;
97975
97983
  }
97976
97984
  }
97977
97985
  function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
97978
- ts.unorderedRemoveItem(ts.Debug.assertDefined(resolution.files), filePath);
97986
+ ts.unorderedRemoveItem(ts.Debug.checkDefined(resolution.files), filePath);
97979
97987
  resolution.refCount--;
97980
97988
  if (resolution.refCount) {
97981
97989
  return;
@@ -98061,7 +98069,7 @@ var ts;
98061
98069
  if (resolution.isInvalidated || !canInvalidate(resolution))
98062
98070
  continue;
98063
98071
  resolution.isInvalidated = invalidated = true;
98064
- for (var _a = 0, _b = ts.Debug.assertDefined(resolution.files); _a < _b.length; _a++) {
98072
+ for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
98065
98073
  var containingFilePath = _b[_a];
98066
98074
  (filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
98067
98075
  hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts.endsWith(containingFilePath, ts.inferredTypesContainingFile);
package/lib/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-dev.20211117";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20211121";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -162,26 +162,6 @@ var ts;
162
162
  ts.emptyArray = [];
163
163
  ts.emptyMap = new ts.Map();
164
164
  ts.emptySet = new ts.Set();
165
- function createMap() {
166
- return new ts.Map();
167
- }
168
- ts.createMap = createMap;
169
- /**
170
- * Create a new map from a template object is provided, the map will copy entries from it.
171
- * @deprecated Use `new Map(getEntries(template))` instead.
172
- */
173
- function createMapFromTemplate(template) {
174
- var map = new ts.Map();
175
- // Copies keys/values from template. Note that for..in will not throw if
176
- // template is undefined, and instead will just exit the loop.
177
- for (var key in template) {
178
- if (hasOwnProperty.call(template, key)) {
179
- map.set(key, template[key]);
180
- }
181
- }
182
- return map;
183
- }
184
- ts.createMapFromTemplate = createMapFromTemplate;
185
165
  function length(array) {
186
166
  return array ? array.length : 0;
187
167
  }
@@ -2416,11 +2396,6 @@ var ts;
2416
2396
  return value;
2417
2397
  }
2418
2398
  Debug.checkDefined = checkDefined;
2419
- /**
2420
- * @deprecated Use `checkDefined` to check whether a value is defined inline. Use `assertIsDefined` to check whether
2421
- * a value is defined at the statement level.
2422
- */
2423
- Debug.assertDefined = checkDefined;
2424
2399
  function assertEachIsDefined(value, message, stackCrawlMark) {
2425
2400
  for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
2426
2401
  var v = value_1[_i];
@@ -2433,11 +2408,6 @@ var ts;
2433
2408
  return value;
2434
2409
  }
2435
2410
  Debug.checkEachDefined = checkEachDefined;
2436
- /**
2437
- * @deprecated Use `checkEachDefined` to check whether the elements of an array are defined inline. Use `assertEachIsDefined` to check whether
2438
- * the elements of an array are defined at the statement level.
2439
- */
2440
- Debug.assertEachDefined = checkEachDefined;
2441
2411
  function assertNever(member, message, stackCrawlMark) {
2442
2412
  if (message === void 0) { message = "Illegal value:"; }
2443
2413
  var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
@@ -13897,21 +13867,6 @@ var ts;
13897
13867
  return undefined;
13898
13868
  }
13899
13869
  ts.getDeclarationOfKind = getDeclarationOfKind;
13900
- /**
13901
- * Create a new escaped identifier map.
13902
- * @deprecated Use `new Map<__String, T>()` instead.
13903
- */
13904
- function createUnderscoreEscapedMap() {
13905
- return new ts.Map();
13906
- }
13907
- ts.createUnderscoreEscapedMap = createUnderscoreEscapedMap;
13908
- /**
13909
- * @deprecated Use `!!map?.size` instead
13910
- */
13911
- function hasEntries(map) {
13912
- return !!map && !!map.size;
13913
- }
13914
- ts.hasEntries = hasEntries;
13915
13870
  function createSymbolTable(symbols) {
13916
13871
  var result = new ts.Map();
13917
13872
  if (symbols) {
@@ -26504,7 +26459,7 @@ var ts;
26504
26459
  sourceMapText = mapTextOrStripInternal;
26505
26460
  }
26506
26461
  var node = oldFileOfCurrentEmit ?
26507
- parseOldFileOfCurrentEmit(ts.Debug.assertDefined(bundleFileInfo)) :
26462
+ parseOldFileOfCurrentEmit(ts.Debug.checkDefined(bundleFileInfo)) :
26508
26463
  parseUnparsedSourceFile(bundleFileInfo, stripInternal, length);
26509
26464
  node.fileName = fileName;
26510
26465
  node.sourceMapPath = sourceMapPath;
@@ -26651,13 +26606,13 @@ var ts;
26651
26606
  };
26652
26607
  node.javascriptPath = declarationTextOrJavascriptPath;
26653
26608
  node.javascriptMapPath = javascriptMapPath;
26654
- node.declarationPath = ts.Debug.assertDefined(javascriptMapTextOrDeclarationPath);
26609
+ node.declarationPath = ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath);
26655
26610
  node.declarationMapPath = declarationMapPath;
26656
26611
  node.buildInfoPath = declarationMapTextOrBuildInfoPath;
26657
26612
  Object.defineProperties(node, {
26658
26613
  javascriptText: { get: function () { return definedTextGetter_1(declarationTextOrJavascriptPath); } },
26659
26614
  javascriptMapText: { get: function () { return textGetter_1(javascriptMapPath); } },
26660
- declarationText: { get: function () { return definedTextGetter_1(ts.Debug.assertDefined(javascriptMapTextOrDeclarationPath)); } },
26615
+ declarationText: { get: function () { return definedTextGetter_1(ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath)); } },
26661
26616
  declarationMapText: { get: function () { return textGetter_1(declarationMapPath); } },
26662
26617
  buildInfo: { get: function () { return getAndCacheBuildInfo_1(function () { return textGetter_1(declarationMapTextOrBuildInfoPath); }); } }
26663
26618
  });
@@ -51666,8 +51621,8 @@ var ts;
51666
51621
  var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
51667
51622
  // If the expanded parameter list had a variadic in a non-trailing position, don't expand it
51668
51623
  var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 170 /* Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
51669
- if (signature.thisParameter) {
51670
- var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context);
51624
+ var thisParameter = tryGetThisParameterDeclaration(signature, context);
51625
+ if (thisParameter) {
51671
51626
  parameters.unshift(thisParameter);
51672
51627
  }
51673
51628
  var returnTypeNode;
@@ -51716,6 +51671,21 @@ var ts;
51716
51671
  }
51717
51672
  return node;
51718
51673
  }
51674
+ function tryGetThisParameterDeclaration(signature, context) {
51675
+ if (signature.thisParameter) {
51676
+ return symbolToParameterDeclaration(signature.thisParameter, context);
51677
+ }
51678
+ if (signature.declaration) {
51679
+ var thisTag = ts.getJSDocThisTag(signature.declaration);
51680
+ if (thisTag && thisTag.typeExpression) {
51681
+ return ts.factory.createParameterDeclaration(
51682
+ /* decorators */ undefined,
51683
+ /* modifiers */ undefined,
51684
+ /* dotDotDotToken */ undefined, "this",
51685
+ /* questionToken */ undefined, typeToTypeNodeHelper(getTypeFromTypeNode(thisTag.typeExpression), context));
51686
+ }
51687
+ }
51688
+ }
51719
51689
  function typeParameterToDeclarationWithConstraint(type, context, constraintNode) {
51720
51690
  var savedContextFlags = context.flags;
51721
51691
  context.flags &= ~512 /* WriteTypeParametersInQualifiedName */; // Avoids potential infinite loop when building for a claimspace with a generic
@@ -52157,10 +52127,8 @@ var ts;
52157
52127
  firstChar = symbolName.charCodeAt(0);
52158
52128
  }
52159
52129
  var expression = void 0;
52160
- if (ts.isSingleOrDoubleQuote(firstChar)) {
52161
- expression = ts.factory.createStringLiteral(symbolName
52162
- .substring(1, symbolName.length - 1)
52163
- .replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39 /* singleQuote */);
52130
+ if (ts.isSingleOrDoubleQuote(firstChar) && !(symbol.flags & 8 /* EnumMember */)) {
52131
+ expression = ts.factory.createStringLiteral(ts.stripQuotes(symbolName).replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39 /* singleQuote */);
52164
52132
  }
52165
52133
  else if (("" + +symbolName) === symbolName) {
52166
52134
  expression = ts.factory.createNumericLiteral(+symbolName);
@@ -94153,7 +94121,7 @@ var ts;
94153
94121
  function visitYieldExpression(node) {
94154
94122
  if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) {
94155
94123
  if (node.asteriskToken) {
94156
- var expression = ts.visitNode(ts.Debug.assertDefined(node.expression), visitor, ts.isExpression);
94124
+ var expression = ts.visitNode(ts.Debug.checkDefined(node.expression), visitor, ts.isExpression);
94157
94125
  return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(
94158
94126
  /*asteriskToken*/ undefined, emitHelpers().createAwaitHelper(factory.updateYieldExpression(node, node.asteriskToken, ts.setTextRange(emitHelpers().createAsyncDelegatorHelper(ts.setTextRange(emitHelpers().createAsyncValuesHelper(expression), expression)), expression)))), node), node);
94159
94127
  }
@@ -95078,11 +95046,11 @@ var ts;
95078
95046
  return existing.name;
95079
95047
  }
95080
95048
  if (!currentFileState.utilizedImplicitRuntimeImports) {
95081
- currentFileState.utilizedImplicitRuntimeImports = ts.createMap();
95049
+ currentFileState.utilizedImplicitRuntimeImports = new ts.Map();
95082
95050
  }
95083
95051
  var specifierSourceImports = currentFileState.utilizedImplicitRuntimeImports.get(importSource);
95084
95052
  if (!specifierSourceImports) {
95085
- specifierSourceImports = ts.createMap();
95053
+ specifierSourceImports = new ts.Map();
95086
95054
  currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports);
95087
95055
  }
95088
95056
  var generatedName = factory.createUniqueName("_" + name, 16 /* Optimistic */ | 32 /* FileLevel */ | 64 /* AllowNameSubstitution */);
@@ -113609,6 +113577,24 @@ var ts;
113609
113577
  }
113610
113578
  }
113611
113579
  ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
113580
+ /** @internal */
113581
+ ts.plainJSErrors = new ts.Set([
113582
+ ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
113583
+ ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
113584
+ ts.Diagnostics.Another_export_default_is_here.code,
113585
+ ts.Diagnostics.The_first_export_default_is_here.code,
113586
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
113587
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
113588
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
113589
+ ts.Diagnostics.constructor_is_a_reserved_word.code,
113590
+ ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode.code,
113591
+ ts.Diagnostics.Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode.code,
113592
+ ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
113593
+ ts.Diagnostics.Invalid_use_of_0_in_strict_mode.code,
113594
+ ts.Diagnostics.A_label_is_not_allowed_here.code,
113595
+ ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
113596
+ ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
113597
+ ]);
113612
113598
  /**
113613
113599
  * Determine if source file needs to be re-created even if its text hasn't changed
113614
113600
  */
@@ -114269,6 +114255,7 @@ var ts;
114269
114255
  newSourceFile.originalFileName = oldSourceFile.originalFileName;
114270
114256
  newSourceFile.resolvedPath = oldSourceFile.resolvedPath;
114271
114257
  newSourceFile.fileName = oldSourceFile.fileName;
114258
+ newSourceFile.impliedNodeFormat = oldSourceFile.impliedNodeFormat;
114272
114259
  var packageName = oldProgram.sourceFileToPackageName.get(oldSourceFile.path);
114273
114260
  if (packageName !== undefined) {
114274
114261
  // If there are 2 different source files for the same package name and at least one of them changes,
@@ -114625,14 +114612,23 @@ var ts;
114625
114612
  }
114626
114613
  var typeChecker = getDiagnosticsProducingTypeChecker();
114627
114614
  ts.Debug.assert(!!sourceFile.bindDiagnostics);
114628
- var isCheckJs = ts.isCheckJsEnabledForFile(sourceFile, options);
114615
+ var isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
114616
+ var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
114617
+ var isPlainJs = isJs && !sourceFile.checkJsDirective && options.checkJs === undefined;
114629
114618
  var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
114630
- // By default, only type-check .ts, .tsx, 'Deferred' and 'External' files (external files are added by plugins)
114619
+ // By default, only type-check .ts, .tsx, Deferred, plain JS, checked JS and External
114620
+ // - plain JS: .js files with no // ts-check and checkJs: undefined
114621
+ // - check JS: .js files with either // ts-check or checkJs: true
114622
+ // - external: files that are added by plugins
114631
114623
  var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */
114632
- || sourceFile.scriptKind === 5 /* External */ || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
114624
+ || sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
114633
114625
  var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
114634
- var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
114635
- return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
114626
+ var checkDiagnostics = includeBindAndCheckDiagnostics && !isPlainJs ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
114627
+ if (isPlainJs) {
114628
+ bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
114629
+ }
114630
+ // skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS
114631
+ return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
114636
114632
  });
114637
114633
  }
114638
114634
  function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics) {
@@ -118541,7 +118537,7 @@ var ts;
118541
118537
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
118542
118538
  if (resolution.refCount) {
118543
118539
  resolution.refCount++;
118544
- ts.Debug.assertDefined(resolution.files);
118540
+ ts.Debug.assertIsDefined(resolution.files);
118545
118541
  }
118546
118542
  else {
118547
118543
  resolution.refCount = 1;
@@ -118609,7 +118605,7 @@ var ts;
118609
118605
  }
118610
118606
  }
118611
118607
  function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
118612
- ts.unorderedRemoveItem(ts.Debug.assertDefined(resolution.files), filePath);
118608
+ ts.unorderedRemoveItem(ts.Debug.checkDefined(resolution.files), filePath);
118613
118609
  resolution.refCount--;
118614
118610
  if (resolution.refCount) {
118615
118611
  return;
@@ -118701,7 +118697,7 @@ var ts;
118701
118697
  if (resolution.isInvalidated || !canInvalidate(resolution))
118702
118698
  continue;
118703
118699
  resolution.isInvalidated = invalidated = true;
118704
- for (var _a = 0, _b = ts.Debug.assertDefined(resolution.files); _a < _b.length; _a++) {
118700
+ for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
118705
118701
  var containingFilePath = _b[_a];
118706
118702
  (filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
118707
118703
  // When its a file with inferred types resolution, invalidate type reference directive resolution
@@ -135589,14 +135585,17 @@ var ts;
135589
135585
  if (node === sourceFile) {
135590
135586
  return undefined;
135591
135587
  }
135592
- var symbol = typeChecker.getSymbolAtLocation(node);
135588
+ var symbol = getSymbol(node, typeChecker);
135593
135589
  if (!symbol)
135594
135590
  return undefined;
135595
135591
  var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
135596
135592
  var returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
135597
135593
  var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node);
135598
135594
  // If a function returns 'void' or some other type with no definition, just return the function definition.
135599
- return fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
135595
+ var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
135596
+ return typeDefinitions.length ? typeDefinitions
135597
+ : !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node)
135598
+ : undefined;
135600
135599
  }
135601
135600
  GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
135602
135601
  function definitionFromType(type, checker, node) {
@@ -149489,9 +149488,9 @@ var ts;
149489
149488
  if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
149490
149489
  return undefined;
149491
149490
  if (!ts.isSourceFile(ts.getThisContainer(fn, /*includeArrowFunctions*/ false))) { // 'this' is defined outside, convert to arrow function
149492
- var fnKeyword = ts.Debug.assertDefined(ts.findChildOfKind(fn, 98 /* FunctionKeyword */, sourceFile));
149491
+ var fnKeyword = ts.Debug.checkDefined(ts.findChildOfKind(fn, 98 /* FunctionKeyword */, sourceFile));
149493
149492
  var name = fn.name;
149494
- var body = ts.Debug.assertDefined(fn.body); // Should be defined because the function contained a 'this' expression
149493
+ var body = ts.Debug.checkDefined(fn.body); // Should be defined because the function contained a 'this' expression
149495
149494
  if (ts.isFunctionExpression(fn)) {
149496
149495
  if (name && ts.FindAllReferences.Core.isSymbolReferencedInFile(name, checker, sourceFile, body)) {
149497
149496
  // Function expression references itself. To fix we would have to extract it to a const.
@@ -171917,7 +171916,7 @@ var ts;
171917
171916
  Session.prototype.getFullNavigateToItems = function (args) {
171918
171917
  var currentFileOnly = args.currentFileOnly, searchValue = args.searchValue, maxResultCount = args.maxResultCount, projectFileName = args.projectFileName;
171919
171918
  if (currentFileOnly) {
171920
- ts.Debug.assertDefined(args.file);
171919
+ ts.Debug.assertIsDefined(args.file);
171921
171920
  var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
171922
171921
  return [{ project: project, result: project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, file) }];
171923
171922
  }
@@ -897,7 +897,7 @@ declare namespace ts {
897
897
  export interface TypePredicateNode extends TypeNode {
898
898
  readonly kind: SyntaxKind.TypePredicate;
899
899
  readonly parent: SignatureDeclaration | JSDocTypeExpression;
900
- readonly assertsModifier?: AssertsToken;
900
+ readonly assertsModifier?: AssertsKeyword;
901
901
  readonly parameterName: Identifier | ThisTypeNode;
902
902
  readonly type?: TypeNode;
903
903
  }
@@ -968,7 +968,7 @@ declare namespace ts {
968
968
  }
969
969
  export interface MappedTypeNode extends TypeNode, Declaration {
970
970
  readonly kind: SyntaxKind.MappedType;
971
- readonly readonlyToken?: ReadonlyToken | PlusToken | MinusToken;
971
+ readonly readonlyToken?: ReadonlyKeyword | PlusToken | MinusToken;
972
972
  readonly typeParameter: TypeParameterDeclaration;
973
973
  readonly nameType?: TypeNode;
974
974
  readonly questionToken?: QuestionToken | PlusToken | MinusToken;
@@ -1465,7 +1465,7 @@ declare namespace ts {
1465
1465
  }
1466
1466
  export interface ForOfStatement extends IterationStatement {
1467
1467
  readonly kind: SyntaxKind.ForOfStatement;
1468
- readonly awaitModifier?: AwaitKeywordToken;
1468
+ readonly awaitModifier?: AwaitKeyword;
1469
1469
  readonly initializer: ForInitializer;
1470
1470
  readonly expression: Expression;
1471
1471
  }