Skip to content
Typecustom-idv0.3.2

CustomIdShape

The fields of a customId, keyed by name.

Use it as a constraint when your own helper takes a definition and its params together. When the fields don't matter, use AnyCustomId.

type CustomIdShape = Record<
    string,
    CustomIdField<unknown>
>;
function label<Shape extends CustomIdShape>(id: CustomId<string, Shape>, params: DecodedParams<Shape>): string {
    return `${id.prefix} ${JSON.stringify(params)}`;
}