typescript 4.1.1-rc → 4.1.5

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.
@@ -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 = "4.1.1-rc";
291
+ ts.version = "4.1.5";
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,
@@ -48790,8 +48793,7 @@ var ts;
48790
48793
  var resolverHost = {
48791
48794
  getCanonicalFileName: getCanonicalFileName,
48792
48795
  getCurrentDirectory: function () { return context.tracker.moduleResolverHost.getCurrentDirectory(); },
48793
- getCommonSourceDirectory: function () { return context.tracker.moduleResolverHost.getCommonSourceDirectory(); },
48794
- getCompilerOptions: function () { return context.tracker.moduleResolverHost.getCompilerOptions(); }
48796
+ getCommonSourceDirectory: function () { return context.tracker.moduleResolverHost.getCommonSourceDirectory(); }
48795
48797
  };
48796
48798
  var newName = ts.getResolvedExternalModuleName(resolverHost, targetFile);
48797
48799
  return ts.factory.createStringLiteral(newName);
@@ -63315,6 +63317,7 @@ var ts;
63315
63317
  return errorType;
63316
63318
  }
63317
63319
  flowDepth++;
63320
+ var sharedFlow;
63318
63321
  while (true) {
63319
63322
  var flags = flow.flags;
63320
63323
  if (flags & 4096 /* Shared */) {
@@ -63327,6 +63330,7 @@ var ts;
63327
63330
  return sharedFlowTypes[i];
63328
63331
  }
63329
63332
  }
63333
+ sharedFlow = flow;
63330
63334
  }
63331
63335
  var type = void 0;
63332
63336
  if (flags & 16 /* Assignment */) {
@@ -63390,9 +63394,9 @@ var ts;
63390
63394
  // simply return the non-auto declared type to reduce follow-on errors.
63391
63395
  type = convertAutoToAny(declaredType);
63392
63396
  }
63393
- if (flags & 4096 /* Shared */) {
63397
+ if (sharedFlow) {
63394
63398
  // Record visited node and the associated type in the cache.
63395
- sharedFlowNodes[sharedFlowCount] = flow;
63399
+ sharedFlowNodes[sharedFlowCount] = sharedFlow;
63396
63400
  sharedFlowTypes[sharedFlowCount] = type;
63397
63401
  sharedFlowCount++;
63398
63402
  }
@@ -66520,10 +66524,10 @@ var ts;
66520
66524
  return links.jsxNamespace;
66521
66525
  }
