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.
@@ -68,7 +68,7 @@ var __extends = (this && this.__extends) || (function () {
68
68
  var extendStatics = function (d, b) {
69
69
  extendStatics = Object.setPrototypeOf ||
70
70
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
71
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
71
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
72
72
  return extendStatics(d, b);
73
73
  };
74
74
  return function (d, b) {
@@ -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 = ts.versionMajorMinor + ".0-dev.20201102";
86
+ ts.version = "4.1.4";
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,
@@ -48099,7 +48102,6 @@ var ts;
48099
48102
  }
48100
48103
  function getSpecifierForModuleSymbol(symbol, context) {
48101
48104
  var _a;
48102
- var _b;
48103
48105
  var file = ts.getDeclarationOfKind(symbol, 297 /* SourceFile */);
48104
48106
  if (!file) {
48105
48107
  var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); });
@@ -48144,7 +48146,7 @@ var ts;
48144
48146
  var moduleResolverHost = context.tracker.moduleResolverHost;
48145
48147
  var specifierCompilerOptions = isBundle_1 ? __assign(__assign({}, compilerOptions), { baseUrl: moduleResolverHost.getCommonSourceDirectory() }) : compilerOptions;
48146
48148
  specifier = ts.first(ts.moduleSpecifiers.getModuleSpecifiers(symbol, specifierCompilerOptions, contextFile, moduleResolverHost, { importModuleSpecifierPreference: isBundle_1 ? "non-relative" : "relative", importModuleSpecifierEnding: isBundle_1 ? "minimal" : undefined }));
48147
- (_a = (_b = links).specifierCache) !== null && _a !== void 0 ? _a : (_b.specifierCache = new ts.Map());
48149
+ (_a = links.specifierCache) !== null && _a !== void 0 ? _a : (links.specifierCache = new ts.Map());
48148
48150
  links.specifierCache.set(contextFile.path, specifier);
48149
48151
  }
48150
48152
  return specifier;
@@ -48586,8 +48588,7 @@ var ts;
48586
48588
  var resolverHost = {
48587
48589
  getCanonicalFileName: getCanonicalFileName,
48588
48590
  getCurrentDirectory: function () { return context.tracker.moduleResolverHost.getCurrentDirectory(); },
48589
- getCommonSourceDirectory: function () { return context.tracker.moduleResolverHost.getCommonSourceDirectory(); },
48590
- getCompilerOptions: function () { return context.tracker.moduleResolverHost.getCompilerOptions(); }
48591
+ getCommonSourceDirectory: function () { return context.tracker.moduleResolverHost.getCommonSourceDirectory(); }
48591
48592
  };
48592
48593
  var newName = ts.getResolvedExternalModuleName(resolverHost, targetFile);
48593
48594
  return ts.factory.createStringLiteral(newName);
@@ -63111,6 +63112,7 @@ var ts;
63111
63112
  return errorType;
63112
63113
  }
63113
63114
  flowDepth++;
63115
+ var sharedFlow;
63114
63116
  while (true) {
63115
63117
  var flags = flow.flags;
63116
63118
  if (flags & 4096 /* Shared */) {
@@ -63123,6 +63125,7 @@ var ts;
63123
63125
  return sharedFlowTypes[i];
63124
63126
  }
63125
63127
  }
63128
+ sharedFlow = flow;
63126
63129
  }
63127
63130
  var type = void 0;
63128
63131
  if (flags & 16 /* Assignment */) {
@@ -63186,9 +63189,9 @@ var ts;
63186
63189
  // simply return the non-auto declared type to reduce follow-on errors.
63187
63190
  type = convertAutoToAny(declaredType);
63188
63191
  }
63189
- if (flags & 4096 /* Shared */) {
63192
+ if (sharedFlow) {
63190
63193
  // Record visited node and the associated type in the cache.
63191
- sharedFlowNodes[sharedFlowCount] = flow;
63194
+ sharedFlowNodes[sharedFlowCount] = sharedFlow;
63192
63195
  sharedFlowTypes[sharedFlowCount] = type;
63193
63196
  sharedFlowCount++;
63194
63197
  }
@@ -66316,10 +66319,10 @@ var ts;
66316
66319
  return links.jsxNamespace;
66317
66320
  }
