{"action":"closed","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/5172","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/5172/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/5172/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/5172/events","html_url":"https://github.com/Microsoft/TypeScript/issues/5172","id":110497402,"number":5172,"title":"npm module resolution not working when generating descriptors","user":{"login":"grofit","id":927201,"avatar_url":"https://avatars.githubusercontent.com/u/927201?v=3","gravatar_id":"","url":"https://api.github.com/users/grofit","html_url":"https://github.com/grofit","followers_url":"https://api.github.com/users/grofit/followers","following_url":"https://api.github.com/users/grofit/following{/other_user}","gists_url":"https://api.github.com/users/grofit/gists{/gist_id}","starred_url":"https://api.github.com/users/grofit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grofit/subscriptions","organizations_url":"https://api.github.com/users/grofit/orgs","repos_url":"https://api.github.com/users/grofit/repos","events_url":"https://api.github.com/users/grofit/events{/privacy}","received_events_url":"https://api.github.com/users/grofit/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Needs%20More%20Info","name":"Needs More Info","color":"556b75"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-10-08T16:54:37Z","updated_at":"2016-02-19T23:47:44Z","closed_at":"2016-02-19T23:47:44Z","body":"When I am compiling my typescript files, it works fine when compiling the normal outputs to js, but if I were to try and compile the descriptors it blows up saying it cannot find the modules.\r\n\r\nSo I have a build script like so:\r\n\r\n```\r\nvar buildFor = function(module) {\r\n    var tsResult = gulp\r\n        .src([ paths.source, paths.typings ])\r\n        .pipe(plumber())\r\n        .pipe(ts({\r\n            module: module,\r\n            removeComments: true,\r\n            target: \"es5\",\r\n            declarationFiles: false,\r\n            typescript: tsc\r\n        }));\r\n\r\n    return tsResult.js.pipe(gulp.dest(paths.output + \"/\" + module));\r\n};\r\n\r\nvar buildDefinitions = function() {\r\n    var tsResult = gulp\r\n        .src([paths.source, paths.typings])\r\n        .pipe(plumber())\r\n        .pipe(ts({\r\n            module: \"commonjs\",\r\n            removeComments: true,\r\n            target: \"es5\",\r\n            declarationFiles: true,\r\n            typescript: tsc\r\n        }));\r\n\r\n    return tsResult.dts.pipe(gulp.dest(paths.output + \"/definitions\"));\r\n};\r\n```\r\n\r\nNow lets assume I have done an `npm install some-module` and that contains an `index.d.ts` which contains descriptor information and links to other d.ts files within this module.\r\n\r\nNow if I had a typescript file like so:\r\n\r\n```\r\nimport {SomeClass} from \"some-module\";\r\n\r\nexport class CampaignDescriptorFactory\r\n{\r\n   public blah: SomeClass;\r\n}\r\n```\r\n\r\nWhen it is compiled with the `buildFor(\"commonjs\")` works fine and no issues reported. However if I were to run the `buildDefinitions()` it blows up saying it cannot find `some-module`.\r\n\r\nIf it helps i have a SO question around this area which gives more info on the use case.\r\nhttp://stackoverflow.com/questions/31983011/typescript-es6-module-syntax-with-ambient-d-ts-module\r\n"}}