Bootcamp

From idea to product, one lesson at a time. To submit your story: https://tinyurl.com/bootspub1

Follow publication

Member-only story

Upcoming Improvements in TypeScript 5.3

Abdelfattah Sekak
Bootcamp
Published in
3 min readAug 28, 2023

--

Text to image with midjourney — Exciting New Features on the Horizon

As TypeScript continues to evolve, we’re all eagerly awaiting the latest version, TypeScript 5.3. This release promises to bring some excellent new features that will greatly enhance the language.

In this article, we’ll explore some of the most anticipated additions to TypeScript 5.3.

Import Attributes: Boosting Security 🛡️

import json from "./data.json" assert { type: "json" };

Import attributes, a TC39 proposal that reached stage 3, allow you to specify the type of the thing you’re importing.

You can use it with standard ESM imports, dynamic imports, re-export a module with a validated type or even instantiate a worker with a validated type.

The main goal here is security — ensuring you’re accessing a remote resource matching the actual MIME type. With this feature in TypeScript, potential security risks due to unexpected MIME types are mitigated.

Supporting Throw Expressions: Better Error Handling 🚀

const id = searchParams.has("id") ? 
searchParams.get("id") :
throw new Error("ID is required");

--

--

Bootcamp
Bootcamp

Published in Bootcamp

From idea to product, one lesson at a time. To submit your story: https://tinyurl.com/bootspub1

Abdelfattah Sekak
Abdelfattah Sekak

Write a response