{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular-cli/issues/4735","repository_url":"https://api.github.com/repos/angular/angular-cli","labels_url":"https://api.github.com/repos/angular/angular-cli/issues/4735/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular-cli/issues/4735/comments","events_url":"https://api.github.com/repos/angular/angular-cli/issues/4735/events","html_url":"https://github.com/angular/angular-cli/issues/4735","id":208045847,"number":4735,"title":"Typescript namespace merge throws duplicate exports","user":{"login":"Abrissirba","id":5156241,"avatar_url":"https://avatars.githubusercontent.com/u/5156241?v=3","gravatar_id":"","url":"https://api.github.com/users/Abrissirba","html_url":"https://github.com/Abrissirba","followers_url":"https://api.github.com/users/Abrissirba/followers","following_url":"https://api.github.com/users/Abrissirba/following{/other_user}","gists_url":"https://api.github.com/users/Abrissirba/gists{/gist_id}","starred_url":"https://api.github.com/users/Abrissirba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Abrissirba/subscriptions","organizations_url":"https://api.github.com/users/Abrissirba/orgs","repos_url":"https://api.github.com/users/Abrissirba/repos","events_url":"https://api.github.com/users/Abrissirba/events{/privacy}","received_events_url":"https://api.github.com/users/Abrissirba/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-02-16T07:54:31Z","updated_at":"2017-02-24T07:33:25Z","closed_at":"2017-02-24T07:33:25Z","body":"We just upgraded from angular-cli:1.0.0-beta.24 beta-24 to @angular/cli:1.0.0-beta.31 and having trouble with namespace merging that we use in our enum types. Take this code as example:\r\n\r\n```\r\nexport enum TaskActions\r\n{\r\n    //Approve = <any>{description: 'asdf', id:1},\r\n    Approve = 1,\r\n    Reject = 2,\r\n    ReAssign = 3,\r\n    Comment = 4\r\n}\r\n\r\nexport namespace TaskActions {\r\n    export function GetIcon(taskAction: TaskActions) {\r\n        switch (taskAction) {\r\n            case TaskActions.Approve: return 'thumb_up';\r\n            case TaskActions.Reject: return 'thumb_down';\r\n            case TaskActions.ReAssign: return 'people';\r\n            case TaskActions.Comment: return 'comment';\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nThis should be valid typescript according to https://www.typescriptlang.org/docs/handbook/declaration-merging.html and it did work in beta.24. However, after upgrading to beta.31 we get the following error on ng serve\r\n\r\n```\r\nERROR in ./src/app/shared/enums/workflow-item-types.enum.ts\r\nModule parse failed: C:\\Working Folder\\exampleApp\\node_modules\\@ngtools\\webpack\\src\\index.js!C:\\Working Folder\\exampleApp\\src\\app\\shared\\enums\\workflow-item-types.enum.ts Duplicate export 'WorkflowItemTypes' (13:11)\r\nYou may need an appropriate loader to handle this file type.\r\n|     WorkflowItemTypes[WorkflowItemTypes[\"Publish\"] = 5605] = \"Publish\";\r\n| })(WorkflowItemTypes || (WorkflowItemTypes = {}));\r\n| export var WorkflowItemTypes;\r\n| (function (WorkflowItemTypes) {\r\n|     function GetDescription(workflowItemTypes) {\r\n @ ./src/app/reporting/edit-item-dialog/edit-item-dialog.component.ts 14:0-80\r\n @ ./src/app/reporting/reporting.module.ts\r\n @ ./src/app/app-routing.module.ts\r\n @ ./src/app/app.module.ts\r\n @ ./src/main.ts\r\n @ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts\r\n```\r\n\r\n### OS?\r\nWindows 7\r\n\r\n### Versions.\r\n@angular/cli: 1.0.0-beta.31\r\nnode: 6.9.5\r\nos: win32 x64\r\n@angular/common: 2.4.7\r\n@angular/compiler: 2.4.7\r\n@angular/core: 2.4.7\r\n@angular/flex-layout: 2.0.0-beta.1\r\n@angular/forms: 2.4.7\r\n@angular/http: 2.4.7\r\n@angular/material: 2.0.0-beta.2\r\n@angular/platform-browser: 2.4.7\r\n@angular/platform-browser-dynamic: 2.4.7\r\n@angular/router: 3.4.7\r\n@angular/cli: 1.0.0-beta.31\r\n@angular/compiler-cli: 2.4.7\r\n@ngtools/webpack: 1.2.9\r\n"},"comment":{"url":"https://api.github.com/repos/angular/angular-cli/issues/comments/282224268","html_url":"https://github.com/angular/angular-cli/issues/4735#issuecomment-282224268","issue_url":"https://api.github.com/repos/angular/angular-cli/issues/4735","id":282224268,"user":{"login":"Abrissirba","id":5156241,"avatar_url":"https://avatars.githubusercontent.com/u/5156241?v=3","gravatar_id":"","url":"https://api.github.com/users/Abrissirba","html_url":"https://github.com/Abrissirba","followers_url":"https://api.github.com/users/Abrissirba/followers","following_url":"https://api.github.com/users/Abrissirba/following{/other_user}","gists_url":"https://api.github.com/users/Abrissirba/gists{/gist_id}","starred_url":"https://api.github.com/users/Abrissirba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Abrissirba/subscriptions","organizations_url":"https://api.github.com/users/Abrissirba/orgs","repos_url":"https://api.github.com/users/Abrissirba/repos","events_url":"https://api.github.com/users/Abrissirba/events{/privacy}","received_events_url":"https://api.github.com/users/Abrissirba/received_events","type":"User","site_admin":false},"created_at":"2017-02-24T07:33:25Z","updated_at":"2017-02-24T07:33:25Z","body":"Found out that starting with typescript version 2.1 the transpiled code will look like below which will be valid module syntax. Angular 4.x will use 2.1 so in the meantime I will use a modified version of acorn where I remove the duplicate exports check.\r\n\r\n```\r\nexport var TaskActions;\r\n(function (TaskActions) {\r\n    //Approve = <any>{description: 'asdf', id:1},\r\n    TaskActions[TaskActions[\"Approve\"] = 1] = \"Approve\";\r\n    TaskActions[TaskActions[\"Reject\"] = 2] = \"Reject\";\r\n    TaskActions[TaskActions[\"ReAssign\"] = 3] = \"ReAssign\";\r\n    TaskActions[TaskActions[\"Comment\"] = 4] = \"Comment\";\r\n})(TaskActions || (TaskActions = {}));\r\n(function (TaskActions) {\r\n    function GetIcon(taskAction) {\r\n        switch (taskAction) {\r\n            case TaskActions.Approve: return 'thumb_up';\r\n            case TaskActions.Reject: return 'thumb_down';\r\n            case TaskActions.ReAssign: return 'people';\r\n            case TaskActions.Comment: return 'comment';\r\n        }\r\n    }\r\n    TaskActions.GetIcon = GetIcon;\r\n})(TaskActions || (TaskActions = {}));\r\n```\r\n"}}
{"actor":{"display_login":"Abrissirba"}}