How to handle ISO date strings in TypeScript?
<p>I'm brand new to typescript, so I'm trying to get the hang of it.</p>

<p>A network request is going to return a JSON object with a field in ISO Date string format.</p>

<pre><code>data : Data = {when: "2016-07-13T18:46:01.933Z"}
</code></pre>

<p>When I create the type signature for this interface, is there any way of specifying that this is actually an ISO timestamp or do I just have to use string?</p>

<pre><code>interface Data {
  when: string
}
</code></pre>

<p>I found out I could use a type alias which mentally helps, but doesn't really validate the ISO string.</p>

<pre><code>type iso = string
interface Data {
  when: iso
}
</code></pre>

<p>On a similar vein, I'm curious if there's anyway to generate js validation from these typescript annotations so I can validate the information received by the endpoint, otherwise the rest of my typed application is worthless. </p>

<p>If this is possible then it would be really cool if this iso string could be coerced into an actual Date object.</p>

<p>As I said, I'm new to typescript, so I'm not sure if this is beyond the scope of what typescript is supposed to do.</p>