Working around unset "length" property on partial functions created with lodash's partialRight

There is no clean way to do this. You either have to opt out of typing or redeclare an interface of your own.

Typescript himself can't do this and just opt for the "good-enough" solution of declaring a bunch of different signatures:

Even if you somehow manage to manipulate the typescript interface, I doubt you could handle the other methods (zone, add, link, ...) which don't have a timezone parameter:

The best you can achieve is avoiding duplicating the whole interface using the Pick utility type:

type CurriedMomentTimezone = Pick<moment.MomentTimezone, 'zone' | 'add' | 'link' | 'load' | 'names' | 'guess' | 'setDefault'> & {
    (): moment.Moment;
    (date: number): moment.Moment;
    (date: number[]): moment.Moment;
    (date: string): moment.Moment;
    (date: string, format: moment.MomentFormatSpecification): moment.Moment;
    (date: string, format: moment.MomentFormatSpecification, strict: boolean): moment.Moment;
    (date: string, format: moment.MomentFormatSpecification, language: string): moment.Moment;
    (date: string, format: moment.MomentFormatSpecification, language: string, strict: boolean): moment.Moment;
    (date: Date): moment.Moment;
    (date: moment.Moment): moment.Moment;
    (date: any): moment.Moment;

localMoment = _.partialRight(, this.accountTimezone) as CurriedMomentTimezone;

These signatures make TypeScript happy:

const localMoment = (...args: any[]): moment.Moment =>, [...args, this.accountTimezone]);

const localMoment2 = _.partialRight(, this.accountTimezone) as (...args: any[]) => moment.Moment;


Since one signature accepts a parameter of any type, it's not much use to create a stricter type than any[] unless you create local overloads for every overload.