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;
@@ -83,7 +83,7 @@ var ts;
83
83
  // If changing the text in this section, be sure to test `configurePrerelease` too.
84
84
  ts.versionMajorMinor = "4.1";
85
85
  /** The version of the TypeScript compiler release */
86
- ts.version = "4.1.1-rc";
86
+ ts.version = "4.1.5";
87
87
  /* @internal */
88
88
  var Comparison;
89
89
  (function (Comparison) {
@@ -7786,8 +7786,6 @@ var ts;
7786
7786
  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."),
7787
7787
  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."),
7788
7788
  _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."),
7789
- 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."),
7790
- 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."),
7791
7789
  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."),
7792
7790
  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."),
7793
7791
  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),
@@ -14036,6 +14034,18 @@ var ts;
14036
14034
  };
14037
14035
  }
14038
14036
  ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain;
14037
+ function createDiagnosticForFileFromMessageChain(sourceFile, messageChain, relatedInformation) {
14038
+ return {
14039
+ file: sourceFile,
14040
+ start: 0,
14041
+ length: 0,
14042
+ code: messageChain.code,
14043
+ category: messageChain.category,
14044
+ messageText: messageChain.next ? messageChain : messageChain.messageText,
14045
+ relatedInformation: relatedInformation
14046
+ };
14047
+ }
14048
+ ts.createDiagnosticForFileFromMessageChain = createDiagnosticForFileFromMessageChain;
14039
14049
  function createDiagnosticForRange(sourceFile, range, message) {
14040
14050
  return {
14041
14051
  file: sourceFile,
@@ -16945,16 +16955,7 @@ var ts;
16945
16955
  var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
16946
16956
  var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
16947
16957
  var extensionless = removeFileExtension(relativePath);
16948
- if (referencePath) {
16949
- return ts.ensurePathIsNonModuleName(extensionless);
16950
- }
16951
- var options = host.getCompilerOptions();
16952
- var rootPkgName = options.bundledPackageName || "";
16953
- var newPath = ts.combinePaths(rootPkgName, extensionless);
16954
- if (rootPkgName && getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeJs && ts.endsWith(newPath, "/index")) {
16955
- return newPath.slice(0, newPath.length - "/index".length);
16956
- }
16957
- return newPath;
16958
+ return referencePath ? ts.ensurePathIsNonModuleName(extensionless) : extensionless;
16958
16959
  }
16959
16960
  ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath;
16960
16961
  function getOwnEmitOutputFilePath(fileName, host, extension) {
@@ -36536,13 +36537,6 @@ var ts;
36536
36537
  category: ts.Diagnostics.Advanced_Options,
36537
36538
  description: ts.Diagnostics.Emit_class_fields_with_Define_instead_of_Set,
36538
36539
  },
36539
- {
36540
- name: "bundledPackageName",
36541
- type: "string",
36542
- affectsEmit: true,
36543
- category: ts.Diagnostics.Advanced_Options,
36544
- description: ts.Diagnostics.Provides_a_root_package_name_when_using_outFile_with_declarations,
36545
- },
36546
36540
  {
36547
36541
  name: "keyofStringsOnly",
36548
36542
  type: "boolean",
@@ -44104,6 +44098,16 @@ var ts;
44104
44098
  }
44105
44099
  }
44106
44100
  function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) {
44101
+ // Pseudo-synthesized input node
44102
+ if (location.pos < 0 || location.end < 0) {
44103
+ if (!isError) {
44104
+ return; // Drop suggestions (we have no span to suggest on)
44105
+ }
44106
+ // Issue errors globally
44107
+ var file = ts.getSourceFileOfNode(location);
44108
+ 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
44109
+ return;
44110
+ }
44107
44111
  addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator
44108
44112
  }
44109
44113
  function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) {
@@ -45679,7 +45683,7 @@ var ts;
45679
45683
  var resolved = getExternalModuleMember(root, commonJSPropertyAccess || node, dontResolveAlias);
45680
45684
  var name = node.propertyName || node.name;
45681
45685
  if (commonJSPropertyAccess && resolved && ts.isIdentifier(name)) {
45682
- return getPropertyOfType(getTypeOfSymbol(resolved), name.escapedText);
45686
+ return resolveSymbol(getPropertyOfType(getTypeOfSymbol(resolved), name.escapedText), dontResolveAlias);
45683
45687
  }
45684
45688
  markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false);
45685
45689
  return resolved;
@@ -47106,7 +47110,6 @@ var ts;
47106
47110
  getProjectReferenceRedirect: function (fileName) { return host.getProjectReferenceRedirect(fileName); },
