Skip to content

Martin Gregersen

  • Home
  • About Martin

Enabling ESM with TS, without the headaches

  • Post author By Martin Aarhus Gregersen
  • Post date June 14, 2023
  • Categories In Typescript

This post was written from an optimistic standpoint, enabling ESM and TS on a new project, making it a straight forward thing to do.If you’re migrating an existing codebase, see my recent article on that topic right here, as that’s a much harder thing to do. Are you wanting to get on the latest trend […]

How to properly use a .d.ts files

  • Post author By Martin Aarhus Gregersen
  • Post date May 22, 2023
  • Categories In Typescript

If you’ve ever need a global type to be available or perhaps already have a few, then There are several cases in Node where we may want to extend interfaces, a common such example is when using the library passport that often recommends appending a user object to our express Request object. Using Typescript, this […]

Taking the ‘Patch’ Out of Monkeypatching: Adding Properties in TypeScript

  • Post author By Martin Aarhus Gregersen
  • Post date May 13, 2023
  • Categories In Typescript

Let’s dive in. It’s a common scenario. You’re coding away in TypeScript, enjoying the safety net of static types. Then, you hit a snag. You need to attach a new property to an existing object, and TypeScript, in all its type-safe glory, is telling you, “Nope, sorry, that’s not going to happen.” In your case, […]

How to fix “Uncaught ReferenceError: process is not defined” error

  • Post author By Martin Aarhus Gregersen
  • Post date May 8, 2023
  • Categories In Typescript

Updated November 5th, 2025 Ever run into this dreaded issue when working with Javascript or – preferably – Typescript?Nothing is more frustrating than happily coding away, deciding you want to increase the security abstraction layer a bit – or perhaps you subscribe to the 12 Factor App – only to get met with this error. […]

The dreaded JS-to-TS Migration: Partial progress or full migration?

  • Post author By Martin Aarhus Gregersen
  • Post date May 1, 2023
  • Categories In Typescript

I write a lot about Typescript. I write a lot about why I think it’s better than Javascript. And perhaps I’ve convinced you too! Maybe you want to start converting some JS projects to TS and see what the fuzz is all about. The only thing blocking you is… How the hell do I get […]

Why pure functions are just better in TS

  • Post author By Martin Aarhus Gregersen
  • Post date April 23, 2023
  • Categories In Typescript

When writing code in TS there are various design choices and patterns that we use, some occurring on purpose and others just happening with little or no thought. One such example is “pure functions” a concept from Javascript that is in my opinion, even more important in Typescript. Pure functions are a simple concept that […]

TS Debugging that doesn’t suck

  • Post author By Martin Aarhus Gregersen
  • Post date April 11, 2023
  • Categories In Typescript
  • No Comments on TS Debugging that doesn’t suck

Unfortunately, at some point or another you are going to create a bug in your system. The larger it grows the more likely it is that you will create that bug. Or an exception! Lean more on how to deal with those here. So what do we do about it? Well, we need to arm […]

How to handle exceptions in Typescript

  • Post author By Martin Aarhus Gregersen
  • Post date March 29, 2023
  • Categories In Typescript

In Typescript, exceptions can be a bit weird. This is especially true if you’re writing library code or a VSCode plugin. Because almost surely you’ll want to output nice and custom error messages to the end user. Typescript doesn’t allow for a try/catch block to catch type errors, like it would for runtime errors. So […]

Switching from JS to TS as an experienced programmer

  • Post author By Martin Aarhus Gregersen
  • Post date March 18, 2023
  • Categories In Typescript

Few programmers start their journey with Typescript. There’s a wide variety of languages we could start with and while it isn’t all that important, a common denominator despite how we learn the web, is Javascript. Most developers encounter javascript at some point or another, as part of making their websites interactive, adding a little bit […]

3 libraries for how to best setup Typescript compilation with Javascript rerendering

  • Post author By Martin Aarhus Gregersen
  • Post date March 1, 2023
  • Categories In Typescript

This post was updated in May 2024, to include a new contender with fewer tools as a potential winner as my personal preference. For Javascript, we are lucky to have an extremely popular library titled nodemon. For Typescript, we’re not quite as lucky. But we do have a few options! In this short article, I’ll […]

Posts pagination

← Newer Posts 1 2 3 4 5 Older Posts →
  • Open Facebook in a new tab
  • Open X in a new tab
  • Open LinkedIn in a new tab
  • Open GitHub in a new tab
© 2026  Martin Aarhus Gregersen Privacy Policy