• This is a helper function to make sure a static type check is performed.

    It may be required in some cases where TypeScript or the IDE fails to check the type of the argument and/or results in complex type error.

    NOTE! IT DOES NOT PERFORM RUNTIME CHECKS.

    You can use it like this:

    interface Foo {
    name ?: string;
    age ?: number;
    }

    function createFoo (
    name ?: string,
    age ?: number
    ) : Foo {
    return {
    ...( name !== undefined ? staticCheckPartial<Foo>({name}) : {})
    ...( age !== undefined ? staticCheckPartial<Foo>({age}) : {})
    }
    }

    For example, this would end up as a static compile time error because there is no bar property:

      ...( age !== undefined ? staticCheckPartial<Foo>({bar: age}) : {})
    

    Returns

    The value which was provided as the argument untouched @PURE

    Nosideeffects

    Type Parameters

    • T

    Parameters

    • value: Partial<T>

      The value to return

    Returns Partial<T>

Generated using TypeDoc