Allow JS constructor function to return non-void

This commit is contained in:
Ron Buckton
2017-06-01 12:11:09 -07:00
parent 928da675ac
commit 3acc76cc8f
4 changed files with 160 additions and 1 deletions
+1 -1
View File
@@ -15835,7 +15835,7 @@ namespace ts {
const callSignatures = getSignaturesOfType(expressionType, SignatureKind.Call);
if (callSignatures.length) {
const signature = resolveCall(node, callSignatures, candidatesOutArray);
if (getReturnTypeOfSignature(signature) !== voidType) {
if (!isInJavaScriptFile(signature.declaration) && getReturnTypeOfSignature(signature) !== voidType) {
error(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword);
}
if (getThisTypeOfSignature(signature) === voidType) {