{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3122","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3122/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3122/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3122/events","html_url":"https://github.com/Microsoft/TypeScript/issues/3122","id":75398060,"number":3122,"title":"Compiling with --noResolve elides needed imports","user":{"login":"breck7","id":74692,"avatar_url":"https://avatars.githubusercontent.com/u/74692?v=3","gravatar_id":"","url":"https://api.github.com/users/breck7","html_url":"https://github.com/breck7","followers_url":"https://api.github.com/users/breck7/followers","following_url":"https://api.github.com/users/breck7/following{/other_user}","gists_url":"https://api.github.com/users/breck7/gists{/gist_id}","starred_url":"https://api.github.com/users/breck7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/breck7/subscriptions","organizations_url":"https://api.github.com/users/breck7/orgs","repos_url":"https://api.github.com/users/breck7/repos","events_url":"https://api.github.com/users/breck7/events{/privacy}","received_events_url":"https://api.github.com/users/breck7/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/By%20Design","name":"By Design","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-05-11T23:50:56Z","updated_at":"2015-05-12T01:26:44Z","closed_at":"2015-05-12T00:00:00Z","body":"car.ts:\r\n```\r\nexport class Car {\r\n\tpublic beep(): void {}\r\n}\r\n```\r\n\r\ntruck.ts:\r\n```\r\nimport Car = require(\"./car\");\r\nclass Truck extends Car.Car {}\r\nnew Truck().beep();\r\n```\r\n\r\n**I expected ./car to be defined in both of these scenarios but it's elided in the first:**\r\n\r\n'tsc --target es5 --module amd **--noResolve** truck.ts' => 'define([\"require\", \"exports\"]'\r\n\r\n'tsc --target es5 --module amd truck.ts' => 'define([\"require\", \"exports\", **\"./car\"**]'\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/101090858","html_url":"https://github.com/Microsoft/TypeScript/issues/3122#issuecomment-101090858","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3122","id":101090858,"user":{"login":"danquirk","id":7121557,"avatar_url":"https://avatars.githubusercontent.com/u/7121557?v=3","gravatar_id":"","url":"https://api.github.com/users/danquirk","html_url":"https://github.com/danquirk","followers_url":"https://api.github.com/users/danquirk/followers","following_url":"https://api.github.com/users/danquirk/following{/other_user}","gists_url":"https://api.github.com/users/danquirk/gists{/gist_id}","starred_url":"https://api.github.com/users/danquirk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danquirk/subscriptions","organizations_url":"https://api.github.com/users/danquirk/orgs","repos_url":"https://api.github.com/users/danquirk/repos","events_url":"https://api.github.com/users/danquirk/events{/privacy}","received_events_url":"https://api.github.com/users/danquirk/received_events","type":"User","site_admin":false},"created_at":"2015-05-12T01:26:44Z","updated_at":"2015-05-12T01:26:44Z","body":"amd-dependency is for explicitly specifying what gets emitted into the require list, regardless of other logic (specifically to override things like the omitting logic for type only imports, or non-javascript require targets that TS doesn't support). That directive is one way to 'force imports' although it isn't as convenient as some global option. But it's not clear why you actually need to force imports here since it's doing the correct thing by default (without ```--noResolve```).\r\n\r\nThe compiler isn't omitting the import for ```car``` because it thinks it's only used in type position. As you see in your original example it gets emitted correctly when you do not use ```--noResolve```. When you use ```--noResolve``` you've explicitly told the compiler not to emit the import for ```car``` because it was an import target (of any kind). If I use Car in a value position like you did then there is a compilation error if I also use ```---noResolve```.\r\n\r\nI still don't understand why you actually need ```--noResolve``` here. It is doing exactly what it's supposed to do though."}}