npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

remutable-ts

v0.0.2

Published

TypeScript utility to safely bypass readonly at compile-time with zero runtime overhead.

Readme

npm version

remutable-ts

remutable-ts provides a simple and type-safe way to remove readonly modifiers from types in TypeScript.

This is useful when you:

  • Need to mutate objects that are defined as readonly (e.g. libraries, framework types).
  • Prefer solutions with no runtime overhead.

⚡ Why not just remove readonly?

Keeping readonly by default is safer as it prevents unintended mutations. remutable-ts allows controlled mutation, even in external modules where needed, giving you flexibility without sacrificing type safety.

Installation

For usage as a devDependency with zero runtime:

npm install --save-dev remutable-ts

Usage

1. Make any type mutable

type Example = {
	readonly a: number;
	readonly b: string;
	readonly nested: {
		readonly c: boolean; // Note nested properties will remain readonly
	};
};

const example: Example = {
	a: 1,
	b: "hello",
	nested: {
		c: true
	},
};

// Inline example usage
(example as Mutable<Example>).a = 2; ✅ allowed now

// Using Mutable<T> to get a fully writable type
const writableExample = example as Mutable<Example>;

writableExample.a = 2; ✅ allowed now
writableExample.b = "world"; ✅ allowed now
// writableExample.nested.c = false; // Error: Cannot assign to 'c' because it remains a read-only property.

console.log("Original example:", example);
console.log("Writable example before mutation:", writableExample);

2. Using inside a class to get a writable view

// 
class MyClass {
	readonly x: number = 5; // Always apply type to literal values
	readonly name: string = "Alice"; // Always apply type to literal values

	update() {
		(this as Mutable<this>).x = 20;  ✅ allowed now

		// or using mutable helper function
		mutable(this).name = "Bob";  ✅ allowed now
	}
}

const myInstance = new MyClass();
console.log("Before update:", myInstance);
myInstance.update();
console.log("After update:", myInstance);

⚠️ Gotcha: literal types

When you initialize a readonly property with a literal value (e.g., readonly score = 0), TypeScript infers a literal type (0), not the broader type (number). This can cause assignment errors when using Mutable<T> or mutable<T>(), since you can't assign, say, 1 to a property of type 0.

Recommendation: Explicitly type such properties to avoid this issue:

const score: Mutable<{ readonly score: number }> = { score: 0 }; // ✅ Use an explicit type

This ensures Mutable<T> and mutable<T>() work as expected for assignments.

License

MIT