{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/11173","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/11173/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/11173/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/11173/events","html_url":"https://github.com/Microsoft/TypeScript/issues/11173","id":179444822,"number":11173,"title":"'foo/bar' style imports not working with @types type definitions","user":{"login":"Naycon","id":5037505,"avatar_url":"https://avatars.githubusercontent.com/u/5037505?v=3","gravatar_id":"","url":"https://api.github.com/users/Naycon","html_url":"https://github.com/Naycon","followers_url":"https://api.github.com/users/Naycon/followers","following_url":"https://api.github.com/users/Naycon/following{/other_user}","gists_url":"https://api.github.com/users/Naycon/gists{/gist_id}","starred_url":"https://api.github.com/users/Naycon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Naycon/subscriptions","organizations_url":"https://api.github.com/users/Naycon/orgs","repos_url":"https://api.github.com/users/Naycon/repos","events_url":"https://api.github.com/users/Naycon/events{/privacy}","received_events_url":"https://api.github.com/users/Naycon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-27T09:42:59Z","updated_at":"2016-09-27T12:29:41Z","closed_at":null,"body":"Not sure if I've misunderstood something regarding module imports in TypeScript 2.0, but the following behaviour is a bit strange to me. Bug? Certainly is inconvenient at least.\r\n\r\n**TypeScript Version:**  2.0.3\r\n\r\n***node_modules/@types/foo/index.d.ts***\r\n```ts\r\ndeclare module \"foo\" {\r\n    export import Card = __Foo.Card.Card;\r\n}\r\n\r\ndeclare namespace __Foo {\r\n    namespace Card {\r\n        export class Card {\r\n            foo: () => string;\r\n        }\r\n        export class CardActions {\r\n            bar: string;\r\n        }\r\n    }\r\n}\r\n\r\ndeclare module \"foo/Card\" {\r\n    export import Card = __Foo.Card;\r\n    export import CardActions = __Foo.Card.CardActions;\r\n    export default Card;\r\n}\r\n```\r\n\r\n***test-not-working.ts (Cannot find module 'foo/Card')***\r\n```ts\r\nimport {CardActions} from 'foo/Card';\r\n\r\nconst action = new CardActions();\r\n```\r\n\r\n***test-okay.ts (No errors)***\r\n```ts\r\nimport * as Foo from 'foo';\r\nimport {CardActions} from 'foo/Card';\r\n\r\nconst action = new CardActions();\r\n```\r\n\r\n\r\n**Expected behavior:**\r\nFirst example with imports from 'foo/Card' directly should work.\r\n\r\n**Actual behavior:** \r\nTypeScript cannot resolve 'foo/Card' unless something is directly imported from 'foo' also well. \r\n\r\n**Workaround:**\r\nBy importing something (doesn't matter what) directly from 'foo', the other imports work as well.\r\n\r\n**Original source of problem:**\r\nWe use [material-ui](https://github.com/callemall/material-ui), which lets you import just the parts you need. This worked fine in TypeScript 1.8 using 'typings', but now it seems we need to rewrite our imports when we use type definitions installed via npm (`npm install --save @types/material-ui`), or use the work around above."},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/249850512","html_url":"https://github.com/Microsoft/TypeScript/issues/11173#issuecomment-249850512","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/11173","id":249850512,"user":{"login":"aluanhaddad","id":5034656,"avatar_url":"https://avatars.githubusercontent.com/u/5034656?v=3","gravatar_id":"","url":"https://api.github.com/users/aluanhaddad","html_url":"https://github.com/aluanhaddad","followers_url":"https://api.github.com/users/aluanhaddad/followers","following_url":"https://api.github.com/users/aluanhaddad/following{/other_user}","gists_url":"https://api.github.com/users/aluanhaddad/gists{/gist_id}","starred_url":"https://api.github.com/users/aluanhaddad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aluanhaddad/subscriptions","organizations_url":"https://api.github.com/users/aluanhaddad/orgs","repos_url":"https://api.github.com/users/aluanhaddad/repos","events_url":"https://api.github.com/users/aluanhaddad/events{/privacy}","received_events_url":"https://api.github.com/users/aluanhaddad/received_events","type":"User","site_admin":false},"created_at":"2016-09-27T12:29:41Z","updated_at":"2016-09-27T12:29:41Z","body":"This works fine for me with both 2.0.3 and 2.1.0-dev.20160927. \r\nTwo things of note are that this will not work in ~1.8.0 and that the module names are case sensitive. It works as long as you same casing for the import as in the ambient declaration. \r\n\r\nJust a personal opinion, using all lowercase module names is preferable as it is a common convention and maps to case insensitive file systems."}}
{"actor":{"display_login":"aluanhaddad"}}