typescript 4.6.0-dev.20211118 → 4.6.0-dev.20211119

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.20211119";
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.
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-dev.20211118";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20211119";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -151,26 +151,6 @@ var ts;
151
151
  ts.emptyArray = [];
152
152
  ts.emptyMap = new ts.Map();
153
153
  ts.emptySet = new ts.Set();
154
- function createMap() {
155
- return new ts.Map();
156
- }
157
- ts.createMap = createMap;
158
- /**
159
- * Create a new map from a template object is provided, the map will copy entries from it.
160
- * @deprecated Use `new Map(getEntries(template))` instead.
161
- */
162
- function createMapFromTemplate(template) {
163
- var map = new ts.Map();
164
- // Copies keys/values from template. Note that for..in will not throw if
165
- // template is undefined, and instead will just exit the loop.
166
- for (var key in template) {
167
- if (hasOwnProperty.call(template, key)) {
168
- map.set(key, template[key]);
169
- }
170
- }
171
- return map;
172
- }
173
- ts.createMapFromTemplate = createMapFromTemplate;
174
154
  function length(array) {
175
155
  return array ? array.length : 0;
176
156
  }
@@ -2405,11 +2385,6 @@ var ts;
2405
2385
  return value;
2406
2386
  }
2407
2387
  Debug.checkDefined = checkDefined;
2408
- /**
2409
- * @deprecated Use `checkDefined` to check whether a value is defined inline. Use `assertIsDefined` to check whether
2410
- * a value is defined at the statement level.
2411
- */
2412
- Debug.assertDefined = checkDefined;
2413
2388
  function assertEachIsDefined(value, message, stackCrawlMark) {
2414
2389
  for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
2415
2390
  var v = value_1[_i];
@@ -2422,11 +2397,6 @@ var ts;
2422
2397
  return value;
2423
2398
  }
2424
2399
  Debug.checkEachDefined = checkEachDefined;
2425
- /**
2426
- * @deprecated Use `checkEachDefined` to check whether the elements of an array are defined inline. Use `assertEachIsDefined` to check whether
2427
- * the elements of an array are defined at the statement level.
2428
- */
2429
- Debug.assertEachDefined = checkEachDefined;
2430
2400
  function assertNever(member, message, stackCrawlMark) {
2431
2401
  if (message === void 0) { message = "Illegal value:"; }
2432
2402
  var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
@@ -13886,21 +13856,6 @@ var ts;
13886
13856
  return undefined;
13887
13857
  }
13888
13858
  ts.getDeclarationOfKind = getDeclarationOfKind;
13889
- /**
13890
- * Create a new escaped identifier map.
13891
- * @deprecated Use `new Map<__String, T>()` instead.
13892
- */
13893
- function createUnderscoreEscapedMap() {
13894
- return new ts.Map();
13895
- }
13896
- ts.createUnderscoreEscapedMap = createUnderscoreEscapedMap;
13897
- /**
13898
- * @deprecated Use `!!map?.size` instead
13899
- */
13900
- function hasEntries(map) {
13901
- return !!map && !!map.size;
13902
- }
13903
- ts.hasEntries = hasEntries;
13904
13859
  function createSymbolTable(symbols) {
13905
13860
  var result = new ts.Map();
13906
13861
  if (symbols) {
@@ -26493,7 +26448,7 @@ var ts;
26493
26448
  sourceMapText = mapTextOrStripInternal;
26494
26449
  }
26495
26450
  var node = oldFileOfCurrentEmit ?
26496
- parseOldFileOfCurrentEmit(ts.Debug.assertDefined(bundleFileInfo)) :
26451
+ parseOldFileOfCurrentEmit(ts.Debug.checkDefined(bundleFileInfo)) :
26497
26452
  parseUnparsedSourceFile(bundleFileInfo, stripInternal, length);
26498
26453
  node.fileName = fileName;
26499
26454
  node.sourceMapPath = sourceMapPath;
@@ -26640,13 +26595,13 @@ var ts;
26640
26595
  };