47107
47111
  isSourceOfProjectReferenceRedirect: function (fileName) { return host.isSourceOfProjectReferenceRedirect(fileName); },
47108
47112
  fileExists: function (fileName) { return host.fileExists(fileName); },
47109
- getCompilerOptions: function () { return host.getCompilerOptions(); }
47110
47113
  } : undefined },
47111
47114
  encounteredError: false,
47112
47115
  visitedTypes: undefined,
@@ -48585,8 +48588,7 @@ var ts;
48585
48588
  var resolverHost = {
48586
48589
  getCanonicalFileName: getCanonicalFileName,
48587
48590
  getCurrentDirectory: function () { return context.tracker.moduleResolverHost.getCurrentDirectory(); },
48588
- getCommonSourceDirectory: function () { return context.tracker.moduleResolverHost.getCommonSourceDirectory(); },
48589
- getCompilerOptions: function () { return context.tracker.moduleResolverHost.getCompilerOptions(); }
48591
+ getCommonSourceDirectory: function () { return context.tracker.moduleResolverHost.getCommonSourceDirectory(); }
48590
48592
  };
48591
48593
  var newName = ts.getResolvedExternalModuleName(resolverHost, targetFile);
48592
48594
  return ts.factory.createStringLiteral(newName);
@@ -63110,6 +63112,7 @@ var ts;
63110
63112
  return errorType;
63111
63113
  }
63112
63114
  flowDepth++;
63115
+ var sharedFlow;
63113
63116
  while (true) {
63114
63117
  var flags = flow.flags;
63115
63118
  if (flags & 4096 /* Shared */) {
@@ -63122,6 +63125,7 @@ var ts;
63122
63125
  return sharedFlowTypes[i];
63123
63126
  }
63124
63127
  }
63128
+ sharedFlow = flow;
63125
63129
  }
63126
63130
  var type = void 0;
63127
63131
  if (flags & 16 /* Assignment */) {
@@ -63185,9 +63189,9 @@ var ts;
63185
63189
  // simply return the non-auto declared type to reduce follow-on errors.
63186
63190
  type = convertAutoToAny(declaredType);
63187
63191
  }
63188
- if (flags & 4096 /* Shared */) {
63192
+ if (sharedFlow) {
63189
63193
  // Record visited node and the associated type in the cache.
63190
- sharedFlowNodes[sharedFlowCount] = flow;
63194
+ sharedFlowNodes[sharedFlowCount] = sharedFlow;
63191
63195
  sharedFlowTypes[sharedFlowCount] = type;
63192
63196
  sharedFlowCount++;
63193
63197
  }
@@ -66315,10 +66319,10 @@ var ts;
66315
66319
  return links.jsxNamespace;
66316
66320
  }
