@typescript-deploys/pr-build 5.5.0-pr-57649-11 → 5.5.0-pr-58124-21
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 +119 -56
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +500 -95
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240410`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -12934,6 +12934,9 @@ function isObjectLiteralOrClassExpressionMethodOrAccessor(node) {
|
|
|
12934
12934
|
function isIdentifierTypePredicate(predicate) {
|
|
12935
12935
|
return predicate && predicate.kind === 1 /* Identifier */;
|
|
12936
12936
|
}
|
|
12937
|
+
function isThisTypePredicate(predicate) {
|
|
12938
|
+
return predicate && predicate.kind === 0 /* This */;
|
|
12939
|
+
}
|
|
12937
12940
|
function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
|
|
12938
12941
|
return forEach(objectLiteral == null ? void 0 : objectLiteral.properties, (property) => {
|
|
12939
12942
|
if (!isPropertyAssignment(property))
|
|
@@ -13394,6 +13397,9 @@ function getExternalModuleRequireArgument(node) {
|
|
|
13394
13397
|
function isInternalModuleImportEqualsDeclaration(node) {
|
|
13395
13398
|
return node.kind === 271 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 283 /* ExternalModuleReference */;
|
|
13396
13399
|
}
|
|
13400
|
+
function isFullSourceFile(sourceFile) {
|
|
13401
|
+
return (sourceFile == null ? void 0 : sourceFile.kind) === 307 /* SourceFile */;
|
|
13402
|
+
}
|
|
13397
13403
|
function isSourceFileJS(file) {
|
|
13398
13404
|
return isInJSFile(file);
|
|
13399
13405
|
}
|
|
@@ -17035,12 +17041,12 @@ function getModuleSpecifierEndingPreference(preference, resolutionMode, compiler
|
|
|
17035
17041
|
return 1 /* Index */;
|
|
17036
17042
|
}
|
|
17037
17043
|
if (!shouldAllowImportingTsExtension(compilerOptions)) {
|
|
17038
|
-
return usesExtensionsOnImports(sourceFile) ? 2 /* JsExtension */ : 0 /* Minimal */;
|
|
17044
|
+
return sourceFile && usesExtensionsOnImports(sourceFile) ? 2 /* JsExtension */ : 0 /* Minimal */;
|
|
17039
17045
|
}
|
|
17040
17046
|
return inferPreference();
|
|
17041
17047
|
function inferPreference() {
|
|
17042
17048
|
let usesJsExtensions = false;
|
|
17043
|
-
const specifiers = sourceFile.imports.length ? sourceFile.imports : isSourceFileJS(sourceFile) ? getRequiresAtTopOfFile(sourceFile).map((r) => r.arguments[0]) : emptyArray;
|
|
17049
|
+
const specifiers = (sourceFile == null ? void 0 : sourceFile.imports.length) ? sourceFile.imports : sourceFile && isSourceFileJS(sourceFile) ? getRequiresAtTopOfFile(sourceFile).map((r) => r.arguments[0]) : emptyArray;
|
|
17044
17050
|
for (const specifier of specifiers) {
|
|
17045
17051
|
if (pathIsRelative(specifier.text)) {
|
|
17046
17052
|
if (moduleResolutionIsNodeNext && resolutionMode === 1 /* CommonJS */ && getModeForUsageLocation(sourceFile, specifier, compilerOptions) === 99 /* ESNext */) {
|
|
@@ -42662,7 +42668,7 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
|
|
|
42662
42668
|
importModuleSpecifierEnding,
|
|
42663
42669
|
resolutionMode ?? importingSourceFile.impliedNodeFormat,
|
|
42664
42670
|
compilerOptions,
|
|
42665
|
-
importingSourceFile
|
|
42671
|
+
isFullSourceFile(importingSourceFile) ? importingSourceFile : void 0
|
|
42666
42672
|
);
|
|
42667
42673
|
}
|
|
42668
42674
|
}
|
|
@@ -42722,7 +42728,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
42722
42728
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
42723
42729
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
42724
42730
|
const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
42725
|
-
const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
|
|
42731
|
+
const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, (modulePath) => forEach(
|
|
42726
42732
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
42727
42733
|
(reason) => {
|
|
42728
42734
|
if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path)
|
|
@@ -45208,7 +45214,6 @@ function createTypeChecker(host) {
|
|
|
45208
45214
|
let result;
|
|
45209
45215
|
let lastLocation;
|
|
45210
45216
|
let lastSelfReferenceLocation;
|
|
45211
|
-
let seenAsUsedOutsideOfSelf = false;
|
|
45212
45217
|
let propertyWithInvalidInitializer;
|
|
45213
45218
|
let associatedDeclarationForContainingInitializerOrBindingName;
|
|
45214
45219
|
let withinDeferredContext = false;
|
|
@@ -45420,9 +45425,6 @@ function createTypeChecker(host) {
|
|
|
45420
45425
|
location = location.parent.parent.parent;
|
|
45421
45426
|
}
|
|
45422
45427
|
break;
|
|
45423
|
-
case 175 /* ClassStaticBlockDeclaration */:
|
|
45424
|
-
seenAsUsedOutsideOfSelf = true;
|
|
45425
|
-
break;
|
|
45426
45428
|
}
|
|
45427
45429
|
if (isSelfReferenceLocation(location)) {
|
|
45428
45430
|
lastSelfReferenceLocation = location;
|
|
@@ -45430,7 +45432,7 @@ function createTypeChecker(host) {
|
|
|
45430
45432
|
lastLocation = location;
|
|
45431
45433
|
location = isJSDocTemplateTag(location) ? getEffectiveContainerForJSDocTemplateTag(location) || location.parent : isJSDocParameterTag(location) || isJSDocReturnTag(location) ? getHostSignatureFromJSDoc(location) || location.parent : location.parent;
|
|
45432
45434
|
}
|
|
45433
|
-
if (isUse && result && (
|
|
45435
|
+
if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
|
|
45434
45436
|
result.isReferenced |= meaning;
|
|
45435
45437
|
}
|
|
45436
45438
|
if (!result) {
|
|
@@ -48123,7 +48125,7 @@ function createTypeChecker(host) {
|
|
|
48123
48125
|
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
48124
48126
|
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
48125
48127
|
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
48126
|
-
serializeTypeForDeclaration: (type, symbol,
|
|
48128
|
+
serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
|
|
48127
48129
|
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
48128
48130
|
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
48129
48131
|
indexInfo,
|
|
@@ -48146,6 +48148,18 @@ function createTypeChecker(host) {
|
|
|
48146
48148
|
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
48147
48149
|
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
48148
48150
|
};
|
|
48151
|
+
function setTextRange2(context, range, location) {
|
|
48152
|
+
if (!nodeIsSynthesized(range) && !(range.flags & 16 /* Synthesized */) && (!context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(range))) {
|
|
48153
|
+
range = factory.cloneNode(range);
|
|
48154
|
+
}
|
|
48155
|
+
if (!location) {
|
|
48156
|
+
return range;
|
|
48157
|
+
}
|
|
48158
|
+
if (!context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(getOriginalNode(location))) {
|
|
48159
|
+
return setOriginalNode(range, location);
|
|
48160
|
+
}
|
|
48161
|
+
return setTextRange(setOriginalNode(range, location), location);
|
|
48162
|
+
}
|
|
48149
48163
|
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
48150
48164
|
if (expr) {
|
|
48151
48165
|
const typeNode = isAssertionExpression(expr) ? expr.type : isJSDocTypeAssertion(expr) ? getJSDocTypeAssertionType(expr) : void 0;
|
|
@@ -48210,6 +48224,7 @@ function createTypeChecker(host) {
|
|
|
48210
48224
|
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : flags & 134217728 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
|
|
48211
48225
|
const context = {
|
|
48212
48226
|
enclosingDeclaration,
|
|
48227
|
+
enclosingFile: enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration),
|
|
48213
48228
|
flags: flags || 0 /* None */,
|
|
48214
48229
|
tracker: void 0,
|
|
48215
48230
|
encounteredError: false,
|
|
@@ -48742,7 +48757,7 @@ function createTypeChecker(host) {
|
|
|
48742
48757
|
if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) {
|
|
48743
48758
|
return node;
|
|
48744
48759
|
}
|
|
48745
|
-
return
|
|
48760
|
+
return setTextRange2(context, factory.cloneNode(visitEachChild(
|
|
48746
48761
|
node,
|
|
48747
48762
|
deepCloneOrReuseNode,
|
|
48748
48763
|
/*context*/
|
|
@@ -49084,7 +49099,13 @@ function createTypeChecker(host) {
|
|
|
49084
49099
|
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
49085
49100
|
context.reverseMappedStack.push(propertySymbol);
|
|
49086
49101
|
}
|
|
49087
|
-
propertyTypeNode = propertyType ? serializeTypeForDeclaration(
|
|
49102
|
+
propertyTypeNode = propertyType ? serializeTypeForDeclaration(
|
|
49103
|
+
context,
|
|
49104
|
+
/*declaration*/
|
|
49105
|
+
void 0,
|
|
49106
|
+
propertyType,
|
|
49107
|
+
propertySymbol
|
|
49108
|
+
) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
49088
49109
|
if (propertyIsReverseMapped) {
|
|
49089
49110
|
context.reverseMappedStack.pop();
|
|
49090
49111
|
}
|
|
@@ -49473,8 +49494,7 @@ function createTypeChecker(host) {
|
|
|
49473
49494
|
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
|
|
49474
49495
|
const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
|
|
49475
49496
|
const parameterType = getTypeOfSymbol(parameterSymbol);
|
|
49476
|
-
const
|
|
49477
|
-
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, addUndefined);
|
|
49497
|
+
const parameterTypeNode = serializeTypeForDeclaration(context, parameterDeclaration, parameterType, parameterSymbol);
|
|
49478
49498
|
const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
|
|
49479
49499
|
const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
49480
49500
|
const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
|
|
@@ -50066,10 +50086,12 @@ function createTypeChecker(host) {
|
|
|
50066
50086
|
}
|
|
50067
50087
|
return enclosingDeclaration;
|
|
50068
50088
|
}
|
|
50069
|
-
function serializeTypeForDeclaration(context, type, symbol
|
|
50089
|
+
function serializeTypeForDeclaration(context, declaration, type, symbol) {
|
|
50070
50090
|
var _a;
|
|
50091
|
+
const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
50092
|
+
const enclosingDeclaration = context.enclosingDeclaration;
|
|
50071
50093
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
50072
|
-
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
50094
|
+
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
50073
50095
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
50074
50096
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
50075
50097
|
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
@@ -50082,7 +50104,7 @@ function createTypeChecker(host) {
|
|
|
50082
50104
|
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
|
|
50083
50105
|
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
|
|
50084
50106
|
}
|
|
50085
|
-
const decl = symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
|
50107
|
+
const decl = declaration ?? symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
|
50086
50108
|
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
50087
50109
|
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
|
|
50088
50110
|
context.flags = oldFlags;
|
|
@@ -50196,7 +50218,7 @@ function createTypeChecker(host) {
|
|
|
50196
50218
|
const type = getDeclaredTypeOfSymbol(sym);
|
|
50197
50219
|
const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node2);
|
|
50198
50220
|
name.symbol = sym;
|
|
50199
|
-
return
|
|
50221
|
+
return setTextRange2(context, setEmitFlags(name, 16777216 /* NoAsciiEscaping */), node2);
|
|
50200
50222
|
}
|
|
50201
50223
|
const updated = visitEachChild(
|
|
50202
50224
|
node2,
|
|
@@ -50205,7 +50227,7 @@ function createTypeChecker(host) {
|
|
|
50205
50227
|
void 0
|
|
50206
50228
|
);
|
|
50207
50229
|
if (updated !== node2) {
|
|
50208
|
-
|
|
50230
|
+
setTextRange2(context, updated, node2);
|
|
50209
50231
|
}
|
|
50210
50232
|
return updated;
|
|
50211
50233
|
}
|
|
@@ -50219,12 +50241,12 @@ function createTypeChecker(host) {
|
|
|
50219
50241
|
if (hadError) {
|
|
50220
50242
|
return void 0;
|
|
50221
50243
|
}
|
|
50222
|
-
return transformed
|
|
50244
|
+
return transformed;
|
|
50223
50245
|
function visitExistingNodeTreeSymbols(node) {
|
|
50224
50246
|
const onExitNewScope = isNewScopeNode(node) ? onEnterNewScope(node) : void 0;
|
|
50225
50247
|
const result = visitExistingNodeTreeSymbolsWorker(node);
|
|
50226
50248
|
onExitNewScope == null ? void 0 : onExitNewScope();
|
|
50227
|
-
return result;
|
|
50249
|
+
return result === node ? setTextRange2(context, factory.cloneNode(result), node) : result;
|
|
50228
50250
|
}
|
|
50229
50251
|
function onEnterNewScope(node) {
|
|
50230
50252
|
const oldContex = context;
|
|
@@ -50360,7 +50382,7 @@ function createTypeChecker(host) {
|
|
|
50360
50382
|
void 0
|
|
50361
50383
|
);
|
|
50362
50384
|
if (visited === node) {
|
|
50363
|
-
visited =
|
|
50385
|
+
visited = setTextRange2(context, factory.cloneNode(node), node);
|
|
50364
50386
|
}
|
|
50365
50387
|
visited.type = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50366
50388
|
if (isParameter(node)) {
|
|
@@ -50383,11 +50405,16 @@ function createTypeChecker(host) {
|
|
|
50383
50405
|
/*context*/
|
|
50384
50406
|
void 0
|
|
50385
50407
|
);
|
|
50386
|
-
const clone =
|
|
50408
|
+
const clone = setTextRange2(context, visited === node ? factory.cloneNode(node) : visited, node);
|
|
50387
50409
|
const flags = getEmitFlags(clone);
|
|
50388
50410
|
setEmitFlags(clone, flags | (context.flags & 1024 /* MultilineObjectLiterals */ && isTypeLiteralNode(node) ? 0 : 1 /* SingleLine */));
|
|
50389
50411
|
return clone;
|
|
50390
50412
|
}
|
|
50413
|
+
if (isStringLiteral(node) && !!(context.flags & 268435456 /* UseSingleQuotesForStringLiteralType */) && !node.singleQuote) {
|
|
50414
|
+
const clone = factory.cloneNode(node);
|
|
50415
|
+
clone.singleQuote = true;
|
|
50416
|
+
return clone;
|
|
50417
|
+
}
|
|
50391
50418
|
if (isConditionalTypeNode(node)) {
|
|
50392
50419
|
const checkType = visitNode(node.checkType, visitExistingNodeTreeSymbols, isTypeNode);
|
|
50393
50420
|
const disposeScope = onEnterNewScope(node);
|
|
@@ -50766,7 +50793,8 @@ function createTypeChecker(host) {
|
|
|
50766
50793
|
);
|
|
50767
50794
|
context.tracker.trackSymbol(type.symbol, context.enclosingDeclaration, 111551 /* Value */);
|
|
50768
50795
|
} else {
|
|
50769
|
-
const statement =
|
|
50796
|
+
const statement = setTextRange2(
|
|
50797
|
+
context,
|
|
50770
50798
|
factory.createVariableStatement(
|
|
50771
50799
|
/*modifiers*/
|
|
50772
50800
|
void 0,
|
|
@@ -50775,7 +50803,13 @@ function createTypeChecker(host) {
|
|
|
50775
50803
|
name,
|
|
50776
50804
|
/*exclamationToken*/
|
|
50777
50805
|
void 0,
|
|
50778
|
-
serializeTypeForDeclaration(
|
|
50806
|
+
serializeTypeForDeclaration(
|
|
50807
|
+
context,
|
|
50808
|
+
/*declaration*/
|
|
50809
|
+
void 0,
|
|
50810
|
+
type,
|
|
50811
|
+
symbol
|
|
50812
|
+
)
|
|
50779
50813
|
)
|
|
50780
50814
|
], flags)
|
|
50781
50815
|
),
|
|
@@ -51048,7 +51082,7 @@ function createTypeChecker(host) {
|
|
|
51048
51082
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
|
51049
51083
|
for (const sig of signatures) {
|
|
51050
51084
|
const decl = signatureToSignatureDeclarationHelper(sig, 262 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName) });
|
|
51051
|
-
addResult(
|
|
51085
|
+
addResult(setTextRange2(context, decl, getSignatureTextRangeLocation(sig)), modifierFlags);
|
|
51052
51086
|
}
|
|
51053
51087
|
if (!(symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && !!symbol.exports && !!symbol.exports.size)) {
|
|
51054
51088
|
const props = filter(getPropertiesOfType(type), isNamespaceMember);
|
|
@@ -51226,7 +51260,8 @@ function createTypeChecker(host) {
|
|
|
51226
51260
|
const indexSignatures = serializeIndexSignatures(classType, baseTypes[0]);
|
|
51227
51261
|
context.enclosingDeclaration = oldEnclosing;
|
|
51228
51262
|
addResult(
|
|
51229
|
-
|
|
51263
|
+
setTextRange2(
|
|
51264
|
+
context,
|
|
51230
51265
|
factory.createClassDeclaration(
|
|
51231
51266
|
/*modifiers*/
|
|
51232
51267
|
void 0,
|
|
@@ -51586,7 +51621,13 @@ function createTypeChecker(host) {
|
|
|
51586
51621
|
varName,
|
|
51587
51622
|
/*exclamationToken*/
|
|
51588
51623
|
void 0,
|
|
51589
|
-
serializeTypeForDeclaration(
|
|
51624
|
+
serializeTypeForDeclaration(
|
|
51625
|
+
context,
|
|
51626
|
+
/*declaration*/
|
|
51627
|
+
void 0,
|
|
51628
|
+
typeToSerialize,
|
|
51629
|
+
symbol
|
|
51630
|
+
)
|
|
51590
51631
|
)
|
|
51591
51632
|
], flags)
|
|
51592
51633
|
);
|
|
@@ -51658,7 +51699,8 @@ function createTypeChecker(host) {
|
|
|
51658
51699
|
});
|
|
51659
51700
|
Debug.assert(!!setter);
|
|
51660
51701
|
const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : void 0;
|
|
51661
|
-
result.push(
|
|
51702
|
+
result.push(setTextRange2(
|
|
51703
|
+
context,
|
|
51662
51704
|
factory.createSetAccessorDeclaration(
|
|
51663
51705
|
factory.createModifiersFromModifierFlags(flag),
|
|
51664
51706
|
name,
|
|
@@ -51670,7 +51712,13 @@ function createTypeChecker(host) {
|
|
|
51670
51712
|
paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context) : "value",
|
|
51671
51713
|
/*questionToken*/
|
|
51672
51714
|
void 0,
|
|
51673
|
-
isPrivate ? void 0 : serializeTypeForDeclaration(
|
|
51715
|
+
isPrivate ? void 0 : serializeTypeForDeclaration(
|
|
51716
|
+
context,
|
|
51717
|
+
/*declaration*/
|
|
51718
|
+
void 0,
|
|
51719
|
+
getTypeOfSymbol(p),
|
|
51720
|
+
p
|
|
51721
|
+
)
|
|
51674
51722
|
)],
|
|
51675
51723
|
/*body*/
|
|
51676
51724
|
void 0
|
|
@@ -51680,12 +51728,19 @@ function createTypeChecker(host) {
|
|
|
51680
51728
|
}
|
|
51681
51729
|
if (p.flags & 32768 /* GetAccessor */) {
|
|
51682
51730
|
const isPrivate2 = modifierFlags & 2 /* Private */;
|
|
51683
|
-
result.push(
|
|
51731
|
+
result.push(setTextRange2(
|
|
51732
|
+
context,
|
|
51684
51733
|
factory.createGetAccessorDeclaration(
|
|
51685
51734
|
factory.createModifiersFromModifierFlags(flag),
|
|
51686
51735
|
name,
|
|
51687
51736
|
[],
|
|
51688
|
-
isPrivate2 ? void 0 : serializeTypeForDeclaration(
|
|
51737
|
+
isPrivate2 ? void 0 : serializeTypeForDeclaration(
|
|
51738
|
+
context,
|
|
51739
|
+
/*declaration*/
|
|
51740
|
+
void 0,
|
|
51741
|
+
getTypeOfSymbol(p),
|
|
51742
|
+
p
|
|
51743
|
+
),
|
|
51689
51744
|
/*body*/
|
|
51690
51745
|
void 0
|
|
51691
51746
|
),
|
|
@@ -51694,12 +51749,19 @@ function createTypeChecker(host) {
|
|
|
51694
51749
|
}
|
|
51695
51750
|
return result;
|
|
51696
51751
|
} else if (p.flags & (4 /* Property */ | 3 /* Variable */ | 98304 /* Accessor */)) {
|
|
51697
|
-
return
|
|
51752
|
+
return setTextRange2(
|
|
51753
|
+
context,
|
|
51698
51754
|
createProperty2(
|
|
51699
51755
|
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
|
|
51700
51756
|
name,
|
|
51701
51757
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
51702
|
-
isPrivate ? void 0 : serializeTypeForDeclaration(
|
|
51758
|
+
isPrivate ? void 0 : serializeTypeForDeclaration(
|
|
51759
|
+
context,
|
|
51760
|
+
/*declaration*/
|
|
51761
|
+
void 0,
|
|
51762
|
+
getWriteTypeOfSymbol(p),
|
|
51763
|
+
p
|
|
51764
|
+
),
|
|
51703
51765
|
// TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
|
|
51704
51766
|
// interface members can't have initializers, however class members _can_
|
|
51705
51767
|
/*initializer*/
|
|
@@ -51712,7 +51774,8 @@ function createTypeChecker(host) {
|
|
|
51712
51774
|
const type = getTypeOfSymbol(p);
|
|
51713
51775
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
|
51714
51776
|
if (flag & 2 /* Private */) {
|
|
51715
|
-
return
|
|
51777
|
+
return setTextRange2(
|
|
51778
|
+
context,
|
|
51716
51779
|
createProperty2(
|
|
51717
51780
|
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
|
|
51718
51781
|
name,
|
|
@@ -51738,7 +51801,7 @@ function createTypeChecker(host) {
|
|
|
51738
51801
|
}
|
|
51739
51802
|
);
|
|
51740
51803
|
const location = sig.declaration && isPrototypePropertyAssignment(sig.declaration.parent) ? sig.declaration.parent : sig.declaration;
|
|
51741
|
-
results2.push(
|
|
51804
|
+
results2.push(setTextRange2(context, decl, location));
|
|
51742
51805
|
}
|
|
51743
51806
|
return results2;
|
|
51744
51807
|
}
|
|
@@ -51794,7 +51857,8 @@ function createTypeChecker(host) {
|
|
|
51794
51857
|
}
|
|
51795
51858
|
}
|
|
51796
51859
|
if (privateProtected) {
|
|
51797
|
-
return [
|
|
51860
|
+
return [setTextRange2(
|
|
51861
|
+
context,
|
|
51798
51862
|
factory.createConstructorDeclaration(
|
|
51799
51863
|
factory.createModifiersFromModifierFlags(privateProtected),
|
|
51800
51864
|
/*parameters*/
|
|
@@ -51809,7 +51873,7 @@ function createTypeChecker(host) {
|
|
|
51809
51873
|
const results2 = [];
|
|
51810
51874
|
for (const sig of signatures) {
|
|
51811
51875
|
const decl = signatureToSignatureDeclarationHelper(sig, outputKind, context);
|
|
51812
|
-
results2.push(
|
|
51876
|
+
results2.push(setTextRange2(context, decl, sig.declaration));
|
|
51813
51877
|
}
|
|
51814
51878
|
return results2;
|
|
51815
51879
|
}
|
|
@@ -55492,12 +55556,10 @@ function createTypeChecker(host) {
|
|
|
55492
55556
|
const target = type.target ?? type;
|
|
55493
55557
|
const typeVariable = getHomomorphicTypeVariable(target);
|
|
55494
55558
|
if (typeVariable && !target.declaration.nameType) {
|
|
55495
|
-
const
|
|
55496
|
-
|
|
55497
|
-
|
|
55498
|
-
|
|
55499
|
-
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
|
|
55500
|
-
}
|
|
55559
|
+
const modifiersType = getModifiersTypeFromMappedType(type);
|
|
55560
|
+
const baseConstraint = isGenericMappedType(modifiersType) ? getApparentTypeOfMappedType(modifiersType) : getBaseConstraintOfType(modifiersType);
|
|
55561
|
+
if (baseConstraint && everyType(baseConstraint, (t) => isArrayOrTupleType(t) || isArrayOrTupleOrIntersection(t))) {
|
|
55562
|
+
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
|
|
55501
55563
|
}
|
|
55502
55564
|
}
|
|
55503
55565
|
return type;
|
|
@@ -55658,13 +55720,13 @@ function createTypeChecker(host) {
|
|
|
55658
55720
|
}
|
|
55659
55721
|
function getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment) {
|
|
55660
55722
|
var _a, _b, _c;
|
|
55661
|
-
let property = (
|
|
55723
|
+
let property = skipObjectFunctionPropertyAugment ? (_a = type.propertyCacheWithoutObjectFunctionPropertyAugment) == null ? void 0 : _a.get(name) : (_b = type.propertyCache) == null ? void 0 : _b.get(name);
|
|
55662
55724
|
if (!property) {
|
|
55663
55725
|
property = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
|
|
55664
55726
|
if (property) {
|
|
55665
55727
|
const properties = skipObjectFunctionPropertyAugment ? type.propertyCacheWithoutObjectFunctionPropertyAugment || (type.propertyCacheWithoutObjectFunctionPropertyAugment = createSymbolTable()) : type.propertyCache || (type.propertyCache = createSymbolTable());
|
|
55666
55728
|
properties.set(name, property);
|
|
55667
|
-
if (skipObjectFunctionPropertyAugment && !((_c = type.propertyCache) == null ? void 0 : _c.get(name))) {
|
|
55729
|
+
if (skipObjectFunctionPropertyAugment && !(getCheckFlags(property) & 48 /* Partial */) && !((_c = type.propertyCache) == null ? void 0 : _c.get(name))) {
|
|
55668
55730
|
const properties2 = type.propertyCache || (type.propertyCache = createSymbolTable());
|
|
55669
55731
|
properties2.set(name, property);
|
|
55670
55732
|
}
|
|
@@ -60927,7 +60989,7 @@ function createTypeChecker(host) {
|
|
|
60927
60989
|
const sourceTypePredicate = getTypePredicateOfSignature(source);
|
|
60928
60990
|
if (sourceTypePredicate) {
|
|
60929
60991
|
result &= compareTypePredicateRelatedTo(sourceTypePredicate, targetTypePredicate, reportErrors2, errorReporter, compareTypes);
|
|
60930
|
-
} else if (isIdentifierTypePredicate(targetTypePredicate)) {
|
|
60992
|
+
} else if (isIdentifierTypePredicate(targetTypePredicate) || isThisTypePredicate(targetTypePredicate)) {
|
|
60931
60993
|
if (reportErrors2) {
|
|
60932
60994
|
errorReporter(Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source));
|
|
60933
60995
|
}
|
|
@@ -66647,7 +66709,7 @@ function createTypeChecker(host) {
|
|
|
66647
66709
|
case 80 /* Identifier */:
|
|
66648
66710
|
if (!isThisInTypeQuery(node)) {
|
|
66649
66711
|
const symbol = getResolvedSymbol(node);
|
|
66650
|
-
return isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol);
|
|
66712
|
+
return isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol) || !!symbol.valueDeclaration && isFunctionExpression(symbol.valueDeclaration);
|
|
66651
66713
|
}
|
|
66652
66714
|
break;
|
|
66653
66715
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -74659,7 +74721,7 @@ function createTypeChecker(host) {
|
|
|
74659
74721
|
true
|
|
74660
74722
|
);
|
|
74661
74723
|
}
|
|
74662
|
-
if (expr.kind === 213 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
|
|
74724
|
+
if (expr.kind === 213 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === getMergedSymbol(func.symbol) && (!isFunctionExpressionOrArrowFunction(func.symbol.valueDeclaration) || isConstantReference(expr.expression))) {
|
|
74663
74725
|
hasReturnOfTypeNever = true;
|
|
74664
74726
|
return;
|
|
74665
74727
|
}
|
|
@@ -83311,9 +83373,10 @@ function createTypeChecker(host) {
|
|
|
83311
83373
|
return false;
|
|
83312
83374
|
}
|
|
83313
83375
|
function declaredParameterTypeContainsUndefined(parameter) {
|
|
83314
|
-
|
|
83376
|
+
const typeNode = getNonlocalEffectiveTypeAnnotationNode(parameter);
|
|
83377
|
+
if (!typeNode)
|
|
83315
83378
|
return false;
|
|
83316
|
-
const type = getTypeFromTypeNode(
|
|
83379
|
+
const type = getTypeFromTypeNode(typeNode);
|
|
83317
83380
|
return containsUndefinedType(type);
|
|
83318
83381
|
}
|
|
83319
83382
|
function requiresAddingImplicitUndefined(parameter) {
|
|
@@ -83323,7 +83386,7 @@ function createTypeChecker(host) {
|
|
|
83323
83386
|
return !!strictNullChecks && !isOptionalParameter(parameter) && !isJSDocParameterTag(parameter) && !!parameter.initializer && !hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
|
|
83324
83387
|
}
|
|
83325
83388
|
function isOptionalUninitializedParameterProperty(parameter) {
|
|
83326
|
-
return strictNullChecks && isOptionalParameter(parameter) && !parameter.initializer && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
|
|
83389
|
+
return strictNullChecks && isOptionalParameter(parameter) && (isJSDocParameterTag(parameter) || !parameter.initializer) && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
|
|
83327
83390
|
}
|
|
83328
83391
|
function isExpandoFunctionDeclaration(node) {
|
|
83329
83392
|
const declaration = getParseTreeNode(node, isFunctionDeclaration);
|
|
@@ -83473,14 +83536,14 @@ function createTypeChecker(host) {
|
|
|
83473
83536
|
return 11 /* ObjectType */;
|
|
83474
83537
|
}
|
|
83475
83538
|
}
|
|
83476
|
-
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker
|
|
83539
|
+
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker) {
|
|
83477
83540
|
const declaration = getParseTreeNode(declarationIn, isVariableLikeOrAccessor);
|
|
83478
83541
|
if (!declaration) {
|
|
83479
83542
|
return factory.createToken(133 /* AnyKeyword */);
|
|
83480
83543
|
}
|
|
83481
83544
|
const symbol = getSymbolOfDeclaration(declaration);
|
|
83482
83545
|
const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
|
|
83483
|
-
return nodeBuilder.serializeTypeForDeclaration(type, symbol,
|
|
83546
|
+
return nodeBuilder.serializeTypeForDeclaration(declaration, type, symbol, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
83484
83547
|
}
|
|
83485
83548
|
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
83486
83549
|
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
@@ -109133,7 +109196,7 @@ function transformDeclarations(context) {
|
|
|
109133
109196
|
case 172 /* PropertyDeclaration */:
|
|
109134
109197
|
case 208 /* BindingElement */:
|
|
109135
109198
|
case 260 /* VariableDeclaration */:
|
|
109136
|
-
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker
|
|
109199
|
+
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
109137
109200
|
break;
|
|
109138
109201
|
case 262 /* FunctionDeclaration */:
|
|
109139
109202
|
case 180 /* ConstructSignature */:
|
package/lib/typescript.d.ts
CHANGED
|
@@ -3233,7 +3233,6 @@ declare namespace ts {
|
|
|
3233
3233
|
private addFilesToNonInferredProject;
|
|
3234
3234
|
private updateNonInferredProjectFiles;
|
|
3235
3235
|
private updateRootAndOptionsOfNonInferredProject;
|
|
3236
|
-
private sendConfigFileDiagEvent;
|
|
3237
3236
|
private getOrCreateInferredProjectForProjectRootPathIfEnabled;
|
|
3238
3237
|
private getOrCreateSingleInferredProjectIfEnabled;
|
|
3239
3238
|
private getOrCreateSingleInferredWithoutProjectRoot;
|