typescript 5.5.0-dev.20240408 → 5.5.0-dev.20240410
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 +116 -49
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +497 -88
- 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-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.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)
|
|
@@ -48119,7 +48125,7 @@ function createTypeChecker(host) {
|
|
|
48119
48125
|
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
48120
48126
|
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
48121
48127
|
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
48122
|
-
serializeTypeForDeclaration: (type, symbol,
|
|
48128
|
+
serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
|
|
48123
48129
|
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
48124
48130
|
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
48125
48131
|
indexInfo,
|
|
@@ -48142,6 +48148,18 @@ function createTypeChecker(host) {
|
|
|
48142
48148
|
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
48143
48149
|
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
48144
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
|
+
}
|
|
48145
48163
|
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
48146
48164
|
if (expr) {
|
|
48147
48165
|
const typeNode = isAssertionExpression(expr) ? expr.type : isJSDocTypeAssertion(expr) ? getJSDocTypeAssertionType(expr) : void 0;
|
|
@@ -48206,6 +48224,7 @@ function createTypeChecker(host) {
|
|
|
48206
48224
|
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : flags & 134217728 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
|
|
48207
48225
|
const context = {
|
|
48208
48226
|
enclosingDeclaration,
|
|
48227
|
+
enclosingFile: enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration),
|
|
48209
48228
|
flags: flags || 0 /* None */,
|
|
48210
48229
|
tracker: void 0,
|
|
48211
48230
|
encounteredError: false,
|
|
@@ -48738,7 +48757,7 @@ function createTypeChecker(host) {
|
|
|
48738
48757
|
if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) {
|
|
48739
48758
|
return node;
|
|
48740
48759
|
}
|
|
48741
|
-
return
|
|
48760
|
+
return setTextRange2(context, factory.cloneNode(visitEachChild(
|
|
48742
48761
|
node,
|
|
48743
48762
|
deepCloneOrReuseNode,
|
|
48744
48763
|
/*context*/
|
|
@@ -49080,7 +49099,13 @@ function createTypeChecker(host) {
|
|
|
49080
49099
|
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
49081
49100
|
context.reverseMappedStack.push(propertySymbol);
|
|
49082
49101
|
}
|
|
49083
|
-
propertyTypeNode = propertyType ? serializeTypeForDeclaration(
|
|
49102
|
+
propertyTypeNode = propertyType ? serializeTypeForDeclaration(
|
|
49103
|
+
context,
|
|
49104
|
+
/*declaration*/
|
|
49105
|
+
void 0,
|
|
49106
|
+
propertyType,
|
|
49107
|
+
propertySymbol
|
|
49108
|
+
) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
49084
49109
|
if (propertyIsReverseMapped) {
|
|
49085
49110
|
context.reverseMappedStack.pop();
|
|
49086
49111
|
}
|
|
@@ -49469,8 +49494,7 @@ function createTypeChecker(host) {
|
|
|
49469
49494
|
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
|
|
49470
49495
|
const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
|
|
49471
49496
|
const parameterType = getTypeOfSymbol(parameterSymbol);
|
|
49472
|
-
const
|
|
49473
|
-
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, addUndefined);
|
|
49497
|
+
const parameterTypeNode = serializeTypeForDeclaration(context, parameterDeclaration, parameterType, parameterSymbol);
|
|
49474
49498
|
const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
|
|
49475
49499
|
const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
49476
49500
|
const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
|
|
@@ -50062,10 +50086,12 @@ function createTypeChecker(host) {
|
|
|
50062
50086
|
}
|
|
50063
50087
|
return enclosingDeclaration;
|
|
50064
50088
|
}
|
|
50065
|
-
function serializeTypeForDeclaration(context, type, symbol
|
|
50089
|
+
function serializeTypeForDeclaration(context, declaration, type, symbol) {
|
|
50066
50090
|
var _a;
|
|
50091
|
+
const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
50092
|
+
const enclosingDeclaration = context.enclosingDeclaration;
|
|
50067
50093
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
50068
|
-
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
50094
|
+
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
50069
50095
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
50070
50096
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
50071
50097
|
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
@@ -50078,7 +50104,7 @@ function createTypeChecker(host) {
|
|
|
50078
50104
|
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
|
|
50079
50105
|
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
|
|
50080
50106
|
}
|
|
50081
|
-
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]);
|
|
50082
50108
|
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
50083
50109
|
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
|
|
50084
50110
|
context.flags = oldFlags;
|
|
@@ -50192,7 +50218,7 @@ function createTypeChecker(host) {
|
|
|
50192
50218
|
const type = getDeclaredTypeOfSymbol(sym);
|
|
50193
50219
|
const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node2);
|
|
50194
50220
|
name.symbol = sym;
|
|
50195
|
-
return
|
|
50221
|
+
return setTextRange2(context, setEmitFlags(name, 16777216 /* NoAsciiEscaping */), node2);
|
|
50196
50222
|
}
|
|
50197
50223
|
const updated = visitEachChild(
|
|
50198
50224
|
node2,
|
|
@@ -50201,7 +50227,7 @@ function createTypeChecker(host) {
|
|
|
50201
50227
|
void 0
|
|
50202
50228
|
);
|
|
50203
50229
|
if (updated !== node2) {
|
|
50204
|
-
|
|
50230
|
+
setTextRange2(context, updated, node2);
|
|
50205
50231
|
}
|
|
50206
50232
|
return updated;
|
|
50207
50233
|
}
|
|
@@ -50215,12 +50241,12 @@ function createTypeChecker(host) {
|
|
|
50215
50241
|
if (hadError) {
|
|
50216
50242
|
return void 0;
|
|
50217
50243
|
}
|
|
50218
|
-
return transformed
|
|
50244
|
+
return transformed;
|
|
50219
50245
|
function visitExistingNodeTreeSymbols(node) {
|
|
50220
50246
|
const onExitNewScope = isNewScopeNode(node) ? onEnterNewScope(node) : void 0;
|
|
50221
50247
|
const result = visitExistingNodeTreeSymbolsWorker(node);
|
|
50222
50248
|
onExitNewScope == null ? void 0 : onExitNewScope();
|
|
50223
|
-
return result;
|
|
50249
|
+
return result === node ? setTextRange2(context, factory.cloneNode(result), node) : result;
|
|
50224
50250
|
}
|
|
50225
50251
|
function onEnterNewScope(node) {
|
|
50226
50252
|
const oldContex = context;
|
|
@@ -50356,7 +50382,7 @@ function createTypeChecker(host) {
|
|
|
50356
50382
|
void 0
|
|
50357
50383
|
);
|
|
50358
50384
|
if (visited === node) {
|
|
50359
|
-
visited =
|
|
50385
|
+
visited = setTextRange2(context, factory.cloneNode(node), node);
|
|
50360
50386
|
}
|
|
50361
50387
|
visited.type = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50362
50388
|
if (isParameter(node)) {
|
|
@@ -50379,11 +50405,16 @@ function createTypeChecker(host) {
|
|
|
50379
50405
|
/*context*/
|
|
50380
50406
|
void 0
|
|
50381
50407
|
);
|
|
50382
|
-
const clone =
|
|
50408
|
+
const clone = setTextRange2(context, visited === node ? factory.cloneNode(node) : visited, node);
|
|
50383
50409
|
const flags = getEmitFlags(clone);
|
|
50384
50410
|
setEmitFlags(clone, flags | (context.flags & 1024 /* MultilineObjectLiterals */ && isTypeLiteralNode(node) ? 0 : 1 /* SingleLine */));
|
|
50385
50411
|
return clone;
|
|
50386
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
|
+
}
|
|
50387
50418
|
if (isConditionalTypeNode(node)) {
|
|
50388
50419
|
const checkType = visitNode(node.checkType, visitExistingNodeTreeSymbols, isTypeNode);
|
|
50389
50420
|
const disposeScope = onEnterNewScope(node);
|
|
@@ -50762,7 +50793,8 @@ function createTypeChecker(host) {
|
|
|
50762
50793
|
);
|
|
50763
50794
|
context.tracker.trackSymbol(type.symbol, context.enclosingDeclaration, 111551 /* Value */);
|
|
50764
50795
|
} else {
|
|
50765
|
-
const statement =
|
|
50796
|
+
const statement = setTextRange2(
|
|
50797
|
+
context,
|
|
50766
50798
|
factory.createVariableStatement(
|
|
50767
50799
|
/*modifiers*/
|
|
50768
50800
|
void 0,
|
|
@@ -50771,7 +50803,13 @@ function createTypeChecker(host) {
|
|
|
50771
50803
|
name,
|
|
50772
50804
|
/*exclamationToken*/
|
|
50773
50805
|
void 0,
|
|
50774
|
-
serializeTypeForDeclaration(
|
|
50806
|
+
serializeTypeForDeclaration(
|
|
50807
|
+
context,
|
|
50808
|
+
/*declaration*/
|
|
50809
|
+
void 0,
|
|
50810
|
+
type,
|
|
50811
|
+
symbol
|
|
50812
|
+
)
|
|
50775
50813
|
)
|
|
50776
50814
|
], flags)
|
|
50777
50815
|
),
|
|
@@ -51044,7 +51082,7 @@ function createTypeChecker(host) {
|
|
|
51044
51082
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
|
51045
51083
|
for (const sig of signatures) {
|
|
51046
51084
|
const decl = signatureToSignatureDeclarationHelper(sig, 262 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName) });
|
|
51047
|
-
addResult(
|
|
51085
|
+
addResult(setTextRange2(context, decl, getSignatureTextRangeLocation(sig)), modifierFlags);
|
|
51048
51086
|
}
|
|
51049
51087
|
if (!(symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && !!symbol.exports && !!symbol.exports.size)) {
|
|
51050
51088
|
const props = filter(getPropertiesOfType(type), isNamespaceMember);
|
|
@@ -51222,7 +51260,8 @@ function createTypeChecker(host) {
|
|
|
51222
51260
|
const indexSignatures = serializeIndexSignatures(classType, baseTypes[0]);
|
|
51223
51261
|
context.enclosingDeclaration = oldEnclosing;
|
|
51224
51262
|
addResult(
|
|
51225
|
-
|
|
51263
|
+
setTextRange2(
|
|
51264
|
+
context,
|
|
51226
51265
|
factory.createClassDeclaration(
|
|
51227
51266
|
/*modifiers*/
|
|
51228
51267
|
void 0,
|
|
@@ -51582,7 +51621,13 @@ function createTypeChecker(host) {
|
|
|
51582
51621
|
varName,
|
|
51583
51622
|
/*exclamationToken*/
|
|
51584
51623
|
void 0,
|
|
51585
|
-
serializeTypeForDeclaration(
|
|
51624
|
+
serializeTypeForDeclaration(
|
|
51625
|
+
context,
|
|
51626
|
+
/*declaration*/
|
|
51627
|
+
void 0,
|
|
51628
|
+
typeToSerialize,
|
|
51629
|
+
symbol
|
|
51630
|
+
)
|
|
51586
51631
|
)
|
|
51587
51632
|
], flags)
|
|
51588
51633
|
);
|
|
@@ -51654,7 +51699,8 @@ function createTypeChecker(host) {
|
|
|
51654
51699
|
});
|
|
51655
51700
|
Debug.assert(!!setter);
|
|
51656
51701
|
const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : void 0;
|
|
51657
|
-
result.push(
|
|
51702
|
+
result.push(setTextRange2(
|
|
51703
|
+
context,
|
|
51658
51704
|
factory.createSetAccessorDeclaration(
|
|
51659
51705
|
factory.createModifiersFromModifierFlags(flag),
|
|
51660
51706
|
name,
|
|
@@ -51666,7 +51712,13 @@ function createTypeChecker(host) {
|
|
|
51666
51712
|
paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context) : "value",
|
|
51667
51713
|
/*questionToken*/
|
|
51668
51714
|
void 0,
|
|
51669
|
-
isPrivate ? void 0 : serializeTypeForDeclaration(
|
|
51715
|
+
isPrivate ? void 0 : serializeTypeForDeclaration(
|
|
51716
|
+
context,
|
|
51717
|
+
/*declaration*/
|
|
51718
|
+
void 0,
|
|
51719
|
+
getTypeOfSymbol(p),
|
|
51720
|
+
p
|
|
51721
|
+
)
|
|
51670
51722
|
)],
|
|
51671
51723
|
/*body*/
|
|
51672
51724
|
void 0
|
|
@@ -51676,12 +51728,19 @@ function createTypeChecker(host) {
|
|
|
51676
51728
|
}
|
|
51677
51729
|
if (p.flags & 32768 /* GetAccessor */) {
|
|
51678
51730
|
const isPrivate2 = modifierFlags & 2 /* Private */;
|
|
51679
|
-
result.push(
|
|
51731
|
+
result.push(setTextRange2(
|
|
51732
|
+
context,
|
|
51680
51733
|
factory.createGetAccessorDeclaration(
|
|
51681
51734
|
factory.createModifiersFromModifierFlags(flag),
|
|
51682
51735
|
name,
|
|
51683
51736
|
[],
|
|
51684
|
-
isPrivate2 ? void 0 : serializeTypeForDeclaration(
|
|
51737
|
+
isPrivate2 ? void 0 : serializeTypeForDeclaration(
|
|
51738
|
+
context,
|
|
51739
|
+
/*declaration*/
|
|
51740
|
+
void 0,
|
|
51741
|
+
getTypeOfSymbol(p),
|
|
51742
|
+
p
|
|
51743
|
+
),
|
|
51685
51744
|
/*body*/
|
|
51686
51745
|
void 0
|
|
51687
51746
|
),
|
|
@@ -51690,12 +51749,19 @@ function createTypeChecker(host) {
|
|
|
51690
51749
|
}
|
|
51691
51750
|
return result;
|
|
51692
51751
|
} else if (p.flags & (4 /* Property */ | 3 /* Variable */ | 98304 /* Accessor */)) {
|
|
51693
|
-
return
|
|
51752
|
+
return setTextRange2(
|
|
51753
|
+
context,
|
|
51694
51754
|
createProperty2(
|
|
51695
51755
|
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
|
|
51696
51756
|
name,
|
|
51697
51757
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
51698
|
-
isPrivate ? void 0 : serializeTypeForDeclaration(
|
|
51758
|
+
isPrivate ? void 0 : serializeTypeForDeclaration(
|
|
51759
|
+
context,
|
|
51760
|
+
/*declaration*/
|
|
51761
|
+
void 0,
|
|
51762
|
+
getWriteTypeOfSymbol(p),
|
|
51763
|
+
p
|
|
51764
|
+
),
|
|
51699
51765
|
// TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
|
|
51700
51766
|
// interface members can't have initializers, however class members _can_
|
|
51701
51767
|
/*initializer*/
|
|
@@ -51708,7 +51774,8 @@ function createTypeChecker(host) {
|
|
|
51708
51774
|
const type = getTypeOfSymbol(p);
|
|
51709
51775
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
|
51710
51776
|
if (flag & 2 /* Private */) {
|
|
51711
|
-
return
|
|
51777
|
+
return setTextRange2(
|
|
51778
|
+
context,
|
|
51712
51779
|
createProperty2(
|
|
51713
51780
|
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
|
|
51714
51781
|
name,
|
|
@@ -51734,7 +51801,7 @@ function createTypeChecker(host) {
|
|
|
51734
51801
|
}
|
|
51735
51802
|
);
|
|
51736
51803
|
const location = sig.declaration && isPrototypePropertyAssignment(sig.declaration.parent) ? sig.declaration.parent : sig.declaration;
|
|
51737
|
-
results2.push(
|
|
51804
|
+
results2.push(setTextRange2(context, decl, location));
|
|
51738
51805
|
}
|
|
51739
51806
|
return results2;
|
|
51740
51807
|
}
|
|
@@ -51790,7 +51857,8 @@ function createTypeChecker(host) {
|
|
|
51790
51857
|
}
|
|
51791
51858
|
}
|
|
51792
51859
|
if (privateProtected) {
|
|
51793
|
-
return [
|
|
51860
|
+
return [setTextRange2(
|
|
51861
|
+
context,
|
|
51794
51862
|
factory.createConstructorDeclaration(
|
|
51795
51863
|
factory.createModifiersFromModifierFlags(privateProtected),
|
|
51796
51864
|
/*parameters*/
|
|
@@ -51805,7 +51873,7 @@ function createTypeChecker(host) {
|
|
|
51805
51873
|
const results2 = [];
|
|
51806
51874
|
for (const sig of signatures) {
|
|
51807
51875
|
const decl = signatureToSignatureDeclarationHelper(sig, outputKind, context);
|
|
51808
|
-
results2.push(
|
|
51876
|
+
results2.push(setTextRange2(context, decl, sig.declaration));
|
|
51809
51877
|
}
|
|
51810
51878
|
return results2;
|
|
51811
51879
|
}
|
|
@@ -55488,12 +55556,10 @@ function createTypeChecker(host) {
|
|
|
55488
55556
|
const target = type.target ?? type;
|
|
55489
55557
|
const typeVariable = getHomomorphicTypeVariable(target);
|
|
55490
55558
|
if (typeVariable && !target.declaration.nameType) {
|
|
55491
|
-
const
|
|
55492
|
-
|
|
55493
|
-
|
|
55494
|
-
|
|
55495
|
-
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
|
|
55496
|
-
}
|
|
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));
|
|
55497
55563
|
}
|
|
55498
55564
|
}
|
|
55499
55565
|
return type;
|
|
@@ -55654,13 +55720,13 @@ function createTypeChecker(host) {
|
|
|
55654
55720
|
}
|
|
55655
55721
|
function getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment) {
|
|
55656
55722
|
var _a, _b, _c;
|
|
55657
|
-
let property = (
|
|
55723
|
+
let property = skipObjectFunctionPropertyAugment ? (_a = type.propertyCacheWithoutObjectFunctionPropertyAugment) == null ? void 0 : _a.get(name) : (_b = type.propertyCache) == null ? void 0 : _b.get(name);
|
|
55658
55724
|
if (!property) {
|
|
55659
55725
|
property = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
|
|
55660
55726
|
if (property) {
|
|
55661
55727
|
const properties = skipObjectFunctionPropertyAugment ? type.propertyCacheWithoutObjectFunctionPropertyAugment || (type.propertyCacheWithoutObjectFunctionPropertyAugment = createSymbolTable()) : type.propertyCache || (type.propertyCache = createSymbolTable());
|
|
55662
55728
|
properties.set(name, property);
|
|
55663
|
-
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))) {
|
|
55664
55730
|
const properties2 = type.propertyCache || (type.propertyCache = createSymbolTable());
|
|
55665
55731
|
properties2.set(name, property);
|
|
55666
55732
|
}
|
|
@@ -60923,7 +60989,7 @@ function createTypeChecker(host) {
|
|
|
60923
60989
|
const sourceTypePredicate = getTypePredicateOfSignature(source);
|
|
60924
60990
|
if (sourceTypePredicate) {
|
|
60925
60991
|
result &= compareTypePredicateRelatedTo(sourceTypePredicate, targetTypePredicate, reportErrors2, errorReporter, compareTypes);
|
|
60926
|
-
} else if (isIdentifierTypePredicate(targetTypePredicate)) {
|
|
60992
|
+
} else if (isIdentifierTypePredicate(targetTypePredicate) || isThisTypePredicate(targetTypePredicate)) {
|
|
60927
60993
|
if (reportErrors2) {
|
|
60928
60994
|
errorReporter(Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source));
|
|
60929
60995
|
}
|
|
@@ -83307,9 +83373,10 @@ function createTypeChecker(host) {
|
|
|
83307
83373
|
return false;
|
|
83308
83374
|
}
|
|
83309
83375
|
function declaredParameterTypeContainsUndefined(parameter) {
|
|
83310
|
-
|
|
83376
|
+
const typeNode = getNonlocalEffectiveTypeAnnotationNode(parameter);
|
|
83377
|
+
if (!typeNode)
|
|
83311
83378
|
return false;
|
|
83312
|
-
const type = getTypeFromTypeNode(
|
|
83379
|
+
const type = getTypeFromTypeNode(typeNode);
|
|
83313
83380
|
return containsUndefinedType(type);
|
|
83314
83381
|
}
|
|
83315
83382
|
function requiresAddingImplicitUndefined(parameter) {
|
|
@@ -83319,7 +83386,7 @@ function createTypeChecker(host) {
|
|
|
83319
83386
|
return !!strictNullChecks && !isOptionalParameter(parameter) && !isJSDocParameterTag(parameter) && !!parameter.initializer && !hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
|
|
83320
83387
|
}
|
|
83321
83388
|
function isOptionalUninitializedParameterProperty(parameter) {
|
|
83322
|
-
return strictNullChecks && isOptionalParameter(parameter) && !parameter.initializer && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
|
|
83389
|
+
return strictNullChecks && isOptionalParameter(parameter) && (isJSDocParameterTag(parameter) || !parameter.initializer) && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
|
|
83323
83390
|
}
|
|
83324
83391
|
function isExpandoFunctionDeclaration(node) {
|
|
83325
83392
|
const declaration = getParseTreeNode(node, isFunctionDeclaration);
|
|
@@ -83469,14 +83536,14 @@ function createTypeChecker(host) {
|
|
|
83469
83536
|
return 11 /* ObjectType */;
|
|
83470
83537
|
}
|
|
83471
83538
|
}
|
|
83472
|
-
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker
|
|
83539
|
+
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker) {
|
|
83473
83540
|
const declaration = getParseTreeNode(declarationIn, isVariableLikeOrAccessor);
|
|
83474
83541
|
if (!declaration) {
|
|
83475
83542
|
return factory.createToken(133 /* AnyKeyword */);
|
|
83476
83543
|
}
|
|
83477
83544
|
const symbol = getSymbolOfDeclaration(declaration);
|
|
83478
83545
|
const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
|
|
83479
|
-
return nodeBuilder.serializeTypeForDeclaration(type, symbol,
|
|
83546
|
+
return nodeBuilder.serializeTypeForDeclaration(declaration, type, symbol, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
83480
83547
|
}
|
|
83481
83548
|
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
83482
83549
|
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
@@ -109129,7 +109196,7 @@ function transformDeclarations(context) {
|
|
|
109129
109196
|
case 172 /* PropertyDeclaration */:
|
|
109130
109197
|
case 208 /* BindingElement */:
|
|
109131
109198
|
case 260 /* VariableDeclaration */:
|
|
109132
|
-
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker
|
|
109199
|
+
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
109133
109200
|
break;
|
|
109134
109201
|
case 262 /* FunctionDeclaration */:
|
|
109135
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;
|