66317
66321
  if (!links || links.jsxNamespace !== false) {
66318
- var namespaceName = getJsxNamespace(location);
66319
- var resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
66322
+ var resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
66320
66323
  if (!resolvedNamespace || resolvedNamespace === unknownSymbol) {
66321
- resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
66324
+ var namespaceName = getJsxNamespace(location);
66325
+ resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
66322
66326
  }
66323
66327
  if (resolvedNamespace) {
66324
66328
  var candidate = resolveSymbol(getSymbol(getExportsOfSymbol(resolveSymbol(resolvedNamespace)), JsxNames.JSX, 1920 /* Namespace */));
@@ -66525,23 +66529,25 @@ var ts;
66525
66529
  checkGrammarJsxElement(node);
66526
66530
  }
66527
66531
  checkJsxPreconditions(node);
66528
- // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
66529
- // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
66530
- var jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
66531
- var jsxFactoryNamespace = getJsxNamespace(node);
66532
- var jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
66533
- // allow null as jsxFragmentFactory
66534
- var jsxFactorySym;
66535
- if (!(ts.isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
66536
- jsxFactorySym = resolveName(jsxFactoryLocation, jsxFactoryNamespace, 111551 /* Value */, jsxFactoryRefErr, jsxFactoryNamespace, /*isUse*/ true);
66537
- }
66538
- if (jsxFactorySym) {
66539
- // Mark local symbol as referenced here because it might not have been marked
66540
- // if jsx emit was not jsxFactory as there wont be error being emitted
66541
- jsxFactorySym.isReferenced = 67108863 /* All */;
66542
- // If react/jsxFactory symbol is alias, mark it as refereced
66543
- if (jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
66544
- markAliasSymbolAsReferenced(jsxFactorySym);
66532
+ if (!getJsxNamespaceContainerForImplicitImport(node)) {
66533
+ // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
66534
+ // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
66535
+ var jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
66536
+ var jsxFactoryNamespace = getJsxNamespace(node);
66537
+ var jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
66538
+ // allow null as jsxFragmentFactory
66539
+ var jsxFactorySym = void 0;
66540
+ if (!(ts.isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
66541
+ jsxFactorySym = resolveName(jsxFactoryLocation, jsxFactoryNamespace, 111551 /* Value */, jsxFactoryRefErr, jsxFactoryNamespace, /*isUse*/ true);
66542
+ }
66543
+ if (jsxFactorySym) {
66544
+ // Mark local symbol as referenced here because it might not have been marked
66545
+ // if jsx emit was not jsxFactory as there wont be error being emitted
66546
+ jsxFactorySym.isReferenced = 67108863 /* All */;
66547
+ // If react/jsxFactory symbol is alias, mark it as refereced
66548
+ if (jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
66549
+ markAliasSymbolAsReferenced(jsxFactorySym);
66550
+ }
66545
66551
  }
66546
66552
  }
66547
66553
  if (isNodeOpeningLikeElement) {
@@ -68352,9 +68358,9 @@ var ts;
68352
68358
  var oldCandidatesForArgumentError = candidatesForArgumentError;
68353
68359
  var oldCandidateForArgumentArityError = candidateForArgumentArityError;
68354
68360
  var oldCandidateForTypeArgumentError = candidateForTypeArgumentError;
68355
- var declCount = ts.length((_a = failed.declaration) === null || _a === void 0 ? void 0 : _a.symbol.declarations);
68356
- var isOverload = declCount > 1;
68357
- 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;
68361
+ var failedSignatureDeclarations = ((_b = (_a = failed.declaration) === null || _a === void 0 ? void 0 : _a.symbol) === null || _b === void 0 ? void 0 : _b.declarations) || ts.emptyArray;
68362
+ var isOverload = failedSignatureDeclarations.length > 1;
68363
+ var implDecl = isOverload ? ts.find(failedSignatureDeclarations, function (d) { return ts.isFunctionLikeDeclaration(d) && ts.nodeIsPresent(d.body); }) : undefined;
68358
68364
  if (implDecl) {
68359
68365
  var candidate = getSignatureFromDeclaration(implDecl);
68360
68366
  var isSingleNonGenericCandidate_1 = !candidate.typeParameters;
@@ -107189,10 +107195,6 @@ var ts;
107189
107195
  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"));
107190
107196
  }
107191
107197
  }
107192
- // Without a package name, for multiple files being bundled into a .d.ts file you basically get a file which doesn't wrk
107193
- if (outputFile && ts.getEmitDeclarations(options) && ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeJs && !options.bundledPackageName) {
107194
- createDiagnosticForOptionName(ts.Diagnostics.The_bundledPackageName_option_must_be_provided_when_using_outFile_and_node_module_resolution_with_declaration_emit, options.out ? "out" : "outFile");
107195
- }
107196
107198
  if (options.resolveJsonModule) {
107197
107199
  if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) {
107198
107200
  createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
@@ -110049,7 +110051,7 @@ var ts;
110049
110051
  function getLocalModuleSpecifier(moduleFileName, _a, compilerOptions, host, _b) {
110050
110052
  var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
110051
110053
  var ending = _b.ending, relativePreference = _b.relativePreference;
110052
- var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs, bundledPackageName = compilerOptions.bundledPackageName;
110054
+ var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
110053
110055
  var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
110054
110056
  removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
110055
110057
  if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
@@ -110060,9 +110062,8 @@ var ts;
110060
110062
  if (!relativeToBaseUrl) {
110061
110063
  return relativePath;
110062
110064
  }
110063
- var bundledPkgReference = bundledPackageName ? ts.combinePaths(bundledPackageName, relativeToBaseUrl) : relativeToBaseUrl;
110064
- var importRelativeToBaseUrl = removeExtensionAndIndexPostFix(bundledPkgReference, ending, compilerOptions);
110065
- var fromPaths = paths && tryGetModuleNameFromPaths(ts.removeFileExtension(bundledPkgReference), importRelativeToBaseUrl, paths);
110065
+ var importRelativeToBaseUrl = removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions);
110066
+ var fromPaths = paths && tryGetModuleNameFromPaths(ts.removeFileExtension(relativeToBaseUrl), importRelativeToBaseUrl, paths);
110066
110067
  var nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
110067
110068
  if (!nonRelative) {
110068
110069
  return relativePath;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.1.1-rc",
5
+ "version": "4.1.5",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [