{"action":"opened","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3005","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3005/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3005/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/3005/events","html_url":"https://github.com/Microsoft/TypeScript/issues/3005","id":72630734,"number":3005,"title":"Using ES6 type definition library when targetting ES5 output","user":{"login":"robertknight","id":2458,"avatar_url":"https://avatars.githubusercontent.com/u/2458?v=3","gravatar_id":"","url":"https://api.github.com/users/robertknight","html_url":"https://github.com/robertknight","followers_url":"https://api.github.com/users/robertknight/followers","following_url":"https://api.github.com/users/robertknight/following{/other_user}","gists_url":"https://api.github.com/users/robertknight/gists{/gist_id}","starred_url":"https://api.github.com/users/robertknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertknight/subscriptions","organizations_url":"https://api.github.com/users/robertknight/orgs","repos_url":"https://api.github.com/users/robertknight/repos","events_url":"https://api.github.com/users/robertknight/events{/privacy}","received_events_url":"https://api.github.com/users/robertknight/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-02T11:08:10Z","updated_at":"2015-05-02T11:08:10Z","closed_at":null,"body":"I'm building a project for 'modern' but not bleeding-edge browsers (IE >= 10, Chrome/Firefox from mid-last year onwards), this means targeting ES5 output since ES6 language features are incomplete. However I'm able to use many ES6 library features either via polyfills (Map, Set, Promise) or because browsers added support for them early on (eg. DataView is available in IE 10 and later).\r\n\r\nAt the moment the language and library targets in TSC are controlled by the same --target option, which makes this difficult, more so in TS 1.5.0-beta because a number of ES6 APIs that used to be in the lib.d.ts file (Map, DataView) are now only found in the ES6 library.\r\n\r\nSome possible solutions:\r\n* Always make ES6 type definitions available - leave it up to TSC users to determine what APIs they can target.\r\n* Put all the type definitions in the same file, but provide a way to annotate methods which are part of a given ES-version. eg. Rust allows annotations like `#[stable(feature = \"rust1\", since = \"1.0.0\")]` on a method to indicate which version of the library a method became available in. Compiler flags could then be used to allow or deny use of ES6 interfaces.\r\n* A simple compiler switch that specifies the library target, separately from the language/emit target.\r\n\r\nThoughts?"}}