{"action":"created","issue":{"url":"https://api.github.com/repos/dsherret/ts-simple-ast/issues/334","repository_url":"https://api.github.com/repos/dsherret/ts-simple-ast","labels_url":"https://api.github.com/repos/dsherret/ts-simple-ast/issues/334/labels{/name}","comments_url":"https://api.github.com/repos/dsherret/ts-simple-ast/issues/334/comments","events_url":"https://api.github.com/repos/dsherret/ts-simple-ast/issues/334/events","html_url":"https://github.com/dsherret/ts-simple-ast/issues/334","id":325549593,"node_id":"MDU6SXNzdWUzMjU1NDk1OTM=","number":334,"title":"Error: Cannot read property 'kind' of undefined","user":{"login":"punithnpg","id":10862627,"node_id":"MDQ6VXNlcjEwODYyNjI3","avatar_url":"https://avatars1.githubusercontent.com/u/10862627?v=4","gravatar_id":"","url":"https://api.github.com/users/punithnpg","html_url":"https://github.com/punithnpg","followers_url":"https://api.github.com/users/punithnpg/followers","following_url":"https://api.github.com/users/punithnpg/following{/other_user}","gists_url":"https://api.github.com/users/punithnpg/gists{/gist_id}","starred_url":"https://api.github.com/users/punithnpg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/punithnpg/subscriptions","organizations_url":"https://api.github.com/users/punithnpg/orgs","repos_url":"https://api.github.com/users/punithnpg/repos","events_url":"https://api.github.com/users/punithnpg/events{/privacy}","received_events_url":"https://api.github.com/users/punithnpg/received_events","type":"User","site_admin":false},"labels":[{"id":950989832,"node_id":"MDU6TGFiZWw5NTA5ODk4MzI=","url":"https://api.github.com/repos/dsherret/ts-simple-ast/labels/awaiting%20more%20feedback","name":"awaiting more feedback","color":"556677","default":false},{"id":552803006,"node_id":"MDU6TGFiZWw1NTI4MDMwMDY=","url":"https://api.github.com/repos/dsherret/ts-simple-ast/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-23T04:58:34Z","updated_at":"2018-07-13T17:54:21Z","closed_at":"2018-07-13T17:54:21Z","author_association":"NONE","body":"Getting this error \r\n```\r\nthrow new errors.InvalidOperationError(err.message + \"\\n\" +\r\n        ^\r\n\r\nError: Cannot read property 'kind' of undefined\r\n```\r\nfor the code: \r\n```\r\nfunction addMethod(methodName, componentName) {\r\n  sourceFile = project.addExistingSourceFile(\r\n    './' + componentName + '/' + componentName + '.component.ts'\r\n  );\r\n  \r\n  classDeclaration = sourceFile.getClass(<ClassName HERE>);\r\n  \r\n  \r\n  classDeclaration.addMethod({\r\n    name: methodName\r\n  });\r\n\r\n  project.save();\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/dsherret/ts-simple-ast/issues/comments/404906907","html_url":"https://github.com/dsherret/ts-simple-ast/issues/334#issuecomment-404906907","issue_url":"https://api.github.com/repos/dsherret/ts-simple-ast/issues/334","id":404906907,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNDkwNjkwNw==","user":{"login":"punithnpg","id":10862627,"node_id":"MDQ6VXNlcjEwODYyNjI3","avatar_url":"https://avatars1.githubusercontent.com/u/10862627?v=4","gravatar_id":"","url":"https://api.github.com/users/punithnpg","html_url":"https://github.com/punithnpg","followers_url":"https://api.github.com/users/punithnpg/followers","following_url":"https://api.github.com/users/punithnpg/following{/other_user}","gists_url":"https://api.github.com/users/punithnpg/gists{/gist_id}","starred_url":"https://api.github.com/users/punithnpg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/punithnpg/subscriptions","organizations_url":"https://api.github.com/users/punithnpg/orgs","repos_url":"https://api.github.com/users/punithnpg/repos","events_url":"https://api.github.com/users/punithnpg/events{/privacy}","received_events_url":"https://api.github.com/users/punithnpg/received_events","type":"User","site_admin":false},"created_at":"2018-07-13T17:54:21Z","updated_at":"2018-07-13T17:54:21Z","author_association":"NONE","body":"@dsherret I changed the implementation of this to \r\n```\r\nfunction addMethod(methodName, component) {\r\n  var componentClass = sourceFile.getClass(component + 'Component');\r\n  componentClass .addMethod({\r\n    name: methodName\r\n  });\r\n  sourceFile.save();\r\n}\r\n```\r\nand this worked well for me!"}}
{"actor":{"display_login":"punithnpg"}}