66318
66321
  if (!links || links.jsxNamespace !== false) {
66319
- var namespaceName = getJsxNamespace(location);
66320
- var resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
66322
+ var resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
66321
66323
  if (!resolvedNamespace || resolvedNamespace === unknownSymbol) {
66322
- resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
66324
+ var namespaceName = getJsxNamespace(location);
66325
+ resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
66323
66326
  }
66324
66327
  if (resolvedNamespace) {
66325
66328
  var candidate = resolveSymbol(getSymbol(getExportsOfSymbol(resolveSymbol(resolvedNamespace)), JsxNames.JSX, 1920 /* Namespace */));
@@ -66526,23 +66529,25 @@ var ts;
66526
66529
  checkGrammarJsxElement(node);
66527
66530
  }
66528
66531
  checkJsxPreconditions(node);
66529
- // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
66530
- // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
66531
- var jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
66532
- var jsxFactoryNamespace = getJsxNamespace(node);
66533
- var jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
66534
- // allow null as jsxFragmentFactory
66535
- var jsxFactorySym;
66536
- if (!(ts.isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
66537
- jsxFactorySym = resolveName(jsxFactoryLocation, jsxFactoryNamespace, 111551 /* Value */, jsxFactoryRefErr, jsxFactoryNamespace, /*isUse*/ true);
66538
- }
66539
- if (jsxFactorySym) {
66540
- // Mark local symbol as referenced here because it might not have been marked
66541
- // if jsx emit was not jsxFactory as there wont be error being emitted
66542
- jsxFactorySym.isReferenced = 67108863 /* All */;
66543
- // If react/jsxFactory symbol is alias, mark it as refereced
66544
- if (jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
66545
- 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
+ }
66546
66551
  }
66547
66552
  }
66548
66553
  if (isNodeOpeningLikeElement) {
@@ -68353,9 +68358,9 @@ var ts;
68353
68358
  var oldCandidatesForArgumentError = candidatesForArgumentError;
68354
68359
  var oldCandidateForArgumentArityError = candidateForArgumentArityError;
68355
68360
  var oldCandidateForTypeArgumentError = candidateForTypeArgumentError;
68356
- var declCount = ts.length((_a = failed.declaration) === null || _a === void 0 ? void 0 : _a.symbol.declarations);
68357
- var isOverload = declCount > 1;
68358
- 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;
68359
68364
  if (implDecl) {
68360
68365
  var candidate = getSignatureFromDeclaration(implDecl);
68361
68366
  var isSingleNonGenericCandidate_1 = !candidate.typeParameters;
@@ -107190,10 +107195,6 @@ var ts;
107190
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"));
107191
107196
  }
107192
107197
  }
107193
- // Without a package name, for multiple files being bundled into a .d.ts file you basically get a file which doesn't wrk
107194
- if (outputFile && ts.getEmitDeclarations(options) && ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeJs && !options.bundledPackageName) {
107195
- createDiagnosticForOptionName(ts.Diagnostics.The_bundledPackageName_option_must_be_provided_when_using_outFile_and_node_module_resolution_with_declaration_emit, options.out ? "out" : "outFile");
107196
- }
107197
107198
  if (options.resolveJsonModule) {
107198
107199
  if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) {
107199
107200
  createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
@@ -110050,7 +110051,7 @@ var ts;
110050
110051
  function getLocalModuleSpecifier(moduleFileName, _a, compilerOptions, host, _b) {
110051
110052
  var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
110052
110053
  var ending = _b.ending, relativePreference = _b.relativePreference;
110053
- var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs, bundledPackageName = compilerOptions.bundledPackageName;
110054
+ var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
110054
110055
  var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
110055
110056
  removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
110056
110057
  if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
@@ -110061,9 +110062,8 @@ var ts;
110061
110062
  if (!relativeToBaseUrl) {
110062
110063
  return relativePath;
110063
110064
  }
110064
- var bundledPkgReference = bundledPackageName ? ts.combinePaths(bundledPackageName, relativeToBaseUrl) : relativeToBaseUrl;
110065
- var importRelativeToBaseUrl = removeExtensionAndIndexPostFix(bundledPkgReference, ending, compilerOptions);
110066
- 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);
110067
110067
  var nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
110068
110068
  if (!nonRelative) {
110069
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.0-dev.20201102",
5
+ "version": "4.1.4",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -54,9 +54,9 @@
54
54
  "@types/through2": "latest",
55
55
  "@types/travis-fold": "latest",
56
56
  "@types/xml2js": "^0.4.0",
57
- "@typescript-eslint/eslint-plugin": "^3.6.1-alpha.1",
58
- "@typescript-eslint/experimental-utils": "^3.4.1-alpha.1",
59
- "@typescript-eslint/parser": "^3.4.1-alpha.1",
57
+ "@typescript-eslint/eslint-plugin": "4.5.0",
58
+ "@typescript-eslint/experimental-utils": "4.5.0",
59
+ "@typescript-eslint/parser": "4.5.0",
60
60
  "async": "latest",
61
61
  "azure-devops-node-api": "^10.1.0",
62
62
  "browser-resolve": "^1.11.2",
@@ -66,10 +66,10 @@
66
66
  "convert-source-map": "latest",
67
67
  "del": "5.1.0",
68
68
  "diff": "^4.0.2",
69
- "eslint": "6.8.0",
70
- "eslint-formatter-autolinkable-stylish": "1.1.2",
71
- "eslint-plugin-import": "2.20.2",
72
- "eslint-plugin-jsdoc": "22.1.0",
69
+ "eslint": "7.12.1",
70
+ "eslint-formatter-autolinkable-stylish": "1.1.4",
71
+ "eslint-plugin-import": "2.22.1",
72
+ "eslint-plugin-jsdoc": "30.7.6",
73
73
  "eslint-plugin-no-null": "1.0.2",
74
74
  "fancy-log": "latest",
75
75
  "fs-extra": "^9.0.0",
@@ -130,4 +130,4 @@
130
130
  "inspector": false
131
131
  },
132
132
  "dependencies": {}
133
- }
133
+ }