Skip to content

Commit

Permalink
fix: node.parent undefined error
Browse files Browse the repository at this point in the history
  • Loading branch information
cxtom committed May 22, 2019
1 parent 3d20979 commit fd47c1f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ export function emitFile(
// emitDecorators(node, node.decorators);
emitModifiers(node, node.modifiers);
// emit(node.asteriskToken);
if (ts.isClassDeclaration(node.parent)) {
if (ts.isClassDeclaration(node.parent || node.original.parent)) {
writeKeyword("function");
writeSpace();
emit(node.name);
Expand Down Expand Up @@ -1718,7 +1718,7 @@ export function emitFile(
if (
node.kind === ts.SyntaxKind.ArrowFunction
|| node.kind === ts.SyntaxKind.FunctionExpression
|| (node.kind === ts.SyntaxKind.MethodDeclaration && !ts.isClassDeclaration(node.parent))
|| (node.kind === ts.SyntaxKind.MethodDeclaration && !ts.isClassDeclaration(node.parent || node.original.parent))
) {
const wrappedNode = createWrappedNode(node, {typeChecker});
const body = wrappedNode.getBody();
Expand Down

0 comments on commit fd47c1f

Please sign in to comment.