@typescript-deploys/pr-build 5.1.0-pr-54216-5 → 5.2.0-pr-54290-7
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 +54 -21
- package/lib/tsserver.js +126 -23
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +127 -23
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +127 -23
- package/lib/typingsInstaller.js +2 -2
- package/package.json +3 -5
package/lib/tsc.js
CHANGED
|
@@ -17,8 +17,8 @@ and limitations under the License.
|
|
|
17
17
|
"use strict";
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
|
-
var versionMajorMinor = "5.
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
20
|
+
var versionMajorMinor = "5.2";
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230517`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -12194,7 +12194,7 @@ function isCommonJSContainingModuleKind(kind) {
|
|
|
12194
12194
|
return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
|
|
12195
12195
|
}
|
|
12196
12196
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
12197
|
-
return isExternalModule(node) ||
|
|
12197
|
+
return isExternalModule(node) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
|
|
12198
12198
|
}
|
|
12199
12199
|
function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
12200
12200
|
switch (node.scriptKind) {
|
|
@@ -54156,7 +54156,35 @@ function createTypeChecker(host) {
|
|
|
54156
54156
|
return emptyArray;
|
|
54157
54157
|
}
|
|
54158
54158
|
function getSignaturesOfType(type, kind) {
|
|
54159
|
-
|
|
54159
|
+
const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
|
|
54160
|
+
if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
|
|
54161
|
+
if (type.arrayFallbackSignatures) {
|
|
54162
|
+
return type.arrayFallbackSignatures;
|
|
54163
|
+
}
|
|
54164
|
+
let memberName;
|
|
54165
|
+
if (everyType(type, (t) => {
|
|
54166
|
+
var _a;
|
|
54167
|
+
return !!((_a = t.symbol) == null ? void 0 : _a.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
|
|
54168
|
+
})) {
|
|
54169
|
+
const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
|
|
54170
|
+
const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
|
|
54171
|
+
return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
|
|
54172
|
+
}
|
|
54173
|
+
type.arrayFallbackSignatures = result;
|
|
54174
|
+
}
|
|
54175
|
+
return result;
|
|
54176
|
+
}
|
|
54177
|
+
function isArrayOrTupleSymbol(symbol) {
|
|
54178
|
+
if (!symbol || !globalArrayType.symbol || !globalReadonlyArrayType.symbol) {
|
|
54179
|
+
return false;
|
|
54180
|
+
}
|
|
54181
|
+
return !!getSymbolIfSameReference(symbol, globalArrayType.symbol) || !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
54182
|
+
}
|
|
54183
|
+
function isReadonlyArraySymbol(symbol) {
|
|
54184
|
+
if (!symbol || !globalReadonlyArrayType.symbol) {
|
|
54185
|
+
return false;
|
|
54186
|
+
}
|
|
54187
|
+
return !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
54160
54188
|
}
|
|
54161
54189
|
function findIndexInfo(indexInfos, keyType) {
|
|
54162
54190
|
return find(indexInfos, (info) => info.keyType === keyType);
|
|
@@ -67010,6 +67038,7 @@ function createTypeChecker(host) {
|
|
|
67010
67038
|
case 9 /* NumericLiteral */:
|
|
67011
67039
|
case 10 /* BigIntLiteral */:
|
|
67012
67040
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
67041
|
+
case 227 /* TemplateExpression */:
|
|
67013
67042
|
case 112 /* TrueKeyword */:
|
|
67014
67043
|
case 97 /* FalseKeyword */:
|
|
67015
67044
|
case 106 /* NullKeyword */:
|
|
@@ -69642,7 +69671,7 @@ function createTypeChecker(host) {
|
|
|
69642
69671
|
}
|
|
69643
69672
|
const typeArgument = typeArgumentTypes[i];
|
|
69644
69673
|
if (!checkTypeAssignableTo(
|
|
69645
|
-
typeArgument,
|
|
69674
|
+
getTypeWithThisArgument(typeArgument, typeArgument),
|
|
69646
69675
|
getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument),
|
|
69647
69676
|
reportErrors2 ? typeArgumentNodes[i] : void 0,
|
|
69648
69677
|
typeArgumentHeadMessage,
|
|
@@ -69676,8 +69705,9 @@ function createTypeChecker(host) {
|
|
|
69676
69705
|
void 0,
|
|
69677
69706
|
checkMode
|
|
69678
69707
|
);
|
|
69708
|
+
const checkAttributesType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(attributesType) : attributesType;
|
|
69679
69709
|
return checkTagNameDoesNotExpectTooManyArguments() && checkTypeRelatedToAndOptionallyElaborate(
|
|
69680
|
-
|
|
69710
|
+
checkAttributesType,
|
|
69681
69711
|
paramType,
|
|
69682
69712
|
relation,
|
|
69683
69713
|
reportErrors2 ? node.tagName : void 0,
|
|
@@ -71417,6 +71447,8 @@ function createTypeChecker(host) {
|
|
|
71417
71447
|
}
|
|
71418
71448
|
return getRegularTypeOfLiteralType(exprType);
|
|
71419
71449
|
}
|
|
71450
|
+
const links = getNodeLinks(node);
|
|
71451
|
+
links.assertionExpressionType = exprType;
|
|
71420
71452
|
checkSourceElement(type);
|
|
71421
71453
|
checkNodeDeferred(node);
|
|
71422
71454
|
return getTypeFromTypeNode(type);
|
|
@@ -71438,9 +71470,11 @@ function createTypeChecker(host) {
|
|
|
71438
71470
|
return { type, expression };
|
|
71439
71471
|
}
|
|
71440
71472
|
function checkAssertionDeferred(node) {
|
|
71441
|
-
const { type
|
|
71473
|
+
const { type } = getAssertionTypeAndExpression(node);
|
|
71442
71474
|
const errNode = isParenthesizedExpression(node) ? type : node;
|
|
71443
|
-
const
|
|
71475
|
+
const links = getNodeLinks(node);
|
|
71476
|
+
Debug.assertIsDefined(links.assertionExpressionType);
|
|
71477
|
+
const exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(links.assertionExpressionType));
|
|
71444
71478
|
const targetType = getTypeFromTypeNode(type);
|
|
71445
71479
|
if (!isErrorType(targetType)) {
|
|
71446
71480
|
addLazyDiagnostic(() => {
|
|
@@ -73807,11 +73841,15 @@ function createTypeChecker(host) {
|
|
|
73807
73841
|
texts.push(span.literal.text);
|
|
73808
73842
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
73809
73843
|
}
|
|
73810
|
-
|
|
73844
|
+
if (isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(
|
|
73811
73845
|
node,
|
|
73812
73846
|
/*contextFlags*/
|
|
73813
73847
|
void 0
|
|
73814
|
-
) || unknownType, isTemplateLiteralContextualType)
|
|
73848
|
+
) || unknownType, isTemplateLiteralContextualType)) {
|
|
73849
|
+
return getTemplateLiteralType(texts, types);
|
|
73850
|
+
}
|
|
73851
|
+
const evaluated = node.parent.kind !== 214 /* TaggedTemplateExpression */ && evaluateTemplateExpression(node);
|
|
73852
|
+
return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
|
|
73815
73853
|
}
|
|
73816
73854
|
function isTemplateLiteralContextualType(type) {
|
|
73817
73855
|
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
@@ -78789,11 +78827,11 @@ function createTypeChecker(host) {
|
|
|
78789
78827
|
);
|
|
78790
78828
|
if (symbol) {
|
|
78791
78829
|
if (symbol.flags & 8 /* EnumMember */) {
|
|
78792
|
-
return evaluateEnumMember(expr, symbol, location);
|
|
78830
|
+
return location ? evaluateEnumMember(expr, symbol, location) : getEnumMemberValue(symbol.valueDeclaration);
|
|
78793
78831
|
}
|
|
78794
78832
|
if (isConstVariable(symbol)) {
|
|
78795
78833
|
const declaration = symbol.valueDeclaration;
|
|
78796
|
-
if (declaration && !declaration.type && declaration.initializer && declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
78834
|
+
if (declaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
|
|
78797
78835
|
return evaluate(declaration.initializer, declaration);
|
|
78798
78836
|
}
|
|
78799
78837
|
}
|
|
@@ -78813,7 +78851,7 @@ function createTypeChecker(host) {
|
|
|
78813
78851
|
const name = escapeLeadingUnderscores(expr.argumentExpression.text);
|
|
78814
78852
|
const member = rootSymbol.exports.get(name);
|
|
78815
78853
|
if (member) {
|
|
78816
|
-
return evaluateEnumMember(expr, member, location);
|
|
78854
|
+
return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
|
|
78817
78855
|
}
|
|
78818
78856
|
}
|
|
78819
78857
|
}
|
|
@@ -113000,8 +113038,7 @@ function createCompilerHostWorker(options, setParentNodes, system = sys) {
|
|
|
113000
113038
|
realpath,
|
|
113001
113039
|
readDirectory: (path, extensions, include, exclude, depth) => system.readDirectory(path, extensions, include, exclude, depth),
|
|
113002
113040
|
createDirectory: (d) => system.createDirectory(d),
|
|
113003
|
-
createHash: maybeBind(system, system.createHash)
|
|
113004
|
-
useSourceOfProjectReferenceRedirect: (projectReferences) => (projectReferences == null ? void 0 : projectReferences.some((x) => x.circular)) || false
|
|
113041
|
+
createHash: maybeBind(system, system.createHash)
|
|
113005
113042
|
};
|
|
113006
113043
|
return compilerHost;
|
|
113007
113044
|
}
|
|
@@ -113773,7 +113810,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
113773
113810
|
let projectReferenceRedirects;
|
|
113774
113811
|
let mapFromFileToProjectReferenceRedirects;
|
|
113775
113812
|
let mapFromToProjectReferenceRedirectSource;
|
|
113776
|
-
const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host
|
|
113813
|
+
const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host)) && !options.disableSourceOfProjectReferenceRedirect;
|
|
113777
113814
|
const { onProgramCreateComplete, fileExists, directoryExists } = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
113778
113815
|
compilerHost: host,
|
|
113779
113816
|
getSymlinkCache,
|
|
@@ -120066,8 +120103,7 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
|
|
|
120066
120103
|
getEnvironmentVariable: maybeBind(host, host.getEnvironmentVariable) || (() => ""),
|
|
120067
120104
|
createHash: maybeBind(host, host.createHash),
|
|
120068
120105
|
readDirectory: maybeBind(host, host.readDirectory),
|
|
120069
|
-
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
120070
|
-
useSourceOfProjectReferenceRedirect: (projectReferences) => (projectReferences == null ? void 0 : projectReferences.some((x) => x.circular)) || false
|
|
120106
|
+
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
120071
120107
|
};
|
|
120072
120108
|
return compilerHost;
|
|
120073
120109
|
}
|
|
@@ -121206,9 +121242,6 @@ function createBuildOrder(state, roots) {
|
|
|
121206
121242
|
const parsed = parseConfigFile(state, configFileName, projPath);
|
|
121207
121243
|
if (parsed && parsed.projectReferences) {
|
|
121208
121244
|
for (const ref of parsed.projectReferences) {
|
|
121209
|
-
if (ref.circular) {
|
|
121210
|
-
continue;
|
|
121211
|
-
}
|
|
121212
121245
|
const resolvedRefPath = resolveProjectName(state, ref.path);
|
|
121213
121246
|
visit(resolvedRefPath, inCircularContext || ref.circular);
|
|
121214
121247
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -2303,8 +2303,8 @@ __export(server_exports, {
|
|
|
2303
2303
|
module.exports = __toCommonJS(server_exports);
|
|
2304
2304
|
|
|
2305
2305
|
// src/compiler/corePublic.ts
|
|
2306
|
-
var versionMajorMinor = "5.
|
|
2307
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2306
|
+
var versionMajorMinor = "5.2";
|
|
2307
|
+
var version = `${versionMajorMinor}.0-insiders.20230517`;
|
|
2308
2308
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2309
2309
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2310
2310
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -15958,7 +15958,7 @@ function isCommonJSContainingModuleKind(kind) {
|
|
|
15958
15958
|
return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
|
|
15959
15959
|
}
|
|
15960
15960
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
15961
|
-
return isExternalModule(node) ||
|
|
15961
|
+
return isExternalModule(node) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
|
|
15962
15962
|
}
|
|
15963
15963
|
function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
15964
15964
|
switch (node.scriptKind) {
|
|
@@ -58807,7 +58807,35 @@ function createTypeChecker(host) {
|
|
|
58807
58807
|
return emptyArray;
|
|
58808
58808
|
}
|
|
58809
58809
|
function getSignaturesOfType(type, kind) {
|
|
58810
|
-
|
|
58810
|
+
const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
|
|
58811
|
+
if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
|
|
58812
|
+
if (type.arrayFallbackSignatures) {
|
|
58813
|
+
return type.arrayFallbackSignatures;
|
|
58814
|
+
}
|
|
58815
|
+
let memberName;
|
|
58816
|
+
if (everyType(type, (t) => {
|
|
58817
|
+
var _a;
|
|
58818
|
+
return !!((_a = t.symbol) == null ? void 0 : _a.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
|
|
58819
|
+
})) {
|
|
58820
|
+
const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
|
|
58821
|
+
const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
|
|
58822
|
+
return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
|
|
58823
|
+
}
|
|
58824
|
+
type.arrayFallbackSignatures = result;
|
|
58825
|
+
}
|
|
58826
|
+
return result;
|
|
58827
|
+
}
|
|
58828
|
+
function isArrayOrTupleSymbol(symbol) {
|
|
58829
|
+
if (!symbol || !globalArrayType.symbol || !globalReadonlyArrayType.symbol) {
|
|
58830
|
+
return false;
|
|
58831
|
+
}
|
|
58832
|
+
return !!getSymbolIfSameReference(symbol, globalArrayType.symbol) || !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
58833
|
+
}
|
|
58834
|
+
function isReadonlyArraySymbol(symbol) {
|
|
58835
|
+
if (!symbol || !globalReadonlyArrayType.symbol) {
|
|
58836
|
+
return false;
|
|
58837
|
+
}
|
|
58838
|
+
return !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
58811
58839
|
}
|
|
58812
58840
|
function findIndexInfo(indexInfos, keyType) {
|
|
58813
58841
|
return find(indexInfos, (info) => info.keyType === keyType);
|
|
@@ -71661,6 +71689,7 @@ function createTypeChecker(host) {
|
|
|
71661
71689
|
case 9 /* NumericLiteral */:
|
|
71662
71690
|
case 10 /* BigIntLiteral */:
|
|
71663
71691
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
71692
|
+
case 227 /* TemplateExpression */:
|
|
71664
71693
|
case 112 /* TrueKeyword */:
|
|
71665
71694
|
case 97 /* FalseKeyword */:
|
|
71666
71695
|
case 106 /* NullKeyword */:
|
|
@@ -74293,7 +74322,7 @@ function createTypeChecker(host) {
|
|
|
74293
74322
|
}
|
|
74294
74323
|
const typeArgument = typeArgumentTypes[i];
|
|
74295
74324
|
if (!checkTypeAssignableTo(
|
|
74296
|
-
typeArgument,
|
|
74325
|
+
getTypeWithThisArgument(typeArgument, typeArgument),
|
|
74297
74326
|
getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument),
|
|
74298
74327
|
reportErrors2 ? typeArgumentNodes[i] : void 0,
|
|
74299
74328
|
typeArgumentHeadMessage,
|
|
@@ -74327,8 +74356,9 @@ function createTypeChecker(host) {
|
|
|
74327
74356
|
void 0,
|
|
74328
74357
|
checkMode
|
|
74329
74358
|
);
|
|
74359
|
+
const checkAttributesType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(attributesType) : attributesType;
|
|
74330
74360
|
return checkTagNameDoesNotExpectTooManyArguments() && checkTypeRelatedToAndOptionallyElaborate(
|
|
74331
|
-
|
|
74361
|
+
checkAttributesType,
|
|
74332
74362
|
paramType,
|
|
74333
74363
|
relation,
|
|
74334
74364
|
reportErrors2 ? node.tagName : void 0,
|
|
@@ -76068,6 +76098,8 @@ function createTypeChecker(host) {
|
|
|
76068
76098
|
}
|
|
76069
76099
|
return getRegularTypeOfLiteralType(exprType);
|
|
76070
76100
|
}
|
|
76101
|
+
const links = getNodeLinks(node);
|
|
76102
|
+
links.assertionExpressionType = exprType;
|
|
76071
76103
|
checkSourceElement(type);
|
|
76072
76104
|
checkNodeDeferred(node);
|
|
76073
76105
|
return getTypeFromTypeNode(type);
|
|
@@ -76089,9 +76121,11 @@ function createTypeChecker(host) {
|
|
|
76089
76121
|
return { type, expression };
|
|
76090
76122
|
}
|
|
76091
76123
|
function checkAssertionDeferred(node) {
|
|
76092
|
-
const { type
|
|
76124
|
+
const { type } = getAssertionTypeAndExpression(node);
|
|
76093
76125
|
const errNode = isParenthesizedExpression(node) ? type : node;
|
|
76094
|
-
const
|
|
76126
|
+
const links = getNodeLinks(node);
|
|
76127
|
+
Debug.assertIsDefined(links.assertionExpressionType);
|
|
76128
|
+
const exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(links.assertionExpressionType));
|
|
76095
76129
|
const targetType = getTypeFromTypeNode(type);
|
|
76096
76130
|
if (!isErrorType(targetType)) {
|
|
76097
76131
|
addLazyDiagnostic(() => {
|
|
@@ -78458,11 +78492,15 @@ function createTypeChecker(host) {
|
|
|
78458
78492
|
texts.push(span.literal.text);
|
|
78459
78493
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
78460
78494
|
}
|
|
78461
|
-
|
|
78495
|
+
if (isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType2(
|
|
78462
78496
|
node,
|
|
78463
78497
|
/*contextFlags*/
|
|
78464
78498
|
void 0
|
|
78465
|
-
) || unknownType, isTemplateLiteralContextualType)
|
|
78499
|
+
) || unknownType, isTemplateLiteralContextualType)) {
|
|
78500
|
+
return getTemplateLiteralType(texts, types);
|
|
78501
|
+
}
|
|
78502
|
+
const evaluated = node.parent.kind !== 214 /* TaggedTemplateExpression */ && evaluateTemplateExpression(node);
|
|
78503
|
+
return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
|
|
78466
78504
|
}
|
|
78467
78505
|
function isTemplateLiteralContextualType(type) {
|
|
78468
78506
|
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
@@ -83440,11 +83478,11 @@ function createTypeChecker(host) {
|
|
|
83440
83478
|
);
|
|
83441
83479
|
if (symbol) {
|
|
83442
83480
|
if (symbol.flags & 8 /* EnumMember */) {
|
|
83443
|
-
return evaluateEnumMember(expr, symbol, location);
|
|
83481
|
+
return location ? evaluateEnumMember(expr, symbol, location) : getEnumMemberValue(symbol.valueDeclaration);
|
|
83444
83482
|
}
|
|
83445
83483
|
if (isConstVariable(symbol)) {
|
|
83446
83484
|
const declaration = symbol.valueDeclaration;
|
|
83447
|
-
if (declaration && !declaration.type && declaration.initializer && declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
83485
|
+
if (declaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
|
|
83448
83486
|
return evaluate(declaration.initializer, declaration);
|
|
83449
83487
|
}
|
|
83450
83488
|
}
|
|
@@ -83464,7 +83502,7 @@ function createTypeChecker(host) {
|
|
|
83464
83502
|
const name = escapeLeadingUnderscores(expr.argumentExpression.text);
|
|
83465
83503
|
const member = rootSymbol.exports.get(name);
|
|
83466
83504
|
if (member) {
|
|
83467
|
-
return evaluateEnumMember(expr, member, location);
|
|
83505
|
+
return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
|
|
83468
83506
|
}
|
|
83469
83507
|
}
|
|
83470
83508
|
}
|
|
@@ -117856,8 +117894,7 @@ function createCompilerHostWorker(options, setParentNodes, system = sys) {
|
|
|
117856
117894
|
realpath,
|
|
117857
117895
|
readDirectory: (path, extensions, include, exclude, depth) => system.readDirectory(path, extensions, include, exclude, depth),
|
|
117858
117896
|
createDirectory: (d) => system.createDirectory(d),
|
|
117859
|
-
createHash: maybeBind(system, system.createHash)
|
|
117860
|
-
useSourceOfProjectReferenceRedirect: (projectReferences) => (projectReferences == null ? void 0 : projectReferences.some((x) => x.circular)) || false
|
|
117897
|
+
createHash: maybeBind(system, system.createHash)
|
|
117861
117898
|
};
|
|
117862
117899
|
return compilerHost;
|
|
117863
117900
|
}
|
|
@@ -118660,7 +118697,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118660
118697
|
let projectReferenceRedirects;
|
|
118661
118698
|
let mapFromFileToProjectReferenceRedirects;
|
|
118662
118699
|
let mapFromToProjectReferenceRedirectSource;
|
|
118663
|
-
const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host
|
|
118700
|
+
const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host)) && !options.disableSourceOfProjectReferenceRedirect;
|
|
118664
118701
|
const { onProgramCreateComplete, fileExists, directoryExists } = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
118665
118702
|
compilerHost: host,
|
|
118666
118703
|
getSymlinkCache,
|
|
@@ -124988,8 +125025,7 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
|
|
|
124988
125025
|
getEnvironmentVariable: maybeBind(host, host.getEnvironmentVariable) || (() => ""),
|
|
124989
125026
|
createHash: maybeBind(host, host.createHash),
|
|
124990
125027
|
readDirectory: maybeBind(host, host.readDirectory),
|
|
124991
|
-
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
124992
|
-
useSourceOfProjectReferenceRedirect: (projectReferences) => (projectReferences == null ? void 0 : projectReferences.some((x) => x.circular)) || false
|
|
125028
|
+
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
124993
125029
|
};
|
|
124994
125030
|
return compilerHost;
|
|
124995
125031
|
}
|
|
@@ -126174,9 +126210,6 @@ function createBuildOrder(state, roots) {
|
|
|
126174
126210
|
const parsed = parseConfigFile(state, configFileName, projPath);
|
|
126175
126211
|
if (parsed && parsed.projectReferences) {
|
|
126176
126212
|
for (const ref of parsed.projectReferences) {
|
|
126177
|
-
if (ref.circular) {
|
|
126178
|
-
continue;
|
|
126179
|
-
}
|
|
126180
126213
|
const resolvedRefPath = resolveProjectName(state, ref.path);
|
|
126181
126214
|
visit(resolvedRefPath, inCircularContext || ref.circular);
|
|
126182
126215
|
}
|
|
@@ -162070,6 +162103,76 @@ function getReferenceAtPosition(sourceFile, position, program) {
|
|
|
162070
162103
|
}
|
|
162071
162104
|
return void 0;
|
|
162072
162105
|
}
|
|
162106
|
+
var typesWithUnwrappedTypeArguments = /* @__PURE__ */ new Set([
|
|
162107
|
+
"Array",
|
|
162108
|
+
"ArrayLike",
|
|
162109
|
+
"ReadonlyArray",
|
|
162110
|
+
"Promise",
|
|
162111
|
+
"PromiseLike",
|
|
162112
|
+
"Iterable",
|
|
162113
|
+
"IterableIterator",
|
|
162114
|
+
"AsyncIterable",
|
|
162115
|
+
"Set",
|
|
162116
|
+
"WeakSet",
|
|
162117
|
+
"ReadonlySet",
|
|
162118
|
+
"Map",
|
|
162119
|
+
"WeakMap",
|
|
162120
|
+
"ReadonlyMap",
|
|
162121
|
+
"Partial",
|
|
162122
|
+
"Required",
|
|
162123
|
+
"Readonly",
|
|
162124
|
+
"Pick",
|
|
162125
|
+
"Omit"
|
|
162126
|
+
]);
|
|
162127
|
+
function shouldUnwrapFirstTypeArgumentTypeDefinitionFromTypeReference(typeChecker, type) {
|
|
162128
|
+
const referenceName = type.symbol.name;
|
|
162129
|
+
if (!typesWithUnwrappedTypeArguments.has(referenceName)) {
|
|
162130
|
+
return false;
|
|
162131
|
+
}
|
|
162132
|
+
const globalType = typeChecker.resolveName(
|
|
162133
|
+
referenceName,
|
|
162134
|
+
/*location*/
|
|
162135
|
+
void 0,
|
|
162136
|
+
788968 /* Type */,
|
|
162137
|
+
/*excludeGlobals*/
|
|
162138
|
+
false
|
|
162139
|
+
);
|
|
162140
|
+
return !!globalType && globalType === type.target.symbol;
|
|
162141
|
+
}
|
|
162142
|
+
function shouldUnwrapFirstTypeArgumentTypeDefinitionFromAlias(typeChecker, type) {
|
|
162143
|
+
if (!type.aliasSymbol) {
|
|
162144
|
+
return false;
|
|
162145
|
+
}
|
|
162146
|
+
const referenceName = type.aliasSymbol.name;
|
|
162147
|
+
if (!typesWithUnwrappedTypeArguments.has(referenceName)) {
|
|
162148
|
+
return false;
|
|
162149
|
+
}
|
|
162150
|
+
const globalType = typeChecker.resolveName(
|
|
162151
|
+
referenceName,
|
|
162152
|
+
/*location*/
|
|
162153
|
+
void 0,
|
|
162154
|
+
788968 /* Type */,
|
|
162155
|
+
/*excludeGlobals*/
|
|
162156
|
+
false
|
|
162157
|
+
);
|
|
162158
|
+
return !!globalType && globalType === type.aliasSymbol;
|
|
162159
|
+
}
|
|
162160
|
+
function getFirstTypeArgumentDefinitions(typeChecker, type, node, failedAliasResolution) {
|
|
162161
|
+
var _a, _b;
|
|
162162
|
+
if (!!(getObjectFlags(type) & 4 /* Reference */) && shouldUnwrapFirstTypeArgumentTypeDefinitionFromTypeReference(typeChecker, type)) {
|
|
162163
|
+
return definitionFromType(typeChecker.getTypeArguments(type)[0], typeChecker, node, failedAliasResolution);
|
|
162164
|
+
}
|
|
162165
|
+
if (shouldUnwrapFirstTypeArgumentTypeDefinitionFromAlias(typeChecker, type) && type.aliasTypeArguments) {
|
|
162166
|
+
return definitionFromType(type.aliasTypeArguments[0], typeChecker, node, failedAliasResolution);
|
|
162167
|
+
}
|
|
162168
|
+
if (getObjectFlags(type) & 32 /* Mapped */ && type.target && shouldUnwrapFirstTypeArgumentTypeDefinitionFromAlias(typeChecker, type.target)) {
|
|
162169
|
+
const declaration = (_b = (_a = type.aliasSymbol) == null ? void 0 : _a.declarations) == null ? void 0 : _b[0];
|
|
162170
|
+
if (declaration && isTypeAliasDeclaration(declaration) && isTypeReferenceNode(declaration.type) && declaration.type.typeArguments) {
|
|
162171
|
+
return definitionFromType(typeChecker.getTypeAtLocation(declaration.type.typeArguments[0]), typeChecker, node, failedAliasResolution);
|
|
162172
|
+
}
|
|
162173
|
+
}
|
|
162174
|
+
return [];
|
|
162175
|
+
}
|
|
162073
162176
|
function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) {
|
|
162074
162177
|
const node = getTouchingPropertyName(sourceFile, position);
|
|
162075
162178
|
if (node === sourceFile) {
|
|
@@ -162095,8 +162198,8 @@ function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) {
|
|
|
162095
162198
|
const typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
162096
162199
|
const returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
|
|
162097
162200
|
const fromReturnType = returnType && definitionFromType(returnType, typeChecker, node, failedAliasResolution);
|
|
162098
|
-
const typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node, failedAliasResolution);
|
|
162099
|
-
return typeDefinitions.length ? typeDefinitions : !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, skipAlias(symbol, typeChecker), node, failedAliasResolution) : void 0;
|
|
162201
|
+
const [resolvedType, typeDefinitions] = fromReturnType && fromReturnType.length !== 0 ? [returnType, fromReturnType] : [typeAtLocation, definitionFromType(typeAtLocation, typeChecker, node, failedAliasResolution)];
|
|
162202
|
+
return typeDefinitions.length ? [...getFirstTypeArgumentDefinitions(typeChecker, resolvedType, node, failedAliasResolution), ...typeDefinitions] : !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, skipAlias(symbol, typeChecker), node, failedAliasResolution) : void 0;
|
|
162100
162203
|
}
|
|
162101
162204
|
function definitionFromType(type, checker, node, failedAliasResolution) {
|
|
162102
162205
|
return flatMap(type.isUnion() && !(type.flags & 32 /* Enum */) ? type.types : [type], (t) => t.symbol && getDefinitionFromSymbol(checker, t.symbol, node, failedAliasResolution));
|
package/lib/tsserverlibrary.d.ts
CHANGED
package/lib/tsserverlibrary.js
CHANGED
|
@@ -34,8 +34,8 @@ var ts = (() => {
|
|
|
34
34
|
var init_corePublic = __esm({
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
|
-
versionMajorMinor = "5.
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
37
|
+
versionMajorMinor = "5.2";
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230517`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -13767,7 +13767,7 @@ ${lanes.join("\n")}
|
|
|
13767
13767
|
return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
|
|
13768
13768
|
}
|
|
13769
13769
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
13770
|
-
return isExternalModule(node) ||
|
|
13770
|
+
return isExternalModule(node) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
|
|
13771
13771
|
}
|
|
13772
13772
|
function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
13773
13773
|
switch (node.scriptKind) {
|
|
@@ -56598,7 +56598,35 @@ ${lanes.join("\n")}
|
|
|
56598
56598
|
return emptyArray;
|
|
56599
56599
|
}
|
|
56600
56600
|
function getSignaturesOfType(type, kind) {
|
|
56601
|
-
|
|
56601
|
+
const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
|
|
56602
|
+
if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
|
|
56603
|
+
if (type.arrayFallbackSignatures) {
|
|
56604
|
+
return type.arrayFallbackSignatures;
|
|
56605
|
+
}
|
|
56606
|
+
let memberName;
|
|
56607
|
+
if (everyType(type, (t) => {
|
|
56608
|
+
var _a;
|
|
56609
|
+
return !!((_a = t.symbol) == null ? void 0 : _a.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
|
|
56610
|
+
})) {
|
|
56611
|
+
const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
|
|
56612
|
+
const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
|
|
56613
|
+
return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
|
|
56614
|
+
}
|
|
56615
|
+
type.arrayFallbackSignatures = result;
|
|
56616
|
+
}
|
|
56617
|
+
return result;
|
|
56618
|
+
}
|
|
56619
|
+
function isArrayOrTupleSymbol(symbol) {
|
|
56620
|
+
if (!symbol || !globalArrayType.symbol || !globalReadonlyArrayType.symbol) {
|
|
56621
|
+
return false;
|
|
56622
|
+
}
|
|
56623
|
+
return !!getSymbolIfSameReference(symbol, globalArrayType.symbol) || !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
56624
|
+
}
|
|
56625
|
+
function isReadonlyArraySymbol(symbol) {
|
|
56626
|
+
if (!symbol || !globalReadonlyArrayType.symbol) {
|
|
56627
|
+
return false;
|
|
56628
|
+
}
|
|
56629
|
+
return !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
56602
56630
|
}
|
|
56603
56631
|
function findIndexInfo(indexInfos, keyType) {
|
|
56604
56632
|
return find(indexInfos, (info) => info.keyType === keyType);
|
|
@@ -69452,6 +69480,7 @@ ${lanes.join("\n")}
|
|
|
69452
69480
|
case 9 /* NumericLiteral */:
|
|
69453
69481
|
case 10 /* BigIntLiteral */:
|
|
69454
69482
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
69483
|
+
case 227 /* TemplateExpression */:
|
|
69455
69484
|
case 112 /* TrueKeyword */:
|
|
69456
69485
|
case 97 /* FalseKeyword */:
|
|
69457
69486
|
case 106 /* NullKeyword */:
|
|
@@ -72084,7 +72113,7 @@ ${lanes.join("\n")}
|
|
|
72084
72113
|
}
|
|
72085
72114
|
const typeArgument = typeArgumentTypes[i];
|
|
72086
72115
|
if (!checkTypeAssignableTo(
|
|
72087
|
-
typeArgument,
|
|
72116
|
+
getTypeWithThisArgument(typeArgument, typeArgument),
|
|
72088
72117
|
getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument),
|
|
72089
72118
|
reportErrors2 ? typeArgumentNodes[i] : void 0,
|
|
72090
72119
|
typeArgumentHeadMessage,
|
|
@@ -72118,8 +72147,9 @@ ${lanes.join("\n")}
|
|
|
72118
72147
|
void 0,
|
|
72119
72148
|
checkMode
|
|
72120
72149
|
);
|
|
72150
|
+
const checkAttributesType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(attributesType) : attributesType;
|
|
72121
72151
|
return checkTagNameDoesNotExpectTooManyArguments() && checkTypeRelatedToAndOptionallyElaborate(
|
|
72122
|
-
|
|
72152
|
+
checkAttributesType,
|
|
72123
72153
|
paramType,
|
|
72124
72154
|
relation,
|
|
72125
72155
|
reportErrors2 ? node.tagName : void 0,
|
|
@@ -73859,6 +73889,8 @@ ${lanes.join("\n")}
|
|
|
73859
73889
|
}
|
|
73860
73890
|
return getRegularTypeOfLiteralType(exprType);
|
|
73861
73891
|
}
|
|
73892
|
+
const links = getNodeLinks(node);
|
|
73893
|
+
links.assertionExpressionType = exprType;
|
|
73862
73894
|
checkSourceElement(type);
|
|
73863
73895
|
checkNodeDeferred(node);
|
|
73864
73896
|
return getTypeFromTypeNode(type);
|
|
@@ -73880,9 +73912,11 @@ ${lanes.join("\n")}
|
|
|
73880
73912
|
return { type, expression };
|
|
73881
73913
|
}
|
|
73882
73914
|
function checkAssertionDeferred(node) {
|
|
73883
|
-
const { type
|
|
73915
|
+
const { type } = getAssertionTypeAndExpression(node);
|
|
73884
73916
|
const errNode = isParenthesizedExpression(node) ? type : node;
|
|
73885
|
-
const
|
|
73917
|
+
const links = getNodeLinks(node);
|
|
73918
|
+
Debug.assertIsDefined(links.assertionExpressionType);
|
|
73919
|
+
const exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(links.assertionExpressionType));
|
|
73886
73920
|
const targetType = getTypeFromTypeNode(type);
|
|
73887
73921
|
if (!isErrorType(targetType)) {
|
|
73888
73922
|
addLazyDiagnostic(() => {
|
|
@@ -76249,11 +76283,15 @@ ${lanes.join("\n")}
|
|
|
76249
76283
|
texts.push(span.literal.text);
|
|
76250
76284
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
76251
76285
|
}
|
|
76252
|
-
|
|
76286
|
+
if (isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType2(
|
|
76253
76287
|
node,
|
|
76254
76288
|
/*contextFlags*/
|
|
76255
76289
|
void 0
|
|
76256
|
-
) || unknownType, isTemplateLiteralContextualType)
|
|
76290
|
+
) || unknownType, isTemplateLiteralContextualType)) {
|
|
76291
|
+
return getTemplateLiteralType(texts, types);
|
|
76292
|
+
}
|
|
76293
|
+
const evaluated = node.parent.kind !== 214 /* TaggedTemplateExpression */ && evaluateTemplateExpression(node);
|
|
76294
|
+
return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
|
|
76257
76295
|
}
|
|
76258
76296
|
function isTemplateLiteralContextualType(type) {
|
|
76259
76297
|
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
@@ -81231,11 +81269,11 @@ ${lanes.join("\n")}
|
|
|
81231
81269
|
);
|
|
81232
81270
|
if (symbol) {
|
|
81233
81271
|
if (symbol.flags & 8 /* EnumMember */) {
|
|
81234
|
-
return evaluateEnumMember(expr, symbol, location);
|
|
81272
|
+
return location ? evaluateEnumMember(expr, symbol, location) : getEnumMemberValue(symbol.valueDeclaration);
|
|
81235
81273
|
}
|
|
81236
81274
|
if (isConstVariable(symbol)) {
|
|
81237
81275
|
const declaration = symbol.valueDeclaration;
|
|
81238
|
-
if (declaration && !declaration.type && declaration.initializer && declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
81276
|
+
if (declaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
|
|
81239
81277
|
return evaluate(declaration.initializer, declaration);
|
|
81240
81278
|
}
|
|
81241
81279
|
}
|
|
@@ -81255,7 +81293,7 @@ ${lanes.join("\n")}
|
|
|
81255
81293
|
const name = escapeLeadingUnderscores(expr.argumentExpression.text);
|
|
81256
81294
|
const member = rootSymbol.exports.get(name);
|
|
81257
81295
|
if (member) {
|
|
81258
|
-
return evaluateEnumMember(expr, member, location);
|
|
81296
|
+
return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
|
|
81259
81297
|
}
|
|
81260
81298
|
}
|
|
81261
81299
|
}
|
|
@@ -115976,8 +116014,7 @@ ${lanes.join("\n")}
|
|
|
115976
116014
|
realpath,
|
|
115977
116015
|
readDirectory: (path, extensions, include, exclude, depth) => system.readDirectory(path, extensions, include, exclude, depth),
|
|
115978
116016
|
createDirectory: (d) => system.createDirectory(d),
|
|
115979
|
-
createHash: maybeBind(system, system.createHash)
|
|
115980
|
-
useSourceOfProjectReferenceRedirect: (projectReferences) => (projectReferences == null ? void 0 : projectReferences.some((x) => x.circular)) || false
|
|
116017
|
+
createHash: maybeBind(system, system.createHash)
|
|
115981
116018
|
};
|
|
115982
116019
|
return compilerHost;
|
|
115983
116020
|
}
|
|
@@ -116659,7 +116696,7 @@ ${lanes.join("\n")}
|
|
|
116659
116696
|
let projectReferenceRedirects;
|
|
116660
116697
|
let mapFromFileToProjectReferenceRedirects;
|
|
116661
116698
|
let mapFromToProjectReferenceRedirectSource;
|
|
116662
|
-
const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host
|
|
116699
|
+
const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host)) && !options.disableSourceOfProjectReferenceRedirect;
|
|
116663
116700
|
const { onProgramCreateComplete, fileExists, directoryExists } = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
116664
116701
|
compilerHost: host,
|
|
116665
116702
|
getSymlinkCache,
|
|
@@ -123114,8 +123151,7 @@ ${lanes.join("\n")}
|
|
|
123114
123151
|
getEnvironmentVariable: maybeBind(host, host.getEnvironmentVariable) || (() => ""),
|
|
123115
123152
|
createHash: maybeBind(host, host.createHash),
|
|
123116
123153
|
readDirectory: maybeBind(host, host.readDirectory),
|
|
123117
|
-
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
123118
|
-
useSourceOfProjectReferenceRedirect: (projectReferences) => (projectReferences == null ? void 0 : projectReferences.some((x) => x.circular)) || false
|
|
123154
|
+
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
123119
123155
|
};
|
|
123120
123156
|
return compilerHost;
|
|
123121
123157
|
}
|
|
@@ -124352,9 +124388,6 @@ ${lanes.join("\n")}
|
|
|
124352
124388
|
const parsed = parseConfigFile(state, configFileName, projPath);
|
|
124353
124389
|
if (parsed && parsed.projectReferences) {
|
|
124354
124390
|
for (const ref of parsed.projectReferences) {
|
|
124355
|
-
if (ref.circular) {
|
|
124356
|
-
continue;
|
|
124357
|
-
}
|
|
124358
124391
|
const resolvedRefPath = resolveProjectName(state, ref.path);
|
|
124359
124392
|
visit(resolvedRefPath, inCircularContext || ref.circular);
|
|
124360
124393
|
}
|
|
@@ -161407,6 +161440,55 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161407
161440
|
}
|
|
161408
161441
|
return void 0;
|
|
161409
161442
|
}
|
|
161443
|
+
function shouldUnwrapFirstTypeArgumentTypeDefinitionFromTypeReference(typeChecker, type) {
|
|
161444
|
+
const referenceName = type.symbol.name;
|
|
161445
|
+
if (!typesWithUnwrappedTypeArguments.has(referenceName)) {
|
|
161446
|
+
return false;
|
|
161447
|
+
}
|
|
161448
|
+
const globalType = typeChecker.resolveName(
|
|
161449
|
+
referenceName,
|
|
161450
|
+
/*location*/
|
|
161451
|
+
void 0,
|
|
161452
|
+
788968 /* Type */,
|
|
161453
|
+
/*excludeGlobals*/
|
|
161454
|
+
false
|
|
161455
|
+
);
|
|
161456
|
+
return !!globalType && globalType === type.target.symbol;
|
|
161457
|
+
}
|
|
161458
|
+
function shouldUnwrapFirstTypeArgumentTypeDefinitionFromAlias(typeChecker, type) {
|
|
161459
|
+
if (!type.aliasSymbol) {
|
|
161460
|
+
return false;
|
|
161461
|
+
}
|
|
161462
|
+
const referenceName = type.aliasSymbol.name;
|
|
161463
|
+
if (!typesWithUnwrappedTypeArguments.has(referenceName)) {
|
|
161464
|
+
return false;
|
|
161465
|
+
}
|
|
161466
|
+
const globalType = typeChecker.resolveName(
|
|
161467
|
+
referenceName,
|
|
161468
|
+
/*location*/
|
|
161469
|
+
void 0,
|
|
161470
|
+
788968 /* Type */,
|
|
161471
|
+
/*excludeGlobals*/
|
|
161472
|
+
false
|
|
161473
|
+
);
|
|
161474
|
+
return !!globalType && globalType === type.aliasSymbol;
|
|
161475
|
+
}
|
|
161476
|
+
function getFirstTypeArgumentDefinitions(typeChecker, type, node, failedAliasResolution) {
|
|
161477
|
+
var _a, _b;
|
|
161478
|
+
if (!!(getObjectFlags(type) & 4 /* Reference */) && shouldUnwrapFirstTypeArgumentTypeDefinitionFromTypeReference(typeChecker, type)) {
|
|
161479
|
+
return definitionFromType(typeChecker.getTypeArguments(type)[0], typeChecker, node, failedAliasResolution);
|
|
161480
|
+
}
|
|
161481
|
+
if (shouldUnwrapFirstTypeArgumentTypeDefinitionFromAlias(typeChecker, type) && type.aliasTypeArguments) {
|
|
161482
|
+
return definitionFromType(type.aliasTypeArguments[0], typeChecker, node, failedAliasResolution);
|
|
161483
|
+
}
|
|
161484
|
+
if (getObjectFlags(type) & 32 /* Mapped */ && type.target && shouldUnwrapFirstTypeArgumentTypeDefinitionFromAlias(typeChecker, type.target)) {
|
|
161485
|
+
const declaration = (_b = (_a = type.aliasSymbol) == null ? void 0 : _a.declarations) == null ? void 0 : _b[0];
|
|
161486
|
+
if (declaration && isTypeAliasDeclaration(declaration) && isTypeReferenceNode(declaration.type) && declaration.type.typeArguments) {
|
|
161487
|
+
return definitionFromType(typeChecker.getTypeAtLocation(declaration.type.typeArguments[0]), typeChecker, node, failedAliasResolution);
|
|
161488
|
+
}
|
|
161489
|
+
}
|
|
161490
|
+
return [];
|
|
161491
|
+
}
|
|
161410
161492
|
function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) {
|
|
161411
161493
|
const node = getTouchingPropertyName(sourceFile, position);
|
|
161412
161494
|
if (node === sourceFile) {
|
|
@@ -161432,8 +161514,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161432
161514
|
const typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
161433
161515
|
const returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
|
|
161434
161516
|
const fromReturnType = returnType && definitionFromType(returnType, typeChecker, node, failedAliasResolution);
|
|
161435
|
-
const typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node, failedAliasResolution);
|
|
161436
|
-
return typeDefinitions.length ? typeDefinitions : !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, skipAlias(symbol, typeChecker), node, failedAliasResolution) : void 0;
|
|
161517
|
+
const [resolvedType, typeDefinitions] = fromReturnType && fromReturnType.length !== 0 ? [returnType, fromReturnType] : [typeAtLocation, definitionFromType(typeAtLocation, typeChecker, node, failedAliasResolution)];
|
|
161518
|
+
return typeDefinitions.length ? [...getFirstTypeArgumentDefinitions(typeChecker, resolvedType, node, failedAliasResolution), ...typeDefinitions] : !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, skipAlias(symbol, typeChecker), node, failedAliasResolution) : void 0;
|
|
161437
161519
|
}
|
|
161438
161520
|
function definitionFromType(type, checker, node, failedAliasResolution) {
|
|
161439
161521
|
return flatMap(type.isUnion() && !(type.flags & 32 /* Enum */) ? type.types : [type], (t) => t.symbol && getDefinitionFromSymbol(checker, t.symbol, node, failedAliasResolution));
|
|
@@ -161650,10 +161732,32 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161650
161732
|
return false;
|
|
161651
161733
|
}
|
|
161652
161734
|
}
|
|
161735
|
+
var typesWithUnwrappedTypeArguments;
|
|
161653
161736
|
var init_goToDefinition = __esm({
|
|
161654
161737
|
"src/services/goToDefinition.ts"() {
|
|
161655
161738
|
"use strict";
|
|
161656
161739
|
init_ts4();
|
|
161740
|
+
typesWithUnwrappedTypeArguments = /* @__PURE__ */ new Set([
|
|
161741
|
+
"Array",
|
|
161742
|
+
"ArrayLike",
|
|
161743
|
+
"ReadonlyArray",
|
|
161744
|
+
"Promise",
|
|
161745
|
+
"PromiseLike",
|
|
161746
|
+
"Iterable",
|
|
161747
|
+
"IterableIterator",
|
|
161748
|
+
"AsyncIterable",
|
|
161749
|
+
"Set",
|
|
161750
|
+
"WeakSet",
|
|
161751
|
+
"ReadonlySet",
|
|
161752
|
+
"Map",
|
|
161753
|
+
"WeakMap",
|
|
161754
|
+
"ReadonlyMap",
|
|
161755
|
+
"Partial",
|
|
161756
|
+
"Required",
|
|
161757
|
+
"Readonly",
|
|
161758
|
+
"Pick",
|
|
161759
|
+
"Omit"
|
|
161760
|
+
]);
|
|
161657
161761
|
}
|
|
161658
161762
|
});
|
|
161659
161763
|
|
package/lib/typescript.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ and limitations under the License.
|
|
|
14
14
|
***************************************************************************** */
|
|
15
15
|
|
|
16
16
|
declare namespace ts {
|
|
17
|
-
const versionMajorMinor = "5.
|
|
17
|
+
const versionMajorMinor = "5.2";
|
|
18
18
|
/** The version of the TypeScript compiler release */
|
|
19
19
|
const version: string;
|
|
20
20
|
/**
|
package/lib/typescript.js
CHANGED
|
@@ -34,8 +34,8 @@ var ts = (() => {
|
|
|
34
34
|
var init_corePublic = __esm({
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
|
-
versionMajorMinor = "5.
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
37
|
+
versionMajorMinor = "5.2";
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230517`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -13767,7 +13767,7 @@ ${lanes.join("\n")}
|
|
|
13767
13767
|
return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
|
|
13768
13768
|
}
|
|
13769
13769
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
13770
|
-
return isExternalModule(node) ||
|
|
13770
|
+
return isExternalModule(node) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
|
|
13771
13771
|
}
|
|
13772
13772
|
function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
13773
13773
|
switch (node.scriptKind) {
|
|
@@ -56598,7 +56598,35 @@ ${lanes.join("\n")}
|
|
|
56598
56598
|
return emptyArray;
|
|
56599
56599
|
}
|
|
56600
56600
|
function getSignaturesOfType(type, kind) {
|
|
56601
|
-
|
|
56601
|
+
const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
|
|
56602
|
+
if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
|
|
56603
|
+
if (type.arrayFallbackSignatures) {
|
|
56604
|
+
return type.arrayFallbackSignatures;
|
|
56605
|
+
}
|
|
56606
|
+
let memberName;
|
|
56607
|
+
if (everyType(type, (t) => {
|
|
56608
|
+
var _a;
|
|
56609
|
+
return !!((_a = t.symbol) == null ? void 0 : _a.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
|
|
56610
|
+
})) {
|
|
56611
|
+
const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
|
|
56612
|
+
const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
|
|
56613
|
+
return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
|
|
56614
|
+
}
|
|
56615
|
+
type.arrayFallbackSignatures = result;
|
|
56616
|
+
}
|
|
56617
|
+
return result;
|
|
56618
|
+
}
|
|
56619
|
+
function isArrayOrTupleSymbol(symbol) {
|
|
56620
|
+
if (!symbol || !globalArrayType.symbol || !globalReadonlyArrayType.symbol) {
|
|
56621
|
+
return false;
|
|
56622
|
+
}
|
|
56623
|
+
return !!getSymbolIfSameReference(symbol, globalArrayType.symbol) || !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
56624
|
+
}
|
|
56625
|
+
function isReadonlyArraySymbol(symbol) {
|
|
56626
|
+
if (!symbol || !globalReadonlyArrayType.symbol) {
|
|
56627
|
+
return false;
|
|
56628
|
+
}
|
|
56629
|
+
return !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
|
|
56602
56630
|
}
|
|
56603
56631
|
function findIndexInfo(indexInfos, keyType) {
|
|
56604
56632
|
return find(indexInfos, (info) => info.keyType === keyType);
|
|
@@ -69452,6 +69480,7 @@ ${lanes.join("\n")}
|
|
|
69452
69480
|
case 9 /* NumericLiteral */:
|
|
69453
69481
|
case 10 /* BigIntLiteral */:
|
|
69454
69482
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
69483
|
+
case 227 /* TemplateExpression */:
|
|
69455
69484
|
case 112 /* TrueKeyword */:
|
|
69456
69485
|
case 97 /* FalseKeyword */:
|
|
69457
69486
|
case 106 /* NullKeyword */:
|
|
@@ -72084,7 +72113,7 @@ ${lanes.join("\n")}
|
|
|
72084
72113
|
}
|
|
72085
72114
|
const typeArgument = typeArgumentTypes[i];
|
|
72086
72115
|
if (!checkTypeAssignableTo(
|
|
72087
|
-
typeArgument,
|
|
72116
|
+
getTypeWithThisArgument(typeArgument, typeArgument),
|
|
72088
72117
|
getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument),
|
|
72089
72118
|
reportErrors2 ? typeArgumentNodes[i] : void 0,
|
|
72090
72119
|
typeArgumentHeadMessage,
|
|
@@ -72118,8 +72147,9 @@ ${lanes.join("\n")}
|
|
|
72118
72147
|
void 0,
|
|
72119
72148
|
checkMode
|
|
72120
72149
|
);
|
|
72150
|
+
const checkAttributesType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(attributesType) : attributesType;
|
|
72121
72151
|
return checkTagNameDoesNotExpectTooManyArguments() && checkTypeRelatedToAndOptionallyElaborate(
|
|
72122
|
-
|
|
72152
|
+
checkAttributesType,
|
|
72123
72153
|
paramType,
|
|
72124
72154
|
relation,
|
|
72125
72155
|
reportErrors2 ? node.tagName : void 0,
|
|
@@ -73859,6 +73889,8 @@ ${lanes.join("\n")}
|
|
|
73859
73889
|
}
|
|
73860
73890
|
return getRegularTypeOfLiteralType(exprType);
|
|
73861
73891
|
}
|
|
73892
|
+
const links = getNodeLinks(node);
|
|
73893
|
+
links.assertionExpressionType = exprType;
|
|
73862
73894
|
checkSourceElement(type);
|
|
73863
73895
|
checkNodeDeferred(node);
|
|
73864
73896
|
return getTypeFromTypeNode(type);
|
|
@@ -73880,9 +73912,11 @@ ${lanes.join("\n")}
|
|
|
73880
73912
|
return { type, expression };
|
|
73881
73913
|
}
|
|
73882
73914
|
function checkAssertionDeferred(node) {
|
|
73883
|
-
const { type
|
|
73915
|
+
const { type } = getAssertionTypeAndExpression(node);
|
|
73884
73916
|
const errNode = isParenthesizedExpression(node) ? type : node;
|
|
73885
|
-
const
|
|
73917
|
+
const links = getNodeLinks(node);
|
|
73918
|
+
Debug.assertIsDefined(links.assertionExpressionType);
|
|
73919
|
+
const exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(links.assertionExpressionType));
|
|
73886
73920
|
const targetType = getTypeFromTypeNode(type);
|
|
73887
73921
|
if (!isErrorType(targetType)) {
|
|
73888
73922
|
addLazyDiagnostic(() => {
|
|
@@ -76249,11 +76283,15 @@ ${lanes.join("\n")}
|
|
|
76249
76283
|
texts.push(span.literal.text);
|
|
76250
76284
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
76251
76285
|
}
|
|
76252
|
-
|
|
76286
|
+
if (isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType2(
|
|
76253
76287
|
node,
|
|
76254
76288
|
/*contextFlags*/
|
|
76255
76289
|
void 0
|
|
76256
|
-
) || unknownType, isTemplateLiteralContextualType)
|
|
76290
|
+
) || unknownType, isTemplateLiteralContextualType)) {
|
|
76291
|
+
return getTemplateLiteralType(texts, types);
|
|
76292
|
+
}
|
|
76293
|
+
const evaluated = node.parent.kind !== 214 /* TaggedTemplateExpression */ && evaluateTemplateExpression(node);
|
|
76294
|
+
return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
|
|
76257
76295
|
}
|
|
76258
76296
|
function isTemplateLiteralContextualType(type) {
|
|
76259
76297
|
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
@@ -81231,11 +81269,11 @@ ${lanes.join("\n")}
|
|
|
81231
81269
|
);
|
|
81232
81270
|
if (symbol) {
|
|
81233
81271
|
if (symbol.flags & 8 /* EnumMember */) {
|
|
81234
|
-
return evaluateEnumMember(expr, symbol, location);
|
|
81272
|
+
return location ? evaluateEnumMember(expr, symbol, location) : getEnumMemberValue(symbol.valueDeclaration);
|
|
81235
81273
|
}
|
|
81236
81274
|
if (isConstVariable(symbol)) {
|
|
81237
81275
|
const declaration = symbol.valueDeclaration;
|
|
81238
|
-
if (declaration && !declaration.type && declaration.initializer && declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location)) {
|
|
81276
|
+
if (declaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
|
|
81239
81277
|
return evaluate(declaration.initializer, declaration);
|
|
81240
81278
|
}
|
|
81241
81279
|
}
|
|
@@ -81255,7 +81293,7 @@ ${lanes.join("\n")}
|
|
|
81255
81293
|
const name = escapeLeadingUnderscores(expr.argumentExpression.text);
|
|
81256
81294
|
const member = rootSymbol.exports.get(name);
|
|
81257
81295
|
if (member) {
|
|
81258
|
-
return evaluateEnumMember(expr, member, location);
|
|
81296
|
+
return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration);
|
|
81259
81297
|
}
|
|
81260
81298
|
}
|
|
81261
81299
|
}
|
|
@@ -115976,8 +116014,7 @@ ${lanes.join("\n")}
|
|
|
115976
116014
|
realpath,
|
|
115977
116015
|
readDirectory: (path, extensions, include, exclude, depth) => system.readDirectory(path, extensions, include, exclude, depth),
|
|
115978
116016
|
createDirectory: (d) => system.createDirectory(d),
|
|
115979
|
-
createHash: maybeBind(system, system.createHash)
|
|
115980
|
-
useSourceOfProjectReferenceRedirect: (projectReferences) => (projectReferences == null ? void 0 : projectReferences.some((x) => x.circular)) || false
|
|
116017
|
+
createHash: maybeBind(system, system.createHash)
|
|
115981
116018
|
};
|
|
115982
116019
|
return compilerHost;
|
|
115983
116020
|
}
|
|
@@ -116659,7 +116696,7 @@ ${lanes.join("\n")}
|
|
|
116659
116696
|
let projectReferenceRedirects;
|
|
116660
116697
|
let mapFromFileToProjectReferenceRedirects;
|
|
116661
116698
|
let mapFromToProjectReferenceRedirectSource;
|
|
116662
|
-
const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host
|
|
116699
|
+
const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host)) && !options.disableSourceOfProjectReferenceRedirect;
|
|
116663
116700
|
const { onProgramCreateComplete, fileExists, directoryExists } = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
116664
116701
|
compilerHost: host,
|
|
116665
116702
|
getSymlinkCache,
|
|
@@ -123114,8 +123151,7 @@ ${lanes.join("\n")}
|
|
|
123114
123151
|
getEnvironmentVariable: maybeBind(host, host.getEnvironmentVariable) || (() => ""),
|
|
123115
123152
|
createHash: maybeBind(host, host.createHash),
|
|
123116
123153
|
readDirectory: maybeBind(host, host.readDirectory),
|
|
123117
|
-
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
123118
|
-
useSourceOfProjectReferenceRedirect: (projectReferences) => (projectReferences == null ? void 0 : projectReferences.some((x) => x.circular)) || false
|
|
123154
|
+
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
123119
123155
|
};
|
|
123120
123156
|
return compilerHost;
|
|
123121
123157
|
}
|
|
@@ -124352,9 +124388,6 @@ ${lanes.join("\n")}
|
|
|
124352
124388
|
const parsed = parseConfigFile(state, configFileName, projPath);
|
|
124353
124389
|
if (parsed && parsed.projectReferences) {
|
|
124354
124390
|
for (const ref of parsed.projectReferences) {
|
|
124355
|
-
if (ref.circular) {
|
|
124356
|
-
continue;
|
|
124357
|
-
}
|
|
124358
124391
|
const resolvedRefPath = resolveProjectName(state, ref.path);
|
|
124359
124392
|
visit(resolvedRefPath, inCircularContext || ref.circular);
|
|
124360
124393
|
}
|
|
@@ -161422,6 +161455,55 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161422
161455
|
}
|
|
161423
161456
|
return void 0;
|
|
161424
161457
|
}
|
|
161458
|
+
function shouldUnwrapFirstTypeArgumentTypeDefinitionFromTypeReference(typeChecker, type) {
|
|
161459
|
+
const referenceName = type.symbol.name;
|
|
161460
|
+
if (!typesWithUnwrappedTypeArguments.has(referenceName)) {
|
|
161461
|
+
return false;
|
|
161462
|
+
}
|
|
161463
|
+
const globalType = typeChecker.resolveName(
|
|
161464
|
+
referenceName,
|
|
161465
|
+
/*location*/
|
|
161466
|
+
void 0,
|
|
161467
|
+
788968 /* Type */,
|
|
161468
|
+
/*excludeGlobals*/
|
|
161469
|
+
false
|
|
161470
|
+
);
|
|
161471
|
+
return !!globalType && globalType === type.target.symbol;
|
|
161472
|
+
}
|
|
161473
|
+
function shouldUnwrapFirstTypeArgumentTypeDefinitionFromAlias(typeChecker, type) {
|
|
161474
|
+
if (!type.aliasSymbol) {
|
|
161475
|
+
return false;
|
|
161476
|
+
}
|
|
161477
|
+
const referenceName = type.aliasSymbol.name;
|
|
161478
|
+
if (!typesWithUnwrappedTypeArguments.has(referenceName)) {
|
|
161479
|
+
return false;
|
|
161480
|
+
}
|
|
161481
|
+
const globalType = typeChecker.resolveName(
|
|
161482
|
+
referenceName,
|
|
161483
|
+
/*location*/
|
|
161484
|
+
void 0,
|
|
161485
|
+
788968 /* Type */,
|
|
161486
|
+
/*excludeGlobals*/
|
|
161487
|
+
false
|
|
161488
|
+
);
|
|
161489
|
+
return !!globalType && globalType === type.aliasSymbol;
|
|
161490
|
+
}
|
|
161491
|
+
function getFirstTypeArgumentDefinitions(typeChecker, type, node, failedAliasResolution) {
|
|
161492
|
+
var _a, _b;
|
|
161493
|
+
if (!!(getObjectFlags(type) & 4 /* Reference */) && shouldUnwrapFirstTypeArgumentTypeDefinitionFromTypeReference(typeChecker, type)) {
|
|
161494
|
+
return definitionFromType(typeChecker.getTypeArguments(type)[0], typeChecker, node, failedAliasResolution);
|
|
161495
|
+
}
|
|
161496
|
+
if (shouldUnwrapFirstTypeArgumentTypeDefinitionFromAlias(typeChecker, type) && type.aliasTypeArguments) {
|
|
161497
|
+
return definitionFromType(type.aliasTypeArguments[0], typeChecker, node, failedAliasResolution);
|
|
161498
|
+
}
|
|
161499
|
+
if (getObjectFlags(type) & 32 /* Mapped */ && type.target && shouldUnwrapFirstTypeArgumentTypeDefinitionFromAlias(typeChecker, type.target)) {
|
|
161500
|
+
const declaration = (_b = (_a = type.aliasSymbol) == null ? void 0 : _a.declarations) == null ? void 0 : _b[0];
|
|
161501
|
+
if (declaration && isTypeAliasDeclaration(declaration) && isTypeReferenceNode(declaration.type) && declaration.type.typeArguments) {
|
|
161502
|
+
return definitionFromType(typeChecker.getTypeAtLocation(declaration.type.typeArguments[0]), typeChecker, node, failedAliasResolution);
|
|
161503
|
+
}
|
|
161504
|
+
}
|
|
161505
|
+
return [];
|
|
161506
|
+
}
|
|
161425
161507
|
function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) {
|
|
161426
161508
|
const node = getTouchingPropertyName(sourceFile, position);
|
|
161427
161509
|
if (node === sourceFile) {
|
|
@@ -161447,8 +161529,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161447
161529
|
const typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
161448
161530
|
const returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
|
|
161449
161531
|
const fromReturnType = returnType && definitionFromType(returnType, typeChecker, node, failedAliasResolution);
|
|
161450
|
-
const typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node, failedAliasResolution);
|
|
161451
|
-
return typeDefinitions.length ? typeDefinitions : !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, skipAlias(symbol, typeChecker), node, failedAliasResolution) : void 0;
|
|
161532
|
+
const [resolvedType, typeDefinitions] = fromReturnType && fromReturnType.length !== 0 ? [returnType, fromReturnType] : [typeAtLocation, definitionFromType(typeAtLocation, typeChecker, node, failedAliasResolution)];
|
|
161533
|
+
return typeDefinitions.length ? [...getFirstTypeArgumentDefinitions(typeChecker, resolvedType, node, failedAliasResolution), ...typeDefinitions] : !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, skipAlias(symbol, typeChecker), node, failedAliasResolution) : void 0;
|
|
161452
161534
|
}
|
|
161453
161535
|
function definitionFromType(type, checker, node, failedAliasResolution) {
|
|
161454
161536
|
return flatMap(type.isUnion() && !(type.flags & 32 /* Enum */) ? type.types : [type], (t) => t.symbol && getDefinitionFromSymbol(checker, t.symbol, node, failedAliasResolution));
|
|
@@ -161665,10 +161747,32 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161665
161747
|
return false;
|
|
161666
161748
|
}
|
|
161667
161749
|
}
|
|
161750
|
+
var typesWithUnwrappedTypeArguments;
|
|
161668
161751
|
var init_goToDefinition = __esm({
|
|
161669
161752
|
"src/services/goToDefinition.ts"() {
|
|
161670
161753
|
"use strict";
|
|
161671
161754
|
init_ts4();
|
|
161755
|
+
typesWithUnwrappedTypeArguments = /* @__PURE__ */ new Set([
|
|
161756
|
+
"Array",
|
|
161757
|
+
"ArrayLike",
|
|
161758
|
+
"ReadonlyArray",
|
|
161759
|
+
"Promise",
|
|
161760
|
+
"PromiseLike",
|
|
161761
|
+
"Iterable",
|
|
161762
|
+
"IterableIterator",
|
|
161763
|
+
"AsyncIterable",
|
|
161764
|
+
"Set",
|
|
161765
|
+
"WeakSet",
|
|
161766
|
+
"ReadonlySet",
|
|
161767
|
+
"Map",
|
|
161768
|
+
"WeakMap",
|
|
161769
|
+
"ReadonlyMap",
|
|
161770
|
+
"Partial",
|
|
161771
|
+
"Required",
|
|
161772
|
+
"Readonly",
|
|
161773
|
+
"Pick",
|
|
161774
|
+
"Omit"
|
|
161775
|
+
]);
|
|
161672
161776
|
}
|
|
161673
161777
|
});
|
|
161674
161778
|
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -53,8 +53,8 @@ var fs = __toESM(require("fs"));
|
|
|
53
53
|
var path = __toESM(require("path"));
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
|
-
var versionMajorMinor = "5.
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
56
|
+
var versionMajorMinor = "5.2";
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20230517`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.
|
|
5
|
+
"version": "5.2.0-pr-54290-7",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -83,9 +83,7 @@
|
|
|
83
83
|
"which": "^2.0.2"
|
|
84
84
|
},
|
|
85
85
|
"overrides": {
|
|
86
|
-
"typescript@*": "$typescript"
|
|
87
|
-
"@octokit/types": "9.0.0",
|
|
88
|
-
"@octokit/openapi-types": "16.0.0"
|
|
86
|
+
"typescript@*": "$typescript"
|
|
89
87
|
},
|
|
90
88
|
"scripts": {
|
|
91
89
|
"test": "hereby runtests-parallel --light=false",
|
|
@@ -116,5 +114,5 @@
|
|
|
116
114
|
"node": "20.1.0",
|
|
117
115
|
"npm": "8.19.4"
|
|
118
116
|
},
|
|
119
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "3c09ef8d3d79da4855445a72635bedf36080857b"
|
|
120
118
|
}
|