66522
66526
  if (!links || links.jsxNamespace !== false) {
66523
- var namespaceName = getJsxNamespace(location);
66524
- var resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
66527
+ var resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
66525
66528
  if (!resolvedNamespace || resolvedNamespace === unknownSymbol) {
66526
- resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
66529
+ var namespaceName = getJsxNamespace(location);
66530
+ resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
66527
66531
  }
66528
66532
  if (resolvedNamespace) {
66529
66533
  var candidate = resolveSymbol(getSymbol(getExportsOfSymbol(resolveSymbol(resolvedNamespace)), JsxNames.JSX, 1920 /* Namespace */));
@@ -66730,23 +66734,25 @@ var ts;
66730
66734
  checkGrammarJsxElement(node);
66731
66735
  }
66732
66736
  checkJsxPreconditions(node);
66733
- // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
66734
- // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
66735
- var jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
66736
- var jsxFactoryNamespace = getJsxNamespace(node);
66737
- var jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
66738
- // allow null as jsxFragmentFactory
66739
- var jsxFactorySym;
66740
- if (!(ts.isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
66741
- jsxFactorySym = resolveName(jsxFactoryLocation, jsxFactoryNamespace, 111551 /* Value */, jsxFactoryRefErr, jsxFactoryNamespace, /*isUse*/ true);
66742
- }
66743
- if (jsxFactorySym) {
66744
- // Mark local symbol as referenced here because it might not have been marked
66745
- // if jsx emit was not jsxFactory as there wont be error being emitted
66746
- jsxFactorySym.isReferenced = 67108863 /* All */;
66747
- // If react/jsxFactory symbol is alias, mark it as refereced
66748
- if (jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
66749
- 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
+ }
66750
66756
  }
66751
66757
  }
66752
66758
  if (isNodeOpeningLikeElement) {
@@ -68557,9 +68563,9 @@ var ts;
68557
68563
  var oldCandidatesForArgumentError = candidatesForArgumentError;
68558
68564
  var oldCandidateForArgumentArityError = candidateForArgumentArityError;
68559
68565
  var oldCandidateForTypeArgumentError = candidateForTypeArgumentError;
68560
- var declCount = ts.length((_a = failed.declaration) === null || _a === void 0 ? void 0 : _a.symbol.declarations);
68561
- var isOverload = declCount > 1;
68562
- 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;
68563
68569
  if (implDecl) {
68564
68570
  var candidate = getSignatureFromDeclaration(implDecl);
68565
68571
  var isSingleNonGenericCandidate_1 = !candidate.typeParameters;
@@ -107394,10 +107400,6 @@ var ts;
107394
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"));
107395
107401
  }
107396
107402
  }
107397
- // Without a package name, for multiple files being bundled into a .d.ts file you basically get a file which doesn't wrk
107398
- if (outputFile && ts.getEmitDeclarations(options) && ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeJs && !options.bundledPackageName) {
107399
- createDiagnosticForOptionName(ts.Diagnostics.The_bundledPackageName_option_must_be_provided_when_using_outFile_and_node_module_resolution_with_declaration_emit, options.out ? "out" : "outFile");
107400
- }
107401
107403
  if (options.resolveJsonModule) {
107402
107404
  if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) {
107403
107405
  createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
@@ -110254,7 +110256,7 @@ var ts;
110254
110256
  function getLocalModuleSpecifier(moduleFileName, _a, compilerOptions, host, _b) {
110255
110257
  var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
110256
110258
  var ending = _b.ending, relativePreference = _b.relativePreference;
110257
- var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs, bundledPackageName = compilerOptions.bundledPackageName;
110259
+ var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
110258
110260
  var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
110259
110261
  removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
110260
110262
  if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
@@ -110265,9 +110267,8 @@ var ts;
110265
110267
  if (!relativeToBaseUrl) {
110266
110268
  return relativePath;
110267
110269
  }
110268
- var bundledPkgReference = bundledPackageName ? ts.combinePaths(bundledPackageName, relativeToBaseUrl) : relativeToBaseUrl;
110269
- var importRelativeToBaseUrl = removeExtensionAndIndexPostFix(bundledPkgReference, ending, compilerOptions);
110270
- 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);
110271
110272
  var nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
110272
110273
  if (!nonRelative) {
110273
110274
  return relativePath;
@@ -115417,8 +115418,7 @@ var ts;
115417
115418
  getSourceFiles: function () { return program.getSourceFiles(); },
115418
115419
  redirectTargetsMap: program.redirectTargetsMap,
115419
115420
  getProjectReferenceRedirect: function (fileName) { return program.getProjectReferenceRedirect(fileName); },
115420
- isSourceOfProjectReferenceRedirect: function (fileName) { return program.isSourceOfProjectReferenceRedirect(fileName); },
115421
- getCompilerOptions: function () { return program.getCompilerOptions(); }
115421
+ isSourceOfProjectReferenceRedirect: function (fileName) { return program.isSourceOfProjectReferenceRedirect(fileName); }
115422
115422
  };
115423
115423
  }
115424
115424
  ts.createModuleSpecifierResolutionHost = createModuleSpecifierResolutionHost;
@@ -150177,6 +150177,8 @@ var ts;
150177
150177
  JsxEmit["Preserve"] = "Preserve";
150178
150178
  JsxEmit["ReactNative"] = "ReactNative";
150179
150179
  JsxEmit["React"] = "React";
150180
+ JsxEmit["ReactJSX"] = "ReactJSX";
150181
+ JsxEmit["ReactJSXDev"] = "ReactJSXDev";
150180
150182
  })(JsxEmit = protocol.JsxEmit || (protocol.JsxEmit = {}));
150181
150183
  var ModuleKind;
150182
150184
  (function (ModuleKind) {
@@ -150187,6 +150189,7 @@ var ts;
150187
150189
  ModuleKind["System"] = "System";
150188
150190
  ModuleKind["ES6"] = "ES6";
150189
150191
  ModuleKind["ES2015"] = "ES2015";
150192
+ ModuleKind["ES2020"] = "ES2020";
150190
150193
  ModuleKind["ESNext"] = "ESNext";
150191
150194
  })(ModuleKind = protocol.ModuleKind || (protocol.ModuleKind = {}));
150192
150195
  var ModuleResolutionKind;
@@ -150210,6 +150213,7 @@ var ts;
150210
150213
  ScriptTarget["ES2018"] = "ES2018";
150211
150214
  ScriptTarget["ES2019"] = "ES2019";
150212
150215
  ScriptTarget["ES2020"] = "ES2020";
150216
+ ScriptTarget["JSON"] = "JSON";
150213
150217
  ScriptTarget["ESNext"] = "ESNext";
150214
150218
  })(ScriptTarget = protocol.ScriptTarget || (protocol.ScriptTarget = {}));
