{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/27051","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/27051/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/27051/comments","events_url":"https://api.github.com/repos/angular/angular/issues/27051/events","html_url":"https://github.com/angular/angular/pull/27051","id":379527822,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5OTU1MjUy","number":27051,"title":"fix(ivy): ngcc should render JavaScript instead of TypeScript","user":{"login":"JoostK","id":123679,"node_id":"MDQ6VXNlcjEyMzY3OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/123679?v=4","gravatar_id":"","url":"https://api.github.com/users/JoostK","html_url":"https://github.com/JoostK","followers_url":"https://api.github.com/users/JoostK/followers","following_url":"https://api.github.com/users/JoostK/following{/other_user}","gists_url":"https://api.github.com/users/JoostK/gists{/gist_id}","starred_url":"https://api.github.com/users/JoostK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoostK/subscriptions","organizations_url":"https://api.github.com/users/JoostK/orgs","repos_url":"https://api.github.com/users/JoostK/repos","events_url":"https://api.github.com/users/JoostK/events{/privacy}","received_events_url":"https://api.github.com/users/JoostK/received_events","type":"User","site_admin":false},"labels":[{"id":149476251,"node_id":"MDU6TGFiZWwxNDk0NzYyNTE=","url":"https://api.github.com/repos/angular/angular/labels/cla:%20yes","name":"cla: yes","color":"009800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-11T14:27:35Z","updated_at":"2018-11-11T18:55:59Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/angular/angular/pulls/27051","html_url":"https://github.com/angular/angular/pull/27051","diff_url":"https://github.com/angular/angular/pull/27051.diff","patch_url":"https://github.com/angular/angular/pull/27051.patch"},"body":"Previously, ngcc used ngtsc's logic to transform the Angular AST\r\nto a TypeScript AST and then leverages TypeScript's node printer to\r\nobtain the source text to insert. This turns out to be a problem when\r\nspecific TypeScript syntax is represented in the AST; the printer cannot\r\nbe configured to output only JavaScript syntax.\r\n\r\nA full-blown TypeScript emit of a complete `ts.SourceFile` would be\r\nrequired to be able to emit JS and possibly downlevel into a lower\r\nlanguage target, which is not an option for ngcc as it currently\r\noperates on partial ASTs, not full source files.\r\n\r\nInstead, the Angular AST itself is used to emit source files, using the\r\nemitter logic that is also used in JIT compilations. As the Angular AST\r\nproduced by ngtsc may contain literal TypeScript nodes inside of\r\n`WrappedNodeExpr`, a TypeScript printer is still used to obtain source\r\ntext for such nodes (assuming no TypeScript specific syntax is present\r\nwithin that node's subtree).\r\n\r\n## PR Checklist\r\nPlease check if your PR fulfills the following requirements:\r\n\r\n- [x] The commit message follows our guidelines: https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit\r\n- [x] Tests for the changes have been added (for bug fixes / features)\r\n- [x] Docs have been added / updated (for bug fixes / features)\r\n\r\n\r\n## PR Type\r\nWhat kind of change does this PR introduce?\r\n\r\n<!-- Please check the one that applies to this PR using \"x\". -->\r\n\r\n- [x] Bugfix\r\n- [ ] Feature\r\n- [ ] Code style update (formatting, local variables)\r\n- [ ] Refactoring (no functional changes, no api changes)\r\n- [ ] Build related changes\r\n- [ ] CI related changes\r\n- [ ] Documentation content changes\r\n- [ ] angular.io application / infrastructure changes\r\n- [ ] Other... Please describe:\r\n\r\n\r\n## What is the current behavior?\r\n<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->\r\n\r\nngcc may output TypeScript specific syntax into JavaScript bundles, which fail to be parsed.\r\n\r\n## What is the new behavior?\r\n\r\nngcc uses existing emitter logic that operates on Angular AST to produce JavaScript code instead of TypeScript.\r\n\r\n## Does this PR introduce a breaking change?\r\n\r\n- [ ] Yes\r\n- [x] No\r\n\r\n\r\n<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->\r\n\r\n\r\n## Other information\r\n\r\n@alxhub Can you comment on my assumption that we can safely print `WrappedNodeExpr` using TypeScript's printing logic, as doing so still has a risk of producing TS specific syntax."},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/437694981","html_url":"https://github.com/angular/angular/pull/27051#issuecomment-437694981","issue_url":"https://api.github.com/repos/angular/angular/issues/27051","id":437694981,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzY5NDk4MQ==","user":{"login":"petebacondarwin","id":15655,"node_id":"MDQ6VXNlcjE1NjU1","avatar_url":"https://avatars0.githubusercontent.com/u/15655?v=4","gravatar_id":"","url":"https://api.github.com/users/petebacondarwin","html_url":"https://github.com/petebacondarwin","followers_url":"https://api.github.com/users/petebacondarwin/followers","following_url":"https://api.github.com/users/petebacondarwin/following{/other_user}","gists_url":"https://api.github.com/users/petebacondarwin/gists{/gist_id}","starred_url":"https://api.github.com/users/petebacondarwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petebacondarwin/subscriptions","organizations_url":"https://api.github.com/users/petebacondarwin/orgs","repos_url":"https://api.github.com/users/petebacondarwin/repos","events_url":"https://api.github.com/users/petebacondarwin/events{/privacy}","received_events_url":"https://api.github.com/users/petebacondarwin/received_events","type":"User","site_admin":false},"created_at":"2018-11-11T18:55:59Z","updated_at":"2018-11-11T18:55:59Z","author_association":"MEMBER","body":"Generally looks like a good idea!"}}
{"actor":{"display_login":"petebacondarwin"}}