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
I've written a custom plugin that adds two methods to dayjs objects: displayShort and displayLong. It works great in JavaScript, but I get a TypeScript error when I call dayjs().displayShort() or dayjs().displayLong() because TypeScript doesn't know about those methods.
How can I solve this problem? I've looked at the type files for the plugins in this repo and tried to extrapolate from them, but if I add the following to a custom type file, I get more TypeScript errors because I seem to be effectively overwriting the Dayjs type rather than adding to it.
Hi,
I've written a custom plugin that adds two methods to dayjs objects:
displayShort
anddisplayLong
. It works great in JavaScript, but I get a TypeScript error when I calldayjs().displayShort()
ordayjs().displayLong()
because TypeScript doesn't know about those methods.How can I solve this problem? I've looked at the type files for the plugins in this repo and tried to extrapolate from them, but if I add the following to a custom type file, I get more TypeScript errors because I seem to be effectively overwriting the Dayjs type rather than adding to it.
My plugin looks like this:
Many thanks for any help, and for this excellent library!
The text was updated successfully, but these errors were encountered: