@typescript-deploys/pr-build 6.0.0-pr-62673-3 → 6.0.0-pr-62789-2
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/_tsc.js +208 -267
- package/lib/cs/diagnosticMessages.generated.json +6 -4
- package/lib/de/diagnosticMessages.generated.json +6 -4
- package/lib/es/diagnosticMessages.generated.json +4 -3
- package/lib/fr/diagnosticMessages.generated.json +6 -4
- package/lib/it/diagnosticMessages.generated.json +6 -4
- package/lib/ja/diagnosticMessages.generated.json +6 -4
- package/lib/ko/diagnosticMessages.generated.json +4 -3
- package/lib/pl/diagnosticMessages.generated.json +6 -4
- package/lib/pt-br/diagnosticMessages.generated.json +4 -3
- package/lib/ru/diagnosticMessages.generated.json +6 -4
- package/lib/tr/diagnosticMessages.generated.json +6 -4
- package/lib/typescript.js +217 -251
- package/lib/zh-cn/diagnosticMessages.generated.json +6 -4
- package/lib/zh-tw/diagnosticMessages.generated.json +4 -3
- package/package.json +18 -18
package/lib/_tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "6.0";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20251124`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -368,20 +368,6 @@ function some(array, predicate) {
|
|
|
368
368
|
}
|
|
369
369
|
return false;
|
|
370
370
|
}
|
|
371
|
-
function getRangesWhere(arr, pred, cb) {
|
|
372
|
-
let start;
|
|
373
|
-
for (let i = 0; i < arr.length; i++) {
|
|
374
|
-
if (pred(arr[i])) {
|
|
375
|
-
start = start === void 0 ? i : start;
|
|
376
|
-
} else {
|
|
377
|
-
if (start !== void 0) {
|
|
378
|
-
cb(start, i);
|
|
379
|
-
start = void 0;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
if (start !== void 0) cb(start, arr.length);
|
|
384
|
-
}
|
|
385
371
|
function concatenate(array1, array2) {
|
|
386
372
|
if (array2 === void 0 || array2.length === 0) return array1;
|
|
387
373
|
if (array1 === void 0 || array1.length === 0) return array2;
|
|
@@ -3362,6 +3348,7 @@ var NodeFlags = /* @__PURE__ */ ((NodeFlags3) => {
|
|
|
3362
3348
|
NodeFlags3[NodeFlags3["JsonFile"] = 134217728] = "JsonFile";
|
|
3363
3349
|
NodeFlags3[NodeFlags3["TypeCached"] = 268435456] = "TypeCached";
|
|
3364
3350
|
NodeFlags3[NodeFlags3["Deprecated"] = 536870912] = "Deprecated";
|
|
3351
|
+
NodeFlags3[NodeFlags3["Unreachable"] = 1073741824] = "Unreachable";
|
|
3365
3352
|
NodeFlags3[NodeFlags3["BlockScoped"] = 7] = "BlockScoped";
|
|
3366
3353
|
NodeFlags3[NodeFlags3["Constant"] = 6] = "Constant";
|
|
3367
3354
|
NodeFlags3[NodeFlags3["ReachabilityCheckFlags"] = 1536] = "ReachabilityCheckFlags";
|
|
@@ -6252,6 +6239,9 @@ var Diagnostics = {
|
|
|
6252
6239
|
Named_imports_from_a_JSON_file_into_an_ECMAScript_module_are_not_allowed_when_module_is_set_to_0: diag(1544, 1 /* Error */, "Named_imports_from_a_JSON_file_into_an_ECMAScript_module_are_not_allowed_when_module_is_set_to_0_1544", "Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to '{0}'."),
|
|
6253
6240
|
using_declarations_are_not_allowed_in_ambient_contexts: diag(1545, 1 /* Error */, "using_declarations_are_not_allowed_in_ambient_contexts_1545", "'using' declarations are not allowed in ambient contexts."),
|
|
6254
6241
|
await_using_declarations_are_not_allowed_in_ambient_contexts: diag(1546, 1 /* Error */, "await_using_declarations_are_not_allowed_in_ambient_contexts_1546", "'await using' declarations are not allowed in ambient contexts."),
|
|
6242
|
+
using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block: diag(1547, 1 /* Error */, "using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block_1547", "'using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block."),
|
|
6243
|
+
await_using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block: diag(1548, 1 /* Error */, "await_using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block_1548", "'await using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block."),
|
|
6244
|
+
Ignore_the_tsconfig_found_and_build_with_commandline_options_and_files: diag(1549, 3 /* Message */, "Ignore_the_tsconfig_found_and_build_with_commandline_options_and_files_1549", "Ignore the tsconfig found and build with commandline options and files."),
|
|
6255
6245
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
6256
6246
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
6257
6247
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -6997,7 +6987,7 @@ var Diagnostics = {
|
|
|
6997
6987
|
Compiler_option_0_may_only_be_used_with_build: diag(5093, 1 /* Error */, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."),
|
|
6998
6988
|
Compiler_option_0_may_not_be_used_with_build: diag(5094, 1 /* Error */, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."),
|
|
6999
6989
|
Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later: diag(5095, 1 /* Error */, "Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095", "Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later."),
|
|
7000
|
-
|
|
6990
|
+
Option_allowImportingTsExtensions_can_only_be_used_when_one_of_noEmit_emitDeclarationOnly_or_rewriteRelativeImportExtensions_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_one_of_noEmit_emitDeclarationOnly_or_rewrite_5096", "Option 'allowImportingTsExtensions' can only be used when one of 'noEmit', 'emitDeclarationOnly', or 'rewriteRelativeImportExtensions' is set."),
|
|
7001
6991
|
An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."),
|
|
7002
6992
|
Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."),
|
|
7003
6993
|
Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprec_5101", `Option '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`),
|
|
@@ -7011,6 +7001,7 @@ var Diagnostics = {
|
|
|
7011
7001
|
Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1: diag(5109, 1 /* Error */, "Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1_5109", "Option 'moduleResolution' must be set to '{0}' (or left unspecified) when option 'module' is set to '{1}'."),
|
|
7012
7002
|
Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1: diag(5110, 1 /* Error */, "Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1_5110", "Option 'module' must be set to '{0}' when option 'moduleResolution' is set to '{1}'."),
|
|
7013
7003
|
Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information: diag(5111, 3 /* Message */, "Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information_5111", "Visit https://aka.ms/ts6 for migration information."),
|
|
7004
|
+
tsconfig_json_is_present_but_will_not_be_loaded_if_files_are_specified_on_commandline_Use_ignoreConfig_to_skip_this_error: diag(5112, 1 /* Error */, "tsconfig_json_is_present_but_will_not_be_loaded_if_files_are_specified_on_commandline_Use_ignoreConf_5112", "tsconfig.json is present but will not be loaded if files are specified on commandline. Use '--ignoreConfig' to skip this error."),
|
|
7014
7005
|
Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
|
|
7015
7006
|
Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
|
|
7016
7007
|
Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
|
|
@@ -12484,9 +12475,6 @@ function isDeclaration(node) {
|
|
|
12484
12475
|
function isDeclarationStatement(node) {
|
|
12485
12476
|
return isDeclarationStatementKind(node.kind);
|
|
12486
12477
|
}
|
|
12487
|
-
function isStatementButNotDeclaration(node) {
|
|
12488
|
-
return isStatementKindButNotDeclarationKind(node.kind);
|
|
12489
|
-
}
|
|
12490
12478
|
function isStatement(node) {
|
|
12491
12479
|
const kind = node.kind;
|
|
12492
12480
|
return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) || isBlockStatement(node);
|
|
@@ -18225,12 +18213,6 @@ function hasJsonModuleEmitEnabled(options) {
|
|
|
18225
18213
|
}
|
|
18226
18214
|
return true;
|
|
18227
18215
|
}
|
|
18228
|
-
function unreachableCodeIsError(options) {
|
|
18229
|
-
return options.allowUnreachableCode === false;
|
|
18230
|
-
}
|
|
18231
|
-
function unusedLabelIsError(options) {
|
|
18232
|
-
return options.allowUnusedLabels === false;
|
|
18233
|
-
}
|
|
18234
18216
|
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
|
18235
18217
|
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
|
18236
18218
|
}
|
|
@@ -18801,11 +18783,6 @@ function matchPatternOrExact(parsedPatterns, candidate) {
|
|
|
18801
18783
|
}
|
|
18802
18784
|
return findBestPatternMatch(patterns, (_) => _, candidate);
|
|
18803
18785
|
}
|
|
18804
|
-
function sliceAfter(arr, value) {
|
|
18805
|
-
const index = arr.indexOf(value);
|
|
18806
|
-
Debug.assert(index !== -1);
|
|
18807
|
-
return arr.slice(index);
|
|
18808
|
-
}
|
|
18809
18786
|
function addRelatedInfo(diagnostic, ...relatedInformation) {
|
|
18810
18787
|
if (!relatedInformation.length) {
|
|
18811
18788
|
return diagnostic;
|
|
@@ -20155,6 +20132,21 @@ function addEmitFlagsRecursively(node, flag, getChild) {
|
|
|
20155
20132
|
function getFirstChild(node) {
|
|
20156
20133
|
return forEachChild(node, (child) => child);
|
|
20157
20134
|
}
|
|
20135
|
+
function canHaveStatements(node) {
|
|
20136
|
+
return isBlock(node) || isModuleBlock(node) || isSourceFile(node) || isCaseClause(node) || isDefaultClause(node);
|
|
20137
|
+
}
|
|
20138
|
+
function isPotentiallyExecutableNode(node) {
|
|
20139
|
+
if (244 /* FirstStatement */ <= node.kind && node.kind <= 260 /* LastStatement */) {
|
|
20140
|
+
if (isVariableStatement(node)) {
|
|
20141
|
+
if (getCombinedNodeFlags(node.declarationList) & 7 /* BlockScoped */) {
|
|
20142
|
+
return true;
|
|
20143
|
+
}
|
|
20144
|
+
return some(node.declarationList.declarations, (d) => d.initializer !== void 0);
|
|
20145
|
+
}
|
|
20146
|
+
return true;
|
|
20147
|
+
}
|
|
20148
|
+
return isClassDeclaration(node) || isEnumDeclaration(node) || isModuleDeclaration(node);
|
|
20149
|
+
}
|
|
20158
20150
|
|
|
20159
20151
|
// src/compiler/factory/baseNodeFactory.ts
|
|
20160
20152
|
function createBaseNodeFactory() {
|
|
@@ -36872,6 +36864,15 @@ var commandOptionsWithoutBuild = [
|
|
|
36872
36864
|
description: Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
|
|
36873
36865
|
defaultValueDescription: false
|
|
36874
36866
|
},
|
|
36867
|
+
{
|
|
36868
|
+
name: "ignoreConfig",
|
|
36869
|
+
type: "boolean",
|
|
36870
|
+
showInSimplifiedHelpView: true,
|
|
36871
|
+
category: Diagnostics.Command_line_Options,
|
|
36872
|
+
isCommandLineOnly: true,
|
|
36873
|
+
description: Diagnostics.Ignore_the_tsconfig_found_and_build_with_commandline_options_and_files,
|
|
36874
|
+
defaultValueDescription: false
|
|
36875
|
+
},
|
|
36875
36876
|
// Basic
|
|
36876
36877
|
targetOptionDeclaration,
|
|
36877
36878
|
moduleOptionDeclaration,
|
|
@@ -42370,13 +42371,6 @@ function createBinder() {
|
|
|
42370
42371
|
/*antecedent*/
|
|
42371
42372
|
void 0
|
|
42372
42373
|
);
|
|
42373
|
-
var reportedUnreachableFlow = createFlowNode(
|
|
42374
|
-
1 /* Unreachable */,
|
|
42375
|
-
/*node*/
|
|
42376
|
-
void 0,
|
|
42377
|
-
/*antecedent*/
|
|
42378
|
-
void 0
|
|
42379
|
-
);
|
|
42380
42374
|
var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
|
|
42381
42375
|
return bindSourceFile2;
|
|
42382
42376
|
function createDiagnosticForNode2(node, message, ...args) {
|
|
@@ -42392,7 +42386,6 @@ function createBinder() {
|
|
|
42392
42386
|
symbolCount = 0;
|
|
42393
42387
|
Symbol13 = objectAllocator.getSymbolConstructor();
|
|
42394
42388
|
Debug.attachFlowNodeDebugInfo(unreachableFlow);
|
|
42395
|
-
Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);
|
|
42396
42389
|
if (!file.locals) {
|
|
42397
42390
|
(_a = tracing) == null ? void 0 : _a.push(
|
|
42398
42391
|
tracing.Phase.Bind,
|
|
@@ -42765,16 +42758,22 @@ function createBinder() {
|
|
|
42765
42758
|
function bindChildren(node) {
|
|
42766
42759
|
const saveInAssignmentPattern = inAssignmentPattern;
|
|
42767
42760
|
inAssignmentPattern = false;
|
|
42768
|
-
if (
|
|
42769
|
-
|
|
42761
|
+
if (isPotentiallyExecutableNode(node)) {
|
|
42762
|
+
node.flags &= ~1073741824 /* Unreachable */;
|
|
42763
|
+
}
|
|
42764
|
+
if (currentFlow === unreachableFlow) {
|
|
42765
|
+
if (canHaveFlowNode(node)) {
|
|
42770
42766
|
node.flowNode = void 0;
|
|
42771
42767
|
}
|
|
42768
|
+
if (isPotentiallyExecutableNode(node)) {
|
|
42769
|
+
node.flags |= 1073741824 /* Unreachable */;
|
|
42770
|
+
}
|
|
42772
42771
|
bindEachChild(node);
|
|
42773
42772
|
bindJSDoc(node);
|
|
42774
42773
|
inAssignmentPattern = saveInAssignmentPattern;
|
|
42775
42774
|
return;
|
|
42776
42775
|
}
|
|
42777
|
-
if (
|
|
42776
|
+
if (244 /* FirstStatement */ <= node.kind && node.kind <= 260 /* LastStatement */ && canHaveFlowNode(node)) {
|
|
42778
42777
|
node.flowNode = currentFlow;
|
|
42779
42778
|
}
|
|
42780
42779
|
switch (node.kind) {
|
|
@@ -43361,8 +43360,8 @@ function createBinder() {
|
|
|
43361
43360
|
};
|
|
43362
43361
|
bind(node.label);
|
|
43363
43362
|
bind(node.statement);
|
|
43364
|
-
if (!activeLabelList.referenced
|
|
43365
|
-
|
|
43363
|
+
if (!activeLabelList.referenced) {
|
|
43364
|
+
node.label.flags |= 1073741824 /* Unreachable */;
|
|
43366
43365
|
}
|
|
43367
43366
|
activeLabelList = activeLabelList.next;
|
|
43368
43367
|
addAntecedent(postStatementLabel, currentFlow);
|
|
@@ -44139,20 +44138,6 @@ function createBinder() {
|
|
|
44139
44138
|
const span = getSpanOfTokenAtPosition(file, node.pos);
|
|
44140
44139
|
file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, ...args));
|
|
44141
44140
|
}
|
|
44142
|
-
function errorOrSuggestionOnNode(isError, node, message) {
|
|
44143
|
-
errorOrSuggestionOnRange(isError, node, node, message);
|
|
44144
|
-
}
|
|
44145
|
-
function errorOrSuggestionOnRange(isError, startNode, endNode, message) {
|
|
44146
|
-
addErrorOrSuggestionDiagnostic(isError, { pos: getTokenPosOfNode(startNode, file), end: endNode.end }, message);
|
|
44147
|
-
}
|
|
44148
|
-
function addErrorOrSuggestionDiagnostic(isError, range, message) {
|
|
44149
|
-
const diag2 = createFileDiagnostic(file, range.pos, range.end - range.pos, message);
|
|
44150
|
-
if (isError) {
|
|
44151
|
-
file.bindDiagnostics.push(diag2);
|
|
44152
|
-
} else {
|
|
44153
|
-
file.bindSuggestionDiagnostics = append(file.bindSuggestionDiagnostics, { ...diag2, category: 2 /* Suggestion */ });
|
|
44154
|
-
}
|
|
44155
|
-
}
|
|
44156
44141
|
function bind(node) {
|
|
44157
44142
|
if (!node) {
|
|
44158
44143
|
return;
|
|
@@ -45039,61 +45024,6 @@ function createBinder() {
|
|
|
45039
45024
|
declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */);
|
|
45040
45025
|
}
|
|
45041
45026
|
}
|
|
45042
|
-
function shouldReportErrorOnModuleDeclaration(node) {
|
|
45043
|
-
const instanceState = getModuleInstanceState(node);
|
|
45044
|
-
return instanceState === 1 /* Instantiated */ || instanceState === 2 /* ConstEnumOnly */ && shouldPreserveConstEnums(options);
|
|
45045
|
-
}
|
|
45046
|
-
function checkUnreachable(node) {
|
|
45047
|
-
if (!(currentFlow.flags & 1 /* Unreachable */)) {
|
|
45048
|
-
return false;
|
|
45049
|
-
}
|
|
45050
|
-
if (currentFlow === unreachableFlow) {
|
|
45051
|
-
const reportError = (
|
|
45052
|
-
// report error on all statements except empty ones
|
|
45053
|
-
isStatementButNotDeclaration(node) && node.kind !== 243 /* EmptyStatement */ || // report error on class declarations
|
|
45054
|
-
node.kind === 264 /* ClassDeclaration */ || // report errors on enums with preserved emit
|
|
45055
|
-
isEnumDeclarationWithPreservedEmit(node, options) || // report error on instantiated modules
|
|
45056
|
-
node.kind === 268 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)
|
|
45057
|
-
);
|
|
45058
|
-
if (reportError) {
|
|
45059
|
-
currentFlow = reportedUnreachableFlow;
|
|
45060
|
-
if (!options.allowUnreachableCode) {
|
|
45061
|
-
const isError = unreachableCodeIsError(options) && !(node.flags & 33554432 /* Ambient */) && (!isVariableStatement(node) || !!(getCombinedNodeFlags(node.declarationList) & 7 /* BlockScoped */) || node.declarationList.declarations.some((d) => !!d.initializer));
|
|
45062
|
-
eachUnreachableRange(node, options, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
|
|
45063
|
-
}
|
|
45064
|
-
}
|
|
45065
|
-
}
|
|
45066
|
-
return true;
|
|
45067
|
-
}
|
|
45068
|
-
}
|
|
45069
|
-
function isEnumDeclarationWithPreservedEmit(node, options) {
|
|
45070
|
-
return node.kind === 267 /* EnumDeclaration */ && (!isEnumConst(node) || shouldPreserveConstEnums(options));
|
|
45071
|
-
}
|
|
45072
|
-
function eachUnreachableRange(node, options, cb) {
|
|
45073
|
-
if (isStatement(node) && isExecutableStatement(node) && isBlock(node.parent)) {
|
|
45074
|
-
const { statements } = node.parent;
|
|
45075
|
-
const slice = sliceAfter(statements, node);
|
|
45076
|
-
getRangesWhere(slice, isExecutableStatement, (start, afterEnd) => cb(slice[start], slice[afterEnd - 1]));
|
|
45077
|
-
} else {
|
|
45078
|
-
cb(node, node);
|
|
45079
|
-
}
|
|
45080
|
-
function isExecutableStatement(s) {
|
|
45081
|
-
return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && // `var x;` may declare a variable used above
|
|
45082
|
-
!(isVariableStatement(s) && !(getCombinedNodeFlags(s) & 7 /* BlockScoped */) && s.declarationList.declarations.some((d) => !d.initializer));
|
|
45083
|
-
}
|
|
45084
|
-
function isPurelyTypeDeclaration(s) {
|
|
45085
|
-
switch (s.kind) {
|
|
45086
|
-
case 265 /* InterfaceDeclaration */:
|
|
45087
|
-
case 266 /* TypeAliasDeclaration */:
|
|
45088
|
-
return true;
|
|
45089
|
-
case 268 /* ModuleDeclaration */:
|
|
45090
|
-
return getModuleInstanceState(s) !== 1 /* Instantiated */;
|
|
45091
|
-
case 267 /* EnumDeclaration */:
|
|
45092
|
-
return !isEnumDeclarationWithPreservedEmit(s, options);
|
|
45093
|
-
default:
|
|
45094
|
-
return false;
|
|
45095
|
-
}
|
|
45096
|
-
}
|
|
45097
45027
|
}
|
|
45098
45028
|
function isExportsOrModuleExportsOrAlias(sourceFile, node) {
|
|
45099
45029
|
let i = 0;
|
|
@@ -46434,6 +46364,8 @@ function createTypeChecker(host) {
|
|
|
46434
46364
|
var currentNode;
|
|
46435
46365
|
var varianceTypeParameter;
|
|
46436
46366
|
var isInferencePartiallyBlocked = false;
|
|
46367
|
+
var withinUnreachableCode = false;
|
|
46368
|
+
var reportedUnreachableNodes;
|
|
46437
46369
|
var emptySymbols = createSymbolTable();
|
|
46438
46370
|
var arrayVariances = [1 /* Covariant */];
|
|
46439
46371
|
var compilerOptions = host.getCompilerOptions();
|
|
@@ -65566,35 +65498,11 @@ function createTypeChecker(host) {
|
|
|
65566
65498
|
/*reportErrors*/
|
|
65567
65499
|
false
|
|
65568
65500
|
) : compareTypesIdentical(s, t);
|
|
65569
|
-
} else
|
|
65570
|
-
|
|
65571
|
-
s,
|
|
65572
|
-
|
|
65573
|
-
|
|
65574
|
-
reportErrors2,
|
|
65575
|
-
/*headMessage*/
|
|
65576
|
-
void 0,
|
|
65577
|
-
intersectionState
|
|
65578
|
-
);
|
|
65579
|
-
} else if (variance === 2 /* Contravariant */) {
|
|
65580
|
-
related = isRelatedTo(
|
|
65581
|
-
t,
|
|
65582
|
-
s,
|
|
65583
|
-
3 /* Both */,
|
|
65584
|
-
reportErrors2,
|
|
65585
|
-
/*headMessage*/
|
|
65586
|
-
void 0,
|
|
65587
|
-
intersectionState
|
|
65588
|
-
);
|
|
65589
|
-
} else if (variance === 3 /* Bivariant */) {
|
|
65590
|
-
related = isRelatedTo(
|
|
65591
|
-
t,
|
|
65592
|
-
s,
|
|
65593
|
-
3 /* Both */,
|
|
65594
|
-
/*reportErrors*/
|
|
65595
|
-
false
|
|
65596
|
-
);
|
|
65597
|
-
if (!related) {
|
|
65501
|
+
} else {
|
|
65502
|
+
if (inVarianceComputation && varianceFlags & 16 /* Unreliable */) {
|
|
65503
|
+
instantiateType(s, reportUnreliableMapper);
|
|
65504
|
+
}
|
|
65505
|
+
if (variance === 1 /* Covariant */) {
|
|
65598
65506
|
related = isRelatedTo(
|
|
65599
65507
|
s,
|
|
65600
65508
|
t,
|
|
@@ -65604,19 +65512,8 @@ function createTypeChecker(host) {
|
|
|
65604
65512
|
void 0,
|
|
65605
65513
|
intersectionState
|
|
65606
65514
|
);
|
|
65607
|
-
}
|
|
65608
|
-
|
|
65609
|
-
related = isRelatedTo(
|
|
65610
|
-
s,
|
|
65611
|
-
t,
|
|
65612
|
-
3 /* Both */,
|
|
65613
|
-
reportErrors2,
|
|
65614
|
-
/*headMessage*/
|
|
65615
|
-
void 0,
|
|
65616
|
-
intersectionState
|
|
65617
|
-
);
|
|
65618
|
-
if (related) {
|
|
65619
|
-
related &= isRelatedTo(
|
|
65515
|
+
} else if (variance === 2 /* Contravariant */) {
|
|
65516
|
+
related = isRelatedTo(
|
|
65620
65517
|
t,
|
|
65621
65518
|
s,
|
|
65622
65519
|
3 /* Both */,
|
|
@@ -65625,6 +65522,46 @@ function createTypeChecker(host) {
|
|
|
65625
65522
|
void 0,
|
|
65626
65523
|
intersectionState
|
|
65627
65524
|
);
|
|
65525
|
+
} else if (variance === 3 /* Bivariant */) {
|
|
65526
|
+
related = isRelatedTo(
|
|
65527
|
+
t,
|
|
65528
|
+
s,
|
|
65529
|
+
3 /* Both */,
|
|
65530
|
+
/*reportErrors*/
|
|
65531
|
+
false
|
|
65532
|
+
);
|
|
65533
|
+
if (!related) {
|
|
65534
|
+
related = isRelatedTo(
|
|
65535
|
+
s,
|
|
65536
|
+
t,
|
|
65537
|
+
3 /* Both */,
|
|
65538
|
+
reportErrors2,
|
|
65539
|
+
/*headMessage*/
|
|
65540
|
+
void 0,
|
|
65541
|
+
intersectionState
|
|
65542
|
+
);
|
|
65543
|
+
}
|
|
65544
|
+
} else {
|
|
65545
|
+
related = isRelatedTo(
|
|
65546
|
+
s,
|
|
65547
|
+
t,
|
|
65548
|
+
3 /* Both */,
|
|
65549
|
+
reportErrors2,
|
|
65550
|
+
/*headMessage*/
|
|
65551
|
+
void 0,
|
|
65552
|
+
intersectionState
|
|
65553
|
+
);
|
|
65554
|
+
if (related) {
|
|
65555
|
+
related &= isRelatedTo(
|
|
65556
|
+
t,
|
|
65557
|
+
s,
|
|
65558
|
+
3 /* Both */,
|
|
65559
|
+
reportErrors2,
|
|
65560
|
+
/*headMessage*/
|
|
65561
|
+
void 0,
|
|
65562
|
+
intersectionState
|
|
65563
|
+
);
|
|
65564
|
+
}
|
|
65628
65565
|
}
|
|
65629
65566
|
}
|
|
65630
65567
|
if (!related) {
|
|
@@ -70668,18 +70605,22 @@ function createTypeChecker(host) {
|
|
|
70668
70605
|
const symbol = getResolvedSymbol(expr);
|
|
70669
70606
|
if (isConstantVariable(symbol)) {
|
|
70670
70607
|
const declaration = symbol.valueDeclaration;
|
|
70671
|
-
|
|
70672
|
-
|
|
70608
|
+
let initializer = getCandidateVariableDeclarationInitializer(declaration);
|
|
70609
|
+
if (initializer && isAccessExpression(initializer) && isMatchingReference(reference, initializer.expression)) {
|
|
70610
|
+
return initializer;
|
|
70673
70611
|
}
|
|
70674
70612
|
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
70675
|
-
|
|
70676
|
-
if (
|
|
70613
|
+
initializer = getCandidateVariableDeclarationInitializer(declaration.parent.parent);
|
|
70614
|
+
if (initializer && (isIdentifier(initializer) || isAccessExpression(initializer)) && isMatchingReference(reference, initializer)) {
|
|
70677
70615
|
return declaration;
|
|
70678
70616
|
}
|
|
70679
70617
|
}
|
|
70680
70618
|
}
|
|
70681
70619
|
}
|
|
70682
70620
|
return void 0;
|
|
70621
|
+
function getCandidateVariableDeclarationInitializer(node) {
|
|
70622
|
+
return isVariableDeclaration(node) && !node.type && node.initializer ? skipParentheses(node.initializer) : void 0;
|
|
70623
|
+
}
|
|
70683
70624
|
}
|
|
70684
70625
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
70685
70626
|
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
|
|
@@ -71017,7 +70958,7 @@ function createTypeChecker(host) {
|
|
|
71017
70958
|
if (!hasDefaultClause) {
|
|
71018
70959
|
return caseType;
|
|
71019
70960
|
}
|
|
71020
|
-
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 32768 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
70961
|
+
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 32768 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)), (t1, t2) => isUnitType(t1) && areTypesComparable(t1, t2))));
|
|
71021
70962
|
return caseType.flags & 131072 /* Never */ ? defaultType : getUnionType([caseType, defaultType]);
|
|
71022
70963
|
}
|
|
71023
70964
|
function narrowTypeByTypeName(type, typeName) {
|
|
@@ -71617,26 +71558,9 @@ function createTypeChecker(host) {
|
|
|
71617
71558
|
function markIdentifierAliasReferenced(location) {
|
|
71618
71559
|
const symbol = getResolvedSymbol(location);
|
|
71619
71560
|
if (symbol && symbol !== argumentsSymbol && symbol !== unknownSymbol && !isThisInTypeQuery(location)) {
|
|
71620
|
-
if (isIdentifierInAbstractMemberComputedPropertyName(location)) {
|
|
71621
|
-
return;
|
|
71622
|
-
}
|
|
71623
71561
|
markAliasReferenced(symbol, location);
|
|
71624
71562
|
}
|
|
71625
71563
|
}
|
|
71626
|
-
function isIdentifierInAbstractMemberComputedPropertyName(node) {
|
|
71627
|
-
let parent = node.parent;
|
|
71628
|
-
while (parent) {
|
|
71629
|
-
if (isComputedPropertyName(parent)) {
|
|
71630
|
-
const memberParent = parent.parent;
|
|
71631
|
-
if ((isMethodDeclaration(memberParent) || isMethodSignature(memberParent) || isPropertyDeclaration(memberParent) || isPropertySignature(memberParent)) && hasSyntacticModifier(memberParent, 64 /* Abstract */)) {
|
|
71632
|
-
return true;
|
|
71633
|
-
}
|
|
71634
|
-
return false;
|
|
71635
|
-
}
|
|
71636
|
-
parent = parent.parent;
|
|
71637
|
-
}
|
|
71638
|
-
return false;
|
|
71639
|
-
}
|
|
71640
71564
|
function markPropertyAliasReferenced(location, propSymbol, parentType) {
|
|
71641
71565
|
const left = isPropertyAccessExpression(location) ? location.expression : location.left;
|
|
71642
71566
|
if (isThisIdentifier(left) || !isIdentifier(left)) {
|
|
@@ -78664,6 +78588,9 @@ function createTypeChecker(host) {
|
|
|
78664
78588
|
let fallbackReturnType = voidType;
|
|
78665
78589
|
if (func.body.kind !== 242 /* Block */) {
|
|
78666
78590
|
returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* SkipGenericFunctions */);
|
|
78591
|
+
if (isConstContext(func.body)) {
|
|
78592
|
+
returnType = getRegularTypeOfLiteralType(returnType);
|
|
78593
|
+
}
|
|
78667
78594
|
if (isAsync) {
|
|
78668
78595
|
returnType = unwrapAwaitedType(checkAwaitedType(
|
|
78669
78596
|
returnType,
|
|
@@ -78695,7 +78622,7 @@ function createTypeChecker(host) {
|
|
|
78695
78622
|
/*contextFlags*/
|
|
78696
78623
|
void 0
|
|
78697
78624
|
);
|
|
78698
|
-
const returnType2 = contextualReturnType && (unwrapReturnType(contextualReturnType, functionFlags) || voidType).flags & 32768 /* Undefined */ ? undefinedType : voidType;
|
|
78625
|
+
const returnType2 = contextualReturnType && someType(unwrapReturnType(contextualReturnType, functionFlags) || voidType, (t) => !!(t.flags & 32768 /* Undefined */)) ? undefinedType : voidType;
|
|
78699
78626
|
return functionFlags & 2 /* Async */ ? createPromiseReturnType(func, returnType2) : (
|
|
78700
78627
|
// Async function
|
|
78701
78628
|
returnType2
|
|
@@ -78775,7 +78702,10 @@ function createTypeChecker(host) {
|
|
|
78775
78702
|
const nextTypes = [];
|
|
78776
78703
|
const isAsync = (getFunctionFlags(func) & 2 /* Async */) !== 0;
|
|
78777
78704
|
forEachYieldExpression(func.body, (yieldExpression) => {
|
|
78778
|
-
|
|
78705
|
+
let yieldExpressionType = yieldExpression.expression ? checkExpression(yieldExpression.expression, checkMode) : undefinedWideningType;
|
|
78706
|
+
if (yieldExpression.expression && isConstContext(yieldExpression.expression)) {
|
|
78707
|
+
yieldExpressionType = getRegularTypeOfLiteralType(yieldExpressionType);
|
|
78708
|
+
}
|
|
78779
78709
|
pushIfUnique(yieldTypes, getYieldedTypeOfYieldExpression(yieldExpression, yieldExpressionType, anyType, isAsync));
|
|
78780
78710
|
let nextType;
|
|
78781
78711
|
if (yieldExpression.asteriskToken) {
|
|
@@ -78892,7 +78822,7 @@ function createTypeChecker(host) {
|
|
|
78892
78822
|
if (type.flags & 131072 /* Never */) {
|
|
78893
78823
|
hasReturnOfTypeNever = true;
|
|
78894
78824
|
}
|
|
78895
|
-
pushIfUnique(aggregatedTypes, type);
|
|
78825
|
+
pushIfUnique(aggregatedTypes, isConstContext(expr) ? getRegularTypeOfLiteralType(type) : type);
|
|
78896
78826
|
} else {
|
|
78897
78827
|
hasReturnWithNoExpression = true;
|
|
78898
78828
|
}
|
|
@@ -79879,7 +79809,8 @@ function createTypeChecker(host) {
|
|
|
79879
79809
|
}
|
|
79880
79810
|
}
|
|
79881
79811
|
function isNotWithinNullishCoalesceExpression(node) {
|
|
79882
|
-
|
|
79812
|
+
const parent = walkUpOuterExpressions(node);
|
|
79813
|
+
return !isBinaryExpression(parent) || parent.operatorToken.kind !== 61 /* QuestionQuestionToken */;
|
|
79883
79814
|
}
|
|
79884
79815
|
function getSyntacticNullishnessSemantics(node) {
|
|
79885
79816
|
node = skipOuterExpressions(node);
|
|
@@ -83969,6 +83900,7 @@ function createTypeChecker(host) {
|
|
|
83969
83900
|
}
|
|
83970
83901
|
function getIterationTypesOfIterable(type, use, errorNode) {
|
|
83971
83902
|
var _a, _b;
|
|
83903
|
+
type = getReducedType(type);
|
|
83972
83904
|
if (type === silentNeverType) {
|
|
83973
83905
|
return silentNeverIterationTypes;
|
|
83974
83906
|
}
|
|
@@ -84042,7 +83974,7 @@ function createTypeChecker(host) {
|
|
|
84042
83974
|
}
|
|
84043
83975
|
let noCache = false;
|
|
84044
83976
|
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84045
|
-
|
|
83977
|
+
let iterationTypes = getIterationTypesOfIterableCached(type, asyncIterationTypesResolver) || getIterationTypesOfIterableFast(type, asyncIterationTypesResolver);
|
|
84046
83978
|
if (iterationTypes) {
|
|
84047
83979
|
if (iterationTypes === noIterationTypes && errorNode) {
|
|
84048
83980
|
noCache = true;
|
|
@@ -84050,6 +83982,10 @@ function createTypeChecker(host) {
|
|
|
84050
83982
|
return use & 8 /* ForOfFlag */ ? getAsyncFromSyncIterationTypes(iterationTypes, errorNode) : iterationTypes;
|
|
84051
83983
|
}
|
|
84052
83984
|
}
|
|
83985
|
+
iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
83986
|
+
if (iterationTypes !== noIterationTypes) {
|
|
83987
|
+
return iterationTypes;
|
|
83988
|
+
}
|
|
84053
83989
|
}
|
|
84054
83990
|
if (use & 1 /* AllowsSyncIterablesFlag */) {
|
|
84055
83991
|
let iterationTypes = getIterationTypesOfIterableCached(type, syncIterationTypesResolver) || getIterationTypesOfIterableFast(type, syncIterationTypesResolver);
|
|
@@ -84067,15 +84003,7 @@ function createTypeChecker(host) {
|
|
|
84067
84003
|
}
|
|
84068
84004
|
}
|
|
84069
84005
|
}
|
|
84070
|
-
|
|
84071
|
-
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84072
|
-
const iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
84073
|
-
if (iterationTypes !== noIterationTypes) {
|
|
84074
|
-
return iterationTypes;
|
|
84075
|
-
}
|
|
84076
|
-
}
|
|
84077
|
-
if (use & 1 /* AllowsSyncIterablesFlag */) {
|
|
84078
|
-
let iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
84006
|
+
iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
84079
84007
|
if (iterationTypes !== noIterationTypes) {
|
|
84080
84008
|
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84081
84009
|
iterationTypes = getAsyncFromSyncIterationTypes(iterationTypes, errorNode);
|
|
@@ -84567,6 +84495,9 @@ function createTypeChecker(host) {
|
|
|
84567
84495
|
return false;
|
|
84568
84496
|
});
|
|
84569
84497
|
}
|
|
84498
|
+
if (node.label.flags & 1073741824 /* Unreachable */ && compilerOptions.allowUnusedLabels !== true) {
|
|
84499
|
+
errorOrSuggestion(compilerOptions.allowUnusedLabels === false, node.label, Diagnostics.Unused_label);
|
|
84500
|
+
}
|
|
84570
84501
|
checkSourceElement(node.statement);
|
|
84571
84502
|
}
|
|
84572
84503
|
function checkThrowStatement(node) {
|
|
@@ -86459,10 +86390,12 @@ function createTypeChecker(host) {
|
|
|
86459
86390
|
function checkSourceElement(node) {
|
|
86460
86391
|
if (node) {
|
|
86461
86392
|
const saveCurrentNode = currentNode;
|
|
86393
|
+
const saveWithinUnreachableCode = withinUnreachableCode;
|
|
86462
86394
|
currentNode = node;
|
|
86463
86395
|
instantiationCount = 0;
|
|
86464
86396
|
checkSourceElementWorker(node);
|
|
86465
86397
|
currentNode = saveCurrentNode;
|
|
86398
|
+
withinUnreachableCode = saveWithinUnreachableCode;
|
|
86466
86399
|
}
|
|
86467
86400
|
}
|
|
86468
86401
|
function checkSourceElementWorker(node) {
|
|
@@ -86490,8 +86423,10 @@ function createTypeChecker(host) {
|
|
|
86490
86423
|
cancellationToken.throwIfCancellationRequested();
|
|
86491
86424
|
}
|
|
86492
86425
|
}
|
|
86493
|
-
if (
|
|
86494
|
-
|
|
86426
|
+
if (compilerOptions.allowUnreachableCode !== true && !withinUnreachableCode) {
|
|
86427
|
+
if (checkSourceElementUnreachable(node)) {
|
|
86428
|
+
withinUnreachableCode = true;
|
|
86429
|
+
}
|
|
86495
86430
|
}
|
|
86496
86431
|
switch (kind) {
|
|
86497
86432
|
case 169 /* TypeParameter */:
|
|
@@ -86669,6 +86604,66 @@ function createTypeChecker(host) {
|
|
|
86669
86604
|
return checkMissingDeclaration(node);
|
|
86670
86605
|
}
|
|
86671
86606
|
}
|
|
86607
|
+
function checkSourceElementUnreachable(node) {
|
|
86608
|
+
if (!isPotentiallyExecutableNode(node)) {
|
|
86609
|
+
return false;
|
|
86610
|
+
}
|
|
86611
|
+
if (reportedUnreachableNodes == null ? void 0 : reportedUnreachableNodes.has(node)) {
|
|
86612
|
+
return true;
|
|
86613
|
+
}
|
|
86614
|
+
if (!isSourceElementUnreachable(node)) {
|
|
86615
|
+
return false;
|
|
86616
|
+
}
|
|
86617
|
+
(reportedUnreachableNodes ?? (reportedUnreachableNodes = /* @__PURE__ */ new Set())).add(node);
|
|
86618
|
+
const sourceFile = getSourceFileOfNode(node);
|
|
86619
|
+
let start = node.pos;
|
|
86620
|
+
let end = node.end;
|
|
86621
|
+
const parent = node.parent;
|
|
86622
|
+
if (canHaveStatements(parent)) {
|
|
86623
|
+
const statements = parent.statements;
|
|
86624
|
+
const offset = statements.indexOf(node);
|
|
86625
|
+
if (offset >= 0) {
|
|
86626
|
+
let first2 = offset;
|
|
86627
|
+
for (let i = offset - 1; i >= 0; i--) {
|
|
86628
|
+
const prevNode = statements[i];
|
|
86629
|
+
if (!isPotentiallyExecutableNode(prevNode) || reportedUnreachableNodes.has(prevNode) || !isSourceElementUnreachable(prevNode)) {
|
|
86630
|
+
break;
|
|
86631
|
+
}
|
|
86632
|
+
first2 = i;
|
|
86633
|
+
reportedUnreachableNodes.add(prevNode);
|
|
86634
|
+
}
|
|
86635
|
+
let last2 = offset;
|
|
86636
|
+
for (let i = offset + 1; i < statements.length; i++) {
|
|
86637
|
+
const nextNode = statements[i];
|
|
86638
|
+
if (!isPotentiallyExecutableNode(nextNode) || !isSourceElementUnreachable(nextNode)) {
|
|
86639
|
+
break;
|
|
86640
|
+
}
|
|
86641
|
+
last2 = i;
|
|
86642
|
+
reportedUnreachableNodes.add(nextNode);
|
|
86643
|
+
}
|
|
86644
|
+
start = statements[first2].pos;
|
|
86645
|
+
end = statements[last2].end;
|
|
86646
|
+
}
|
|
86647
|
+
}
|
|
86648
|
+
start = skipTrivia(sourceFile.text, start);
|
|
86649
|
+
addErrorOrSuggestion(compilerOptions.allowUnreachableCode === false, createFileDiagnostic(sourceFile, start, end - start, Diagnostics.Unreachable_code_detected));
|
|
86650
|
+
return true;
|
|
86651
|
+
}
|
|
86652
|
+
function isSourceElementUnreachable(node) {
|
|
86653
|
+
if (node.flags & 1073741824 /* Unreachable */) {
|
|
86654
|
+
switch (node.kind) {
|
|
86655
|
+
case 267 /* EnumDeclaration */:
|
|
86656
|
+
return !isEnumConst(node) || shouldPreserveConstEnums(compilerOptions);
|
|
86657
|
+
case 268 /* ModuleDeclaration */:
|
|
86658
|
+
return isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions));
|
|
86659
|
+
default:
|
|
86660
|
+
return true;
|
|
86661
|
+
}
|
|
86662
|
+
} else if (canHaveFlowNode(node) && node.flowNode) {
|
|
86663
|
+
return !isReachableFlowNode(node.flowNode);
|
|
86664
|
+
}
|
|
86665
|
+
return false;
|
|
86666
|
+
}
|
|
86672
86667
|
function checkJSDocCommentWorker(node) {
|
|
86673
86668
|
if (isArray(node)) {
|
|
86674
86669
|
forEach(node, (tag) => {
|
|
@@ -86831,6 +86826,7 @@ function createTypeChecker(host) {
|
|
|
86831
86826
|
mark(afterMark);
|
|
86832
86827
|
measure("Check", beforeMark, afterMark);
|
|
86833
86828
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
86829
|
+
reportedUnreachableNodes = void 0;
|
|
86834
86830
|
}
|
|
86835
86831
|
function unusedIsError(kind, isAmbient) {
|
|
86836
86832
|
if (isAmbient) {
|
|
@@ -89986,6 +89982,11 @@ function createTypeChecker(host) {
|
|
|
89986
89982
|
declarationList,
|
|
89987
89983
|
blockScopeFlags === 4 /* Using */ ? Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration : Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration
|
|
89988
89984
|
);
|
|
89985
|
+
} else if (isVariableStatement(declarationList.parent) && isCaseOrDefaultClause(declarationList.parent.parent)) {
|
|
89986
|
+
return grammarErrorOnNode(
|
|
89987
|
+
declarationList,
|
|
89988
|
+
blockScopeFlags === 4 /* Using */ ? Diagnostics.using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block : Diagnostics.await_using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block
|
|
89989
|
+
);
|
|
89989
89990
|
}
|
|
89990
89991
|
if (declarationList.flags & 33554432 /* Ambient */) {
|
|
89991
89992
|
return grammarErrorOnNode(
|
|
@@ -102824,8 +102825,6 @@ function transformESNext(context) {
|
|
|
102824
102825
|
return visitForStatement(node);
|
|
102825
102826
|
case 251 /* ForOfStatement */:
|
|
102826
102827
|
return visitForOfStatement(node);
|
|
102827
|
-
case 256 /* SwitchStatement */:
|
|
102828
|
-
return visitSwitchStatement(node);
|
|
102829
102828
|
default:
|
|
102830
102829
|
return visitEachChild(node, visitor, context);
|
|
102831
102830
|
}
|
|
@@ -102989,60 +102988,6 @@ function transformESNext(context) {
|
|
|
102989
102988
|
}
|
|
102990
102989
|
return visitEachChild(node, visitor, context);
|
|
102991
102990
|
}
|
|
102992
|
-
function visitCaseOrDefaultClause(node, envBinding) {
|
|
102993
|
-
if (getUsingKindOfStatements(node.statements) !== 0 /* None */) {
|
|
102994
|
-
if (isCaseClause(node)) {
|
|
102995
|
-
return factory2.updateCaseClause(
|
|
102996
|
-
node,
|
|
102997
|
-
visitNode(node.expression, visitor, isExpression),
|
|
102998
|
-
transformUsingDeclarations(
|
|
102999
|
-
node.statements,
|
|
103000
|
-
/*start*/
|
|
103001
|
-
0,
|
|
103002
|
-
node.statements.length,
|
|
103003
|
-
envBinding,
|
|
103004
|
-
/*topLevelStatements*/
|
|
103005
|
-
void 0
|
|
103006
|
-
)
|
|
103007
|
-
);
|
|
103008
|
-
} else {
|
|
103009
|
-
return factory2.updateDefaultClause(
|
|
103010
|
-
node,
|
|
103011
|
-
transformUsingDeclarations(
|
|
103012
|
-
node.statements,
|
|
103013
|
-
/*start*/
|
|
103014
|
-
0,
|
|
103015
|
-
node.statements.length,
|
|
103016
|
-
envBinding,
|
|
103017
|
-
/*topLevelStatements*/
|
|
103018
|
-
void 0
|
|
103019
|
-
)
|
|
103020
|
-
);
|
|
103021
|
-
}
|
|
103022
|
-
}
|
|
103023
|
-
return visitEachChild(node, visitor, context);
|
|
103024
|
-
}
|
|
103025
|
-
function visitSwitchStatement(node) {
|
|
103026
|
-
const usingKind = getUsingKindOfCaseOrDefaultClauses(node.caseBlock.clauses);
|
|
103027
|
-
if (usingKind) {
|
|
103028
|
-
const envBinding = createEnvBinding();
|
|
103029
|
-
return createDownlevelUsingStatements(
|
|
103030
|
-
[
|
|
103031
|
-
factory2.updateSwitchStatement(
|
|
103032
|
-
node,
|
|
103033
|
-
visitNode(node.expression, visitor, isExpression),
|
|
103034
|
-
factory2.updateCaseBlock(
|
|
103035
|
-
node.caseBlock,
|
|
103036
|
-
node.caseBlock.clauses.map((clause) => visitCaseOrDefaultClause(clause, envBinding))
|
|
103037
|
-
)
|
|
103038
|
-
)
|
|
103039
|
-
],
|
|
103040
|
-
envBinding,
|
|
103041
|
-
usingKind === 2 /* Async */
|
|
103042
|
-
);
|
|
103043
|
-
}
|
|
103044
|
-
return visitEachChild(node, visitor, context);
|
|
103045
|
-
}
|
|
103046
102991
|
function transformUsingDeclarations(statementsIn, start, end, envBinding, topLevelStatements) {
|
|
103047
102992
|
const statements = [];
|
|
103048
102993
|
for (let i = start; i < end; i++) {
|
|
@@ -103408,15 +103353,6 @@ function getUsingKindOfStatements(statements) {
|
|
|
103408
103353
|
}
|
|
103409
103354
|
return result;
|
|
103410
103355
|
}
|
|
103411
|
-
function getUsingKindOfCaseOrDefaultClauses(clauses) {
|
|
103412
|
-
let result = 0 /* None */;
|
|
103413
|
-
for (const clause of clauses) {
|
|
103414
|
-
const usingKind = getUsingKindOfStatements(clause.statements);
|
|
103415
|
-
if (usingKind === 2 /* Async */) return 2 /* Async */;
|
|
103416
|
-
if (usingKind > result) result = usingKind;
|
|
103417
|
-
}
|
|
103418
|
-
return result;
|
|
103419
|
-
}
|
|
103420
103356
|
|
|
103421
103357
|
// src/compiler/transformers/jsx.ts
|
|
103422
103358
|
function transformJsx(context) {
|
|
@@ -124529,7 +124465,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
124529
124465
|
}
|
|
124530
124466
|
}
|
|
124531
124467
|
if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly || options.rewriteRelativeImportExtensions)) {
|
|
124532
|
-
createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.
|
|
124468
|
+
createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_one_of_noEmit_emitDeclarationOnly_or_rewriteRelativeImportExtensions_is_set);
|
|
124533
124469
|
}
|
|
124534
124470
|
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
124535
124471
|
if (options.resolvePackageJsonExports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
@@ -132131,18 +132067,23 @@ function executeCommandLineWorker(sys2, cb, commandLine) {
|
|
|
132131
132067
|
return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
|
|
132132
132068
|
}
|
|
132133
132069
|
}
|
|
132134
|
-
} else if (commandLine.fileNames.length === 0) {
|
|
132070
|
+
} else if (!commandLine.options.ignoreConfig || commandLine.fileNames.length === 0) {
|
|
132135
132071
|
const searchPath = normalizePath(sys2.getCurrentDirectory());
|
|
132136
132072
|
configFileName = findConfigFile(searchPath, (fileName) => sys2.fileExists(fileName));
|
|
132137
|
-
|
|
132138
|
-
|
|
132139
|
-
|
|
132140
|
-
|
|
132141
|
-
|
|
132142
|
-
|
|
132143
|
-
|
|
132073
|
+
if (commandLine.fileNames.length !== 0) {
|
|
132074
|
+
if (configFileName) {
|
|
132075
|
+
reportDiagnostic(createCompilerDiagnostic(Diagnostics.tsconfig_json_is_present_but_will_not_be_loaded_if_files_are_specified_on_commandline_Use_ignoreConfig_to_skip_this_error));
|
|
132076
|
+
return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
|
|
132077
|
+
}
|
|
132078
|
+
} else if (!configFileName) {
|
|
132079
|
+
if (commandLine.options.showConfig) {
|
|
132080
|
+
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0, normalizePath(sys2.getCurrentDirectory())));
|
|
132081
|
+
} else {
|
|
132082
|
+
printVersion(sys2);
|
|
132083
|
+
printHelp(sys2, commandLine);
|
|
132084
|
+
}
|
|
132085
|
+
return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
|
|
132144
132086
|
}
|
|
132145
|
-
return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
|
|
132146
132087
|
}
|
|
132147
132088
|
const currentDirectory = sys2.getCurrentDirectory();
|
|
132148
132089
|
const commandLineOptions = convertToOptionsWithAbsolutePaths(
|