Skip to content

Commit b98eecb

Browse files
committed
1 parent 0584288 commit b98eecb

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
@@ -22373,7 +22373,7 @@ namespace ts {
2237322373
!numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & (TypeFlags.Union | TypeFlags.Never)) && isTypeAssignableTo(funcType, globalFunctionType);
2237422374
}
2237522375

22376-
function resolveNewExpression(node: NewExpression, candidatesOutArray: Signature[] | undefined, checkMode: CheckMode): Signature {
22376+
function resolveNewExpression(node: NewExpression, candidatesOutArray: Signature[] | undefined, checkMode: CheckMode, contextFlags?: ContextFlags): Signature {
2237722377
if (node.arguments && languageVersion < ScriptTarget.ES5) {
2237822378
const spreadIndex = getSpreadArgumentIndex(node.arguments);
2237922379
if (spreadIndex >= 0) {
@@ -22426,7 +22426,7 @@ namespace ts {
2242622426
return resolveErrorCall(node);
2242722427
}
2242822428

22429-
return resolveCall(node, constructSignatures, candidatesOutArray, checkMode);
22429+
return resolveCall(node, constructSignatures, candidatesOutArray, checkMode, /*fallbackError*/ undefined, contextFlags);
2243022430
}
2243122431

2243222432
// If expressionType's apparent type is an object type with no construct signatures but
@@ -22435,7 +22435,7 @@ namespace ts {
2243522435
// operation is Any. It is an error to have a Void this type.
2243622436
const callSignatures = getSignaturesOfType(expressionType, SignatureKind.Call);
2243722437
if (callSignatures.length) {
22438-
const signature = resolveCall(node, callSignatures, candidatesOutArray, checkMode);
22438+
const signature = resolveCall(node, callSignatures, candidatesOutArray, checkMode, /*fallbackError*/ undefined, contextFlags);
2243922439
if (!noImplicitAny) {
2244022440
if (signature.declaration && !isJSConstructor(signature.declaration) && getReturnTypeOfSignature(signature) !== voidType) {
2244122441
error(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword);
@@ -22786,7 +22786,7 @@ namespace ts {
2278622786
case SyntaxKind.CallExpression:
2278722787
return resolveCallExpression(node, candidatesOutArray, checkMode, contextFlags);
2278822788
case SyntaxKind.NewExpression:
22789-
return resolveNewExpression(node, candidatesOutArray, checkMode);
22789+
return resolveNewExpression(node, candidatesOutArray, checkMode, contextFlags);
2279022790
case SyntaxKind.TaggedTemplateExpression:
2279122791
return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode);
2279222792
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)