26641
26596
  node.javascriptPath = declarationTextOrJavascriptPath;
26642
26597
  node.javascriptMapPath = javascriptMapPath;
26643
- node.declarationPath = ts.Debug.assertDefined(javascriptMapTextOrDeclarationPath);
26598
+ node.declarationPath = ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath);
26644
26599
  node.declarationMapPath = declarationMapPath;
26645
26600
  node.buildInfoPath = declarationMapTextOrBuildInfoPath;
26646
26601
  Object.defineProperties(node, {
26647
26602
  javascriptText: { get: function () { return definedTextGetter_1(declarationTextOrJavascriptPath); } },
26648
26603
  javascriptMapText: { get: function () { return textGetter_1(javascriptMapPath); } },
26649
- declarationText: { get: function () { return definedTextGetter_1(ts.Debug.assertDefined(javascriptMapTextOrDeclarationPath)); } },
26604
+ declarationText: { get: function () { return definedTextGetter_1(ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath)); } },
26650
26605
  declarationMapText: { get: function () { return textGetter_1(declarationMapPath); } },
26651
26606
  buildInfo: { get: function () { return getAndCacheBuildInfo_1(function () { return textGetter_1(declarationMapTextOrBuildInfoPath); }); } }
26652
26607
  });
@@ -52161,10 +52116,8 @@ var ts;
52161
52116
  firstChar = symbolName.charCodeAt(0);
52162
52117
  }
52163
52118
  var expression = void 0;
52164
- if (ts.isSingleOrDoubleQuote(firstChar)) {
52165
- expression = ts.factory.createStringLiteral(symbolName
52166
- .substring(1, symbolName.length - 1)
52167
- .replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39 /* singleQuote */);
52119
+ if (ts.isSingleOrDoubleQuote(firstChar) && !(symbol.flags & 8 /* EnumMember */)) {
52120
+ expression = ts.factory.createStringLiteral(ts.stripQuotes(symbolName).replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39 /* singleQuote */);
52168
52121
  }
52169
52122
  else if (("" + +symbolName) === symbolName) {
52170
52123
  expression = ts.factory.createNumericLiteral(+symbolName);
@@ -94157,7 +94110,7 @@ var ts;
94157
94110
  function visitYieldExpression(node) {
94158
94111
  if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) {
94159
94112
  if (node.asteriskToken) {
94160
- var expression = ts.visitNode(ts.Debug.assertDefined(node.expression), visitor, ts.isExpression);
94113
+ var expression = ts.visitNode(ts.Debug.checkDefined(node.expression), visitor, ts.isExpression);
94161
94114
  return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(
94162
94115
  /*asteriskToken*/ undefined, emitHelpers().createAwaitHelper(factory.updateYieldExpression(node, node.asteriskToken, ts.setTextRange(emitHelpers().createAsyncDelegatorHelper(ts.setTextRange(emitHelpers().createAsyncValuesHelper(expression), expression)), expression)))), node), node);
94163
94116
  }
@@ -95082,11 +95035,11 @@ var ts;
95082
95035
  return existing.name;
95083
95036
  }
95084
95037
  if (!currentFileState.utilizedImplicitRuntimeImports) {
95085
- currentFileState.utilizedImplicitRuntimeImports = ts.createMap();
95038
+ currentFileState.utilizedImplicitRuntimeImports = new ts.Map();
95086
95039
  }
95087
95040
  var specifierSourceImports = currentFileState.utilizedImplicitRuntimeImports.get(importSource);
95088
95041
  if (!specifierSourceImports) {
95089
- specifierSourceImports = ts.createMap();
95042
+ specifierSourceImports = new ts.Map();
95090
95043
  currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports);
95091
95044
  }
95092
95045
  var generatedName = factory.createUniqueName("_" + name, 16 /* Optimistic */ | 32 /* FileLevel */ | 64 /* AllowNameSubstitution */);
