typescript 4.5.0-dev.20211026 → 4.5.0-dev.20211030
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cs/diagnosticMessages.generated.json +1 -0
- package/lib/de/diagnosticMessages.generated.json +1 -0
- package/lib/es/diagnosticMessages.generated.json +1 -0
- package/lib/fr/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +1 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +1 -0
- package/lib/lib.dom.d.ts +186 -92
- package/lib/lib.dom.iterable.d.ts +1 -7
- package/lib/lib.webworker.d.ts +60 -19
- package/lib/lib.webworker.iterable.d.ts +0 -7
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/protocol.d.ts +7 -0
- package/lib/pt-br/diagnosticMessages.generated.json +1 -0
- package/lib/ru/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +319 -127
- package/lib/tsserver.js +652 -196
- package/lib/tsserverlibrary.d.ts +8 -0
- package/lib/tsserverlibrary.js +652 -196
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +648 -196
- package/lib/typescriptServices.d.ts +1 -0
- package/lib/typescriptServices.js +648 -196
- package/lib/typingsInstaller.js +380 -133
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -0
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211030";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -2540,6 +2540,10 @@ var ts;
|
|
|
2540
2540
|
return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
|
|
2541
2541
|
}
|
|
2542
2542
|
Debug.formatSyntaxKind = formatSyntaxKind;
|
|
2543
|
+
function formatSnippetKind(kind) {
|
|
2544
|
+
return formatEnum(kind, ts.SnippetKind, /*isFlags*/ false);
|
|
2545
|
+
}
|
|
2546
|
+
Debug.formatSnippetKind = formatSnippetKind;
|
|
2543
2547
|
function formatNodeFlags(flags) {
|
|
2544
2548
|
return formatEnum(flags, ts.NodeFlags, /*isFlags*/ true);
|
|
2545
2549
|
}
|
|
@@ -4456,6 +4460,13 @@ var ts;
|
|
|
4456
4460
|
ExitStatus[ExitStatus["ProjectReferenceCycle_OutputsSkupped"] = 4] = "ProjectReferenceCycle_OutputsSkupped";
|
|
4457
4461
|
})(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {}));
|
|
4458
4462
|
/* @internal */
|
|
4463
|
+
var MemberOverrideStatus;
|
|
4464
|
+
(function (MemberOverrideStatus) {
|
|
4465
|
+
MemberOverrideStatus[MemberOverrideStatus["Ok"] = 0] = "Ok";
|
|
4466
|
+
MemberOverrideStatus[MemberOverrideStatus["NeedsOverride"] = 1] = "NeedsOverride";
|
|
4467
|
+
MemberOverrideStatus[MemberOverrideStatus["HasInvalidOverride"] = 2] = "HasInvalidOverride";
|
|
4468
|
+
})(MemberOverrideStatus = ts.MemberOverrideStatus || (ts.MemberOverrideStatus = {}));
|
|
4469
|
+
/* @internal */
|
|
4459
4470
|
var UnionReduction;
|
|
4460
4471
|
(function (UnionReduction) {
|
|
4461
4472
|
UnionReduction[UnionReduction["None"] = 0] = "None";
|
|
@@ -5104,7 +5115,7 @@ var ts;
|
|
|
5104
5115
|
(function (ModuleResolutionKind) {
|
|
5105
5116
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5106
5117
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5107
|
-
// Starting with node12, node's module resolver has significant departures from
|
|
5118
|
+
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
|
|
5108
5119
|
// to better support ecmascript modules and their use within node - more features are still being added, so
|
|
5109
5120
|
// we can expect it to change over time, and as such, offer both a `NodeNext` moving resolution target, and a `Node12`
|
|
5110
5121
|
// version-anchored resolution target
|
|
@@ -5437,6 +5448,15 @@ var ts;
|
|
|
5437
5448
|
// Masks
|
|
5438
5449
|
// - Additional bitmasks
|
|
5439
5450
|
})(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {}));
|
|
5451
|
+
// Reference: https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax
|
|
5452
|
+
/* @internal */
|
|
5453
|
+
var SnippetKind;
|
|
5454
|
+
(function (SnippetKind) {
|
|
5455
|
+
SnippetKind[SnippetKind["TabStop"] = 0] = "TabStop";
|
|
5456
|
+
SnippetKind[SnippetKind["Placeholder"] = 1] = "Placeholder";
|
|
5457
|
+
SnippetKind[SnippetKind["Choice"] = 2] = "Choice";
|
|
5458
|
+
SnippetKind[SnippetKind["Variable"] = 3] = "Variable";
|
|
5459
|
+
})(SnippetKind = ts.SnippetKind || (ts.SnippetKind = {}));
|
|
5440
5460
|
var EmitFlags;
|
|
5441
5461
|
(function (EmitFlags) {
|
|
5442
5462
|
EmitFlags[EmitFlags["None"] = 0] = "None";
|
|
@@ -8673,6 +8693,8 @@ var ts;
|
|
|
8673
8693
|
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext: diag(2821, ts.DiagnosticCategory.Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext'."),
|
|
8674
8694
|
Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, ts.DiagnosticCategory.Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
|
|
8675
8695
|
Cannot_find_namespace_0_Did_you_mean_1: diag(2833, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
|
|
8696
|
+
Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path."),
|
|
8697
|
+
Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"),
|
|
8676
8698
|
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
8677
8699
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
8678
8700
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -8779,6 +8801,7 @@ var ts;
|
|
|
8779
8801
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class: diag(4121, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_4121", "This member cannot have a JSDoc comment with an '@override' tag because its containing class '{0}' does not extend another class."),
|
|
8780
8802
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
|
|
8781
8803
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
|
|
8804
|
+
Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, ts.DiagnosticCategory.Error, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
8782
8805
|
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
|
8783
8806
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
8784
8807
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
|
@@ -9332,6 +9355,7 @@ var ts;
|
|
|
9332
9355
|
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead: diag(7059, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059", "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."),
|
|
9333
9356
|
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint: diag(7060, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060", "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."),
|
|
9334
9357
|
A_mapped_type_may_not_declare_properties_or_methods: diag(7061, ts.DiagnosticCategory.Error, "A_mapped_type_may_not_declare_properties_or_methods_7061", "A mapped type may not declare properties or methods."),
|
|
9358
|
+
JSON_imports_are_experimental_in_ES_module_mode_imports: diag(7062, ts.DiagnosticCategory.Error, "JSON_imports_are_experimental_in_ES_module_mode_imports_7062", "JSON imports are experimental in ES module mode imports."),
|
|
9335
9359
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9336
9360
|
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
|
|
9337
9361
|
import_can_only_be_used_in_TypeScript_files: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_TypeScript_files_8002", "'import ... =' can only be used in TypeScript files."),
|
|
@@ -9435,6 +9459,7 @@ var ts;
|
|
|
9435
9459
|
Remove_unused_destructuring_declaration: diag(90039, ts.DiagnosticCategory.Message, "Remove_unused_destructuring_declaration_90039", "Remove unused destructuring declaration"),
|
|
9436
9460
|
Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
|
|
9437
9461
|
Declare_a_private_field_named_0: diag(90053, ts.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."),
|
|
9462
|
+
Includes_imports_of_types_referenced_by_0: diag(90054, ts.DiagnosticCategory.Message, "Includes_imports_of_types_referenced_by_0_90054", "Includes imports of types referenced by '{0}'"),
|
|
9438
9463
|
Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
|
|
9439
9464
|
Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
|
|
9440
9465
|
Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
|
|
@@ -19628,6 +19653,8 @@ var ts;
|
|
|
19628
19653
|
case ts.ModuleKind.ES2020:
|
|
19629
19654
|
case ts.ModuleKind.ES2022:
|
|
19630
19655
|
case ts.ModuleKind.ESNext:
|
|
19656
|
+
case ts.ModuleKind.Node12:
|
|
19657
|
+
case ts.ModuleKind.NodeNext:
|
|
19631
19658
|
return true;
|
|
19632
19659
|
default:
|
|
19633
19660
|
return false;
|
|
@@ -20739,6 +20766,10 @@ var ts;
|
|
|
20739
20766
|
return node.kind === 212 /* FunctionExpression */ || node.kind === 213 /* ArrowFunction */;
|
|
20740
20767
|
}
|
|
20741
20768
|
ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction;
|
|
20769
|
+
function escapeSnippetText(text) {
|
|
20770
|
+
return text.replace(/\$/gm, "\\$");
|
|
20771
|
+
}
|
|
20772
|
+
ts.escapeSnippetText = escapeSnippetText;
|
|
20742
20773
|
})(ts || (ts = {}));
|
|
20743
20774
|
/* @internal */
|
|
20744
20775
|
var ts;
|
|
@@ -26942,6 +26973,25 @@ var ts;
|
|
|
26942
26973
|
}
|
|
26943
26974
|
}
|
|
26944
26975
|
ts.moveEmitHelpers = moveEmitHelpers;
|
|
26976
|
+
/**
|
|
26977
|
+
* Gets the SnippetElement of a node.
|
|
26978
|
+
*/
|
|
26979
|
+
/* @internal */
|
|
26980
|
+
function getSnippetElement(node) {
|
|
26981
|
+
var _a;
|
|
26982
|
+
return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.snippetElement;
|
|
26983
|
+
}
|
|
26984
|
+
ts.getSnippetElement = getSnippetElement;
|
|
26985
|
+
/**
|
|
26986
|
+
* Sets the SnippetElement of a node.
|
|
26987
|
+
*/
|
|
26988
|
+
/* @internal */
|
|
26989
|
+
function setSnippetElement(node, snippet) {
|
|
26990
|
+
var emitNode = getOrCreateEmitNode(node);
|
|
26991
|
+
emitNode.snippetElement = snippet;
|
|
26992
|
+
return node;
|
|
26993
|
+
}
|
|
26994
|
+
ts.setSnippetElement = setSnippetElement;
|
|
26945
26995
|
/* @internal */
|
|
26946
26996
|
function ignoreSourceNewlines(node) {
|
|
26947
26997
|
getOrCreateEmitNode(node).flags |= 134217728 /* IgnoreSourceNewlines */;
|
|
@@ -47067,6 +47117,7 @@ var ts;
|
|
|
47067
47117
|
isDeclarationVisible: isDeclarationVisible,
|
|
47068
47118
|
isPropertyAccessible: isPropertyAccessible,
|
|
47069
47119
|
getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration,
|
|
47120
|
+
getMemberOverrideModifierStatus: getMemberOverrideModifierStatus,
|
|
47070
47121
|
};
|
|
47071
47122
|
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
|
|
47072
47123
|
var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
|
|
@@ -47310,6 +47361,21 @@ var ts;
|
|
|
47310
47361
|
var enumRelation = new ts.Map();
|
|
47311
47362
|
var builtinGlobals = ts.createSymbolTable();
|
|
47312
47363
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
47364
|
+
// Extensions suggested for path imports when module resolution is node12 or higher.
|
|
47365
|
+
// The first element of each tuple is the extension a file has.
|
|
47366
|
+
// The second element of each tuple is the extension that should be used in a path import.
|
|
47367
|
+
// e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
|
|
47368
|
+
var suggestedExtensions = [
|
|
47369
|
+
[".mts", ".mjs"],
|
|
47370
|
+
[".ts", ".js"],
|
|
47371
|
+
[".cts", ".cjs"],
|
|
47372
|
+
[".mjs", ".mjs"],
|
|
47373
|
+
[".js", ".js"],
|
|
47374
|
+
[".cjs", ".cjs"],
|
|
47375
|
+
[".tsx", compilerOptions.jsx === 1 /* Preserve */ ? ".jsx" : ".js"],
|
|
47376
|
+
[".jsx", ".jsx"],
|
|
47377
|
+
[".json", ".json"],
|
|
47378
|
+
];
|
|
47313
47379
|
initializeTypeChecker();
|
|
47314
47380
|
return checker;
|
|
47315
47381
|
function getJsxNamespace(location) {
|
|
@@ -48813,6 +48879,10 @@ var ts;
|
|
|
48813
48879
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
48814
48880
|
return usageMode === ts.ModuleKind.ESNext && targetMode === ts.ModuleKind.CommonJS;
|
|
48815
48881
|
}
|
|
48882
|
+
function isOnlyImportedAsDefault(usage) {
|
|
48883
|
+
var usageMode = getUsageModeForExpression(usage);
|
|
48884
|
+
return usageMode === ts.ModuleKind.ESNext && ts.endsWith(usage.text, ".json" /* Json */);
|
|
48885
|
+
}
|
|
48816
48886
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
48817
48887
|
var usageMode = file && getUsageModeForExpression(usage);
|
|
48818
48888
|
if (file && usageMode !== undefined) {
|
|
@@ -48863,8 +48933,9 @@ var ts;
|
|
|
48863
48933
|
exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, node, dontResolveAlias);
|
|
48864
48934
|
}
|
|
48865
48935
|
var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
48936
|
+
var hasDefaultOnly = isOnlyImportedAsDefault(node.parent.moduleSpecifier);
|
|
48866
48937
|
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, node.parent.moduleSpecifier);
|
|
48867
|
-
if (!exportDefaultSymbol && !hasSyntheticDefault) {
|
|
48938
|
+
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
48868
48939
|
if (hasExportAssignmentSymbol(moduleSymbol)) {
|
|
48869
48940
|
var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
48870
48941
|
var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
@@ -48878,7 +48949,7 @@ var ts;
|
|
|
48878
48949
|
reportNonDefaultExport(moduleSymbol, node);
|
|
48879
48950
|
}
|
|
48880
48951
|
}
|
|
48881
|
-
else if (hasSyntheticDefault) {
|
|
48952
|
+
else if (hasSyntheticDefault || hasDefaultOnly) {
|
|
48882
48953
|
// per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
|
|
48883
48954
|
var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
48884
48955
|
markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
|
|
@@ -49003,7 +49074,7 @@ var ts;
|
|
|
49003
49074
|
var symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
|
|
49004
49075
|
if (symbolFromModule === undefined && name.escapedText === "default" /* Default */) {
|
|
49005
49076
|
var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
49006
|
-
if (canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
49077
|
+
if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
49007
49078
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
49008
49079
|
}
|
|
49009
49080
|
}
|
|
@@ -49520,7 +49591,7 @@ var ts;
|
|
|
49520
49591
|
: undefined;
|
|
49521
49592
|
}
|
|
49522
49593
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {
|
|
49523
|
-
var _a, _b, _c, _d, _e, _f;
|
|
49594
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
49524
49595
|
if (isForAugmentation === void 0) { isForAugmentation = false; }
|
|
49525
49596
|
if (ts.startsWith(moduleReference, "@types/")) {
|
|
49526
49597
|
var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
@@ -49541,7 +49612,7 @@ var ts;
|
|
|
49541
49612
|
((_e = (ts.isModuleDeclaration(location) ? location : location.parent && ts.isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : undefined)) === null || _e === void 0 ? void 0 : _e.name) ||
|
|
49542
49613
|
((_f = (ts.isLiteralImportTypeNode(location) ? location : undefined)) === null || _f === void 0 ? void 0 : _f.argument.literal);
|
|
49543
49614
|
var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
49544
|
-
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49615
|
+
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49545
49616
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
49546
49617
|
var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
49547
49618
|
if (sourceFile) {
|
|
@@ -49554,6 +49625,9 @@ var ts;
|
|
|
49554
49625
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
49555
49626
|
error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
|
|
49556
49627
|
}
|
|
49628
|
+
if (mode === ts.ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === ".json" /* Json */) {
|
|
49629
|
+
error(errorNode, ts.Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
|
|
49630
|
+
}
|
|
49557
49631
|
}
|
|
49558
49632
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
49559
49633
|
return getMergedSymbol(sourceFile.symbol);
|
|
@@ -49604,6 +49678,10 @@ var ts;
|
|
|
49604
49678
|
}
|
|
49605
49679
|
else {
|
|
49606
49680
|
var tsExtension = ts.tryExtractTSExtension(moduleReference);
|
|
49681
|
+
var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
|
|
49682
|
+
var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
|
|
49683
|
+
var resolutionIsNode12OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node12 ||
|
|
49684
|
+
moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
|
|
49607
49685
|
if (tsExtension) {
|
|
49608
49686
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
49609
49687
|
var importSourceWithoutExtension = ts.removeExtension(moduleReference, tsExtension);
|
|
@@ -49623,6 +49701,19 @@ var ts;
|
|
|
49623
49701
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
49624
49702
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
49625
49703
|
}
|
|
49704
|
+
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode12OrNext && isExtensionlessRelativePathImport) {
|
|
49705
|
+
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
49706
|
+
var suggestedExt = (_g = suggestedExtensions.find(function (_a) {
|
|
49707
|
+
var actualExt = _a[0], _importExt = _a[1];
|
|
49708
|
+
return host.fileExists(absoluteRef_1 + actualExt);
|
|
49709
|
+
})) === null || _g === void 0 ? void 0 : _g[1];
|
|
49710
|
+
if (suggestedExt) {
|
|
49711
|
+
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
49712
|
+
}
|
|
49713
|
+
else {
|
|
49714
|
+
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
49715
|
+
}
|
|
49716
|
+
}
|
|
49626
49717
|
else {
|
|
49627
49718
|
error(errorNode, moduleNotFoundError, moduleReference);
|
|
49628
49719
|
}
|
|
@@ -49692,40 +49783,50 @@ var ts;
|
|
|
49692
49783
|
error(referencingLocation, ts.Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, compilerOptionName);
|
|
49693
49784
|
return symbol;
|
|
49694
49785
|
}
|
|
49695
|
-
|
|
49696
|
-
|
|
49697
|
-
|
|
49698
|
-
|
|
49699
|
-
|
|
49786
|
+
var referenceParent = referencingLocation.parent;
|
|
49787
|
+
if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) ||
|
|
49788
|
+
ts.isImportCall(referenceParent)) {
|
|
49789
|
+
var reference = ts.isImportCall(referenceParent) ? referenceParent.arguments[0] : referenceParent.moduleSpecifier;
|
|
49790
|
+
var type = getTypeOfSymbol(symbol);
|
|
49791
|
+
var defaultOnlyType = getTypeWithSyntheticDefaultOnly(type, symbol, moduleSymbol, reference);
|
|
49792
|
+
if (defaultOnlyType) {
|
|
49793
|
+
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
49794
|
+
}
|
|
49795
|
+
if (ts.getESModuleInterop(compilerOptions)) {
|
|
49700
49796
|
var sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
49701
49797
|
if (!sigs || !sigs.length) {
|
|
49702
49798
|
sigs = getSignaturesOfStructuredType(type, 1 /* Construct */);
|
|
49703
49799
|
}
|
|
49704
|
-
if (sigs && sigs.length) {
|
|
49705
|
-
var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol,
|
|
49706
|
-
|
|
49707
|
-
var result = createSymbol(symbol.flags, symbol.escapedName);
|
|
49708
|
-
result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
|
|
49709
|
-
result.parent = symbol.parent;
|
|
49710
|
-
result.target = symbol;
|
|
49711
|
-
result.originatingImport = referenceParent;
|
|
49712
|
-
if (symbol.valueDeclaration)
|
|
49713
|
-
result.valueDeclaration = symbol.valueDeclaration;
|
|
49714
|
-
if (symbol.constEnumOnlyModule)
|
|
49715
|
-
result.constEnumOnlyModule = true;
|
|
49716
|
-
if (symbol.members)
|
|
49717
|
-
result.members = new ts.Map(symbol.members);
|
|
49718
|
-
if (symbol.exports)
|
|
49719
|
-
result.exports = new ts.Map(symbol.exports);
|
|
49720
|
-
var resolvedModuleType = resolveStructuredTypeMembers(moduleType); // Should already be resolved from the signature checks above
|
|
49721
|
-
result.type = createAnonymousType(result, resolvedModuleType.members, ts.emptyArray, ts.emptyArray, resolvedModuleType.indexInfos);
|
|
49722
|
-
return result;
|
|
49800
|
+
if ((sigs && sigs.length) || getPropertyOfType(type, "default" /* Default */)) {
|
|
49801
|
+
var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference);
|
|
49802
|
+
return cloneTypeAsModuleType(symbol, moduleType, referenceParent);
|
|
49723
49803
|
}
|
|
49724
49804
|
}
|
|
49725
49805
|
}
|
|
49726
49806
|
}
|
|
49727
49807
|
return symbol;
|
|
49728
49808
|
}
|
|
49809
|
+
/**
|
|
49810
|
+
* Create a new symbol which has the module's type less the call and construct signatures
|
|
49811
|
+
*/
|
|
49812
|
+
function cloneTypeAsModuleType(symbol, moduleType, referenceParent) {
|
|
49813
|
+
var result = createSymbol(symbol.flags, symbol.escapedName);
|
|
49814
|
+
result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
|
|
49815
|
+
result.parent = symbol.parent;
|
|
49816
|
+
result.target = symbol;
|
|
49817
|
+
result.originatingImport = referenceParent;
|
|
49818
|
+
if (symbol.valueDeclaration)
|
|
49819
|
+
result.valueDeclaration = symbol.valueDeclaration;
|
|
49820
|
+
if (symbol.constEnumOnlyModule)
|
|
49821
|
+
result.constEnumOnlyModule = true;
|
|
49822
|
+
if (symbol.members)
|
|
49823
|
+
result.members = new ts.Map(symbol.members);
|
|
49824
|
+
if (symbol.exports)
|
|
49825
|
+
result.exports = new ts.Map(symbol.exports);
|
|
49826
|
+
var resolvedModuleType = resolveStructuredTypeMembers(moduleType); // Should already be resolved from the signature checks above
|
|
49827
|
+
result.type = createAnonymousType(result, resolvedModuleType.members, ts.emptyArray, ts.emptyArray, resolvedModuleType.indexInfos);
|
|
49828
|
+
return result;
|
|
49829
|
+
}
|
|
49729
49830
|
function hasExportAssignmentSymbol(moduleSymbol) {
|
|
49730
49831
|
return moduleSymbol.exports.get("export=" /* ExportEquals */) !== undefined;
|
|
49731
49832
|
}
|
|
@@ -59331,7 +59432,7 @@ var ts;
|
|
|
59331
59432
|
var _loop_16 = function () {
|
|
59332
59433
|
i--;
|
|
59333
59434
|
var t = types[i];
|
|
59334
|
-
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return
|
|
59435
|
+
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
59335
59436
|
ts.orderedRemoveItemAt(types, i);
|
|
59336
59437
|
}
|
|
59337
59438
|
};
|
|
@@ -61524,7 +61625,9 @@ var ts;
|
|
|
61524
61625
|
return mapTypeWithAlias(getReducedType(mappedTypeVariable), function (t) {
|
|
61525
61626
|
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
61526
61627
|
if (!type.declaration.nameType) {
|
|
61527
|
-
|
|
61628
|
+
var constraint = void 0;
|
|
61629
|
+
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 &&
|
|
61630
|
+
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, ts.or(isArrayType, isTupleType))) {
|
|
61528
61631
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
61529
61632
|
}
|
|
61530
61633
|
if (isGenericTupleType(t)) {
|
|
@@ -63064,13 +63167,12 @@ var ts;
|
|
|
63064
63167
|
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
63065
63168
|
var result = 0 /* False */;
|
|
63066
63169
|
var saveErrorInfo = captureErrorCalculationState();
|
|
63067
|
-
|
|
63068
|
-
|
|
63069
|
-
|
|
63070
|
-
|
|
63071
|
-
|
|
63072
|
-
|
|
63073
|
-
structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
|
|
63170
|
+
if ((source.flags & 1048576 /* Union */ || target.flags & 1048576 /* Union */) && getConstituentCount(source) * getConstituentCount(target) < 4) {
|
|
63171
|
+
// We skip caching when source or target is a union with no more than three constituents.
|
|
63172
|
+
result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
|
|
63173
|
+
}
|
|
63174
|
+
else if (source.flags & 3145728 /* UnionOrIntersection */ || target.flags & 3145728 /* UnionOrIntersection */) {
|
|
63175
|
+
result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */, recursionFlags);
|
|
63074
63176
|
}
|
|
63075
63177
|
if (!result && !(source.flags & 1048576 /* Union */) && (source.flags & (469499904 /* StructuredOrInstantiable */) || target.flags & 469499904 /* StructuredOrInstantiable */)) {
|
|
63076
63178
|
if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags)) {
|
|
@@ -63527,19 +63629,19 @@ var ts;
|
|
|
63527
63629
|
var maybeStart = maybeCount;
|
|
63528
63630
|
maybeKeys[maybeCount] = id;
|
|
63529
63631
|
maybeCount++;
|
|
63632
|
+
var saveExpandingFlags = expandingFlags;
|
|
63530
63633
|
if (recursionFlags & 1 /* Source */) {
|
|
63531
63634
|
sourceStack[sourceDepth] = source;
|
|
63532
63635
|
sourceDepth++;
|
|
63636
|
+
if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
|
|
63637
|
+
expandingFlags |= 1 /* Source */;
|
|
63533
63638
|
}
|
|
63534
63639
|
if (recursionFlags & 2 /* Target */) {
|
|
63535
63640
|
targetStack[targetDepth] = target;
|
|
63536
63641
|
targetDepth++;
|
|
63642
|
+
if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
|
|
63643
|
+
expandingFlags |= 2 /* Target */;
|
|
63537
63644
|
}
|
|
63538
|
-
var saveExpandingFlags = expandingFlags;
|
|
63539
|
-
if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
|
|
63540
|
-
expandingFlags |= 1 /* Source */;
|
|
63541
|
-
if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
|
|
63542
|
-
expandingFlags |= 2 /* Target */;
|
|
63543
63645
|
var originalHandler;
|
|
63544
63646
|
var propagatingVarianceFlags = 0;
|
|
63545
63647
|
if (outofbandVarianceMarkerHandler) {
|
|
@@ -63563,13 +63665,13 @@ var ts;
|
|
|
63563
63665
|
if (outofbandVarianceMarkerHandler) {
|
|
63564
63666
|
outofbandVarianceMarkerHandler = originalHandler;
|
|
63565
63667
|
}
|
|
63566
|
-
expandingFlags = saveExpandingFlags;
|
|
63567
63668
|
if (recursionFlags & 1 /* Source */) {
|
|
63568
63669
|
sourceDepth--;
|
|
63569
63670
|
}
|
|
63570
63671
|
if (recursionFlags & 2 /* Target */) {
|
|
63571
63672
|
targetDepth--;
|
|
63572
63673
|
}
|
|
63674
|
+
expandingFlags = saveExpandingFlags;
|
|
63573
63675
|
if (result) {
|
|
63574
63676
|
if (result === -1 /* True */ || (sourceDepth === 0 && targetDepth === 0)) {
|
|
63575
63677
|
if (result === -1 /* True */ || result === 3 /* Maybe */) {
|
|
@@ -63907,8 +64009,7 @@ var ts;
|
|
|
63907
64009
|
// For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
|
|
63908
64010
|
instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
|
|
63909
64011
|
}
|
|
63910
|
-
|
|
63911
|
-
if (result_9 && ts.every(result_9, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); })) {
|
|
64012
|
+
if (isTypeMatchedByTemplateLiteralType(source, target)) {
|
|
63912
64013
|
return -1 /* True */;
|
|
63913
64014
|
}
|
|
63914
64015
|
}
|
|
@@ -64103,9 +64204,9 @@ var ts;
|
|
|
64103
64204
|
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 1048576 /* Union */) {
|
|
64104
64205
|
var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */ | 2097152 /* Intersection */ | 33554432 /* Substitution */);
|
|
64105
64206
|
if (objectOnlyTarget.flags & 1048576 /* Union */) {
|
|
64106
|
-
var
|
|
64107
|
-
if (
|
|
64108
|
-
return
|
|
64207
|
+
var result_9 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
|
|
64208
|
+
if (result_9) {
|
|
64209
|
+
return result_9;
|
|
64109
64210
|
}
|
|
64110
64211
|
}
|
|
64111
64212
|
}
|
|
@@ -64177,13 +64278,13 @@ var ts;
|
|
|
64177
64278
|
var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
|
|
64178
64279
|
getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
|
|
64179
64280
|
if (modifiersRelated) {
|
|
64180
|
-
var
|
|
64281
|
+
var result_10;
|
|
64181
64282
|
var targetConstraint = getConstraintTypeFromMappedType(target);
|
|
64182
64283
|
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), makeFunctionTypeMapper(getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers));
|
|
64183
|
-
if (
|
|
64284
|
+
if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
|
|
64184
64285
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
|
|
64185
64286
|
if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
|
|
64186
|
-
return
|
|
64287
|
+
return result_10 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3 /* Both */, reportErrors);
|
|
64187
64288
|
}
|
|
64188
64289
|
}
|
|
64189
64290
|
}
|
|
@@ -66266,6 +66367,10 @@ var ts;
|
|
|
66266
66367
|
inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) :
|
|
66267
66368
|
undefined;
|
|
66268
66369
|
}
|
|
66370
|
+
function isTypeMatchedByTemplateLiteralType(source, target) {
|
|
66371
|
+
var inferences = inferTypesFromTemplateLiteralType(source, target);
|
|
66372
|
+
return !!inferences && ts.every(inferences, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); });
|
|
66373
|
+
}
|
|
66269
66374
|
function getStringLikeTypeForType(type) {
|
|
66270
66375
|
return type.flags & (1 /* Any */ | 402653316 /* StringLike */) ? type : getTemplateLiteralType(["", ""], [type]);
|
|
66271
66376
|
}
|
|
@@ -67169,8 +67274,11 @@ var ts;
|
|
|
67169
67274
|
function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
|
|
67170
67275
|
switch (node.kind) {
|
|
67171
67276
|
case 79 /* Identifier */:
|
|
67172
|
-
|
|
67173
|
-
|
|
67277
|
+
if (!ts.isThisInTypeQuery(node)) {
|
|
67278
|
+
var symbol = getResolvedSymbol(node);
|
|
67279
|
+
return symbol !== unknownSymbol ? (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType) + "|" + getSymbolId(symbol) : undefined;
|
|
67280
|
+
}
|
|
67281
|
+
// falls through
|
|
67174
67282
|
case 108 /* ThisKeyword */:
|
|
67175
67283
|
return "0|" + (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType);
|
|
67176
67284
|
case 229 /* NonNullExpression */:
|
|
@@ -67801,7 +67909,7 @@ var ts;
|
|
|
67801
67909
|
mapType(type, mapper);
|
|
67802
67910
|
}
|
|
67803
67911
|
function getConstituentCount(type) {
|
|
67804
|
-
return type.flags &
|
|
67912
|
+
return type.flags & 1048576 /* Union */ ? type.types.length : 1;
|
|
67805
67913
|
}
|
|
67806
67914
|
function extractTypesOfKind(type, kind) {
|
|
67807
67915
|
return filterType(type, function (t) { return (t.flags & kind) !== 0; });
|
|
@@ -69299,7 +69407,7 @@ var ts;
|
|
|
69299
69407
|
return parent.kind === 205 /* PropertyAccessExpression */ ||
|
|
69300
69408
|
parent.kind === 207 /* CallExpression */ && parent.expression === node ||
|
|
69301
69409
|
parent.kind === 206 /* ElementAccessExpression */ && parent.expression === node &&
|
|
69302
|
-
!(
|
|
69410
|
+
!(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
|
|
69303
69411
|
}
|
|
69304
69412
|
function isGenericTypeWithUnionConstraint(type) {
|
|
69305
69413
|
return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
|
|
@@ -74899,11 +75007,33 @@ var ts;
|
|
|
74899
75007
|
if (moduleSymbol) {
|
|
74900
75008
|
var esModuleSymbol = resolveESModuleSymbol(moduleSymbol, specifier, /*dontRecursivelyResolve*/ true, /*suppressUsageError*/ false);
|
|
74901
75009
|
if (esModuleSymbol) {
|
|
74902
|
-
return createPromiseReturnType(node,
|
|
75010
|
+
return createPromiseReturnType(node, getTypeWithSyntheticDefaultOnly(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier) ||
|
|
75011
|
+
getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier));
|
|
74903
75012
|
}
|
|
74904
75013
|
}
|
|
74905
75014
|
return createPromiseReturnType(node, anyType);
|
|
74906
75015
|
}
|
|
75016
|
+
function createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol) {
|
|
75017
|
+
var memberTable = ts.createSymbolTable();
|
|
75018
|
+
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
75019
|
+
newSymbol.parent = originalSymbol;
|
|
75020
|
+
newSymbol.nameType = getStringLiteralType("default");
|
|
75021
|
+
newSymbol.target = resolveSymbol(symbol);
|
|
75022
|
+
memberTable.set("default" /* Default */, newSymbol);
|
|
75023
|
+
return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
75024
|
+
}
|
|
75025
|
+
function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
|
|
75026
|
+
var hasDefaultOnly = isOnlyImportedAsDefault(moduleSpecifier);
|
|
75027
|
+
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
75028
|
+
var synthType = type;
|
|
75029
|
+
if (!synthType.defaultOnlyType) {
|
|
75030
|
+
var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
|
|
75031
|
+
synthType.defaultOnlyType = type_4;
|
|
75032
|
+
}
|
|
75033
|
+
return synthType.defaultOnlyType;
|
|
75034
|
+
}
|
|
75035
|
+
return undefined;
|
|
75036
|
+
}
|
|
74907
75037
|
function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) {
|
|
74908
75038
|
var _a;
|
|
74909
75039
|
if (allowSyntheticDefaultImports && type && !isErrorType(type)) {
|
|
@@ -74912,14 +75042,8 @@ var ts;
|
|
|
74912
75042
|
var file = (_a = originalSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
74913
75043
|
var hasSyntheticDefault = canHaveSyntheticDefault(file, originalSymbol, /*dontResolveAlias*/ false, moduleSpecifier);
|
|
74914
75044
|
if (hasSyntheticDefault) {
|
|
74915
|
-
var memberTable = ts.createSymbolTable();
|
|
74916
|
-
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
74917
|
-
newSymbol.parent = originalSymbol;
|
|
74918
|
-
newSymbol.nameType = getStringLiteralType("default");
|
|
74919
|
-
newSymbol.target = resolveSymbol(symbol);
|
|
74920
|
-
memberTable.set("default" /* Default */, newSymbol);
|
|
74921
75045
|
var anonymousSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
|
|
74922
|
-
var defaultContainingObject =
|
|
75046
|
+
var defaultContainingObject = createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol);
|
|
74923
75047
|
anonymousSymbol.type = defaultContainingObject;
|
|
74924
75048
|
synthType.syntheticType = isValidSpreadType(type) ? getSpreadType(type, defaultContainingObject, anonymousSymbol, /*objectFlags*/ 0, /*readonly*/ false) : defaultContainingObject;
|
|
74925
75049
|
}
|
|
@@ -75627,12 +75751,12 @@ var ts;
|
|
|
75627
75751
|
var witnesses = getSwitchClauseTypeOfWitnesses(node, /*retainDefault*/ false);
|
|
75628
75752
|
// notEqualFacts states that the type of the switched value is not equal to every type in the switch.
|
|
75629
75753
|
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true);
|
|
75630
|
-
var
|
|
75754
|
+
var type_5 = getBaseConstraintOfType(operandType) || operandType;
|
|
75631
75755
|
// Take any/unknown as a special condition. Or maybe we could change `type` to a union containing all primitive types.
|
|
75632
|
-
if (
|
|
75756
|
+
if (type_5.flags & 3 /* AnyOrUnknown */) {
|
|
75633
75757
|
return (556800 /* AllTypeofNE */ & notEqualFacts_1) === 556800 /* AllTypeofNE */;
|
|
75634
75758
|
}
|
|
75635
|
-
return !!(filterType(
|
|
75759
|
+
return !!(filterType(type_5, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
|
|
75636
75760
|
}
|
|
75637
75761
|
var type = getTypeOfExpression(node.expression);
|
|
75638
75762
|
if (!isLiteralType(type)) {
|
|
@@ -78728,12 +78852,12 @@ var ts;
|
|
|
78728
78852
|
case 264 /* ImportEqualsDeclaration */:
|
|
78729
78853
|
case 267 /* NamespaceImport */:
|
|
78730
78854
|
case 266 /* ImportClause */:
|
|
78731
|
-
var
|
|
78855
|
+
var result_11 = 0 /* None */;
|
|
78732
78856
|
var target = resolveAlias(getSymbolOfNode(d));
|
|
78733
78857
|
ts.forEach(target.declarations, function (d) {
|
|
78734
|
-
|
|
78858
|
+
result_11 |= getDeclarationSpaces(d);
|
|
78735
78859
|
});
|
|
78736
|
-
return
|
|
78860
|
+
return result_11;
|
|
78737
78861
|
case 253 /* VariableDeclaration */:
|
|
78738
78862
|
case 202 /* BindingElement */:
|
|
78739
78863
|
case 255 /* FunctionDeclaration */:
|
|
@@ -81602,7 +81726,7 @@ var ts;
|
|
|
81602
81726
|
checkKindsOfPropertyMemberOverrides(type, baseType_1);
|
|
81603
81727
|
}
|
|
81604
81728
|
}
|
|
81605
|
-
|
|
81729
|
+
checkMembersForOverrideModifier(node, type, typeWithThis, staticType);
|
|
81606
81730
|
var implementedTypeNodes = ts.getEffectiveImplementsTypeNodes(node);
|
|
81607
81731
|
if (implementedTypeNodes) {
|
|
81608
81732
|
for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) {
|
|
@@ -81637,8 +81761,7 @@ var ts;
|
|
|
81637
81761
|
checkPropertyInitialization(node);
|
|
81638
81762
|
}
|
|
81639
81763
|
}
|
|
81640
|
-
function
|
|
81641
|
-
var nodeInAmbientContext = !!(node.flags & 8388608 /* Ambient */);
|
|
81764
|
+
function checkMembersForOverrideModifier(node, type, typeWithThis, staticType) {
|
|
81642
81765
|
var baseTypeNode = ts.getEffectiveBaseTypeNode(node);
|
|
81643
81766
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
81644
81767
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
@@ -81650,46 +81773,71 @@ var ts;
|
|
|
81650
81773
|
if (ts.isConstructorDeclaration(member)) {
|
|
81651
81774
|
ts.forEach(member.parameters, function (param) {
|
|
81652
81775
|
if (ts.isParameterPropertyDeclaration(param, member)) {
|
|
81653
|
-
|
|
81776
|
+
checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, param,
|
|
81777
|
+
/* memberIsParameterProperty */ true);
|
|
81654
81778
|
}
|
|
81655
81779
|
});
|
|
81656
81780
|
}
|
|
81657
|
-
|
|
81781
|
+
checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member,
|
|
81782
|
+
/* memberIsParameterProperty */ false);
|
|
81658
81783
|
};
|
|
81659
81784
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
81660
81785
|
var member = _a[_i];
|
|
81661
81786
|
_loop_29(member);
|
|
81662
81787
|
}
|
|
81663
|
-
|
|
81664
|
-
|
|
81665
|
-
|
|
81666
|
-
|
|
81667
|
-
|
|
81668
|
-
|
|
81669
|
-
|
|
81670
|
-
|
|
81671
|
-
|
|
81672
|
-
|
|
81673
|
-
|
|
81674
|
-
|
|
81675
|
-
|
|
81676
|
-
|
|
81677
|
-
|
|
81678
|
-
|
|
81788
|
+
}
|
|
81789
|
+
/**
|
|
81790
|
+
* @param member Existing member node to be checked.
|
|
81791
|
+
* Note: `member` cannot be a synthetic node.
|
|
81792
|
+
*/
|
|
81793
|
+
function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) {
|
|
81794
|
+
if (reportErrors === void 0) { reportErrors = true; }
|
|
81795
|
+
var declaredProp = member.name
|
|
81796
|
+
&& getSymbolAtLocation(member.name)
|
|
81797
|
+
|| getSymbolAtLocation(member);
|
|
81798
|
+
if (!declaredProp) {
|
|
81799
|
+
return 0 /* Ok */;
|
|
81800
|
+
}
|
|
81801
|
+
return checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, ts.hasOverrideModifier(member), ts.hasAbstractModifier(member), ts.isStatic(member), memberIsParameterProperty, ts.symbolName(declaredProp), reportErrors ? member : undefined);
|
|
81802
|
+
}
|
|
81803
|
+
/**
|
|
81804
|
+
* Checks a class member declaration for either a missing or an invalid `override` modifier.
|
|
81805
|
+
* Note: this function can be used for speculative checking,
|
|
81806
|
+
* i.e. checking a member that does not yet exist in the program.
|
|
81807
|
+
* An example of that would be to call this function in a completions scenario,
|
|
81808
|
+
* when offering a method declaration as completion.
|
|
81809
|
+
* @param errorNode The node where we should report an error, or undefined if we should not report errors.
|
|
81810
|
+
*/
|
|
81811
|
+
function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, memberName, errorNode) {
|
|
81812
|
+
var isJs = ts.isInJSFile(node);
|
|
81813
|
+
var nodeInAmbientContext = !!(node.flags & 8388608 /* Ambient */);
|
|
81814
|
+
if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) {
|
|
81815
|
+
var memberEscapedName = ts.escapeLeadingUnderscores(memberName);
|
|
81816
|
+
var thisType = memberIsStatic ? staticType : typeWithThis;
|
|
81817
|
+
var baseType = memberIsStatic ? baseStaticType : baseWithThis;
|
|
81818
|
+
var prop = getPropertyOfType(thisType, memberEscapedName);
|
|
81819
|
+
var baseProp = getPropertyOfType(baseType, memberEscapedName);
|
|
81820
|
+
var baseClassName = typeToString(baseWithThis);
|
|
81821
|
+
if (prop && !baseProp && memberHasOverrideModifier) {
|
|
81822
|
+
if (errorNode) {
|
|
81823
|
+
var suggestion = getSuggestedSymbolForNonexistentClassMember(memberName, baseType); // Again, using symbol name: note that's different from `symbol.escapedName`
|
|
81679
81824
|
suggestion ?
|
|
81680
|
-
error(
|
|
81825
|
+
error(errorNode, isJs ?
|
|
81681
81826
|
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1 :
|
|
81682
81827
|
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1, baseClassName, symbolToString(suggestion)) :
|
|
81683
|
-
error(
|
|
81828
|
+
error(errorNode, isJs ?
|
|
81684
81829
|
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 :
|
|
81685
81830
|
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName);
|
|
81686
81831
|
}
|
|
81687
|
-
|
|
81688
|
-
|
|
81689
|
-
|
|
81690
|
-
|
|
81691
|
-
|
|
81692
|
-
|
|
81832
|
+
return 2 /* HasInvalidOverride */;
|
|
81833
|
+
}
|
|
81834
|
+
else if (prop && (baseProp === null || baseProp === void 0 ? void 0 : baseProp.declarations) && compilerOptions.noImplicitOverride && !nodeInAmbientContext) {
|
|
81835
|
+
var baseHasAbstract = ts.some(baseProp.declarations, ts.hasAbstractModifier);
|
|
81836
|
+
if (memberHasOverrideModifier) {
|
|
81837
|
+
return 0 /* Ok */;
|
|
81838
|
+
}
|
|
81839
|
+
if (!baseHasAbstract) {
|
|
81840
|
+
if (errorNode) {
|
|
81693
81841
|
var diag = memberIsParameterProperty ?
|
|
81694
81842
|
isJs ?
|
|
81695
81843
|
ts.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
|
|
@@ -81697,20 +81845,28 @@ var ts;
|
|
|
81697
81845
|
isJs ?
|
|
81698
81846
|
ts.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
|
|
81699
81847
|
ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0;
|
|
81700
|
-
error(
|
|
81848
|
+
error(errorNode, diag, baseClassName);
|
|
81701
81849
|
}
|
|
81702
|
-
|
|
81703
|
-
|
|
81850
|
+
return 1 /* NeedsOverride */;
|
|
81851
|
+
}
|
|
81852
|
+
else if (memberHasAbstractModifier && baseHasAbstract) {
|
|
81853
|
+
if (errorNode) {
|
|
81854
|
+
error(errorNode, ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0, baseClassName);
|
|
81704
81855
|
}
|
|
81856
|
+
return 1 /* NeedsOverride */;
|
|
81705
81857
|
}
|
|
81706
81858
|
}
|
|
81707
|
-
|
|
81859
|
+
}
|
|
81860
|
+
else if (memberHasOverrideModifier) {
|
|
81861
|
+
if (errorNode) {
|
|
81708
81862
|
var className = typeToString(type);
|
|
81709
|
-
error(
|
|
81863
|
+
error(errorNode, isJs ?
|
|
81710
81864
|
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class :
|
|
81711
81865
|
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className);
|
|
81712
81866
|
}
|
|
81867
|
+
return 2 /* HasInvalidOverride */;
|
|
81713
81868
|
}
|
|
81869
|
+
return 0 /* Ok */;
|
|
81714
81870
|
}
|
|
81715
81871
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
81716
81872
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
@@ -81753,6 +81909,31 @@ var ts;
|
|
|
81753
81909
|
}
|
|
81754
81910
|
}
|
|
81755
81911
|
}
|
|
81912
|
+
/**
|
|
81913
|
+
* Checks a member declaration node to see if has a missing or invalid `override` modifier.
|
|
81914
|
+
* @param node Class-like node where the member is declared.
|
|
81915
|
+
* @param member Member declaration node.
|
|
81916
|
+
* Note: `member` can be a synthetic node without a parent.
|
|
81917
|
+
*/
|
|
81918
|
+
function getMemberOverrideModifierStatus(node, member) {
|
|
81919
|
+
if (!member.name) {
|
|
81920
|
+
return 0 /* Ok */;
|
|
81921
|
+
}
|
|
81922
|
+
var symbol = getSymbolOfNode(node);
|
|
81923
|
+
var type = getDeclaredTypeOfSymbol(symbol);
|
|
81924
|
+
var typeWithThis = getTypeWithThisArgument(type);
|
|
81925
|
+
var staticType = getTypeOfSymbol(symbol);
|
|
81926
|
+
var baseTypeNode = ts.getEffectiveBaseTypeNode(node);
|
|
81927
|
+
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
81928
|
+
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
81929
|
+
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
81930
|
+
var memberHasOverrideModifier = member.parent
|
|
81931
|
+
? ts.hasOverrideModifier(member)
|
|
81932
|
+
: ts.hasSyntacticModifier(member, 16384 /* Override */);
|
|
81933
|
+
var memberName = ts.unescapeLeadingUnderscores(ts.getTextOfPropertyName(member.name));
|
|
81934
|
+
return checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, ts.hasAbstractModifier(member), ts.isStatic(member),
|
|
81935
|
+
/* memberIsParameterProperty */ false, memberName);
|
|
81936
|
+
}
|
|
81756
81937
|
function getTargetSymbol(s) {
|
|
81757
81938
|
// if symbol is instantiated its flags are not copied from the 'target'
|
|
81758
81939
|
// so we'll need to get back original 'target' symbol to work with correct set of flags
|
|
@@ -94749,11 +94930,11 @@ var ts;
|
|
|
94749
94930
|
currentFileState.filenameDeclaration = declaration;
|
|
94750
94931
|
return currentFileState.filenameDeclaration.name;
|
|
94751
94932
|
}
|
|
94752
|
-
function getJsxFactoryCalleePrimitive(
|
|
94753
|
-
return compilerOptions.jsx === 5 /* ReactJSXDev */ ? "jsxDEV" :
|
|
94933
|
+
function getJsxFactoryCalleePrimitive(isStaticChildren) {
|
|
94934
|
+
return compilerOptions.jsx === 5 /* ReactJSXDev */ ? "jsxDEV" : isStaticChildren ? "jsxs" : "jsx";
|
|
94754
94935
|
}
|
|
94755
|
-
function getJsxFactoryCallee(
|
|
94756
|
-
var type = getJsxFactoryCalleePrimitive(
|
|
94936
|
+
function getJsxFactoryCallee(isStaticChildren) {
|
|
94937
|
+
var type = getJsxFactoryCalleePrimitive(isStaticChildren);
|
|
94757
94938
|
return getImplicitImportForName(type);
|
|
94758
94939
|
}
|
|
94759
94940
|
function getImplicitJsxFragmentReference() {
|
|
@@ -94905,9 +95086,9 @@ var ts;
|
|
|
94905
95086
|
}
|
|
94906
95087
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
94907
95088
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
94908
|
-
if (ts.length(nonWhitespaceChildren) === 1) {
|
|
94909
|
-
var
|
|
94910
|
-
return
|
|
95089
|
+
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
95090
|
+
var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
95091
|
+
return result_12 && factory.createPropertyAssignment("children", result_12);
|
|
94911
95092
|
}
|
|
94912
95093
|
var result = ts.mapDefined(children, transformJsxChildToExpression);
|
|
94913
95094
|
return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
|
|
@@ -94919,15 +95100,18 @@ var ts;
|
|
|
94919
95100
|
var attrs = keyAttr ? ts.filter(node.attributes.properties, function (p) { return p !== keyAttr; }) : node.attributes.properties;
|
|
94920
95101
|
var objectProperties = ts.length(attrs) ? transformJsxAttributesToObjectProps(attrs, childrenProp) :
|
|
94921
95102
|
factory.createObjectLiteralExpression(childrenProp ? [childrenProp] : ts.emptyArray); // When there are no attributes, React wants {}
|
|
94922
|
-
return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr,
|
|
95103
|
+
return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children || ts.emptyArray, isChild, location);
|
|
94923
95104
|
}
|
|
94924
|
-
function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr,
|
|
95105
|
+
function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children, isChild, location) {
|
|
95106
|
+
var _a;
|
|
95107
|
+
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95108
|
+
var isStaticChildren = ts.length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) === null || _a === void 0 ? void 0 : _a.dotDotDotToken);
|
|
94925
95109
|
var args = [tagName, objectProperties, !keyAttr ? factory.createVoidZero() : transformJsxAttributeInitializer(keyAttr.initializer)];
|
|
94926
95110
|
if (compilerOptions.jsx === 5 /* ReactJSXDev */) {
|
|
94927
95111
|
var originalFile = ts.getOriginalNode(currentSourceFile);
|
|
94928
95112
|
if (originalFile && ts.isSourceFile(originalFile)) {
|
|
94929
95113
|
// isStaticChildren development flag
|
|
94930
|
-
args.push(
|
|
95114
|
+
args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
|
|
94931
95115
|
// __source development flag
|
|
94932
95116
|
var lineCol = ts.getLineAndCharacterOfPosition(originalFile, location.pos);
|
|
94933
95117
|
args.push(factory.createObjectLiteralExpression([
|
|
@@ -94939,7 +95123,7 @@ var ts;
|
|
|
94939
95123
|
args.push(factory.createThis());
|
|
94940
95124
|
}
|
|
94941
95125
|
}
|
|
94942
|
-
var element = ts.setTextRange(factory.createCallExpression(getJsxFactoryCallee(
|
|
95126
|
+
var element = ts.setTextRange(factory.createCallExpression(getJsxFactoryCallee(isStaticChildren), /*typeArguments*/ undefined, args), location);
|
|
94943
95127
|
if (isChild) {
|
|
94944
95128
|
ts.startOnNewLine(element);
|
|
94945
95129
|
}
|
|
@@ -94969,7 +95153,7 @@ var ts;
|
|
|
94969
95153
|
}
|
|
94970
95154
|
}
|
|
94971
95155
|
return visitJsxOpeningLikeElementOrFragmentJSX(getImplicitJsxFragmentReference(), childrenProps || factory.createObjectLiteralExpression([]),
|
|
94972
|
-
/*keyAttr*/ undefined,
|
|
95156
|
+
/*keyAttr*/ undefined, children, isChild, location);
|
|
94973
95157
|
}
|
|
94974
95158
|
function visitJsxOpeningFragmentCreateElement(node, children, isChild, location) {
|
|
94975
95159
|
var element = ts.createExpressionForJsxFragment(factory, context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), context.getEmitResolver().getJsxFragmentFactoryEntity(currentSourceFile), compilerOptions.reactNamespace, // TODO: GH#18217
|
|
@@ -108057,7 +108241,14 @@ var ts;
|
|
|
108057
108241
|
// clear the parenthesizer rule as we ascend
|
|
108058
108242
|
currentParenthesizerRule = undefined;
|
|
108059
108243
|
}
|
|
108060
|
-
function pipelineEmitWithHintWorker(hint, node) {
|
|
108244
|
+
function pipelineEmitWithHintWorker(hint, node, allowSnippets) {
|
|
108245
|
+
if (allowSnippets === void 0) { allowSnippets = true; }
|
|
108246
|
+
if (allowSnippets) {
|
|
108247
|
+
var snippet = ts.getSnippetElement(node);
|
|
108248
|
+
if (snippet) {
|
|
108249
|
+
return emitSnippetNode(hint, node, snippet);
|
|
108250
|
+
}
|
|
108251
|
+
}
|
|
108061
108252
|
if (hint === 0 /* SourceFile */)
|
|
108062
108253
|
return emitSourceFile(ts.cast(node, ts.isSourceFile));
|
|
108063
108254
|
if (hint === 2 /* IdentifierName */)
|
|
@@ -108666,6 +108857,28 @@ var ts;
|
|
|
108666
108857
|
}
|
|
108667
108858
|
}
|
|
108668
108859
|
//
|
|
108860
|
+
// Snippet Elements
|
|
108861
|
+
//
|
|
108862
|
+
function emitSnippetNode(hint, node, snippet) {
|
|
108863
|
+
switch (snippet.kind) {
|
|
108864
|
+
case 1 /* Placeholder */:
|
|
108865
|
+
emitPlaceholder(hint, node, snippet);
|
|
108866
|
+
break;
|
|
108867
|
+
case 0 /* TabStop */:
|
|
108868
|
+
emitTabStop(snippet);
|
|
108869
|
+
break;
|
|
108870
|
+
}
|
|
108871
|
+
}
|
|
108872
|
+
function emitPlaceholder(hint, node, snippet) {
|
|
108873
|
+
nonEscapingWrite("${" + snippet.order + ":"); // `${2:`
|
|
108874
|
+
pipelineEmitWithHintWorker(hint, node, /*allowSnippets*/ false); // `...`
|
|
108875
|
+
nonEscapingWrite("}"); // `}`
|
|
108876
|
+
// `${2:...}`
|
|
108877
|
+
}
|
|
108878
|
+
function emitTabStop(snippet) {
|
|
108879
|
+
nonEscapingWrite("$" + snippet.order);
|
|
108880
|
+
}
|
|
108881
|
+
//
|
|
108669
108882
|
// Identifiers
|
|
108670
108883
|
//
|
|
108671
108884
|
function emitIdentifier(node) {
|
|
@@ -110904,6 +111117,15 @@ var ts;
|
|
|
110904
111117
|
function writeProperty(s) {
|
|
110905
111118
|
writer.writeProperty(s);
|
|
110906
111119
|
}
|
|
111120
|
+
function nonEscapingWrite(s) {
|
|
111121
|
+
// This should be defined in a snippet-escaping text writer.
|
|
111122
|
+
if (writer.nonEscapingWrite) {
|
|
111123
|
+
writer.nonEscapingWrite(s);
|
|
111124
|
+
}
|
|
111125
|
+
else {
|
|
111126
|
+
writer.write(s);
|
|
111127
|
+
}
|
|
111128
|
+
}
|
|
110907
111129
|
function writeLine(count) {
|
|
110908
111130
|
if (count === void 0) { count = 1; }
|
|
110909
111131
|
for (var i = 0; i < count; i++) {
|
|
@@ -113707,15 +113929,15 @@ var ts;
|
|
|
113707
113929
|
// which per above occurred during the current program creation.
|
|
113708
113930
|
// Since we assume the filesystem does not change during program creation,
|
|
113709
113931
|
// it is safe to reuse resolutions from the earlier call.
|
|
113710
|
-
var
|
|
113932
|
+
var result_13 = [];
|
|
113711
113933
|
var i = 0;
|
|
113712
113934
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
113713
113935
|
var moduleName = moduleNames_1[_i];
|
|
113714
113936
|
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
113715
113937
|
i++;
|
|
113716
|
-
|
|
113938
|
+
result_13.push(resolvedModule);
|
|
113717
113939
|
}
|
|
113718
|
-
return
|
|
113940
|
+
return result_13;
|
|
113719
113941
|
}
|
|
113720
113942
|
// At this point, we know at least one of the following hold:
|
|
113721
113943
|
// - file has local declarations for ambient modules
|
|
@@ -114007,8 +114229,8 @@ var ts;
|
|
|
114007
114229
|
var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (ref) { return ts.toFileNameLowerCase(ref.fileName); });
|
|
114008
114230
|
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
114009
114231
|
// ensure that types resolutions are still correct
|
|
114010
|
-
var
|
|
114011
|
-
if (
|
|
114232
|
+
var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
114233
|
+
if (typeReferenceResolutionsChanged) {
|
|
114012
114234
|
structureIsReused = 1 /* SafeModules */;
|
|
114013
114235
|
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
114014
114236
|
}
|
|
@@ -115296,6 +115518,21 @@ var ts;
|
|
|
115296
115518
|
return resolvedRef;
|
|
115297
115519
|
}
|
|
115298
115520
|
function verifyCompilerOptions() {
|
|
115521
|
+
var isNightly = ts.stringContains(ts.version, "-dev");
|
|
115522
|
+
if (!isNightly) {
|
|
115523
|
+
if (ts.getEmitModuleKind(options) === ts.ModuleKind.Node12) {
|
|
115524
|
+
createOptionValueDiagnostic("module", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "node12");
|
|
115525
|
+
}
|
|
115526
|
+
else if (ts.getEmitModuleKind(options) === ts.ModuleKind.NodeNext) {
|
|
115527
|
+
createOptionValueDiagnostic("module", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "nodenext");
|
|
115528
|
+
}
|
|
115529
|
+
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12) {
|
|
115530
|
+
createOptionValueDiagnostic("moduleResolution", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "node12");
|
|
115531
|
+
}
|
|
115532
|
+
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
115533
|
+
createOptionValueDiagnostic("moduleResolution", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "nodenext");
|
|
115534
|
+
}
|
|
115535
|
+
}
|
|
115299
115536
|
if (options.strictPropertyInitialization && !ts.getStrictOptionValue(options, "strictNullChecks")) {
|
|
115300
115537
|
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
|
|
115301
115538
|
}
|
|
@@ -115444,7 +115681,9 @@ var ts;
|
|
|
115444
115681
|
}
|
|
115445
115682
|
}
|
|
115446
115683
|
if (options.resolveJsonModule) {
|
|
115447
|
-
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs
|
|
115684
|
+
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
|
|
115685
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node12 &&
|
|
115686
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
115448
115687
|
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
|
|
115449
115688
|
}
|
|
115450
115689
|
// Any emit other than common js, amd, es2015 or esnext is error
|
|
@@ -115772,8 +116011,8 @@ var ts;
|
|
|
115772
116011
|
function createDiagnosticForOptionName(message, option1, option2, option3) {
|
|
115773
116012
|
createDiagnosticForOption(/*onKey*/ true, option1, option2, message, option1, option2, option3);
|
|
115774
116013
|
}
|
|
115775
|
-
function createOptionValueDiagnostic(option1, message, arg0) {
|
|
115776
|
-
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0);
|
|
116014
|
+
function createOptionValueDiagnostic(option1, message, arg0, arg1) {
|
|
116015
|
+
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0, arg1);
|
|
115777
116016
|
}
|
|
115778
116017
|
function createDiagnosticForReference(sourceFile, index, message, arg0, arg1) {
|
|
115779
116018
|
var referencesSyntax = ts.firstDefined(ts.getTsConfigPropArray(sourceFile || options.configFile, "references"), function (property) { return ts.isArrayLiteralExpression(property.initializer) ? property.initializer : undefined; });
|
|
@@ -118017,6 +118256,9 @@ var ts;
|
|
|
118017
118256
|
else {
|
|
118018
118257
|
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile);
|
|
118019
118258
|
perDirectoryResolution.set(name, mode, resolution);
|
|
118259
|
+
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
118260
|
+
resolutionHost.onDiscoveredSymlink();
|
|
118261
|
+
}
|
|
118020
118262
|
}
|
|
118021
118263
|
resolutionsInFile.set(name, mode, resolution);
|
|
118022
118264
|
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
@@ -118485,6 +118727,11 @@ var ts;
|
|
|
118485
118727
|
}
|
|
118486
118728
|
}
|
|
118487
118729
|
ts.createResolutionCache = createResolutionCache;
|
|
118730
|
+
function resolutionIsSymlink(resolution) {
|
|
118731
|
+
var _a, _b;
|
|
118732
|
+
return !!(((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.originalPath) ||
|
|
118733
|
+
((_b = resolution.resolvedTypeReferenceDirective) === null || _b === void 0 ? void 0 : _b.originalPath));
|
|
118734
|
+
}
|
|
118488
118735
|
})(ts || (ts = {}));
|
|
118489
118736
|
// Used by importFixes, getEditsForFileRename, and declaration emit to synthesize import module specifiers.
|
|
118490
118737
|
/* @internal */
|
|
@@ -118777,9 +119024,9 @@ var ts;
|
|
|
118777
119024
|
if (!preferSymlinks) {
|
|
118778
119025
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
118779
119026
|
// so we only need to remove them from the realpath filenames.
|
|
118780
|
-
var
|
|
118781
|
-
if (
|
|
118782
|
-
return
|
|
119027
|
+
var result_14 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
119028
|
+
if (result_14)
|
|
119029
|
+
return result_14;
|
|
118783
119030
|
}
|
|
118784
119031
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
118785
119032
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -118799,10 +119046,10 @@ var ts;
|
|
|
118799
119046
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
118800
119047
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
118801
119048
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
118802
|
-
var
|
|
119049
|
+
var result_15 = cb(option, target === referenceRedirect);
|
|
118803
119050
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
118804
|
-
if (
|
|
118805
|
-
return
|
|
119051
|
+
if (result_15)
|
|
119052
|
+
return result_15;
|
|
118806
119053
|
}
|
|
118807
119054
|
});
|
|
118808
119055
|
});
|