Búsqueda de sitios web

Extender archivo de definición de Typescript (.d.ts) cuando proviene de NPM


Extiendo el momento para gestionar los días festivos (basado en el calendario francés). Así que también amplío el archivo de definición de TypeScript, pero antes estaba usando tsd con /// <reference. Esto funcionaba bastante bien. El contenido de mi .d.ts:

/// <reference path="../moment/moment.d.ts" />

declare module moment {

  interface Moment {
    weekDays(date: Moment): number;
    weekendDays(date: Moment): number;
    addWeekDays(days: number): Moment;
    subtractWeekDays(days: number): Moment;
    isWeekDay(): boolean;
    isWeekendDay(): boolean;
  }

}

Ahora cambié a typings y referencié .d.ts en tsconfig.json. Uso la definición de moment de su paquete npm y mi .d.ts ya no funciona. Cambié a esto :

declare namespace moment {
    interface Moment {
        weekDays(date: Moment): number;
        weekendDays(date: Moment): number;
        addWeekDays(days: number): Moment;
        subtractWeekDays(days: number): Moment;
        isWeekDay(): boolean;
        isWeekendDay(): boolean;
    }
}

Pero esto no está funcionando, y luego intenté esto:

declare module 'moment' {
    interface Moment {
        weekDays(date: Moment): number;
        weekendDays(date: Moment): number;
        addWeekDays(days: number): Moment;
        subtractWeekDays(days: number): Moment;
        isWeekDay(): boolean;
        isWeekendDay(): boolean;
    }
}

Esto borra el archivo .d.ts del momento original...

¿Cómo puedo ampliar este archivo .d.ts?