{"action":"created","issue":{"url":"https://api.github.com/repos/codemix/babel-plugin-typecheck/issues/123","repository_url":"https://api.github.com/repos/codemix/babel-plugin-typecheck","labels_url":"https://api.github.com/repos/codemix/babel-plugin-typecheck/issues/123/labels{/name}","comments_url":"https://api.github.com/repos/codemix/babel-plugin-typecheck/issues/123/comments","events_url":"https://api.github.com/repos/codemix/babel-plugin-typecheck/issues/123/events","html_url":"https://github.com/codemix/babel-plugin-typecheck/issues/123","id":136430656,"number":123,"title":"Weird behavior after importing type","user":{"login":"prewk","id":640102,"avatar_url":"https://avatars.githubusercontent.com/u/640102?v=3","gravatar_id":"","url":"https://api.github.com/users/prewk","html_url":"https://github.com/prewk","followers_url":"https://api.github.com/users/prewk/followers","following_url":"https://api.github.com/users/prewk/following{/other_user}","gists_url":"https://api.github.com/users/prewk/gists{/gist_id}","starred_url":"https://api.github.com/users/prewk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prewk/subscriptions","organizations_url":"https://api.github.com/users/prewk/orgs","repos_url":"https://api.github.com/users/prewk/repos","events_url":"https://api.github.com/users/prewk/events{/privacy}","received_events_url":"https://api.github.com/users/prewk/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-25T16:05:18Z","updated_at":"2016-02-26T09:42:50Z","closed_at":"2016-02-26T08:16:39Z","body":"Am I correct in assuming that this should work?\r\n\r\n````js\r\n// a.js\r\n\r\nexport type Foo = { id: number; title: string; type: 'FOO' | 'BAR'; };\r\n\r\n// b.js\r\n\r\nimport type { Foo } from './a';\r\n\r\nconst item = { id: 123, title: 'Lorem ipsum', type: 'FOO' };\r\nconst x: Foo = item;\r\n````\r\n\r\nI have a similar situation where it keeps saying `TypeError: Value of variable \"item\" violates contract. Expected: Foo Got: { id: number; title: string; type: string; }`\r\n\r\nHowever, it works if I keep everything in one file:\r\n\r\n````js\r\ntype Foo = { id: number; title: string; type: 'FOO' | 'BAR'; };\r\n\r\nconst item = { id: 123, title: 'Lorem ipsum', 'FOO' };\r\nconst x: Foo = item;\r\n````\r\n\r\nIn the first, not working, example I've experimented with trying this out:\r\n\r\n````js\r\nconst item = { id: 123, title: 'Lorem ipsum', 'FOO' };\r\nconsole.log(Foo(item)); // Logs 'true'\r\nconst x: Foo = item;\r\n````\r\n\r\nWhich makes me even more confused, because if it's failing, it should return false, right?\r\n\r\nThanks for an awesome lib!"},"comment":{"url":"https://api.github.com/repos/codemix/babel-plugin-typecheck/issues/comments/189192619","html_url":"https://github.com/codemix/babel-plugin-typecheck/issues/123#issuecomment-189192619","issue_url":"https://api.github.com/repos/codemix/babel-plugin-typecheck/issues/123","id":189192619,"user":{"login":"phpnode","id":363611,"avatar_url":"https://avatars.githubusercontent.com/u/363611?v=3","gravatar_id":"","url":"https://api.github.com/users/phpnode","html_url":"https://github.com/phpnode","followers_url":"https://api.github.com/users/phpnode/followers","following_url":"https://api.github.com/users/phpnode/following{/other_user}","gists_url":"https://api.github.com/users/phpnode/gists{/gist_id}","starred_url":"https://api.github.com/users/phpnode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phpnode/subscriptions","organizations_url":"https://api.github.com/users/phpnode/orgs","repos_url":"https://api.github.com/users/phpnode/repos","events_url":"https://api.github.com/users/phpnode/events{/privacy}","received_events_url":"https://api.github.com/users/phpnode/received_events","type":"User","site_admin":false},"created_at":"2016-02-26T09:42:50Z","updated_at":"2016-02-26T09:42:50Z","body":"@prewk glad to hear it's working."}}