You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Types of property 'start' are incompatible.
Type 'number[]' is not assignable to type 'DateArray'.
Type 'number[]' is missing the following properties from type '[number, number, number]': 0, 1, 2
The problem is, when you're setting the event variable, you write the start property like so: const event = { start: [0, 0, 0, 0, 0] }
Typescript will see "start" as number[] which is correct because it inferred the type, it's an array of numbers. But the createEvent method expects an array with 5 numbers like [Number, Number, Number, Number, Number].
To resolve the issue you have to set the type of the event object to the EventAttributes: const event:ics.EventAttributes = { start: [0, 0, 0, 0, 0] }
This will make typescript not infer the type. As far as I'm aware this is the correct behavior from typescript.
While trying to build an example code:
const event = { start: [2018, 5, 30, 6, 30], duration: { hours: 6, minutes: 30 }, title: 'Bolder Boulder', description: 'Annual 10-kilometer run in Boulder, Colorado', location: 'Folsom Field, University of Colorado (finish line)', url: 'http://www.bolderboulder.com/', geo: { lat: 40.0095, lon: 105.2669 }, categories: ['10k races', 'Memorial Day Weekend', 'Boulder CO'], status: 'CONFIRMED', busyStatus: 'BUSY', organizer: { name: 'Admin', email: '[email protected]' }, attendees: [ { name: 'Adam Gibbons', email: '[email protected]', rsvp: true, partstat: 'ACCEPTED', role: 'REQ-PARTICIPANT' }, { name: 'Brittany Seaton', email: '[email protected]', dir: 'https://linkedin.com/in/brittanyseaton', role: 'OPT-PARTICIPANT' } ] }
I get the following error:
npm : 6.14.14
ics: 2.35.0
Same issue discussed in #138
The text was updated successfully, but these errors were encountered: