{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9153","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9153/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9153/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9153/events","html_url":"https://github.com/Microsoft/TypeScript/issues/9153","id":160120345,"number":9153,"title":"Can we please have module resolution for AMD?","user":{"login":"blendsdk","id":5524595,"avatar_url":"https://avatars.githubusercontent.com/u/5524595?v=3","gravatar_id":"","url":"https://api.github.com/users/blendsdk","html_url":"https://github.com/blendsdk","followers_url":"https://api.github.com/users/blendsdk/followers","following_url":"https://api.github.com/users/blendsdk/following{/other_user}","gists_url":"https://api.github.com/users/blendsdk/gists{/gist_id}","starred_url":"https://api.github.com/users/blendsdk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blendsdk/subscriptions","organizations_url":"https://api.github.com/users/blendsdk/orgs","repos_url":"https://api.github.com/users/blendsdk/repos","events_url":"https://api.github.com/users/blendsdk/events{/privacy}","received_events_url":"https://api.github.com/users/blendsdk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Question","name":"Question","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-06-14T08:04:10Z","updated_at":"2016-06-14T19:24:02Z","closed_at":null,"body":"Hi,\r\n\r\nI would know what are the possibilities and reservations for having a sort of module resolution\r\nwhen compiling a project with `--module=amd`\r\n\r\n### The context:\r\n\r\n- This is about NodeJS and NPM modules\r\n- I am developing a fairly large library that is distributed as an NPM module\r\n- The project ultimately compiles down to a single js file and a single d.ts file.\r\n- The framework consist of many classes, one class per file, and the classes are organized in various namspaces (like we do it in .NET)\r\n- At the consumer side, after installing the lib with `npm install --save` I use `typings install --save --global file:node_modules/path/to/lib.d.ts` \r\n\r\n### The problem and the request\r\n\r\n- I use statements like `var fs = require('fs');` at the top of some classes. This works at runtime just fine but at develop time, I don't get \"intellisense\" from VSCode for example, even with adding `/// ref` and installing `dt~node` with `typings` . The compiler sees 'fs' as 'any' because `require(\"fs\"`) is not resolved to an external module.\r\n\r\nI understand that is about module resolution and emitting somekind of `require` statement, but would it be possible to implement such module resolution (just for the sake of intellisense)  in the compiler.\r\n\r\nAny thoughts? \r\n\r\nThanks.\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/225988972","html_url":"https://github.com/Microsoft/TypeScript/issues/9153#issuecomment-225988972","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9153","id":225988972,"user":{"login":"blendsdk","id":5524595,"avatar_url":"https://avatars.githubusercontent.com/u/5524595?v=3","gravatar_id":"","url":"https://api.github.com/users/blendsdk","html_url":"https://github.com/blendsdk","followers_url":"https://api.github.com/users/blendsdk/followers","following_url":"https://api.github.com/users/blendsdk/following{/other_user}","gists_url":"https://api.github.com/users/blendsdk/gists{/gist_id}","starred_url":"https://api.github.com/users/blendsdk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blendsdk/subscriptions","organizations_url":"https://api.github.com/users/blendsdk/orgs","repos_url":"https://api.github.com/users/blendsdk/repos","events_url":"https://api.github.com/users/blendsdk/events{/privacy}","received_events_url":"https://api.github.com/users/blendsdk/received_events","type":"User","site_admin":false},"created_at":"2016-06-14T19:24:02Z","updated_at":"2016-06-14T19:24:02Z","body":"Sorry for the confusion. The current setup works at runtime but in this case just for the built-in nodejs modules I don't get intellisense because the compile sees `var a = require('b')` not as a module import in AMD! \r\n\r\nWhat I don't want to do is:\r\n\r\n- use `import a = require('a')`  (undesired code generation)\r\n- use `--module=<anything but amd>` (undesired module resolution and need to import/export)\r\n\r\nAs a workaround I can create an interface :\r\n```\r\ninterface NodeFSModule {\r\n    execSync(.....)  ....\r\n    rmdir(.....)\r\n}\r\n\r\n// then\r\nvar fs:NodeFSModule = require(\"fs\")\r\n\r\n// which equals no more fun programming to do for every function in NodeJs FS\r\n```\r\n\r\nAny advice?\r\n"}}
{"actor":{"display_login":"blendsdk"}}