title: Adding type to a literal in TypeScript
body: <p>Can I add a type to a literal in TypeScript? Something like the below:</p>
  <pre><code>type State = 'DRAFT' | 'PUBLISHED';
  (['DRAFT', 'OOPS']: State[]).map(s =&gt; doSomethingWithState(s)); // Should be flagged by the compiler as 'OOPS' is not compatible with State
  (['DRAFT']: State[]).map(s =&gt; doSomethingWithState(s)); // Valid
  (['DRAFT', 'PUBLISHED']: State[]).map(s =&gt; doSomethingWithState(s)); // Valid
  </code></pre>
  <p>I have tried using <code>as</code> but this tells the compiler to treat the as as though it were of the given type, not to check that the literal is of the given type.</p>
  <p>I could also do <code>const foo: Type = ...</code> but I don't need to assign this value, I just want to declare it and use it immediately.</p>