typescript 4.1.0-dev.20201102 → 4.1.4

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/typescript.js CHANGED
@@ -78,7 +78,7 @@ var __extends = (this && this.__extends) || (function () {
78
78
  var extendStatics = function (d, b) {
79
79
  extendStatics = Object.setPrototypeOf ||
80
80
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
81
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
81
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
82
82
  return extendStatics(d, b);
83
83
  };
84
84
  return function (d, b) {
@@ -288,7 +288,7 @@ var ts;
288
288
  // If changing the text in this section, be sure to test `configurePrerelease` too.
289
289
  ts.versionMajorMinor = "4.1";
290
290
  /** The version of the TypeScript compiler release */
291
- ts.version = ts.versionMajorMinor + ".0-dev.20201102";
291
+ ts.version = "4.1.4";
292
292
  /* @internal */
293
293
  var Comparison;
294
294
  (function (Comparison) {
@@ -7991,8 +7991,6 @@ var ts;
7991
7991
  Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, ts.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."),
7992
7992
  Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1388, ts.DiagnosticCategory.Error, "Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1388", "Constructor type notation must be parenthesized when used in an intersection type."),
7993
7993
  _0_is_not_allowed_as_a_variable_declaration_name: diag(1389, ts.DiagnosticCategory.Error, "_0_is_not_allowed_as_a_variable_declaration_name_1389", "'{0}' is not allowed as a variable declaration name."),
7994
- Provides_a_root_package_name_when_using_outFile_with_declarations: diag(1390, ts.DiagnosticCategory.Message, "Provides_a_root_package_name_when_using_outFile_with_declarations_1390", "Provides a root package name when using outFile with declarations."),
7995
- The_bundledPackageName_option_must_be_provided_when_using_outFile_and_node_module_resolution_with_declaration_emit: diag(1391, ts.DiagnosticCategory.Error, "The_bundledPackageName_option_must_be_provided_when_using_outFile_and_node_module_resolution_with_de_1391", "The `bundledPackageName` option must be provided when using outFile and node module resolution with declaration emit."),
7996
7994
  The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
7997
7995
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
7998
7996
  Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
@@ -14241,6 +14239,18 @@ var ts;
14241
14239
  };
14242
14240
  }
14243
14241
  ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain;
14242
+ function createDiagnosticForFileFromMessageChain(sourceFile, messageChain, relatedInformation) {
14243
+ return {
14244
+ file: sourceFile,
14245
+ start: 0,
14246
+ length: 0,
14247
+ code: messageChain.code,
14248
+ category: messageChain.category,
14249
+ messageText: messageChain.next ? messageChain : messageChain.messageText,
14250
+ relatedInformation: relatedInformation
14251
+ };
14252
+ }
14253
+ ts.createDiagnosticForFileFromMessageChain = createDiagnosticForFileFromMessageChain;
14244
14254
  function createDiagnosticForRange(sourceFile, range, message) {
14245
14255
  return {
14246
14256
  file: sourceFile,
@@ -17150,16 +17160,7 @@ var ts;
17150
17160
  var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
17151
17161
  var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
17152
17162
  var extensionless = removeFileExtension(relativePath);
17153
- if (referencePath) {
17154
- return ts.ensurePathIsNonModuleName(extensionless);
17155
- }
17156
- var options = host.getCompilerOptions();
17157
- var rootPkgName = options.bundledPackageName || "";
17158
- var newPath = ts.combinePaths(rootPkgName, extensionless);
17159
- if (rootPkgName && getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeJs && ts.endsWith(newPath, "/index")) {
17160
- return newPath.slice(0, newPath.length - "/index".length);
17161
- }
17162
- return newPath;
17163
+ return referencePath ? ts.ensurePathIsNonModuleName(extensionless) : extensionless;
17163
17164
  }
17164
17165
  ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath;
17165
17166
  function getOwnEmitOutputFilePath(fileName, host, extension) {
@@ -36741,13 +36742,6 @@ var ts;
36741
36742
  category: ts.Diagnostics.Advanced_Options,
36742
36743
  description: ts.Diagnostics.Emit_class_fields_with_Define_instead_of_Set,
36743
36744
  },
36744
- {
36745
- name: "bundledPackageName",
36746
- type: "string",
36747
- affectsEmit: true,
36748
- category: ts.Diagnostics.Advanced_Options,
36749
- description: ts.Diagnostics.Provides_a_root_package_name_when_using_outFile_with_declarations,
36750
- },
36751
36745
  {
36752
36746
  name: "keyofStringsOnly",
36753
36747
  type: "boolean",
@@ -44309,6 +44303,16 @@ var ts;
44309
44303
  }
44310
44304
  }
44311
44305
  function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) {
44306
+ // Pseudo-synthesized input node
44307
+ if (location.pos < 0 || location.end < 0) {
44308
+ if (!isError) {
44309
+ return; // Drop suggestions (we have no span to suggest on)
44310
+ }
44311
+ // Issue errors globally
44312
+ var file = ts.getSourceFileOfNode(location);
44313
+ addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line no-in-operator
44314
+ return;
44315
+ }
44312
44316
  addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator
44313
44317
  }
44314
44318
  function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) {
@@ -45884,7 +45888,7 @@ var ts;
45884
45888
  var resolved = getExternalModuleMember(root, commonJSPropertyAccess || node, dontResolveAlias);
45885
45889
  var name = node.propertyName || node.name;
45886
45890
  if (commonJSPropertyAccess && resolved && ts.isIdentifier(name)) {
45887
- return getPropertyOfType(getTypeOfSymbol(resolved), name.escapedText);
45891
+ return resolveSymbol(getPropertyOfType(getTypeOfSymbol(resolved), name.escapedText), dontResolveAlias);
45888
45892
  }
45889
45893
  markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false);
