-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
Previously, Typescript users had to install the optional dependencies for the types to be available. These have now been replaced with stub types so that the optional dependencies no longer need to be installed. close #405
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
import type {Moment} from 'moment'; | ||
import type {Moment as MomentTZ} from 'moment-timezone'; | ||
import type {Dayjs} from 'dayjs'; | ||
import type {DateTime as LuxonDateTime} from 'luxon'; | ||
|
||
|
||
/** | ||
* ical-generator supports [native Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date), | ||
* [moment.js](https://momentjs.com/) (and [moment-timezone](https://momentjs.com/timezone/), [Day.js](https://day.js.org/en/) and | ||
* [Luxon](https://moment.github.io/luxon/)'s [DateTime](https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html) | ||
* objects. You can also pass a string which is then passed to javascript's Date internally. | ||
*/ | ||
export type ICalDateTimeValue = Date | Moment | MomentTZ | Dayjs | LuxonDateTime | string; | ||
export type ICalDateTimeValue = Date | ICalMomentStub | ICalMomentTimezoneStub | ICalLuxonDateTimeStub | ICalDayJsStub | string; | ||
|
||
export interface ICalRepeatingOptions { | ||
freq: ICalEventRepeatingFreq; | ||
|
@@ -54,6 +48,49 @@ export interface ICalTimezone { | |
generator?: (timezone: string) => string|null; | ||
} | ||
|
||
export interface ICalMomentStub { | ||
_isAMomentObject: true; | ||
format(format?: string): string; | ||
clone(): ICalMomentStub; | ||
utc(): ICalMomentStub; | ||
toDate(): Date; | ||
isValid(): boolean; | ||
toJSON(): string; | ||
} | ||
|
||
export interface ICalMomentTimezoneStub extends ICalMomentStub { | ||
clone(): ICalMomentTimezoneStub; | ||
utc(): ICalMomentTimezoneStub; | ||
tz(): string | undefined; | ||
tz(timezone: string): ICalMomentTimezoneStub; | ||
} | ||
|
||
export interface ICalMomentDurationStub { | ||
asSeconds(): number; | ||
} | ||
|
||
export interface ICalLuxonDateTimeStub { | ||
setZone(zone?: string): ICalLuxonDateTimeStub; | ||
toFormat(fmt: string): string; | ||
toJSDate(): Date; | ||
get isValid(): boolean; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
sebbo2002
Author
Owner
|
||
toJSON(): string; | ||
} | ||
|
||
export interface ICalDayJsStub { | ||
tz(zone?: string): ICalDayJsStub; | ||
utc(): ICalDayJsStub; | ||
format(format?: string): string; | ||
toDate(): Date; | ||
isValid(): boolean; | ||
toJSON(): string; | ||
} | ||
|
||
export interface ICalRRuleStub { | ||
between(after: Date, before: Date, inc?: boolean, iterator?: (d: Date, len: number) => boolean): Date[]; | ||
toString(): string; | ||
} | ||
|
||
export enum ICalEventRepeatingFreq { | ||
SECONDLY = 'SECONDLY', | ||
MINUTELY = 'MINUTELY', | ||
|
I'm started to have a problem when installed a new version of adonis/mail, because yarn updated ical-generator to the last version and I could not avoid this. The error points to this line when I try to build the project, where if I remove this "get" the error is solved and the project seems to work correctly.. is this correct?