typescript 4.6.0-dev.20211118 → 4.6.0-dev.20211122

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.
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20211118";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20211122";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -356,26 +356,6 @@ var ts;
356
356
  ts.emptyArray = [];
357
357
  ts.emptyMap = new ts.Map();
358
358
  ts.emptySet = new ts.Set();
359
- function createMap() {
360
- return new ts.Map();
361
- }
362
- ts.createMap = createMap;
363
- /**
364
- * Create a new map from a template object is provided, the map will copy entries from it.
365
- * @deprecated Use `new Map(getEntries(template))` instead.
366
- */
367
- function createMapFromTemplate(template) {
368
- var map = new ts.Map();
369
- // Copies keys/values from template. Note that for..in will not throw if
370
- // template is undefined, and instead will just exit the loop.
371
- for (var key in template) {
372
- if (hasOwnProperty.call(template, key)) {
373
- map.set(key, template[key]);
374
- }
375
- }
376
- return map;
377
- }
378
- ts.createMapFromTemplate = createMapFromTemplate;
379
359
  function length(array) {
380
360
  return array ? array.length : 0;
381
361
  }
@@ -2610,11 +2590,6 @@ var ts;
2610
2590
  return value;
2611
2591
  }
2612
2592
  Debug.checkDefined = checkDefined;
2613
- /**
2614
- * @deprecated Use `checkDefined` to check whether a value is defined inline. Use `assertIsDefined` to check whether
2615
- * a value is defined at the statement level.
2616
- */
2617
- Debug.assertDefined = checkDefined;
2618
2593
  function assertEachIsDefined(value, message, stackCrawlMark) {
2619
2594
  for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
2620
2595
  var v = value_1[_i];
@@ -2627,11 +2602,6 @@ var ts;
2627
2602
  return value;
2628
2603
  }
2629
2604
  Debug.checkEachDefined = checkEachDefined;
2630
- /**
2631
- * @deprecated Use `checkEachDefined` to check whether the elements of an array are defined inline. Use `assertEachIsDefined` to check whether
2632
- * the elements of an array are defined at the statement level.
2633
- */
2634
- Debug.assertEachDefined = checkEachDefined;
2635
2605
  function assertNever(member, message, stackCrawlMark) {
2636
2606
  if (message === void 0) { message = "Illegal value:"; }
2637
2607
  var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
@@ -14091,21 +14061,6 @@ var ts;
14091
14061
  return undefined;
14092
14062
  }
14093
14063
  ts.getDeclarationOfKind = getDeclarationOfKind;
14094
- /**
14095
- * Create a new escaped identifier map.
14096
- * @deprecated Use `new Map<__String, T>()` instead.
14097
- */
14098
- function createUnderscoreEscapedMap() {
14099
- return new ts.Map();
14100
- }
14101
- ts.createUnderscoreEscapedMap = createUnderscoreEscapedMap;
14102
- /**
14103
- * @deprecated Use `!!map?.size` instead
14104
- */
14105
- function hasEntries(map) {
14106
- return !!map && !!map.size;
14107
- }
14108
- ts.hasEntries = hasEntries;
14109
14064
  function createSymbolTable(symbols) {
14110
14065
  var result = new ts.Map();
14111
14066
  if (symbols) {
@@ -26698,7 +26653,7 @@ var ts;
26698
26653
  sourceMapText = mapTextOrStripInternal;
26699
26654
  }
26700
26655
  var node = oldFileOfCurrentEmit ?
26701
- parseOldFileOfCurrentEmit(ts.Debug.assertDefined(bundleFileInfo)) :
26656
+ parseOldFileOfCurrentEmit(ts.Debug.checkDefined(bundleFileInfo)) :
26702
26657
  parseUnparsedSourceFile(bundleFileInfo, stripInternal, length);
26703
26658
  node.fileName = fileName;
26704
26659
  node.sourceMapPath = sourceMapPath;
@@ -26845,13 +26800,13 @@ var ts;
26845
26800
  };