45890
45894
  return resolved;
@@ -47311,7 +47315,6 @@ var ts;
47311
47315
  getProjectReferenceRedirect: function (fileName) { return host.getProjectReferenceRedirect(fileName); },
47312
47316
  isSourceOfProjectReferenceRedirect: function (fileName) { return host.isSourceOfProjectReferenceRedirect(fileName); },
47313
47317
  fileExists: function (fileName) { return host.fileExists(fileName); },
47314
- getCompilerOptions: function () { return host.getCompilerOptions(); }
47315
47318
  } : undefined },
47316
47319
  encounteredError: false,
47317
47320
  visitedTypes: undefined,
@@ -48304,7 +48307,6 @@ var ts;
48304
48307
  }
48305
48308
  function getSpecifierForModuleSymbol(symbol, context) {
48306
48309
  var _a;
48307
- var _b;
48308
48310
  var file = ts.getDeclarationOfKind(symbol, 297 /* SourceFile */);
48309
48311
  if (!file) {
48310
48312
  var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); });
@@ -48349,7 +48351,7 @@ var ts;
48349
48351
  var moduleResolverHost = context.tracker.moduleResolverHost;
48350
48352
  var specifierCompilerOptions = isBundle_1 ? __assign(__assign({}, compilerOptions), { baseUrl: moduleResolverHost.getCommonSourceDirectory() }) : compilerOptions;
48351
48353
  specifier = ts.first(ts.moduleSpecifiers.getModuleSpecifiers(symbol, specifierCompilerOptions, contextFile, moduleResolverHost, { importModuleSpecifierPreference: isBundle_1 ? "non-relative" : "relative", importModuleSpecifierEnding: isBundle_1 ? "minimal" : undefined }));
48352
- (_a = (_b = links).specifierCache) !== null && _a !== void 0 ? _a : (_b.specifierCache = new ts.Map());
48354
+ (_a = links.specifierCache) !== null && _a !== void 0 ? _a : (links.specifierCache = new ts.Map());
48353
48355
  links.specifierCache.set(contextFile.path, specifier);
48354
48356
  }
48355
48357
  return specifier;
@@ -48791,8 +48793,7 @@ var ts;
48791
48793
  var resolverHost = {
48792
48794
  getCanonicalFileName: getCanonicalFileName,
48793
48795
  getCurrentDirectory: function () { return context.tracker.moduleResolverHost.getCurrentDirectory(); },
48794
- getCommonSourceDirectory: function () { return context.tracker.moduleResolverHost.getCommonSourceDirectory(); },
48795
- getCompilerOptions: function () { return context.tracker.moduleResolverHost.getCompilerOptions(); }
48796
+ getCommonSourceDirectory: function () { return context.tracker.moduleResolverHost.getCommonSourceDirectory(); }
48796
48797
  };
48797
48798
  var newName = ts.getResolvedExternalModuleName(resolverHost, targetFile);
48798
48799
  return ts.factory.createStringLiteral(newName);
@@ -63316,6 +63317,7 @@ var ts;
63316
63317
  return errorType;
63317
63318
  }
63318
63319
  flowDepth++;
63320
+ var sharedFlow;
63319
63321
  while (true) {
63320
63322
  var flags = flow.flags;
63321
63323
  if (flags & 4096 /* Shared */) {
@@ -63328,6 +63330,7 @@ var ts;
63328
63330
  return sharedFlowTypes[i];
63329
63331
  }
63330
63332
  }
