@@ -9596,7 +9596,7 @@ namespace ts {
95969596 // When creating an optional property in strictNullChecks mode, if 'undefined' isn't assignable to the
95979597 // type, we include 'undefined' in the type. Similarly, when creating a non-optional property in strictNullChecks
95989598 // mode, if the underlying property is optional we remove 'undefined' from the type.
9599- prop.type = strictNullChecks && isOptional && !isTypeAssignableTo(undefinedType, propType ) ? getOptionalType(propType) :
9599+ prop.type = strictNullChecks && isOptional && !maybeTypeOfKind(propType, TypeFlags.Undefined | TypeFlags.Void ) ? getOptionalType(propType) :
96009600 strictNullChecks && !isOptional && modifiersProp && modifiersProp.flags & SymbolFlags.Optional ? getTypeWithFacts(propType, TypeFacts.NEUndefined) :
96019601 propType;
96029602 if (modifiersProp) {
@@ -11343,6 +11343,11 @@ namespace ts {
1134311343 function getTypeFromTypeReference(node: TypeReferenceType): Type {
1134411344 const links = getNodeLinks(node);
1134511345 if (!links.resolvedType) {
11346+ // handle LS queries on the `const` in `x as const` by resolving to the type of `x`
11347+ if (isConstTypeReference(node) && isAssertionExpression(node.parent)) {
11348+ links.resolvedSymbol = unknownSymbol;
11349+ return links.resolvedType = checkExpressionCached(node.parent.expression);
11350+ }
1134611351 let symbol: Symbol | undefined;
1134711352 let type: Type | undefined;
1134811353 const meaning = SymbolFlags.Type;
@@ -13696,7 +13701,7 @@ namespace ts {
1369613701 const templateMapper = combineTypeMappers(mapper, createTypeMapper([getTypeParameterFromMappedType(type)], [key]));
1369713702 const propType = instantiateType(getTemplateTypeFromMappedType(<MappedType>type.target || type), templateMapper);
1369813703 const modifiers = getMappedTypeModifiers(type);
13699- return strictNullChecks && modifiers & MappedTypeModifiers.IncludeOptional && !isTypeAssignableTo(undefinedType, propType ) ? getOptionalType(propType) :
13704+ return strictNullChecks && modifiers & MappedTypeModifiers.IncludeOptional && !maybeTypeOfKind(propType, TypeFlags.Undefined | TypeFlags.Void ) ? getOptionalType(propType) :
1370013705 strictNullChecks && modifiers & MappedTypeModifiers.ExcludeOptional && isOptional ? getTypeWithFacts(propType, TypeFacts.NEUndefined) :
1370113706 propType;
1370213707 }
@@ -22608,6 +22613,7 @@ namespace ts {
2260822613
2260922614 function checkJsxSelfClosingElementDeferred(node: JsxSelfClosingElement) {
2261022615 checkJsxOpeningLikeElementOrOpeningFragment(node);
22616+ resolveUntypedCall(node); // ensure type arguments and parameters are typechecked, even if there is an arity error
2261122617 }
2261222618
2261322619 function checkJsxSelfClosingElement(node: JsxSelfClosingElement, _checkMode: CheckMode | undefined): Type {
@@ -24995,14 +25001,14 @@ namespace ts {
2499525001 }
2499625002
2499725003 // No signature was applicable. We have already reported the errors for the invalid signature.
24998- // If this is a type resolution session, e.g. Language Service, try to get better information than anySignature.
2499925004 function getCandidateForOverloadFailure(
2500025005 node: CallLikeExpression,
2500125006 candidates: Signature[],
2500225007 args: readonly Expression[],
2500325008 hasCandidatesOutArray: boolean,
2500425009 ): Signature {
2500525010 Debug.assert(candidates.length > 0); // Else should not have called this.
25011+ checkNodeDeferred(node);
2500625012 // Normally we will combine overloads. Skip this if they have type parameters since that's hard to combine.
2500725013 // Don't do this if there is a `candidatesOutArray`,
2500825014 // because then we want the chosen best candidate to be one of the overloads, not a combination.
@@ -29299,7 +29305,7 @@ namespace ts {
2929929305 }
2930029306
2930129307 function isPrivateWithinAmbient(node: Node): boolean {
29302- return hasModifier(node, ModifierFlags.Private) && !!(node.flags & NodeFlags.Ambient);
29308+ return ( hasModifier(node, ModifierFlags.Private) || isPrivateIdentifierPropertyDeclaration(node) ) && !!(node.flags & NodeFlags.Ambient);
2930329309 }
2930429310
2930529311 function getEffectiveDeclarationFlags(n: Declaration, flagsToCheck: ModifierFlags): ModifierFlags {
@@ -33971,6 +33977,16 @@ namespace ts {
3397133977 currentNode = node;
3397233978 instantiationCount = 0;
3397333979 switch (node.kind) {
33980+ case SyntaxKind.CallExpression:
33981+ case SyntaxKind.NewExpression:
33982+ case SyntaxKind.TaggedTemplateExpression:
33983+ case SyntaxKind.Decorator:
33984+ case SyntaxKind.JsxOpeningElement:
33985+ // These node kinds are deferred checked when overload resolution fails
33986+ // To save on work, we ensure the arguments are checked just once, in
33987+ // a deferred way
33988+ resolveUntypedCall(node as CallLikeExpression);
33989+ break;
3397433990 case SyntaxKind.FunctionExpression:
3397533991 case SyntaxKind.ArrowFunction:
3397633992 case SyntaxKind.MethodDeclaration:
0 commit comments