Skip to content

Commit

Permalink
Merge pull request #59 from roypeled/fix-broken-class-parser
Browse files Browse the repository at this point in the history
Fix broken class parser
  • Loading branch information
roypeled authored Jul 25, 2024
2 parents f6ea81e + cd9aefd commit 9ad1e29
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typestrong/ts-mockito",
"version": "2.7.8",
"version": "2.7.9",
"description": "Mocking library for TypeScript",
"main": "lib/ts-mockito.js",
"typings": "lib/ts-mockito",
Expand Down
4 changes: 2 additions & 2 deletions src/utils/MockableFunctionsFinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ function handleObject(n: ObjectExpression): string[] {
return names;
}

const isSpread = (n: any): n is SpreadElement => n.type === 'SpreadElement';
const isSpread = (n: { type:string }): n is SpreadElement => n.type === 'SpreadElement';

function handleExpression(n?: Expression | null): string[] {
if (!n) return [];
switch (n.type) {
case "ArrayExpression":
return n.elements.flatMap(e => isSpread(e) ? handleUnaryLike(e) : handleExpression(e));
return n.elements.flatMap(e => e ? (isSpread(e) ? handleUnaryLike(e) : handleExpression(e)) : []);
case "AssignmentExpression":
return handleAssignment(n);
case "BinaryExpression":
Expand Down

0 comments on commit 9ad1e29

Please sign in to comment.