150215
150219
  })(protocol = server.protocol || (server.protocol = {}));
@@ -152149,6 +152153,10 @@ var ts;
152149
152153
  Project.prototype.enablePlugin = function (pluginConfigEntry, searchPaths, pluginConfigOverrides) {
152150
152154
  var _this = this;
152151
152155
  this.projectService.logger.info("Enabling plugin " + pluginConfigEntry.name + " from candidate paths: " + searchPaths.join(","));
152156
+ if (!pluginConfigEntry.name || ts.parsePackageName(pluginConfigEntry.name).rest) {
152157
+ this.projectService.logger.info("Skipped loading plugin " + (pluginConfigEntry.name || JSON.stringify(pluginConfigEntry)) + " because only package name is allowed plugin name");
152158
+ return;
152159
+ }
152152
152160
  var log = function (message) { return _this.projectService.logger.info(message); };
152153
152161
  var errorLogs;
152154
152162
  var logError = function (message) { (errorLogs || (errorLogs = [])).push(message); };
@@ -157274,7 +157282,7 @@ var ts;
157274
157282
  };
157275
157283
  Session.prototype.getEncodedSemanticClassifications = function (args) {
157276
157284
  var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
157277
- return project.getLanguageService().getEncodedSemanticClassifications(file, args);
157285
+ return project.getLanguageService().getEncodedSemanticClassifications(file, args, args.format);
157278
157286
  };
157279
157287
  Session.prototype.getProject = function (projectFileName) {
157280
157288
  return projectFileName === undefined ? undefined : this.projectService.findProject(projectFileName);
@@ -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;
package/lib/typescript.js CHANGED
@@ -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 = "4.1.1-rc";
291
+ ts.version = "4.1.5";
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,
@@ -48790,8 +48793,7 @@ var ts;
48790
48793
  var resolverHost = {
48791
48794
  getCanonicalFileName: getCanonicalFileName,
48792
48795
  getCurrentDirectory: function () { return context.tracker.moduleResolverHost.getCurrentDirectory(); },
48793
- getCommonSourceDirectory: function () { return context.tracker.moduleResolverHost.getCommonSourceDirectory(); },
48794
- getCompilerOptions: function () { return context.tracker.moduleResolverHost.getCompilerOptions(); }
48796
+ getCommonSourceDirectory: function () { return context.tracker.moduleResolverHost.getCommonSourceDirectory(); }
48795
48797
  };
48796
48798
  var newName = ts.getResolvedExternalModuleName(resolverHost, targetFile);
48797
48799
  return ts.factory.createStringLiteral(newName);
@@ -63315,6 +63317,7 @@ var ts;
63315
63317
  return errorType;
63316
63318
  }
63317
63319
  flowDepth++;
63320
+ var sharedFlow;
63318
63321
  while (true) {
63319
63322
  var flags = flow.flags;
63320
63323
  if (flags & 4096 /* Shared */) {
@@ -63327,6 +63330,7 @@ var ts;
63327
63330
  return sharedFlowTypes[i];
63328
63331
  }
63329
63332
  }
63333
+ sharedFlow = flow;
63330
63334
  }
63331
63335
  var type = void 0;
63332
63336
  if (flags & 16 /* Assignment */) {
@@ -63390,9 +63394,9 @@ var ts;
63390
63394
  // simply return the non-auto declared type to reduce follow-on errors.
63391
63395
  type = convertAutoToAny(declaredType);
63392
63396
  }
63393
- if (flags & 4096 /* Shared */) {
63397
+ if (sharedFlow) {
63394
63398
  // Record visited node and the associated type in the cache.
63395
- sharedFlowNodes[sharedFlowCount] = flow;
63399
+ sharedFlowNodes[sharedFlowCount] = sharedFlow;
63396
63400
  sharedFlowTypes[sharedFlowCount] = type;
63397
63401
  sharedFlowCount++;
63398
63402
  }
@@ -66520,10 +66524,10 @@ var ts;
66520
66524
  return links.jsxNamespace;
66521
66525
  }