26846
26801
  node.javascriptPath = declarationTextOrJavascriptPath;
26847
26802
  node.javascriptMapPath = javascriptMapPath;
26848
- node.declarationPath = ts.Debug.assertDefined(javascriptMapTextOrDeclarationPath);
26803
+ node.declarationPath = ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath);
26849
26804
  node.declarationMapPath = declarationMapPath;
26850
26805
  node.buildInfoPath = declarationMapTextOrBuildInfoPath;
26851
26806
  Object.defineProperties(node, {
26852
26807
  javascriptText: { get: function () { return definedTextGetter_1(declarationTextOrJavascriptPath); } },
26853
26808
  javascriptMapText: { get: function () { return textGetter_1(javascriptMapPath); } },
26854
- declarationText: { get: function () { return definedTextGetter_1(ts.Debug.assertDefined(javascriptMapTextOrDeclarationPath)); } },
26809
+ declarationText: { get: function () { return definedTextGetter_1(ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath)); } },
26855
26810
  declarationMapText: { get: function () { return textGetter_1(declarationMapPath); } },
26856
26811
  buildInfo: { get: function () { return getAndCacheBuildInfo_1(function () { return textGetter_1(declarationMapTextOrBuildInfoPath); }); } }
26857
26812
  });
@@ -52366,10 +52321,8 @@ var ts;
52366
52321
  firstChar = symbolName.charCodeAt(0);
52367
52322
  }
52368
52323
  var expression = void 0;
52369
- if (ts.isSingleOrDoubleQuote(firstChar)) {
52370
- expression = ts.factory.createStringLiteral(symbolName
52371
- .substring(1, symbolName.length - 1)
52372
- .replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39 /* singleQuote */);
52324
+ if (ts.isSingleOrDoubleQuote(firstChar) && !(symbol.flags & 8 /* EnumMember */)) {
52325
+ expression = ts.factory.createStringLiteral(ts.stripQuotes(symbolName).replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39 /* singleQuote */);
52373
52326
  }
52374
52327
  else if (("" + +symbolName) === symbolName) {
52375
52328
  expression = ts.factory.createNumericLiteral(+symbolName);
@@ -94362,7 +94315,7 @@ var ts;
94362
94315
  function visitYieldExpression(node) {
94363
94316
  if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) {
94364
94317
  if (node.asteriskToken) {
94365
- var expression = ts.visitNode(ts.Debug.assertDefined(node.expression), visitor, ts.isExpression);
94318
+ var expression = ts.visitNode(ts.Debug.checkDefined(node.expression), visitor, ts.isExpression);
94366
94319
  return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(
94367
94320
  /*asteriskToken*/ undefined, emitHelpers().createAwaitHelper(factory.updateYieldExpression(node, node.asteriskToken, ts.setTextRange(emitHelpers().createAsyncDelegatorHelper(ts.setTextRange(emitHelpers().createAsyncValuesHelper(expression), expression)), expression)))), node), node);
94368
94321
  }
@@ -95287,11 +95240,11 @@ var ts;
95287
95240
  return existing.name;
95288
95241
  }
95289
95242
  if (!currentFileState.utilizedImplicitRuntimeImports) {
95290
- currentFileState.utilizedImplicitRuntimeImports = ts.createMap();
95243
+ currentFileState.utilizedImplicitRuntimeImports = new ts.Map();
95291
95244
  }
95292
95245
  var specifierSourceImports = currentFileState.utilizedImplicitRuntimeImports.get(importSource);
95293
95246
  if (!specifierSourceImports) {
95294
- specifierSourceImports = ts.createMap();
95247
+ specifierSourceImports = new ts.Map();
95295
95248
  currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports);
95296
95249
  }
95297
95250
  var generatedName = factory.createUniqueName("_" + name, 16 /* Optimistic */ | 32 /* FileLevel */ | 64 /* AllowNameSubstitution */);
@@ -113818,6 +113771,24 @@ var ts;
113818
113771
  }
