I'm creating an .ics feed Express app in typescript that returns all the events of a given user in my system. Right now it throws an error to the user when the user has no events, beacause the returned .ics file is invalid. I want to support returning no event such that you can subscribe to the .ics feed before you have any events and then it'll be ready and set up for when you do get events.
Unfortunately this is not possible to return a valid .ics file with no event. Well, technically you could have a valid .ics file without a vevent but then you'd need to have alarm, todo, timezone, ...
See: RFC 5545 section 3.6 which defines the format for *.ics files, specs that a valid calendar file should have at least one component: EVENT, TODO, TIMEZONE, ...
3.6. Calendar Components
The body of the iCalendar object consists of a sequence of
calendar properties and one or more calendar components .
[...]
component = 1*(eventc / todoc / journalc / freebusyc /
timezonec / iana-comp / x-comp)