@typescript-deploys/pr-build 5.0.0-pr-51387-10 → 5.0.0-pr-51387-49
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 +392 -419
- package/lib/tsserver.js +349 -397
- package/lib/tsserverlibrary.d.ts +5 -2
- package/lib/tsserverlibrary.js +348 -389
- package/lib/typescript.d.ts +5 -2
- package/lib/typescript.js +344 -389
- package/lib/typingsInstaller.js +8 -7
- package/package.json +3 -3
package/lib/tsserver.js
CHANGED
|
@@ -452,6 +452,7 @@ var ts = (() => {
|
|
|
452
452
|
createFunctionTypeNode: () => createFunctionTypeNode,
|
|
453
453
|
createGetAccessor: () => createGetAccessor,
|
|
454
454
|
createGetCanonicalFileName: () => createGetCanonicalFileName,
|
|
455
|
+
createGetSourceFile: () => createGetSourceFile,
|
|
455
456
|
createGetSymbolAccessibilityDiagnosticForNode: () => createGetSymbolAccessibilityDiagnosticForNode,
|
|
456
457
|
createGetSymbolAccessibilityDiagnosticForNodeName: () => createGetSymbolAccessibilityDiagnosticForNodeName,
|
|
457
458
|
createGetSymbolWalker: () => createGetSymbolWalker,
|
|
@@ -471,6 +472,8 @@ var ts = (() => {
|
|
|
471
472
|
createIndexedAccessTypeNode: () => createIndexedAccessTypeNode,
|
|
472
473
|
createInferTypeNode: () => createInferTypeNode,
|
|
473
474
|
createInputFiles: () => createInputFiles,
|
|
475
|
+
createInputFilesWithFilePaths: () => createInputFilesWithFilePaths,
|
|
476
|
+
createInputFilesWithFileTexts: () => createInputFilesWithFileTexts,
|
|
474
477
|
createInterfaceDeclaration: () => createInterfaceDeclaration,
|
|
475
478
|
createIntersectionTypeNode: () => createIntersectionTypeNode,
|
|
476
479
|
createJSDocAugmentsTag: () => createJSDocAugmentsTag,
|
|
@@ -671,6 +674,7 @@ var ts = (() => {
|
|
|
671
674
|
createWatchStatusReporter: () => createWatchStatusReporter,
|
|
672
675
|
createWhile: () => createWhile,
|
|
673
676
|
createWith: () => createWith,
|
|
677
|
+
createWriteFileMeasuringIO: () => createWriteFileMeasuringIO,
|
|
674
678
|
createYield: () => createYield,
|
|
675
679
|
declarationNameToString: () => declarationNameToString,
|
|
676
680
|
decodeMappings: () => decodeMappings,
|
|
@@ -2623,7 +2627,6 @@ var ts = (() => {
|
|
|
2623
2627
|
projectContainsInfoDirectly: () => projectContainsInfoDirectly,
|
|
2624
2628
|
protocol: () => ts_server_protocol_exports,
|
|
2625
2629
|
removeSorted: () => removeSorted,
|
|
2626
|
-
setDynamicImport: () => setDynamicImport,
|
|
2627
2630
|
stringifyIndented: () => stringifyIndented,
|
|
2628
2631
|
toEvent: () => toEvent,
|
|
2629
2632
|
toNormalizedPath: () => toNormalizedPath,
|
|
@@ -2633,7 +2636,7 @@ var ts = (() => {
|
|
|
2633
2636
|
|
|
2634
2637
|
// src/compiler/corePublic.ts
|
|
2635
2638
|
var versionMajorMinor = "5.0";
|
|
2636
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2639
|
+
var version = `${versionMajorMinor}.0-insiders.20221107`;
|
|
2637
2640
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2638
2641
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2639
2642
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -5030,6 +5033,7 @@ m2: ${this.mapper2.__debugToString().split("\n").join("\n ")}`;
|
|
|
5030
5033
|
})(BoxCharacter || (BoxCharacter = {}));
|
|
5031
5034
|
let Connection;
|
|
5032
5035
|
((Connection2) => {
|
|
5036
|
+
Connection2[Connection2["None"] = 0] = "None";
|
|
5033
5037
|
Connection2[Connection2["Up"] = 1] = "Up";
|
|
5034
5038
|
Connection2[Connection2["Down"] = 2] = "Down";
|
|
5035
5039
|
Connection2[Connection2["Left"] = 4] = "Left";
|
|
@@ -10065,7 +10069,7 @@ ${lanes.join("\n")}
|
|
|
10065
10069
|
The_0_operator_cannot_be_applied_to_type_symbol: diag(2469, 1 /* Error */, "The_0_operator_cannot_be_applied_to_type_symbol_2469", "The '{0}' operator cannot be applied to type 'symbol'."),
|
|
10066
10070
|
Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: diag(2472, 1 /* Error */, "Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher_2472", "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher."),
|
|
10067
10071
|
Enum_declarations_must_all_be_const_or_non_const: diag(2473, 1 /* Error */, "Enum_declarations_must_all_be_const_or_non_const_2473", "Enum declarations must all be const or non-const."),
|
|
10068
|
-
|
|
10072
|
+
const_enum_member_initializers_must_be_constant_expressions: diag(2474, 1 /* Error */, "const_enum_member_initializers_must_be_constant_expressions_2474", "const enum member initializers must be constant expressions."),
|
|
10069
10073
|
const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query: diag(2475, 1 /* Error */, "const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475", "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query."),
|
|
10070
10074
|
A_const_enum_member_can_only_be_accessed_using_a_string_literal: diag(2476, 1 /* Error */, "A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476", "A const enum member can only be accessed using a string literal."),
|
|
10071
10075
|
const_enum_member_initializer_was_evaluated_to_a_non_finite_value: diag(2477, 1 /* Error */, "const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477", "'const' enum member initializer was evaluated to a non-finite value."),
|
|
@@ -10121,7 +10125,6 @@ ${lanes.join("\n")}
|
|
|
10121
10125
|
Object_is_possibly_undefined: diag(2532, 1 /* Error */, "Object_is_possibly_undefined_2532", "Object is possibly 'undefined'."),
|
|
10122
10126
|
Object_is_possibly_null_or_undefined: diag(2533, 1 /* Error */, "Object_is_possibly_null_or_undefined_2533", "Object is possibly 'null' or 'undefined'."),
|
|
10123
10127
|
A_function_returning_never_cannot_have_a_reachable_end_point: diag(2534, 1 /* Error */, "A_function_returning_never_cannot_have_a_reachable_end_point_2534", "A function returning 'never' cannot have a reachable end point."),
|
|
10124
|
-
Enum_type_0_has_members_with_initializers_that_are_not_literals: diag(2535, 1 /* Error */, "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", "Enum type '{0}' has members with initializers that are not literals."),
|
|
10125
10128
|
Type_0_cannot_be_used_to_index_type_1: diag(2536, 1 /* Error */, "Type_0_cannot_be_used_to_index_type_1_2536", "Type '{0}' cannot be used to index type '{1}'."),
|
|
10126
10129
|
Type_0_has_no_matching_index_signature_for_type_1: diag(2537, 1 /* Error */, "Type_0_has_no_matching_index_signature_for_type_1_2537", "Type '{0}' has no matching index signature for type '{1}'."),
|
|
10127
10130
|
Type_0_cannot_be_used_as_an_index_type: diag(2538, 1 /* Error */, "Type_0_cannot_be_used_as_an_index_type_2538", "Type '{0}' cannot be used as an index type."),
|
|
@@ -11364,7 +11367,7 @@ ${lanes.join("\n")}
|
|
|
11364
11367
|
An_optional_chain_cannot_contain_private_identifiers: diag(18030, 1 /* Error */, "An_optional_chain_cannot_contain_private_identifiers_18030", "An optional chain cannot contain private identifiers."),
|
|
11365
11368
|
The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents: diag(18031, 1 /* Error */, "The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituent_18031", "The intersection '{0}' was reduced to 'never' because property '{1}' has conflicting types in some constituents."),
|
|
11366
11369
|
The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some: diag(18032, 1 /* Error */, "The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_pr_18032", "The intersection '{0}' was reduced to 'never' because property '{1}' exists in multiple constituents and is private in some."),
|
|
11367
|
-
|
|
11370
|
+
Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values: diag(18033, 1 /* Error */, "Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values_18033", "Type '{0}' is not assignable to type '{1}' as required for computed enum member values."),
|
|
11368
11371
|
Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compiler_option_is_specified_e_g_Fragment: diag(18034, 3 /* Message */, "Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compi_18034", "Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'."),
|
|
11369
11372
|
Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name: diag(18035, 1 /* Error */, "Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name_18035", "Invalid value for 'jsxFragmentFactory'. '{0}' is not a valid identifier or qualified-name."),
|
|
11370
11373
|
Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator: diag(18036, 1 /* Error */, "Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_dec_18036", "Class decorators can't be used with static private identifier. Consider removing the experimental decorator."),
|
|
@@ -24887,69 +24890,83 @@ ${lanes.join("\n")}
|
|
|
24887
24890
|
node.helpers = map(bundleFileInfo.sources && bundleFileInfo.sources.helpers, (name) => getAllUnscopedEmitHelpers().get(name));
|
|
24888
24891
|
return node;
|
|
24889
24892
|
}
|
|
24890
|
-
function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath
|
|
24893
|
+
function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath) {
|
|
24894
|
+
return !isString(javascriptTextOrReadFileText) ? createInputFilesWithFilePaths(
|
|
24895
|
+
javascriptTextOrReadFileText,
|
|
24896
|
+
declarationTextOrJavascriptPath,
|
|
24897
|
+
javascriptMapPath,
|
|
24898
|
+
javascriptMapTextOrDeclarationPath,
|
|
24899
|
+
declarationMapPath,
|
|
24900
|
+
declarationMapTextOrBuildInfoPath
|
|
24901
|
+
) : createInputFilesWithFileTexts(
|
|
24902
|
+
void 0,
|
|
24903
|
+
javascriptTextOrReadFileText,
|
|
24904
|
+
javascriptMapPath,
|
|
24905
|
+
javascriptMapTextOrDeclarationPath,
|
|
24906
|
+
void 0,
|
|
24907
|
+
declarationTextOrJavascriptPath,
|
|
24908
|
+
declarationMapPath,
|
|
24909
|
+
declarationMapTextOrBuildInfoPath
|
|
24910
|
+
);
|
|
24911
|
+
}
|
|
24912
|
+
function createInputFilesWithFilePaths(readFileText, javascriptPath, javascriptMapPath, declarationPath, declarationMapPath, buildInfoPath, host, options) {
|
|
24891
24913
|
const node = parseNodeFactory.createInputFiles();
|
|
24892
|
-
|
|
24893
|
-
|
|
24894
|
-
|
|
24895
|
-
|
|
24896
|
-
|
|
24897
|
-
|
|
24898
|
-
|
|
24899
|
-
|
|
24900
|
-
|
|
24901
|
-
|
|
24902
|
-
|
|
24903
|
-
|
|
24904
|
-
|
|
24905
|
-
|
|
24906
|
-
|
|
24914
|
+
node.javascriptPath = javascriptPath;
|
|
24915
|
+
node.javascriptMapPath = javascriptMapPath;
|
|
24916
|
+
node.declarationPath = declarationPath;
|
|
24917
|
+
node.declarationMapPath = declarationMapPath;
|
|
24918
|
+
node.buildInfoPath = buildInfoPath;
|
|
24919
|
+
const cache = new Map();
|
|
24920
|
+
const textGetter = (path) => {
|
|
24921
|
+
if (path === void 0)
|
|
24922
|
+
return void 0;
|
|
24923
|
+
let value = cache.get(path);
|
|
24924
|
+
if (value === void 0) {
|
|
24925
|
+
value = readFileText(path);
|
|
24926
|
+
cache.set(path, value !== void 0 ? value : false);
|
|
24927
|
+
}
|
|
24928
|
+
return value !== false ? value : void 0;
|
|
24929
|
+
};
|
|
24930
|
+
const definedTextGetter = (path) => {
|
|
24931
|
+
const result = textGetter(path);
|
|
24932
|
+
return result !== void 0 ? result : `/* Input file ${path} was missing */\r
|
|
24907
24933
|
`;
|
|
24908
|
-
|
|
24909
|
-
|
|
24910
|
-
|
|
24911
|
-
|
|
24912
|
-
|
|
24913
|
-
|
|
24914
|
-
|
|
24934
|
+
};
|
|
24935
|
+
let buildInfo;
|
|
24936
|
+
const getAndCacheBuildInfo = () => {
|
|
24937
|
+
var _a2, _b;
|
|
24938
|
+
if (buildInfo === void 0 && buildInfoPath) {
|
|
24939
|
+
if (host == null ? void 0 : host.getBuildInfo) {
|
|
24940
|
+
buildInfo = (_a2 = host.getBuildInfo(buildInfoPath, options.configFilePath)) != null ? _a2 : false;
|
|
24941
|
+
} else {
|
|
24942
|
+
const result = textGetter(buildInfoPath);
|
|
24943
|
+
buildInfo = result !== void 0 ? (_b = getBuildInfo(buildInfoPath, result)) != null ? _b : false : false;
|
|
24915
24944
|
}
|
|
24916
|
-
|
|
24917
|
-
|
|
24918
|
-
|
|
24919
|
-
|
|
24920
|
-
|
|
24921
|
-
|
|
24922
|
-
|
|
24923
|
-
|
|
24924
|
-
|
|
24925
|
-
|
|
24926
|
-
|
|
24927
|
-
|
|
24928
|
-
|
|
24929
|
-
|
|
24930
|
-
|
|
24931
|
-
|
|
24932
|
-
|
|
24933
|
-
|
|
24934
|
-
|
|
24935
|
-
|
|
24936
|
-
|
|
24937
|
-
|
|
24938
|
-
|
|
24939
|
-
|
|
24940
|
-
|
|
24941
|
-
node.javascriptText = javascriptTextOrReadFileText;
|
|
24942
|
-
node.javascriptMapPath = javascriptMapPath;
|
|
24943
|
-
node.javascriptMapText = javascriptMapTextOrDeclarationPath;
|
|
24944
|
-
node.declarationText = declarationTextOrJavascriptPath;
|
|
24945
|
-
node.declarationMapPath = declarationMapPath;
|
|
24946
|
-
node.declarationMapText = declarationMapTextOrBuildInfoPath;
|
|
24947
|
-
node.javascriptPath = javascriptPath;
|
|
24948
|
-
node.declarationPath = declarationPath;
|
|
24949
|
-
node.buildInfoPath = buildInfoPath;
|
|
24950
|
-
node.buildInfo = buildInfo;
|
|
24951
|
-
node.oldFileOfCurrentEmit = oldFileOfCurrentEmit;
|
|
24952
|
-
}
|
|
24945
|
+
}
|
|
24946
|
+
return buildInfo || void 0;
|
|
24947
|
+
};
|
|
24948
|
+
Object.defineProperties(node, {
|
|
24949
|
+
javascriptText: { get: () => definedTextGetter(javascriptPath) },
|
|
24950
|
+
javascriptMapText: { get: () => textGetter(javascriptMapPath) },
|
|
24951
|
+
declarationText: { get: () => definedTextGetter(Debug.checkDefined(declarationPath)) },
|
|
24952
|
+
declarationMapText: { get: () => textGetter(declarationMapPath) },
|
|
24953
|
+
buildInfo: { get: getAndCacheBuildInfo }
|
|
24954
|
+
});
|
|
24955
|
+
return node;
|
|
24956
|
+
}
|
|
24957
|
+
function createInputFilesWithFileTexts(javascriptPath, javascriptText, javascriptMapPath, javascriptMapText, declarationPath, declarationText, declarationMapPath, declarationMapText, buildInfoPath, buildInfo, oldFileOfCurrentEmit) {
|
|
24958
|
+
const node = parseNodeFactory.createInputFiles();
|
|
24959
|
+
node.javascriptPath = javascriptPath;
|
|
24960
|
+
node.javascriptText = javascriptText;
|
|
24961
|
+
node.javascriptMapPath = javascriptMapPath;
|
|
24962
|
+
node.javascriptMapText = javascriptMapText;
|
|
24963
|
+
node.declarationPath = declarationPath;
|
|
24964
|
+
node.declarationText = declarationText;
|
|
24965
|
+
node.declarationMapPath = declarationMapPath;
|
|
24966
|
+
node.declarationMapText = declarationMapText;
|
|
24967
|
+
node.buildInfoPath = buildInfoPath;
|
|
24968
|
+
node.buildInfo = buildInfo;
|
|
24969
|
+
node.oldFileOfCurrentEmit = oldFileOfCurrentEmit;
|
|
24953
24970
|
return node;
|
|
24954
24971
|
}
|
|
24955
24972
|
var SourceMapSource2;
|
|
@@ -42991,7 +43008,6 @@ ${lanes.join("\n")}
|
|
|
42991
43008
|
const Signature15 = objectAllocator.getSignatureConstructor();
|
|
42992
43009
|
let typeCount = 0;
|
|
42993
43010
|
let symbolCount = 0;
|
|
42994
|
-
let enumCount = 0;
|
|
42995
43011
|
let totalInstantiationCount = 0;
|
|
42996
43012
|
let instantiationCount = 0;
|
|
42997
43013
|
let instantiationDepth = 0;
|
|
@@ -44822,7 +44838,7 @@ ${lanes.join("\n")}
|
|
|
44822
44838
|
}
|
|
44823
44839
|
}
|
|
44824
44840
|
function isSameScopeDescendentOf(initial, parent2, stopAt) {
|
|
44825
|
-
return !!parent2 && !!findAncestor(initial, (n) => n === parent2 || (n === stopAt || isFunctionLike(n) && !getImmediatelyInvokedFunctionExpression(n) ? "quit" : false));
|
|
44841
|
+
return !!parent2 && !!findAncestor(initial, (n) => n === parent2 || (n === stopAt || isFunctionLike(n) && (!getImmediatelyInvokedFunctionExpression(n) || isAsyncFunction(n)) ? "quit" : false));
|
|
44826
44842
|
}
|
|
44827
44843
|
function getAnyImportSyntax(node) {
|
|
44828
44844
|
switch (node.kind) {
|
|
@@ -46095,6 +46111,11 @@ ${lanes.join("\n")}
|
|
|
46095
46111
|
(_a2 = tracing) == null ? void 0 : _a2.recordType(result);
|
|
46096
46112
|
return result;
|
|
46097
46113
|
}
|
|
46114
|
+
function createTypeWithSymbol(flags, symbol) {
|
|
46115
|
+
const result = createType(flags);
|
|
46116
|
+
result.symbol = symbol;
|
|
46117
|
+
return result;
|
|
46118
|
+
}
|
|
46098
46119
|
function createOriginType(flags) {
|
|
46099
46120
|
return new Type27(checker, flags);
|
|
46100
46121
|
}
|
|
@@ -46105,9 +46126,8 @@ ${lanes.join("\n")}
|
|
|
46105
46126
|
return type;
|
|
46106
46127
|
}
|
|
46107
46128
|
function createObjectType(objectFlags, symbol) {
|
|
46108
|
-
const type =
|
|
46129
|
+
const type = createTypeWithSymbol(524288 /* Object */, symbol);
|
|
46109
46130
|
type.objectFlags = objectFlags;
|
|
46110
|
-
type.symbol = symbol;
|
|
46111
46131
|
type.members = void 0;
|
|
46112
46132
|
type.properties = void 0;
|
|
46113
46133
|
type.callSignatures = void 0;
|
|
@@ -46119,10 +46139,7 @@ ${lanes.join("\n")}
|
|
|
46119
46139
|
return getUnionType(arrayFrom(typeofNEFacts.keys(), getStringLiteralType));
|
|
46120
46140
|
}
|
|
46121
46141
|
function createTypeParameter(symbol) {
|
|
46122
|
-
|
|
46123
|
-
if (symbol)
|
|
46124
|
-
type.symbol = symbol;
|
|
46125
|
-
return type;
|
|
46142
|
+
return createTypeWithSymbol(262144 /* TypeParameter */, symbol);
|
|
46126
46143
|
}
|
|
46127
46144
|
function isReservedMemberName(name) {
|
|
46128
46145
|
return name.charCodeAt(0) === 95 /* _ */ && name.charCodeAt(1) === 95 /* _ */ && name.charCodeAt(2) !== 95 /* _ */ && name.charCodeAt(2) !== 64 /* at */ && name.charCodeAt(2) !== 35 /* hash */;
|
|
@@ -46713,29 +46730,29 @@ ${lanes.join("\n")}
|
|
|
46713
46730
|
context.approximateLength += 7;
|
|
46714
46731
|
return factory.createKeywordTypeNode(134 /* BooleanKeyword */);
|
|
46715
46732
|
}
|
|
46716
|
-
if (type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */)) {
|
|
46717
|
-
const parentSymbol = getParentOfSymbol(type.symbol);
|
|
46718
|
-
const parentName = symbolToTypeNode(parentSymbol, context, 788968 /* Type */);
|
|
46719
|
-
if (getDeclaredTypeOfSymbol(parentSymbol) === type) {
|
|
46720
|
-
return parentName;
|
|
46721
|
-
}
|
|
46722
|
-
const memberName = symbolName(type.symbol);
|
|
46723
|
-
if (isIdentifierText(memberName, 0 /* ES3 */)) {
|
|
46724
|
-
return appendReferenceToType(
|
|
46725
|
-
parentName,
|
|
46726
|
-
factory.createTypeReferenceNode(memberName, void 0)
|
|
46727
|
-
);
|
|
46728
|
-
}
|
|
46729
|
-
if (isImportTypeNode(parentName)) {
|
|
46730
|
-
parentName.isTypeOf = true;
|
|
46731
|
-
return factory.createIndexedAccessTypeNode(parentName, factory.createLiteralTypeNode(factory.createStringLiteral(memberName)));
|
|
46732
|
-
} else if (isTypeReferenceNode(parentName)) {
|
|
46733
|
-
return factory.createIndexedAccessTypeNode(factory.createTypeQueryNode(parentName.typeName), factory.createLiteralTypeNode(factory.createStringLiteral(memberName)));
|
|
46734
|
-
} else {
|
|
46735
|
-
return Debug.fail("Unhandled type node kind returned from `symbolToTypeNode`.");
|
|
46736
|
-
}
|
|
46737
|
-
}
|
|
46738
46733
|
if (type.flags & 1056 /* EnumLike */) {
|
|
46734
|
+
if (type.symbol.flags & 8 /* EnumMember */) {
|
|
46735
|
+
const parentSymbol = getParentOfSymbol(type.symbol);
|
|
46736
|
+
const parentName = symbolToTypeNode(parentSymbol, context, 788968 /* Type */);
|
|
46737
|
+
if (getDeclaredTypeOfSymbol(parentSymbol) === type) {
|
|
46738
|
+
return parentName;
|
|
46739
|
+
}
|
|
46740
|
+
const memberName = symbolName(type.symbol);
|
|
46741
|
+
if (isIdentifierText(memberName, 0 /* ES3 */)) {
|
|
46742
|
+
return appendReferenceToType(
|
|
46743
|
+
parentName,
|
|
46744
|
+
factory.createTypeReferenceNode(memberName, void 0)
|
|
46745
|
+
);
|
|
46746
|
+
}
|
|
46747
|
+
if (isImportTypeNode(parentName)) {
|
|
46748
|
+
parentName.isTypeOf = true;
|
|
46749
|
+
return factory.createIndexedAccessTypeNode(parentName, factory.createLiteralTypeNode(factory.createStringLiteral(memberName)));
|
|
46750
|
+
} else if (isTypeReferenceNode(parentName)) {
|
|
46751
|
+
return factory.createIndexedAccessTypeNode(factory.createTypeQueryNode(parentName.typeName), factory.createLiteralTypeNode(factory.createStringLiteral(memberName)));
|
|
46752
|
+
} else {
|
|
46753
|
+
return Debug.fail("Unhandled type node kind returned from `symbolToTypeNode`.");
|
|
46754
|
+
}
|
|
46755
|
+
}
|
|
46739
46756
|
return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
|
|
46740
46757
|
}
|
|
46741
46758
|
if (type.flags & 128 /* StringLiteral */) {
|
|
@@ -51074,91 +51091,36 @@ ${lanes.join("\n")}
|
|
|
51074
51091
|
}
|
|
51075
51092
|
return links.declaredType;
|
|
51076
51093
|
}
|
|
51077
|
-
function isStringConcatExpression(expr) {
|
|
51078
|
-
if (isStringLiteralLike(expr)) {
|
|
51079
|
-
return true;
|
|
51080
|
-
} else if (expr.kind === 223 /* BinaryExpression */) {
|
|
51081
|
-
return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right);
|
|
51082
|
-
}
|
|
51083
|
-
return false;
|
|
51084
|
-
}
|
|
51085
|
-
function isLiteralEnumMember(member) {
|
|
51086
|
-
const expr = member.initializer;
|
|
51087
|
-
if (!expr) {
|
|
51088
|
-
return !(member.flags & 16777216 /* Ambient */);
|
|
51089
|
-
}
|
|
51090
|
-
switch (expr.kind) {
|
|
51091
|
-
case 10 /* StringLiteral */:
|
|
51092
|
-
case 8 /* NumericLiteral */:
|
|
51093
|
-
case 14 /* NoSubstitutionTemplateLiteral */:
|
|
51094
|
-
return true;
|
|
51095
|
-
case 221 /* PrefixUnaryExpression */:
|
|
51096
|
-
return expr.operator === 40 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */;
|
|
51097
|
-
case 79 /* Identifier */:
|
|
51098
|
-
return nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText);
|
|
51099
|
-
case 223 /* BinaryExpression */:
|
|
51100
|
-
return isStringConcatExpression(expr);
|
|
51101
|
-
default:
|
|
51102
|
-
return false;
|
|
51103
|
-
}
|
|
51104
|
-
}
|
|
51105
|
-
function getEnumKind(symbol) {
|
|
51106
|
-
const links = getSymbolLinks(symbol);
|
|
51107
|
-
if (links.enumKind !== void 0) {
|
|
51108
|
-
return links.enumKind;
|
|
51109
|
-
}
|
|
51110
|
-
let hasNonLiteralMember = false;
|
|
51111
|
-
if (symbol.declarations) {
|
|
51112
|
-
for (const declaration of symbol.declarations) {
|
|
51113
|
-
if (declaration.kind === 263 /* EnumDeclaration */) {
|
|
51114
|
-
for (const member of declaration.members) {
|
|
51115
|
-
if (member.initializer && isStringLiteralLike(member.initializer)) {
|
|
51116
|
-
return links.enumKind = 1 /* Literal */;
|
|
51117
|
-
}
|
|
51118
|
-
if (!isLiteralEnumMember(member)) {
|
|
51119
|
-
hasNonLiteralMember = true;
|
|
51120
|
-
}
|
|
51121
|
-
}
|
|
51122
|
-
}
|
|
51123
|
-
}
|
|
51124
|
-
}
|
|
51125
|
-
return links.enumKind = hasNonLiteralMember ? 0 /* Numeric */ : 1 /* Literal */;
|
|
51126
|
-
}
|
|
51127
51094
|
function getBaseTypeOfEnumLiteralType(type) {
|
|
51128
51095
|
return type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */) ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
|
|
51129
51096
|
}
|
|
51130
51097
|
function getDeclaredTypeOfEnum(symbol) {
|
|
51131
51098
|
const links = getSymbolLinks(symbol);
|
|
51132
|
-
if (links.declaredType) {
|
|
51133
|
-
return links.declaredType;
|
|
51134
|
-
}
|
|
51135
|
-
if (getEnumKind(symbol) === 1 /* Literal */) {
|
|
51136
|
-
enumCount++;
|
|
51099
|
+
if (!links.declaredType) {
|
|
51137
51100
|
const memberTypeList = [];
|
|
51138
51101
|
if (symbol.declarations) {
|
|
51139
51102
|
for (const declaration of symbol.declarations) {
|
|
51140
51103
|
if (declaration.kind === 263 /* EnumDeclaration */) {
|
|
51141
51104
|
for (const member of declaration.members) {
|
|
51142
|
-
|
|
51143
|
-
|
|
51144
|
-
|
|
51145
|
-
|
|
51105
|
+
if (hasBindableName(member)) {
|
|
51106
|
+
const memberSymbol = getSymbolOfNode(member);
|
|
51107
|
+
const value = getEnumMemberValue(member);
|
|
51108
|
+
const memberType = value !== void 0 ? getFreshTypeOfLiteralType(getEnumLiteralType(value, getSymbolId(symbol), memberSymbol)) : createTypeWithSymbol(32 /* Enum */, memberSymbol);
|
|
51109
|
+
getSymbolLinks(memberSymbol).declaredType = memberType;
|
|
51110
|
+
memberTypeList.push(getRegularTypeOfLiteralType(memberType));
|
|
51111
|
+
}
|
|
51146
51112
|
}
|
|
51147
51113
|
}
|
|
51148
51114
|
}
|
|
51149
51115
|
}
|
|
51150
|
-
|
|
51151
|
-
|
|
51152
|
-
|
|
51153
|
-
|
|
51154
|
-
enumType2.symbol = symbol;
|
|
51155
|
-
}
|
|
51156
|
-
return links.declaredType = enumType2;
|
|
51116
|
+
const enumType = memberTypeList.length ? getUnionType(memberTypeList, 1 /* Literal */, symbol, void 0) : createTypeWithSymbol(32 /* Enum */, symbol);
|
|
51117
|
+
if (enumType.flags & 1048576 /* Union */) {
|
|
51118
|
+
enumType.flags |= 1024 /* EnumLiteral */;
|
|
51119
|
+
enumType.symbol = symbol;
|
|
51157
51120
|
}
|
|
51121
|
+
links.declaredType = enumType;
|
|
51158
51122
|
}
|
|
51159
|
-
|
|
51160
|
-
enumType.symbol = symbol;
|
|
51161
|
-
return links.declaredType = enumType;
|
|
51123
|
+
return links.declaredType;
|
|
51162
51124
|
}
|
|
51163
51125
|
function getDeclaredTypeOfEnumMember(symbol) {
|
|
51164
51126
|
const links = getSymbolLinks(symbol);
|
|
@@ -53410,8 +53372,7 @@ ${lanes.join("\n")}
|
|
|
53410
53372
|
return type;
|
|
53411
53373
|
}
|
|
53412
53374
|
function cloneTypeReference(source) {
|
|
53413
|
-
const type =
|
|
53414
|
-
type.symbol = source.symbol;
|
|
53375
|
+
const type = createTypeWithSymbol(source.flags, source.symbol);
|
|
53415
53376
|
type.objectFlags = source.objectFlags;
|
|
53416
53377
|
type.target = source.target;
|
|
53417
53378
|
type.resolvedTypeArguments = source.resolvedTypeArguments;
|
|
@@ -54959,8 +54920,7 @@ ${lanes.join("\n")}
|
|
|
54959
54920
|
return result;
|
|
54960
54921
|
}
|
|
54961
54922
|
function createStringMappingType(symbol, type) {
|
|
54962
|
-
const result =
|
|
54963
|
-
result.symbol = symbol;
|
|
54923
|
+
const result = createTypeWithSymbol(268435456 /* StringMapping */, symbol);
|
|
54964
54924
|
result.type = type;
|
|
54965
54925
|
return result;
|
|
54966
54926
|
}
|
|
@@ -55774,8 +55734,7 @@ ${lanes.join("\n")}
|
|
|
55774
55734
|
return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration) : info;
|
|
55775
55735
|
}
|
|
55776
55736
|
function createLiteralType(flags, value, symbol, regularType) {
|
|
55777
|
-
const type =
|
|
55778
|
-
type.symbol = symbol;
|
|
55737
|
+
const type = createTypeWithSymbol(flags, symbol);
|
|
55779
55738
|
type.value = value;
|
|
55780
55739
|
type.regularType = regularType || type;
|
|
55781
55740
|
return type;
|
|
@@ -55812,8 +55771,7 @@ ${lanes.join("\n")}
|
|
|
55812
55771
|
}
|
|
55813
55772
|
function getEnumLiteralType(value, enumId, symbol) {
|
|
55814
55773
|
let type;
|
|
55815
|
-
const
|
|
55816
|
-
const key = enumId + qualifier + value;
|
|
55774
|
+
const key = `${enumId}${typeof value === "string" ? "@" : "#"}${value}`;
|
|
55817
55775
|
const flags = 1024 /* EnumLiteral */ | (typeof value === "string" ? 128 /* StringLiteral */ : 256 /* NumberLiteral */);
|
|
55818
55776
|
return enumLiteralTypes.get(key) || (enumLiteralTypes.set(key, type = createLiteralType(flags, value, symbol)), type);
|
|
55819
55777
|
}
|
|
@@ -55828,8 +55786,7 @@ ${lanes.join("\n")}
|
|
|
55828
55786
|
return links.resolvedType;
|
|
55829
55787
|
}
|
|
55830
55788
|
function createUniqueESSymbolType(symbol) {
|
|
55831
|
-
const type =
|
|
55832
|
-
type.symbol = symbol;
|
|
55789
|
+
const type = createTypeWithSymbol(8192 /* UniqueESSymbol */, symbol);
|
|
55833
55790
|
type.escapedName = `__@${type.symbol.escapedName}@${getSymbolId(type.symbol)}`;
|
|
55834
55791
|
return type;
|
|
55835
55792
|
}
|
|
@@ -57070,19 +57027,20 @@ ${lanes.join("\n")}
|
|
|
57070
57027
|
function isStringIndexSignatureOnlyType(type) {
|
|
57071
57028
|
return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 3145728 /* UnionOrIntersection */ && every(type.types, isStringIndexSignatureOnlyType) || false;
|
|
57072
57029
|
}
|
|
57073
|
-
function isEnumTypeRelatedTo(
|
|
57030
|
+
function isEnumTypeRelatedTo(source, target, errorReporter) {
|
|
57031
|
+
const sourceSymbol = source.flags & 8 /* EnumMember */ ? getParentOfSymbol(source) : source;
|
|
57032
|
+
const targetSymbol = target.flags & 8 /* EnumMember */ ? getParentOfSymbol(target) : target;
|
|
57074
57033
|
if (sourceSymbol === targetSymbol) {
|
|
57075
57034
|
return true;
|
|
57076
57035
|
}
|
|
57036
|
+
if (sourceSymbol.escapedName !== targetSymbol.escapedName || !(sourceSymbol.flags & 256 /* RegularEnum */) || !(targetSymbol.flags & 256 /* RegularEnum */)) {
|
|
57037
|
+
return false;
|
|
57038
|
+
}
|
|
57077
57039
|
const id = getSymbolId(sourceSymbol) + "," + getSymbolId(targetSymbol);
|
|
57078
57040
|
const entry = enumRelation.get(id);
|
|
57079
57041
|
if (entry !== void 0 && !(!(entry & 4 /* Reported */) && entry & 2 /* Failed */ && errorReporter)) {
|
|
57080
57042
|
return !!(entry & 1 /* Succeeded */);
|
|
57081
57043
|
}
|
|
57082
|
-
if (sourceSymbol.escapedName !== targetSymbol.escapedName || !(sourceSymbol.flags & 256 /* RegularEnum */) || !(targetSymbol.flags & 256 /* RegularEnum */)) {
|
|
57083
|
-
enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
|
|
57084
|
-
return false;
|
|
57085
|
-
}
|
|
57086
57044
|
const targetEnumType = getTypeOfSymbol(targetSymbol);
|
|
57087
57045
|
for (const property of getPropertiesOfType(getTypeOfSymbol(sourceSymbol))) {
|
|
57088
57046
|
if (property.flags & 8 /* EnumMember */) {
|
|
@@ -57126,12 +57084,12 @@ ${lanes.join("\n")}
|
|
|
57126
57084
|
return true;
|
|
57127
57085
|
if (s & 12288 /* ESSymbolLike */ && t & 4096 /* ESSymbol */)
|
|
57128
57086
|
return true;
|
|
57129
|
-
if (s & 32 /* Enum */ && t & 32 /* Enum */ && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter))
|
|
57087
|
+
if (s & 32 /* Enum */ && t & 32 /* Enum */ && source.symbol.escapedName === target.symbol.escapedName && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter))
|
|
57130
57088
|
return true;
|
|
57131
57089
|
if (s & 1024 /* EnumLiteral */ && t & 1024 /* EnumLiteral */) {
|
|
57132
57090
|
if (s & 1048576 /* Union */ && t & 1048576 /* Union */ && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter))
|
|
57133
57091
|
return true;
|
|
57134
|
-
if (s & 2944 /* Literal */ && t & 2944 /* Literal */ && source.value === target.value && isEnumTypeRelatedTo(
|
|
57092
|
+
if (s & 2944 /* Literal */ && t & 2944 /* Literal */ && source.value === target.value && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter))
|
|
57135
57093
|
return true;
|
|
57136
57094
|
}
|
|
57137
57095
|
if (s & 32768 /* Undefined */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & (32768 /* Undefined */ | 16384 /* Void */)))
|
|
@@ -58627,28 +58585,30 @@ ${lanes.join("\n")}
|
|
|
58627
58585
|
}
|
|
58628
58586
|
const sourceTypeArguments = getTypeArguments(source2);
|
|
58629
58587
|
const targetTypeArguments = getTypeArguments(target2);
|
|
58630
|
-
const
|
|
58631
|
-
const
|
|
58588
|
+
const targetStartCount = getStartElementCount(target2.target, 11 /* NonRest */);
|
|
58589
|
+
const targetEndCount = getEndElementCount(target2.target, 11 /* NonRest */);
|
|
58590
|
+
const targetHasRestElement = target2.target.hasRestElement;
|
|
58632
58591
|
let canExcludeDiscriminants = !!excludedProperties;
|
|
58633
|
-
for (let
|
|
58634
|
-
const
|
|
58635
|
-
const
|
|
58636
|
-
const
|
|
58592
|
+
for (let sourcePosition = 0; sourcePosition < sourceArity; sourcePosition++) {
|
|
58593
|
+
const sourceFlags = isTupleType(source2) ? source2.target.elementFlags[sourcePosition] : 4 /* Rest */;
|
|
58594
|
+
const sourcePositionFromEnd = sourceArity - 1 - sourcePosition;
|
|
58595
|
+
const targetPosition = targetHasRestElement && sourcePosition >= targetStartCount ? targetArity - 1 - Math.min(sourcePositionFromEnd, targetEndCount) : sourcePosition;
|
|
58596
|
+
const targetFlags = target2.target.elementFlags[targetPosition];
|
|
58637
58597
|
if (targetFlags & 8 /* Variadic */ && !(sourceFlags & 8 /* Variadic */)) {
|
|
58638
58598
|
if (reportErrors2) {
|
|
58639
|
-
reportError(Diagnostics.Source_provides_no_match_for_variadic_element_at_position_0_in_target,
|
|
58599
|
+
reportError(Diagnostics.Source_provides_no_match_for_variadic_element_at_position_0_in_target, targetPosition);
|
|
58640
58600
|
}
|
|
58641
58601
|
return 0 /* False */;
|
|
58642
58602
|
}
|
|
58643
58603
|
if (sourceFlags & 8 /* Variadic */ && !(targetFlags & 12 /* Variable */)) {
|
|
58644
58604
|
if (reportErrors2) {
|
|
58645
|
-
reportError(Diagnostics.Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target,
|
|
58605
|
+
reportError(Diagnostics.Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target, sourcePosition, targetPosition);
|
|
58646
58606
|
}
|
|
58647
58607
|
return 0 /* False */;
|
|
58648
58608
|
}
|
|
58649
58609
|
if (targetFlags & 1 /* Required */ && !(sourceFlags & 1 /* Required */)) {
|
|
58650
58610
|
if (reportErrors2) {
|
|
58651
|
-
reportError(Diagnostics.Source_provides_no_match_for_required_element_at_position_0_in_target,
|
|
58611
|
+
reportError(Diagnostics.Source_provides_no_match_for_required_element_at_position_0_in_target, targetPosition);
|
|
58652
58612
|
}
|
|
58653
58613
|
return 0 /* False */;
|
|
58654
58614
|
}
|
|
@@ -58656,20 +58616,20 @@ ${lanes.join("\n")}
|
|
|
58656
58616
|
if (sourceFlags & 12 /* Variable */ || targetFlags & 12 /* Variable */) {
|
|
58657
58617
|
canExcludeDiscriminants = false;
|
|
58658
58618
|
}
|
|
58659
|
-
if (canExcludeDiscriminants && (excludedProperties == null ? void 0 : excludedProperties.has("" +
|
|
58619
|
+
if (canExcludeDiscriminants && (excludedProperties == null ? void 0 : excludedProperties.has("" + sourcePosition))) {
|
|
58660
58620
|
continue;
|
|
58661
58621
|
}
|
|
58662
58622
|
}
|
|
58663
|
-
const sourceType =
|
|
58664
|
-
const targetType = targetTypeArguments[
|
|
58623
|
+
const sourceType = removeMissingType(sourceTypeArguments[sourcePosition], !!(sourceFlags & targetFlags & 2 /* Optional */));
|
|
58624
|
+
const targetType = targetTypeArguments[targetPosition];
|
|
58665
58625
|
const targetCheckType = sourceFlags & 8 /* Variadic */ && targetFlags & 4 /* Rest */ ? createArrayType(targetType) : removeMissingType(targetType, !!(targetFlags & 2 /* Optional */));
|
|
58666
58626
|
const related = isRelatedTo(sourceType, targetCheckType, 3 /* Both */, reportErrors2, void 0, intersectionState);
|
|
58667
58627
|
if (!related) {
|
|
58668
58628
|
if (reportErrors2 && (targetArity > 1 || sourceArity > 1)) {
|
|
58669
|
-
if (
|
|
58670
|
-
reportIncompatibleError(Diagnostics.
|
|
58629
|
+
if (targetHasRestElement && sourcePosition >= targetStartCount && sourcePositionFromEnd >= targetEndCount && targetStartCount !== sourceArity - targetEndCount - 1) {
|
|
58630
|
+
reportIncompatibleError(Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target, targetStartCount, sourceArity - targetEndCount - 1, targetPosition);
|
|
58671
58631
|
} else {
|
|
58672
|
-
reportIncompatibleError(Diagnostics.
|
|
58632
|
+
reportIncompatibleError(Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target, sourcePosition, targetPosition);
|
|
58673
58633
|
}
|
|
58674
58634
|
}
|
|
58675
58635
|
return 0 /* False */;
|
|
@@ -60249,10 +60209,7 @@ ${lanes.join("\n")}
|
|
|
60249
60209
|
return;
|
|
60250
60210
|
}
|
|
60251
60211
|
source = getUnionType(sources);
|
|
60252
|
-
} else if (target.flags & 2097152 /* Intersection */ &&
|
|
60253
|
-
target.types,
|
|
60254
|
-
(t) => !!getInferenceInfoForType(t) || isGenericMappedType(t) && !!getInferenceInfoForType(getHomomorphicTypeVariable(t) || neverType)
|
|
60255
|
-
)) {
|
|
60212
|
+
} else if (target.flags & 2097152 /* Intersection */ && !every(target.types, isNonGenericObjectType)) {
|
|
60256
60213
|
if (!(source.flags & 1048576 /* Union */)) {
|
|
60257
60214
|
const [sources, targets] = inferFromMatchingTypes(source.flags & 2097152 /* Intersection */ ? source.types : [source], target.types, isTypeIdenticalTo);
|
|
60258
60215
|
if (sources.length === 0 || targets.length === 0) {
|
|
@@ -67481,7 +67438,7 @@ ${lanes.join("\n")}
|
|
|
67481
67438
|
if (symbol && symbol.flags & 2097152 /* Alias */) {
|
|
67482
67439
|
symbol = resolveAlias(symbol);
|
|
67483
67440
|
}
|
|
67484
|
-
return !!(symbol && getAllSymbolFlags(symbol) & 384 /* Enum */
|
|
67441
|
+
return !!(symbol && getAllSymbolFlags(symbol) & 384 /* Enum */);
|
|
67485
67442
|
}
|
|
67486
67443
|
return false;
|
|
67487
67444
|
}
|
|
@@ -69406,7 +69363,7 @@ ${lanes.join("\n")}
|
|
|
69406
69363
|
}
|
|
69407
69364
|
}
|
|
69408
69365
|
function checkExpressionCached(node, checkMode) {
|
|
69409
|
-
if (checkMode
|
|
69366
|
+
if (checkMode) {
|
|
69410
69367
|
return checkExpression(node, checkMode);
|
|
69411
69368
|
}
|
|
69412
69369
|
const links = getNodeLinks(node);
|
|
@@ -70423,9 +70380,6 @@ ${lanes.join("\n")}
|
|
|
70423
70380
|
symbol.escapedName
|
|
70424
70381
|
);
|
|
70425
70382
|
}
|
|
70426
|
-
if (type.flags & 32 /* Enum */ && symbol.flags & 8 /* EnumMember */) {
|
|
70427
|
-
error(node, Diagnostics.Enum_type_0_has_members_with_initializers_that_are_not_literals, typeToString(type));
|
|
70428
|
-
}
|
|
70429
70383
|
}
|
|
70430
70384
|
}
|
|
70431
70385
|
}
|
|
@@ -73749,7 +73703,7 @@ ${lanes.join("\n")}
|
|
|
73749
73703
|
if (member.initializer) {
|
|
73750
73704
|
return computeConstantValue(member);
|
|
73751
73705
|
}
|
|
73752
|
-
if (member.parent.flags & 16777216 /* Ambient */ && !isEnumConst(member.parent)
|
|
73706
|
+
if (member.parent.flags & 16777216 /* Ambient */ && !isEnumConst(member.parent)) {
|
|
73753
73707
|
return void 0;
|
|
73754
73708
|
}
|
|
73755
73709
|
if (autoValue !== void 0) {
|
|
@@ -73759,134 +73713,140 @@ ${lanes.join("\n")}
|
|
|
73759
73713
|
return void 0;
|
|
73760
73714
|
}
|
|
73761
73715
|
function computeConstantValue(member) {
|
|
73762
|
-
const enumKind = getEnumKind(getSymbolOfNode(member.parent));
|
|
73763
73716
|
const isConstEnum = isEnumConst(member.parent);
|
|
73764
73717
|
const initializer = member.initializer;
|
|
73765
|
-
const value =
|
|
73718
|
+
const value = evaluate(initializer, member);
|
|
73766
73719
|
if (value !== void 0) {
|
|
73767
73720
|
if (isConstEnum && typeof value === "number" && !isFinite(value)) {
|
|
73768
73721
|
error(initializer, isNaN(value) ? Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value);
|
|
73769
73722
|
}
|
|
73770
|
-
} else if (enumKind === 1 /* Literal */) {
|
|
73771
|
-
error(initializer, Diagnostics.Computed_values_are_not_permitted_in_an_enum_with_string_valued_members);
|
|
73772
|
-
return 0;
|
|
73773
73723
|
} else if (isConstEnum) {
|
|
73774
|
-
error(initializer, Diagnostics.
|
|
73724
|
+
error(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
|
|
73775
73725
|
} else if (member.parent.flags & 16777216 /* Ambient */) {
|
|
73776
73726
|
error(initializer, Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
|
|
73777
73727
|
} else {
|
|
73778
|
-
|
|
73779
|
-
if (!isTypeAssignableToKind(source, 296 /* NumberLike */)) {
|
|
73780
|
-
error(initializer, Diagnostics.Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhaustiveness_checks_consider_using_an_object_literal_instead, typeToString(source));
|
|
73781
|
-
} else {
|
|
73782
|
-
checkTypeAssignableTo(source, getDeclaredTypeOfSymbol(getSymbolOfNode(member.parent)), initializer, void 0);
|
|
73783
|
-
}
|
|
73728
|
+
checkTypeAssignableTo(checkExpression(initializer), numberType, initializer, Diagnostics.Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values);
|
|
73784
73729
|
}
|
|
73785
73730
|
return value;
|
|
73786
|
-
|
|
73787
|
-
|
|
73788
|
-
|
|
73789
|
-
|
|
73790
|
-
|
|
73791
|
-
|
|
73792
|
-
|
|
73793
|
-
|
|
73794
|
-
|
|
73795
|
-
|
|
73796
|
-
|
|
73797
|
-
|
|
73798
|
-
|
|
73731
|
+
}
|
|
73732
|
+
function evaluate(expr, location2) {
|
|
73733
|
+
switch (expr.kind) {
|
|
73734
|
+
case 221 /* PrefixUnaryExpression */:
|
|
73735
|
+
const value = evaluate(expr.operand, location2);
|
|
73736
|
+
if (typeof value === "number") {
|
|
73737
|
+
switch (expr.operator) {
|
|
73738
|
+
case 39 /* PlusToken */:
|
|
73739
|
+
return value;
|
|
73740
|
+
case 40 /* MinusToken */:
|
|
73741
|
+
return -value;
|
|
73742
|
+
case 54 /* TildeToken */:
|
|
73743
|
+
return ~value;
|
|
73799
73744
|
}
|
|
73800
|
-
|
|
73801
|
-
|
|
73802
|
-
|
|
73803
|
-
|
|
73804
|
-
|
|
73805
|
-
|
|
73806
|
-
|
|
73807
|
-
|
|
73808
|
-
|
|
73809
|
-
|
|
73810
|
-
|
|
73811
|
-
|
|
73812
|
-
|
|
73813
|
-
|
|
73814
|
-
|
|
73815
|
-
|
|
73816
|
-
|
|
73817
|
-
|
|
73818
|
-
|
|
73819
|
-
|
|
73820
|
-
|
|
73821
|
-
|
|
73822
|
-
|
|
73823
|
-
|
|
73824
|
-
|
|
73825
|
-
|
|
73826
|
-
|
|
73827
|
-
|
|
73828
|
-
|
|
73829
|
-
|
|
73745
|
+
}
|
|
73746
|
+
break;
|
|
73747
|
+
case 223 /* BinaryExpression */:
|
|
73748
|
+
const left = evaluate(expr.left, location2);
|
|
73749
|
+
const right = evaluate(expr.right, location2);
|
|
73750
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
73751
|
+
switch (expr.operatorToken.kind) {
|
|
73752
|
+
case 51 /* BarToken */:
|
|
73753
|
+
return left | right;
|
|
73754
|
+
case 50 /* AmpersandToken */:
|
|
73755
|
+
return left & right;
|
|
73756
|
+
case 48 /* GreaterThanGreaterThanToken */:
|
|
73757
|
+
return left >> right;
|
|
73758
|
+
case 49 /* GreaterThanGreaterThanGreaterThanToken */:
|
|
73759
|
+
return left >>> right;
|
|
73760
|
+
case 47 /* LessThanLessThanToken */:
|
|
73761
|
+
return left << right;
|
|
73762
|
+
case 52 /* CaretToken */:
|
|
73763
|
+
return left ^ right;
|
|
73764
|
+
case 41 /* AsteriskToken */:
|
|
73765
|
+
return left * right;
|
|
73766
|
+
case 43 /* SlashToken */:
|
|
73767
|
+
return left / right;
|
|
73768
|
+
case 39 /* PlusToken */:
|
|
73769
|
+
return left + right;
|
|
73770
|
+
case 40 /* MinusToken */:
|
|
73771
|
+
return left - right;
|
|
73772
|
+
case 44 /* PercentToken */:
|
|
73773
|
+
return left % right;
|
|
73774
|
+
case 42 /* AsteriskAsteriskToken */:
|
|
73775
|
+
return left ** right;
|
|
73776
|
+
}
|
|
73777
|
+
} else if ((typeof left === "string" || typeof left === "number") && (typeof right === "string" || typeof right === "number") && expr.operatorToken.kind === 39 /* PlusToken */) {
|
|
73778
|
+
return "" + left + right;
|
|
73779
|
+
}
|
|
73780
|
+
break;
|
|
73781
|
+
case 10 /* StringLiteral */:
|
|
73782
|
+
case 14 /* NoSubstitutionTemplateLiteral */:
|
|
73783
|
+
return expr.text;
|
|
73784
|
+
case 225 /* TemplateExpression */:
|
|
73785
|
+
return evaluateTemplateExpression(expr, location2);
|
|
73786
|
+
case 8 /* NumericLiteral */:
|
|
73787
|
+
checkGrammarNumericLiteral(expr);
|
|
73788
|
+
return +expr.text;
|
|
73789
|
+
case 214 /* ParenthesizedExpression */:
|
|
73790
|
+
return evaluate(expr.expression, location2);
|
|
73791
|
+
case 79 /* Identifier */:
|
|
73792
|
+
if (isInfinityOrNaNString(expr.escapedText)) {
|
|
73793
|
+
return +expr.escapedText;
|
|
73794
|
+
}
|
|
73795
|
+
case 208 /* PropertyAccessExpression */:
|
|
73796
|
+
if (isEntityNameExpression(expr)) {
|
|
73797
|
+
const symbol = resolveEntityName(expr, 111551 /* Value */, true);
|
|
73798
|
+
if (symbol) {
|
|
73799
|
+
if (symbol.flags & 8 /* EnumMember */) {
|
|
73800
|
+
return evaluateEnumMember(expr, symbol, location2);
|
|
73830
73801
|
}
|
|
73831
|
-
|
|
73832
|
-
|
|
73833
|
-
|
|
73834
|
-
|
|
73835
|
-
case 10 /* StringLiteral */:
|
|
73836
|
-
case 14 /* NoSubstitutionTemplateLiteral */:
|
|
73837
|
-
return expr.text;
|
|
73838
|
-
case 8 /* NumericLiteral */:
|
|
73839
|
-
checkGrammarNumericLiteral(expr);
|
|
73840
|
-
return +expr.text;
|
|
73841
|
-
case 214 /* ParenthesizedExpression */:
|
|
73842
|
-
return evaluate(expr.expression);
|
|
73843
|
-
case 79 /* Identifier */:
|
|
73844
|
-
const identifier = expr;
|
|
73845
|
-
if (isInfinityOrNaNString(identifier.escapedText)) {
|
|
73846
|
-
return +identifier.escapedText;
|
|
73847
|
-
}
|
|
73848
|
-
return nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
|
|
73849
|
-
case 209 /* ElementAccessExpression */:
|
|
73850
|
-
case 208 /* PropertyAccessExpression */:
|
|
73851
|
-
if (isConstantMemberAccess(expr)) {
|
|
73852
|
-
const type = getTypeOfExpression(expr.expression);
|
|
73853
|
-
if (type.symbol && type.symbol.flags & 384 /* Enum */) {
|
|
73854
|
-
let name;
|
|
73855
|
-
if (expr.kind === 208 /* PropertyAccessExpression */) {
|
|
73856
|
-
name = expr.name.escapedText;
|
|
73857
|
-
} else {
|
|
73858
|
-
name = escapeLeadingUnderscores(cast(expr.argumentExpression, isLiteralExpression).text);
|
|
73802
|
+
if (isConstVariable(symbol)) {
|
|
73803
|
+
const declaration = symbol.valueDeclaration;
|
|
73804
|
+
if (declaration && !declaration.type && declaration.initializer && declaration !== location2 && isBlockScopedNameDeclaredBeforeUse(declaration, location2)) {
|
|
73805
|
+
return evaluate(declaration.initializer, declaration);
|
|
73859
73806
|
}
|
|
73860
|
-
return evaluateEnumMember(expr, type.symbol, name);
|
|
73861
73807
|
}
|
|
73862
73808
|
}
|
|
73863
|
-
|
|
73864
|
-
|
|
73865
|
-
|
|
73866
|
-
|
|
73867
|
-
|
|
73868
|
-
|
|
73869
|
-
|
|
73870
|
-
|
|
73871
|
-
|
|
73872
|
-
|
|
73873
|
-
|
|
73809
|
+
}
|
|
73810
|
+
break;
|
|
73811
|
+
case 209 /* ElementAccessExpression */:
|
|
73812
|
+
const root = expr.expression;
|
|
73813
|
+
if (isEntityNameExpression(root) && isStringLiteralLike(expr.argumentExpression)) {
|
|
73814
|
+
const rootSymbol = resolveEntityName(root, 111551 /* Value */, true);
|
|
73815
|
+
if (rootSymbol && rootSymbol.flags & 384 /* Enum */) {
|
|
73816
|
+
const name = escapeLeadingUnderscores(expr.argumentExpression.text);
|
|
73817
|
+
const member = rootSymbol.exports.get(name);
|
|
73818
|
+
if (member) {
|
|
73819
|
+
return evaluateEnumMember(expr, member, location2);
|
|
73820
|
+
}
|
|
73874
73821
|
}
|
|
73875
|
-
error(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
|
73876
|
-
return 0;
|
|
73877
|
-
} else {
|
|
73878
|
-
error(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(memberSymbol));
|
|
73879
73822
|
}
|
|
73880
|
-
|
|
73823
|
+
break;
|
|
73824
|
+
}
|
|
73825
|
+
return void 0;
|
|
73826
|
+
}
|
|
73827
|
+
function evaluateEnumMember(expr, symbol, location2) {
|
|
73828
|
+
const declaration = symbol.valueDeclaration;
|
|
73829
|
+
if (!declaration || declaration === location2) {
|
|
73830
|
+
error(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
73881
73831
|
return void 0;
|
|
73882
73832
|
}
|
|
73833
|
+
if (!isBlockScopedNameDeclaredBeforeUse(declaration, location2)) {
|
|
73834
|
+
error(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
|
73835
|
+
return 0;
|
|
73836
|
+
}
|
|
73837
|
+
return getEnumMemberValue(declaration);
|
|
73883
73838
|
}
|
|
73884
|
-
function
|
|
73885
|
-
|
|
73886
|
-
|
|
73887
|
-
|
|
73839
|
+
function evaluateTemplateExpression(expr, location2) {
|
|
73840
|
+
let result = expr.head.text;
|
|
73841
|
+
for (const span of expr.templateSpans) {
|
|
73842
|
+
const value = evaluate(span.expression, location2);
|
|
73843
|
+
if (value === void 0) {
|
|
73844
|
+
return void 0;
|
|
73845
|
+
}
|
|
73846
|
+
result += value;
|
|
73847
|
+
result += span.literal.text;
|
|
73888
73848
|
}
|
|
73889
|
-
return
|
|
73849
|
+
return result;
|
|
73890
73850
|
}
|
|
73891
73851
|
function checkEnumDeclaration(node) {
|
|
73892
73852
|
addLazyDiagnostic(() => checkEnumDeclarationWorker(node));
|
|
@@ -73932,6 +73892,9 @@ ${lanes.join("\n")}
|
|
|
73932
73892
|
if (isPrivateIdentifier(node.name)) {
|
|
73933
73893
|
error(node, Diagnostics.An_enum_member_cannot_be_named_with_a_private_identifier);
|
|
73934
73894
|
}
|
|
73895
|
+
if (node.initializer) {
|
|
73896
|
+
checkExpression(node.initializer);
|
|
73897
|
+
}
|
|
73935
73898
|
}
|
|
73936
73899
|
function getFirstNonAmbientClassOrFunctionDeclaration(symbol) {
|
|
73937
73900
|
const declarations = symbol.declarations;
|
|
@@ -97349,17 +97312,19 @@ ${lanes.join("\n")}
|
|
|
97349
97312
|
});
|
|
97350
97313
|
}
|
|
97351
97314
|
function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
|
|
97315
|
+
var _a2, _b;
|
|
97316
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Emit, "emitUsingBuildInfo", {}, true);
|
|
97317
|
+
ts_performance_exports.mark("beforeEmit");
|
|
97318
|
+
const result = emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers);
|
|
97319
|
+
ts_performance_exports.mark("afterEmit");
|
|
97320
|
+
ts_performance_exports.measure("Emit", "beforeEmit", "afterEmit");
|
|
97321
|
+
(_b = tracing) == null ? void 0 : _b.pop();
|
|
97322
|
+
return result;
|
|
97323
|
+
}
|
|
97324
|
+
function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers) {
|
|
97352
97325
|
const createHash = maybeBind(host, host.createHash);
|
|
97353
97326
|
const { buildInfoPath, jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath } = getOutputPathsForBundle(config.options, false);
|
|
97354
|
-
|
|
97355
|
-
if (host.getBuildInfo) {
|
|
97356
|
-
buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
|
|
97357
|
-
} else {
|
|
97358
|
-
const buildInfoText = host.readFile(buildInfoPath);
|
|
97359
|
-
if (!buildInfoText)
|
|
97360
|
-
return buildInfoPath;
|
|
97361
|
-
buildInfo = getBuildInfo(buildInfoPath, buildInfoText);
|
|
97362
|
-
}
|
|
97327
|
+
const buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
|
|
97363
97328
|
if (!buildInfo)
|
|
97364
97329
|
return buildInfoPath;
|
|
97365
97330
|
if (!buildInfo.bundle || !buildInfo.bundle.js || declarationFilePath && !buildInfo.bundle.dts)
|
|
@@ -97385,21 +97350,21 @@ ${lanes.join("\n")}
|
|
|
97385
97350
|
if (declarationMapPath && computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
|
|
97386
97351
|
return declarationMapPath;
|
|
97387
97352
|
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
97388
|
-
const ownPrependInput =
|
|
97353
|
+
const ownPrependInput = createInputFilesWithFileTexts(
|
|
97354
|
+
jsFilePath,
|
|
97389
97355
|
jsFileText,
|
|
97390
|
-
declarationText,
|
|
97391
97356
|
sourceMapFilePath,
|
|
97392
97357
|
sourceMapText,
|
|
97358
|
+
declarationFilePath,
|
|
97359
|
+
declarationText,
|
|
97393
97360
|
declarationMapPath,
|
|
97394
97361
|
declarationMapText,
|
|
97395
|
-
jsFilePath,
|
|
97396
|
-
declarationFilePath,
|
|
97397
97362
|
buildInfoPath,
|
|
97398
97363
|
buildInfo,
|
|
97399
97364
|
true
|
|
97400
97365
|
);
|
|
97401
97366
|
const outputFiles = [];
|
|
97402
|
-
const prependNodes = createPrependNodes(config.projectReferences, getCommandLine, (f) => host.readFile(f));
|
|
97367
|
+
const prependNodes = createPrependNodes(config.projectReferences, getCommandLine, (f) => host.readFile(f), host);
|
|
97403
97368
|
const sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
|
|
97404
97369
|
let changedDtsText;
|
|
97405
97370
|
let changedDtsData;
|
|
@@ -102073,14 +102038,12 @@ ${lanes.join("\n")}
|
|
|
102073
102038
|
function createCompilerHost(options, setParentNodes) {
|
|
102074
102039
|
return createCompilerHostWorker(options, setParentNodes);
|
|
102075
102040
|
}
|
|
102076
|
-
function
|
|
102077
|
-
|
|
102078
|
-
const getCanonicalFileName = createGetCanonicalFileName(system.useCaseSensitiveFileNames);
|
|
102079
|
-
function getSourceFile(fileName, languageVersionOrOptions, onError) {
|
|
102041
|
+
function createGetSourceFile(readFile, getCompilerOptions, setParentNodes) {
|
|
102042
|
+
return (fileName, languageVersionOrOptions, onError) => {
|
|
102080
102043
|
let text;
|
|
102081
102044
|
try {
|
|
102082
102045
|
mark("beforeIORead");
|
|
102083
|
-
text =
|
|
102046
|
+
text = readFile(fileName, getCompilerOptions().charset);
|
|
102084
102047
|
mark("afterIORead");
|
|
102085
102048
|
measure("I/O Read", "beforeIORead", "afterIORead");
|
|
102086
102049
|
} catch (e) {
|
|
@@ -102090,27 +102053,19 @@ ${lanes.join("\n")}
|
|
|
102090
102053
|
text = "";
|
|
102091
102054
|
}
|
|
102092
102055
|
return text !== void 0 ? createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes) : void 0;
|
|
102093
|
-
}
|
|
102094
|
-
|
|
102095
|
-
|
|
102096
|
-
|
|
102097
|
-
}
|
|
102098
|
-
if ((compilerHost.directoryExists || system.directoryExists)(directoryPath)) {
|
|
102099
|
-
existingDirectories.set(directoryPath, true);
|
|
102100
|
-
return true;
|
|
102101
|
-
}
|
|
102102
|
-
return false;
|
|
102103
|
-
}
|
|
102104
|
-
function writeFile2(fileName, data, writeByteOrderMark, onError) {
|
|
102056
|
+
};
|
|
102057
|
+
}
|
|
102058
|
+
function createWriteFileMeasuringIO(actualWriteFile, createDirectory, directoryExists) {
|
|
102059
|
+
return (fileName, data, writeByteOrderMark, onError) => {
|
|
102105
102060
|
try {
|
|
102106
102061
|
mark("beforeIOWrite");
|
|
102107
102062
|
writeFileEnsuringDirectories(
|
|
102108
102063
|
fileName,
|
|
102109
102064
|
data,
|
|
102110
102065
|
writeByteOrderMark,
|
|
102111
|
-
|
|
102112
|
-
|
|
102113
|
-
|
|
102066
|
+
actualWriteFile,
|
|
102067
|
+
createDirectory,
|
|
102068
|
+
directoryExists
|
|
102114
102069
|
);
|
|
102115
102070
|
mark("afterIOWrite");
|
|
102116
102071
|
measure("I/O Write", "beforeIOWrite", "afterIOWrite");
|
|
@@ -102119,6 +102074,20 @@ ${lanes.join("\n")}
|
|
|
102119
102074
|
onError(e.message);
|
|
102120
102075
|
}
|
|
102121
102076
|
}
|
|
102077
|
+
};
|
|
102078
|
+
}
|
|
102079
|
+
function createCompilerHostWorker(options, setParentNodes, system = sys) {
|
|
102080
|
+
const existingDirectories = new Map();
|
|
102081
|
+
const getCanonicalFileName = createGetCanonicalFileName(system.useCaseSensitiveFileNames);
|
|
102082
|
+
function directoryExists(directoryPath) {
|
|
102083
|
+
if (existingDirectories.has(directoryPath)) {
|
|
102084
|
+
return true;
|
|
102085
|
+
}
|
|
102086
|
+
if ((compilerHost.directoryExists || system.directoryExists)(directoryPath)) {
|
|
102087
|
+
existingDirectories.set(directoryPath, true);
|
|
102088
|
+
return true;
|
|
102089
|
+
}
|
|
102090
|
+
return false;
|
|
102122
102091
|
}
|
|
102123
102092
|
function getDefaultLibLocation() {
|
|
102124
102093
|
return getDirectoryPath(normalizePath(system.getExecutingFilePath()));
|
|
@@ -102126,10 +102095,14 @@ ${lanes.join("\n")}
|
|
|
102126
102095
|
const newLine = getNewLineCharacter(options, () => system.newLine);
|
|
102127
102096
|
const realpath = system.realpath && ((path) => system.realpath(path));
|
|
102128
102097
|
const compilerHost = {
|
|
102129
|
-
getSourceFile,
|
|
102098
|
+
getSourceFile: createGetSourceFile((fileName) => compilerHost.readFile(fileName), () => options, setParentNodes),
|
|
102130
102099
|
getDefaultLibLocation,
|
|
102131
102100
|
getDefaultLibFileName: (options2) => combinePaths(getDefaultLibLocation(), getDefaultLibFileName(options2)),
|
|
102132
|
-
writeFile:
|
|
102101
|
+
writeFile: createWriteFileMeasuringIO(
|
|
102102
|
+
(path, data, writeByteOrderMark) => system.writeFile(path, data, writeByteOrderMark),
|
|
102103
|
+
(path) => (compilerHost.createDirectory || system.createDirectory)(path),
|
|
102104
|
+
(path) => directoryExists(path)
|
|
102105
|
+
),
|
|
102133
102106
|
getCurrentDirectory: memoize(() => system.getCurrentDirectory()),
|
|
102134
102107
|
useCaseSensitiveFileNames: () => system.useCaseSensitiveFileNames,
|
|
102135
102108
|
getCanonicalFileName,
|
|
@@ -103500,7 +103473,8 @@ ${lanes.join("\n")}
|
|
|
103500
103473
|
const path = toPath3(fileName);
|
|
103501
103474
|
const sourceFile = getSourceFileByPath(path);
|
|
103502
103475
|
return sourceFile ? sourceFile.text : filesByName.has(path) ? void 0 : host.readFile(path);
|
|
103503
|
-
}
|
|
103476
|
+
},
|
|
103477
|
+
host
|
|
103504
103478
|
);
|
|
103505
103479
|
}
|
|
103506
103480
|
function isSourceFileFromExternalLibrary(file) {
|
|
@@ -105286,7 +105260,7 @@ ${lanes.join("\n")}
|
|
|
105286
105260
|
trace: host.trace ? (s) => host.trace(s) : void 0
|
|
105287
105261
|
};
|
|
105288
105262
|
}
|
|
105289
|
-
function createPrependNodes(projectReferences, getCommandLine, readFile) {
|
|
105263
|
+
function createPrependNodes(projectReferences, getCommandLine, readFile, host) {
|
|
105290
105264
|
if (!projectReferences)
|
|
105291
105265
|
return emptyArray;
|
|
105292
105266
|
let nodes;
|
|
@@ -105298,7 +105272,7 @@ ${lanes.join("\n")}
|
|
|
105298
105272
|
if (!out)
|
|
105299
105273
|
continue;
|
|
105300
105274
|
const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath } = getOutputPathsForBundle(resolvedRefOpts.options, true);
|
|
105301
|
-
const node =
|
|
105275
|
+
const node = createInputFilesWithFilePaths(readFile, jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath, host, resolvedRefOpts.options);
|
|
105302
105276
|
(nodes || (nodes = [])).push(node);
|
|
105303
105277
|
}
|
|
105304
105278
|
}
|
|
@@ -105500,7 +105474,8 @@ ${lanes.join("\n")}
|
|
|
105500
105474
|
function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
|
|
105501
105475
|
var _a2, _b, _c;
|
|
105502
105476
|
const fileInfos = new Map();
|
|
105503
|
-
const
|
|
105477
|
+
const options = newProgram.getCompilerOptions();
|
|
105478
|
+
const referencedMap = options.module !== 0 /* None */ && !outFile(options) ? createManyToManyPathMap() : void 0;
|
|
105504
105479
|
const exportedModulesMap = referencedMap ? createManyToManyPathMap() : void 0;
|
|
105505
105480
|
const useOldState = canReuseOldState(referencedMap, oldState);
|
|
105506
105481
|
newProgram.getTypeChecker();
|
|
@@ -105953,7 +105928,7 @@ ${lanes.join("\n")}
|
|
|
105953
105928
|
const seenEmittedFiles = state.seenEmittedFiles || (state.seenEmittedFiles = new Map());
|
|
105954
105929
|
for (let i = state.affectedFilesPendingEmitIndex; i < affectedFilesPendingEmit.length; i++) {
|
|
105955
105930
|
const affectedFile = Debug.checkDefined(state.program).getSourceFileByPath(affectedFilesPendingEmit[i]);
|
|
105956
|
-
if (affectedFile) {
|
|
105931
|
+
if (affectedFile && sourceFileMayBeEmitted(affectedFile, state.program)) {
|
|
105957
105932
|
const seenKind = seenEmittedFiles.get(affectedFile.resolvedPath);
|
|
105958
105933
|
const emitKind = Debug.checkDefined(Debug.checkDefined(state.affectedFilesPendingEmitKind).get(affectedFile.resolvedPath));
|
|
105959
105934
|
if (seenKind === void 0 || seenKind < emitKind) {
|
|
@@ -106258,6 +106233,9 @@ ${lanes.join("\n")}
|
|
|
106258
106233
|
const seenFiles = new Set();
|
|
106259
106234
|
for (const path of state.affectedFilesPendingEmit.slice(state.affectedFilesPendingEmitIndex).sort(compareStringsCaseSensitive)) {
|
|
106260
106235
|
if (tryAddToSet(seenFiles, path)) {
|
|
106236
|
+
const file = state.program.getSourceFileByPath(path);
|
|
106237
|
+
if (!sourceFileMayBeEmitted(file, state.program))
|
|
106238
|
+
continue;
|
|
106261
106239
|
const fileId = toFileId(path), emitKind = state.affectedFilesPendingEmitKind.get(path);
|
|
106262
106240
|
(affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push(
|
|
106263
106241
|
emitKind === 1 /* Full */ ? fileId : [fileId]
|
|
@@ -108043,24 +108021,18 @@ ${lanes.join("\n")}
|
|
|
108043
108021
|
const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
|
|
108044
108022
|
const hostGetNewLine = memoize(() => host.getNewLine());
|
|
108045
108023
|
return {
|
|
108046
|
-
getSourceFile: (
|
|
108047
|
-
|
|
108048
|
-
|
|
108049
|
-
|
|
108050
|
-
|
|
108051
|
-
mark("afterIORead");
|
|
108052
|
-
measure("I/O Read", "beforeIORead", "afterIORead");
|
|
108053
|
-
} catch (e) {
|
|
108054
|
-
if (onError) {
|
|
108055
|
-
onError(e.message);
|
|
108056
|
-
}
|
|
108057
|
-
text = "";
|
|
108058
|
-
}
|
|
108059
|
-
return text !== void 0 ? createSourceFile(fileName, text, languageVersionOrOptions) : void 0;
|
|
108060
|
-
},
|
|
108024
|
+
getSourceFile: createGetSourceFile(
|
|
108025
|
+
(fileName, encoding) => host.readFile(fileName, encoding),
|
|
108026
|
+
getCompilerOptions,
|
|
108027
|
+
void 0
|
|
108028
|
+
),
|
|
108061
108029
|
getDefaultLibLocation: maybeBind(host, host.getDefaultLibLocation),
|
|
108062
108030
|
getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
|
|
108063
|
-
writeFile:
|
|
108031
|
+
writeFile: createWriteFileMeasuringIO(
|
|
108032
|
+
(path, data, writeByteOrderMark) => host.writeFile(path, data, writeByteOrderMark),
|
|
108033
|
+
(path) => host.createDirectory(path),
|
|
108034
|
+
(path) => host.directoryExists(path)
|
|
108035
|
+
),
|
|
108064
108036
|
getCurrentDirectory: memoize(() => host.getCurrentDirectory()),
|
|
108065
108037
|
useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
|
|
108066
108038
|
getCanonicalFileName: createGetCanonicalFileName(useCaseSensitiveFileNames),
|
|
@@ -108077,25 +108049,6 @@ ${lanes.join("\n")}
|
|
|
108077
108049
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
108078
108050
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
108079
108051
|
};
|
|
108080
|
-
function writeFile2(fileName, text, writeByteOrderMark, onError) {
|
|
108081
|
-
try {
|
|
108082
|
-
mark("beforeIOWrite");
|
|
108083
|
-
writeFileEnsuringDirectories(
|
|
108084
|
-
fileName,
|
|
108085
|
-
text,
|
|
108086
|
-
writeByteOrderMark,
|
|
108087
|
-
(path, data, writeByteOrderMark2) => host.writeFile(path, data, writeByteOrderMark2),
|
|
108088
|
-
(path) => host.createDirectory(path),
|
|
108089
|
-
(path) => host.directoryExists(path)
|
|
108090
|
-
);
|
|
108091
|
-
mark("afterIOWrite");
|
|
108092
|
-
measure("I/O Write", "beforeIOWrite", "afterIOWrite");
|
|
108093
|
-
} catch (e) {
|
|
108094
|
-
if (onError) {
|
|
108095
|
-
onError(e.message);
|
|
108096
|
-
}
|
|
108097
|
-
}
|
|
108098
|
-
}
|
|
108099
108052
|
}
|
|
108100
108053
|
function setGetSourceFileAsHashVersioned(compilerHost, host) {
|
|
108101
108054
|
const originalGetSourceFile = compilerHost.getSourceFile;
|
|
@@ -109606,7 +109559,7 @@ ${lanes.join("\n")}
|
|
|
109606
109559
|
return emitDiagnostics;
|
|
109607
109560
|
}
|
|
109608
109561
|
function emitBundle(writeFileCallback, customTransformers) {
|
|
109609
|
-
var _a2, _b;
|
|
109562
|
+
var _a2, _b, _c, _d;
|
|
109610
109563
|
Debug.assert(kind === 1 /* UpdateBundle */);
|
|
109611
109564
|
if (state.options.dry) {
|
|
109612
109565
|
reportStatus(state, Diagnostics.A_non_dry_build_would_update_output_of_project_0, project);
|
|
@@ -109618,6 +109571,7 @@ ${lanes.join("\n")}
|
|
|
109618
109571
|
reportStatus(state, Diagnostics.Updating_output_of_project_0, project);
|
|
109619
109572
|
const { compilerHost } = state;
|
|
109620
109573
|
state.projectCompilerOptions = config.options;
|
|
109574
|
+
(_b = (_a2 = state.host).beforeEmitBundle) == null ? void 0 : _b.call(_a2, config);
|
|
109621
109575
|
const outputFiles = emitUsingBuildInfo(
|
|
109622
109576
|
config,
|
|
109623
109577
|
compilerHost,
|
|
@@ -109625,7 +109579,7 @@ ${lanes.join("\n")}
|
|
|
109625
109579
|
const refName = resolveProjectName(state, ref.path);
|
|
109626
109580
|
return parseConfigFile(state, refName, toResolvedConfigFilePath(state, refName));
|
|
109627
109581
|
},
|
|
109628
|
-
customTransformers || ((
|
|
109582
|
+
customTransformers || ((_d = (_c = state.host).getCustomTransformers) == null ? void 0 : _d.call(_c, project))
|
|
109629
109583
|
);
|
|
109630
109584
|
if (isString(outputFiles)) {
|
|
109631
109585
|
reportStatus(state, Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, project, relName(state, outputFiles));
|
|
@@ -111601,6 +111555,7 @@ ${lanes.join("\n")}
|
|
|
111601
111555
|
createFunctionTypeNode: () => createFunctionTypeNode,
|
|
111602
111556
|
createGetAccessor: () => createGetAccessor,
|
|
111603
111557
|
createGetCanonicalFileName: () => createGetCanonicalFileName,
|
|
111558
|
+
createGetSourceFile: () => createGetSourceFile,
|
|
111604
111559
|
createGetSymbolAccessibilityDiagnosticForNode: () => createGetSymbolAccessibilityDiagnosticForNode,
|
|
111605
111560
|
createGetSymbolAccessibilityDiagnosticForNodeName: () => createGetSymbolAccessibilityDiagnosticForNodeName,
|
|
111606
111561
|
createGetSymbolWalker: () => createGetSymbolWalker,
|
|
@@ -111620,6 +111575,8 @@ ${lanes.join("\n")}
|
|
|
111620
111575
|
createIndexedAccessTypeNode: () => createIndexedAccessTypeNode,
|
|
111621
111576
|
createInferTypeNode: () => createInferTypeNode,
|
|
111622
111577
|
createInputFiles: () => createInputFiles,
|
|
111578
|
+
createInputFilesWithFilePaths: () => createInputFilesWithFilePaths,
|
|
111579
|
+
createInputFilesWithFileTexts: () => createInputFilesWithFileTexts,
|
|
111623
111580
|
createInterfaceDeclaration: () => createInterfaceDeclaration,
|
|
111624
111581
|
createIntersectionTypeNode: () => createIntersectionTypeNode,
|
|
111625
111582
|
createJSDocAugmentsTag: () => createJSDocAugmentsTag,
|
|
@@ -111820,6 +111777,7 @@ ${lanes.join("\n")}
|
|
|
111820
111777
|
createWatchStatusReporter: () => createWatchStatusReporter,
|
|
111821
111778
|
createWhile: () => createWhile,
|
|
111822
111779
|
createWith: () => createWith,
|
|
111780
|
+
createWriteFileMeasuringIO: () => createWriteFileMeasuringIO,
|
|
111823
111781
|
createYield: () => createYield,
|
|
111824
111782
|
declarationNameToString: () => declarationNameToString,
|
|
111825
111783
|
decodeMappings: () => decodeMappings,
|
|
@@ -120777,7 +120735,7 @@ ${lanes.join("\n")}
|
|
|
120777
120735
|
return !!(this.flags & 3145728 /* UnionOrIntersection */);
|
|
120778
120736
|
}
|
|
120779
120737
|
isLiteral() {
|
|
120780
|
-
return !!(this.flags &
|
|
120738
|
+
return !!(this.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */ | 2048 /* BigIntLiteral */));
|
|
120781
120739
|
}
|
|
120782
120740
|
isStringLiteral() {
|
|
120783
120741
|
return !!(this.flags & 128 /* StringLiteral */);
|
|
@@ -160789,12 +160747,6 @@ ${e.message}`;
|
|
|
160789
160747
|
});
|
|
160790
160748
|
}
|
|
160791
160749
|
};
|
|
160792
|
-
var dynamicImport = async (_id) => {
|
|
160793
|
-
throw new Error("Dynamic import not implemented");
|
|
160794
|
-
};
|
|
160795
|
-
function setDynamicImport(fn) {
|
|
160796
|
-
dynamicImport = fn;
|
|
160797
|
-
}
|
|
160798
160750
|
function createWebSystem(host, args, getExecutingFilePath) {
|
|
160799
160751
|
const returnEmptyString = () => "";
|
|
160800
160752
|
const getExecutingDirectoryPath = memoize(() => memoize(() => ensureTrailingDirectorySeparator(getDirectoryPath(getExecutingFilePath()))));
|
|
@@ -160831,7 +160783,7 @@ ${e.message}`;
|
|
|
160831
160783
|
}
|
|
160832
160784
|
const scriptPath = combinePaths(packageRoot, browser);
|
|
160833
160785
|
try {
|
|
160834
|
-
const { default: module2 } = await
|
|
160786
|
+
const { default: module2 } = await import(scriptPath);
|
|
160835
160787
|
return { module: module2, error: void 0 };
|
|
160836
160788
|
} catch (e) {
|
|
160837
160789
|
return { module: void 0, error: e };
|