113819
113772
  }
113820
113773
  ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
113774
+ /** @internal */
113775
+ ts.plainJSErrors = new ts.Set([
113776
+ ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
113777
+ ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
113778
+ ts.Diagnostics.Another_export_default_is_here.code,
113779
+ ts.Diagnostics.The_first_export_default_is_here.code,
113780
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
113781
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
113782
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
113783
+ ts.Diagnostics.constructor_is_a_reserved_word.code,
113784
+ ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode.code,
113785
+ 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,
113786
+ ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
113787
+ ts.Diagnostics.Invalid_use_of_0_in_strict_mode.code,
113788
+ ts.Diagnostics.A_label_is_not_allowed_here.code,
113789
+ ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
113790
+ ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
113791
+ ]);
113821
113792
  /**
113822
113793
  * Determine if source file needs to be re-created even if its text hasn't changed
113823
113794
  */
@@ -114835,14 +114806,23 @@ var ts;
114835
114806
  }
114836
114807
  var typeChecker = getDiagnosticsProducingTypeChecker();
114837
114808
  ts.Debug.assert(!!sourceFile.bindDiagnostics);
114838
- var isCheckJs = ts.isCheckJsEnabledForFile(sourceFile, options);
114809
+ var isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
114810
+ var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
114811
+ var isPlainJs = isJs && !sourceFile.checkJsDirective && options.checkJs === undefined;
114839
114812
  var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
114840
- // By default, only type-check .ts, .tsx, 'Deferred' and 'External' files (external files are added by plugins)
114813
+ // By default, only type-check .ts, .tsx, Deferred, plain JS, checked JS and External
114814
+ // - plain JS: .js files with no // ts-check and checkJs: undefined
114815
+ // - check JS: .js files with either // ts-check or checkJs: true
114816
+ // - external: files that are added by plugins
114841
114817
  var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */
114842
- || sourceFile.scriptKind === 5 /* External */ || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
114818
+ || sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
114843
114819
  var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
114844
- var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
114845
- return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
114820
+ var checkDiagnostics = includeBindAndCheckDiagnostics && !isPlainJs ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
114821
+ if (isPlainJs) {
114822
+ bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
114823
+ }
114824
+ // skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS
114825
+ return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
114846
114826
  });
114847
114827
  }
114848
114828
  function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics) {
@@ -118751,7 +118731,7 @@ var ts;
118751
118731
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
118752
118732
  if (resolution.refCount) {
118753
118733
  resolution.refCount++;
118754
- ts.Debug.assertDefined(resolution.files);
118734
+ ts.Debug.assertIsDefined(resolution.files);
118755
118735
  }
118756
118736
  else {
118757
118737
  resolution.refCount = 1;
@@ -118819,7 +118799,7 @@ var ts;
118819
118799
  }
118820
118800
  }
118821
118801
  function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
118822
- ts.unorderedRemoveItem(ts.Debug.assertDefined(resolution.files), filePath);
118802
+ ts.unorderedRemoveItem(ts.Debug.checkDefined(resolution.files), filePath);
118823
118803
  resolution.refCount--;
118824
118804
  if (resolution.refCount) {
118825
118805
  return;
@@ -118911,7 +118891,7 @@ var ts;
118911
118891
  if (resolution.isInvalidated || !canInvalidate(resolution))
118912
118892
  continue;
118913
118893
  resolution.isInvalidated = invalidated = true;
118914
- for (var _a = 0, _b = ts.Debug.assertDefined(resolution.files); _a < _b.length; _a++) {
118894
+ for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
118915
118895
  var containingFilePath = _b[_a];
118916
118896
  (filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
118917
118897
  // When its a file with inferred types resolution, invalidate type reference directive resolution
@@ -136187,14 +136167,17 @@ var ts;
136187
136167
  if (node === sourceFile) {
136188
136168
  return undefined;
136189
136169
  }
136190
- var symbol = typeChecker.getSymbolAtLocation(node);
136170
+ var symbol = getSymbol(node, typeChecker);
136191
136171
  if (!symbol)
136192
136172
  return undefined;
136193
136173
  var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
136194
136174
  var returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
136195
136175
  var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node);
136196
136176
  // If a function returns 'void' or some other type with no definition, just return the function definition.
136197
- return fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
136177
+ var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
136178
+ return typeDefinitions.length ? typeDefinitions
136179
+ : !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node)
136180
+ : undefined;
136198
136181
  }
