mwbot-ts - v1.2.7
    Preparing search index...

    Type Alias PartiallyRequired<T, K>

    PartiallyRequired: Required<Pick<T, K>> & Omit<T, K>

    Utility type that makes a subset of properties in an object type required. Use this when certain properties in a generally optional object type are known to be present.

    For example, the linkshere property in the response from titles=Main_page&prop=linkshere&lhprop= will be an array of empty objects because lhprop= is left empty. However, specifying lhprop=pageid guarantees that each object will contain a pageid property. In such cases, you can do:

    import { PartiallyRequired, ApiResponseQueryPagesPropLinkshere } from 'mwbot-ts';
    type ApiResponseQueryPagesPropLinkshereVerified = PartiallyRequired<ApiResponseQueryPagesPropLinkshere, 'pageid'>;

    This creates a type where the pageid property is non-optional, without modifying the rest of the type.

    Type Parameters

    • T extends Record<string, any>

      The base object type.

    • K extends keyof T

      The keys of T to make required.