@@ -113613,6 +113566,24 @@ var ts;
113613
113566
  }
113614
113567
  }
113615
113568
  ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
113569
+ /** @internal */
113570
+ ts.plainJSErrors = new ts.Set([
113571
+ ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
113572
+ ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
113573
+ ts.Diagnostics.Another_export_default_is_here.code,
113574
+ ts.Diagnostics.The_first_export_default_is_here.code,
113575
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
113576
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
113577
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
113578
+ ts.Diagnostics.constructor_is_a_reserved_word.code,
113579
+ ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode.code,
113580
+ 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,
113581
+ ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
113582
+ ts.Diagnostics.Invalid_use_of_0_in_strict_mode.code,
113583
+ ts.Diagnostics.A_label_is_not_allowed_here.code,
113584
+ ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
113585
+ ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
113586
+ ]);
113616
113587
  /**
113617
113588
  * Determine if source file needs to be re-created even if its text hasn't changed
113618
113589
  */
@@ -114630,14 +114601,23 @@ var ts;
114630
114601
  }
114631
114602
  var typeChecker = getDiagnosticsProducingTypeChecker();
114632
114603
  ts.Debug.assert(!!sourceFile.bindDiagnostics);
114633
- var isCheckJs = ts.isCheckJsEnabledForFile(sourceFile, options);
114604
+ var isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
114605
+ var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
114606
+ var isPlainJs = isJs && !sourceFile.checkJsDirective && options.checkJs === undefined;
114634
114607
  var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
114635
- // By default, only type-check .ts, .tsx, 'Deferred' and 'External' files (external files are added by plugins)
114608
+ // By default, only type-check .ts, .tsx, Deferred, plain JS, checked JS and External
114609
+ // - plain JS: .js files with no // ts-check and checkJs: undefined
114610
+ // - check JS: .js files with either // ts-check or checkJs: true
114611
+ // - external: files that are added by plugins
114636
114612
  var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */
114637
- || sourceFile.scriptKind === 5 /* External */ || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
114613
+ || sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
114638
114614
  var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
114639
- var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
114640
- return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
114615
+ var checkDiagnostics = includeBindAndCheckDiagnostics && !isPlainJs ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
114616
+ if (isPlainJs) {
114617
+ bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
114618
+ }
114619
+ // skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS
114620
+ return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
114641
114621
  });
114642
114622
  }
114643
114623
  function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics) {
@@ -118546,7 +118526,7 @@ var ts;
118546
118526
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
118547
118527
  if (resolution.refCount) {
118548
118528
  resolution.refCount++;
118549
- ts.Debug.assertDefined(resolution.files);
118529
+ ts.Debug.assertIsDefined(resolution.files);
118550
118530
  }
118551
118531
  else {
118552
118532
  resolution.refCount = 1;
@@ -118614,7 +118594,7 @@ var ts;
118614
118594
  }
118615
118595
  }
118616
118596
  function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
118617
- ts.unorderedRemoveItem(ts.Debug.assertDefined(resolution.files), filePath);
118597
+ ts.unorderedRemoveItem(ts.Debug.checkDefined(resolution.files), filePath);
118618
118598
  resolution.refCount--;
118619
118599
  if (resolution.refCount) {
118620
118600
  return;
@@ -118706,7 +118686,7 @@ var ts;
118706
118686
  if (resolution.isInvalidated || !canInvalidate(resolution))
118707
118687
  continue;
118708
118688
  resolution.isInvalidated = invalidated = true;
118709
- for (var _a = 0, _b = ts.Debug.assertDefined(resolution.files); _a < _b.length; _a++) {
118689
+ for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
118710
118690
  var containingFilePath = _b[_a];
118711
118691
  (filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
118712
118692
  // When its a file with inferred types resolution, invalidate type reference directive resolution
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.6.0-dev.20211118",
5
+ "version": "4.6.0-dev.20211119",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [