{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/7535","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/7535/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/7535/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/7535/events","html_url":"https://github.com/Microsoft/TypeScript/issues/7535","id":141163009,"number":7535,"title":"How to Compare Two Definitions Structurally?","user":{"login":"blakeembrey","id":1088987,"avatar_url":"https://avatars.githubusercontent.com/u/1088987?v=3","gravatar_id":"","url":"https://api.github.com/users/blakeembrey","html_url":"https://github.com/blakeembrey","followers_url":"https://api.github.com/users/blakeembrey/followers","following_url":"https://api.github.com/users/blakeembrey/following{/other_user}","gists_url":"https://api.github.com/users/blakeembrey/gists{/gist_id}","starred_url":"https://api.github.com/users/blakeembrey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blakeembrey/subscriptions","organizations_url":"https://api.github.com/users/blakeembrey/orgs","repos_url":"https://api.github.com/users/blakeembrey/repos","events_url":"https://api.github.com/users/blakeembrey/events{/privacy}","received_events_url":"https://api.github.com/users/blakeembrey/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Question","name":"Question","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2016-03-16T03:30:19Z","updated_at":"2016-04-27T18:22:52Z","closed_at":"2016-03-29T04:46:10Z","body":"I'm not sure if this feature is currently supported, or even whether the whole chain of features have been enabled to make this workflow work, but at the lowest level how would one compare two definitions (`1.d.ts` and `2.d.ts`) and check if they're compatible? On top of this, would it be possible to access the definitions for a JavaScript library?\r\n\r\nReasoning: It'd be great to be able to type existing JavaScript libraries, but the biggest thing hindering third-parties is being able to integrate the workflow with CI. One way to improve this workflow would be with the `--allowJs` flag on the library itself to generate one definition, then comparing it to the user-written definition. Having the declarations flag work with `--allowJs` would also allow users to get started writing definitions 10x faster - just run `tsc entry.js --allowJs --declaration --out definitions` and improve the types little by little. "},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/215181396","html_url":"https://github.com/Microsoft/TypeScript/issues/7535#issuecomment-215181396","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/7535","id":215181396,"user":{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars.githubusercontent.com/u/8000722?v=3","gravatar_id":"","url":"https://api.github.com/users/mhegazy","html_url":"https://github.com/mhegazy","followers_url":"https://api.github.com/users/mhegazy/followers","following_url":"https://api.github.com/users/mhegazy/following{/other_user}","gists_url":"https://api.github.com/users/mhegazy/gists{/gist_id}","starred_url":"https://api.github.com/users/mhegazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhegazy/subscriptions","organizations_url":"https://api.github.com/users/mhegazy/orgs","repos_url":"https://api.github.com/users/mhegazy/repos","events_url":"https://api.github.com/users/mhegazy/events{/privacy}","received_events_url":"https://api.github.com/users/mhegazy/received_events","type":"User","site_admin":false},"created_at":"2016-04-27T18:22:52Z","updated_at":"2016-04-27T18:22:52Z","body":"how far would this go, like there are JS dynamic constructs that can not be verified statically, e.g.\r\n\r\n```js\r\nvar mod = require(\"./other\");\r\nfor(var i in mod) {\r\n    exports[i + \"_extension\"] = mod[i];\r\n}\r\n```\r\n\r\nhow would you check this against a .d.ts file?"}}