Background image
Featured blog post image

Lean TypeScript SDKs for the browser

New features to the Speakeasy Platform - September 4, 2024

What’s better than an ergonomic, type-safe TypeScript SDK? A lean, ergonomic, type-safe TypeScript SDK that’s optimized for the browser! We’ve made some major improvements to our TypeScript generation so that you can better serve your users who are building web applications.

And best of all, no breaking changes are required on your end. Just rerun your TypeScript generation and get the latest and greatest 🎉

Lean TypeScript SDKs with standalone functions

When SDKs are large, they can bloat the bundle size of your user’s app, even if they’re only using a small portion of your SDK’s functionality. That matters because the smaller the bundle, the faster the app loads, the better the user experience. If your SDK is too large, it may be a non-starter for your users.

To address this, we’ve introduced a new feature for TypeScript SDKs called Standalone Functions to make your SDKs tree-shakable. That will allow your users to import only the functions they need, resulting in a smaller bundle size and a more performant application.

Here’s an example of standalone functions in action via Dub’s SDK (opens in a new tab):

function_based.ts
import { DubCore } from "dub/core.js";
import { linksCount } from "dub/funcs/linksCount.js";
async function run() {
const dub = new DubCore();
const result = await linksCount(dub);
if (!result.ok) {
throw result.error;
}
// Use the result
console.log("Link count:", result.value);
}
run();

The performance benefits are enormous. In a benchmark test using a single function from the Dub SDK, bundle-size reduced from 324.4 kb -> 82.1 kb. That’s a 75% reduction in bundle size!

If you want the juicy technical details, check out the full blog post.


Regenerate Github SDKs from the CLI

Speakeasy run github

You can now remotely generate your SDKs on GitHub directly from your terminal! Just use the ​--github​ flag with ​speakeasy run​ to kick off a remote generation.

If you haven’t installed the GitHub app yet, don’t worry. Follow the prompts in your workspace to complete the setup. This will ensure the Speakeasy Github app has access to your managed repositories within your organization.

Ready to streamline your workflow? Give it a try!

🐝 New features and bug fixes 🐛

Info Icon

NOTE

Based on the most recent CLI version: Speakeasy v1.388.0 (opens in a new tab)

Generation platform

🐝 Feat: Add Summary and ToC sections to Readme generation

TypeScript

🐝 Feat: support added for custom compile commands
🐝 Feat: support for streaming file uploads in test generation
🐛 Fix: pagination when used alongside error handling

Python

🐛 Fix: pagination when used alongside error handling
🐛 Fix: correct implementation of unions of arrays
🐛 Fix: add errorUnions handling to usage snippets

Go

🐝 Feat: Support added for streaming uploads

C#

🐛 Fix: prevent conflicts with System namespace

PHP

🐛 Fix: handle empty global parameters array