-
-
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
fix: fixed missing types for ArraySupport plugin #1401
fix: fixed missing types for ArraySupport plugin #1401
Conversation
default: string | number | Date | Dayjs | ||
} | ||
|
||
export type ConfigType = ConfigTypeMap[keyof ConfigTypeMap] |
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.
what's this used for please? And will this affect the original type if the plugin is imported?
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.
@iamkun The type
keyword doesn't support declaration merging. And yes, it will add the plugin's type into ConfigType
.
ConfigTypeMap[keyof ConfigTypeMap]
basically means "merge every members' type into a union". If no plugin was imported, the type of ConfigType
is string | number | Date | Dayjs
(same as before). When the ArraySupport plugin was imported, ConfigType
will become string | number | Date | Dayjs | [year?: number, ...]
.
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.
looks cool, does this requires higher ts version?
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.
@iamkun Labeled tuple elements require TypeScript 4.0 or higher, I can convert it back to un-labelled ones if you want to support older TypeScript versions.
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.
that's what I'm concerned. We should have a fallback support at least ts 3 I think
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.
@iamkun It should work on TypeScript 3 now.
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.
can we make sure that ConfigTypeMap[keyof ConfigTypeMap]
works on ts3?
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.
can we make sure that
ConfigTypeMap[keyof ConfigTypeMap]
works on ts3?
@iamkun Yes, this will work on TypeScript 3. You can verify it on TypeScript playground.
THX |
## [1.10.5](v1.10.4...v1.10.5) (2021-05-26) ### Bug Fixes * add meridiem in ar locales ([#1375](#1375)) ([319f616](319f616)) * Added Zulu support to customParseFormat ([#1359](#1359)) ([1138a3f](1138a3f)) * fix Bengali [bn] locale monthsShort error ([a0e6c0c](a0e6c0c)) * fix missing types for ArraySupport plugin ([#1401](#1401)) ([b1abdc4](b1abdc4)) * fix Ukrainian [uk] locale ([#1463](#1463)) ([0fdac93](0fdac93)) * hotfix for `Duration` types ([#1357](#1357)) ([855b7b3](855b7b3)), closes [#1354](#1354) * timezone plugin DST error ([#1352](#1352)) ([71bed15](71bed15)) * Update duration plugin change string to number ([#1394](#1394)) ([e1546d1](e1546d1)) * update Duration plugin to support no-argument ([#1400](#1400)) ([8d9a5ae](8d9a5ae)) * Update Finnish [fi] locale to set yearStart ([#1378](#1378)) ([f3370bd](f3370bd)) * update Russian [ru] locale meridiem and unit tests ([#1403](#1403)) ([f10f39d](f10f39d)) * update Russian [ru] locale yearStart config ([#1372](#1372)) ([5052515](5052515)) * update Slovenian [sl] locale to set correct ordinal ([#1386](#1386)) ([cb4f746](cb4f746)) * update Spanish [es] locale to change month names to lowercase ([#1414](#1414)) ([9c20e77](9c20e77)) * update Swedish [sv] locale to set correct yearStart ([#1385](#1385)) ([66c5935](66c5935)) * update UTC plugin to support string argument like +HH:mm ([#1395](#1395)) ([656127c](656127c))
🎉 This PR is included in version 1.10.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [1.10.5](iamkun/dayjs@v1.10.4...v1.10.5) (2021-05-26) ### Bug Fixes * add meridiem in ar locales ([#1375](iamkun/dayjs#1375)) ([319f616](iamkun/dayjs@319f616)) * Added Zulu support to customParseFormat ([#1359](iamkun/dayjs#1359)) ([1138a3f](iamkun/dayjs@1138a3f)) * fix Bengali [bn] locale monthsShort error ([a0e6c0c](iamkun/dayjs@a0e6c0c)) * fix missing types for ArraySupport plugin ([#1401](iamkun/dayjs#1401)) ([b1abdc4](iamkun/dayjs@b1abdc4)) * fix Ukrainian [uk] locale ([#1463](iamkun/dayjs#1463)) ([0fdac93](iamkun/dayjs@0fdac93)) * hotfix for `Duration` types ([#1357](iamkun/dayjs#1357)) ([855b7b3](iamkun/dayjs@855b7b3)), closes [#1354](iamkun/dayjs#1354) * timezone plugin DST error ([#1352](iamkun/dayjs#1352)) ([71bed15](iamkun/dayjs@71bed15)) * Update duration plugin change string to number ([#1394](iamkun/dayjs#1394)) ([e1546d1](iamkun/dayjs@e1546d1)) * update Duration plugin to support no-argument ([#1400](iamkun/dayjs#1400)) ([8d9a5ae](iamkun/dayjs@8d9a5ae)) * Update Finnish [fi] locale to set yearStart ([#1378](iamkun/dayjs#1378)) ([f3370bd](iamkun/dayjs@f3370bd)) * update Russian [ru] locale meridiem and unit tests ([#1403](iamkun/dayjs#1403)) ([f10f39d](iamkun/dayjs@f10f39d)) * update Russian [ru] locale yearStart config ([#1372](iamkun/dayjs#1372)) ([5052515](iamkun/dayjs@5052515)) * update Slovenian [sl] locale to set correct ordinal ([#1386](iamkun/dayjs#1386)) ([cb4f746](iamkun/dayjs@cb4f746)) * update Spanish [es] locale to change month names to lowercase ([#1414](iamkun/dayjs#1414)) ([9c20e77](iamkun/dayjs@9c20e77)) * update Swedish [sv] locale to set correct yearStart ([#1385](iamkun/dayjs#1385)) ([66c5935](iamkun/dayjs@66c5935)) * update UTC plugin to support string argument like +HH:mm ([#1395](iamkun/dayjs#1395)) ([656127c](iamkun/dayjs@656127c))
## [1.10.5](iamkun/dayjs@v1.10.4...v1.10.5) (2021-05-26) ### Bug Fixes * add meridiem in ar locales ([#1375](iamkun/dayjs#1375)) ([319f616](iamkun/dayjs@319f616)) * Added Zulu support to customParseFormat ([#1359](iamkun/dayjs#1359)) ([1138a3f](iamkun/dayjs@1138a3f)) * fix Bengali [bn] locale monthsShort error ([a0e6c0c](iamkun/dayjs@a0e6c0c)) * fix missing types for ArraySupport plugin ([#1401](iamkun/dayjs#1401)) ([b1abdc4](iamkun/dayjs@b1abdc4)) * fix Ukrainian [uk] locale ([#1463](iamkun/dayjs#1463)) ([0fdac93](iamkun/dayjs@0fdac93)) * hotfix for `Duration` types ([#1357](iamkun/dayjs#1357)) ([855b7b3](iamkun/dayjs@855b7b3)), closes [#1354](iamkun/dayjs#1354) * timezone plugin DST error ([#1352](iamkun/dayjs#1352)) ([71bed15](iamkun/dayjs@71bed15)) * Update duration plugin change string to number ([#1394](iamkun/dayjs#1394)) ([e1546d1](iamkun/dayjs@e1546d1)) * update Duration plugin to support no-argument ([#1400](iamkun/dayjs#1400)) ([8d9a5ae](iamkun/dayjs@8d9a5ae)) * Update Finnish [fi] locale to set yearStart ([#1378](iamkun/dayjs#1378)) ([f3370bd](iamkun/dayjs@f3370bd)) * update Russian [ru] locale meridiem and unit tests ([#1403](iamkun/dayjs#1403)) ([f10f39d](iamkun/dayjs@f10f39d)) * update Russian [ru] locale yearStart config ([#1372](iamkun/dayjs#1372)) ([5052515](iamkun/dayjs@5052515)) * update Slovenian [sl] locale to set correct ordinal ([#1386](iamkun/dayjs#1386)) ([cb4f746](iamkun/dayjs@cb4f746)) * update Spanish [es] locale to change month names to lowercase ([#1414](iamkun/dayjs#1414)) ([9c20e77](iamkun/dayjs@9c20e77)) * update Swedish [sv] locale to set correct yearStart ([#1385](iamkun/dayjs#1385)) ([66c5935](iamkun/dayjs@66c5935)) * update UTC plugin to support string argument like +HH:mm ([#1395](iamkun/dayjs#1395)) ([656127c](iamkun/dayjs@656127c))
## [1.10.5](iamkun/dayjs@v1.10.4...v1.10.5) (2021-05-26) ### Bug Fixes * add meridiem in ar locales ([#1375](iamkun/dayjs#1375)) ([319f616](iamkun/dayjs@319f616)) * Added Zulu support to customParseFormat ([#1359](iamkun/dayjs#1359)) ([1138a3f](iamkun/dayjs@1138a3f)) * fix Bengali [bn] locale monthsShort error ([a0e6c0c](iamkun/dayjs@a0e6c0c)) * fix missing types for ArraySupport plugin ([#1401](iamkun/dayjs#1401)) ([b1abdc4](iamkun/dayjs@b1abdc4)) * fix Ukrainian [uk] locale ([#1463](iamkun/dayjs#1463)) ([0fdac93](iamkun/dayjs@0fdac93)) * hotfix for `Duration` types ([#1357](iamkun/dayjs#1357)) ([855b7b3](iamkun/dayjs@855b7b3)), closes [#1354](iamkun/dayjs#1354) * timezone plugin DST error ([#1352](iamkun/dayjs#1352)) ([71bed15](iamkun/dayjs@71bed15)) * Update duration plugin change string to number ([#1394](iamkun/dayjs#1394)) ([e1546d1](iamkun/dayjs@e1546d1)) * update Duration plugin to support no-argument ([#1400](iamkun/dayjs#1400)) ([8d9a5ae](iamkun/dayjs@8d9a5ae)) * Update Finnish [fi] locale to set yearStart ([#1378](iamkun/dayjs#1378)) ([f3370bd](iamkun/dayjs@f3370bd)) * update Russian [ru] locale meridiem and unit tests ([#1403](iamkun/dayjs#1403)) ([f10f39d](iamkun/dayjs@f10f39d)) * update Russian [ru] locale yearStart config ([#1372](iamkun/dayjs#1372)) ([5052515](iamkun/dayjs@5052515)) * update Slovenian [sl] locale to set correct ordinal ([#1386](iamkun/dayjs#1386)) ([cb4f746](iamkun/dayjs@cb4f746)) * update Spanish [es] locale to change month names to lowercase ([#1414](iamkun/dayjs#1414)) ([9c20e77](iamkun/dayjs@9c20e77)) * update Swedish [sv] locale to set correct yearStart ([#1385](iamkun/dayjs#1385)) ([66c5935](iamkun/dayjs@66c5935)) * update UTC plugin to support string argument like +HH:mm ([#1395](iamkun/dayjs#1395)) ([656127c](iamkun/dayjs@656127c))
I've added an interface called
ConfigTypeMap
, so other plugins could add their own types toConfigType
. The same fix could be applied to ObjectSupport in a future pull request.Fixes #1170