PokéRogue
    Preparing search index...

    Function ensurePropertyIsObject

    • Ensure data.property exists and is a non-null object.

      If property does not exist on the object or is not a non-null object, it will be initialized to an empty object.

      Type Parameters

      • const T extends string

        The string literal type of the property

      Parameters

      • data: Record<string, unknown>

        The object to ensure has a specific property. Must be a non-null object.

      • property: StringLiteral<T>

        String literal of the property in question

      Returns asserts data is Record<string, unknown> & Record<T, Record<string, unknown>>