Need clarification of the target and lib compiler options : <p>I find I'm confused by the target and lib options and how they interact with the features supported in the source code. I feel the docs need improving a little so am asking here before raising an issue.</p>

<p>I naively assumed that target specifies the version of JS that the output code requires to run (with the addition of a module loader). Thus we can always use all the advanced JS features (like object spread) that TS supports in our source and the compiler generates suitable code for the target we specify. I assume it had polyfills etc at hand and the code would just run on the target VM.</p>

<p>However the docs for the lib option specify the default libs depend on the target. But, libs effect what source types are available and so effect what code we can use. Thus the source features we can use depend on the target. That is not as I expected. I should say my understanding of lib is that they are typings with a different API, though the docs do not really say what they are.</p>

<p>I can see that here are some language features that do not depend on types and others that do. However it's not clear if that's part of the reason for this situation.</p>

<p>Can someone please clarify this?</p>

<p>A secondary question is why is there both an ES6 and an ES2015 lib when they are usual documented as being the same thing.</p>

<p>thanks</p>
