Skip to content

Commit fcf95de

Browse files
committed
enhancement(transformer): Fallback to `instanceof Object' control flow for overloads with non literal inputs
1 parent 00d256f commit fcf95de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/transformer/descriptor/method/method.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import ts from 'typescript';
22
import { GetTsAutoMockOverloadOptions, TsAutoMockOverloadOptions } from '../../../options/overload';
3-
import { GetClassDeclarationDescriptor } from '../class/classDeclaration';
43
import { TypescriptCreator } from '../../helper/creator';
54
import { MockDefiner } from '../../mockDefiner/mockDefiner';
65
import { ModuleName } from '../../mockDefiner/modules/moduleName';
@@ -60,7 +59,8 @@ function CreateTypeEquality(signatureType: ts.TypeNode | undefined, primaryDecla
6059
signatureType ? ts.createStringLiteral(signatureType.getText()) : ts.createVoidZero(),
6160
);
6261
} else {
63-
return ts.createBinary(identifier, ts.SyntaxKind.InstanceOfKeyword, ts.createIdentifier(signatureType.getText()));
62+
// FIXME: Support `instanceof Class`, falls back to Object for now. The fallback causes undefined behavior!
63+
return ts.createBinary(identifier, ts.SyntaxKind.InstanceOfKeyword, ts.createIdentifier('Object'));
6464
}
6565
}
6666

0 commit comments

Comments
 (0)