63333
+ sharedFlow = flow;
63331
63334
  }
63332
63335
  var type = void 0;
63333
63336
  if (flags & 16 /* Assignment */) {
@@ -63391,9 +63394,9 @@ var ts;
63391
63394
  // simply return the non-auto declared type to reduce follow-on errors.
63392
63395
  type = convertAutoToAny(declaredType);
63393
63396
  }
63394
- if (flags & 4096 /* Shared */) {
63397
+ if (sharedFlow) {
63395
63398
  // Record visited node and the associated type in the cache.
63396
- sharedFlowNodes[sharedFlowCount] = flow;
63399
+ sharedFlowNodes[sharedFlowCount] = sharedFlow;
63397
63400
  sharedFlowTypes[sharedFlowCount] = type;
63398
63401
  sharedFlowCount++;
63399
63402
  }
@@ -66521,10 +66524,10 @@ var ts;
66521
66524
  return links.jsxNamespace;
66522
66525
  }
66523
66526
  if (!links || links.jsxNamespace !== false) {
66524
- var namespaceName = getJsxNamespace(location);
66525
- var resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
66527
+ var resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
66526
66528
  if (!resolvedNamespace || resolvedNamespace === unknownSymbol) {
66527
- resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
66529
+ var namespaceName = getJsxNamespace(location);
66530
+ resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
66528
66531
  }
66529
66532
  if (resolvedNamespace) {
66530
66533
  var candidate = resolveSymbol(getSymbol(getExportsOfSymbol(resolveSymbol(resolvedNamespace)), JsxNames.JSX, 1920 /* Namespace */));
@@ -66731,23 +66734,25 @@ var ts;
66731
66734
  checkGrammarJsxElement(node);
66732
66735
  }
66733
66736
  checkJsxPreconditions(node);
66734
- // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
66735
- // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
66736
- var jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
66737
- var jsxFactoryNamespace = getJsxNamespace(node);
66738
- var jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
66739
- // allow null as jsxFragmentFactory
66740
- var jsxFactorySym;
66741
- if (!(ts.isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
66742
- jsxFactorySym = resolveName(jsxFactoryLocation, jsxFactoryNamespace, 111551 /* Value */, jsxFactoryRefErr, jsxFactoryNamespace, /*isUse*/ true);
66743
- }
66744
- if (jsxFactorySym) {
66745
- // Mark local symbol as referenced here because it might not have been marked
66746
- // if jsx emit was not jsxFactory as there wont be error being emitted
66747
- jsxFactorySym.isReferenced = 67108863 /* All */;
66748
- // If react/jsxFactory symbol is alias, mark it as refereced
66749
- if (jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
66750
- markAliasSymbolAsReferenced(jsxFactorySym);
66737
+ if (!getJsxNamespaceContainerForImplicitImport(node)) {
66738
+ // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
66739
+ // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
66740
+ var jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
66741
+ var jsxFactoryNamespace = getJsxNamespace(node);
66742
+ var jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
66743
+ // allow null as jsxFragmentFactory
66744
+ var jsxFactorySym = void 0;
66745
+ if (!(ts.isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
66746
+ jsxFactorySym = resolveName(jsxFactoryLocation, jsxFactoryNamespace, 111551 /* Value */, jsxFactoryRefErr, jsxFactoryNamespace, /*isUse*/ true);
66747
+ }
66748
+ if (jsxFactorySym) {
66749
+ // Mark local symbol as referenced here because it might not have been marked
66750
+ // if jsx emit was not jsxFactory as there wont be error being emitted
66751
+ jsxFactorySym.isReferenced = 67108863 /* All */;
66752
+ // If react/jsxFactory symbol is alias, mark it as refereced
66753
+ if (jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
66754
+ markAliasSymbolAsReferenced(jsxFactorySym);
66755
+ }
66751
66756
  }
66752
66757
  }
66753
66758
  if (isNodeOpeningLikeElement) {
@@ -68558,9 +68563,9 @@ var ts;
68558
68563
  var oldCandidatesForArgumentError = candidatesForArgumentError;
68559
68564
  var oldCandidateForArgumentArityError = candidateForArgumentArityError;
68560
68565
  var oldCandidateForTypeArgumentError = candidateForTypeArgumentError;
68561
- var declCount = ts.length((_a = failed.declaration) === null || _a === void 0 ? void 0 : _a.symbol.declarations);
68562
- var isOverload = declCount > 1;
68563
- var implDecl = isOverload ? ts.find(((_b = failed.declaration) === null || _b === void 0 ? void 0 : _b.symbol.declarations) || ts.emptyArray, function (d) { return ts.isFunctionLikeDeclaration(d) && ts.nodeIsPresent(d.body); }) : undefined;
68566
+ var failedSignatureDeclarations = ((_b = (_a = failed.declaration) === null || _a === void 0 ? void 0 : _a.symbol) === null || _b === void 0 ? void 0 : _b.declarations) || ts.emptyArray;
68567
+ var isOverload = failedSignatureDeclarations.length > 1;
68568
+ var implDecl = isOverload ? ts.find(failedSignatureDeclarations, function (d) { return ts.isFunctionLikeDeclaration(d) && ts.nodeIsPresent(d.body); }) : undefined;
68564
68569
  if (implDecl) {
68565
68570
  var candidate = getSignatureFromDeclaration(implDecl);
68566
68571
  var isSingleNonGenericCandidate_1 = !candidate.typeParameters;
@@ -107395,10 +107400,6 @@ var ts;
107395
107400
  programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? "out" : "outFile"));
107396
107401
  }
107397
107402
  }
107398
- // Without a package name, for multiple files being bundled into a .d.ts file you basically get a file which doesn't wrk
107399
- if (outputFile && ts.getEmitDeclarations(options) && ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeJs && !options.bundledPackageName) {
107400
- createDiagnosticForOptionName(ts.Diagnostics.The_bundledPackageName_option_must_be_provided_when_using_outFile_and_node_module_resolution_with_declaration_emit, options.out ? "out" : "outFile");
107401
- }
107402
107403
  if (options.resolveJsonModule) {
107403
107404
  if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) {
107404
107405
  createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
@@ -110255,7 +110256,7 @@ var ts;
110255
110256
  function getLocalModuleSpecifier(moduleFileName, _a, compilerOptions, host, _b) {
110256
110257
  var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
110257
110258
  var ending = _b.ending, relativePreference = _b.relativePreference;
110258
- var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs, bundledPackageName = compilerOptions.bundledPackageName;
110259
+ var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
110259
110260
  var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
110260
110261
  removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
110261
110262
  if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
@@ -110266,9 +110267,8 @@ var ts;
110266
110267
  if (!relativeToBaseUrl) {
110267
110268
  return relativePath;
110268
110269
  }
110269
- var bundledPkgReference = bundledPackageName ? ts.combinePaths(bundledPackageName, relativeToBaseUrl) : relativeToBaseUrl;
110270
- var importRelativeToBaseUrl = removeExtensionAndIndexPostFix(bundledPkgReference, ending, compilerOptions);
110271
- var fromPaths = paths && tryGetModuleNameFromPaths(ts.removeFileExtension(bundledPkgReference), importRelativeToBaseUrl, paths);
110270
+ var importRelativeToBaseUrl = removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions);
110271
+ var fromPaths = paths && tryGetModuleNameFromPaths(ts.removeFileExtension(relativeToBaseUrl), importRelativeToBaseUrl, paths);
110272
110272
  var nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
110273
110273
  if (!nonRelative) {
110274
110274
  return relativePath;
@@ -115418,8 +115418,7 @@ var ts;
115418
115418
  getSourceFiles: function () { return program.getSourceFiles(); },
115419
115419
  redirectTargetsMap: program.redirectTargetsMap,
115420
115420
  getProjectReferenceRedirect: function (fileName) { return program.getProjectReferenceRedirect(fileName); },
115421
- isSourceOfProjectReferenceRedirect: function (fileName) { return program.isSourceOfProjectReferenceRedirect(fileName); },
115422
- getCompilerOptions: function () { return program.getCompilerOptions(); }
115421
+ isSourceOfProjectReferenceRedirect: function (fileName) { return program.isSourceOfProjectReferenceRedirect(fileName); }
115423
115422
  };
115424
115423
  }
115425
115424
  ts.createModuleSpecifierResolutionHost = createModuleSpecifierResolutionHost;
@@ -147434,7 +147433,7 @@ var ts;
147434
147433
  * This is a semantic operation.
147435
147434
  */
147436
147435
  function getSignatureHelpItems(fileName, position, _a) {
147437
- var triggerReason = (_a === void 0 ? ts.emptyOptions : _a).triggerReason;
147436
+ var _b = _a === void 0 ? ts.emptyOptions : _a, triggerReason = _b.triggerReason;
147438
147437
  synchronizeHostData();
147439
147438
  var sourceFile = getValidSourceFile(fileName);
147440
147439
  return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, triggerReason, cancellationToken);
@@ -2790,7 +2790,6 @@ declare namespace ts {
2790
2790
  allowUnusedLabels?: boolean;
2791
2791
  alwaysStrict?: boolean;
2792
2792
  baseUrl?: string;
2793
- bundledPackageName?: string;
2794
2793
  charset?: string;
2795
2794
  checkJs?: boolean;
2796
2795
  declaration?: boolean;
@@ -78,7 +78,7 @@ var __extends = (this && this.__extends) || (function () {
78
78
  var extendStatics = function (d, b) {
79
79
  extendStatics = Object.setPrototypeOf ||
80
80
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
81
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
81
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
82
82
  return extendStatics(d, b);
83
83
  };
84
84
  return function (d, b) {
@@ -288,7 +288,7 @@ var ts;
288
288
  // If changing the text in this section, be sure to test `configurePrerelease` too.
289
289
  ts.versionMajorMinor = "4.1";
290
290
  /** The version of the TypeScript compiler release */
291
- ts.version = ts.versionMajorMinor + ".0-dev.20201102";
291
+ ts.version = "4.1.4";
292
292
  /* @internal */
293
293
  var Comparison;
294
294
  (function (Comparison) {
@@ -7991,8 +7991,6 @@ var ts;
7991
7991
  Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, ts.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."),
7992
7992
  Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1388, ts.DiagnosticCategory.Error, "Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1388", "Constructor type notation must be parenthesized when used in an intersection type."),
7993
7993
  _0_is_not_allowed_as_a_variable_declaration_name: diag(1389, ts.DiagnosticCategory.Error, "_0_is_not_allowed_as_a_variable_declaration_name_1389", "'{0}' is not allowed as a variable declaration name."),
7994
- Provides_a_root_package_name_when_using_outFile_with_declarations: diag(1390, ts.DiagnosticCategory.Message, "Provides_a_root_package_name_when_using_outFile_with_declarations_1390", "Provides a root package name when using outFile with declarations."),
7995
- The_bundledPackageName_option_must_be_provided_when_using_outFile_and_node_module_resolution_with_declaration_emit: diag(1391, ts.DiagnosticCategory.Error, "The_bundledPackageName_option_must_be_provided_when_using_outFile_and_node_module_resolution_with_de_1391", "The `bundledPackageName` option must be provided when using outFile and node module resolution with declaration emit."),
7996
7994
  The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
7997
7995
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
7998
7996
  Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
@@ -14241,6 +14239,18 @@ var ts;
14241
14239
  };
14242
14240
  }
14243
14241
  ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain;
14242
+ function createDiagnosticForFileFromMessageChain(sourceFile, messageChain, relatedInformation) {
14243
+ return {
14244
+ file: sourceFile,
14245
+ start: 0,
14246
+ length: 0,
14247
+ code: messageChain.code,
14248
+ category: messageChain.category,
14249
+ messageText: messageChain.next ? messageChain : messageChain.messageText,
14250
+ relatedInformation: relatedInformation
14251
+ };
14252
+ }
14253
+ ts.createDiagnosticForFileFromMessageChain = createDiagnosticForFileFromMessageChain;
14244
14254
  function createDiagnosticForRange(sourceFile, range, message) {
14245
14255
  return {
14246
14256
  file: sourceFile,
@@ -17150,16 +17160,7 @@ var ts;
17150
17160
  var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
17151
17161
  var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
17152
17162
  var extensionless = removeFileExtension(relativePath);
17153
- if (referencePath) {
17154
- return ts.ensurePathIsNonModuleName(extensionless);
17155
- }
17156
- var options = host.getCompilerOptions();
17157
- var rootPkgName = options.bundledPackageName || "";
17158
- var newPath = ts.combinePaths(rootPkgName, extensionless);
17159
- if (rootPkgName && getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeJs && ts.endsWith(newPath, "/index")) {
17160
- return newPath.slice(0, newPath.length - "/index".length);
17161
- }
17162
- return newPath;
17163
+ return referencePath ? ts.ensurePathIsNonModuleName(extensionless) : extensionless;
17163
17164
  }
17164
17165
  ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath;
17165
17166
  function getOwnEmitOutputFilePath(fileName, host, extension) {
@@ -36741,13 +36742,6 @@ var ts;
36741
36742
  category: ts.Diagnostics.Advanced_Options,
36742
36743
  description: ts.Diagnostics.Emit_class_fields_with_Define_instead_of_Set,
36743
36744
  },
36744
- {
36745
- name: "bundledPackageName",
36746
- type: "string",
36747
- affectsEmit: true,
36748
- category: ts.Diagnostics.Advanced_Options,
36749
- description: ts.Diagnostics.Provides_a_root_package_name_when_using_outFile_with_declarations,
36750
- },
36751
36745
  {
36752
36746
  name: "keyofStringsOnly",
36753
36747
  type: "boolean",
@@ -44309,6 +44303,16 @@ var ts;
44309
44303
  }
44310
44304
  }
44311
44305
  function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) {
44306
+ // Pseudo-synthesized input node
44307
+ if (location.pos < 0 || location.end < 0) {
44308
+ if (!isError) {
44309
+ return; // Drop suggestions (we have no span to suggest on)
44310
+ }
44311
+ // Issue errors globally
44312
+ var file = ts.getSourceFileOfNode(location);
44313
+ addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line no-in-operator
44314
+ return;
44315
+ }
44312
44316
  addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator
44313
44317
  }
44314
44318
  function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) {
@@ -45884,7 +45888,7 @@ var ts;
45884
45888
  var resolved = getExternalModuleMember(root, commonJSPropertyAccess || node, dontResolveAlias);
45885
45889
  var name = node.propertyName || node.name;
45886
45890
  if (commonJSPropertyAccess && resolved && ts.isIdentifier(name)) {
45887
- return getPropertyOfType(getTypeOfSymbol(resolved), name.escapedText);
45891
+ return resolveSymbol(getPropertyOfType(getTypeOfSymbol(resolved), name.escapedText), dontResolveAlias);
45888
45892
  }
45889
45893
  markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false);
45890
45894
  return resolved;
@@ -47311,7 +47315,6 @@ var ts;
47311
47315
  getProjectReferenceRedirect: function (fileName) { return host.getProjectReferenceRedirect(fileName); },
47312
47316
  isSourceOfProjectReferenceRedirect: function (fileName) { return host.isSourceOfProjectReferenceRedirect(fileName); },
47313
47317
  fileExists: function (fileName) { return host.fileExists(fileName); },
47314
- getCompilerOptions: function () { return host.getCompilerOptions(); }
47315
47318
  } : undefined },
47316
47319
  encounteredError: false,
47317
47320
  visitedTypes: undefined,
@@ -48304,7 +48307,6 @@ var ts;
48304
48307
  }
48305
48308
  function getSpecifierForModuleSymbol(symbol, context) {
48306
48309
  var _a;
48307
- var _b;
48308
48310
  var file = ts.getDeclarationOfKind(symbol, 297 /* SourceFile */);
48309
48311
  if (!file) {
48310
48312
  var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); });
