typescript 4.6.0-dev.20211115 → 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.
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.20211115";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20211119";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  function tryGetNativeMap() {
@@ -108,20 +108,6 @@ var ts;
108
108
  ts.emptyArray = [];
109
109
  ts.emptyMap = new ts.Map();
110
110
  ts.emptySet = new ts.Set();
111
- function createMap() {
112
- return new ts.Map();
113
- }
114
- ts.createMap = createMap;
115
- function createMapFromTemplate(template) {
116
- var map = new ts.Map();
117
- for (var key in template) {
118
- if (hasOwnProperty.call(template, key)) {
119
- map.set(key, template[key]);
120
- }
121
- }
122
- return map;
123
- }
124
- ts.createMapFromTemplate = createMapFromTemplate;
125
111
  function length(array) {
126
112
  return array ? array.length : 0;
127
113
  }
@@ -2005,7 +1991,6 @@ var ts;
2005
1991
  return value;
2006
1992
  }
2007
1993
  Debug.checkDefined = checkDefined;
2008
- Debug.assertDefined = checkDefined;
2009
1994
  function assertEachIsDefined(value, message, stackCrawlMark) {
2010
1995
  for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
2011
1996
  var v = value_1[_i];
@@ -2018,7 +2003,6 @@ var ts;
2018
2003
  return value;
2019
2004
  }
2020
2005
  Debug.checkEachDefined = checkEachDefined;
2021
- Debug.assertEachDefined = checkEachDefined;
2022
2006
  function assertNever(member, message, stackCrawlMark) {
2023
2007
  if (message === void 0) { message = "Illegal value:"; }
2024
2008
  var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
@@ -10501,14 +10485,6 @@ var ts;
10501
10485
  return undefined;
10502
10486
  }
10503
10487
  ts.getDeclarationOfKind = getDeclarationOfKind;
10504
- function createUnderscoreEscapedMap() {
10505
- return new ts.Map();
10506
- }
10507
- ts.createUnderscoreEscapedMap = createUnderscoreEscapedMap;
10508
- function hasEntries(map) {
10509
- return !!map && !!map.size;
10510
- }
10511
- ts.hasEntries = hasEntries;
10512
10488
  function createSymbolTable(symbols) {
10513
10489
  var result = new ts.Map();
10514
10490
  if (symbols) {
@@ -21313,7 +21289,7 @@ var ts;
21313
21289
  sourceMapText = mapTextOrStripInternal;
21314
21290
  }
21315
21291
  var node = oldFileOfCurrentEmit ?
21316
- parseOldFileOfCurrentEmit(ts.Debug.assertDefined(bundleFileInfo)) :
21292
+ parseOldFileOfCurrentEmit(ts.Debug.checkDefined(bundleFileInfo)) :
21317
21293
  parseUnparsedSourceFile(bundleFileInfo, stripInternal, length);
21318
21294
  node.fileName = fileName;
21319
21295
  node.sourceMapPath = sourceMapPath;
@@ -21458,13 +21434,13 @@ var ts;
21458
21434
  };
21459
21435
  node.javascriptPath = declarationTextOrJavascriptPath;
21460
21436
  node.javascriptMapPath = javascriptMapPath;
21461
- node.declarationPath = ts.Debug.assertDefined(javascriptMapTextOrDeclarationPath);
21437
+ node.declarationPath = ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath);
21462
21438
  node.declarationMapPath = declarationMapPath;
21463
21439
  node.buildInfoPath = declarationMapTextOrBuildInfoPath;
21464
21440
  Object.defineProperties(node, {
21465
21441
  javascriptText: { get: function () { return definedTextGetter_1(declarationTextOrJavascriptPath); } },
21466
21442
  javascriptMapText: { get: function () { return textGetter_1(javascriptMapPath); } },
21467
- declarationText: { get: function () { return definedTextGetter_1(ts.Debug.assertDefined(javascriptMapTextOrDeclarationPath)); } },
21443
+ declarationText: { get: function () { return definedTextGetter_1(ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath)); } },
21468
21444
  declarationMapText: { get: function () { return textGetter_1(declarationMapPath); } },
21469
21445
  buildInfo: { get: function () { return getAndCacheBuildInfo_1(function () { return textGetter_1(declarationMapTextOrBuildInfoPath); }); } }
21470
21446
  });
@@ -42581,8 +42557,8 @@ var ts;
42581
42557
  }
42582
42558
  var expandedParams = getExpandedParameters(signature, true)[0];
42583
42559
  var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 170, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
