Skip to main content
Version: 1.6.0

Aliasing

JsLIGO supports namespace aliases, that is, namespaces that work as synonyms of other (previously defined) namespaces. This feature can be useful if we implement a namespace using a previously defined one, but in the future, we might need to change it. For example, until 2025, the Bulgarian Lev is pegged to the euro currency:

namespace Euro {
export type t = nat;
export const add = (a: t, b: t) : t => a + b;
export const one: t = 1n;
export const two: t = 2n;
};
import Bulgarian_Lev = Euro;

Note the keyword import, even if the module Euro is defined in the same file (this might be a bit counter-intuitive, but this is the convention).