136199
136182
  GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
136200
136183
  function definitionFromType(type, checker, node) {
@@ -150087,9 +150070,9 @@ var ts;
150087
150070
  if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
150088
150071
  return undefined;
150089
150072
  if (!ts.isSourceFile(ts.getThisContainer(fn, /*includeArrowFunctions*/ false))) { // 'this' is defined outside, convert to arrow function
150090
- var fnKeyword = ts.Debug.assertDefined(ts.findChildOfKind(fn, 98 /* FunctionKeyword */, sourceFile));
150073
+ var fnKeyword = ts.Debug.checkDefined(ts.findChildOfKind(fn, 98 /* FunctionKeyword */, sourceFile));
150091
150074
  var name = fn.name;
150092
- var body = ts.Debug.assertDefined(fn.body); // Should be defined because the function contained a 'this' expression
150075
+ var body = ts.Debug.checkDefined(fn.body); // Should be defined because the function contained a 'this' expression
150093
150076
  if (ts.isFunctionExpression(fn)) {
150094
150077
  if (name && ts.FindAllReferences.Core.isSymbolReferencedInFile(name, checker, sourceFile, body)) {
150095
150078
  // Function expression references itself. To fix we would have to extract it to a const.
@@ -172127,7 +172110,7 @@ var ts;
172127
172110
  Session.prototype.getFullNavigateToItems = function (args) {
172128
172111
  var currentFileOnly = args.currentFileOnly, searchValue = args.searchValue, maxResultCount = args.maxResultCount, projectFileName = args.projectFileName;
172129
172112
  if (currentFileOnly) {
172130
- ts.Debug.assertDefined(args.file);
172113
+ ts.Debug.assertIsDefined(args.file);
172131
172114
  var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
172132
172115
  return [{ project: project, result: project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, file) }];
172133
172116
  }
@@ -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
  }
package/lib/typescript.js CHANGED
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20211118";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20211122";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -356,26 +356,6 @@ var ts;
356
356
  ts.emptyArray = [];
357
357
  ts.emptyMap = new ts.Map();
358
358
  ts.emptySet = new ts.Set();
359
- function createMap() {
360
- return new ts.Map();
361
- }
362
- ts.createMap = createMap;
363
- /**
364
- * Create a new map from a template object is provided, the map will copy entries from it.
365
- * @deprecated Use `new Map(getEntries(template))` instead.
366
- */
367
- function createMapFromTemplate(template) {
368
- var map = new ts.Map();
369
- // Copies keys/values from template. Note that for..in will not throw if
370
- // template is undefined, and instead will just exit the loop.
371
- for (var key in template) {
372
- if (hasOwnProperty.call(template, key)) {
373
- map.set(key, template[key]);
374
- }
375
- }
376
- return map;
377
- }
378
- ts.createMapFromTemplate = createMapFromTemplate;
379
359
  function length(array) {
380
360
  return array ? array.length : 0;
381
361
  }
@@ -2610,11 +2590,6 @@ var ts;
2610
2590
  return value;
2611
2591
  }
2612
2592
  Debug.checkDefined = checkDefined;
2613
- /**
2614
- * @deprecated Use `checkDefined` to check whether a value is defined inline. Use `assertIsDefined` to check whether
2615
- * a value is defined at the statement level.
2616
- */
2617
- Debug.assertDefined = checkDefined;
2618
2593
  function assertEachIsDefined(value, message, stackCrawlMark) {
2619
2594
  for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
2620
2595
  var v = value_1[_i];
@@ -2627,11 +2602,6 @@ var ts;
2627
2602
  return value;
2628
2603
  }
2629
2604
  Debug.checkEachDefined = checkEachDefined;
2630
- /**
2631
- * @deprecated Use `checkEachDefined` to check whether the elements of an array are defined inline. Use `assertEachIsDefined` to check whether
2632
- * the elements of an array are defined at the statement level.
2633
- */
2634
- Debug.assertEachDefined = checkEachDefined;
2635
2605
  function assertNever(member, message, stackCrawlMark) {
2636
2606
  if (message === void 0) { message = "Illegal value:"; }
2637
2607
  var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
@@ -14091,21 +14061,6 @@ var ts;
14091
14061
  return undefined;
14092
14062
  }
14093
14063
  ts.getDeclarationOfKind = getDeclarationOfKind;
14094
- /**
14095
- * Create a new escaped identifier map.
14096
- * @deprecated Use `new Map<__String, T>()` instead.
14097
- */
14098
- function createUnderscoreEscapedMap() {
14099
- return new ts.Map();
14100
- }
14101
- ts.createUnderscoreEscapedMap = createUnderscoreEscapedMap;
14102
- /**
14103
- * @deprecated Use `!!map?.size` instead
14104
- */
14105
- function hasEntries(map) {
14106
- return !!map && !!map.size;
14107
- }
14108
- ts.hasEntries = hasEntries;
14109
14064
  function createSymbolTable(symbols) {
14110
14065
  var result = new ts.Map();
14111
14066
  if (symbols) {
@@ -26698,7 +26653,7 @@ var ts;
26698
26653
  sourceMapText = mapTextOrStripInternal;
26699
26654
  }
26700
26655
  var node = oldFileOfCurrentEmit ?
26701
- parseOldFileOfCurrentEmit(ts.Debug.assertDefined(bundleFileInfo)) :
26656
+ parseOldFileOfCurrentEmit(ts.Debug.checkDefined(bundleFileInfo)) :
26702
26657
  parseUnparsedSourceFile(bundleFileInfo, stripInternal, length);
26703
26658
  node.fileName = fileName;
26704
26659
  node.sourceMapPath = sourceMapPath;
@@ -26845,13 +26800,13 @@ var ts;
26845
26800
  };
26846
26801
  node.javascriptPath = declarationTextOrJavascriptPath;
26847
26802
  node.javascriptMapPath = javascriptMapPath;
26848
- node.declarationPath = ts.Debug.assertDefined(javascriptMapTextOrDeclarationPath);
26803
+ node.declarationPath = ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath);
26849
26804
  node.declarationMapPath = declarationMapPath;
26850
26805
  node.buildInfoPath = declarationMapTextOrBuildInfoPath;
26851
26806
  Object.defineProperties(node, {
26852
26807
  javascriptText: { get: function () { return definedTextGetter_1(declarationTextOrJavascriptPath); } },
26853
26808
  javascriptMapText: { get: function () { return textGetter_1(javascriptMapPath); } },
26854
- declarationText: { get: function () { return definedTextGetter_1(ts.Debug.assertDefined(javascriptMapTextOrDeclarationPath)); } },
26809
+ declarationText: { get: function () { return definedTextGetter_1(ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath)); } },
26855
26810
  declarationMapText: { get: function () { return textGetter_1(declarationMapPath); } },
26856
26811
  buildInfo: { get: function () { return getAndCacheBuildInfo_1(function () { return textGetter_1(declarationMapTextOrBuildInfoPath); }); } }
26857
26812
  });
