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.
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.20211118";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20211122";
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
  });
@@ -43052,10 +43028,8 @@ var ts;
43052
43028
  firstChar = symbolName.charCodeAt(0);
43053
43029
  }
43054
43030
  var expression = void 0;
43055
- if (ts.isSingleOrDoubleQuote(firstChar)) {
43056
- expression = ts.factory.createStringLiteral(symbolName
43057
- .substring(1, symbolName.length - 1)
43058
- .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);
43059
43033
  }
43060
43034
  else if (("" + +symbolName) === symbolName) {
43061
43035
  expression = ts.factory.createNumericLiteral(+symbolName);
@@ -78606,7 +78580,7 @@ var ts;
78606
78580
  function visitYieldExpression(node) {
78607
78581
  if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) {
78608
78582
  if (node.asteriskToken) {
78609
- 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);
78610
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);
78611
78585
  }
78612
78586
  return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(undefined, createDownlevelAwait(node.expression
@@ -79404,11 +79378,11 @@ var ts;
79404
79378
  return existing.name;
79405
79379
  }
79406
79380
  if (!currentFileState.utilizedImplicitRuntimeImports) {
79407
- currentFileState.utilizedImplicitRuntimeImports = ts.createMap();
79381
+ currentFileState.utilizedImplicitRuntimeImports = new ts.Map();
79408
79382
  }
79409
79383
  var specifierSourceImports = currentFileState.utilizedImplicitRuntimeImports.get(importSource);
79410
79384
  if (!specifierSourceImports) {
79411
- specifierSourceImports = ts.createMap();
79385
+ specifierSourceImports = new ts.Map();
79412
79386
  currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports);
79413
79387
  }
79414
79388
  var generatedName = factory.createUniqueName("_" + name, 16 | 32 | 64);
@@ -93686,6 +93660,23 @@ var ts;
93686
93660
  }
93687
93661
  }
93688
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
+ ]);
93689
93680
  function shouldProgramCreateNewSourceFiles(program, newOptions) {
93690
93681
  if (!program)
93691
93682
  return false;
@@ -94533,13 +94524,18 @@ var ts;
94533
94524
  }
94534
94525
  var typeChecker = getDiagnosticsProducingTypeChecker();
94535
94526
  ts.Debug.assert(!!sourceFile.bindDiagnostics);
94536
- 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;
94537
94530
  var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
94538
94531
  var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 || sourceFile.scriptKind === 4
94539
- || sourceFile.scriptKind === 5 || isCheckJs || sourceFile.scriptKind === 7);
94532
+ || sourceFile.scriptKind === 5 || isPlainJs || isCheckJs || sourceFile.scriptKind === 7);
94540
94533
  var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
94541
- var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
94542
- 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);
94543
94539
  });
94544
94540
  }
94545
94541
  function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics) {
@@ -97922,7 +97918,7 @@ var ts;
97922
97918
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
97923
97919
  if (resolution.refCount) {
97924
97920
  resolution.refCount++;
97925
- ts.Debug.assertDefined(resolution.files);
97921
+ ts.Debug.assertIsDefined(resolution.files);
97926
97922
  }
97927
97923
  else {
97928
97924
  resolution.refCount = 1;
@@ -97987,7 +97983,7 @@ var ts;
97987
97983
  }
97988
97984
  }
97989
97985
  function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
97990
- ts.unorderedRemoveItem(ts.Debug.assertDefined(resolution.files), filePath);
97986
+ ts.unorderedRemoveItem(ts.Debug.checkDefined(resolution.files), filePath);
97991
97987
  resolution.refCount--;
97992
97988
  if (resolution.refCount) {
97993
97989
  return;
@@ -98073,7 +98069,7 @@ var ts;
98073
98069
  if (resolution.isInvalidated || !canInvalidate(resolution))
98074
98070
  continue;
98075
98071
  resolution.isInvalidated = invalidated = true;
98076
- 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++) {
98077
98073
  var containingFilePath = _b[_a];
98078
98074
  (filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
98079
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.20211118";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20211122";
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
  });
@@ -52172,10 +52127,8 @@ var ts;
52172
52127
  firstChar = symbolName.charCodeAt(0);
52173
52128
  }
52174
52129
  var expression = void 0;
52175
- if (ts.isSingleOrDoubleQuote(firstChar)) {
52176
- expression = ts.factory.createStringLiteral(symbolName
52177
- .substring(1, symbolName.length - 1)
52178
- .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 */);
52179
52132
  }
52180
52133
  else if (("" + +symbolName) === symbolName) {
52181
52134
  expression = ts.factory.createNumericLiteral(+symbolName);
@@ -94168,7 +94121,7 @@ var ts;
94168
94121
  function visitYieldExpression(node) {
94169
94122
  if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) {
94170
94123
  if (node.asteriskToken) {
94171
- 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);
94172
94125
  return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(
94173
94126
  /*asteriskToken*/ undefined, emitHelpers().createAwaitHelper(factory.updateYieldExpression(node, node.asteriskToken, ts.setTextRange(emitHelpers().createAsyncDelegatorHelper(ts.setTextRange(emitHelpers().createAsyncValuesHelper(expression), expression)), expression)))), node), node);
94174
94127
  }
