Skip to content

Commit 8b5c5e1

Browse files
committed
Update to TypeScript 4.1.2
1 parent 0f58d2d commit 8b5c5e1

File tree

2 files changed

+52
-55
lines changed

2 files changed

+52
-55
lines changed

cli/dts/typescript.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -2790,7 +2790,6 @@ declare namespace ts {
27902790
allowUnusedLabels?: boolean;
27912791
alwaysStrict?: boolean;
27922792
baseUrl?: string;
2793-
bundledPackageName?: string;
27942793
charset?: string;
27952794
checkJs?: boolean;
27962795
declaration?: boolean;

cli/tsc/00_typescript.js

+52-54
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ var ts;
288288
// If changing the text in this section, be sure to test `configurePrerelease` too.
289289
ts.versionMajorMinor = "4.1";
290290
/** The version of the TypeScript compiler release */
291-
ts.version = "4.1.1-rc";
291+
ts.version = "4.1.2";
292292
/* @internal */
293293
var Comparison;
294294
(function (Comparison) {
@@ -7991,8 +7991,6 @@ var ts;
79917991
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."),
79927992
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."),
79937993
_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."),
79967994
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."),
79977995
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."),
79987996
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;
1424114239
};
1424214240
}
1424314241
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;
1424414254
function createDiagnosticForRange(sourceFile, range, message) {
1424514255
return {
1424614256
file: sourceFile,
@@ -17150,16 +17160,7 @@ var ts;
1715017160
var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
1715117161
var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
1715217162
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;
1716317164
}
1716417165
ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath;
1716517166
function getOwnEmitOutputFilePath(fileName, host, extension) {
@@ -36741,13 +36742,6 @@ var ts;
3674136742
category: ts.Diagnostics.Advanced_Options,
3674236743
description: ts.Diagnostics.Emit_class_fields_with_Define_instead_of_Set,
3674336744
},
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-
},
3675136745
{
3675236746
name: "keyofStringsOnly",
3675336747
type: "boolean",
@@ -44309,6 +44303,16 @@ var ts;
4430944303
}
4431044304
}
4431144305
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+
}
4431244316
addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator
4431344317
}
4431444318
function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) {
@@ -47311,7 +47315,6 @@ var ts;
4731147315
getProjectReferenceRedirect: function (fileName) { return host.getProjectReferenceRedirect(fileName); },
4731247316
isSourceOfProjectReferenceRedirect: function (fileName) { return host.isSourceOfProjectReferenceRedirect(fileName); },
4731347317
fileExists: function (fileName) { return host.fileExists(fileName); },
47314-
getCompilerOptions: function () { return host.getCompilerOptions(); }
4731547318
} : undefined },
4731647319
encounteredError: false,
4731747320
visitedTypes: undefined,
@@ -48790,8 +48793,7 @@ var ts;
4879048793
var resolverHost = {
4879148794
getCanonicalFileName: getCanonicalFileName,
4879248795
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(); }
4879548797
};
4879648798
var newName = ts.getResolvedExternalModuleName(resolverHost, targetFile);
4879748799
return ts.factory.createStringLiteral(newName);
@@ -66520,10 +66522,10 @@ var ts;
6652066522
return links.jsxNamespace;
6652166523
}
6652266524
if (!links || links.jsxNamespace !== false) {
66523-
var namespaceName = getJsxNamespace(location);
66524-
var resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
66525+
var resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
6652566526
if (!resolvedNamespace || resolvedNamespace === unknownSymbol) {
66526-
resolvedNamespace = getJsxNamespaceContainerForImplicitImport(location);
66527+
var namespaceName = getJsxNamespace(location);
66528+
resolvedNamespace = resolveName(location, namespaceName, 1920 /* Namespace */, /*diagnosticMessage*/ undefined, namespaceName, /*isUse*/ false);
6652766529
}
6652866530
if (resolvedNamespace) {
6652966531
var candidate = resolveSymbol(getSymbol(getExportsOfSymbol(resolveSymbol(resolvedNamespace)), JsxNames.JSX, 1920 /* Namespace */));
@@ -66730,23 +66732,25 @@ var ts;
6673066732
checkGrammarJsxElement(node);
6673166733
}
6673266734
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);
66735+
if (!getJsxNamespaceContainerForImplicitImport(node)) {
66736+
// The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
66737+
// And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
66738+
var jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined;
66739+
var jsxFactoryNamespace = getJsxNamespace(node);
66740+
var jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
66741+
// allow null as jsxFragmentFactory
66742+
var jsxFactorySym = void 0;
66743+
if (!(ts.isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
66744+
jsxFactorySym = resolveName(jsxFactoryLocation, jsxFactoryNamespace, 111551 /* Value */, jsxFactoryRefErr, jsxFactoryNamespace, /*isUse*/ true);
66745+
}
66746+
if (jsxFactorySym) {
66747+
// Mark local symbol as referenced here because it might not have been marked
66748+
// if jsx emit was not jsxFactory as there wont be error being emitted
66749+
jsxFactorySym.isReferenced = 67108863 /* All */;
66750+
// If react/jsxFactory symbol is alias, mark it as refereced
66751+
if (jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
66752+
markAliasSymbolAsReferenced(jsxFactorySym);
66753+
}
6675066754
}
6675166755
}
6675266756
if (isNodeOpeningLikeElement) {
@@ -107394,10 +107398,6 @@ var ts;
107394107398
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"));
107395107399
}
107396107400
}
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-
}
107401107401
if (options.resolveJsonModule) {
107402107402
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) {
107403107403
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
@@ -110254,7 +110254,7 @@ var ts;
110254110254
function getLocalModuleSpecifier(moduleFileName, _a, compilerOptions, host, _b) {
110255110255
var getCanonicalFileName = _a.getCanonicalFileName, sourceDirectory = _a.sourceDirectory;
110256110256
var ending = _b.ending, relativePreference = _b.relativePreference;
110257-
var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs, bundledPackageName = compilerOptions.bundledPackageName;
110257+
var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
110258110258
var relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
110259110259
removeExtensionAndIndexPostFix(ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
110260110260
if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
@@ -110265,9 +110265,8 @@ var ts;
110265110265
if (!relativeToBaseUrl) {
110266110266
return relativePath;
110267110267
}
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);
110268+
var importRelativeToBaseUrl = removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions);
110269+
var fromPaths = paths && tryGetModuleNameFromPaths(ts.removeFileExtension(relativeToBaseUrl), importRelativeToBaseUrl, paths);
110271110270
var nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
110272110271
if (!nonRelative) {
110273110272
return relativePath;
@@ -115417,8 +115416,7 @@ var ts;
115417115416
getSourceFiles: function () { return program.getSourceFiles(); },
115418115417
redirectTargetsMap: program.redirectTargetsMap,
115419115418
getProjectReferenceRedirect: function (fileName) { return program.getProjectReferenceRedirect(fileName); },
115420-
isSourceOfProjectReferenceRedirect: function (fileName) { return program.isSourceOfProjectReferenceRedirect(fileName); },
115421-
getCompilerOptions: function () { return program.getCompilerOptions(); }
115419+
isSourceOfProjectReferenceRedirect: function (fileName) { return program.isSourceOfProjectReferenceRedirect(fileName); }
115422115420
};
115423115421
}
115424115422
ts.createModuleSpecifierResolutionHost = createModuleSpecifierResolutionHost;
@@ -147433,7 +147431,7 @@ var ts;
147433147431
* This is a semantic operation.
147434147432
*/
147435147433
function getSignatureHelpItems(fileName, position, _a) {
147436-
var triggerReason = (_a === void 0 ? ts.emptyOptions : _a).triggerReason;
147434+
var _b = _a === void 0 ? ts.emptyOptions : _a, triggerReason = _b.triggerReason;
147437147435
synchronizeHostData();
147438147436
var sourceFile = getValidSourceFile(fileName);
147439147437
return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, triggerReason, cancellationToken);

0 commit comments

Comments
 (0)