peterbraden / ical.js

ical for javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recurrences is declared as an array and used as an object

boris-chernysh opened this issue · comments

Hello

Here is the creation of an array in the reccurrences field:

if (par[curr.uid].recurrences === undefined) {
    par[curr.uid].recurrences = new Array();
}

and here filling it with values:

if (typeof curr.recurrenceid.toISOString === 'function') {
    par[curr.uid].recurrences[curr.recurrenceid.toISOString().substring(0,10)] = recurrenceObj;
}

When using this field, the specifics of the array are not used. This is fine for javascript, but would be an error when using this field in typescript.

Error:

src/dependencies/calendars/ICal/utils.ts:87:46 - error TS7015: Element implicitly has an 'any' type because index 
expression is not of type 'number'.

87             const recurrence = event.recurrences?.[dateLookupKey]

The same goes for the exdate field.