Allow JS constructor function to return non-void

This commit is contained in:
Ron Buckton committed 2017-06-01 12:11:09 -07:00
1 parent 928da675ac
commit 3acc76cc8f
4 files changed
+160 -1

No files matched your search

+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) {