So here is the situation, I am using dayjs-recur plugin of dayjs in my project, but the tsc complains that it cannot find type declarations. So I resolved the issue using the following piece of code in dayjs-recur.d.ts:
declare module 'dayjs-recur' {
import { PluginFunc } from 'dayjs';
const defaultExport: PluginFunc<unknown>;
export = defaultExport;
}
Though it is not enough to satisfy the LSP, I must also augment dayjs namespace. By looking up typescript documentation I came up with the following snippet:
declare module 'dayjs-recur' {
import { Dayjs, PluginFunc } from 'dayjs';
interface RecurPlugin {
every(...args: any): RecurPlugin;
daysOfMonth(): RecurPlugin;
fromDate(date: any): RecurPlugin;
next(any: any): Dayjs;
all(): Dayjs[];
}
const defaultExport: PluginFunc<unknown>;
export = defaultExport;
namespace dayjs {
export function recur(...args: any): RecurPlugin;
}
}
But it doesn't seem to do anything. Any suggestions?