@@ -48349,7 +48351,7 @@ var ts;
48349
48351
  var moduleResolverHost = context.tracker.moduleResolverHost;
48350
48352
  var specifierCompilerOptions = isBundle_1 ? __assign(__assign({}, compilerOptions), { baseUrl: moduleResolverHost.getCommonSourceDirectory() }) : compilerOptions;
48351
48353
  specifier = ts.first(ts.moduleSpecifiers.getModuleSpecifiers(symbol, specifierCompilerOptions, contextFile, moduleResolverHost, { importModuleSpecifierPreference: isBundle_1 ? "non-relative" : "relative", importModuleSpecifierEnding: isBundle_1 ? "minimal" : undefined }));
48352
- (_a = (_b = links).specifierCache) !== null && _a !== void 0 ? _a : (_b.specifierCache = new ts.Map());
48354
+ (_a = links.specifierCache) !== null && _a !== void 0 ? _a : (links.specifierCache = new ts.Map());
48353
48355
  links.specifierCache.set(contextFile.path, specifier);
48354
48356
  }
48355
48357
  return specifier;
@@ -48791,8 +48793,7 @@ var ts;
48791
48793
  var resolverHost = {
48792
48794
  getCanonicalFileName: getCanonicalFileName,
48793
48795
  getCurrentDirectory: function () { return context.tracker.moduleResolverHost.getCurrentDirectory(); },
48794
- getCommonSourceDirectory: function () { return context.tracker.moduleResolverHost.getCommonSourceDirectory(); },
48795
- getCompilerOptions: function () { return context.tracker.moduleResolverHost.getCompilerOptions(); }
48796
+ getCommonSourceDirectory: function () { return context.tracker.moduleResolverHost.getCommonSourceDirectory(); }
48796
48797
  };
