Skip to content

Commit 6b6e41e

Browse files
committed
Fixes #28470
1 parent 7b56329 commit 6b6e41e

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22240,7 +22240,7 @@ namespace ts {
2224022240
!numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & (TypeFlags.Union | TypeFlags.Never)) && isTypeAssignableTo(funcType, globalFunctionType);
2224122241
}
2224222242

22243-
function resolveNewExpression(node: NewExpression, candidatesOutArray: Signature[] | undefined, checkMode: CheckMode): Signature {
22243+
function resolveNewExpression(node: NewExpression, candidatesOutArray: Signature[] | undefined, checkMode: CheckMode, contextFlags?: ContextFlags): Signature {
2224422244
if (node.arguments && languageVersion < ScriptTarget.ES5) {
2224522245
const spreadIndex = getSpreadArgumentIndex(node.arguments);
2224622246
if (spreadIndex >= 0) {
@@ -22293,7 +22293,7 @@ namespace ts {
2229322293
return resolveErrorCall(node);
2229422294
}
2229522295

22296-
return resolveCall(node, constructSignatures, candidatesOutArray, checkMode);
22296+
return resolveCall(node, constructSignatures, candidatesOutArray, checkMode, /*fallbackError*/ undefined, contextFlags);
2229722297
}
2229822298

2229922299
// If expressionType's apparent type is an object type with no construct signatures but
@@ -22302,7 +22302,7 @@ namespace ts {
2230222302
// operation is Any. It is an error to have a Void this type.
2230322303
const callSignatures = getSignaturesOfType(expressionType, SignatureKind.Call);
2230422304
if (callSignatures.length) {
22305-
const signature = resolveCall(node, callSignatures, candidatesOutArray, checkMode);
22305+
const signature = resolveCall(node, callSignatures, candidatesOutArray, checkMode, /*fallbackError*/ undefined, contextFlags);
2230622306
if (!noImplicitAny) {
2230722307
if (signature.declaration && !isJSConstructor(signature.declaration) && getReturnTypeOfSignature(signature) !== voidType) {
2230822308
error(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword);
@@ -22653,7 +22653,7 @@ namespace ts {
2265322653
case SyntaxKind.CallExpression:
2265422654
return resolveCallExpression(node, candidatesOutArray, checkMode, contextFlags);
2265522655
case SyntaxKind.NewExpression:
22656-
return resolveNewExpression(node, candidatesOutArray, checkMode);
22656+
return resolveNewExpression(node, candidatesOutArray, checkMode, contextFlags);
2265722657
case SyntaxKind.TaggedTemplateExpression:
2265822658
return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode);
2265922659
case SyntaxKind.Decorator:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/// <reference path="fourslash.ts" />
2+
// @strict: true
3+
4+
//// interface Options {
5+
//// someFunction?: () => string
6+
//// anotherFunction?: () => string
7+
//// }
8+
////
9+
//// export class Clazz<T extends Options> {
10+
//// constructor(public a: T) {}
11+
//// }
12+
////
13+
//// new Clazz({ /*1*/ })
14+
15+
verify.completions({ marker: '1', includes: ['someFunction', 'anotherFunction'] })
16+

0 commit comments

Comments
 (0)