typescript 5.5.0-dev.20240318 → 5.5.0-dev.20240320
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/lib.es2022.regexp.d.ts +1 -1
- package/lib/lib.esnext.array.d.ts +35 -0
- package/lib/lib.esnext.d.ts +2 -0
- package/lib/lib.esnext.regexp.d.ts +25 -0
- package/lib/tsc.js +227 -162
- package/lib/typescript.d.ts +13 -0
- package/lib/typescript.js +286 -184
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -159,6 +159,7 @@ __export(typescript_exports, {
|
|
|
159
159
|
SignatureCheckMode: () => SignatureCheckMode,
|
|
160
160
|
SignatureFlags: () => SignatureFlags,
|
|
161
161
|
SignatureHelp: () => ts_SignatureHelp_exports,
|
|
162
|
+
SignatureInfo: () => SignatureInfo,
|
|
162
163
|
SignatureKind: () => SignatureKind,
|
|
163
164
|
SmartSelectionRange: () => ts_SmartSelectionRange_exports,
|
|
164
165
|
SnippetKind: () => SnippetKind,
|
|
@@ -2325,7 +2326,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2325
2326
|
|
|
2326
2327
|
// src/compiler/corePublic.ts
|
|
2327
2328
|
var versionMajorMinor = "5.5";
|
|
2328
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2329
|
+
var version = `${versionMajorMinor}.0-dev.20240320`;
|
|
2329
2330
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2330
2331
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2331
2332
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -15656,6 +15657,9 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
|
|
|
15656
15657
|
es2015: [
|
|
15657
15658
|
"from",
|
|
15658
15659
|
"of"
|
|
15660
|
+
],
|
|
15661
|
+
esnext: [
|
|
15662
|
+
"fromAsync"
|
|
15659
15663
|
]
|
|
15660
15664
|
})),
|
|
15661
15665
|
ObjectConstructor: new Map(Object.entries({
|
|
@@ -38176,6 +38180,8 @@ var libEntries = [
|
|
|
38176
38180
|
["esnext.weakref", "lib.es2021.weakref.d.ts"],
|
|
38177
38181
|
["esnext.decorators", "lib.esnext.decorators.d.ts"],
|
|
38178
38182
|
["esnext.object", "lib.esnext.object.d.ts"],
|
|
38183
|
+
["esnext.array", "lib.esnext.array.d.ts"],
|
|
38184
|
+
["esnext.regexp", "lib.esnext.regexp.d.ts"],
|
|
38179
38185
|
["decorators", "lib.decorators.d.ts"],
|
|
38180
38186
|
["decorators.legacy", "lib.decorators.legacy.d.ts"]
|
|
38181
38187
|
];
|
|
@@ -51867,13 +51873,6 @@ function createTypeChecker(host) {
|
|
|
51867
51873
|
});
|
|
51868
51874
|
}
|
|
51869
51875
|
function getSymbolIfSameReference(s1, s2) {
|
|
51870
|
-
var _a, _b;
|
|
51871
|
-
if (s1.flags & 524288 /* TypeAlias */ && ((_a = s2.declarations) == null ? void 0 : _a.find(isTypeAlias))) {
|
|
51872
|
-
s2 = getDeclaredTypeOfTypeAlias(s2).aliasSymbol || s2;
|
|
51873
|
-
}
|
|
51874
|
-
if (s2.flags & 524288 /* TypeAlias */ && ((_b = s1.declarations) == null ? void 0 : _b.find(isTypeAlias))) {
|
|
51875
|
-
s1 = getDeclaredTypeOfTypeAlias(s1).aliasSymbol || s1;
|
|
51876
|
-
}
|
|
51877
51876
|
if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) {
|
|
51878
51877
|
return s1;
|
|
51879
51878
|
}
|
|
@@ -52508,6 +52507,18 @@ function createTypeChecker(host) {
|
|
|
52508
52507
|
return {
|
|
52509
52508
|
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
52510
52509
|
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
52510
|
+
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
52511
|
+
serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(
|
|
52512
|
+
context,
|
|
52513
|
+
type,
|
|
52514
|
+
symbol,
|
|
52515
|
+
enclosingDeclaration,
|
|
52516
|
+
/*includePrivateSymbol*/
|
|
52517
|
+
void 0,
|
|
52518
|
+
/*bundled*/
|
|
52519
|
+
void 0,
|
|
52520
|
+
addUndefined
|
|
52521
|
+
)),
|
|
52511
52522
|
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
52512
52523
|
indexInfo,
|
|
52513
52524
|
context,
|
|
@@ -52529,6 +52540,50 @@ function createTypeChecker(host) {
|
|
|
52529
52540
|
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker, bundled) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context, bundled)),
|
|
52530
52541
|
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
52531
52542
|
};
|
|
52543
|
+
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
52544
|
+
if (expr) {
|
|
52545
|
+
const typeNode = isAssertionExpression(expr) ? expr.type : isJSDocTypeAssertion(expr) ? getJSDocTypeAssertionType(expr) : void 0;
|
|
52546
|
+
if (typeNode && !isConstTypeReference(typeNode)) {
|
|
52547
|
+
const result = tryReuseExistingTypeNode(context, typeNode, type, expr.parent, addUndefined);
|
|
52548
|
+
if (result) {
|
|
52549
|
+
return result;
|
|
52550
|
+
}
|
|
52551
|
+
}
|
|
52552
|
+
}
|
|
52553
|
+
if (addUndefined) {
|
|
52554
|
+
type = getOptionalType(type);
|
|
52555
|
+
}
|
|
52556
|
+
return typeToTypeNodeHelper(type, context);
|
|
52557
|
+
}
|
|
52558
|
+
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined, includePrivateSymbol, bundled) {
|
|
52559
|
+
const originalType = type;
|
|
52560
|
+
if (addUndefined) {
|
|
52561
|
+
type = getOptionalType(type);
|
|
52562
|
+
}
|
|
52563
|
+
const clone2 = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2, includePrivateSymbol, bundled);
|
|
52564
|
+
if (clone2) {
|
|
52565
|
+
if (addUndefined && !someType(getTypeFromTypeNode(typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
|
|
52566
|
+
return factory.createUnionTypeNode([clone2, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
52567
|
+
}
|
|
52568
|
+
return clone2;
|
|
52569
|
+
}
|
|
52570
|
+
if (addUndefined && originalType !== type) {
|
|
52571
|
+
const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host2, includePrivateSymbol, bundled);
|
|
52572
|
+
if (cloneMissingUndefined) {
|
|
52573
|
+
return factory.createUnionTypeNode([cloneMissingUndefined, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
52574
|
+
}
|
|
52575
|
+
}
|
|
52576
|
+
return void 0;
|
|
52577
|
+
}
|
|
52578
|
+
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, includePrivateSymbol, bundled, annotationType) {
|
|
52579
|
+
if (typeNodeIsEquivalentToType(existing, host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
52580
|
+
const result = tryReuseExistingTypeNodeHelper(context, existing, includePrivateSymbol, bundled);
|
|
52581
|
+
if (result) {
|
|
52582
|
+
return result;
|
|
52583
|
+
}
|
|
52584
|
+
}
|
|
52585
|
+
return void 0;
|
|
52586
|
+
}
|
|
52532
52587
|
function symbolToNode(symbol, context, meaning) {
|
|
52533
52588
|
if (context.flags & 1073741824 /* WriteComputedProps */) {
|
|
52534
52589
|
if (symbol.valueDeclaration) {
|
|
@@ -52970,8 +53025,8 @@ function createTypeChecker(host) {
|
|
|
52970
53025
|
if (isInstantiationExpressionType) {
|
|
52971
53026
|
const instantiationExpressionType = type2;
|
|
52972
53027
|
const existing = instantiationExpressionType.node;
|
|
52973
|
-
if (isTypeQueryNode(existing)
|
|
52974
|
-
const typeNode =
|
|
53028
|
+
if (isTypeQueryNode(existing)) {
|
|
53029
|
+
const typeNode = tryReuseExistingNonParameterTypeNode(context, existing, type2);
|
|
52975
53030
|
if (typeNode) {
|
|
52976
53031
|
return typeNode;
|
|
52977
53032
|
}
|
|
@@ -53777,11 +53832,9 @@ function createTypeChecker(host) {
|
|
|
53777
53832
|
}
|
|
53778
53833
|
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) {
|
|
53779
53834
|
const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
|
|
53780
|
-
|
|
53781
|
-
|
|
53782
|
-
|
|
53783
|
-
}
|
|
53784
|
-
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
|
|
53835
|
+
const parameterType = getTypeOfSymbol(parameterSymbol);
|
|
53836
|
+
const addUndefined = parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration);
|
|
53837
|
+
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports, addUndefined);
|
|
53785
53838
|
const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
|
|
53786
53839
|
const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
53787
53840
|
const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
|
|
@@ -54371,16 +54424,15 @@ function createTypeChecker(host) {
|
|
|
54371
54424
|
}
|
|
54372
54425
|
return enclosingDeclaration;
|
|
54373
54426
|
}
|
|
54374
|
-
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
54427
|
+
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled, addUndefined) {
|
|
54428
|
+
var _a;
|
|
54375
54429
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
54376
54430
|
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
54377
54431
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
54378
54432
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
54379
|
-
|
|
54380
|
-
|
|
54381
|
-
|
|
54382
|
-
return result2;
|
|
54383
|
-
}
|
|
54433
|
+
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined, includePrivateSymbol, bundled);
|
|
54434
|
+
if (result2) {
|
|
54435
|
+
return result2;
|
|
54384
54436
|
}
|
|
54385
54437
|
}
|
|
54386
54438
|
}
|
|
@@ -54388,16 +54440,17 @@ function createTypeChecker(host) {
|
|
|
54388
54440
|
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
|
|
54389
54441
|
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
|
|
54390
54442
|
}
|
|
54391
|
-
const
|
|
54443
|
+
const decl = symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
|
54444
|
+
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
54445
|
+
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
|
|
54392
54446
|
context.flags = oldFlags;
|
|
54393
54447
|
return result;
|
|
54394
54448
|
}
|
|
54395
|
-
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
|
|
54396
|
-
const typeFromTypeNode = getTypeFromTypeNode(typeNode);
|
|
54449
|
+
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type, typeFromTypeNode = getTypeFromTypeNode(typeNode)) {
|
|
54397
54450
|
if (typeFromTypeNode === type) {
|
|
54398
54451
|
return true;
|
|
54399
54452
|
}
|
|
54400
|
-
if (isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
|
|
54453
|
+
if (annotatedDeclaration && (isParameter(annotatedDeclaration) || isPropertyDeclaration(annotatedDeclaration)) && annotatedDeclaration.questionToken) {
|
|
54401
54454
|
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
54402
54455
|
}
|
|
54403
54456
|
return false;
|
|
@@ -54409,11 +54462,9 @@ function createTypeChecker(host) {
|
|
|
54409
54462
|
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
54410
54463
|
const annotated = getTypeFromTypeNode(annotation);
|
|
54411
54464
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
54412
|
-
|
|
54413
|
-
|
|
54414
|
-
|
|
54415
|
-
return result;
|
|
54416
|
-
}
|
|
54465
|
+
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, includePrivateSymbol, bundled, thisInstantiated);
|
|
54466
|
+
if (result) {
|
|
54467
|
+
return result;
|
|
54417
54468
|
}
|
|
54418
54469
|
}
|
|
54419
54470
|
}
|
|
@@ -54442,7 +54493,9 @@ function createTypeChecker(host) {
|
|
|
54442
54493
|
/*shouldComputeAliasesToMakeVisible*/
|
|
54443
54494
|
false
|
|
54444
54495
|
).accessibility !== 0 /* Accessible */) {
|
|
54445
|
-
|
|
54496
|
+
if (!isDeclarationName(node)) {
|
|
54497
|
+
introducesError = true;
|
|
54498
|
+
}
|
|
54446
54499
|
} else {
|
|
54447
54500
|
context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
|
|
54448
54501
|
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
|
|
@@ -54456,7 +54509,7 @@ function createTypeChecker(host) {
|
|
|
54456
54509
|
}
|
|
54457
54510
|
return { introducesError, node };
|
|
54458
54511
|
}
|
|
54459
|
-
function
|
|
54512
|
+
function tryReuseExistingTypeNodeHelper(context, existing, includePrivateSymbol, bundled) {
|
|
54460
54513
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
54461
54514
|
cancellationToken.throwIfCancellationRequested();
|
|
54462
54515
|
}
|
|
@@ -54580,6 +54633,31 @@ function createTypeChecker(host) {
|
|
|
54580
54633
|
node.isTypeOf
|
|
54581
54634
|
);
|
|
54582
54635
|
}
|
|
54636
|
+
if (isParameter(node)) {
|
|
54637
|
+
if (!node.type && !node.initializer) {
|
|
54638
|
+
return factory.updateParameterDeclaration(
|
|
54639
|
+
node,
|
|
54640
|
+
/*modifiers*/
|
|
54641
|
+
void 0,
|
|
54642
|
+
node.dotDotDotToken,
|
|
54643
|
+
visitEachChild(
|
|
54644
|
+
node.name,
|
|
54645
|
+
visitExistingNodeTreeSymbols,
|
|
54646
|
+
/*context*/
|
|
54647
|
+
void 0
|
|
54648
|
+
),
|
|
54649
|
+
node.questionToken,
|
|
54650
|
+
factory.createKeywordTypeNode(133 /* AnyKeyword */),
|
|
54651
|
+
/*initializer*/
|
|
54652
|
+
void 0
|
|
54653
|
+
);
|
|
54654
|
+
}
|
|
54655
|
+
}
|
|
54656
|
+
if (isPropertySignature(node)) {
|
|
54657
|
+
if (!node.type && !node.initializer) {
|
|
54658
|
+
return factory.updatePropertySignature(node, node.modifiers, node.name, node.questionToken, factory.createKeywordTypeNode(133 /* AnyKeyword */));
|
|
54659
|
+
}
|
|
54660
|
+
}
|
|
54583
54661
|
if (isEntityName(node) || isEntityNameExpression(node)) {
|
|
54584
54662
|
const { introducesError, node: result } = trackExistingEntityName(node, context, includePrivateSymbol);
|
|
54585
54663
|
hadError = hadError || introducesError;
|
|
@@ -54587,7 +54665,7 @@ function createTypeChecker(host) {
|
|
|
54587
54665
|
return result;
|
|
54588
54666
|
}
|
|
54589
54667
|
}
|
|
54590
|
-
if (file && isTupleTypeNode(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
|
|
54668
|
+
if (file && isTupleTypeNode(node) && !nodeIsSynthesized(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
|
|
54591
54669
|
setEmitFlags(node, 1 /* SingleLine */);
|
|
54592
54670
|
}
|
|
54593
54671
|
return visitEachChild(
|
|
@@ -55111,7 +55189,15 @@ function createTypeChecker(host) {
|
|
|
55111
55189
|
context.flags |= 8388608 /* InTypeAlias */;
|
|
55112
55190
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
55113
55191
|
context.enclosingDeclaration = jsdocAliasDecl;
|
|
55114
|
-
const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) &&
|
|
55192
|
+
const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && tryReuseExistingNonParameterTypeNode(
|
|
55193
|
+
context,
|
|
55194
|
+
jsdocAliasDecl.typeExpression.type,
|
|
55195
|
+
aliasType,
|
|
55196
|
+
/*host*/
|
|
55197
|
+
void 0,
|
|
55198
|
+
includePrivateSymbol,
|
|
55199
|
+
bundled
|
|
55200
|
+
) || typeToTypeNodeHelper(aliasType, context);
|
|
55115
55201
|
addResult(
|
|
55116
55202
|
setSyntheticLeadingComments(
|
|
55117
55203
|
factory.createTypeAliasDeclaration(
|
|
@@ -55344,7 +55430,15 @@ function createTypeChecker(host) {
|
|
|
55344
55430
|
}
|
|
55345
55431
|
return cleanup(factory.createExpressionWithTypeArguments(
|
|
55346
55432
|
expr,
|
|
55347
|
-
map(e.typeArguments, (a) =>
|
|
55433
|
+
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(
|
|
55434
|
+
context,
|
|
55435
|
+
a,
|
|
55436
|
+
getTypeFromTypeNode(a),
|
|
55437
|
+
/*host*/
|
|
55438
|
+
void 0,
|
|
55439
|
+
includePrivateSymbol,
|
|
55440
|
+
bundled
|
|
55441
|
+
) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
|
|
55348
55442
|
));
|
|
55349
55443
|
function cleanup(result2) {
|
|
55350
55444
|
context.enclosingDeclaration = oldEnclosing;
|
|
@@ -55803,8 +55897,10 @@ function createTypeChecker(host) {
|
|
|
55803
55897
|
}
|
|
55804
55898
|
}
|
|
55805
55899
|
function isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, hostSymbol) {
|
|
55900
|
+
var _a2;
|
|
55806
55901
|
const ctxSrc = getSourceFileOfNode(context.enclosingDeclaration);
|
|
55807
|
-
return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !
|
|
55902
|
+
return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !some((_a2 = typeToSerialize.symbol) == null ? void 0 : _a2.declarations, isTypeNode) && // If the type comes straight from a type node, we shouldn't try to break it up
|
|
55903
|
+
!length(getIndexInfosOfType(typeToSerialize)) && !isClassInstanceSide(typeToSerialize) && // While a class instance is potentially representable as a NS, prefer printing a reference to the instance type and serializing the class
|
|
55808
55904
|
!!(length(filter(getPropertiesOfType(typeToSerialize), isNamespaceMember)) || length(getSignaturesOfType(typeToSerialize, 0 /* Call */))) && !length(getSignaturesOfType(typeToSerialize, 1 /* Construct */)) && // TODO: could probably serialize as function + ns + class, now that that's OK
|
|
55809
55905
|
!getDeclarationWithTypeAnnotation(hostSymbol, enclosingDeclaration) && !(typeToSerialize.symbol && some(typeToSerialize.symbol.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && !some(getPropertiesOfType(typeToSerialize), (p) => isLateBoundName(p.escapedName)) && !some(getPropertiesOfType(typeToSerialize), (p) => some(p.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && every(getPropertiesOfType(typeToSerialize), (p) => {
|
|
55810
55906
|
if (!isIdentifierText(symbolName(p), languageVersion)) {
|
|
@@ -59678,13 +59774,16 @@ function createTypeChecker(host) {
|
|
|
59678
59774
|
const constraint = getConstraintTypeFromMappedType(type);
|
|
59679
59775
|
if (constraint.flags & 4194304 /* Index */) {
|
|
59680
59776
|
const baseConstraint = getBaseConstraintOfType(constraint.type);
|
|
59681
|
-
if (baseConstraint && everyType(baseConstraint, isArrayOrTupleType)) {
|
|
59777
|
+
if (baseConstraint && everyType(baseConstraint, (t) => isArrayOrTupleType(t) || isArrayOrTupleOrIntersection(t))) {
|
|
59682
59778
|
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
|
|
59683
59779
|
}
|
|
59684
59780
|
}
|
|
59685
59781
|
}
|
|
59686
59782
|
return type;
|
|
59687
59783
|
}
|
|
59784
|
+
function isArrayOrTupleOrIntersection(type) {
|
|
59785
|
+
return !!(type.flags & 2097152 /* Intersection */) && every(type.types, isArrayOrTupleType);
|
|
59786
|
+
}
|
|
59688
59787
|
function isMappedTypeGenericIndexedAccess(type) {
|
|
59689
59788
|
let objectType;
|
|
59690
59789
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
@@ -64076,29 +64175,28 @@ function createTypeChecker(host) {
|
|
|
64076
64175
|
if (typeVariable) {
|
|
64077
64176
|
const mappedTypeVariable = instantiateType(typeVariable, mapper);
|
|
64078
64177
|
if (typeVariable !== mappedTypeVariable) {
|
|
64079
|
-
return mapTypeWithAlias(
|
|
64080
|
-
getReducedType(mappedTypeVariable),
|
|
64081
|
-
(t) => {
|
|
64082
|
-
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
64083
|
-
if (!type.declaration.nameType) {
|
|
64084
|
-
let constraint;
|
|
64085
|
-
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
64086
|
-
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
64087
|
-
}
|
|
64088
|
-
if (isTupleType(t)) {
|
|
64089
|
-
return instantiateMappedTupleType(t, type, typeVariable, mapper);
|
|
64090
|
-
}
|
|
64091
|
-
}
|
|
64092
|
-
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
64093
|
-
}
|
|
64094
|
-
return t;
|
|
64095
|
-
},
|
|
64096
|
-
aliasSymbol,
|
|
64097
|
-
aliasTypeArguments
|
|
64098
|
-
);
|
|
64178
|
+
return mapTypeWithAlias(getReducedType(mappedTypeVariable), instantiateConstituent, aliasSymbol, aliasTypeArguments);
|
|
64099
64179
|
}
|
|
64100
64180
|
}
|
|
64101
64181
|
return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments);
|
|
64182
|
+
function instantiateConstituent(t) {
|
|
64183
|
+
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
64184
|
+
if (!type.declaration.nameType) {
|
|
64185
|
+
let constraint;
|
|
64186
|
+
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
64187
|
+
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
64188
|
+
}
|
|
64189
|
+
if (isTupleType(t)) {
|
|
64190
|
+
return instantiateMappedTupleType(t, type, typeVariable, mapper);
|
|
64191
|
+
}
|
|
64192
|
+
if (isArrayOrTupleOrIntersection(t)) {
|
|
64193
|
+
return getIntersectionType(map(t.types, instantiateConstituent));
|
|
64194
|
+
}
|
|
64195
|
+
}
|
|
64196
|
+
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
64197
|
+
}
|
|
64198
|
+
return t;
|
|
64199
|
+
}
|
|
64102
64200
|
}
|
|
64103
64201
|
function getModifiedReadonlyState(state, modifiers) {
|
|
64104
64202
|
return modifiers & 1 /* IncludeReadonly */ ? true : modifiers & 2 /* ExcludeReadonly */ ? false : state;
|
|
@@ -69001,7 +69099,9 @@ function createTypeChecker(host) {
|
|
|
69001
69099
|
return false;
|
|
69002
69100
|
}
|
|
69003
69101
|
function inferTypesFromTemplateLiteralType(source, target) {
|
|
69004
|
-
return source.flags & 128 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arraysEqual(source.texts, target.texts) ? map(source.types,
|
|
69102
|
+
return source.flags & 128 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arraysEqual(source.texts, target.texts) ? map(source.types, (s, i) => {
|
|
69103
|
+
return isTypeAssignableTo(getBaseConstraintOrType(s), getBaseConstraintOrType(target.types[i])) ? s : getStringLikeTypeForType(s);
|
|
69104
|
+
}) : inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) : void 0;
|
|
69005
69105
|
}
|
|
69006
69106
|
function isTypeMatchedByTemplateLiteralType(source, target) {
|
|
69007
69107
|
const inferences = inferTypesFromTemplateLiteralType(source, target);
|
|
@@ -85183,7 +85283,7 @@ function createTypeChecker(host) {
|
|
|
85183
85283
|
error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
85184
85284
|
} else {
|
|
85185
85285
|
const text = getTextOfPropertyName(member.name);
|
|
85186
|
-
if (isNumericLiteralName(text)) {
|
|
85286
|
+
if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
|
|
85187
85287
|
error2(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
|
|
85188
85288
|
}
|
|
85189
85289
|
}
|
|
@@ -87634,14 +87734,34 @@ function createTypeChecker(host) {
|
|
|
87634
87734
|
return factory.createToken(133 /* AnyKeyword */);
|
|
87635
87735
|
}
|
|
87636
87736
|
const symbol = getSymbolOfDeclaration(declaration);
|
|
87637
|
-
|
|
87638
|
-
|
|
87639
|
-
|
|
87640
|
-
|
|
87641
|
-
|
|
87642
|
-
|
|
87737
|
+
const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
|
|
87738
|
+
return nodeBuilder.serializeTypeForDeclaration(type, symbol, addUndefined, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
87739
|
+
}
|
|
87740
|
+
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
87741
|
+
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
87742
|
+
}
|
|
87743
|
+
function getPossibleTypeNodeReuseExpression(declaration) {
|
|
87744
|
+
var _a;
|
|
87745
|
+
return isFunctionLike(declaration) && !isSetAccessor(declaration) ? getSingleReturnExpression(declaration) : isExportAssignment(declaration) ? declaration.expression : !!declaration.initializer ? declaration.initializer : isParameter(declaration) && isSetAccessor(declaration.parent) ? getSingleReturnExpression(getAllAccessorDeclarations((_a = getSymbolOfDeclaration(declaration.parent)) == null ? void 0 : _a.declarations, declaration.parent).getAccessor) : void 0;
|
|
87746
|
+
}
|
|
87747
|
+
function getSingleReturnExpression(declaration) {
|
|
87748
|
+
let candidateExpr;
|
|
87749
|
+
if (declaration && !nodeIsMissing(declaration.body)) {
|
|
87750
|
+
const body = declaration.body;
|
|
87751
|
+
if (body && isBlock(body)) {
|
|
87752
|
+
forEachReturnStatement(body, (s) => {
|
|
87753
|
+
if (!candidateExpr) {
|
|
87754
|
+
candidateExpr = s.expression;
|
|
87755
|
+
} else {
|
|
87756
|
+
candidateExpr = void 0;
|
|
87757
|
+
return true;
|
|
87758
|
+
}
|
|
87759
|
+
});
|
|
87760
|
+
} else {
|
|
87761
|
+
candidateExpr = body;
|
|
87762
|
+
}
|
|
87643
87763
|
}
|
|
87644
|
-
return
|
|
87764
|
+
return candidateExpr;
|
|
87645
87765
|
}
|
|
87646
87766
|
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
|
|
87647
87767
|
const signatureDeclaration = getParseTreeNode(signatureDeclarationIn, isFunctionLike);
|
|
@@ -87653,7 +87773,15 @@ function createTypeChecker(host) {
|
|
|
87653
87773
|
if (typePredicate) {
|
|
87654
87774
|
return nodeBuilder.typePredicateToTypePredicateNode(typePredicate, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
87655
87775
|
}
|
|
87656
|
-
return nodeBuilder.
|
|
87776
|
+
return nodeBuilder.expressionOrTypeToTypeNode(
|
|
87777
|
+
getPossibleTypeNodeReuseExpression(signatureDeclaration),
|
|
87778
|
+
getReturnTypeOfSignature(signature),
|
|
87779
|
+
/*addUndefined*/
|
|
87780
|
+
void 0,
|
|
87781
|
+
enclosingDeclaration,
|
|
87782
|
+
flags | 1024 /* MultilineObjectLiterals */,
|
|
87783
|
+
tracker
|
|
87784
|
+
);
|
|
87657
87785
|
}
|
|
87658
87786
|
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
|
|
87659
87787
|
const expr = getParseTreeNode(exprIn, isExpression);
|
|
@@ -87661,7 +87789,15 @@ function createTypeChecker(host) {
|
|
|
87661
87789
|
return factory.createToken(133 /* AnyKeyword */);
|
|
87662
87790
|
}
|
|
87663
87791
|
const type = getWidenedType(getRegularTypeOfExpression(expr));
|
|
87664
|
-
return nodeBuilder.
|
|
87792
|
+
return nodeBuilder.expressionOrTypeToTypeNode(
|
|
87793
|
+
expr,
|
|
87794
|
+
type,
|
|
87795
|
+
/*addUndefined*/
|
|
87796
|
+
void 0,
|
|
87797
|
+
enclosingDeclaration,
|
|
87798
|
+
flags | 1024 /* MultilineObjectLiterals */,
|
|
87799
|
+
tracker
|
|
87800
|
+
);
|
|
87665
87801
|
}
|
|
87666
87802
|
function hasGlobalName(name) {
|
|
87667
87803
|
return globals.has(escapeLeadingUnderscores(name));
|
|
@@ -113368,10 +113504,10 @@ function transformDeclarations(context) {
|
|
|
113368
113504
|
return newFile;
|
|
113369
113505
|
}
|
|
113370
113506
|
needsDeclare = true;
|
|
113371
|
-
const
|
|
113507
|
+
const updated = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(sourceFile)) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
|
|
113372
113508
|
return factory2.updateSourceFile(
|
|
113373
113509
|
sourceFile,
|
|
113374
|
-
transformAndReplaceLatePaintedStatements(
|
|
113510
|
+
transformAndReplaceLatePaintedStatements(updated),
|
|
113375
113511
|
/*isDeclarationFile*/
|
|
113376
113512
|
true,
|
|
113377
113513
|
/*referencedFiles*/
|
|
@@ -113435,7 +113571,7 @@ function transformDeclarations(context) {
|
|
|
113435
113571
|
combinedStatements = setTextRange(factory2.createNodeArray([...combinedStatements, createEmptyExports(factory2)]), combinedStatements);
|
|
113436
113572
|
}
|
|
113437
113573
|
}
|
|
113438
|
-
|
|
113574
|
+
return factory2.updateSourceFile(
|
|
113439
113575
|
node,
|
|
113440
113576
|
combinedStatements,
|
|
113441
113577
|
/*isDeclarationFile*/
|
|
@@ -113445,8 +113581,6 @@ function transformDeclarations(context) {
|
|
|
113445
113581
|
node.hasNoDefaultLib,
|
|
113446
113582
|
getLibReferences()
|
|
113447
113583
|
);
|
|
113448
|
-
updated.exportedModulesFromDeclarationEmit = exportedModulesFromDeclarationEmit;
|
|
113449
|
-
return updated;
|
|
113450
113584
|
function getLibReferences() {
|
|
113451
113585
|
return arrayFrom(libs2.keys(), (lib) => ({ fileName: lib, pos: -1, end: -1 }));
|
|
113452
113586
|
}
|
|
@@ -124816,6 +124950,12 @@ function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationTo
|
|
|
124816
124950
|
outputFiles.push({ name: fileName, writeByteOrderMark, text });
|
|
124817
124951
|
}
|
|
124818
124952
|
}
|
|
124953
|
+
var SignatureInfo = /* @__PURE__ */ ((SignatureInfo2) => {
|
|
124954
|
+
SignatureInfo2[SignatureInfo2["ComputedDts"] = 0] = "ComputedDts";
|
|
124955
|
+
SignatureInfo2[SignatureInfo2["StoredSignatureAtEmit"] = 1] = "StoredSignatureAtEmit";
|
|
124956
|
+
SignatureInfo2[SignatureInfo2["UsedVersion"] = 2] = "UsedVersion";
|
|
124957
|
+
return SignatureInfo2;
|
|
124958
|
+
})(SignatureInfo || {});
|
|
124819
124959
|
var BuilderState;
|
|
124820
124960
|
((BuilderState2) => {
|
|
124821
124961
|
function createManyToManyPathMap() {
|
|
@@ -124953,12 +125093,11 @@ var BuilderState;
|
|
|
124953
125093
|
}
|
|
124954
125094
|
BuilderState2.canReuseOldState = canReuseOldState;
|
|
124955
125095
|
function create(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
124956
|
-
var _a, _b
|
|
125096
|
+
var _a, _b;
|
|
124957
125097
|
const fileInfos = /* @__PURE__ */ new Map();
|
|
124958
125098
|
const options = newProgram.getCompilerOptions();
|
|
124959
125099
|
const isOutFile = options.outFile;
|
|
124960
125100
|
const referencedMap = options.module !== 0 /* None */ && !isOutFile ? createManyToManyPathMap() : void 0;
|
|
124961
|
-
const exportedModulesMap = referencedMap ? createManyToManyPathMap() : void 0;
|
|
124962
125101
|
const useOldState = canReuseOldState(referencedMap, oldState);
|
|
124963
125102
|
newProgram.getTypeChecker();
|
|
124964
125103
|
for (const sourceFile of newProgram.getSourceFiles()) {
|
|
@@ -124970,13 +125109,6 @@ var BuilderState;
|
|
|
124970
125109
|
if (newReferences) {
|
|
124971
125110
|
referencedMap.set(sourceFile.resolvedPath, newReferences);
|
|
124972
125111
|
}
|
|
124973
|
-
if (useOldState) {
|
|
124974
|
-
const oldUncommittedExportedModules = (_c = oldState.oldExportedModulesMap) == null ? void 0 : _c.get(sourceFile.resolvedPath);
|
|
124975
|
-
const exportedModules = oldUncommittedExportedModules === void 0 ? oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) : oldUncommittedExportedModules || void 0;
|
|
124976
|
-
if (exportedModules) {
|
|
124977
|
-
exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
|
|
124978
|
-
}
|
|
124979
|
-
}
|
|
124980
125112
|
}
|
|
124981
125113
|
fileInfos.set(sourceFile.resolvedPath, {
|
|
124982
125114
|
version: version2,
|
|
@@ -124989,7 +125121,6 @@ var BuilderState;
|
|
|
124989
125121
|
return {
|
|
124990
125122
|
fileInfos,
|
|
124991
125123
|
referencedMap,
|
|
124992
|
-
exportedModulesMap,
|
|
124993
125124
|
useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
|
|
124994
125125
|
};
|
|
124995
125126
|
}
|
|
@@ -125000,7 +125131,7 @@ var BuilderState;
|
|
|
125000
125131
|
}
|
|
125001
125132
|
BuilderState2.releaseCache = releaseCache2;
|
|
125002
125133
|
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, host) {
|
|
125003
|
-
var _a
|
|
125134
|
+
var _a;
|
|
125004
125135
|
const result = getFilesAffectedByWithOldState(
|
|
125005
125136
|
state,
|
|
125006
125137
|
programOfThisState,
|
|
@@ -125009,7 +125140,6 @@ var BuilderState;
|
|
|
125009
125140
|
host
|
|
125010
125141
|
);
|
|
125011
125142
|
(_a = state.oldSignatures) == null ? void 0 : _a.clear();
|
|
125012
|
-
(_b = state.oldExportedModulesMap) == null ? void 0 : _b.clear();
|
|
125013
125143
|
return result;
|
|
125014
125144
|
}
|
|
125015
125145
|
BuilderState2.getFilesAffectedBy = getFilesAffectedBy;
|
|
@@ -125063,24 +125193,16 @@ var BuilderState;
|
|
|
125063
125193
|
const prevSignature = info.signature;
|
|
125064
125194
|
let latestSignature;
|
|
125065
125195
|
if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
|
|
125066
|
-
computeDtsSignature(programOfThisState, sourceFile, cancellationToken, host, (signature
|
|
125196
|
+
computeDtsSignature(programOfThisState, sourceFile, cancellationToken, host, (signature) => {
|
|
125067
125197
|
latestSignature = signature;
|
|
125068
|
-
if (
|
|
125069
|
-
|
|
125070
|
-
}
|
|
125198
|
+
if (host.storeSignatureInfo)
|
|
125199
|
+
(state.signatureInfo ?? (state.signatureInfo = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, 0 /* ComputedDts */);
|
|
125071
125200
|
});
|
|
125072
125201
|
}
|
|
125073
125202
|
if (latestSignature === void 0) {
|
|
125074
125203
|
latestSignature = sourceFile.version;
|
|
125075
|
-
if (
|
|
125076
|
-
(state.
|
|
125077
|
-
const references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : void 0;
|
|
125078
|
-
if (references) {
|
|
125079
|
-
state.exportedModulesMap.set(sourceFile.resolvedPath, references);
|
|
125080
|
-
} else {
|
|
125081
|
-
state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
|
|
125082
|
-
}
|
|
125083
|
-
}
|
|
125204
|
+
if (host.storeSignatureInfo)
|
|
125205
|
+
(state.signatureInfo ?? (state.signatureInfo = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, 2 /* UsedVersion */);
|
|
125084
125206
|
}
|
|
125085
125207
|
(state.oldSignatures || (state.oldSignatures = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, prevSignature || false);
|
|
125086
125208
|
(state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = /* @__PURE__ */ new Set())).add(sourceFile.resolvedPath);
|
|
@@ -125088,28 +125210,6 @@ var BuilderState;
|
|
|
125088
125210
|
return latestSignature !== prevSignature;
|
|
125089
125211
|
}
|
|
125090
125212
|
BuilderState2.updateShapeSignature = updateShapeSignature;
|
|
125091
|
-
function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
|
|
125092
|
-
if (!state.exportedModulesMap)
|
|
125093
|
-
return;
|
|
125094
|
-
(state.oldExportedModulesMap || (state.oldExportedModulesMap = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
|
|
125095
|
-
const exportedModules = getExportedModules(exportedModulesFromDeclarationEmit);
|
|
125096
|
-
if (exportedModules) {
|
|
125097
|
-
state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
|
|
125098
|
-
} else {
|
|
125099
|
-
state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
|
|
125100
|
-
}
|
|
125101
|
-
}
|
|
125102
|
-
BuilderState2.updateExportedModules = updateExportedModules;
|
|
125103
|
-
function getExportedModules(exportedModulesFromDeclarationEmit) {
|
|
125104
|
-
let exportedModules;
|
|
125105
|
-
exportedModulesFromDeclarationEmit == null ? void 0 : exportedModulesFromDeclarationEmit.forEach(
|
|
125106
|
-
(symbol) => getReferencedFilesFromImportedModuleSymbol(symbol).forEach(
|
|
125107
|
-
(path) => (exportedModules ?? (exportedModules = /* @__PURE__ */ new Set())).add(path)
|
|
125108
|
-
)
|
|
125109
|
-
);
|
|
125110
|
-
return exportedModules;
|
|
125111
|
-
}
|
|
125112
|
-
BuilderState2.getExportedModules = getExportedModules;
|
|
125113
125213
|
function getAllDependencies(state, programOfThisState, sourceFile) {
|
|
125114
125214
|
const compilerOptions = programOfThisState.getCompilerOptions();
|
|
125115
125215
|
if (compilerOptions.outFile) {
|
|
@@ -125484,7 +125584,7 @@ function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
|
|
|
125484
125584
|
Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
|
|
125485
125585
|
}
|
|
125486
125586
|
function getNextAffectedFile(state, cancellationToken, host) {
|
|
125487
|
-
var _a
|
|
125587
|
+
var _a;
|
|
125488
125588
|
while (true) {
|
|
125489
125589
|
const { affectedFiles } = state;
|
|
125490
125590
|
if (affectedFiles) {
|
|
@@ -125508,7 +125608,6 @@ function getNextAffectedFile(state, cancellationToken, host) {
|
|
|
125508
125608
|
state.changedFilesSet.delete(state.currentChangedFilePath);
|
|
125509
125609
|
state.currentChangedFilePath = void 0;
|
|
125510
125610
|
(_a = state.oldSignatures) == null ? void 0 : _a.clear();
|
|
125511
|
-
(_b = state.oldExportedModulesMap) == null ? void 0 : _b.clear();
|
|
125512
125611
|
state.affectedFiles = void 0;
|
|
125513
125612
|
}
|
|
125514
125613
|
const nextKey = state.changedFilesSet.keys().next();
|
|
@@ -125669,7 +125768,7 @@ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, hos
|
|
|
125669
125768
|
}
|
|
125670
125769
|
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
125671
125770
|
var _a;
|
|
125672
|
-
if (!state.
|
|
125771
|
+
if (!state.referencedMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
125673
125772
|
return;
|
|
125674
125773
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
125675
125774
|
return;
|
|
@@ -125692,7 +125791,7 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
|
|
|
125692
125791
|
}
|
|
125693
125792
|
}
|
|
125694
125793
|
const seenFileAndExportsOfFile = /* @__PURE__ */ new Set();
|
|
125695
|
-
(_a = state.
|
|
125794
|
+
(_a = state.referencedMap.getKeys(affectedFile.resolvedPath)) == null ? void 0 : _a.forEach((exportedFromPath) => {
|
|
125696
125795
|
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host))
|
|
125697
125796
|
return true;
|
|
125698
125797
|
const references = state.referencedMap.getKeys(exportedFromPath);
|
|
@@ -125706,27 +125805,17 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
|
|
|
125706
125805
|
});
|
|
125707
125806
|
}
|
|
125708
125807
|
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
|
|
125709
|
-
var _a
|
|
125808
|
+
var _a;
|
|
125710
125809
|
if (!tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
125711
125810
|
return void 0;
|
|
125712
125811
|
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host))
|
|
125713
125812
|
return true;
|
|
125714
125813
|
handleDtsMayChangeOf(state, filePath, cancellationToken, host);
|
|
125715
|
-
(_a = state.
|
|
125716
|
-
(
|
|
125717
|
-
state,
|
|
125718
|
-
exportedFromPath,
|
|
125719
|
-
seenFileAndExportsOfFile,
|
|
125720
|
-
cancellationToken,
|
|
125721
|
-
host
|
|
125722
|
-
)
|
|
125723
|
-
);
|
|
125724
|
-
(_b = state.referencedMap.getKeys(filePath)) == null ? void 0 : _b.forEach(
|
|
125725
|
-
(referencingFilePath) => !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
|
|
125726
|
-
handleDtsMayChangeOf(
|
|
125727
|
-
// Dont add to seen since this is not yet done with the export removal
|
|
125814
|
+
(_a = state.referencedMap.getKeys(filePath)) == null ? void 0 : _a.forEach(
|
|
125815
|
+
(referencingFilePath) => handleDtsMayChangeOfFileAndExportsOfFile(
|
|
125728
125816
|
state,
|
|
125729
125817
|
referencingFilePath,
|
|
125818
|
+
seenFileAndExportsOfFile,
|
|
125730
125819
|
cancellationToken,
|
|
125731
125820
|
host
|
|
125732
125821
|
)
|
|
@@ -125841,18 +125930,6 @@ function getBuildInfo2(state) {
|
|
|
125841
125930
|
toFileIdListId(state.referencedMap.getValues(key))
|
|
125842
125931
|
]);
|
|
125843
125932
|
}
|
|
125844
|
-
let exportedModulesMap;
|
|
125845
|
-
if (state.exportedModulesMap) {
|
|
125846
|
-
exportedModulesMap = mapDefined(arrayFrom(state.exportedModulesMap.keys()).sort(compareStringsCaseSensitive), (key) => {
|
|
125847
|
-
var _a2;
|
|
125848
|
-
const oldValue = (_a2 = state.oldExportedModulesMap) == null ? void 0 : _a2.get(key);
|
|
125849
|
-
if (oldValue === void 0)
|
|
125850
|
-
return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
|
|
125851
|
-
if (oldValue)
|
|
125852
|
-
return [toFileId(key), toFileIdListId(oldValue)];
|
|
125853
|
-
return void 0;
|
|
125854
|
-
});
|
|
125855
|
-
}
|
|
125856
125933
|
const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.semanticDiagnosticsPerFile);
|
|
125857
125934
|
let affectedFilesPendingEmit;
|
|
125858
125935
|
if ((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size) {
|
|
@@ -125891,7 +125968,6 @@ function getBuildInfo2(state) {
|
|
|
125891
125968
|
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
|
|
125892
125969
|
fileIdsList,
|
|
125893
125970
|
referencedMap,
|
|
125894
|
-
exportedModulesMap,
|
|
125895
125971
|
semanticDiagnosticsPerFile,
|
|
125896
125972
|
emitDiagnosticsPerFile,
|
|
125897
125973
|
affectedFilesPendingEmit,
|
|
@@ -126211,7 +126287,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
126211
126287
|
if (!getEmitDeclarations(state.compilerOptions))
|
|
126212
126288
|
return writeFile2 || maybeBind(host, host.writeFile);
|
|
126213
126289
|
return (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
|
|
126214
|
-
var _a, _b, _c
|
|
126290
|
+
var _a, _b, _c;
|
|
126215
126291
|
if (isDeclarationFileName(fileName)) {
|
|
126216
126292
|
if (!state.compilerOptions.outFile) {
|
|
126217
126293
|
Debug.assert((sourceFiles == null ? void 0 : sourceFiles.length) === 1);
|
|
@@ -126230,10 +126306,8 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
126230
126306
|
if (!((_a = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a.length))
|
|
126231
126307
|
emitSignature = signature;
|
|
126232
126308
|
if (signature !== file.version) {
|
|
126233
|
-
if (host.
|
|
126234
|
-
(state.
|
|
126235
|
-
if (state.exportedModulesMap)
|
|
126236
|
-
BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
|
|
126309
|
+
if (host.storeSignatureInfo)
|
|
126310
|
+
(state.signatureInfo ?? (state.signatureInfo = /* @__PURE__ */ new Map())).set(file.resolvedPath, 1 /* StoredSignatureAtEmit */);
|
|
126237
126311
|
if (state.affectedFiles) {
|
|
126238
126312
|
const existing = (_b = state.oldSignatures) == null ? void 0 : _b.get(file.resolvedPath);
|
|
126239
126313
|
if (existing === void 0)
|
|
@@ -126241,14 +126315,13 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
126241
126315
|
info.signature = signature;
|
|
126242
126316
|
} else {
|
|
126243
126317
|
info.signature = signature;
|
|
126244
|
-
(_c = state.oldExportedModulesMap) == null ? void 0 : _c.clear();
|
|
126245
126318
|
}
|
|
126246
126319
|
}
|
|
126247
126320
|
}
|
|
126248
126321
|
}
|
|
126249
126322
|
if (state.compilerOptions.composite) {
|
|
126250
126323
|
const filePath = sourceFiles[0].resolvedPath;
|
|
126251
|
-
emitSignature = handleNewSignature((
|
|
126324
|
+
emitSignature = handleNewSignature((_c = state.emitSignatures) == null ? void 0 : _c.get(filePath), emitSignature);
|
|
126252
126325
|
if (!emitSignature)
|
|
126253
126326
|
return;
|
|
126254
126327
|
(state.emitSignatures ?? (state.emitSignatures = /* @__PURE__ */ new Map())).set(filePath, emitSignature);
|
|
@@ -126440,7 +126513,6 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
126440
126513
|
fileInfos,
|
|
126441
126514
|
compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
126442
126515
|
referencedMap: toManyToManyPathMap(program.referencedMap),
|
|
126443
|
-
exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
|
|
126444
126516
|
semanticDiagnosticsPerFile: toPerFileDiagnostics(program.semanticDiagnosticsPerFile),
|
|
126445
126517
|
emitDiagnosticsPerFile: toPerFileDiagnostics(program.emitDiagnosticsPerFile),
|
|
126446
126518
|
hasReusableDiagnostic: true,
|
|
@@ -128110,7 +128182,7 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
|
|
|
128110
128182
|
getEnvironmentVariable: maybeBind(host, host.getEnvironmentVariable) || (() => ""),
|
|
128111
128183
|
createHash: maybeBind(host, host.createHash),
|
|
128112
128184
|
readDirectory: maybeBind(host, host.readDirectory),
|
|
128113
|
-
|
|
128185
|
+
storeSignatureInfo: host.storeSignatureInfo,
|
|
128114
128186
|
jsDocParsingMode: host.jsDocParsingMode
|
|
128115
128187
|
};
|
|
128116
128188
|
return compilerHost;
|
|
@@ -128177,7 +128249,7 @@ function createProgramHost(system, createProgram2) {
|
|
|
128177
128249
|
writeFile: (path, data, writeByteOrderMark) => system.writeFile(path, data, writeByteOrderMark),
|
|
128178
128250
|
createHash: maybeBind(system, system.createHash),
|
|
128179
128251
|
createProgram: createProgram2 || createEmitAndSemanticDiagnosticsBuilderProgram,
|
|
128180
|
-
|
|
128252
|
+
storeSignatureInfo: system.storeSignatureInfo,
|
|
128181
128253
|
now: maybeBind(system, system.now)
|
|
128182
128254
|
};
|
|
128183
128255
|
}
|
|
@@ -128283,7 +128355,7 @@ function createIncrementalCompilerHost(options, system = sys) {
|
|
|
128283
128355
|
system
|
|
128284
128356
|
);
|
|
128285
128357
|
host.createHash = maybeBind(system, system.createHash);
|
|
128286
|
-
host.
|
|
128358
|
+
host.storeSignatureInfo = system.storeSignatureInfo;
|
|
128287
128359
|
setGetSourceFileAsHashVersioned(host);
|
|
128288
128360
|
changeCompilerHostLikeToUseCache(host, (fileName) => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName));
|
|
128289
128361
|
return host;
|
|
@@ -139133,15 +139205,25 @@ registerRefactor(refactorName3, {
|
|
|
139133
139205
|
extractToTypeDefAction.kind
|
|
139134
139206
|
],
|
|
139135
139207
|
getAvailableActions: function getRefactorActionsToExtractType(context) {
|
|
139136
|
-
const info = getRangeToExtract(context, context.triggerReason === "invoked");
|
|
139208
|
+
const { info, affectedTextRange } = getRangeToExtract(context, context.triggerReason === "invoked");
|
|
139137
139209
|
if (!info)
|
|
139138
139210
|
return emptyArray;
|
|
139139
139211
|
if (!isRefactorErrorInfo(info)) {
|
|
139140
|
-
|
|
139212
|
+
const refactorInfo = [{
|
|
139141
139213
|
name: refactorName3,
|
|
139142
139214
|
description: getLocaleSpecificMessage(Diagnostics.Extract_type),
|
|
139143
139215
|
actions: info.isJS ? [extractToTypeDefAction] : append([extractToTypeAliasAction], info.typeElements && extractToInterfaceAction)
|
|
139144
139216
|
}];
|
|
139217
|
+
return refactorInfo.map((info2) => ({
|
|
139218
|
+
...info2,
|
|
139219
|
+
actions: info2.actions.map((action) => ({
|
|
139220
|
+
...action,
|
|
139221
|
+
range: affectedTextRange ? {
|
|
139222
|
+
start: { line: getLineAndCharacterOfPosition(context.file, affectedTextRange.pos).line, offset: getLineAndCharacterOfPosition(context.file, affectedTextRange.pos).character },
|
|
139223
|
+
end: { line: getLineAndCharacterOfPosition(context.file, affectedTextRange.end).line, offset: getLineAndCharacterOfPosition(context.file, affectedTextRange.end).character }
|
|
139224
|
+
} : void 0
|
|
139225
|
+
}))
|
|
139226
|
+
}));
|
|
139145
139227
|
}
|
|
139146
139228
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
139147
139229
|
return [{
|
|
@@ -139158,7 +139240,7 @@ registerRefactor(refactorName3, {
|
|
|
139158
139240
|
},
|
|
139159
139241
|
getEditsForAction: function getRefactorEditsToExtractType(context, actionName2) {
|
|
139160
139242
|
const { file } = context;
|
|
139161
|
-
const info = getRangeToExtract(context);
|
|
139243
|
+
const { info } = getRangeToExtract(context);
|
|
139162
139244
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected to find a range to extract");
|
|
139163
139245
|
const name = getUniqueName("NewType", file);
|
|
139164
139246
|
const edits = ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
@@ -139194,14 +139276,14 @@ function getRangeToExtract(context, considerEmptySpans = true) {
|
|
|
139194
139276
|
const isCursorRequest = range.pos === range.end && considerEmptySpans;
|
|
139195
139277
|
const firstType = getFirstTypeAt(file, startPosition, range, isCursorRequest);
|
|
139196
139278
|
if (!firstType || !isTypeNode(firstType))
|
|
139197
|
-
return { error: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_type_node) };
|
|
139279
|
+
return { info: { error: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_type_node) }, affectedTextRange: void 0 };
|
|
139198
139280
|
const checker = context.program.getTypeChecker();
|
|
139199
139281
|
const enclosingNode = getEnclosingNode(firstType, isJS);
|
|
139200
139282
|
if (enclosingNode === void 0)
|
|
139201
|
-
return { error: getLocaleSpecificMessage(Diagnostics.No_type_could_be_extracted_from_this_type_node) };
|
|
139283
|
+
return { info: { error: getLocaleSpecificMessage(Diagnostics.No_type_could_be_extracted_from_this_type_node) }, affectedTextRange: void 0 };
|
|
139202
139284
|
const expandedFirstType = getExpandedSelectionNode(firstType, enclosingNode);
|
|
139203
139285
|
if (!isTypeNode(expandedFirstType))
|
|
139204
|
-
return { error: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_type_node) };
|
|
139286
|
+
return { info: { error: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_type_node) }, affectedTextRange: void 0 };
|
|
139205
139287
|
const typeList = [];
|
|
139206
139288
|
if ((isUnionTypeNode(expandedFirstType.parent) || isIntersectionTypeNode(expandedFirstType.parent)) && range.end > firstType.end) {
|
|
139207
139289
|
addRange(
|
|
@@ -139212,11 +139294,11 @@ function getRangeToExtract(context, considerEmptySpans = true) {
|
|
|
139212
139294
|
);
|
|
139213
139295
|
}
|
|
139214
139296
|
const selection = typeList.length > 1 ? typeList : expandedFirstType;
|
|
139215
|
-
const typeParameters = collectTypeParameters(checker, selection, enclosingNode, file);
|
|
139297
|
+
const { typeParameters, affectedTextRange } = collectTypeParameters(checker, selection, enclosingNode, file);
|
|
139216
139298
|
if (!typeParameters)
|
|
139217
|
-
return { error: getLocaleSpecificMessage(Diagnostics.No_type_could_be_extracted_from_this_type_node) };
|
|
139299
|
+
return { info: { error: getLocaleSpecificMessage(Diagnostics.No_type_could_be_extracted_from_this_type_node) }, affectedTextRange: void 0 };
|
|
139218
139300
|
const typeElements = flattenTypeLiteralNodeReference(checker, selection);
|
|
139219
|
-
return { isJS, selection, enclosingNode, typeParameters, typeElements };
|
|
139301
|
+
return { info: { isJS, selection, enclosingNode, typeParameters, typeElements }, affectedTextRange };
|
|
139220
139302
|
}
|
|
139221
139303
|
function getFirstTypeAt(file, startPosition, range, isCursorRequest) {
|
|
139222
139304
|
const currentNodes = [
|
|
@@ -139270,12 +139352,12 @@ function rangeContainsSkipTrivia(r1, node, file) {
|
|
|
139270
139352
|
function collectTypeParameters(checker, selection, enclosingNode, file) {
|
|
139271
139353
|
const result = [];
|
|
139272
139354
|
const selectionArray = toArray(selection);
|
|
139273
|
-
const selectionRange = { pos: selectionArray[0].
|
|
139355
|
+
const selectionRange = { pos: selectionArray[0].getStart(file), end: selectionArray[selectionArray.length - 1].end };
|
|
139274
139356
|
for (const t of selectionArray) {
|
|
139275
139357
|
if (visitor(t))
|
|
139276
|
-
return void 0;
|
|
139358
|
+
return { typeParameters: void 0, affectedTextRange: void 0 };
|
|
139277
139359
|
}
|
|
139278
|
-
return result;
|
|
139360
|
+
return { typeParameters: result, affectedTextRange: selectionRange };
|
|
139279
139361
|
function visitor(node) {
|
|
139280
139362
|
if (isTypeReferenceNode(node)) {
|
|
139281
139363
|
if (isIdentifier(node.typeName)) {
|
|
@@ -139641,7 +139723,12 @@ registerRefactor(refactorName5, {
|
|
|
139641
139723
|
getAvailableActions: function getRefactorActionsToMoveToNewFile(context) {
|
|
139642
139724
|
const statements = getStatementsToMove(context);
|
|
139643
139725
|
if (context.preferences.allowTextChangesInNewFiles && statements) {
|
|
139644
|
-
|
|
139726
|
+
const file = context.file;
|
|
139727
|
+
const affectedTextRange = {
|
|
139728
|
+
start: { line: getLineAndCharacterOfPosition(file, statements.all[0].getStart(file)).line, offset: getLineAndCharacterOfPosition(file, statements.all[0].getStart(file)).character },
|
|
139729
|
+
end: { line: getLineAndCharacterOfPosition(file, last(statements.all).end).line, offset: getLineAndCharacterOfPosition(file, last(statements.all).end).character }
|
|
139730
|
+
};
|
|
139731
|
+
return [{ name: refactorName5, description, actions: [{ ...moveToNewFileAction, range: affectedTextRange }] }];
|
|
139645
139732
|
}
|
|
139646
139733
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
139647
139734
|
return [{ name: refactorName5, description, actions: [{ ...moveToNewFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }] }];
|
|
@@ -139747,12 +139834,12 @@ var moveToFileAction = {
|
|
|
139747
139834
|
registerRefactor(refactorNameForMoveToFile, {
|
|
139748
139835
|
kinds: [moveToFileAction.kind],
|
|
139749
139836
|
getAvailableActions: function getRefactorActionsToMoveToFile(context, interactiveRefactorArguments) {
|
|
139837
|
+
const file = context.file;
|
|
139750
139838
|
const statements = getStatementsToMove(context);
|
|
139751
139839
|
if (!interactiveRefactorArguments) {
|
|
139752
139840
|
return emptyArray;
|
|
139753
139841
|
}
|
|
139754
139842
|
if (context.endPosition !== void 0) {
|
|
139755
|
-
const file = context.file;
|
|
139756
139843
|
const startNodeAncestor = findAncestor(getTokenAtPosition(file, context.startPosition), isBlockLike);
|
|
139757
139844
|
const endNodeAncestor = findAncestor(getTokenAtPosition(file, context.endPosition), isBlockLike);
|
|
139758
139845
|
if (startNodeAncestor && !isSourceFile(startNodeAncestor) && endNodeAncestor && !isSourceFile(endNodeAncestor)) {
|
|
@@ -139760,7 +139847,11 @@ registerRefactor(refactorNameForMoveToFile, {
|
|
|
139760
139847
|
}
|
|
139761
139848
|
}
|
|
139762
139849
|
if (context.preferences.allowTextChangesInNewFiles && statements) {
|
|
139763
|
-
|
|
139850
|
+
const affectedTextRange = {
|
|
139851
|
+
start: { line: getLineAndCharacterOfPosition(file, statements.all[0].getStart(file)).line, offset: getLineAndCharacterOfPosition(file, statements.all[0].getStart(file)).character },
|
|
139852
|
+
end: { line: getLineAndCharacterOfPosition(file, last(statements.all).end).line, offset: getLineAndCharacterOfPosition(file, last(statements.all).end).character }
|
|
139853
|
+
};
|
|
139854
|
+
return [{ name: refactorNameForMoveToFile, description: description2, actions: [{ ...moveToFileAction, range: affectedTextRange }] }];
|
|
139764
139855
|
}
|
|
139765
139856
|
if (context.preferences.provideRefactorNotApplicableReason) {
|
|
139766
139857
|
return [{ name: refactorNameForMoveToFile, description: description2, actions: [{ ...moveToFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }] }];
|
|
@@ -142318,7 +142409,7 @@ function getRefactorActionsToExtractSymbol(context) {
|
|
|
142318
142409
|
}
|
|
142319
142410
|
return errors;
|
|
142320
142411
|
}
|
|
142321
|
-
const extractions = getPossibleExtractions(targetRange, context);
|
|
142412
|
+
const { affectedTextRange, extractions } = getPossibleExtractions(targetRange, context);
|
|
142322
142413
|
if (extractions === void 0) {
|
|
142323
142414
|
return emptyArray;
|
|
142324
142415
|
}
|
|
@@ -142338,7 +142429,11 @@ function getRefactorActionsToExtractSymbol(context) {
|
|
|
142338
142429
|
functionActions.push({
|
|
142339
142430
|
description: description3,
|
|
142340
142431
|
name: `function_scope_${i}`,
|
|
142341
|
-
kind: extractFunctionAction.kind
|
|
142432
|
+
kind: extractFunctionAction.kind,
|
|
142433
|
+
range: {
|
|
142434
|
+
start: { line: getLineAndCharacterOfPosition(context.file, affectedTextRange.pos).line, offset: getLineAndCharacterOfPosition(context.file, affectedTextRange.pos).character },
|
|
142435
|
+
end: { line: getLineAndCharacterOfPosition(context.file, affectedTextRange.end).line, offset: getLineAndCharacterOfPosition(context.file, affectedTextRange.end).character }
|
|
142436
|
+
}
|
|
142342
142437
|
});
|
|
142343
142438
|
}
|
|
142344
142439
|
} else if (!innermostErrorFunctionAction) {
|
|
@@ -142358,7 +142453,11 @@ function getRefactorActionsToExtractSymbol(context) {
|
|
|
142358
142453
|
constantActions.push({
|
|
142359
142454
|
description: description3,
|
|
142360
142455
|
name: `constant_scope_${i}`,
|
|
142361
|
-
kind: extractConstantAction.kind
|
|
142456
|
+
kind: extractConstantAction.kind,
|
|
142457
|
+
range: {
|
|
142458
|
+
start: { line: getLineAndCharacterOfPosition(context.file, affectedTextRange.pos).line, offset: getLineAndCharacterOfPosition(context.file, affectedTextRange.pos).character },
|
|
142459
|
+
end: { line: getLineAndCharacterOfPosition(context.file, affectedTextRange.end).line, offset: getLineAndCharacterOfPosition(context.file, affectedTextRange.end).character }
|
|
142460
|
+
}
|
|
142362
142461
|
});
|
|
142363
142462
|
}
|
|
142364
142463
|
} else if (!innermostErrorConstantAction) {
|
|
@@ -142797,7 +142896,7 @@ function getConstantExtractionAtIndex(targetRange, context, requestedChangesInde
|
|
|
142797
142896
|
return extractConstantInScope(expression, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], targetRange.facts, context);
|
|
142798
142897
|
}
|
|
142799
142898
|
function getPossibleExtractions(targetRange, context) {
|
|
142800
|
-
const { scopes, readsAndWrites: { functionErrorsPerScope, constantErrorsPerScope } } = getPossibleExtractionsWorker(targetRange, context);
|
|
142899
|
+
const { scopes, affectedTextRange, readsAndWrites: { functionErrorsPerScope, constantErrorsPerScope } } = getPossibleExtractionsWorker(targetRange, context);
|
|
142801
142900
|
const extractions = scopes.map((scope, i) => {
|
|
142802
142901
|
const functionDescriptionPart = getDescriptionForFunctionInScope(scope);
|
|
142803
142902
|
const constantDescriptionPart = getDescriptionForConstantInScope(scope);
|
|
@@ -142828,7 +142927,7 @@ function getPossibleExtractions(targetRange, context) {
|
|
|
142828
142927
|
}
|
|
142829
142928
|
};
|
|
142830
142929
|
});
|
|
142831
|
-
return extractions;
|
|
142930
|
+
return { affectedTextRange, extractions };
|
|
142832
142931
|
}
|
|
142833
142932
|
function getPossibleExtractionsWorker(targetRange, context) {
|
|
142834
142933
|
const { file: sourceFile } = context;
|
|
@@ -142842,7 +142941,7 @@ function getPossibleExtractionsWorker(targetRange, context) {
|
|
|
142842
142941
|
context.program.getTypeChecker(),
|
|
142843
142942
|
context.cancellationToken
|
|
142844
142943
|
);
|
|
142845
|
-
return { scopes, readsAndWrites };
|
|
142944
|
+
return { scopes, affectedTextRange: enclosingTextRange, readsAndWrites };
|
|
142846
142945
|
}
|
|
142847
142946
|
function getDescriptionForFunctionInScope(scope) {
|
|
142848
142947
|
return isFunctionLikeDeclaration(scope) ? "inner function" : isClassLike(scope) ? "method" : "function";
|
|
@@ -173559,6 +173658,7 @@ __export(ts_exports2, {
|
|
|
173559
173658
|
SignatureCheckMode: () => SignatureCheckMode,
|
|
173560
173659
|
SignatureFlags: () => SignatureFlags,
|
|
173561
173660
|
SignatureHelp: () => ts_SignatureHelp_exports,
|
|
173661
|
+
SignatureInfo: () => SignatureInfo,
|
|
173562
173662
|
SignatureKind: () => SignatureKind,
|
|
173563
173663
|
SmartSelectionRange: () => ts_SmartSelectionRange_exports,
|
|
173564
173664
|
SnippetKind: () => SnippetKind,
|
|
@@ -186056,7 +186156,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
186056
186156
|
getApplicableRefactors(args) {
|
|
186057
186157
|
const { file, project } = this.getFileAndProject(args);
|
|
186058
186158
|
const scriptInfo = project.getScriptInfoForNormalizedPath(file);
|
|
186059
|
-
|
|
186159
|
+
const result = project.getLanguageService().getApplicableRefactors(file, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file), args.triggerReason, args.kind, args.includeInteractiveActions);
|
|
186160
|
+
return result.map((result2) => ({ ...result2, actions: result2.actions.map((action) => ({ ...action, range: action.range ? { start: convertToLocation({ line: action.range.start.line, character: action.range.start.offset }), end: convertToLocation({ line: action.range.end.line, character: action.range.end.offset }) } : void 0 })) }));
|
|
186060
186161
|
}
|
|
186061
186162
|
getEditsForRefactor(args, simplifiedResult) {
|
|
186062
186163
|
const { file, project } = this.getFileAndProject(args);
|
|
@@ -187759,6 +187860,7 @@ if (typeof console !== "undefined") {
|
|
|
187759
187860
|
SignatureCheckMode,
|
|
187760
187861
|
SignatureFlags,
|
|
187761
187862
|
SignatureHelp,
|
|
187863
|
+
SignatureInfo,
|
|
187762
187864
|
SignatureKind,
|
|
187763
187865
|
SmartSelectionRange,
|
|
187764
187866
|
SnippetKind,
|