Bytes #37 - Prepping to fight the Haskell demon

Prepping to fight the Haskell demon

Issue #37.March 1, 2021.2 Minute read.

Hi friends. I love all 82,159 of you. Thanks for reading.

TypeScript Releases v4.20-blaze-it

Elon Musk smoking TypeScript

Those types are **potent.**

TypeScript shipped its quarterly update last week... which happened to be version 4.20. And despite not being a major release, we counted ten new features and nine breaking changes. Apparently, Bill Gates is still running a tight ship over at Microsoft.

That's a lot of features/changes to unpack, so we'll cover the top 3 (according to us) and leave you to check out the rest for yourself in the very ~~long~~ detailed release notes.

1. Changes to rest elements in tuple types -- Tuples (pronounced Tuples) are kinda like VR/AR headsets: people like talking about them more than they actually use them. The tl;dr is that tuples are data types that let you express arrays with a fixed number of elements, and they don't need to be the same type of element (i.e. you could have a string and a number in one array).

TypeScript used to only allow rest elements at the last position of a tuple, but now they can occur anywhere within a tuple, which (according to the PR) is useful, "for strongly typing functions with variable parameter lists that end in a fixed set of parameters.

2. abstract construct signatures -- The original PR for this feature was first made back in January 2020: a simpler time when most of us hadn't heard of Covid and Gamestop was just a fun store where kids went to get ripped off. One ~~decade~~ year later, and we finally have support for the abstract keyword on constructor types and construct signatures, which is helpful for writing mixin factories in a way that supports abstract classes.

3. --explainFiles for figuring out your project structure -- A new & improved way to answer the age-old question: "Why in the world is TypeScript including this file?" Now you can just use the --explainFiles flag, and the TS compiler will give you an output listing why it included the various lib.d.ts files, local files, and node_modules files. Low-key, this might be the most helpful new feature of the release.

The Bottom Line

How much would it cost to create a reality TV show called Tuple Town, where we film 7 TypeScript enthusiasts living together under one roof? Find out what happens when developers stop being polite and start getting real.

Someone start a Kickstarter, please.


Hasura Releases v2.0

Hasura

Us prepping to fight the Haskell demon

This is just a tribute... to the name Hasura, which we just learned is a combination of the Sanskrit word for "demon" (asura) and Haskell. Well, those crazy little Haskell Demons just released v2.0 of Hasura's GraphQL Engine last week, and it's their most significant release in years.

Quick review: Hasura's open-source GraphQL engine is what first put Hasura on the map a few years ago. It's fast, and it doesn't require a build step because its configuration is completely dynamic and API based. The engine also gives you instant, realtime GraphQL APIs over Postgres with webhook triggers on database events and remote schemas for business logic.

What's new with v2:

  • Database diversity -- Initially, Hasura only supported Postgres, but Hasura 2.0 features a refactored "query compilation pipeline," so that the engine can be generalized to work with any database. It also allows you to connect to multiple independent DB's simultaneously.

  • The best of REST and GraphQL -- Since REST API's don't seem to be going away anytime soon, Hasura 2.0 now lets you create idiomatic REST endpoints based on GraphQL templates. The idea here is to give you all the benefits of GraphQL and REST, when you need it.

  • New & improved auth engine -- The updated authorization engine extends Hasura's auth policy abilities across data sources. That means you can control authorization on both your own GraphQL services or external GraphQL APIs that you don't own with role-based schemas and preset-arguments.

The Bottom Line

Like every other popular dev tool, Hasura is now trying to leverage its clout to launch a backend-as-a-service/cloud computing product. But hey, they raised $35m last year, so I guess it was worth selling their souls to the Haskell Demon?

Can't wait to launch the Bytes Deployment Platform once we hit a million subscribers.


JS Tip

Sometimes you want to remove a property/value from an object. Using the power of JavaScript™ (and ES6's rest operator), you can do it like this.

const user = {
  name: 'Tyler',
  age: 30,
  date: 1614619969641,
  funny: true
}

const { funny, ...updatedUser } = user

console.log(user) // {name: "Tyler", age: 30, date: 1614619969641}

Cool Bits

  1. Jaakko made a slick Next.js landing page template for SAAS products. Unfortunately, it doesn't come with the creepy, gangly-armed people included, so you'll have to get those somewhere else.

  2. Fireship made a cool video on how to make an invite-only app. Now you can create the Clubhouse of backend-as-a-service tools and become the wet dream of every VC in the Valley. Also,

  3. Mike Bostock wrote a post that looks back on the last 10 years of data viz since he released D3. One thing that hasn't changed: people getting real angry at us when we make data viz jokes.

  4. Nolan wrote an insightful post about going beyond beyond bundle size when assessing JavaScript performance.

  5. What's even more fun than normal code reviews? Remote code reviews!! 🤮 Thankfully, James wrote a nice article on a few ways to make the process less painful.

  6. Rishabh wrote a cool tutorial on using React & Three.js to recreate real-world terrain. If he'd released it a few years earlier, these guys could've used it to realize that it do go down.

  7. Ractive Player makes it easy to create interactive videos in React. It'll be perfect for helping me put the finishing touches on my YouTube singing course that I've been working on.

  8. James from the AWS team wrote about building a serverless multiplayer game that scales. Knowing James, he probably wants us to use AWS to build it. And thinks we should sell our new game on Amazon Marketplace. And stream ourselves playing it on Twitch. Classic company man. Classic James.

Join Bytes

Delivered to 70,048 developers every Monday