48797
48798
  var newName = ts.getResolvedExternalModuleName(resolverHost, targetFile);
48798
48799
  return ts.factory.createStringLiteral(newName);
@@ -63316,6 +63317,7 @@ var ts;
63316
63317
  return errorType;
63317
63318
  }
63318
63319
  flowDepth++;
63320
+ var sharedFlow;
63319
63321
  while (true) {
63320
63322
  var flags = flow.flags;
63321
63323
  if (flags & 4096 /* Shared */) {
@@ -63328,6 +63330,7 @@ var ts;
63328
63330
  return sharedFlowTypes[i];
63329
63331
  }
63330
63332
  }
63333
+ sharedFlow = flow;
63331
63334
  }
63332
63335
  var type = void 0;
63333
63336
  if (flags & 16 /* Assignment */) {
@@ -63391,9 +63394,9 @@ var ts;
63391
63394
  // simply return the non-auto declared type to reduce follow-on errors.
63392
63395
  type = convertAutoToAny(declaredType);
63393
63396
  }
63394
- if (flags & 4096 /* Shared */) {
63397
+ if (sharedFlow) {
63395
63398
  // Record visited node and the associated type in the cache.
63396
- sharedFlowNodes[sharedFlowCount] = flow;
63399
+ sharedFlowNodes[sharedFlowCount] = sharedFlow;
63397
63400
  sharedFlowTypes[sharedFlowCount] = type;
63398
63401
  sharedFlowCount++;
63399
63402
  }
@@ -66521,10 +66524,10 @@ var ts;
66521
66524
  return links.jsxNamespace;
66522
66525
  }