@@ -95093,11 +95046,11 @@ var ts;
95093
95046
  return existing.name;
95094
95047
  }
95095
95048
  if (!currentFileState.utilizedImplicitRuntimeImports) {
95096
- currentFileState.utilizedImplicitRuntimeImports = ts.createMap();
95049
+ currentFileState.utilizedImplicitRuntimeImports = new ts.Map();
95097
95050
  }
95098
95051
  var specifierSourceImports = currentFileState.utilizedImplicitRuntimeImports.get(importSource);
95099
95052
  if (!specifierSourceImports) {
95100
- specifierSourceImports = ts.createMap();
95053
+ specifierSourceImports = new ts.Map();
95101
95054
  currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports);
95102
95055
  }
95103
95056
  var generatedName = factory.createUniqueName("_" + name, 16 /* Optimistic */ | 32 /* FileLevel */ | 64 /* AllowNameSubstitution */);
@@ -113624,6 +113577,24 @@ var ts;
113624
113577
  }
113625
113578
  }
113626
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
+ ]);
113627
113598
  /**
113628
113599
  * Determine if source file needs to be re-created even if its text hasn't changed
113629
113600
  */
@@ -114641,14 +114612,23 @@ var ts;
114641
114612
  }
114642
114613
  var typeChecker = getDiagnosticsProducingTypeChecker();
114643
114614
  ts.Debug.assert(!!sourceFile.bindDiagnostics);
114644
- 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;
114645
114618
  var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
114646
- // 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
114647
114623
  var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */
114648
- || sourceFile.scriptKind === 5 /* External */ || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
114624
+ || sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
114649
114625
  var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
114650
- var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
114651
- 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);
114652
114632
  });
114653
114633
  }
114654
114634
  function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics) {
@@ -118557,7 +118537,7 @@ var ts;
118557
118537
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
118558
118538
  if (resolution.refCount) {
118559
118539
  resolution.refCount++;
118560
- ts.Debug.assertDefined(resolution.files);
118540
+ ts.Debug.assertIsDefined(resolution.files);
118561
118541
  }
118562
118542
  else {
118563
118543
  resolution.refCount = 1;
@@ -118625,7 +118605,7 @@ var ts;
118625
118605
  }
118626
118606
  }
118627
118607
  function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
118628
- ts.unorderedRemoveItem(ts.Debug.assertDefined(resolution.files), filePath);
118608
+ ts.unorderedRemoveItem(ts.Debug.checkDefined(resolution.files), filePath);
118629
118609
  resolution.refCount--;
118630
118610
  if (resolution.refCount) {
118631
118611
  return;
@@ -118717,7 +118697,7 @@ var ts;
118717
118697
  if (resolution.isInvalidated || !canInvalidate(resolution))
118718
118698
  continue;
118719
118699
  resolution.isInvalidated = invalidated = true;
118720
- 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++) {
118721
118701
  var containingFilePath = _b[_a];
118722
118702
  (filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
118723
118703
  // When its a file with inferred types resolution, invalidate type reference directive resolution
@@ -135605,14 +135585,17 @@ var ts;
135605
135585
  if (node === sourceFile) {
135606
135586
  return undefined;
135607
135587
  }
135608
- var symbol = typeChecker.getSymbolAtLocation(node);
135588
+ var symbol = getSymbol(node, typeChecker);
135609
135589
  if (!symbol)
135610
135590
  return undefined;
135611
135591
  var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
135612
135592
  var returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
135613
135593
  var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node);
135614
135594
  // If a function returns 'void' or some other type with no definition, just return the function definition.
135615
- 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;
135616
135599
  }
135617
135600
  GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
135618
135601
  function definitionFromType(type, checker, node) {
@@ -149505,9 +149488,9 @@ var ts;
149505
149488
  if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
149506
149489
  return undefined;
149507
149490
  if (!ts.isSourceFile(ts.getThisContainer(fn, /*includeArrowFunctions*/ false))) { // 'this' is defined outside, convert to arrow function
149508
- var fnKeyword = ts.Debug.assertDefined(ts.findChildOfKind(fn, 98 /* FunctionKeyword */, sourceFile));
149491
+ var fnKeyword = ts.Debug.checkDefined(ts.findChildOfKind(fn, 98 /* FunctionKeyword */, sourceFile));
149509
149492
  var name = fn.name;
149510
- 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
149511
149494
  if (ts.isFunctionExpression(fn)) {
149512
149495
  if (name && ts.FindAllReferences.Core.isSymbolReferencedInFile(name, checker, sourceFile, body)) {
149513
149496
  // Function expression references itself. To fix we would have to extract it to a const.
@@ -171933,7 +171916,7 @@ var ts;
171933
171916
  Session.prototype.getFullNavigateToItems = function (args) {
171934
171917
  var currentFileOnly = args.currentFileOnly, searchValue = args.searchValue, maxResultCount = args.maxResultCount, projectFileName = args.projectFileName;
171935
171918
  if (currentFileOnly) {
171936
- ts.Debug.assertDefined(args.file);
171919
+ ts.Debug.assertIsDefined(args.file);
171937
171920
  var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
171938
171921
  return [{ project: project, result: project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, file) }];
171939
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
  }