Skip to content

Commit 0364cdf

Browse files
authored
validating assignment of functions to object literal method types (#1136)
* validating assignment of functions to object literal method types * fixed indentation in tests Co-authored-by: Tom <tomblind@users.noreply.github.com>
1 parent 73a4ed0 commit 0364cdf

File tree

5 files changed

+1305
-51
lines changed

5 files changed

+1305
-51
lines changed

src/transformation/utils/assignment-validation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ export function validateAssignment(
6060

6161
if (
6262
(toType.flags & ts.TypeFlags.Object) !== 0 &&
63-
((toType as ts.ObjectType).objectFlags & ts.ObjectFlags.ClassOrInterface) !== 0 &&
63+
(ts.isTypeLiteralNode(toTypeNode) ||
64+
((toType as ts.ObjectType).objectFlags & ts.ObjectFlags.ClassOrInterface) !== 0) &&
6465
toType.symbol &&
6566
toType.symbol.members &&
6667
fromType.symbol &&

0 commit comments

Comments
 (0)