66523
66526
  if (!links || links.jsxNamespace !== false) {
66524
- var namespaceName = getJsxNamespace(location);
66525
- var resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
66527
+ var resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
66526
66528
  if (!resolvedNamespace || resolvedNamespace === unknownSymbol) {
66527
- resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
66529
+ var namespaceName = getJsxNamespace(location);
66530
+ resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
66528
66531
  }
66529
66532
  if (resolvedNamespace) {
66530
66533
  var candidate = resolveSymbol(getSymbol(getExportsOfSymbol(resolveSymbol(resolvedNamespace)), JsxNames.JSX, 1920 /* Namespace */));
@@ -66731,23 +66734,25 @@ var ts;
66731
66734
  checkGrammarJsxElement(node);
66732
66735
  }
66733
66736
  checkJsxPreconditions(node);
66734
- // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
66735
- // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
66736
- var jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
66737
- var jsxFactoryNamespace = getJsxNamespace(node);
66738
- var jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
66739
- // allow null as jsxFragmentFactory
66740
- var jsxFactorySym;
66741
- if (!(ts.isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
66742
- jsxFactorySym = resolveName(jsxFactoryLocation, jsxFactoryNamespace, 111551 /* Value */, jsxFactoryRefErr, jsxFactoryNamespace, /*isUse*/ true);
66743
- }
66744
- if (jsxFactorySym) {
66745
- // Mark local symbol as referenced here because it might not have been marked
66746
- // if jsx emit was not jsxFactory as there wont be error being emitted
66747
- jsxFactorySym.isReferenced = 67108863 /* All */;
66748
- // If react/jsxFactory symbol is alias, mark it as refereced
66749
- if (jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
66750
- markAliasSymbolAsReferenced(jsxFactorySym);
66737
+ if (!getJsxNamespaceContainerForImplicitImport(node)) {
66738
+ // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
66739
+ // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
66740
+ var jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
66741
+ var jsxFactoryNamespace = getJsxNamespace(node);
66742
+ var jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
66743
+ // allow null as jsxFragmentFactory
66744
+ var jsxFactorySym = void 0;
66745
+ if (!(ts.isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
66746
+ jsxFactorySym = resolveName(jsxFactoryLocation, jsxFactoryNamespace, 111551 /* Value */, jsxFactoryRefErr, jsxFactoryNamespace, /*isUse*/ true);
66747
+ }
66748
+ if (jsxFactorySym) {
66749
+ // Mark local symbol as referenced here because it might not have been marked
66750
+ // if jsx emit was not jsxFactory as there wont be error being emitted
66751
+ jsxFactorySym.isReferenced = 67108863 /* All */;
66752
+ // If react/jsxFactory symbol is alias, mark it as refereced
66753
+ if (jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
66754
+ markAliasSymbolAsReferenced(jsxFactorySym);
66755
+ }
66751
66756
  }
66752
66757
  }
66753
66758
  if (isNodeOpeningLikeElement) {
@@ -68558,9 +68563,9 @@ var ts;
68558
68563
  var oldCandidatesForArgumentError = candidatesForArgumentError;
68559
68564
  var oldCandidateForArgumentArityError = candidateForArgumentArityError;
68560
68565
  var oldCandidateForTypeArgumentError = candidateForTypeArgumentError;
68561
- var declCount = ts.length((_a = failed.declaration) === null || _a === void 0 ? void 0 : _a.symbol.declarations);
68562
- var isOverload = declCount > 1;
68563
- var implDecl = isOverload ? ts.find(((_b = failed.declaration) === null || _b === void 0 ? void 0 : _b.symbol.declarations) || ts.emptyArray, function (d) { return ts.isFunctionLikeDeclaration(d) && ts.nodeIsPresent(d.body); }) : undefined;
68566
+ var failedSignatureDeclarations = ((_b = (_a = failed.declaration) === null || _a === void 0 ? void 0 : _a.symbol) === null || _b === void 0 ? void 0 : _b.declarations) || ts.emptyArray;
68567
+ var isOverload = failedSignatureDeclarations.length > 1;
68568
+ var implDecl = isOverload ? ts.find(failedSignatureDeclarations, function (d) { return ts.isFunctionLikeDeclaration(d) && ts.nodeIsPresent(d.body); }) : undefined;
68564
68569
  if (implDecl) {
68565
68570
  var candidate = getSignatureFromDeclaration(implDecl);
68566
68571
  var isSingleNonGenericCandidate_1 = !candidate.typeParameters;
@@ -107395,10 +107400,6 @@ var ts;
107395
107400
  programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? "out" : "outFile"));
107396
107401
  }
107397
107402
  }
107398
- // Without a package name, for multiple files being bundled into a .d.ts file you basically get a file which doesn't wrk
107399
- if (outputFile && ts.getEmitDeclarations(options) && ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeJs && !options.bundledPackageName) {
107400
- createDiagnosticForOptionName(ts.Diagnostics.The_bundledPackageName_option_must_be_provided_when_using_outFile_and_node_module_resolution_with_declaration_emit, options.out ? "out" : "outFile");
107401
- }
107402
107403
  if (options.resolveJsonModule) {
107403
107404
  if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) {
107404
107405
  createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
@@ -110255,7 +110256,7 @@ var ts;
110255
110256
  function getLocalModuleSpecifier(moduleFileName, _a, compilerOptions, host, _b) {
110256
110257
  var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
110257
110258
  var ending = _b.ending, relativePreference = _b.relativePreference;
110258
- var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs, bundledPackageName = compilerOptions.bundledPackageName;
110259
+ var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
110259
110260
  var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
110260
110261
  removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
110261
110262
  if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
@@ -110266,9 +110267,8 @@ var ts;
110266
110267
  if (!relativeToBaseUrl) {
110267
110268
  return relativePath;
110268
110269
  }
110269
- var bundledPkgReference = bundledPackageName ? ts.combinePaths(bundledPackageName, relativeToBaseUrl) : relativeToBaseUrl;
110270
- var importRelativeToBaseUrl = removeExtensionAndIndexPostFix(bundledPkgReference, ending, compilerOptions);
110271
- var fromPaths = paths && tryGetModuleNameFromPaths(ts.removeFileExtension(bundledPkgReference), importRelativeToBaseUrl, paths);
110270
+ var importRelativeToBaseUrl = removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions);
110271
+ var fromPaths = paths && tryGetModuleNameFromPaths(ts.removeFileExtension(relativeToBaseUrl), importRelativeToBaseUrl, paths);
110272
110272
  var nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
110273
110273
  if (!nonRelative) {
110274
110274
  return relativePath;
@@ -115418,8 +115418,7 @@ var ts;
115418
115418
  getSourceFiles: function () { return program.getSourceFiles(); },
115419
115419
  redirectTargetsMap: program.redirectTargetsMap,
115420
115420
  getProjectReferenceRedirect: function (fileName) { return program.getProjectReferenceRedirect(fileName); },
115421
- isSourceOfProjectReferenceRedirect: function (fileName) { return program.isSourceOfProjectReferenceRedirect(fileName); },
115422
- getCompilerOptions: function () { return program.getCompilerOptions(); }
115421
+ isSourceOfProjectReferenceRedirect: function (fileName) { return program.isSourceOfProjectReferenceRedirect(fileName); }
115423
115422
  };
115424
115423
  }
115425
115424
  ts.createModuleSpecifierResolutionHost = createModuleSpecifierResolutionHost;
@@ -147434,7 +147433,7 @@ var ts;
147434
147433
  * This is a semantic operation.
147435
147434
  */
147436
147435
  function getSignatureHelpItems(fileName, position, _a) {
147437
- var triggerReason = (_a === void 0 ? ts.emptyOptions : _a).triggerReason;
147436
+ var _b = _a === void 0 ? ts.emptyOptions : _a, triggerReason = _b.triggerReason;
147438
147437
  synchronizeHostData();
147439
147438
  var sourceFile = getValidSourceFile(fileName);
147440
147439
  return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, triggerReason, cancellationToken);