Incorrect typings for Reminder attributes
Closed this issue · 1 comments
Hey, love the project! I finally switched over to your library after having maintained my own version for years.
I know this issue is not your fault, since these typings are automatically generated from the docs, but though I'd flag it anyway.
notes
, dueDate
, and completionDate
can all be falsy, and are by default. You can confirm this by running the following code in Scriptable:
const r = new Reminder();
console.log(JSON.stringify({
notes: String(r.notes),
dueDate: String(r.dueDate),
completionDate: String(r.completionDate)
}, null, 2));
Which results in this:
{
"notes": "undefined",
"dueDate": "null",
"completionDate": "null"
}
But your package, and the Scriptable docs, show all those values as never being falsy.
I've fixed this in my own codebase w/ the following type declaration:
declare class AdjustedReminder extends Reminder {
notes?: string;
dueDate?: Date;
completionDate?: Date;
}
And then I just use AdjustedReminder
anywhere I'd otherwise use Reminder
(as a type).
Thank you for the contribution!
I've only just seen this now, otherwise I would have changed the types earlier. I've already made a few improvements from the automatically generated types since some are not accurate (e.g. XMLParser would be unusable because no parameter would be passed to the callback functions).