-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export function declarations from LocaleData Plugin #1116
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #1116 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 172 174 +2
Lines 1557 1619 +62
Branches 331 356 +25
=========================================
+ Hits 1557 1619 +62
Continue to review full report at Codecov.
|
types/plugin/localeData.d.ts
Outdated
@@ -6,5 +6,14 @@ export = plugin | |||
declare module 'dayjs' { | |||
interface Dayjs { | |||
localeData(): any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean under interface Dayjs?
If so, I think the exported functions should not sit under the interface since those functions are not instance methods of Dayjs.
Instead, those functions are like static, not binding to a class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can typescript knows that weekdaysMin is available on dayjs
like this dayjs.weekdaysMin()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, should we take dayjs().localeData().weekdays() into consideration as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right. I've added localeData types to both dayjs and Dayjs instances.
Now (dayjs or dayjs()).localeData() both have types.
Looks cool. Two minor suggestions:
Ref: https://github.com/iamkun/dayjs/blob/dev/src/plugin/localeData/index.js#L21 |
## [1.9.4](v1.9.3...v1.9.4) (2020-10-23) ### Bug Fixes * Add descriptions to types ([#1148](#1148)) ([9a407a1](9a407a1)) * add devHelper plugin ([#1163](#1163)) ([de49dc8](de49dc8)) * Fix Hungarian (hu) locale ([#1112](#1112)) ([ab13754](ab13754)) * fix minMax plugin parsing empty array bug ([#1062](#1062)) ([368108b](368108b)) * update adding/subtracting Duration from Dayjs object ([#1156](#1156)) ([f861aca](f861aca)) * update en-NZ locale to use proper ordinal formatting function ([#1143](#1143)) ([fcdbc58](fcdbc58)) * update localeData plugin type ([#1116](#1116)) ([ee5a4ec](ee5a4ec)) * update timezone plugin to support custom parse format ([#1160](#1160)) ([48cbf31](48cbf31)), closes [#1159](#1159) * update timezone plugin to support keepLocalTime ([#1161](#1161)) ([1d429e5](1d429e5)), closes [#1149](#1149)
🎉 This PR is included in version 1.9.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [1.9.4](iamkun/dayjs@v1.9.3...v1.9.4) (2020-10-23) ### Bug Fixes * Add descriptions to types ([#1148](iamkun/dayjs#1148)) ([9a407a1](iamkun/dayjs@9a407a1)) * add devHelper plugin ([#1163](iamkun/dayjs#1163)) ([de49dc8](iamkun/dayjs@de49dc8)) * Fix Hungarian (hu) locale ([#1112](iamkun/dayjs#1112)) ([ab13754](iamkun/dayjs@ab13754)) * fix minMax plugin parsing empty array bug ([#1062](iamkun/dayjs#1062)) ([368108b](iamkun/dayjs@368108b)) * update adding/subtracting Duration from Dayjs object ([#1156](iamkun/dayjs#1156)) ([f861aca](iamkun/dayjs@f861aca)) * update en-NZ locale to use proper ordinal formatting function ([#1143](iamkun/dayjs#1143)) ([fcdbc58](iamkun/dayjs@fcdbc58)) * update localeData plugin type ([#1116](iamkun/dayjs#1116)) ([ee5a4ec](iamkun/dayjs@ee5a4ec)) * update timezone plugin to support custom parse format ([#1160](iamkun/dayjs#1160)) ([48cbf31](iamkun/dayjs@48cbf31)), closes [#1159](iamkun/dayjs#1159) * update timezone plugin to support keepLocalTime ([#1161](iamkun/dayjs#1161)) ([1d429e5](iamkun/dayjs@1d429e5)), closes [#1149](iamkun/dayjs#1149)
## [1.9.4](iamkun/dayjs@v1.9.3...v1.9.4) (2020-10-23) ### Bug Fixes * Add descriptions to types ([#1148](iamkun/dayjs#1148)) ([9a407a1](iamkun/dayjs@9a407a1)) * add devHelper plugin ([#1163](iamkun/dayjs#1163)) ([de49dc8](iamkun/dayjs@de49dc8)) * Fix Hungarian (hu) locale ([#1112](iamkun/dayjs#1112)) ([ab13754](iamkun/dayjs@ab13754)) * fix minMax plugin parsing empty array bug ([#1062](iamkun/dayjs#1062)) ([368108b](iamkun/dayjs@368108b)) * update adding/subtracting Duration from Dayjs object ([#1156](iamkun/dayjs#1156)) ([f861aca](iamkun/dayjs@f861aca)) * update en-NZ locale to use proper ordinal formatting function ([#1143](iamkun/dayjs#1143)) ([fcdbc58](iamkun/dayjs@fcdbc58)) * update localeData plugin type ([#1116](iamkun/dayjs#1116)) ([ee5a4ec](iamkun/dayjs@ee5a4ec)) * update timezone plugin to support custom parse format ([#1160](iamkun/dayjs#1160)) ([48cbf31](iamkun/dayjs@48cbf31)), closes [#1159](iamkun/dayjs#1159) * update timezone plugin to support keepLocalTime ([#1161](iamkun/dayjs#1161)) ([1d429e5](iamkun/dayjs@1d429e5)), closes [#1149](iamkun/dayjs#1149)
## [1.9.4](iamkun/dayjs@v1.9.3...v1.9.4) (2020-10-23) ### Bug Fixes * Add descriptions to types ([#1148](iamkun/dayjs#1148)) ([9a407a1](iamkun/dayjs@9a407a1)) * add devHelper plugin ([#1163](iamkun/dayjs#1163)) ([de49dc8](iamkun/dayjs@de49dc8)) * Fix Hungarian (hu) locale ([#1112](iamkun/dayjs#1112)) ([ab13754](iamkun/dayjs@ab13754)) * fix minMax plugin parsing empty array bug ([#1062](iamkun/dayjs#1062)) ([368108b](iamkun/dayjs@368108b)) * update adding/subtracting Duration from Dayjs object ([#1156](iamkun/dayjs#1156)) ([f861aca](iamkun/dayjs@f861aca)) * update en-NZ locale to use proper ordinal formatting function ([#1143](iamkun/dayjs#1143)) ([fcdbc58](iamkun/dayjs@fcdbc58)) * update localeData plugin type ([#1116](iamkun/dayjs#1116)) ([ee5a4ec](iamkun/dayjs@ee5a4ec)) * update timezone plugin to support custom parse format ([#1160](iamkun/dayjs#1160)) ([48cbf31](iamkun/dayjs@48cbf31)), closes [#1159](iamkun/dayjs#1159) * update timezone plugin to support keepLocalTime ([#1161](iamkun/dayjs#1161)) ([1d429e5](iamkun/dayjs@1d429e5)), closes [#1149](iamkun/dayjs#1149)
No description provided.