42584
- if (signature.thisParameter) {
42585
- var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context);
42560
+ var thisParameter = tryGetThisParameterDeclaration(signature, context);
42561
+ if (thisParameter) {
42586
42562
  parameters.unshift(thisParameter);
42587
42563
  }
42588
42564
  var returnTypeNode;
@@ -42631,6 +42607,17 @@ var ts;
42631
42607
  }
42632
42608
  return node;
42633
42609
  }
42610
+ function tryGetThisParameterDeclaration(signature, context) {
42611
+ if (signature.thisParameter) {
42612
+ return symbolToParameterDeclaration(signature.thisParameter, context);
42613
+ }
42614
+ if (signature.declaration) {
42615
+ var thisTag = ts.getJSDocThisTag(signature.declaration);
42616
+ if (thisTag && thisTag.typeExpression) {
42617
+ return ts.factory.createParameterDeclaration(undefined, undefined, undefined, "this", undefined, typeToTypeNodeHelper(getTypeFromTypeNode(thisTag.typeExpression), context));
42618
+ }
42619
+ }
42620
+ }
42634
42621
  function typeParameterToDeclarationWithConstraint(type, context, constraintNode) {
42635
42622
  var savedContextFlags = context.flags;
42636
42623
  context.flags &= ~512;
@@ -43041,10 +43028,8 @@ var ts;
43041
43028
  firstChar = symbolName.charCodeAt(0);
43042
43029
  }
43043
43030
  var expression = void 0;
43044
- if (ts.isSingleOrDoubleQuote(firstChar)) {
43045
- expression = ts.factory.createStringLiteral(symbolName
43046
- .substring(1, symbolName.length - 1)
43047
- .replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39);
43031
+ if (ts.isSingleOrDoubleQuote(firstChar) && !(symbol.flags & 8)) {
43032
+ expression = ts.factory.createStringLiteral(ts.stripQuotes(symbolName).replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39);
43048
43033
  }
43049
43034
  else if (("" + +symbolName) === symbolName) {
43050
43035
  expression = ts.factory.createNumericLiteral(+symbolName);
@@ -78595,7 +78580,7 @@ var ts;
78595
78580
  function visitYieldExpression(node) {
78596
78581
  if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) {
78597
78582
  if (node.asteriskToken) {
78598
- var expression = ts.visitNode(ts.Debug.assertDefined(node.expression), visitor, ts.isExpression);
78583
+ var expression = ts.visitNode(ts.Debug.checkDefined(node.expression), visitor, ts.isExpression);
78599
78584
  return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(undefined, emitHelpers().createAwaitHelper(factory.updateYieldExpression(node, node.asteriskToken, ts.setTextRange(emitHelpers().createAsyncDelegatorHelper(ts.setTextRange(emitHelpers().createAsyncValuesHelper(expression), expression)), expression)))), node), node);
78600
78585
  }
78601
78586
  return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(undefined, createDownlevelAwait(node.expression
@@ -79393,11 +79378,11 @@ var ts;
79393
79378
  return existing.name;
79394
79379
  }
79395
79380
  if (!currentFileState.utilizedImplicitRuntimeImports) {
79396
- currentFileState.utilizedImplicitRuntimeImports = ts.createMap();
79381
+ currentFileState.utilizedImplicitRuntimeImports = new ts.Map();
79397
79382
  }
79398
79383
  var specifierSourceImports = currentFileState.utilizedImplicitRuntimeImports.get(importSource);
79399
79384
  if (!specifierSourceImports) {
79400
- specifierSourceImports = ts.createMap();
79385
+ specifierSourceImports = new ts.Map();
79401
79386
  currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports);
79402
79387
  }
79403
79388
  var generatedName = factory.createUniqueName("_" + name, 16 | 32 | 64);
@@ -89224,6 +89209,7 @@ var ts;
89224
89209
  return emitJSDocSignature(node);
89225
89210
  case 325:
89226
89211
  case 330:
89212
+ case 335:
89227
89213
  return emitJSDocSimpleTag(node);
89228
89214
  case 326:
89229
89215
  case 327:
@@ -89235,7 +89221,6 @@ var ts;
89235
89221
  case 332:
89236
89222
  case 333:
89237
89223
  case 334:
89238
- case 335:
89239
89224
  return;
89240
89225
  case 336:
89241
89226
  return emitJSDocCallbackTag(node);
@@ -93675,6 +93660,23 @@ var ts;
93675
93660
  }
93676
93661
  }
93677
93662
  ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
