jens-maus / node-ical

NodeJS class for parsing iCalendar/ICS files
Apache License 2.0
118 stars 50 forks source link

#313 Add unknown Tyoe #327

Closed theimo1221 closed 4 weeks ago

Apollon77 commented 1 month ago

hehe, same as #317 just different ... soooo @jens-maus any or unknown your decision gg

jens-maus commented 4 weeks ago

hehe, same as #317 just different ... soooo @jens-maus any or unknown your decision gg

Sorry, I am not an TS expert.. So what are the implications of any vs. unknown here?

theimo1221 commented 4 weeks ago

Hello Jens,

'Any' turns off type checking completely, thus increasing risks for bugs at usages, while 'unknown' enforces the developer to implement his own type checks (typeof) or cast's (as ...).

So in this case unknown is more stable until we add a specific definition/interface for those objects.

This might be an interesting article about the topic with some examples: https://rahuulmiishra.medium.com/typescripts-any-vs-unknown-vs-never-when-and-how-to-use-them-35d81ea57c01