@@ -52366,10 +52321,8 @@ var ts;
52366
52321
  firstChar = symbolName.charCodeAt(0);
52367
52322
  }
52368
52323
  var expression = void 0;
52369
- if (ts.isSingleOrDoubleQuote(firstChar)) {
52370
- expression = ts.factory.createStringLiteral(symbolName
52371
- .substring(1, symbolName.length - 1)
52372
- .replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39 /* singleQuote */);
52324
+ if (ts.isSingleOrDoubleQuote(firstChar) && !(symbol.flags & 8 /* EnumMember */)) {
52325
+ expression = ts.factory.createStringLiteral(ts.stripQuotes(symbolName).replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39 /* singleQuote */);
52373
52326
  }
52374
52327
  else if (("" + +symbolName) === symbolName) {
52375
52328
  expression = ts.factory.createNumericLiteral(+symbolName);
@@ -94362,7 +94315,7 @@ var ts;
94362
94315
  function visitYieldExpression(node) {
94363
94316
  if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) {
94364
94317
  if (node.asteriskToken) {
94365
- var expression = ts.visitNode(ts.Debug.assertDefined(node.expression), visitor, ts.isExpression);
94318
+ var expression = ts.visitNode(ts.Debug.checkDefined(node.expression), visitor, ts.isExpression);
94366
94319
  return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(
94367
94320
  /*asteriskToken*/ undefined, emitHelpers().createAwaitHelper(factory.updateYieldExpression(node, node.asteriskToken, ts.setTextRange(emitHelpers().createAsyncDelegatorHelper(ts.setTextRange(emitHelpers().createAsyncValuesHelper(expression), expression)), expression)))), node), node);
94368
94321
  }
@@ -95287,11 +95240,11 @@ var ts;
95287
95240
  return existing.name;
95288
95241
  }
