Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong return type from RRule.fromString(...).options (bad null values in ParsedOptions) #638

Open
ghost opened this issue Sep 13, 2024 · 0 comments

Comments

@ghost
Copy link

ghost commented Sep 13, 2024

We use the following: RRule.fromString(ruleString) with ruleString = 'DTSTART:19760101T000000 FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"'

The TS types claim that the returntype of the options field is a ParsedOptions:

rrule/src/types.ts

Lines 59 to 72 in 9f2061f

export interface ParsedOptions extends Options {
dtstart: Date
wkst: number
bysetpos: number[]
bymonth: number[]
bymonthday: number[]
bynmonthday: number[]
byyearday: number[]
byweekno: number[]
byweekday: number[]
byhour: number[]
byminute: number[]
bysecond: number[]
}

However, a handful of these fields will be null which isn't allowed by the typing.
This trips our linter (eslint).


In our case, these fields are problematic (null, but not typed as such):

  • bysetpos
  • bymonth
  • byyearday
  • byweekno
  • byweekday

But other fields are likely also affected by other rrules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants