Incorrect typing for `Event.originalStartTime`
mheavenor opened this issue · 2 comments
Describe the bug
The typing of the originalStartTime
property on the Event
model is typed as a number. The value, however, is an instance of a Date object.
To Reproduce
const idOfRecurringEvent = "some_id"
const event = await nylas.events.find(idOfRecurringEvent);
console.log(event.originalStartTime instanceof Date) // true even though event.originalStartTime is supposedly a 'number'
Expected behavior
The typing for originalStartTime
should be Date
as that is what the value is
SDK Version:
6.4.1
The codebase seems to still type originalStartTime
as a number as specified here: https://github.com/nylas/nylas-nodejs/blob/main/src/models/event.ts#L77
Thanks for opening this issue @mheavenor, we're taking a look and will post an update once we have one.
@mheavenor thanks for your patience! You're correct as it's a typing mismatch, however because replacing number
with Date
entirely would result in a breaking change, for now we're going to set the type as a union of those two types and will be released in the next update. Once v7.0 drops (in the works) we will ensure that this attribute will be corrected to just Date
. Sorry for the inconvenience, and thanks for bringing this to our attention!
Edit: After further testing, it always deserializes to Date
and never to number
so it's inherently broken, the change now will remove number
as the type and replace it with Date