Interface CustomKindOptions<Properties, Specifics>

interface CustomKindOptions<
    Properties extends CustomTypeProperties,
    Specifics extends TypirSpecifics,
> {
    calculateTypeIdentifier?: (
        properties: CustomTypeInitialization<Properties, Specifics>,
    ) => string;
    calculateTypeName?: (
        properties: CustomTypeStorage<Properties, Specifics>,
    ) => string;
    calculateTypeUserRepresentation?: (
        properties: CustomTypeStorage<Properties, Specifics>,
    ) => string;
    getNewCustomTypeExplicitlyConvertibleToTypes?: (
        fromNewCustom: CustomType<Properties, Specifics>,
    ) => Type[];
    getNewCustomTypeImplicitlyConvertibleToTypes?: (
        fromNewCustom: CustomType<Properties, Specifics>,
    ) => Type[];
    getSubTypesOfNewCustomType?: (
        superNewCustom: CustomType<Properties, Specifics>,
    ) => Type[];
    getSuperTypesOfNewCustomType?: (
        subNewCustom: CustomType<Properties, Specifics>,
    ) => Type[];
    getTypesExplicitlyConvertibleToNewCustomType?: (
        toNewCustom: CustomType<Properties, Specifics>,
    ) => Type[];
    getTypesImplicitlyConvertibleToNewCustomType?: (
        toNewCustom: CustomType<Properties, Specifics>,
    ) => Type[];
    isNewCustomTypeConvertibleToType?: (
        fromNewCustom: CustomType<Properties, Specifics>,
        toOther: Type,
    ) => ConversionMode;
    isNewCustomTypeSubTypeOf?: (
        subNewCustom: CustomType<Properties, Specifics>,
        superOther: Type,
    ) => boolean;
    isNewCustomTypeSuperTypeOf?: (
        subOther: Type,
        superNewCustom: CustomType<Properties, Specifics>,
    ) => boolean;
    isTypeConvertibleToNewCustomType?: (
        fromOther: Type,
        toNewCustom: CustomType<Properties, Specifics>,
    ) => ConversionMode;
    name: string;
}

Type Parameters

Properties

calculateTypeIdentifier?: (
    properties: CustomTypeInitialization<Properties, Specifics>,
) => string

This identifier needs to consider all properties which make the custom type unique. The identifiers are used to detect unique custom types. The default implementation considers all properties and their structure in a straight-forward way, but does not guarantee unique identifiers in all cases in general, since string properties might contain values looking like identifiers of other properties. The default implementation can be customized in order to overcome this limitation or to produce better readable identifiers. It is the responsibility of the user of Typir to consider all relevant properties and their structure/nesting.

calculateTypeName?: (
    properties: CustomTypeStorage<Properties, Specifics>,
) => string

Define the name for each custom type; might be overridden by the custom type-specific name. If undefined, the identifier is used instead.

calculateTypeUserRepresentation?: (
    properties: CustomTypeStorage<Properties, Specifics>,
) => string

Define the user representation for each custom type; might be overridden by the custom type-specific user representation.

getNewCustomTypeExplicitlyConvertibleToTypes?: (
    fromNewCustom: CustomType<Properties, Specifics>,
) => Type[]
getNewCustomTypeImplicitlyConvertibleToTypes?: (
    fromNewCustom: CustomType<Properties, Specifics>,
) => Type[]
getSubTypesOfNewCustomType?: (
    superNewCustom: CustomType<Properties, Specifics>,
) => Type[]
getSuperTypesOfNewCustomType?: (
    subNewCustom: CustomType<Properties, Specifics>,
) => Type[]
getTypesExplicitlyConvertibleToNewCustomType?: (
    toNewCustom: CustomType<Properties, Specifics>,
) => Type[]
getTypesImplicitlyConvertibleToNewCustomType?: (
    toNewCustom: CustomType<Properties, Specifics>,
) => Type[]
isNewCustomTypeConvertibleToType?: (
    fromNewCustom: CustomType<Properties, Specifics>,
    toOther: Type,
) => ConversionMode
isNewCustomTypeSubTypeOf?: (
    subNewCustom: CustomType<Properties, Specifics>,
    superOther: Type,
) => boolean
isNewCustomTypeSuperTypeOf?: (
    subOther: Type,
    superNewCustom: CustomType<Properties, Specifics>,
) => boolean
isTypeConvertibleToNewCustomType?: (
    fromOther: Type,
    toNewCustom: CustomType<Properties, Specifics>,
) => ConversionMode
name: string

Name for this custom kind. The names of custom kinds are unique.