As the name suggest, this allow us to remap existing state, decorate, model, derive to anything we like to prevent name collision, or just wanting to rename a property.

By providing a function as a first parameters, the callback will accept current value, allowing us to remap the value to anything we like.

new Teasim()
    a: "a",
    b: "b",
  // Exclude b state
  .state(({ b, }) => rest);

This is useful when you have to deal with a plugin that has some duplicate name, allowing you to remap the name of the plugin:

new Teasim().use(
  plugin.decorate(({ logger, }) => ({
    pluginLogger: logger,,

Remap function can be use with state, decorate, model, derive to helps you define a correct property name and preventing name collision.


The provide a smoother experience, some plugins might have a lot of property value which can be overwhelming to remap one-by-one.

The Affix function which consists of prefix and suffix, allowing us to remap all property of an instance.

const setup = new Teasim({ name: "setup" }).decorate({
  argon: "a",
  boron: "b",
  carbon: "c",

const app = new Teasim().use(setup.prefix("decorator", "setup")).get("/", ({ setupCarbon }) => setupCarbon);

Allowing us to bulk remap a property of the plugin effortlessly, preventing the name collision of the plugin.

By default, affix will handle both runtime, type-level code automatically, remapping the property to camelCase as naming convention.

In some condition, you can also remap all property of the plugin:

const app = new Teasim().use(setup.prefix("all", "setup")).get("/", ({ setupCarbon }) => setupCarbon);