66522
66526
  if (!links || links.jsxNamespace !== false) {
66523
- var namespaceName = getJsxNamespace(location);
66524
- var resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
66527
+ var resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
66525
66528
  if (!resolvedNamespace || resolvedNamespace === unknownSymbol) {
66526
- resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
66529
+ var namespaceName = getJsxNamespace(location);
66530
+ resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
66527
66531
  }
66528
66532
  if (resolvedNamespace) {
66529
66533
  var candidate = resolveSymbol(getSymbol(getExportsOfSymbol(resolveSymbol(resolvedNamespace)), JsxNames.JSX, 1920 /* Namespace */));
@@ -66730,23 +66734,25 @@ var ts;
66730
66734
  checkGrammarJsxElement(node);
66731
66735
  }
66732
66736
  checkJsxPreconditions(node);
66733
- // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
66734
- // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
66735
- var jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
66736
- var jsxFactoryNamespace = getJsxNamespace(node);
66737
- var jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
66738
- // allow null as jsxFragmentFactory
66739
- var jsxFactorySym;
66740
- if (!(ts.isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
66741
- jsxFactorySym = resolveName(jsxFactoryLocation, jsxFactoryNamespace, 111551 /* Value */, jsxFactoryRefErr, jsxFactoryNamespace, /*isUse*/ true);
66742
- }
66743
- if (jsxFactorySym) {
66744
- // Mark local symbol as referenced here because it might not have been marked
66745
- // if jsx emit was not jsxFactory as there wont be error being emitted
66746
- jsxFactorySym.isReferenced = 67108863 /* All */;
66747
- // If react/jsxFactory symbol is alias, mark it as refereced
66748
- if (jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
66749
- 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
+ }
66750
66756
  }
66751
66757
  }
66752
66758
  if (isNodeOpeningLikeElement) {
@@ -68557,9 +68563,9 @@ var ts;
68557
68563
  var oldCandidatesForArgumentError = candidatesForArgumentError;
68558
68564
  var oldCandidateForArgumentArityError = candidateForArgumentArityError;
68559
68565
  var oldCandidateForTypeArgumentError = candidateForTypeArgumentError;
68560
- var declCount = ts.length((_a = failed.declaration) === null || _a === void 0 ? void 0 : _a.symbol.declarations);
68561
- var isOverload = declCount > 1;
68562
- 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;
68563
68569
  if (implDecl) {
68564
68570
  var candidate = getSignatureFromDeclaration(implDecl);
68565
68571
  var isSingleNonGenericCandidate_1 = !candidate.typeParameters;
@@ -107394,10 +107400,6 @@ var ts;
107394
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"));
107395
107401
  }
107396
107402
  }
107397
- // Without a package name, for multiple files being bundled into a .d.ts file you basically get a file which doesn't wrk
107398
- if (outputFile && ts.getEmitDeclarations(options) && ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeJs && !options.bundledPackageName) {
107399
- createDiagnosticForOptionName(ts.Diagnostics.The_bundledPackageName_option_must_be_provided_when_using_outFile_and_node_module_resolution_with_declaration_emit, options.out ? "out" : "outFile");
107400
- }
107401
107403
  if (options.resolveJsonModule) {
107402
107404
  if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) {
107403
107405
  createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
@@ -110254,7 +110256,7 @@ var ts;
110254
110256
  function getLocalModuleSpecifier(moduleFileName, _a, compilerOptions, host, _b) {
110255
110257
  var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
110256
110258
  var ending = _b.ending, relativePreference = _b.relativePreference;
110257
- var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs, bundledPackageName = compilerOptions.bundledPackageName;
110259
+ var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
110258
110260
  var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
110259
110261
  removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
110260
110262
  if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
@@ -110265,9 +110267,8 @@ var ts;
110265
110267
  if (!relativeToBaseUrl) {
110266
110268
  return relativePath;
110267
110269
  }
110268
- var bundledPkgReference = bundledPackageName ? ts.combinePaths(bundledPackageName, relativeToBaseUrl) : relativeToBaseUrl;
110269
- var importRelativeToBaseUrl = removeExtensionAndIndexPostFix(bundledPkgReference, ending, compilerOptions);
110270
- 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);
110271
110272
  var nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
110272
110273
  if (!nonRelative) {
110273
110274
  return relativePath;
@@ -115417,8 +115418,7 @@ var ts;
115417
115418
  getSourceFiles: function () { return program.getSourceFiles(); },
115418
115419
  redirectTargetsMap: program.redirectTargetsMap,
115419
115420
  getProjectReferenceRedirect: function (fileName) { return program.getProjectReferenceRedirect(fileName); },
115420
- isSourceOfProjectReferenceRedirect: function (fileName) { return program.isSourceOfProjectReferenceRedirect(fileName); },
115421
- getCompilerOptions: function () { return program.getCompilerOptions(); }
115421
+ isSourceOfProjectReferenceRedirect: function (fileName) { return program.isSourceOfProjectReferenceRedirect(fileName); }
115422
115422
  };
115423
115423
  }
115424
115424
  ts.createModuleSpecifierResolutionHost = createModuleSpecifierResolutionHost;
@@ -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;