<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Braden Snell</title>
    <description>The latest articles on DEV Community by Braden Snell (@bradenhs).</description>
    <link>https://dev.to/bradenhs</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F416114%2F07f60b91-4acd-44bd-9eac-a7268f5688f2.jpeg</url>
      <title>DEV Community: Braden Snell</title>
      <link>https://dev.to/bradenhs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bradenhs"/>
    <language>en</language>
    <item>
      <title>The Irony of TypeScript and React</title>
      <dc:creator>Braden Snell</dc:creator>
      <pubDate>Wed, 15 Jul 2020 11:29:59 +0000</pubDate>
      <link>https://dev.to/bradenhs/the-irony-of-typescript-and-react-11bk</link>
      <guid>https://dev.to/bradenhs/the-irony-of-typescript-and-react-11bk</guid>
      <description>&lt;h2&gt;
  
  
  React proves libraries don't have to be written in TypeScript to be good at TypeScript.
&lt;/h2&gt;




&lt;p&gt;Angular. Ember. Svelte. Vue. TypeScript has been adopted by frontend frameworks with crushing inevitability. The ubiquitous (and often annoying) "Port this to TypeScript" GitHub issues, found in popular JavaScript repositories far and wide, reflect a real desire. Developers want the tooling benefits TypeScript-typed dependencies bring to their codebase. Not every library author has accepted the need to use TypeScript, but most have and more will. The notable exception to this emerging consensus is React, and the notable irony of this notable exception is the unmatched quality of React's TypeScript developer experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  JSX
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://reactjs.org/docs/introducing-jsx.html"&gt;JSX&lt;/a&gt; was introduced to the world in 2013, when React was open-sourced. JSX takes code like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"hello"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And turns it into this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Its simple syntactic sugar for JavaScript. Anytime anything complex needs to be done developers must hop out of JSX land with a couple curly brackets &lt;code&gt;{}&lt;/code&gt; and insert a JavaScript expression. Its simplicity and heavy reliance on JavaScript sets JSX apart. It also gives JSX a distinct advantage: tooling.&lt;/p&gt;

&lt;p&gt;In 2015, &lt;a href="https://devblogs.microsoft.com/typescript/announcing-typescript-1-6-2/"&gt;TypeScript 1.6 was released&lt;/a&gt; and support for JSX was added to the compiler. With this release new possibilities ranging from statically validating props, to multi-file component symbol renaming, were given to TypeScript/React projects. By virtue of the close relationship between JSX and JavaScript, feature-rich tooling was relatively easy to add. Other view-describing languages have struggled to meet the bar set by TypeScript and JSX. Even Angular 2, which was &lt;em&gt;written in TypeScript for TypeScript users&lt;/em&gt;, falls far short of React's JSX powered TypeScript experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Challenge
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The challenge TypeScript poses to library authors today isn't about converting an existing codebase to TypeScript. Instead the challenge is designing APIs that are statically analyzable.&lt;/strong&gt; The custom template languages common in frontend frameworks today are an extreme example of APIs that are not easy to statically analyze, but they are far from the only example. There are libraries in the JavaScript ecosystem that (barring fundamental API changes) will likely never have great TypeScript support. TypeScript's complex brew of union types, mapped types, conditional types, and variadic types &lt;em&gt;does&lt;/em&gt; make many patterns possible to express. Possible, however, doesn't always mean easy.&lt;/p&gt;

&lt;p&gt;Clearly, the solution is not to simply (re)write a library in TypeScript, though that certainly helps. The path forward is difficult because it means accepting new limitations. An API with no type-safety requirements will always have more flexibility than one with type-safety requirements. &lt;a href="https://www.youtube.com/watch?v=YrZTho_o_is"&gt;But, constraints are good for innovation&lt;/a&gt;. Embracing the limitations TypeScript imposes often leads to the creation of far more simple APIs.&lt;/p&gt;

&lt;h2&gt;
  
  
  It's Ironic
&lt;/h2&gt;

&lt;p&gt;Typically, a mess of complex generics is a bad idea in application code. For library code, however, the pain is generally worth the effort. Many times TypeScript support is an unasked-for burden placed upon folks building open source software in the JavaScript ecosystem. Welcome or not though, these requests reflect reality. In the end those libraries that embrace and conquer the challenges TypeScript offers will find success. Those that do not, will not reach their full potential. If you're building a new library in TypeScript, or converting an existing one to TypeScript you may wonder where to begin. Perhaps, start by thinking about the ironic truth React teaches us: libraries don't have to be written in TypeScript to be good at TypeScript.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Originally published at &lt;a href="https://typehero.org/the-irony-of-typescript-and-react"&gt;TypeHero.org&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>typescript</category>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Introducing Type Hero</title>
      <dc:creator>Braden Snell</dc:creator>
      <pubDate>Wed, 15 Jul 2020 11:29:43 +0000</pubDate>
      <link>https://dev.to/bradenhs/introducing-type-hero-1849</link>
      <guid>https://dev.to/bradenhs/introducing-type-hero-1849</guid>
      <description>&lt;h2&gt;
  
  
  Intelligent commentary on the TypeScript ecosystem and high quality, TypeScript-first tools.
&lt;/h2&gt;




&lt;p&gt;Dear TypeScript World,&lt;/p&gt;

&lt;p&gt;👋 Hi, I'm Braden and I'm launching &lt;a href="https://typehero.org"&gt;Type Hero&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://devblogs.microsoft.com/typescript/announcing-typescript-1-0/"&gt;Microsoft released TypeScript 1.0 to the world in April 2014&lt;/a&gt;. I was working in a C# shop at the time and we were quick to adopt TypeScript for our frontend development. That early introduction to the language shaped my career in the ensuing years. I sought out opportunities to work with TypeScript. I applied for positions where I knew I could use the technology. Over the years, I've built some pretty cool stuff using the language ranging from web app frontends and backends to mobile apps. I've become intimately familiar with TypeScript's limitations and flaws. I've also seen first-hand the positive difference it makes when building applications large and small.&lt;/p&gt;

&lt;p&gt;These years of experience have left me with a lot of strong opinions. Type Hero is a home for those opinions. Its also home to a growing group of open source projects designed to make building type safe applications a little easier. Type Hero won't be a personal blog. Just like the open source projects under the Type Hero name, I hope it eventually attracts thoughtful contributions from folks besides me. If you're looking for intelligent commentary on the TypeScript ecosystem and high quality, TypeScript-first tools look no further than Type Hero.&lt;/p&gt;

&lt;p&gt;Enjoy reading!&lt;/p&gt;

&lt;p&gt;Braden&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Originally published at &lt;a href="https://typehero.org/introducing-type-hero"&gt;TypeHero.org&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>typescript</category>
    </item>
  </channel>
</rss>