95289
95242
  if (!currentFileState.utilizedImplicitRuntimeImports) {
95290
- currentFileState.utilizedImplicitRuntimeImports = ts.createMap();
95243
+ currentFileState.utilizedImplicitRuntimeImports = new ts.Map();
95291
95244
  }
95292
95245
  var specifierSourceImports = currentFileState.utilizedImplicitRuntimeImports.get(importSource);
95293
95246
  if (!specifierSourceImports) {
95294
- specifierSourceImports = ts.createMap();
95247
+ specifierSourceImports = new ts.Map();
95295
95248
  currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports);
95296
95249
  }
95297
95250
  var generatedName = factory.createUniqueName("_" + name, 16 /* Optimistic */ | 32 /* FileLevel */ | 64 /* AllowNameSubstitution */);
@@ -113818,6 +113771,24 @@ var ts;
113818
113771
  }
113819
113772
  }
113820
113773
  ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
113774
+ /** @internal */
113775
+ ts.plainJSErrors = new ts.Set([
113776
+ ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
113777
+ ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
113778
+ ts.Diagnostics.Another_export_default_is_here.code,
113779
+ ts.Diagnostics.The_first_export_default_is_here.code,
113780
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
113781
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
113782
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
113783
+ ts.Diagnostics.constructor_is_a_reserved_word.code,
113784
+ ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode.code,
113785
+ 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,
113786
+ ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
113787
+ ts.Diagnostics.Invalid_use_of_0_in_strict_mode.code,
113788
+ ts.Diagnostics.A_label_is_not_allowed_here.code,
113789
+ ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
113790
+ ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
113791
+ ]);
113821
113792
  /**
113822
113793
  * Determine if source file needs to be re-created even if its text hasn't changed
113823
113794
  */
@@ -114835,14 +114806,23 @@ var ts;
114835
114806
  }
114836
114807
  var typeChecker = getDiagnosticsProducingTypeChecker();
114837
114808
  ts.Debug.assert(!!sourceFile.bindDiagnostics);
114838
- var isCheckJs = ts.isCheckJsEnabledForFile(sourceFile, options);
114809
+ var isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
114810
+ var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
114811
+ var isPlainJs = isJs && !sourceFile.checkJsDirective && options.checkJs === undefined;
114839
114812
  var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
114840
- // By default, only type-check .ts, .tsx, 'Deferred' and 'External' files (external files are added by plugins)
114813
+ // By default, only type-check .ts, .tsx, Deferred, plain JS, checked JS and External
114814
+ // - plain JS: .js files with no // ts-check and checkJs: undefined
114815
+ // - check JS: .js files with either // ts-check or checkJs: true
114816
+ // - external: files that are added by plugins
114841
114817
  var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */
