{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6022","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6022/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6022/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6022/events","html_url":"https://github.com/Microsoft/TypeScript/issues/6022","id":121361036,"number":6022,"title":"External modules that don't export anything emit empty declarations.","user":{"login":"robwormald","id":534930,"avatar_url":"https://avatars.githubusercontent.com/u/534930?v=3","gravatar_id":"","url":"https://api.github.com/users/robwormald","html_url":"https://github.com/robwormald","followers_url":"https://api.github.com/users/robwormald/followers","following_url":"https://api.github.com/users/robwormald/following{/other_user}","gists_url":"https://api.github.com/users/robwormald/gists{/gist_id}","starred_url":"https://api.github.com/users/robwormald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robwormald/subscriptions","organizations_url":"https://api.github.com/users/robwormald/orgs","repos_url":"https://api.github.com/users/robwormald/repos","events_url":"https://api.github.com/users/robwormald/events{/privacy}","received_events_url":"https://api.github.com/users/robwormald/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Fixed","name":"Fixed","color":"bfe5bf"}],"state":"closed","locked":false,"assignee":{"login":"vladima","id":8052307,"avatar_url":"https://avatars.githubusercontent.com/u/8052307?v=3","gravatar_id":"","url":"https://api.github.com/users/vladima","html_url":"https://github.com/vladima","followers_url":"https://api.github.com/users/vladima/followers","following_url":"https://api.github.com/users/vladima/following{/other_user}","gists_url":"https://api.github.com/users/vladima/gists{/gist_id}","starred_url":"https://api.github.com/users/vladima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladima/subscriptions","organizations_url":"https://api.github.com/users/vladima/orgs","repos_url":"https://api.github.com/users/vladima/repos","events_url":"https://api.github.com/users/vladima/events{/privacy}","received_events_url":"https://api.github.com/users/vladima/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/15","html_url":"https://github.com/Microsoft/TypeScript/milestones/TypeScript%201.8","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/15/labels","id":1347987,"number":15,"title":"TypeScript 1.8","description":"","creator":{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars.githubusercontent.com/u/8000722?v=3","gravatar_id":"","url":"https://api.github.com/users/mhegazy","html_url":"https://github.com/mhegazy","followers_url":"https://api.github.com/users/mhegazy/followers","following_url":"https://api.github.com/users/mhegazy/following{/other_user}","gists_url":"https://api.github.com/users/mhegazy/gists{/gist_id}","starred_url":"https://api.github.com/users/mhegazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhegazy/subscriptions","organizations_url":"https://api.github.com/users/mhegazy/orgs","repos_url":"https://api.github.com/users/mhegazy/repos","events_url":"https://api.github.com/users/mhegazy/events{/privacy}","received_events_url":"https://api.github.com/users/mhegazy/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":305,"state":"closed","created_at":"2015-10-09T22:07:47Z","updated_at":"2016-01-29T18:25:32Z","due_on":null,"closed_at":"2016-01-28T20:08:21Z"},"comments":13,"created_at":"2015-12-09T23:00:17Z","updated_at":"2016-02-02T23:50:23Z","closed_at":"2016-01-16T05:28:42Z","body":"Background - in RxJS we have a number of \"operators\" that extend our base Observable type.\r\n\r\n```typescript\r\n//src/Observable.ts\r\nclass Observable {\r\n  map: <R>(project: (x: T, ix?: number) => R, thisArg?: any) => Observable<R>;\r\n}\r\n```\r\n\r\n```typescript\r\n// src/operators/map.ts\r\nexport function map<T, R>(project: (x: T, ix?: number) => R, thisArg?: any): Observable<R> {\r\n  if (typeof project !== 'function') {\r\n    throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');\r\n  }\r\n  return this.lift(new MapOperator(project, thisArg));\r\n}\r\n//snip\r\n```\r\n\r\nThis separation allows a user to import the `map` operator function and use it without bringing in the other 95 or so - without \"side-effects\":\r\n```typescript\r\nimport {map} from 'rxjs/operators/map'\r\nmap.call(someObservable, (v) => v + 1 );\r\n```\r\nWithout functionBind, this is slightly unergonomic, so we defined a set of \"patch\" modules that import the `Observable` type and the the `map` operator, and patch the prototype there:\r\n\r\n```typescript\r\n//rxjs/add/operators/map.ts\r\nimport {Observable} from '../../Observable';\r\nimport {map} from '../../operator/map';\r\nObservable.prototype.map = map;\r\n```\r\n\r\nWith the idea being a user should be able to simply `import 'rxjs/add/operators/map'` and have the prototype patched in the background.\r\n\r\nIssue:\r\n\r\nThe emitted `rxjs/add/operators/map.d.ts` file is emitted completely empty, and so when a user goes to `import 'rxjs/add/operators/map.ts'`, the Typescript compiler errors with\r\n ```\r\nerror TS2656: \r\nExported external package typings file 'node_modules/rxjs/add/operator/map.d.ts' is not a module. \r\nPlease contact the package author to update the package definition.\r\n```\r\nDiscussed with @mhegazy \r\n\r\nCC @blesh @jeffbcross\r\n\r\nRxJS Issue: https://github.com/ReactiveX/RxJS/issues/1010\r\nSample file: https://github.com/ReactiveX/RxJS/blob/master/src/add/operator/map.ts "},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/178892844","html_url":"https://github.com/Microsoft/TypeScript/issues/6022#issuecomment-178892844","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6022","id":178892844,"user":{"login":"masaeedu","id":3674056,"avatar_url":"https://avatars.githubusercontent.com/u/3674056?v=3","gravatar_id":"","url":"https://api.github.com/users/masaeedu","html_url":"https://github.com/masaeedu","followers_url":"https://api.github.com/users/masaeedu/followers","following_url":"https://api.github.com/users/masaeedu/following{/other_user}","gists_url":"https://api.github.com/users/masaeedu/gists{/gist_id}","starred_url":"https://api.github.com/users/masaeedu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masaeedu/subscriptions","organizations_url":"https://api.github.com/users/masaeedu/orgs","repos_url":"https://api.github.com/users/masaeedu/repos","events_url":"https://api.github.com/users/masaeedu/events{/privacy}","received_events_url":"https://api.github.com/users/masaeedu/received_events","type":"User","site_admin":false},"created_at":"2016-02-02T23:50:23Z","updated_at":"2016-02-02T23:50:23Z","body":"@mhegazy Will do"}}