@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/tsserverlibrary.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,
|
|
@@ -2534,7 +2538,7 @@ var ts = (() => {
|
|
|
2534
2538
|
|
|
2535
2539
|
// src/compiler/corePublic.ts
|
|
2536
2540
|
var versionMajorMinor = "5.0";
|
|
2537
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2541
|
+
var version = `${versionMajorMinor}.0-insiders.20221107`;
|
|
2538
2542
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2539
2543
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2540
2544
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4931,6 +4935,7 @@ m2: ${this.mapper2.__debugToString().split("\n").join("\n ")}`;
|
|
|
4931
4935
|
})(BoxCharacter || (BoxCharacter = {}));
|
|
4932
4936
|
let Connection;
|
|
4933
4937
|
((Connection2) => {
|
|
4938
|
+
Connection2[Connection2["None"] = 0] = "None";
|
|
4934
4939
|
Connection2[Connection2["Up"] = 1] = "Up";
|
|
4935
4940
|
Connection2[Connection2["Down"] = 2] = "Down";
|
|
4936
4941
|
Connection2[Connection2["Left"] = 4] = "Left";
|
|
@@ -9966,7 +9971,7 @@ ${lanes.join("\n")}
|
|
|
9966
9971
|
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'."),
|
|
9967
9972
|
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."),
|
|
9968
9973
|
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."),
|
|
9969
|
-
|
|
9974
|
+
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."),
|
|
9970
9975
|
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."),
|
|
9971
9976
|
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."),
|
|
9972
9977
|
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."),
|
|
@@ -10022,7 +10027,6 @@ ${lanes.join("\n")}
|
|
|
10022
10027
|
Object_is_possibly_undefined: diag(2532, 1 /* Error */, "Object_is_possibly_undefined_2532", "Object is possibly 'undefined'."),
|
|
10023
10028
|
Object_is_possibly_null_or_undefined: diag(2533, 1 /* Error */, "Object_is_possibly_null_or_undefined_2533", "Object is possibly 'null' or 'undefined'."),
|
|
10024
10029
|
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."),
|
|
10025
|
-
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."),
|
|
10026
10030
|
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}'."),
|
|
10027
10031
|
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}'."),
|
|
10028
10032
|
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."),
|
|
@@ -11265,7 +11269,7 @@ ${lanes.join("\n")}
|
|
|
11265
11269
|
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."),
|
|
11266
11270
|
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."),
|
|
11267
11271
|
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."),
|
|
11268
|
-
|
|
11272
|
+
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."),
|
|
11269
11273
|
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'."),
|
|
11270
11274
|
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."),
|
|
11271
11275
|
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."),
|
|
@@ -24788,69 +24792,83 @@ ${lanes.join("\n")}
|
|
|
24788
24792
|
node.helpers = map(bundleFileInfo.sources && bundleFileInfo.sources.helpers, (name) => getAllUnscopedEmitHelpers().get(name));
|
|
24789
24793
|
return node;
|
|
24790
24794
|
}
|
|
24791
|
-
function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath
|
|
24795
|
+
function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath) {
|
|
24796
|
+
return !isString(javascriptTextOrReadFileText) ? createInputFilesWithFilePaths(
|
|
24797
|
+
javascriptTextOrReadFileText,
|
|
24798
|
+
declarationTextOrJavascriptPath,
|
|
24799
|
+
javascriptMapPath,
|
|
24800
|
+
javascriptMapTextOrDeclarationPath,
|
|
24801
|
+
declarationMapPath,
|
|
24802
|
+
declarationMapTextOrBuildInfoPath
|
|
24803
|
+
) : createInputFilesWithFileTexts(
|
|
24804
|
+
void 0,
|
|
24805
|
+
javascriptTextOrReadFileText,
|
|
24806
|
+
javascriptMapPath,
|
|
24807
|
+
javascriptMapTextOrDeclarationPath,
|
|
24808
|
+
void 0,
|
|
24809
|
+
declarationTextOrJavascriptPath,
|
|
24810
|
+
declarationMapPath,
|
|
24811
|
+
declarationMapTextOrBuildInfoPath
|
|
24812
|
+
);
|
|
24813
|
+
}
|
|
24814
|
+
function createInputFilesWithFilePaths(readFileText, javascriptPath, javascriptMapPath, declarationPath, declarationMapPath, buildInfoPath, host, options) {
|
|
24792
24815
|
const node = parseNodeFactory.createInputFiles();
|
|
24793
|
-
|
|
24794
|
-
|
|
24795
|
-
|
|
24796
|
-
|
|
24797
|
-
|
|
24798
|
-
|
|
24799
|
-
|
|
24800
|
-
|
|
24801
|
-
|
|
24802
|
-
|
|
24803
|
-
|
|
24804
|
-
|
|
24805
|
-
|
|
24806
|
-
|
|
24807
|
-
|
|
24816
|
+
node.javascriptPath = javascriptPath;
|
|
24817
|
+
node.javascriptMapPath = javascriptMapPath;
|
|
24818
|
+
node.declarationPath = declarationPath;
|
|
24819
|
+
node.declarationMapPath = declarationMapPath;
|
|
24820
|
+
node.buildInfoPath = buildInfoPath;
|
|
24821
|
+
const cache = new Map();
|
|
24822
|
+
const textGetter = (path) => {
|
|
24823
|
+
if (path === void 0)
|
|
24824
|
+
return void 0;
|
|
24825
|
+
let value = cache.get(path);
|
|
24826
|
+
if (value === void 0) {
|
|
24827
|
+
value = readFileText(path);
|
|
24828
|
+
cache.set(path, value !== void 0 ? value : false);
|
|
24829
|
+
}
|
|
24830
|
+
return value !== false ? value : void 0;
|
|
24831
|
+
};
|
|
24832
|
+
const definedTextGetter = (path) => {
|
|
24833
|
+
const result = textGetter(path);
|
|
24834
|
+
return result !== void 0 ? result : `/* Input file ${path} was missing */\r
|
|
24808
24835
|
`;
|
|
24809
|
-
|
|
24810
|
-
|
|
24811
|
-
|
|
24812
|
-
|
|
24813
|
-
|
|
24814
|
-
|
|
24815
|
-
|
|
24836
|
+
};
|
|
24837
|
+
let buildInfo;
|
|
24838
|
+
const getAndCacheBuildInfo = () => {
|
|
24839
|
+
var _a2, _b;
|
|
24840
|
+
if (buildInfo === void 0 && buildInfoPath) {
|
|
24841
|
+
if (host == null ? void 0 : host.getBuildInfo) {
|
|
24842
|
+
buildInfo = (_a2 = host.getBuildInfo(buildInfoPath, options.configFilePath)) != null ? _a2 : false;
|
|
24843
|
+
} else {
|
|
24844
|
+
const result = textGetter(buildInfoPath);
|
|
24845
|
+
buildInfo = result !== void 0 ? (_b = getBuildInfo(buildInfoPath, result)) != null ? _b : false : false;
|
|
24816
24846
|
}
|
|
24817
|
-
|
|
24818
|
-
|
|
24819
|
-
|
|
24820
|
-
|
|
24821
|
-
|
|
24822
|
-
|
|
24823
|
-
|
|
24824
|
-
|
|
24825
|
-
|
|
24826
|
-
|
|
24827
|
-
|
|
24828
|
-
|
|
24829
|
-
|
|
24830
|
-
|
|
24831
|
-
|
|
24832
|
-
|
|
24833
|
-
|
|
24834
|
-
|
|
24835
|
-
|
|
24836
|
-
|
|
24837
|
-
|
|
24838
|
-
|
|
24839
|
-
|
|
24840
|
-
|
|
24841
|
-
|
|
24842
|
-
node.javascriptText = javascriptTextOrReadFileText;
|
|
24843
|
-
node.javascriptMapPath = javascriptMapPath;
|
|
24844
|
-
node.javascriptMapText = javascriptMapTextOrDeclarationPath;
|
|
24845
|
-
node.declarationText = declarationTextOrJavascriptPath;
|
|
24846
|
-
node.declarationMapPath = declarationMapPath;
|
|
24847
|
-
node.declarationMapText = declarationMapTextOrBuildInfoPath;
|
|
24848
|
-
node.javascriptPath = javascriptPath;
|
|
24849
|
-
node.declarationPath = declarationPath;
|
|
24850
|
-
node.buildInfoPath = buildInfoPath;
|
|
24851
|
-
node.buildInfo = buildInfo;
|
|
24852
|
-
node.oldFileOfCurrentEmit = oldFileOfCurrentEmit;
|
|
24853
|
-
}
|
|
24847
|
+
}
|
|
24848
|
+
return buildInfo || void 0;
|
|
24849
|
+
};
|
|
24850
|
+
Object.defineProperties(node, {
|
|
24851
|
+
javascriptText: { get: () => definedTextGetter(javascriptPath) },
|
|
24852
|
+
javascriptMapText: { get: () => textGetter(javascriptMapPath) },
|
|
24853
|
+
declarationText: { get: () => definedTextGetter(Debug.checkDefined(declarationPath)) },
|
|
24854
|
+
declarationMapText: { get: () => textGetter(declarationMapPath) },
|
|
24855
|
+
buildInfo: { get: getAndCacheBuildInfo }
|
|
24856
|
+
});
|
|
24857
|
+
return node;
|
|
24858
|
+
}
|
|
24859
|
+
function createInputFilesWithFileTexts(javascriptPath, javascriptText, javascriptMapPath, javascriptMapText, declarationPath, declarationText, declarationMapPath, declarationMapText, buildInfoPath, buildInfo, oldFileOfCurrentEmit) {
|
|
24860
|
+
const node = parseNodeFactory.createInputFiles();
|
|
24861
|
+
node.javascriptPath = javascriptPath;
|
|
24862
|
+
node.javascriptText = javascriptText;
|
|
24863
|
+
node.javascriptMapPath = javascriptMapPath;
|
|
24864
|
+
node.javascriptMapText = javascriptMapText;
|
|
24865
|
+
node.declarationPath = declarationPath;
|
|
24866
|
+
node.declarationText = declarationText;
|
|
24867
|
+
node.declarationMapPath = declarationMapPath;
|
|
24868
|
+
node.declarationMapText = declarationMapText;
|
|
24869
|
+
node.buildInfoPath = buildInfoPath;
|
|
24870
|
+
node.buildInfo = buildInfo;
|
|
24871
|
+
node.oldFileOfCurrentEmit = oldFileOfCurrentEmit;
|
|
24854
24872
|
return node;
|
|
24855
24873
|
}
|
|
24856
24874
|
var SourceMapSource2;
|
|
@@ -42892,7 +42910,6 @@ ${lanes.join("\n")}
|
|
|
42892
42910
|
const Signature15 = objectAllocator.getSignatureConstructor();
|
|
42893
42911
|
let typeCount = 0;
|
|
42894
42912
|
let symbolCount = 0;
|
|
42895
|
-
let enumCount = 0;
|
|
42896
42913
|
let totalInstantiationCount = 0;
|
|
42897
42914
|
let instantiationCount = 0;
|
|
42898
42915
|
let instantiationDepth = 0;
|
|
@@ -44723,7 +44740,7 @@ ${lanes.join("\n")}
|
|
|
44723
44740
|
}
|
|
44724
44741
|
}
|
|
44725
44742
|
function isSameScopeDescendentOf(initial, parent2, stopAt) {
|
|
44726
|
-
return !!parent2 && !!findAncestor(initial, (n) => n === parent2 || (n === stopAt || isFunctionLike(n) && !getImmediatelyInvokedFunctionExpression(n) ? "quit" : false));
|
|
44743
|
+
return !!parent2 && !!findAncestor(initial, (n) => n === parent2 || (n === stopAt || isFunctionLike(n) && (!getImmediatelyInvokedFunctionExpression(n) || isAsyncFunction(n)) ? "quit" : false));
|
|
44727
44744
|
}
|
|
44728
44745
|
function getAnyImportSyntax(node) {
|
|
44729
44746
|
switch (node.kind) {
|
|
@@ -45996,6 +46013,11 @@ ${lanes.join("\n")}
|
|
|
45996
46013
|
(_a2 = tracing) == null ? void 0 : _a2.recordType(result);
|
|
45997
46014
|
return result;
|
|
45998
46015
|
}
|
|
46016
|
+
function createTypeWithSymbol(flags, symbol) {
|
|
46017
|
+
const result = createType(flags);
|
|
46018
|
+
result.symbol = symbol;
|
|
46019
|
+
return result;
|
|
46020
|
+
}
|
|
45999
46021
|
function createOriginType(flags) {
|
|
46000
46022
|
return new Type27(checker, flags);
|
|
46001
46023
|
}
|
|
@@ -46006,9 +46028,8 @@ ${lanes.join("\n")}
|
|
|
46006
46028
|
return type;
|
|
46007
46029
|
}
|
|
46008
46030
|
function createObjectType(objectFlags, symbol) {
|
|
46009
|
-
const type =
|
|
46031
|
+
const type = createTypeWithSymbol(524288 /* Object */, symbol);
|
|
46010
46032
|
type.objectFlags = objectFlags;
|
|
46011
|
-
type.symbol = symbol;
|
|
46012
46033
|
type.members = void 0;
|
|
46013
46034
|
type.properties = void 0;
|
|
46014
46035
|
type.callSignatures = void 0;
|
|
@@ -46020,10 +46041,7 @@ ${lanes.join("\n")}
|
|
|
46020
46041
|
return getUnionType(arrayFrom(typeofNEFacts.keys(), getStringLiteralType));
|
|
46021
46042
|
}
|
|
46022
46043
|
function createTypeParameter(symbol) {
|
|
46023
|
-
|
|
46024
|
-
if (symbol)
|
|
46025
|
-
type.symbol = symbol;
|
|
46026
|
-
return type;
|
|
46044
|
+
return createTypeWithSymbol(262144 /* TypeParameter */, symbol);
|
|
46027
46045
|
}
|
|
46028
46046
|
function isReservedMemberName(name) {
|
|
46029
46047
|
return name.charCodeAt(0) === 95 /* _ */ && name.charCodeAt(1) === 95 /* _ */ && name.charCodeAt(2) !== 95 /* _ */ && name.charCodeAt(2) !== 64 /* at */ && name.charCodeAt(2) !== 35 /* hash */;
|
|
@@ -46614,29 +46632,29 @@ ${lanes.join("\n")}
|
|
|
46614
46632
|
context.approximateLength += 7;
|
|
46615
46633
|
return factory.createKeywordTypeNode(134 /* BooleanKeyword */);
|
|
46616
46634
|
}
|
|
46617
|
-
if (type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */)) {
|
|
46618
|
-
const parentSymbol = getParentOfSymbol(type.symbol);
|
|
46619
|
-
const parentName = symbolToTypeNode(parentSymbol, context, 788968 /* Type */);
|
|
46620
|
-
if (getDeclaredTypeOfSymbol(parentSymbol) === type) {
|
|
46621
|
-
return parentName;
|
|
46622
|
-
}
|
|
46623
|
-
const memberName = symbolName(type.symbol);
|
|
46624
|
-
if (isIdentifierText(memberName, 0 /* ES3 */)) {
|
|
46625
|
-
return appendReferenceToType(
|
|
46626
|
-
parentName,
|
|
46627
|
-
factory.createTypeReferenceNode(memberName, void 0)
|
|
46628
|
-
);
|
|
46629
|
-
}
|
|
46630
|
-
if (isImportTypeNode(parentName)) {
|
|
46631
|
-
parentName.isTypeOf = true;
|
|
46632
|
-
return factory.createIndexedAccessTypeNode(parentName, factory.createLiteralTypeNode(factory.createStringLiteral(memberName)));
|
|
46633
|
-
} else if (isTypeReferenceNode(parentName)) {
|
|
46634
|
-
return factory.createIndexedAccessTypeNode(factory.createTypeQueryNode(parentName.typeName), factory.createLiteralTypeNode(factory.createStringLiteral(memberName)));
|
|
46635
|
-
} else {
|
|
46636
|
-
return Debug.fail("Unhandled type node kind returned from `symbolToTypeNode`.");
|
|
46637
|
-
}
|
|
46638
|
-
}
|
|
46639
46635
|
if (type.flags & 1056 /* EnumLike */) {
|
|
46636
|
+
if (type.symbol.flags & 8 /* EnumMember */) {
|
|
46637
|
+
const parentSymbol = getParentOfSymbol(type.symbol);
|
|
46638
|
+
const parentName = symbolToTypeNode(parentSymbol, context, 788968 /* Type */);
|
|
46639
|
+
if (getDeclaredTypeOfSymbol(parentSymbol) === type) {
|
|
46640
|
+
return parentName;
|
|
46641
|
+
}
|
|
46642
|
+
const memberName = symbolName(type.symbol);
|
|
46643
|
+
if (isIdentifierText(memberName, 0 /* ES3 */)) {
|
|
46644
|
+
return appendReferenceToType(
|
|
46645
|
+
parentName,
|
|
46646
|
+
factory.createTypeReferenceNode(memberName, void 0)
|
|
46647
|
+
);
|
|
46648
|
+
}
|
|
46649
|
+
if (isImportTypeNode(parentName)) {
|
|
46650
|
+
parentName.isTypeOf = true;
|
|
46651
|
+
return factory.createIndexedAccessTypeNode(parentName, factory.createLiteralTypeNode(factory.createStringLiteral(memberName)));
|
|
46652
|
+
} else if (isTypeReferenceNode(parentName)) {
|
|
46653
|
+
return factory.createIndexedAccessTypeNode(factory.createTypeQueryNode(parentName.typeName), factory.createLiteralTypeNode(factory.createStringLiteral(memberName)));
|
|
46654
|
+
} else {
|
|
46655
|
+
return Debug.fail("Unhandled type node kind returned from `symbolToTypeNode`.");
|
|
46656
|
+
}
|
|
46657
|
+
}
|
|
46640
46658
|
return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
|
|
46641
46659
|
}
|
|
46642
46660
|
if (type.flags & 128 /* StringLiteral */) {
|
|
@@ -50975,91 +50993,36 @@ ${lanes.join("\n")}
|
|
|
50975
50993
|
}
|
|
50976
50994
|
return links.declaredType;
|
|
50977
50995
|
}
|
|
50978
|
-
function isStringConcatExpression(expr) {
|
|
50979
|
-
if (isStringLiteralLike(expr)) {
|
|
50980
|
-
return true;
|
|
50981
|
-
} else if (expr.kind === 223 /* BinaryExpression */) {
|
|
50982
|
-
return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right);
|
|
50983
|
-
}
|
|
50984
|
-
return false;
|
|
50985
|
-
}
|
|
50986
|
-
function isLiteralEnumMember(member) {
|
|
50987
|
-
const expr = member.initializer;
|
|
50988
|
-
if (!expr) {
|
|
50989
|
-
return !(member.flags & 16777216 /* Ambient */);
|
|
50990
|
-
}
|
|
50991
|
-
switch (expr.kind) {
|
|
50992
|
-
case 10 /* StringLiteral */:
|
|
50993
|
-
case 8 /* NumericLiteral */:
|
|
50994
|
-
case 14 /* NoSubstitutionTemplateLiteral */:
|
|
50995
|
-
return true;
|
|
50996
|
-
case 221 /* PrefixUnaryExpression */:
|
|
50997
|
-
return expr.operator === 40 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */;
|
|
50998
|
-
case 79 /* Identifier */:
|
|
50999
|
-
return nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText);
|
|
51000
|
-
case 223 /* BinaryExpression */:
|
|
51001
|
-
return isStringConcatExpression(expr);
|
|
51002
|
-
default:
|
|
51003
|
-
return false;
|
|
51004
|
-
}
|
|
51005
|
-
}
|
|
51006
|
-
function getEnumKind(symbol) {
|
|
51007
|
-
const links = getSymbolLinks(symbol);
|
|
51008
|
-
if (links.enumKind !== void 0) {
|
|
51009
|
-
return links.enumKind;
|
|
51010
|
-
}
|
|
51011
|
-
let hasNonLiteralMember = false;
|
|
51012
|
-
if (symbol.declarations) {
|
|
51013
|
-
for (const declaration of symbol.declarations) {
|
|
51014
|
-
if (declaration.kind === 263 /* EnumDeclaration */) {
|
|
51015
|
-
for (const member of declaration.members) {
|
|
51016
|
-
if (member.initializer && isStringLiteralLike(member.initializer)) {
|
|
51017
|
-
return links.enumKind = 1 /* Literal */;
|
|
51018
|
-
}
|
|
51019
|
-
if (!isLiteralEnumMember(member)) {
|
|
51020
|
-
hasNonLiteralMember = true;
|
|
51021
|
-
}
|
|
51022
|
-
}
|
|
51023
|
-
}
|
|
51024
|
-
}
|
|
51025
|
-
}
|
|
51026
|
-
return links.enumKind = hasNonLiteralMember ? 0 /* Numeric */ : 1 /* Literal */;
|
|
51027
|
-
}
|
|
51028
50996
|
function getBaseTypeOfEnumLiteralType(type) {
|
|
51029
50997
|
return type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */) ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
|
|
51030
50998
|
}
|
|
51031
50999
|
function getDeclaredTypeOfEnum(symbol) {
|
|
51032
51000
|
const links = getSymbolLinks(symbol);
|
|
51033
|
-
if (links.declaredType) {
|
|
51034
|
-
return links.declaredType;
|
|
51035
|
-
}
|
|
51036
|
-
if (getEnumKind(symbol) === 1 /* Literal */) {
|
|
51037
|
-
enumCount++;
|
|
51001
|
+
if (!links.declaredType) {
|
|
51038
51002
|
const memberTypeList = [];
|
|
51039
51003
|
if (symbol.declarations) {
|
|
51040
51004
|
for (const declaration of symbol.declarations) {
|
|
51041
51005
|
if (declaration.kind === 263 /* EnumDeclaration */) {
|
|
51042
51006
|
for (const member of declaration.members) {
|
|
51043
|
-
|
|
51044
|
-
|
|
51045
|
-
|
|
51046
|
-
|
|
51007
|
+
if (hasBindableName(member)) {
|
|
51008
|
+
const memberSymbol = getSymbolOfNode(member);
|
|
51009
|
+
const value = getEnumMemberValue(member);
|
|
51010
|
+
const memberType = value !== void 0 ? getFreshTypeOfLiteralType(getEnumLiteralType(value, getSymbolId(symbol), memberSymbol)) : createTypeWithSymbol(32 /* Enum */, memberSymbol);
|
|
51011
|
+
getSymbolLinks(memberSymbol).declaredType = memberType;
|
|
51012
|
+
memberTypeList.push(getRegularTypeOfLiteralType(memberType));
|
|
51013
|
+
}
|
|
51047
51014
|
}
|
|
51048
51015
|
}
|
|
51049
51016
|
}
|
|
51050
51017
|
}
|
|
51051
|
-
|
|
51052
|
-
|
|
51053
|
-
|
|
51054
|
-
|
|
51055
|
-
enumType2.symbol = symbol;
|
|
51056
|
-
}
|
|
51057
|
-
return links.declaredType = enumType2;
|
|
51018
|
+
const enumType = memberTypeList.length ? getUnionType(memberTypeList, 1 /* Literal */, symbol, void 0) : createTypeWithSymbol(32 /* Enum */, symbol);
|
|
51019
|
+
if (enumType.flags & 1048576 /* Union */) {
|
|
51020
|
+
enumType.flags |= 1024 /* EnumLiteral */;
|
|
51021
|
+
enumType.symbol = symbol;
|
|
51058
51022
|
}
|
|
51023
|
+
links.declaredType = enumType;
|
|
51059
51024
|
}
|
|
51060
|
-
|
|
51061
|
-
enumType.symbol = symbol;
|
|
51062
|
-
return links.declaredType = enumType;
|
|
51025
|
+
return links.declaredType;
|
|
51063
51026
|
}
|
|
51064
51027
|
function getDeclaredTypeOfEnumMember(symbol) {
|
|
51065
51028
|
const links = getSymbolLinks(symbol);
|
|
@@ -53311,8 +53274,7 @@ ${lanes.join("\n")}
|
|
|
53311
53274
|
return type;
|
|
53312
53275
|
}
|
|
53313
53276
|
function cloneTypeReference(source) {
|
|
53314
|
-
const type =
|
|
53315
|
-
type.symbol = source.symbol;
|
|
53277
|
+
const type = createTypeWithSymbol(source.flags, source.symbol);
|
|
53316
53278
|
type.objectFlags = source.objectFlags;
|
|
53317
53279
|
type.target = source.target;
|
|
53318
53280
|
type.resolvedTypeArguments = source.resolvedTypeArguments;
|
|
@@ -54860,8 +54822,7 @@ ${lanes.join("\n")}
|
|
|
54860
54822
|
return result;
|
|
54861
54823
|
}
|
|
54862
54824
|
function createStringMappingType(symbol, type) {
|
|
54863
|
-
const result =
|
|
54864
|
-
result.symbol = symbol;
|
|
54825
|
+
const result = createTypeWithSymbol(268435456 /* StringMapping */, symbol);
|
|
54865
54826
|
result.type = type;
|
|
54866
54827
|
return result;
|
|
54867
54828
|
}
|
|
@@ -55675,8 +55636,7 @@ ${lanes.join("\n")}
|
|
|
55675
55636
|
return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration) : info;
|
|
55676
55637
|
}
|
|
55677
55638
|
function createLiteralType(flags, value, symbol, regularType) {
|
|
55678
|
-
const type =
|
|
55679
|
-
type.symbol = symbol;
|
|
55639
|
+
const type = createTypeWithSymbol(flags, symbol);
|
|
55680
55640
|
type.value = value;
|
|
55681
55641
|
type.regularType = regularType || type;
|
|
55682
55642
|
return type;
|
|
@@ -55713,8 +55673,7 @@ ${lanes.join("\n")}
|
|
|
55713
55673
|
}
|
|
55714
55674
|
function getEnumLiteralType(value, enumId, symbol) {
|
|
55715
55675
|
let type;
|
|
55716
|
-
const
|
|
55717
|
-
const key = enumId + qualifier + value;
|
|
55676
|
+
const key = `${enumId}${typeof value === "string" ? "@" : "#"}${value}`;
|
|
55718
55677
|
const flags = 1024 /* EnumLiteral */ | (typeof value === "string" ? 128 /* StringLiteral */ : 256 /* NumberLiteral */);
|
|
55719
55678
|
return enumLiteralTypes.get(key) || (enumLiteralTypes.set(key, type = createLiteralType(flags, value, symbol)), type);
|
|
55720
55679
|
}
|
|
@@ -55729,8 +55688,7 @@ ${lanes.join("\n")}
|
|
|
55729
55688
|
return links.resolvedType;
|
|
55730
55689
|
}
|
|
55731
55690
|
function createUniqueESSymbolType(symbol) {
|
|
55732
|
-
const type =
|
|
55733
|
-
type.symbol = symbol;
|
|
55691
|
+
const type = createTypeWithSymbol(8192 /* UniqueESSymbol */, symbol);
|
|
55734
55692
|
type.escapedName = `__@${type.symbol.escapedName}@${getSymbolId(type.symbol)}`;
|
|
55735
55693
|
return type;
|
|
55736
55694
|
}
|
|
@@ -56971,19 +56929,20 @@ ${lanes.join("\n")}
|
|
|
56971
56929
|
function isStringIndexSignatureOnlyType(type) {
|
|
56972
56930
|
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;
|
|
56973
56931
|
}
|
|
56974
|
-
function isEnumTypeRelatedTo(
|
|
56932
|
+
function isEnumTypeRelatedTo(source, target, errorReporter) {
|
|
56933
|
+
const sourceSymbol = source.flags & 8 /* EnumMember */ ? getParentOfSymbol(source) : source;
|
|
56934
|
+
const targetSymbol = target.flags & 8 /* EnumMember */ ? getParentOfSymbol(target) : target;
|
|
56975
56935
|
if (sourceSymbol === targetSymbol) {
|
|
56976
56936
|
return true;
|
|
56977
56937
|
}
|
|
56938
|
+
if (sourceSymbol.escapedName !== targetSymbol.escapedName || !(sourceSymbol.flags & 256 /* RegularEnum */) || !(targetSymbol.flags & 256 /* RegularEnum */)) {
|
|
56939
|
+
return false;
|
|
56940
|
+
}
|
|
56978
56941
|
const id = getSymbolId(sourceSymbol) + "," + getSymbolId(targetSymbol);
|
|
56979
56942
|
const entry = enumRelation.get(id);
|
|
56980
56943
|
if (entry !== void 0 && !(!(entry & 4 /* Reported */) && entry & 2 /* Failed */ && errorReporter)) {
|
|
56981
56944
|
return !!(entry & 1 /* Succeeded */);
|
|
56982
56945
|
}
|
|
56983
|
-
if (sourceSymbol.escapedName !== targetSymbol.escapedName || !(sourceSymbol.flags & 256 /* RegularEnum */) || !(targetSymbol.flags & 256 /* RegularEnum */)) {
|
|
56984
|
-
enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
|
|
56985
|
-
return false;
|
|
56986
|
-
}
|
|
56987
56946
|
const targetEnumType = getTypeOfSymbol(targetSymbol);
|
|
56988
56947
|
for (const property of getPropertiesOfType(getTypeOfSymbol(sourceSymbol))) {
|
|
56989
56948
|
if (property.flags & 8 /* EnumMember */) {
|
|
@@ -57027,12 +56986,12 @@ ${lanes.join("\n")}
|
|
|
57027
56986
|
return true;
|
|
57028
56987
|
if (s & 12288 /* ESSymbolLike */ && t & 4096 /* ESSymbol */)
|
|
57029
56988
|
return true;
|
|
57030
|
-
if (s & 32 /* Enum */ && t & 32 /* Enum */ && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter))
|
|
56989
|
+
if (s & 32 /* Enum */ && t & 32 /* Enum */ && source.symbol.escapedName === target.symbol.escapedName && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter))
|
|
57031
56990
|
return true;
|
|
57032
56991
|
if (s & 1024 /* EnumLiteral */ && t & 1024 /* EnumLiteral */) {
|
|
57033
56992
|
if (s & 1048576 /* Union */ && t & 1048576 /* Union */ && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter))
|
|
57034
56993
|
return true;
|
|
57035
|
-
if (s & 2944 /* Literal */ && t & 2944 /* Literal */ && source.value === target.value && isEnumTypeRelatedTo(
|
|
56994
|
+
if (s & 2944 /* Literal */ && t & 2944 /* Literal */ && source.value === target.value && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter))
|
|
57036
56995
|
return true;
|
|
57037
56996
|
}
|
|
57038
56997
|
if (s & 32768 /* Undefined */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & (32768 /* Undefined */ | 16384 /* Void */)))
|
|
@@ -58528,28 +58487,30 @@ ${lanes.join("\n")}
|
|
|
58528
58487
|
}
|
|
58529
58488
|
const sourceTypeArguments = getTypeArguments(source2);
|
|
58530
58489
|
const targetTypeArguments = getTypeArguments(target2);
|
|
58531
|
-
const
|
|
58532
|
-
const
|
|
58490
|
+
const targetStartCount = getStartElementCount(target2.target, 11 /* NonRest */);
|
|
58491
|
+
const targetEndCount = getEndElementCount(target2.target, 11 /* NonRest */);
|
|
58492
|
+
const targetHasRestElement = target2.target.hasRestElement;
|
|
58533
58493
|
let canExcludeDiscriminants = !!excludedProperties;
|
|
58534
|
-
for (let
|
|
58535
|
-
const
|
|
58536
|
-
const
|
|
58537
|
-
const
|
|
58494
|
+
for (let sourcePosition = 0; sourcePosition < sourceArity; sourcePosition++) {
|
|
58495
|
+
const sourceFlags = isTupleType(source2) ? source2.target.elementFlags[sourcePosition] : 4 /* Rest */;
|
|
58496
|
+
const sourcePositionFromEnd = sourceArity - 1 - sourcePosition;
|
|
58497
|
+
const targetPosition = targetHasRestElement && sourcePosition >= targetStartCount ? targetArity - 1 - Math.min(sourcePositionFromEnd, targetEndCount) : sourcePosition;
|
|
58498
|
+
const targetFlags = target2.target.elementFlags[targetPosition];
|
|
58538
58499
|
if (targetFlags & 8 /* Variadic */ && !(sourceFlags & 8 /* Variadic */)) {
|
|
58539
58500
|
if (reportErrors2) {
|
|
58540
|
-
reportError(Diagnostics.Source_provides_no_match_for_variadic_element_at_position_0_in_target,
|
|
58501
|
+
reportError(Diagnostics.Source_provides_no_match_for_variadic_element_at_position_0_in_target, targetPosition);
|
|
58541
58502
|
}
|
|
58542
58503
|
return 0 /* False */;
|
|
58543
58504
|
}
|
|
58544
58505
|
if (sourceFlags & 8 /* Variadic */ && !(targetFlags & 12 /* Variable */)) {
|
|
58545
58506
|
if (reportErrors2) {
|
|
58546
|
-
reportError(Diagnostics.Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target,
|
|
58507
|
+
reportError(Diagnostics.Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target, sourcePosition, targetPosition);
|
|
58547
58508
|
}
|
|
58548
58509
|
return 0 /* False */;
|
|
58549
58510
|
}
|
|
58550
58511
|
if (targetFlags & 1 /* Required */ && !(sourceFlags & 1 /* Required */)) {
|
|
58551
58512
|
if (reportErrors2) {
|
|
58552
|
-
reportError(Diagnostics.Source_provides_no_match_for_required_element_at_position_0_in_target,
|
|
58513
|
+
reportError(Diagnostics.Source_provides_no_match_for_required_element_at_position_0_in_target, targetPosition);
|
|
58553
58514
|
}
|
|
58554
58515
|
return 0 /* False */;
|
|
58555
58516
|
}
|
|
@@ -58557,20 +58518,20 @@ ${lanes.join("\n")}
|
|
|
58557
58518
|
if (sourceFlags & 12 /* Variable */ || targetFlags & 12 /* Variable */) {
|
|
58558
58519
|
canExcludeDiscriminants = false;
|
|
58559
58520
|
}
|
|
58560
|
-
if (canExcludeDiscriminants && (excludedProperties == null ? void 0 : excludedProperties.has("" +
|
|
58521
|
+
if (canExcludeDiscriminants && (excludedProperties == null ? void 0 : excludedProperties.has("" + sourcePosition))) {
|
|
58561
58522
|
continue;
|
|
58562
58523
|
}
|
|
58563
58524
|
}
|
|
58564
|
-
const sourceType =
|
|
58565
|
-
const targetType = targetTypeArguments[
|
|
58525
|
+
const sourceType = removeMissingType(sourceTypeArguments[sourcePosition], !!(sourceFlags & targetFlags & 2 /* Optional */));
|
|
58526
|
+
const targetType = targetTypeArguments[targetPosition];
|
|
58566
58527
|
const targetCheckType = sourceFlags & 8 /* Variadic */ && targetFlags & 4 /* Rest */ ? createArrayType(targetType) : removeMissingType(targetType, !!(targetFlags & 2 /* Optional */));
|
|
58567
58528
|
const related = isRelatedTo(sourceType, targetCheckType, 3 /* Both */, reportErrors2, void 0, intersectionState);
|
|
58568
58529
|
if (!related) {
|
|
58569
58530
|
if (reportErrors2 && (targetArity > 1 || sourceArity > 1)) {
|
|
58570
|
-
if (
|
|
58571
|
-
reportIncompatibleError(Diagnostics.
|
|
58531
|
+
if (targetHasRestElement && sourcePosition >= targetStartCount && sourcePositionFromEnd >= targetEndCount && targetStartCount !== sourceArity - targetEndCount - 1) {
|
|
58532
|
+
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);
|
|
58572
58533
|
} else {
|
|
58573
|
-
reportIncompatibleError(Diagnostics.
|
|
58534
|
+
reportIncompatibleError(Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target, sourcePosition, targetPosition);
|
|
58574
58535
|
}
|
|
58575
58536
|
}
|
|
58576
58537
|
return 0 /* False */;
|
|
@@ -60150,10 +60111,7 @@ ${lanes.join("\n")}
|
|
|
60150
60111
|
return;
|
|
60151
60112
|
}
|
|
60152
60113
|
source = getUnionType(sources);
|
|
60153
|
-
} else if (target.flags & 2097152 /* Intersection */ &&
|
|
60154
|
-
target.types,
|
|
60155
|
-
(t) => !!getInferenceInfoForType(t) || isGenericMappedType(t) && !!getInferenceInfoForType(getHomomorphicTypeVariable(t) || neverType)
|
|
60156
|
-
)) {
|
|
60114
|
+
} else if (target.flags & 2097152 /* Intersection */ && !every(target.types, isNonGenericObjectType)) {
|
|
60157
60115
|
if (!(source.flags & 1048576 /* Union */)) {
|
|
60158
60116
|
const [sources, targets] = inferFromMatchingTypes(source.flags & 2097152 /* Intersection */ ? source.types : [source], target.types, isTypeIdenticalTo);
|
|
60159
60117
|
if (sources.length === 0 || targets.length === 0) {
|
|
@@ -67382,7 +67340,7 @@ ${lanes.join("\n")}
|
|
|
67382
67340
|
if (symbol && symbol.flags & 2097152 /* Alias */) {
|
|
67383
67341
|
symbol = resolveAlias(symbol);
|
|
67384
67342
|
}
|
|
67385
|
-
return !!(symbol && getAllSymbolFlags(symbol) & 384 /* Enum */
|
|
67343
|
+
return !!(symbol && getAllSymbolFlags(symbol) & 384 /* Enum */);
|
|
67386
67344
|
}
|
|
67387
67345
|
return false;
|
|
67388
67346
|
}
|
|
@@ -69307,7 +69265,7 @@ ${lanes.join("\n")}
|
|
|
69307
69265
|
}
|
|
69308
69266
|
}
|
|
69309
69267
|
function checkExpressionCached(node, checkMode) {
|
|
69310
|
-
if (checkMode
|
|
69268
|
+
if (checkMode) {
|
|
69311
69269
|
return checkExpression(node, checkMode);
|
|
69312
69270
|
}
|
|
69313
69271
|
const links = getNodeLinks(node);
|
|
@@ -70324,9 +70282,6 @@ ${lanes.join("\n")}
|
|
|
70324
70282
|
symbol.escapedName
|
|
70325
70283
|
);
|
|
70326
70284
|
}
|
|
70327
|
-
if (type.flags & 32 /* Enum */ && symbol.flags & 8 /* EnumMember */) {
|
|
70328
|
-
error(node, Diagnostics.Enum_type_0_has_members_with_initializers_that_are_not_literals, typeToString(type));
|
|
70329
|
-
}
|
|
70330
70285
|
}
|
|
70331
70286
|
}
|
|
70332
70287
|
}
|
|
@@ -73650,7 +73605,7 @@ ${lanes.join("\n")}
|
|
|
73650
73605
|
if (member.initializer) {
|
|
73651
73606
|
return computeConstantValue(member);
|
|
73652
73607
|
}
|
|
73653
|
-
if (member.parent.flags & 16777216 /* Ambient */ && !isEnumConst(member.parent)
|
|
73608
|
+
if (member.parent.flags & 16777216 /* Ambient */ && !isEnumConst(member.parent)) {
|
|
73654
73609
|
return void 0;
|
|
73655
73610
|
}
|
|
73656
73611
|
if (autoValue !== void 0) {
|
|
@@ -73660,134 +73615,140 @@ ${lanes.join("\n")}
|
|
|
73660
73615
|
return void 0;
|
|
73661
73616
|
}
|
|
73662
73617
|
function computeConstantValue(member) {
|
|
73663
|
-
const enumKind = getEnumKind(getSymbolOfNode(member.parent));
|
|
73664
73618
|
const isConstEnum = isEnumConst(member.parent);
|
|
73665
73619
|
const initializer = member.initializer;
|
|
73666
|
-
const value =
|
|
73620
|
+
const value = evaluate(initializer, member);
|
|
73667
73621
|
if (value !== void 0) {
|
|
73668
73622
|
if (isConstEnum && typeof value === "number" && !isFinite(value)) {
|
|
73669
73623
|
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);
|
|
73670
73624
|
}
|
|
73671
|
-
} else if (enumKind === 1 /* Literal */) {
|
|
73672
|
-
error(initializer, Diagnostics.Computed_values_are_not_permitted_in_an_enum_with_string_valued_members);
|
|
73673
|
-
return 0;
|
|
73674
73625
|
} else if (isConstEnum) {
|
|
73675
|
-
error(initializer, Diagnostics.
|
|
73626
|
+
error(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
|
|
73676
73627
|
} else if (member.parent.flags & 16777216 /* Ambient */) {
|
|
73677
73628
|
error(initializer, Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
|
|
73678
73629
|
} else {
|
|
73679
|
-
|
|
73680
|
-
if (!isTypeAssignableToKind(source, 296 /* NumberLike */)) {
|
|
73681
|
-
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));
|
|
73682
|
-
} else {
|
|
73683
|
-
checkTypeAssignableTo(source, getDeclaredTypeOfSymbol(getSymbolOfNode(member.parent)), initializer, void 0);
|
|
73684
|
-
}
|
|
73630
|
+
checkTypeAssignableTo(checkExpression(initializer), numberType, initializer, Diagnostics.Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values);
|
|
73685
73631
|
}
|
|
73686
73632
|
return value;
|
|
73687
|
-
|
|
73688
|
-
|
|
73689
|
-
|
|
73690
|
-
|
|
73691
|
-
|
|
73692
|
-
|
|
73693
|
-
|
|
73694
|
-
|
|
73695
|
-
|
|
73696
|
-
|
|
73697
|
-
|
|
73698
|
-
|
|
73699
|
-
|
|
73633
|
+
}
|
|
73634
|
+
function evaluate(expr, location) {
|
|
73635
|
+
switch (expr.kind) {
|
|
73636
|
+
case 221 /* PrefixUnaryExpression */:
|
|
73637
|
+
const value = evaluate(expr.operand, location);
|
|
73638
|
+
if (typeof value === "number") {
|
|
73639
|
+
switch (expr.operator) {
|
|
73640
|
+
case 39 /* PlusToken */:
|
|
73641
|
+
return value;
|
|
73642
|
+
case 40 /* MinusToken */:
|
|
73643
|
+
return -value;
|
|
73644
|
+
case 54 /* TildeToken */:
|
|
73645
|
+
return ~value;
|
|
73700
73646
|
}
|
|
73701
|
-
|
|
73702
|
-
|
|
73703
|
-
|
|
73704
|
-
|
|
73705
|
-
|
|
73706
|
-
|
|
73707
|
-
|
|
73708
|
-
|
|
73709
|
-
|
|
73710
|
-
|
|
73711
|
-
|
|
73712
|
-
|
|
73713
|
-
|
|
73714
|
-
|
|
73715
|
-
|
|
73716
|
-
|
|
73717
|
-
|
|
73718
|
-
|
|
73719
|
-
|
|
73720
|
-
|
|
73721
|
-
|
|
73722
|
-
|
|
73723
|
-
|
|
73724
|
-
|
|
73725
|
-
|
|
73726
|
-
|
|
73727
|
-
|
|
73728
|
-
|
|
73729
|
-
|
|
73730
|
-
|
|
73647
|
+
}
|
|
73648
|
+
break;
|
|
73649
|
+
case 223 /* BinaryExpression */:
|
|
73650
|
+
const left = evaluate(expr.left, location);
|
|
73651
|
+
const right = evaluate(expr.right, location);
|
|
73652
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
73653
|
+
switch (expr.operatorToken.kind) {
|
|
73654
|
+
case 51 /* BarToken */:
|
|
73655
|
+
return left | right;
|
|
73656
|
+
case 50 /* AmpersandToken */:
|
|
73657
|
+
return left & right;
|
|
73658
|
+
case 48 /* GreaterThanGreaterThanToken */:
|
|
73659
|
+
return left >> right;
|
|
73660
|
+
case 49 /* GreaterThanGreaterThanGreaterThanToken */:
|
|
73661
|
+
return left >>> right;
|
|
73662
|
+
case 47 /* LessThanLessThanToken */:
|
|
73663
|
+
return left << right;
|
|
73664
|
+
case 52 /* CaretToken */:
|
|
73665
|
+
return left ^ right;
|
|
73666
|
+
case 41 /* AsteriskToken */:
|
|
73667
|
+
return left * right;
|
|
73668
|
+
case 43 /* SlashToken */:
|
|
73669
|
+
return left / right;
|
|
73670
|
+
case 39 /* PlusToken */:
|
|
73671
|
+
return left + right;
|
|
73672
|
+
case 40 /* MinusToken */:
|
|
73673
|
+
return left - right;
|
|
73674
|
+
case 44 /* PercentToken */:
|
|
73675
|
+
return left % right;
|
|
73676
|
+
case 42 /* AsteriskAsteriskToken */:
|
|
73677
|
+
return left ** right;
|
|
73678
|
+
}
|
|
73679
|
+
} else if ((typeof left === "string" || typeof left === "number") && (typeof right === "string" || typeof right === "number") && expr.operatorToken.kind === 39 /* PlusToken */) {
|
|
73680
|
+
return "" + left + right;
|
|
73681
|
+
}
|
|
73682
|
+
break;
|
|
73683
|
+
case 10 /* StringLiteral */:
|
|
73684
|
+
case 14 /* NoSubstitutionTemplateLiteral */:
|
|
73685
|
+
return expr.text;
|
|
73686
|
+
case 225 /* TemplateExpression */:
|
|
73687
|
+
return evaluateTemplateExpression(expr, location);
|
|
73688
|
+
case 8 /* NumericLiteral */:
|
|
73689
|
+
checkGrammarNumericLiteral(expr);
|
|
73690
|
+
return +expr.text;
|
|
73691
|
+
case 214 /* ParenthesizedExpression */:
|
|
73692
|
+
return evaluate(expr.expression, location);
|
|
73693
|
+
case 79 /* Identifier */:
|
|
73694
|
+
if (isInfinityOrNaNString(expr.escapedText)) {
|
|
73695
|
+
return +expr.escapedText;
|
|
73696
|
+
}
|
|
73697
|
+
case 208 /* PropertyAccessExpression */:
|
|
73698
|
+
if (isEntityNameExpression(expr)) {
|
|
73699
|
+
const symbol = resolveEntityName(expr, 111551 /* Value */, true);
|
|
73700
|
+
if (symbol) {
|
|
73701
|
+
if (symbol.flags & 8 /* EnumMember */) {
|
|
73702
|
+
return evaluateEnumMember(expr, symbol, location);
|
|
73731
73703
|
}
|
|
73732
|
-
|
|
73733
|
-
|
|
73734
|
-
|
|
73735
|
-
|
|
73736
|
-
case 10 /* StringLiteral */:
|
|
73737
|
-
case 14 /* NoSubstitutionTemplateLiteral */:
|
|
73738
|
-
return expr.text;
|
|
73739
|
-
case 8 /* NumericLiteral */:
|
|
73740
|
-
checkGrammarNumericLiteral(expr);
|
|
73741
|
-
return +expr.text;
|
|
73742
|
-
case 214 /* ParenthesizedExpression */:
|
|
73743
|
-
return evaluate(expr.expression);
|
|
73744
|
-
case 79 /* Identifier */:
|
|
73745
|
-
const identifier = expr;
|
|
73746
|
-
if (isInfinityOrNaNString(identifier.escapedText)) {
|
|
73747
|
-
return +identifier.escapedText;
|
|
73748
|
-
}
|
|
73749
|
-
return nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
|
|
73750
|
-
case 209 /* ElementAccessExpression */:
|
|
73751
|
-
case 208 /* PropertyAccessExpression */:
|
|
73752
|
-
if (isConstantMemberAccess(expr)) {
|
|
73753
|
-
const type = getTypeOfExpression(expr.expression);
|
|
73754
|
-
if (type.symbol && type.symbol.flags & 384 /* Enum */) {
|
|
73755
|
-
let name;
|
|
73756
|
-
if (expr.kind === 208 /* PropertyAccessExpression */) {
|
|
73757
|
-
name = expr.name.escapedText;
|
|
73758
|
-
} else {
|
|
73759
|
-
name = escapeLeadingUnderscores(cast(expr.argumentExpression, isLiteralExpression).text);
|
|
73704
|
+
if (isConstVariable(symbol)) {
|
|
73705
|
+
const declaration = symbol.valueDeclaration;
|
|
73706
|
+
if (declaration && !declaration.type && declaration.initializer && declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
73707
|
+
return evaluate(declaration.initializer, declaration);
|
|
73760
73708
|
}
|
|
73761
|
-
return evaluateEnumMember(expr, type.symbol, name);
|
|
73762
73709
|
}
|
|
73763
73710
|
}
|
|
73764
|
-
|
|
73765
|
-
|
|
73766
|
-
|
|
73767
|
-
|
|
73768
|
-
|
|
73769
|
-
|
|
73770
|
-
|
|
73771
|
-
|
|
73772
|
-
|
|
73773
|
-
|
|
73774
|
-
|
|
73711
|
+
}
|
|
73712
|
+
break;
|
|
73713
|
+
case 209 /* ElementAccessExpression */:
|
|
73714
|
+
const root = expr.expression;
|
|
73715
|
+
if (isEntityNameExpression(root) && isStringLiteralLike(expr.argumentExpression)) {
|
|
73716
|
+
const rootSymbol = resolveEntityName(root, 111551 /* Value */, true);
|
|
73717
|
+
if (rootSymbol && rootSymbol.flags & 384 /* Enum */) {
|
|
73718
|
+
const name = escapeLeadingUnderscores(expr.argumentExpression.text);
|
|
73719
|
+
const member = rootSymbol.exports.get(name);
|
|
73720
|
+
if (member) {
|
|
73721
|
+
return evaluateEnumMember(expr, member, location);
|
|
73722
|
+
}
|
|
73775
73723
|
}
|
|
73776
|
-
error(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
|
73777
|
-
return 0;
|
|
73778
|
-
} else {
|
|
73779
|
-
error(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(memberSymbol));
|
|
73780
73724
|
}
|
|
73781
|
-
|
|
73725
|
+
break;
|
|
73726
|
+
}
|
|
73727
|
+
return void 0;
|
|
73728
|
+
}
|
|
73729
|
+
function evaluateEnumMember(expr, symbol, location) {
|
|
73730
|
+
const declaration = symbol.valueDeclaration;
|
|
73731
|
+
if (!declaration || declaration === location) {
|
|
73732
|
+
error(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
73782
73733
|
return void 0;
|
|
73783
73734
|
}
|
|
73735
|
+
if (!isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
73736
|
+
error(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums);
|
|
73737
|
+
return 0;
|
|
73738
|
+
}
|
|
73739
|
+
return getEnumMemberValue(declaration);
|
|
73784
73740
|
}
|
|
73785
|
-
function
|
|
73786
|
-
|
|
73787
|
-
|
|
73788
|
-
|
|
73741
|
+
function evaluateTemplateExpression(expr, location) {
|
|
73742
|
+
let result = expr.head.text;
|
|
73743
|
+
for (const span of expr.templateSpans) {
|
|
73744
|
+
const value = evaluate(span.expression, location);
|
|
73745
|
+
if (value === void 0) {
|
|
73746
|
+
return void 0;
|
|
73747
|
+
}
|
|
73748
|
+
result += value;
|
|
73749
|
+
result += span.literal.text;
|
|
73789
73750
|
}
|
|
73790
|
-
return
|
|
73751
|
+
return result;
|
|
73791
73752
|
}
|
|
73792
73753
|
function checkEnumDeclaration(node) {
|
|
73793
73754
|
addLazyDiagnostic(() => checkEnumDeclarationWorker(node));
|
|
@@ -73833,6 +73794,9 @@ ${lanes.join("\n")}
|
|
|
73833
73794
|
if (isPrivateIdentifier(node.name)) {
|
|
73834
73795
|
error(node, Diagnostics.An_enum_member_cannot_be_named_with_a_private_identifier);
|
|
73835
73796
|
}
|
|
73797
|
+
if (node.initializer) {
|
|
73798
|
+
checkExpression(node.initializer);
|
|
73799
|
+
}
|
|
73836
73800
|
}
|
|
73837
73801
|
function getFirstNonAmbientClassOrFunctionDeclaration(symbol) {
|
|
73838
73802
|
const declarations = symbol.declarations;
|
|
@@ -97250,17 +97214,19 @@ ${lanes.join("\n")}
|
|
|
97250
97214
|
});
|
|
97251
97215
|
}
|
|
97252
97216
|
function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
|
|
97217
|
+
var _a2, _b;
|
|
97218
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Emit, "emitUsingBuildInfo", {}, true);
|
|
97219
|
+
ts_performance_exports.mark("beforeEmit");
|
|
97220
|
+
const result = emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers);
|
|
97221
|
+
ts_performance_exports.mark("afterEmit");
|
|
97222
|
+
ts_performance_exports.measure("Emit", "beforeEmit", "afterEmit");
|
|
97223
|
+
(_b = tracing) == null ? void 0 : _b.pop();
|
|
97224
|
+
return result;
|
|
97225
|
+
}
|
|
97226
|
+
function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers) {
|
|
97253
97227
|
const createHash = maybeBind(host, host.createHash);
|
|
97254
97228
|
const { buildInfoPath, jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath } = getOutputPathsForBundle(config.options, false);
|
|
97255
|
-
|
|
97256
|
-
if (host.getBuildInfo) {
|
|
97257
|
-
buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
|
|
97258
|
-
} else {
|
|
97259
|
-
const buildInfoText = host.readFile(buildInfoPath);
|
|
97260
|
-
if (!buildInfoText)
|
|
97261
|
-
return buildInfoPath;
|
|
97262
|
-
buildInfo = getBuildInfo(buildInfoPath, buildInfoText);
|
|
97263
|
-
}
|
|
97229
|
+
const buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
|
|
97264
97230
|
if (!buildInfo)
|
|
97265
97231
|
return buildInfoPath;
|
|
97266
97232
|
if (!buildInfo.bundle || !buildInfo.bundle.js || declarationFilePath && !buildInfo.bundle.dts)
|
|
@@ -97286,21 +97252,21 @@ ${lanes.join("\n")}
|
|
|
97286
97252
|
if (declarationMapPath && computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
|
|
97287
97253
|
return declarationMapPath;
|
|
97288
97254
|
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
97289
|
-
const ownPrependInput =
|
|
97255
|
+
const ownPrependInput = createInputFilesWithFileTexts(
|
|
97256
|
+
jsFilePath,
|
|
97290
97257
|
jsFileText,
|
|
97291
|
-
declarationText,
|
|
97292
97258
|
sourceMapFilePath,
|
|
97293
97259
|
sourceMapText,
|
|
97260
|
+
declarationFilePath,
|
|
97261
|
+
declarationText,
|
|
97294
97262
|
declarationMapPath,
|
|
97295
97263
|
declarationMapText,
|
|
97296
|
-
jsFilePath,
|
|
97297
|
-
declarationFilePath,
|
|
97298
97264
|
buildInfoPath,
|
|
97299
97265
|
buildInfo,
|
|
97300
97266
|
true
|
|
97301
97267
|
);
|
|
97302
97268
|
const outputFiles = [];
|
|
97303
|
-
const prependNodes = createPrependNodes(config.projectReferences, getCommandLine, (f) => host.readFile(f));
|
|
97269
|
+
const prependNodes = createPrependNodes(config.projectReferences, getCommandLine, (f) => host.readFile(f), host);
|
|
97304
97270
|
const sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
|
|
97305
97271
|
let changedDtsText;
|
|
97306
97272
|
let changedDtsData;
|
|
@@ -101974,14 +101940,12 @@ ${lanes.join("\n")}
|
|
|
101974
101940
|
function createCompilerHost(options, setParentNodes) {
|
|
101975
101941
|
return createCompilerHostWorker(options, setParentNodes);
|
|
101976
101942
|
}
|
|
101977
|
-
function
|
|
101978
|
-
|
|
101979
|
-
const getCanonicalFileName = createGetCanonicalFileName(system.useCaseSensitiveFileNames);
|
|
101980
|
-
function getSourceFile(fileName, languageVersionOrOptions, onError) {
|
|
101943
|
+
function createGetSourceFile(readFile, getCompilerOptions, setParentNodes) {
|
|
101944
|
+
return (fileName, languageVersionOrOptions, onError) => {
|
|
101981
101945
|
let text;
|
|
101982
101946
|
try {
|
|
101983
101947
|
mark("beforeIORead");
|
|
101984
|
-
text =
|
|
101948
|
+
text = readFile(fileName, getCompilerOptions().charset);
|
|
101985
101949
|
mark("afterIORead");
|
|
101986
101950
|
measure("I/O Read", "beforeIORead", "afterIORead");
|
|
101987
101951
|
} catch (e) {
|
|
@@ -101991,27 +101955,19 @@ ${lanes.join("\n")}
|
|
|
101991
101955
|
text = "";
|
|
101992
101956
|
}
|
|
101993
101957
|
return text !== void 0 ? createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes) : void 0;
|
|
101994
|
-
}
|
|
101995
|
-
|
|
101996
|
-
|
|
101997
|
-
|
|
101998
|
-
}
|
|
101999
|
-
if ((compilerHost.directoryExists || system.directoryExists)(directoryPath)) {
|
|
102000
|
-
existingDirectories.set(directoryPath, true);
|
|
102001
|
-
return true;
|
|
102002
|
-
}
|
|
102003
|
-
return false;
|
|
102004
|
-
}
|
|
102005
|
-
function writeFile2(fileName, data, writeByteOrderMark, onError) {
|
|
101958
|
+
};
|
|
101959
|
+
}
|
|
101960
|
+
function createWriteFileMeasuringIO(actualWriteFile, createDirectory, directoryExists) {
|
|
101961
|
+
return (fileName, data, writeByteOrderMark, onError) => {
|
|
102006
101962
|
try {
|
|
102007
101963
|
mark("beforeIOWrite");
|
|
102008
101964
|
writeFileEnsuringDirectories(
|
|
102009
101965
|
fileName,
|
|
102010
101966
|
data,
|
|
102011
101967
|
writeByteOrderMark,
|
|
102012
|
-
|
|
102013
|
-
|
|
102014
|
-
|
|
101968
|
+
actualWriteFile,
|
|
101969
|
+
createDirectory,
|
|
101970
|
+
directoryExists
|
|
102015
101971
|
);
|
|
102016
101972
|
mark("afterIOWrite");
|
|
102017
101973
|
measure("I/O Write", "beforeIOWrite", "afterIOWrite");
|
|
@@ -102020,6 +101976,20 @@ ${lanes.join("\n")}
|
|
|
102020
101976
|
onError(e.message);
|
|
102021
101977
|
}
|
|
102022
101978
|
}
|
|
101979
|
+
};
|
|
101980
|
+
}
|
|
101981
|
+
function createCompilerHostWorker(options, setParentNodes, system = sys) {
|
|
101982
|
+
const existingDirectories = new Map();
|
|
101983
|
+
const getCanonicalFileName = createGetCanonicalFileName(system.useCaseSensitiveFileNames);
|
|
101984
|
+
function directoryExists(directoryPath) {
|
|
101985
|
+
if (existingDirectories.has(directoryPath)) {
|
|
101986
|
+
return true;
|
|
101987
|
+
}
|
|
101988
|
+
if ((compilerHost.directoryExists || system.directoryExists)(directoryPath)) {
|
|
101989
|
+
existingDirectories.set(directoryPath, true);
|
|
101990
|
+
return true;
|
|
101991
|
+
}
|
|
101992
|
+
return false;
|
|
102023
101993
|
}
|
|
102024
101994
|
function getDefaultLibLocation() {
|
|
102025
101995
|
return getDirectoryPath(normalizePath(system.getExecutingFilePath()));
|
|
@@ -102027,10 +101997,14 @@ ${lanes.join("\n")}
|
|
|
102027
101997
|
const newLine = getNewLineCharacter(options, () => system.newLine);
|
|
102028
101998
|
const realpath = system.realpath && ((path) => system.realpath(path));
|
|
102029
101999
|
const compilerHost = {
|
|
102030
|
-
getSourceFile,
|
|
102000
|
+
getSourceFile: createGetSourceFile((fileName) => compilerHost.readFile(fileName), () => options, setParentNodes),
|
|
102031
102001
|
getDefaultLibLocation,
|
|
102032
102002
|
getDefaultLibFileName: (options2) => combinePaths(getDefaultLibLocation(), getDefaultLibFileName(options2)),
|
|
102033
|
-
writeFile:
|
|
102003
|
+
writeFile: createWriteFileMeasuringIO(
|
|
102004
|
+
(path, data, writeByteOrderMark) => system.writeFile(path, data, writeByteOrderMark),
|
|
102005
|
+
(path) => (compilerHost.createDirectory || system.createDirectory)(path),
|
|
102006
|
+
(path) => directoryExists(path)
|
|
102007
|
+
),
|
|
102034
102008
|
getCurrentDirectory: memoize(() => system.getCurrentDirectory()),
|
|
102035
102009
|
useCaseSensitiveFileNames: () => system.useCaseSensitiveFileNames,
|
|
102036
102010
|
getCanonicalFileName,
|
|
@@ -103401,7 +103375,8 @@ ${lanes.join("\n")}
|
|
|
103401
103375
|
const path = toPath3(fileName);
|
|
103402
103376
|
const sourceFile = getSourceFileByPath(path);
|
|
103403
103377
|
return sourceFile ? sourceFile.text : filesByName.has(path) ? void 0 : host.readFile(path);
|
|
103404
|
-
}
|
|
103378
|
+
},
|
|
103379
|
+
host
|
|
103405
103380
|
);
|
|
103406
103381
|
}
|
|
103407
103382
|
function isSourceFileFromExternalLibrary(file) {
|
|
@@ -105187,7 +105162,7 @@ ${lanes.join("\n")}
|
|
|
105187
105162
|
trace: host.trace ? (s) => host.trace(s) : void 0
|
|
105188
105163
|
};
|
|
105189
105164
|
}
|
|
105190
|
-
function createPrependNodes(projectReferences, getCommandLine, readFile) {
|
|
105165
|
+
function createPrependNodes(projectReferences, getCommandLine, readFile, host) {
|
|
105191
105166
|
if (!projectReferences)
|
|
105192
105167
|
return emptyArray;
|
|
105193
105168
|
let nodes;
|
|
@@ -105199,7 +105174,7 @@ ${lanes.join("\n")}
|
|
|
105199
105174
|
if (!out)
|
|
105200
105175
|
continue;
|
|
105201
105176
|
const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath } = getOutputPathsForBundle(resolvedRefOpts.options, true);
|
|
105202
|
-
const node =
|
|
105177
|
+
const node = createInputFilesWithFilePaths(readFile, jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath, host, resolvedRefOpts.options);
|
|
105203
105178
|
(nodes || (nodes = [])).push(node);
|
|
105204
105179
|
}
|
|
105205
105180
|
}
|
|
@@ -105401,7 +105376,8 @@ ${lanes.join("\n")}
|
|
|
105401
105376
|
function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
|
|
105402
105377
|
var _a2, _b, _c;
|
|
105403
105378
|
const fileInfos = new Map();
|
|
105404
|
-
const
|
|
105379
|
+
const options = newProgram.getCompilerOptions();
|
|
105380
|
+
const referencedMap = options.module !== 0 /* None */ && !outFile(options) ? createManyToManyPathMap() : void 0;
|
|
105405
105381
|
const exportedModulesMap = referencedMap ? createManyToManyPathMap() : void 0;
|
|
105406
105382
|
const useOldState = canReuseOldState(referencedMap, oldState);
|
|
105407
105383
|
newProgram.getTypeChecker();
|
|
@@ -105854,7 +105830,7 @@ ${lanes.join("\n")}
|
|
|
105854
105830
|
const seenEmittedFiles = state.seenEmittedFiles || (state.seenEmittedFiles = new Map());
|
|
105855
105831
|
for (let i = state.affectedFilesPendingEmitIndex; i < affectedFilesPendingEmit.length; i++) {
|
|
105856
105832
|
const affectedFile = Debug.checkDefined(state.program).getSourceFileByPath(affectedFilesPendingEmit[i]);
|
|
105857
|
-
if (affectedFile) {
|
|
105833
|
+
if (affectedFile && sourceFileMayBeEmitted(affectedFile, state.program)) {
|
|
105858
105834
|
const seenKind = seenEmittedFiles.get(affectedFile.resolvedPath);
|
|
105859
105835
|
const emitKind = Debug.checkDefined(Debug.checkDefined(state.affectedFilesPendingEmitKind).get(affectedFile.resolvedPath));
|
|
105860
105836
|
if (seenKind === void 0 || seenKind < emitKind) {
|
|
@@ -106159,6 +106135,9 @@ ${lanes.join("\n")}
|
|
|
106159
106135
|
const seenFiles = new Set();
|
|
106160
106136
|
for (const path of state.affectedFilesPendingEmit.slice(state.affectedFilesPendingEmitIndex).sort(compareStringsCaseSensitive)) {
|
|
106161
106137
|
if (tryAddToSet(seenFiles, path)) {
|
|
106138
|
+
const file = state.program.getSourceFileByPath(path);
|
|
106139
|
+
if (!sourceFileMayBeEmitted(file, state.program))
|
|
106140
|
+
continue;
|
|
106162
106141
|
const fileId = toFileId(path), emitKind = state.affectedFilesPendingEmitKind.get(path);
|
|
106163
106142
|
(affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push(
|
|
106164
106143
|
emitKind === 1 /* Full */ ? fileId : [fileId]
|
|
@@ -107944,24 +107923,18 @@ ${lanes.join("\n")}
|
|
|
107944
107923
|
const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
|
|
107945
107924
|
const hostGetNewLine = memoize(() => host.getNewLine());
|
|
107946
107925
|
return {
|
|
107947
|
-
getSourceFile: (
|
|
107948
|
-
|
|
107949
|
-
|
|
107950
|
-
|
|
107951
|
-
|
|
107952
|
-
mark("afterIORead");
|
|
107953
|
-
measure("I/O Read", "beforeIORead", "afterIORead");
|
|
107954
|
-
} catch (e) {
|
|
107955
|
-
if (onError) {
|
|
107956
|
-
onError(e.message);
|
|
107957
|
-
}
|
|
107958
|
-
text = "";
|
|
107959
|
-
}
|
|
107960
|
-
return text !== void 0 ? createSourceFile(fileName, text, languageVersionOrOptions) : void 0;
|
|
107961
|
-
},
|
|
107926
|
+
getSourceFile: createGetSourceFile(
|
|
107927
|
+
(fileName, encoding) => host.readFile(fileName, encoding),
|
|
107928
|
+
getCompilerOptions,
|
|
107929
|
+
void 0
|
|
107930
|
+
),
|
|
107962
107931
|
getDefaultLibLocation: maybeBind(host, host.getDefaultLibLocation),
|
|
107963
107932
|
getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
|
|
107964
|
-
writeFile:
|
|
107933
|
+
writeFile: createWriteFileMeasuringIO(
|
|
107934
|
+
(path, data, writeByteOrderMark) => host.writeFile(path, data, writeByteOrderMark),
|
|
107935
|
+
(path) => host.createDirectory(path),
|
|
107936
|
+
(path) => host.directoryExists(path)
|
|
107937
|
+
),
|
|
107965
107938
|
getCurrentDirectory: memoize(() => host.getCurrentDirectory()),
|
|
107966
107939
|
useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
|
|
107967
107940
|
getCanonicalFileName: createGetCanonicalFileName(useCaseSensitiveFileNames),
|
|
@@ -107978,25 +107951,6 @@ ${lanes.join("\n")}
|
|
|
107978
107951
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
107979
107952
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
107980
107953
|
};
|
|
107981
|
-
function writeFile2(fileName, text, writeByteOrderMark, onError) {
|
|
107982
|
-
try {
|
|
107983
|
-
mark("beforeIOWrite");
|
|
107984
|
-
writeFileEnsuringDirectories(
|
|
107985
|
-
fileName,
|
|
107986
|
-
text,
|
|
107987
|
-
writeByteOrderMark,
|
|
107988
|
-
(path, data, writeByteOrderMark2) => host.writeFile(path, data, writeByteOrderMark2),
|
|
107989
|
-
(path) => host.createDirectory(path),
|
|
107990
|
-
(path) => host.directoryExists(path)
|
|
107991
|
-
);
|
|
107992
|
-
mark("afterIOWrite");
|
|
107993
|
-
measure("I/O Write", "beforeIOWrite", "afterIOWrite");
|
|
107994
|
-
} catch (e) {
|
|
107995
|
-
if (onError) {
|
|
107996
|
-
onError(e.message);
|
|
107997
|
-
}
|
|
107998
|
-
}
|
|
107999
|
-
}
|
|
108000
107954
|
}
|
|
108001
107955
|
function setGetSourceFileAsHashVersioned(compilerHost, host) {
|
|
108002
107956
|
const originalGetSourceFile = compilerHost.getSourceFile;
|
|
@@ -109507,7 +109461,7 @@ ${lanes.join("\n")}
|
|
|
109507
109461
|
return emitDiagnostics;
|
|
109508
109462
|
}
|
|
109509
109463
|
function emitBundle(writeFileCallback, customTransformers) {
|
|
109510
|
-
var _a2, _b;
|
|
109464
|
+
var _a2, _b, _c, _d;
|
|
109511
109465
|
Debug.assert(kind === 1 /* UpdateBundle */);
|
|
109512
109466
|
if (state.options.dry) {
|
|
109513
109467
|
reportStatus(state, Diagnostics.A_non_dry_build_would_update_output_of_project_0, project);
|
|
@@ -109519,6 +109473,7 @@ ${lanes.join("\n")}
|
|
|
109519
109473
|
reportStatus(state, Diagnostics.Updating_output_of_project_0, project);
|
|
109520
109474
|
const { compilerHost } = state;
|
|
109521
109475
|
state.projectCompilerOptions = config.options;
|
|
109476
|
+
(_b = (_a2 = state.host).beforeEmitBundle) == null ? void 0 : _b.call(_a2, config);
|
|
109522
109477
|
const outputFiles = emitUsingBuildInfo(
|
|
109523
109478
|
config,
|
|
109524
109479
|
compilerHost,
|
|
@@ -109526,7 +109481,7 @@ ${lanes.join("\n")}
|
|
|
109526
109481
|
const refName = resolveProjectName(state, ref.path);
|
|
109527
109482
|
return parseConfigFile(state, refName, toResolvedConfigFilePath(state, refName));
|
|
109528
109483
|
},
|
|
109529
|
-
customTransformers || ((
|
|
109484
|
+
customTransformers || ((_d = (_c = state.host).getCustomTransformers) == null ? void 0 : _d.call(_c, project))
|
|
109530
109485
|
);
|
|
109531
109486
|
if (isString(outputFiles)) {
|
|
109532
109487
|
reportStatus(state, Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, project, relName(state, outputFiles));
|
|
@@ -118096,7 +118051,7 @@ ${lanes.join("\n")}
|
|
|
118096
118051
|
return !!(this.flags & 3145728 /* UnionOrIntersection */);
|
|
118097
118052
|
}
|
|
118098
118053
|
isLiteral() {
|
|
118099
|
-
return !!(this.flags &
|
|
118054
|
+
return !!(this.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */ | 2048 /* BigIntLiteral */));
|
|
118100
118055
|
}
|
|
118101
118056
|
isStringLiteral() {
|
|
118102
118057
|
return !!(this.flags & 128 /* StringLiteral */);
|
|
@@ -147786,6 +147741,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
147786
147741
|
createFunctionTypeNode: () => createFunctionTypeNode,
|
|
147787
147742
|
createGetAccessor: () => createGetAccessor,
|
|
147788
147743
|
createGetCanonicalFileName: () => createGetCanonicalFileName,
|
|
147744
|
+
createGetSourceFile: () => createGetSourceFile,
|
|
147789
147745
|
createGetSymbolAccessibilityDiagnosticForNode: () => createGetSymbolAccessibilityDiagnosticForNode,
|
|
147790
147746
|
createGetSymbolAccessibilityDiagnosticForNodeName: () => createGetSymbolAccessibilityDiagnosticForNodeName,
|
|
147791
147747
|
createGetSymbolWalker: () => createGetSymbolWalker,
|
|
@@ -147805,6 +147761,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
147805
147761
|
createIndexedAccessTypeNode: () => createIndexedAccessTypeNode,
|
|
147806
147762
|
createInferTypeNode: () => createInferTypeNode,
|
|
147807
147763
|
createInputFiles: () => createInputFiles,
|
|
147764
|
+
createInputFilesWithFilePaths: () => createInputFilesWithFilePaths,
|
|
147765
|
+
createInputFilesWithFileTexts: () => createInputFilesWithFileTexts,
|
|
147808
147766
|
createInterfaceDeclaration: () => createInterfaceDeclaration,
|
|
147809
147767
|
createIntersectionTypeNode: () => createIntersectionTypeNode,
|
|
147810
147768
|
createJSDocAugmentsTag: () => createJSDocAugmentsTag,
|
|
@@ -148005,6 +147963,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
148005
147963
|
createWatchStatusReporter: () => createWatchStatusReporter,
|
|
148006
147964
|
createWhile: () => createWhile,
|
|
148007
147965
|
createWith: () => createWith,
|
|
147966
|
+
createWriteFileMeasuringIO: () => createWriteFileMeasuringIO,
|
|
148008
147967
|
createYield: () => createYield,
|
|
148009
147968
|
declarationNameToString: () => declarationNameToString,
|
|
148010
147969
|
decodeMappings: () => decodeMappings,
|