114842
- || sourceFile.scriptKind === 5 /* External */ || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
114818
+ || sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
114843
114819
  var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
114844
- var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
114845
- return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
114820
+ var checkDiagnostics = includeBindAndCheckDiagnostics && !isPlainJs ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
114821
+ if (isPlainJs) {
114822
+ bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
114823
+ }
114824
+ // skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS
114825
+ return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
114846
114826
  });
114847
114827
  }
114848
114828
  function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics) {
@@ -118751,7 +118731,7 @@ var ts;
118751
118731
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
118752
118732
  if (resolution.refCount) {
118753
118733
  resolution.refCount++;
118754
- ts.Debug.assertDefined(resolution.files);
118734
+ ts.Debug.assertIsDefined(resolution.files);
118755
118735
  }
118756
118736
  else {
118757
118737
  resolution.refCount = 1;
@@ -118819,7 +118799,7 @@ var ts;
118819
118799
  }
118820
118800
  }
118821
118801
  function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
118822
- ts.unorderedRemoveItem(ts.Debug.assertDefined(resolution.files), filePath);
118802
+ ts.unorderedRemoveItem(ts.Debug.checkDefined(resolution.files), filePath);
118823
118803
  resolution.refCount--;
118824
118804
  if (resolution.refCount) {
118825
118805
  return;
@@ -118911,7 +118891,7 @@ var ts;
118911
118891
  if (resolution.isInvalidated || !canInvalidate(resolution))
118912
118892
  continue;
118913
118893
  resolution.isInvalidated = invalidated = true;
118914
- for (var _a = 0, _b = ts.Debug.assertDefined(resolution.files); _a < _b.length; _a++) {
118894
+ for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
118915
118895
  var containingFilePath = _b[_a];
118916
118896
  (filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
118917
118897
  // When its a file with inferred types resolution, invalidate type reference directive resolution
@@ -136187,14 +136167,17 @@ var ts;
136187
136167
  if (node === sourceFile) {
136188
136168
  return undefined;
136189
136169
  }
136190
- var symbol = typeChecker.getSymbolAtLocation(node);
136170
+ var symbol = getSymbol(node, typeChecker);
136191
136171
  if (!symbol)
136192
136172
  return undefined;
136193
136173
  var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
136194
136174
  var returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
136195
136175
  var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node);
136196
136176
  // If a function returns 'void' or some other type with no definition, just return the function definition.
136197
- return fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
136177
+ var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
136178
+ return typeDefinitions.length ? typeDefinitions
136179
+ : !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node)
136180
+ : undefined;
136198
136181
  }
136199
136182
  GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
136200
136183
  function definitionFromType(type, checker, node) {
@@ -150087,9 +150070,9 @@ var ts;
150087
150070
  if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
150088
150071
  return undefined;
150089
150072
  if (!ts.isSourceFile(ts.getThisContainer(fn, /*includeArrowFunctions*/ false))) { // 'this' is defined outside, convert to arrow function
150090
- var fnKeyword = ts.Debug.assertDefined(ts.findChildOfKind(fn, 98 /* FunctionKeyword */, sourceFile));
150073
+ var fnKeyword = ts.Debug.checkDefined(ts.findChildOfKind(fn, 98 /* FunctionKeyword */, sourceFile));
150091
150074
  var name = fn.name;
150092
- var body = ts.Debug.assertDefined(fn.body); // Should be defined because the function contained a 'this' expression
150075
+ var body = ts.Debug.checkDefined(fn.body); // Should be defined because the function contained a 'this' expression
150093
150076
  if (ts.isFunctionExpression(fn)) {
150094
150077
  if (name && ts.FindAllReferences.Core.isSymbolReferencedInFile(name, checker, sourceFile, body)) {
150095
150078
  // Function expression references itself. To fix we would have to extract it to a const.
@@ -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
  }