93663
+ ts.plainJSErrors = new ts.Set([
93664
+ ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
93665
+ ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
93666
+ ts.Diagnostics.Another_export_default_is_here.code,
93667
+ ts.Diagnostics.The_first_export_default_is_here.code,
93668
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
93669
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
93670
+ ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
93671
+ ts.Diagnostics.constructor_is_a_reserved_word.code,
93672
+ ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode.code,
93673
+ ts.Diagnostics.Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode.code,
93674
+ ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
93675
+ ts.Diagnostics.Invalid_use_of_0_in_strict_mode.code,
93676
+ ts.Diagnostics.A_label_is_not_allowed_here.code,
93677
+ ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
93678
+ ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
93679
+ ]);
93678
93680
  function shouldProgramCreateNewSourceFiles(program, newOptions) {
93679
93681
  if (!program)
93680
93682
  return false;
@@ -94217,6 +94219,7 @@ var ts;
94217
94219
  newSourceFile.originalFileName = oldSourceFile.originalFileName;
94218
94220
  newSourceFile.resolvedPath = oldSourceFile.resolvedPath;
94219
94221
  newSourceFile.fileName = oldSourceFile.fileName;
94222
+ newSourceFile.impliedNodeFormat = oldSourceFile.impliedNodeFormat;
94220
94223
  var packageName = oldProgram.sourceFileToPackageName.get(oldSourceFile.path);
94221
94224
  if (packageName !== undefined) {
94222
94225
  var prevKind = seenPackageNames.get(packageName);
@@ -94521,13 +94524,18 @@ var ts;
94521
94524
  }
94522
94525
  var typeChecker = getDiagnosticsProducingTypeChecker();
94523
94526
  ts.Debug.assert(!!sourceFile.bindDiagnostics);
94524
- var isCheckJs = ts.isCheckJsEnabledForFile(sourceFile, options);
94527
+ var isJs = sourceFile.scriptKind === 1 || sourceFile.scriptKind === 2;
94528
+ var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
94529
+ var isPlainJs = isJs && !sourceFile.checkJsDirective && options.checkJs === undefined;
94525
94530
  var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
94526
94531
  var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 || sourceFile.scriptKind === 4
94527
- || sourceFile.scriptKind === 5 || isCheckJs || sourceFile.scriptKind === 7);
94532
+ || sourceFile.scriptKind === 5 || isPlainJs || isCheckJs || sourceFile.scriptKind === 7);
94528
94533
  var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
94529
- var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
94530
- return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
94534
+ var checkDiagnostics = includeBindAndCheckDiagnostics && !isPlainJs ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
94535
+ if (isPlainJs) {
94536
+ bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
94537
+ }
94538
+ return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
94531
94539
  });
94532
94540
  }
94533
94541
  function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics) {
@@ -95424,7 +95432,7 @@ var ts;
95424
95432
  return resolvedRef;
95425
95433
  }
95426
95434
  function verifyCompilerOptions() {
95427
- var isNightly = ts.stringContains(ts.version, "-dev");
95435
+ var isNightly = ts.stringContains(ts.version, "-dev") || ts.stringContains(ts.version, "-insiders");
95428
95436
  if (!isNightly) {
95429
95437
  if (ts.getEmitModuleKind(options) === ts.ModuleKind.Node12) {
95430
95438
  createOptionValueDiagnostic("module", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "node12");
@@ -97910,7 +97918,7 @@ var ts;
97910
97918
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
97911
97919
  if (resolution.refCount) {
97912
97920
  resolution.refCount++;
97913
- ts.Debug.assertDefined(resolution.files);
97921
+ ts.Debug.assertIsDefined(resolution.files);
97914
97922
  }
97915
97923
  else {
97916
97924
  resolution.refCount = 1;
@@ -97975,7 +97983,7 @@ var ts;
97975
97983
  }
97976
97984
  }
97977
97985
  function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
97978
- ts.unorderedRemoveItem(ts.Debug.assertDefined(resolution.files), filePath);
97986
+ ts.unorderedRemoveItem(ts.Debug.checkDefined(resolution.files), filePath);
97979
97987
  resolution.refCount--;
97980
97988
  if (resolution.refCount) {
97981
97989
  return;
@@ -98061,7 +98069,7 @@ var ts;
98061
98069
  if (resolution.isInvalidated || !canInvalidate(resolution))
98062
98070
  continue;
98063
98071
  resolution.isInvalidated = invalidated = true;
98064
- for (var _a = 0, _b = ts.Debug.assertDefined(resolution.files); _a < _b.length; _a++) {
98072
+ for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
98065
98073
  var containingFilePath = _b[_a];
98066
98074
  (filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
98067
98075
  hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts.endsWith(containingFilePath, ts.inferredTypesContainingFile);