typescript 5.5.0-dev.20240328 → 5.5.0-dev.20240329
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 +157 -153
- package/lib/typescript.js +198 -191
- 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.20240329`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -42684,13 +42684,21 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
42684
42684
|
}
|
|
42685
42685
|
const nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, getDirectoryPath(modulePath));
|
|
42686
42686
|
const nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
|
|
42687
|
-
|
|
42687
|
+
const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
|
|
42688
|
+
if (!packageJsonPathsAreEqual(nearestTargetPackageJson, nearestSourcePackageJson, ignoreCase)) {
|
|
42688
42689
|
return maybeNonRelative;
|
|
42689
42690
|
}
|
|
42690
42691
|
return relativePath;
|
|
42691
42692
|
}
|
|
42692
42693
|
return isPathRelativeToParent(maybeNonRelative) || countPathComponents(relativePath) < countPathComponents(maybeNonRelative) ? relativePath : maybeNonRelative;
|
|
42693
42694
|
}
|
|
42695
|
+
function packageJsonPathsAreEqual(a, b, ignoreCase) {
|
|
42696
|
+
if (a === b)
|
|
42697
|
+
return true;
|
|
42698
|
+
if (a === void 0 || b === void 0)
|
|
42699
|
+
return false;
|
|
42700
|
+
return comparePaths(a, b, ignoreCase) === 0 /* EqualTo */;
|
|
42701
|
+
}
|
|
42694
42702
|
function countPathComponents(path) {
|
|
42695
42703
|
let count = 0;
|
|
42696
42704
|
for (let i = startsWith(path, "./") ? 2 : 0; i < path.length; i++) {
|
|
@@ -47958,17 +47966,8 @@ function createTypeChecker(host) {
|
|
|
47958
47966
|
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
47959
47967
|
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
47960
47968
|
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
47961
|
-
serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(
|
|
47962
|
-
|
|
47963
|
-
type,
|
|
47964
|
-
symbol,
|
|
47965
|
-
enclosingDeclaration,
|
|
47966
|
-
/*includePrivateSymbol*/
|
|
47967
|
-
void 0,
|
|
47968
|
-
/*bundled*/
|
|
47969
|
-
void 0,
|
|
47970
|
-
addUndefined
|
|
47971
|
-
)),
|
|
47969
|
+
serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, addUndefined)),
|
|
47970
|
+
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
47972
47971
|
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
47973
47972
|
indexInfo,
|
|
47974
47973
|
context,
|
|
@@ -47987,7 +47986,7 @@ function createTypeChecker(host) {
|
|
|
47987
47986
|
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
|
|
47988
47987
|
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
|
|
47989
47988
|
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
|
|
47990
|
-
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker
|
|
47989
|
+
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
47991
47990
|
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
47992
47991
|
};
|
|
47993
47992
|
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
@@ -48005,12 +48004,12 @@ function createTypeChecker(host) {
|
|
|
48005
48004
|
}
|
|
48006
48005
|
return typeToTypeNodeHelper(type, context);
|
|
48007
48006
|
}
|
|
48008
|
-
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined
|
|
48007
|
+
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined) {
|
|
48009
48008
|
const originalType = type;
|
|
48010
48009
|
if (addUndefined) {
|
|
48011
48010
|
type = getOptionalType(type);
|
|
48012
48011
|
}
|
|
48013
|
-
const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2
|
|
48012
|
+
const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
|
|
48014
48013
|
if (clone) {
|
|
48015
48014
|
if (addUndefined && !someType(getTypeFromTypeNode(typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
|
|
48016
48015
|
return factory.createUnionTypeNode([clone, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
@@ -48018,16 +48017,16 @@ function createTypeChecker(host) {
|
|
|
48018
48017
|
return clone;
|
|
48019
48018
|
}
|
|
48020
48019
|
if (addUndefined && originalType !== type) {
|
|
48021
|
-
const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host2
|
|
48020
|
+
const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host2);
|
|
48022
48021
|
if (cloneMissingUndefined) {
|
|
48023
48022
|
return factory.createUnionTypeNode([cloneMissingUndefined, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
48024
48023
|
}
|
|
48025
48024
|
}
|
|
48026
48025
|
return void 0;
|
|
48027
48026
|
}
|
|
48028
|
-
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration,
|
|
48027
|
+
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, annotationType) {
|
|
48029
48028
|
if (typeNodeIsEquivalentToType(existing, host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
48030
|
-
const result = tryReuseExistingTypeNodeHelper(context, existing
|
|
48029
|
+
const result = tryReuseExistingTypeNodeHelper(context, existing);
|
|
48031
48030
|
if (result) {
|
|
48032
48031
|
return result;
|
|
48033
48032
|
}
|
|
@@ -48062,7 +48061,8 @@ function createTypeChecker(host) {
|
|
|
48062
48061
|
symbolDepth: void 0,
|
|
48063
48062
|
inferTypeParameters: void 0,
|
|
48064
48063
|
approximateLength: 0,
|
|
48065
|
-
trackedSymbols: void 0
|
|
48064
|
+
trackedSymbols: void 0,
|
|
48065
|
+
bundled: !!compilerOptions.outFile && !!enclosingDeclaration && isExternalOrCommonJsModule(getSourceFileOfNode(enclosingDeclaration))
|
|
48066
48066
|
};
|
|
48067
48067
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
|
48068
48068
|
const resultingNode = cb(context);
|
|
@@ -49053,9 +49053,8 @@ function createTypeChecker(host) {
|
|
|
49053
49053
|
}
|
|
49054
49054
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
49055
49055
|
var _a;
|
|
49056
|
-
const
|
|
49057
|
-
|
|
49058
|
-
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
49056
|
+
const flags = context.flags;
|
|
49057
|
+
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
49059
49058
|
context.approximateLength += 3;
|
|
49060
49059
|
let typeParameters;
|
|
49061
49060
|
let typeArguments;
|
|
@@ -49131,27 +49130,17 @@ function createTypeChecker(host) {
|
|
|
49131
49130
|
);
|
|
49132
49131
|
}
|
|
49133
49132
|
}
|
|
49134
|
-
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor
|
|
49133
|
+
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor */));
|
|
49135
49134
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
49136
49135
|
if (thisParameter) {
|
|
49137
49136
|
parameters.unshift(thisParameter);
|
|
49138
49137
|
}
|
|
49139
|
-
|
|
49140
|
-
const
|
|
49141
|
-
if (typePredicate) {
|
|
49142
|
-
returnTypeNode = typePredicateToTypePredicateNodeHelper(typePredicate, context);
|
|
49143
|
-
} else {
|
|
49144
|
-
const returnType = getReturnTypeOfSignature(signature);
|
|
49145
|
-
if (returnType && !(suppressAny && isTypeAny(returnType))) {
|
|
49146
|
-
returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports);
|
|
49147
|
-
} else if (!suppressAny) {
|
|
49148
|
-
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
49149
|
-
}
|
|
49150
|
-
}
|
|
49138
|
+
context.flags = flags;
|
|
49139
|
+
const returnTypeNode = serializeReturnTypeForSignature(context, signature);
|
|
49151
49140
|
let modifiers = options == null ? void 0 : options.modifiers;
|
|
49152
49141
|
if (kind === 185 /* ConstructorType */ && signature.flags & 4 /* Abstract */) {
|
|
49153
|
-
const
|
|
49154
|
-
modifiers = factory.createModifiersFromModifierFlags(
|
|
49142
|
+
const flags2 = modifiersToFlags(modifiers);
|
|
49143
|
+
modifiers = factory.createModifiersFromModifierFlags(flags2 | 64 /* Abstract */);
|
|
49155
49144
|
}
|
|
49156
49145
|
const node = kind === 179 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 180 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 173 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 174 /* MethodDeclaration */ ? factory.createMethodDeclaration(
|
|
49157
49146
|
modifiers,
|
|
@@ -49280,11 +49269,11 @@ function createTypeChecker(host) {
|
|
|
49280
49269
|
return getDeclarationOfKind(parameterSymbol, 341 /* JSDocParameterTag */);
|
|
49281
49270
|
}
|
|
49282
49271
|
}
|
|
49283
|
-
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags
|
|
49272
|
+
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
|
|
49284
49273
|
const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
|
|
49285
49274
|
const parameterType = getTypeOfSymbol(parameterSymbol);
|
|
49286
49275
|
const addUndefined = parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration);
|
|
49287
|
-
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration,
|
|
49276
|
+
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, addUndefined);
|
|
49288
49277
|
const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
|
|
49289
49278
|
const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
49290
49279
|
const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
|
|
@@ -49853,7 +49842,7 @@ function createTypeChecker(host) {
|
|
|
49853
49842
|
return initial;
|
|
49854
49843
|
}
|
|
49855
49844
|
function getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration) {
|
|
49856
|
-
return symbol.declarations && find(symbol.declarations, (s) => !!
|
|
49845
|
+
return symbol.declarations && find(symbol.declarations, (s) => !!getNonlocalEffectiveTypeAnnotationNode(s) && (!enclosingDeclaration || !!findAncestor(s, (n) => n === enclosingDeclaration)));
|
|
49857
49846
|
}
|
|
49858
49847
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
49859
49848
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
@@ -49864,13 +49853,13 @@ function createTypeChecker(host) {
|
|
|
49864
49853
|
}
|
|
49865
49854
|
return enclosingDeclaration;
|
|
49866
49855
|
}
|
|
49867
|
-
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration,
|
|
49856
|
+
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, addUndefined) {
|
|
49868
49857
|
var _a;
|
|
49869
49858
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
49870
49859
|
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
49871
49860
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
49872
|
-
const existing =
|
|
49873
|
-
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined
|
|
49861
|
+
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
49862
|
+
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
49874
49863
|
if (result2) {
|
|
49875
49864
|
return result2;
|
|
49876
49865
|
}
|
|
@@ -49895,22 +49884,43 @@ function createTypeChecker(host) {
|
|
|
49895
49884
|
}
|
|
49896
49885
|
return false;
|
|
49897
49886
|
}
|
|
49898
|
-
function serializeReturnTypeForSignature(context,
|
|
49887
|
+
function serializeReturnTypeForSignature(context, signature) {
|
|
49888
|
+
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
49889
|
+
const flags = context.flags;
|
|
49890
|
+
if (suppressAny)
|
|
49891
|
+
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
49892
|
+
let returnTypeNode;
|
|
49893
|
+
const returnType = getReturnTypeOfSignature(signature);
|
|
49894
|
+
if (returnType && !(suppressAny && isTypeAny(returnType))) {
|
|
49895
|
+
returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature);
|
|
49896
|
+
} else if (!suppressAny) {
|
|
49897
|
+
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
49898
|
+
}
|
|
49899
|
+
context.flags = flags;
|
|
49900
|
+
return returnTypeNode;
|
|
49901
|
+
}
|
|
49902
|
+
function serializeReturnTypeForSignatureWorker(context, signature) {
|
|
49903
|
+
const typePredicate = getTypePredicateOfSignature(signature);
|
|
49904
|
+
const type = getReturnTypeOfSignature(signature);
|
|
49899
49905
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
49900
|
-
const annotation = signature.declaration &&
|
|
49906
|
+
const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
49901
49907
|
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
49902
49908
|
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
49903
49909
|
const annotated = getTypeFromTypeNode(annotation);
|
|
49904
49910
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
49905
|
-
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration,
|
|
49911
|
+
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, thisInstantiated);
|
|
49906
49912
|
if (result) {
|
|
49907
49913
|
return result;
|
|
49908
49914
|
}
|
|
49909
49915
|
}
|
|
49910
49916
|
}
|
|
49911
|
-
|
|
49917
|
+
if (typePredicate) {
|
|
49918
|
+
return typePredicateToTypePredicateNodeHelper(typePredicate, context);
|
|
49919
|
+
}
|
|
49920
|
+
const expr = signature.declaration && getPossibleTypeNodeReuseExpression(signature.declaration);
|
|
49921
|
+
return expressionOrTypeToTypeNode(context, expr, type);
|
|
49912
49922
|
}
|
|
49913
|
-
function trackExistingEntityName(node, context
|
|
49923
|
+
function trackExistingEntityName(node, context) {
|
|
49914
49924
|
let introducesError = false;
|
|
49915
49925
|
const leftmost = getFirstIdentifier(node);
|
|
49916
49926
|
if (isInJSFile(node) && (isExportsIdentifier(leftmost) || isModuleExportsAccessExpression(leftmost.parent) || isQualifiedName(leftmost.parent) && isModuleIdentifier(leftmost.parent.left) && isExportsIdentifier(leftmost.parent.right))) {
|
|
@@ -49939,7 +49949,6 @@ function createTypeChecker(host) {
|
|
|
49939
49949
|
}
|
|
49940
49950
|
} else {
|
|
49941
49951
|
context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning);
|
|
49942
|
-
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
|
|
49943
49952
|
}
|
|
49944
49953
|
if (isIdentifier(node)) {
|
|
49945
49954
|
const type = getDeclaredTypeOfSymbol(sym);
|
|
@@ -49950,7 +49959,7 @@ function createTypeChecker(host) {
|
|
|
49950
49959
|
}
|
|
49951
49960
|
return { introducesError, node };
|
|
49952
49961
|
}
|
|
49953
|
-
function tryReuseExistingTypeNodeHelper(context, existing
|
|
49962
|
+
function tryReuseExistingTypeNodeHelper(context, existing) {
|
|
49954
49963
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
49955
49964
|
cancellationToken.throwIfCancellationRequested();
|
|
49956
49965
|
}
|
|
@@ -50073,33 +50082,27 @@ function createTypeChecker(host) {
|
|
|
50073
50082
|
node.isTypeOf
|
|
50074
50083
|
);
|
|
50075
50084
|
}
|
|
50076
|
-
if (
|
|
50077
|
-
|
|
50078
|
-
return factory.updateParameterDeclaration(
|
|
50079
|
-
node,
|
|
50080
|
-
/*modifiers*/
|
|
50081
|
-
void 0,
|
|
50082
|
-
node.dotDotDotToken,
|
|
50083
|
-
visitEachChild(
|
|
50084
|
-
node.name,
|
|
50085
|
-
visitExistingNodeTreeSymbols,
|
|
50086
|
-
/*context*/
|
|
50087
|
-
void 0
|
|
50088
|
-
),
|
|
50089
|
-
node.questionToken,
|
|
50090
|
-
factory.createKeywordTypeNode(133 /* AnyKeyword */),
|
|
50091
|
-
/*initializer*/
|
|
50092
|
-
void 0
|
|
50093
|
-
);
|
|
50094
|
-
}
|
|
50085
|
+
if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
|
|
50086
|
+
return void 0;
|
|
50095
50087
|
}
|
|
50096
|
-
if (isPropertySignature(node)) {
|
|
50097
|
-
|
|
50098
|
-
|
|
50088
|
+
if (isFunctionLike(node) && !node.type || isPropertyDeclaration(node) && !node.type && !node.initializer || isPropertySignature(node) && !node.type && !node.initializer || isParameter(node) && !node.type && !node.initializer) {
|
|
50089
|
+
let visited = visitEachChild(
|
|
50090
|
+
node,
|
|
50091
|
+
visitExistingNodeTreeSymbols,
|
|
50092
|
+
/*context*/
|
|
50093
|
+
void 0
|
|
50094
|
+
);
|
|
50095
|
+
if (visited === node) {
|
|
50096
|
+
visited = setTextRange(factory.cloneNode(node), node);
|
|
50099
50097
|
}
|
|
50098
|
+
visited.type = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50099
|
+
if (isParameter(node)) {
|
|
50100
|
+
visited.modifiers = void 0;
|
|
50101
|
+
}
|
|
50102
|
+
return visited;
|
|
50100
50103
|
}
|
|
50101
50104
|
if (isEntityName(node) || isEntityNameExpression(node)) {
|
|
50102
|
-
const { introducesError, node: result } = trackExistingEntityName(node, context
|
|
50105
|
+
const { introducesError, node: result } = trackExistingEntityName(node, context);
|
|
50103
50106
|
hadError = hadError || introducesError;
|
|
50104
50107
|
if (result !== node) {
|
|
50105
50108
|
return result;
|
|
@@ -50130,7 +50133,7 @@ function createTypeChecker(host) {
|
|
|
50130
50133
|
return p.name && isIdentifier(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`;
|
|
50131
50134
|
}
|
|
50132
50135
|
function rewriteModuleSpecifier(parent, lit) {
|
|
50133
|
-
if (bundled) {
|
|
50136
|
+
if (context.bundled) {
|
|
50134
50137
|
if (context.tracker && context.tracker.moduleResolverHost) {
|
|
50135
50138
|
const targetFile = getExternalModuleFileFromDeclaration(parent);
|
|
50136
50139
|
if (targetFile) {
|
|
@@ -50149,7 +50152,7 @@ function createTypeChecker(host) {
|
|
|
50149
50152
|
}
|
|
50150
50153
|
}
|
|
50151
50154
|
}
|
|
50152
|
-
function symbolTableToDeclarationStatements(symbolTable, context
|
|
50155
|
+
function symbolTableToDeclarationStatements(symbolTable, context) {
|
|
50153
50156
|
var _a;
|
|
50154
50157
|
const serializePropertySymbolForClass = makeSerializePropertySymbol(
|
|
50155
50158
|
factory.createPropertyDeclaration,
|
|
@@ -50208,7 +50211,7 @@ function createTypeChecker(host) {
|
|
|
50208
50211
|
const baseName = unescapeLeadingUnderscores(name);
|
|
50209
50212
|
void getInternalSymbolName(symbol, baseName);
|
|
50210
50213
|
});
|
|
50211
|
-
let addingDeclare = !bundled;
|
|
50214
|
+
let addingDeclare = !context.bundled;
|
|
50212
50215
|
const exportEquals = symbolTable.get("export=" /* ExportEquals */);
|
|
50213
50216
|
if (exportEquals && symbolTable.size > 1 && exportEquals.flags & (2097152 /* Alias */ | 1536 /* Module */)) {
|
|
50214
50217
|
symbolTable = createSymbolTable();
|
|
@@ -50489,7 +50492,7 @@ function createTypeChecker(host) {
|
|
|
50489
50492
|
name,
|
|
50490
50493
|
/*exclamationToken*/
|
|
50491
50494
|
void 0,
|
|
50492
|
-
serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration
|
|
50495
|
+
serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration)
|
|
50493
50496
|
)
|
|
50494
50497
|
], flags)
|
|
50495
50498
|
),
|
|
@@ -50631,9 +50634,7 @@ function createTypeChecker(host) {
|
|
|
50631
50634
|
jsdocAliasDecl.typeExpression.type,
|
|
50632
50635
|
aliasType,
|
|
50633
50636
|
/*host*/
|
|
50634
|
-
void 0
|
|
50635
|
-
includePrivateSymbol,
|
|
50636
|
-
bundled
|
|
50637
|
+
void 0
|
|
50637
50638
|
) || typeToTypeNodeHelper(aliasType, context);
|
|
50638
50639
|
addResult(
|
|
50639
50640
|
setSyntheticLeadingComments(
|
|
@@ -50763,7 +50764,7 @@ function createTypeChecker(host) {
|
|
|
50763
50764
|
function serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags) {
|
|
50764
50765
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
|
50765
50766
|
for (const sig of signatures) {
|
|
50766
|
-
const decl = signatureToSignatureDeclarationHelper(sig, 262 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName)
|
|
50767
|
+
const decl = signatureToSignatureDeclarationHelper(sig, 262 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName) });
|
|
50767
50768
|
addResult(setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags);
|
|
50768
50769
|
}
|
|
50769
50770
|
if (!(symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && !!symbol.exports && !!symbol.exports.size)) {
|
|
@@ -50857,7 +50858,7 @@ function createTypeChecker(host) {
|
|
|
50857
50858
|
);
|
|
50858
50859
|
}
|
|
50859
50860
|
let introducesError;
|
|
50860
|
-
({ introducesError, node: expr } = trackExistingEntityName(expr, context
|
|
50861
|
+
({ introducesError, node: expr } = trackExistingEntityName(expr, context));
|
|
50861
50862
|
if (introducesError) {
|
|
50862
50863
|
return cleanup(
|
|
50863
50864
|
/*result*/
|
|
@@ -50867,15 +50868,7 @@ function createTypeChecker(host) {
|
|
|
50867
50868
|
}
|
|
50868
50869
|
return cleanup(factory.createExpressionWithTypeArguments(
|
|
50869
50870
|
expr,
|
|
50870
|
-
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(
|
|
50871
|
-
context,
|
|
50872
|
-
a,
|
|
50873
|
-
getTypeFromTypeNode(a),
|
|
50874
|
-
/*host*/
|
|
50875
|
-
void 0,
|
|
50876
|
-
includePrivateSymbol,
|
|
50877
|
-
bundled
|
|
50878
|
-
) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
|
|
50871
|
+
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(context, a, getTypeFromTypeNode(a)) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
|
|
50879
50872
|
));
|
|
50880
50873
|
function cleanup(result2) {
|
|
50881
50874
|
context.enclosingDeclaration = oldEnclosing;
|
|
@@ -51100,7 +51093,7 @@ function createTypeChecker(host) {
|
|
|
51100
51093
|
break;
|
|
51101
51094
|
case 273 /* ImportClause */: {
|
|
51102
51095
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51103
|
-
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
|
51096
|
+
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
|
51104
51097
|
const attributes = isImportDeclaration(node.parent) ? node.parent.attributes : void 0;
|
|
51105
51098
|
const isTypeOnly = isJSDocImportTag(node.parent);
|
|
51106
51099
|
addResult(
|
|
@@ -51122,7 +51115,7 @@ function createTypeChecker(host) {
|
|
|
51122
51115
|
}
|
|
51123
51116
|
case 274 /* NamespaceImport */: {
|
|
51124
51117
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51125
|
-
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
|
51118
|
+
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
|
51126
51119
|
const isTypeOnly = isJSDocImportTag(node.parent.parent);
|
|
51127
51120
|
addResult(
|
|
51128
51121
|
factory.createImportDeclaration(
|
|
@@ -51156,7 +51149,7 @@ function createTypeChecker(host) {
|
|
|
51156
51149
|
break;
|
|
51157
51150
|
case 276 /* ImportSpecifier */: {
|
|
51158
51151
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51159
|
-
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
|
51152
|
+
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
|
51160
51153
|
const isTypeOnly = isJSDocImportTag(node.parent.parent.parent);
|
|
51161
51154
|
addResult(
|
|
51162
51155
|
factory.createImportDeclaration(
|
|
@@ -51310,7 +51303,7 @@ function createTypeChecker(host) {
|
|
|
51310
51303
|
varName,
|
|
51311
51304
|
/*exclamationToken*/
|
|
51312
51305
|
void 0,
|
|
51313
|
-
serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration
|
|
51306
|
+
serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration)
|
|
51314
51307
|
)
|
|
51315
51308
|
], flags)
|
|
51316
51309
|
);
|
|
@@ -51394,7 +51387,7 @@ function createTypeChecker(host) {
|
|
|
51394
51387
|
paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context) : "value",
|
|
51395
51388
|
/*questionToken*/
|
|
51396
51389
|
void 0,
|
|
51397
|
-
isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration
|
|
51390
|
+
isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration)
|
|
51398
51391
|
)],
|
|
51399
51392
|
/*body*/
|
|
51400
51393
|
void 0
|
|
@@ -51409,7 +51402,7 @@ function createTypeChecker(host) {
|
|
|
51409
51402
|
factory.createModifiersFromModifierFlags(flag),
|
|
51410
51403
|
name,
|
|
51411
51404
|
[],
|
|
51412
|
-
isPrivate2 ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration
|
|
51405
|
+
isPrivate2 ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration),
|
|
51413
51406
|
/*body*/
|
|
51414
51407
|
void 0
|
|
51415
51408
|
),
|
|
@@ -51423,7 +51416,7 @@ function createTypeChecker(host) {
|
|
|
51423
51416
|
factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag),
|
|
51424
51417
|
name,
|
|
51425
51418
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
51426
|
-
isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration
|
|
51419
|
+
isPrivate ? void 0 : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration),
|
|
51427
51420
|
// TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
|
|
51428
51421
|
// interface members can't have initializers, however class members _can_
|
|
51429
51422
|
/*initializer*/
|
|
@@ -83167,9 +83160,23 @@ function createTypeChecker(host) {
|
|
|
83167
83160
|
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
83168
83161
|
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
83169
83162
|
}
|
|
83163
|
+
function getAllAccessorDeclarationsForDeclaration(accessor) {
|
|
83164
|
+
accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration);
|
|
83165
|
+
const otherKind = accessor.kind === 178 /* SetAccessor */ ? 177 /* GetAccessor */ : 178 /* SetAccessor */;
|
|
83166
|
+
const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(accessor), otherKind);
|
|
83167
|
+
const firstAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? otherAccessor : accessor;
|
|
83168
|
+
const secondAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? accessor : otherAccessor;
|
|
83169
|
+
const setAccessor = accessor.kind === 178 /* SetAccessor */ ? accessor : otherAccessor;
|
|
83170
|
+
const getAccessor = accessor.kind === 177 /* GetAccessor */ ? accessor : otherAccessor;
|
|
83171
|
+
return {
|
|
83172
|
+
firstAccessor,
|
|
83173
|
+
secondAccessor,
|
|
83174
|
+
setAccessor,
|
|
83175
|
+
getAccessor
|
|
83176
|
+
};
|
|
83177
|
+
}
|
|
83170
83178
|
function getPossibleTypeNodeReuseExpression(declaration) {
|
|
83171
|
-
|
|
83172
|
-
return isFunctionLike(declaration) && !isSetAccessor(declaration) ? getSingleReturnExpression(declaration) : isExportAssignment(declaration) ? declaration.expression : !!declaration.initializer ? declaration.initializer : isParameter(declaration) && isSetAccessor(declaration.parent) ? getSingleReturnExpression(getAllAccessorDeclarations((_a = getSymbolOfDeclaration(declaration.parent)) == null ? void 0 : _a.declarations, declaration.parent).getAccessor) : void 0;
|
|
83179
|
+
return isFunctionLike(declaration) && !isSetAccessor(declaration) ? getSingleReturnExpression(declaration) : isExportAssignment(declaration) ? declaration.expression : !!declaration.initializer ? declaration.initializer : isParameter(declaration) && isSetAccessor(declaration.parent) ? getSingleReturnExpression(getAllAccessorDeclarationsForDeclaration(declaration.parent).getAccessor) : void 0;
|
|
83173
83180
|
}
|
|
83174
83181
|
function getSingleReturnExpression(declaration) {
|
|
83175
83182
|
let candidateExpr;
|
|
@@ -83195,20 +83202,7 @@ function createTypeChecker(host) {
|
|
|
83195
83202
|
if (!signatureDeclaration) {
|
|
83196
83203
|
return factory.createToken(133 /* AnyKeyword */);
|
|
83197
83204
|
}
|
|
83198
|
-
|
|
83199
|
-
const typePredicate = getTypePredicateOfSignature(signature);
|
|
83200
|
-
if (typePredicate) {
|
|
83201
|
-
return nodeBuilder.typePredicateToTypePredicateNode(typePredicate, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
83202
|
-
}
|
|
83203
|
-
return nodeBuilder.expressionOrTypeToTypeNode(
|
|
83204
|
-
getPossibleTypeNodeReuseExpression(signatureDeclaration),
|
|
83205
|
-
getReturnTypeOfSignature(signature),
|
|
83206
|
-
/*addUndefined*/
|
|
83207
|
-
void 0,
|
|
83208
|
-
enclosingDeclaration,
|
|
83209
|
-
flags | 1024 /* MultilineObjectLiterals */,
|
|
83210
|
-
tracker
|
|
83211
|
-
);
|
|
83205
|
+
return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
83212
83206
|
}
|
|
83213
83207
|
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
|
|
83214
83208
|
const expr = getParseTreeNode(exprIn, isExpression);
|
|
@@ -83367,6 +83361,35 @@ function createTypeChecker(host) {
|
|
|
83367
83361
|
return parseIsolatedEntityName(compilerOptions.jsxFragmentFactory, languageVersion);
|
|
83368
83362
|
}
|
|
83369
83363
|
}
|
|
83364
|
+
function getNonlocalEffectiveTypeAnnotationNode(node) {
|
|
83365
|
+
const direct = getEffectiveTypeAnnotationNode(node);
|
|
83366
|
+
if (direct) {
|
|
83367
|
+
return direct;
|
|
83368
|
+
}
|
|
83369
|
+
if (node.kind === 169 /* Parameter */ && node.parent.kind === 178 /* SetAccessor */) {
|
|
83370
|
+
const other = getAllAccessorDeclarationsForDeclaration(node.parent).getAccessor;
|
|
83371
|
+
if (other) {
|
|
83372
|
+
return getEffectiveReturnTypeNode(other);
|
|
83373
|
+
}
|
|
83374
|
+
}
|
|
83375
|
+
return void 0;
|
|
83376
|
+
}
|
|
83377
|
+
function getNonlocalEffectiveReturnTypeAnnotationNode(node) {
|
|
83378
|
+
const direct = getEffectiveReturnTypeNode(node);
|
|
83379
|
+
if (direct) {
|
|
83380
|
+
return direct;
|
|
83381
|
+
}
|
|
83382
|
+
if (node.kind === 177 /* GetAccessor */) {
|
|
83383
|
+
const other = getAllAccessorDeclarationsForDeclaration(node).setAccessor;
|
|
83384
|
+
if (other) {
|
|
83385
|
+
const param = getSetAccessorValueParameter(other);
|
|
83386
|
+
if (param) {
|
|
83387
|
+
return getEffectiveTypeAnnotationNode(param);
|
|
83388
|
+
}
|
|
83389
|
+
}
|
|
83390
|
+
}
|
|
83391
|
+
return void 0;
|
|
83392
|
+
}
|
|
83370
83393
|
function createResolver() {
|
|
83371
83394
|
return {
|
|
83372
83395
|
getReferencedExportContainer,
|
|
@@ -83420,34 +83443,19 @@ function createTypeChecker(host) {
|
|
|
83420
83443
|
},
|
|
83421
83444
|
getJsxFactoryEntity,
|
|
83422
83445
|
getJsxFragmentFactoryEntity,
|
|
83423
|
-
getAllAccessorDeclarations(accessor) {
|
|
83424
|
-
accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration);
|
|
83425
|
-
const otherKind = accessor.kind === 178 /* SetAccessor */ ? 177 /* GetAccessor */ : 178 /* SetAccessor */;
|
|
83426
|
-
const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(accessor), otherKind);
|
|
83427
|
-
const firstAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? otherAccessor : accessor;
|
|
83428
|
-
const secondAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? accessor : otherAccessor;
|
|
83429
|
-
const setAccessor = accessor.kind === 178 /* SetAccessor */ ? accessor : otherAccessor;
|
|
83430
|
-
const getAccessor = accessor.kind === 177 /* GetAccessor */ ? accessor : otherAccessor;
|
|
83431
|
-
return {
|
|
83432
|
-
firstAccessor,
|
|
83433
|
-
secondAccessor,
|
|
83434
|
-
setAccessor,
|
|
83435
|
-
getAccessor
|
|
83436
|
-
};
|
|
83437
|
-
},
|
|
83438
83446
|
isBindingCapturedByNode: (node, decl) => {
|
|
83439
83447
|
const parseNode = getParseTreeNode(node);
|
|
83440
83448
|
const parseDecl = getParseTreeNode(decl);
|
|
83441
83449
|
return !!parseNode && !!parseDecl && (isVariableDeclaration(parseDecl) || isBindingElement(parseDecl)) && isBindingCapturedByNode(parseNode, parseDecl);
|
|
83442
83450
|
},
|
|
83443
|
-
getDeclarationStatementsForSourceFile: (node, flags, tracker
|
|
83451
|
+
getDeclarationStatementsForSourceFile: (node, flags, tracker) => {
|
|
83444
83452
|
const n = getParseTreeNode(node);
|
|
83445
83453
|
Debug.assert(n && n.kind === 307 /* SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile");
|
|
83446
83454
|
const sym = getSymbolOfDeclaration(node);
|
|
83447
83455
|
if (!sym) {
|
|
83448
|
-
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker
|
|
83456
|
+
return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker);
|
|
83449
83457
|
}
|
|
83450
|
-
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker
|
|
83458
|
+
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
|
|
83451
83459
|
},
|
|
83452
83460
|
isImportRequiredByAugmentation
|
|
83453
83461
|
};
|
|
@@ -83789,7 +83797,7 @@ function createTypeChecker(host) {
|
|
|
83789
83797
|
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here);
|
|
83790
83798
|
}
|
|
83791
83799
|
} else if (legacyDecorators && (node.kind === 177 /* GetAccessor */ || node.kind === 178 /* SetAccessor */)) {
|
|
83792
|
-
const accessors =
|
|
83800
|
+
const accessors = getAllAccessorDeclarationsForDeclaration(node);
|
|
83793
83801
|
if (hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) {
|
|
83794
83802
|
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
|
|
83795
83803
|
}
|
|
@@ -88980,7 +88988,7 @@ function transformTypeScript(context) {
|
|
|
88980
88988
|
if (typeSerializer) {
|
|
88981
88989
|
let decorators;
|
|
88982
88990
|
if (shouldAddTypeMetadata(node)) {
|
|
88983
|
-
const typeMetadata = emitHelpers().createMetadataHelper("design:type", typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node));
|
|
88991
|
+
const typeMetadata = emitHelpers().createMetadataHelper("design:type", typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node, container));
|
|
88984
88992
|
decorators = append(decorators, factory2.createDecorator(typeMetadata));
|
|
88985
88993
|
}
|
|
88986
88994
|
if (shouldAddParamTypesMetadata(node)) {
|
|
@@ -89007,7 +89015,7 @@ function transformTypeScript(context) {
|
|
|
89007
89015
|
/*type*/
|
|
89008
89016
|
void 0,
|
|
89009
89017
|
factory2.createToken(39 /* EqualsGreaterThanToken */),
|
|
89010
|
-
typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node)
|
|
89018
|
+
typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node, container)
|
|
89011
89019
|
));
|
|
89012
89020
|
properties = append(properties, typeProperty);
|
|
89013
89021
|
}
|
|
@@ -92444,7 +92452,7 @@ function createRuntimeTypeSerializer(context) {
|
|
|
92444
92452
|
let currentNameScope;
|
|
92445
92453
|
return {
|
|
92446
92454
|
serializeTypeNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeTypeNode, node),
|
|
92447
|
-
serializeTypeOfNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeTypeOfNode, node),
|
|
92455
|
+
serializeTypeOfNode: (serializerContext, node, container) => setSerializerContextAnd(serializerContext, serializeTypeOfNode, node, container),
|
|
92448
92456
|
serializeParameterTypesOfNode: (serializerContext, node, container) => setSerializerContextAnd(serializerContext, serializeParameterTypesOfNode, node, container),
|
|
92449
92457
|
serializeReturnTypeOfNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeReturnTypeOfNode, node)
|
|
92450
92458
|
};
|
|
@@ -92458,18 +92466,18 @@ function createRuntimeTypeSerializer(context) {
|
|
|
92458
92466
|
currentNameScope = savedCurrentNameScope;
|
|
92459
92467
|
return result;
|
|
92460
92468
|
}
|
|
92461
|
-
function getAccessorTypeNode(node) {
|
|
92462
|
-
const accessors =
|
|
92469
|
+
function getAccessorTypeNode(node, container) {
|
|
92470
|
+
const accessors = getAllAccessorDeclarations(container.members, node);
|
|
92463
92471
|
return accessors.setAccessor && getSetAccessorTypeAnnotationNode(accessors.setAccessor) || accessors.getAccessor && getEffectiveReturnTypeNode(accessors.getAccessor);
|
|
92464
92472
|
}
|
|
92465
|
-
function serializeTypeOfNode(node) {
|
|
92473
|
+
function serializeTypeOfNode(node, container) {
|
|
92466
92474
|
switch (node.kind) {
|
|
92467
92475
|
case 172 /* PropertyDeclaration */:
|
|
92468
92476
|
case 169 /* Parameter */:
|
|
92469
92477
|
return serializeTypeNode(node.type);
|
|
92470
92478
|
case 178 /* SetAccessor */:
|
|
92471
92479
|
case 177 /* GetAccessor */:
|
|
92472
|
-
return serializeTypeNode(getAccessorTypeNode(node));
|
|
92480
|
+
return serializeTypeNode(getAccessorTypeNode(node, container));
|
|
92473
92481
|
case 263 /* ClassDeclaration */:
|
|
92474
92482
|
case 231 /* ClassExpression */:
|
|
92475
92483
|
case 174 /* MethodDeclaration */:
|
|
@@ -92492,7 +92500,7 @@ function createRuntimeTypeSerializer(context) {
|
|
|
92492
92500
|
if (parameter.dotDotDotToken) {
|
|
92493
92501
|
expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type)));
|
|
92494
92502
|
} else {
|
|
92495
|
-
expressions.push(serializeTypeOfNode(parameter));
|
|
92503
|
+
expressions.push(serializeTypeOfNode(parameter, container));
|
|
92496
92504
|
}
|
|
92497
92505
|
}
|
|
92498
92506
|
}
|
|
@@ -108519,13 +108527,13 @@ function transformDeclarations(context) {
|
|
|
108519
108527
|
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
108520
108528
|
}
|
|
108521
108529
|
}
|
|
108522
|
-
function transformDeclarationsForJS(sourceFile
|
|
108530
|
+
function transformDeclarationsForJS(sourceFile) {
|
|
108523
108531
|
const oldDiag = getSymbolAccessibilityDiagnostic;
|
|
108524
108532
|
getSymbolAccessibilityDiagnostic = (s) => s.errorNode && canProduceDiagnostics(s.errorNode) ? createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : {
|
|
108525
108533
|
diagnosticMessage: s.errorModuleName ? Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit : Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit,
|
|
108526
108534
|
errorNode: s.errorNode || sourceFile
|
|
108527
108535
|
};
|
|
108528
|
-
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker
|
|
108536
|
+
const result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker);
|
|
108529
108537
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
108530
108538
|
return result;
|
|
108531
108539
|
}
|
|
@@ -108556,11 +108564,7 @@ function transformDeclarations(context) {
|
|
|
108556
108564
|
if (isExternalOrCommonJsModule(sourceFile) || isJsonSourceFile(sourceFile)) {
|
|
108557
108565
|
resultHasExternalModuleIndicator = false;
|
|
108558
108566
|
needsDeclare = false;
|
|
108559
|
-
const statements = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(
|
|
108560
|
-
sourceFile,
|
|
108561
|
-
/*bundled*/
|
|
108562
|
-
true
|
|
108563
|
-
)) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
|
|
108567
|
+
const statements = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(sourceFile)) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
|
|
108564
108568
|
const newFile = factory2.updateSourceFile(
|
|
108565
108569
|
sourceFile,
|
|
108566
108570
|
[factory2.createModuleDeclaration(
|
|
@@ -108882,7 +108886,7 @@ function transformDeclarations(context) {
|
|
|
108882
108886
|
if (!isPrivate) {
|
|
108883
108887
|
const valueParameter = getSetAccessorValueParameter(input);
|
|
108884
108888
|
if (valueParameter) {
|
|
108885
|
-
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input,
|
|
108889
|
+
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, getAllAccessorDeclarations(isObjectLiteralExpression(input.parent) ? input.parent.properties : input.parent.members, input));
|
|
108886
108890
|
newValueParameter = ensureParameter(
|
|
108887
108891
|
valueParameter,
|
|
108888
108892
|
/*modifierMask*/
|
|
@@ -109168,7 +109172,7 @@ function transformDeclarations(context) {
|
|
|
109168
109172
|
void 0
|
|
109169
109173
|
);
|
|
109170
109174
|
}
|
|
109171
|
-
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input,
|
|
109175
|
+
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, getAllAccessorDeclarations(isObjectLiteralExpression(input.parent) ? input.parent.properties : input.parent.members, input));
|
|
109172
109176
|
return cleanup(factory2.updateGetAccessorDeclaration(
|
|
109173
109177
|
input,
|
|
109174
109178
|
ensureModifiers(input),
|
|
@@ -111016,7 +111020,6 @@ var notImplementedResolver = {
|
|
|
111016
111020
|
isLiteralConstDeclaration: notImplemented,
|
|
111017
111021
|
getJsxFactoryEntity: notImplemented,
|
|
111018
111022
|
getJsxFragmentFactoryEntity: notImplemented,
|
|
111019
|
-
getAllAccessorDeclarations: notImplemented,
|
|
111020
111023
|
isBindingCapturedByNode: notImplemented,
|
|
111021
111024
|
getDeclarationStatementsForSourceFile: notImplemented,
|
|
111022
111025
|
isImportRequiredByAugmentation: notImplemented
|
|
@@ -121958,7 +121961,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121958
121961
|
impliedFormatPackageJsons.delete(newFile.resolvedPath);
|
|
121959
121962
|
});
|
|
121960
121963
|
impliedFormatPackageJsons.forEach((existing, path) => {
|
|
121961
|
-
|
|
121964
|
+
const newFile = newProgram == null ? void 0 : newProgram.getSourceFileByPath(path);
|
|
121965
|
+
if (!newFile || newFile.resolvedPath !== path) {
|
|
121962
121966
|
existing.forEach((location) => fileWatchesOfAffectingLocations.get(location).files--);
|
|
121963
121967
|
impliedFormatPackageJsons.delete(path);
|
|
121964
121968
|
}
|