<story><title>TypeScript 2.3</title><url>https://blogs.msdn.microsoft.com/typescript/2017/04/27/announcing-typescript-2-3/</url></story><parent_chain><item><author>anonyfox</author><text>Since 2.1 ts is becoming a de-facto default choice for any serious JS projects I&amp;#x27;d say. In conjunction with VSCode it really shines and makes JS sometimes even enjoyable...&lt;p&gt;But there is an issue that quirks our team almost daily: the bolted-on typesystem provides a false sense of safety. You can look at an API response, write an interface for the data structure, build functionality ontop of it, and when the API response structure changes in subtle ways over time, everything &lt;i&gt;may&lt;/i&gt; break without notice. There is no way to enforce an interface through casting anywhere, not even via some code generation or sth like that.</text></item></parent_chain><comment><author>smrq</author><text>Codegen your TS interfaces from your server endpoints.  You don&amp;#x27;t need run-time enforcement if you have a compile-time guarantee that the endpoint you&amp;#x27;re hitting will return a specific type back.&lt;p&gt;TypeLite (&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.nuget.org&amp;#x2F;packages&amp;#x2F;TypeLite&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.nuget.org&amp;#x2F;packages&amp;#x2F;TypeLite&lt;/a&gt;) can get you halfway there with C#.  I used that for a while before eventually wanting more and rolling my own solution, which takes a WebAPI endpoint and generates typed fetch methods.  It&amp;#x27;s not anywhere close to polished or reusable, unfortunately.</text></comment>
<story><title>TypeScript 2.3</title><url>https://blogs.msdn.microsoft.com/typescript/2017/04/27/announcing-typescript-2-3/</url></story><parent_chain><item><author>anonyfox</author><text>Since 2.1 ts is becoming a de-facto default choice for any serious JS projects I&amp;#x27;d say. In conjunction with VSCode it really shines and makes JS sometimes even enjoyable...&lt;p&gt;But there is an issue that quirks our team almost daily: the bolted-on typesystem provides a false sense of safety. You can look at an API response, write an interface for the data structure, build functionality ontop of it, and when the API response structure changes in subtle ways over time, everything &lt;i&gt;may&lt;/i&gt; break without notice. There is no way to enforce an interface through casting anywhere, not even via some code generation or sth like that.</text></item></parent_chain><comment><author>Nemo157</author><text>Use something like &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;lbovet&amp;#x2F;typson&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;lbovet&amp;#x2F;typson&lt;/a&gt; to generate a JSON schema for your interfaces, then use a JSON schema validator before casting the API response to your interface.&lt;p&gt;I haven&amp;#x27;t touched TS since ~1.3, but this was all working well back then at least.</text></comment>