An identity type.

You can't do:

interface Foo extends typeof Bar {}

But you can do:

interface Foo extends Identity<typeof Bar> {}

Without this type you'd have to do:

interface FooType = typeof Bar;
interface Foo extends FooType {};

We have to do this a lot because we generate complex objects with detailed type information. When exported, TS (as of 5.2) inlines the type of these objects in declarations which makes our declarations massive. To avoid this we create an interface from the type then cast to the interface for export.

interface CommonRootEndpoint {
    behaviors: {
        index: typeof IndexBehavior;
        parts: typeof PartsBehavior;
    } & {
        index: typeof IndexBehavior;
        parts: typeof PartsBehavior;
    };
    defaults: StateOf<{
        index: typeof IndexBehavior;
        parts: typeof PartsBehavior;
    }>;
    deviceClass: DeviceClassification;
    deviceRevision: number;
    deviceType: DeviceTypeId;
    name: "RootNode";
    requirements: typeof RootRequirements;
    set(defaults: InputStateOf<{
        index: typeof IndexBehavior;
        parts: typeof PartsBehavior;
    }>): With<For<{
        behaviors: {
            index: typeof IndexBehavior;
            parts: typeof PartsBehavior;
        };
        deviceClass: DeviceClassification;
        deviceRevision: number;
        deviceType: DeviceTypeId;
        name: "RootNode";
        requirements: typeof RootRequirements;
    }>, {
        index: typeof IndexBehavior;
        parts: typeof PartsBehavior;
    }>;
    with<const BL>(...behaviors: BL): With<For<{
        behaviors: {
            index: typeof IndexBehavior;
            parts: typeof PartsBehavior;
        };
        deviceClass: DeviceClassification;
        deviceRevision: number;
        deviceType: DeviceTypeId;
        name: "RootNode";
        requirements: typeof RootRequirements;
    }>, With<{
        index: typeof IndexBehavior;
        parts: typeof PartsBehavior;
    }, BL>>;
}

Hierarchy (view full)

Properties

behaviors: {
    index: typeof IndexBehavior;
    parts: typeof PartsBehavior;
} & {
    index: typeof IndexBehavior;
    parts: typeof PartsBehavior;
}
defaults: StateOf<{
    index: typeof IndexBehavior;
    parts: typeof PartsBehavior;
}>

Access default state values.

deviceRevision: number
deviceType: DeviceTypeId
name
requirements: typeof RootRequirements

Methods

  • Define an endpoint like this one with different defaults. Only updates values present in the input object.

    Parameters

    Returns With<For<{
        behaviors: {
            index: typeof IndexBehavior;
            parts: typeof PartsBehavior;
        };
        deviceClass: DeviceClassification;
        deviceRevision: number;
        deviceType: DeviceTypeId;
        name: "RootNode";
        requirements: typeof RootRequirements;
    }>, {
        index: typeof IndexBehavior;
        parts: typeof PartsBehavior;
    }>

  • Define an endpoint like this one with additional and/or replacement server behaviors.

    Type Parameters

    • const BL extends List

    Parameters

    • Rest...behaviors: BL

    Returns With<For<{
        behaviors: {
            index: typeof IndexBehavior;
            parts: typeof PartsBehavior;
        };
        deviceClass: DeviceClassification;
        deviceRevision: number;
        deviceType: DeviceTypeId;
        name: "RootNode";
        requirements: typeof RootRequirements;
    }>, With<{
        index: typeof IndexBehavior;
        parts: typeof PartsBehavior;
    }, BL>>