TypeScript Icon

TypeScript

TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
55 Stories
All Topics

Max Howell github.com

tea is not a package manager. tea is unified packaging infrastructure

Homebrew creator Max Howell is back with a brand new invention:

tea is a standalone, binary download for all platforms that puts the entire open source ecosystem at your fingertips. Casually and effortlessly use the latest and greatest or the oldest and most mature from any layer of any stack. Break down the silos between programming communities, throw together scripts that use entirely separate tools and languages and share them with the world with a simple one-liner.

All you need is tea.

Bold! I love how many interesting ideas are packed in to this project: pipelines, universal virtual-env, executable markdown… the list goes on. Check out the README for all the deets. My big question is: might Max and the team be thinking too big this time around?

TypeScript github.com

A CRUD framework for full stack TypeScript

Full-stack web development is (still) too complicated. Simple CRUD, a common requirement of any business application, should be simple to build, maintain, and extend when the need arises.

Remult is a full-stack CRUD framework that uses your TypeScript entities as a single source of truth for your API, frontend type-safe API client and backend ORM.

This isn’t just production-ready, it’s been used in production since 2018.

TypeScript github.com

A headless, code-first CMS built with TypeScript

This looks very opinionated with the tech it chooses (Node, Express, MongoDB, React, TypeScript). But if you like those choices, that probably means you’ll like what they’ve cooked up.

  • Payload gives you everything you need, but then steps back and lets you build what you want in JavaScript or TypeScript - with no unnecessary complexity brought by GUIs. You’ll understand how your CMS works because you will have written it exactly how you want it.
  • Bring your own Express server and do whatever you need on top of Payload. Payload doesn’t impose anything on you or your app.
  • Completely control the Admin panel by using your own React components. Swap out fields or even entire views with ease.
  • Use your data however and wherever you need thanks to auto-generated, yet fully extensible REST, GraphQL, and Local Node APIs.

TypeScript github.com

A compiled-away, type-safe, readable RegExp alternative

This isn’t the first attempt at making regular expressions more approachable, but it’s the first one I’ve seen that also brings type safety to the table. Example code:

import { createRegExp, exactly, oneOrMore, digit } from 'magic-regexp'

// Quick-and-dirty semver
createRegExp(
  oneOrMore(digit)
    .as('major')
    .and('.')
    .and(oneOrMore(digit).as('minor'))
    .and(exactly('.').and(oneOrMore(char).as('patch')).optionally())
)
// /(?<major>(\d)+)\.(?<minor>(\d)+)(\.(?<patch>(.)+))?/

JS Party JS Party #226

The third year of the third age of JS

In 2020, Shawn (swyx) Wang wrote:

Every 10 years there is a changing of the guard in JavaScript. I think we have just started a period of accelerated change that could in thge future be regarded as the Third Age of JavaScript.

We’re now in year three of this third age and Swyx joins us to look back at what he missed, look around at what’s happening today, and look forward at what might be coming next.

Chris Krycho semver-ts.org

Semantic Versioning for TypeScript Types

Since TypeScript doesn’t follow SemVer itself, TS libraries which do want to follow SemVer need both high-level guidance about how to do that and detailed analysis of the corner cases to watch out for as well as ways to mitigate breaking changes from TS.

This doc is a (beta!) specification of SemVer for managing changes to TypeScript types, including when the TS compiler makes breaking changes in its type-checking and type emit across a “minor” release.

JS Party JS Party #222

The Type Annotations proposal

Daniel Rosenwasser and Ryan Cavanaugh from the TypeScript team at Microsoft join Nick and Boneskull to catch us up on the latest happening with the TypeScript project, including what’s exciting in the new 4.7 beta release. Then, we dive deep into the new, TC-39 stage 1 Type Annotations proposal, what it is, and what it means for the future of a not really typed JavaScript!

TypeScript github.com

ECMAScript proposal: Types as Comments

This proposal is brand new (stage 0), but I hear that a lot of work has been put into it behind the scenes by a lot of people, so it has that going for it…

This proposal aims to enable developers to add type annotations to their JavaScript code, allowing those annotations to be checked by a type checker that is external to JavaScript. At runtime, a JavaScript engine ignores them, treating the types as comments.

The aim of this proposal is to enable developers to run programs written in TypeScript, Flow, and other static typing supersets of JavaScript without any need for transpilation, if they stick within a certain reasonably large subset of the language.

The implications of this change are pretty massive, if it were to ever ship. And you better believe we’re putting together a JS Party episode to discuss it with the people involved.

TypeScript cstrnt.dev

Tricks I wish I knew when I learned TypeScript

Tim Raderschad shares some knowledge he acquired the hard way. The tricks are:

  1. Readonly
  2. Any vs Unknown
  3. Typing Objects with Records

I knew exactly zero of these (although I’ve only written a few hundred lines of TypeScript thus far. I’m mostly ignoring it so I can retain my arch nemesis status with Nick (the perpetual TypeScript bull) on JS Party. 😉)

Niek npmjs.com

Todo Or Die? TypeScript can do that

Turns out Niek and his team were also inspired by other Todo or Die implementations:

Lately, there is some talk about Todo or Die plugins in languages. According to your latest newsletter, it is now supported in Rust, Ruby, Python, and Elixir. We’ve now added support for TypeScript as a language server plugin!

For now, it has a minimal feature set, because this was created in a day during our company’s Innovation Day, but we have lots of ideas to extend the project.

TypeScript tRPC.io

A TypeScript toolkit for building end-to-end typesafe data layers

tRPC doesn’t generate code for you, add functions to your run-time, or require any additions to your build pipeline. It simply allows your client code to be aware of your server-side type annotations and declarations so you can have type-safety and autocompletion inferred from its API paths, input/output data, and errors.

A TypeScript toolkit for building end-to-end typesafe data layers

Deno github.com

Deno 1.6 lets you compile TypeScript to a single executable

A (potentially) landmark feature landed in Deno 1.6:

deno compile --unstable https://deno.land/std@0.79.0/examples/cat.ts will make you an executable version of the module.

This puts Deno-based TypeScript projects in the same league as Go and Rust by providing a way to distribute software without the pain of dynamically linking multiple files. (This single-binary distribution has made Go a popular choice for projects such as the GitHub CLI and Stripe CLI.)

Node has had a similar capability by way of Vercel’s pkg project, but Deno sets itself apart by supporting the feature as part of the runtime itself.

TypeScript github.com

Tips for performant TypeScript

From Microsoft’s TypeScript wiki on GitHub:

There are easy ways to configure TypeScript to ensure faster compilations and editing experiences. The earlier on these practices are adopted, the better. Beyond best-practices, there are some common techniques for investigating slow compilations/editing experiences, some common fixes, and some common ways of helping the TypeScript team investigate the issues as a last resort.

TypeScript nullbyt.es

A new TypeScript Postgres query builder

Martijn de Haan:

It’s been almost 3 years since I started working on this query builder idea of mine. Today is finally the day Mammoth hits 1.0. Mammoth is a no-batteries-included type-safe Postgres query builder for TypeScript. Hooray!

Congrats on shipping, Martijn! Here’s a peak at the API:

const rows = await db
    .select(db.foo.id, db.bar.name)
    .from(db.foo)
    .leftJoin(db.bar)
    .on(db.bar.fooId.eq(db.foo.id));
  0:00 / 0:00