From 140fa0c180b434a1693d1021fee01807659c8174 Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 30 Aug 2021 20:10:14 +0800 Subject: [PATCH] chore: improve withInstall typing (#9354) * chore: improve withInstall typing * chore: upd * fix: missing entry --- src/action-bar-button/index.ts | 4 +--- src/action-bar-icon/index.ts | 4 +--- src/action-bar/index.ts | 4 +--- src/action-sheet/index.ts | 4 +--- src/address-edit/index.ts | 4 +--- src/address-list/index.ts | 4 +--- src/area/index.ts | 4 +--- src/badge/index.ts | 4 +--- src/button/index.ts | 4 +--- src/calendar/index.ts | 4 +--- src/card/index.ts | 4 +--- src/cascader/index.ts | 4 +--- src/cell-group/index.ts | 4 +--- src/cell/index.ts | 4 +--- src/checkbox-group/index.ts | 4 +--- src/checkbox/index.ts | 4 +--- src/circle/index.ts | 4 +--- src/col/index.ts | 4 +--- src/collapse-item/index.ts | 4 +--- src/collapse/index.ts | 4 +--- src/config-provider/index.ts | 4 +--- src/contact-card/index.ts | 4 +--- src/contact-edit/index.ts | 4 +--- src/contact-list/index.ts | 4 +--- src/count-down/index.ts | 4 +--- src/coupon-cell/index.ts | 4 +--- src/coupon-list/index.ts | 4 +--- src/coupon/index.ts | 4 +--- src/datetime-picker/index.ts | 4 +--- src/dialog/function-call.tsx | 6 +++--- src/divider/index.ts | 4 +--- src/dropdown-item/index.ts | 4 +--- src/dropdown-menu/index.ts | 4 +--- src/empty/index.ts | 4 +--- src/field/index.ts | 4 +--- src/form/index.ts | 4 +--- src/grid-item/index.ts | 4 +--- src/grid/index.ts | 4 +--- src/icon/index.ts | 4 +--- src/image-preview/function-call.tsx | 4 ++-- src/image/index.ts | 4 +--- src/index-anchor/index.ts | 4 +--- src/index-bar/index.ts | 4 +--- src/list/index.ts | 4 +--- src/loading/index.ts | 4 +--- src/locale/index.ts | 3 +-- src/nav-bar/index.ts | 4 +--- src/notice-bar/index.ts | 4 +--- src/notify/function-call.tsx | 6 +++--- src/number-keyboard/index.ts | 4 +--- src/overlay/index.ts | 4 +--- src/pagination/index.ts | 4 +--- src/password-input/index.ts | 4 +--- src/picker/index.ts | 4 +--- src/popover/index.ts | 4 +--- src/popup/index.ts | 4 +--- src/progress/index.ts | 4 +--- src/pull-refresh/index.ts | 4 +--- src/radio-group/index.ts | 4 +--- src/radio/index.ts | 4 +--- src/rate/index.ts | 4 +--- src/row/index.ts | 4 +--- src/search/index.ts | 4 +--- src/share-sheet/index.ts | 4 +--- src/sidebar-item/index.ts | 4 +--- src/sidebar/index.ts | 4 +--- src/skeleton/index.ts | 4 +--- src/slider/index.ts | 4 +--- src/step/index.ts | 4 +--- src/stepper/index.ts | 4 +--- src/steps/index.ts | 4 +--- src/sticky/index.ts | 4 +--- src/submit-bar/index.ts | 4 +--- src/swipe-cell/index.ts | 4 +--- src/swipe-item/index.ts | 4 +--- src/swipe/index.ts | 4 +--- src/switch/index.ts | 4 +--- src/tab/index.ts | 4 +--- src/tabbar-item/index.ts | 4 +--- src/tabbar/index.ts | 4 +--- src/tabs/index.ts | 4 +--- src/tag/index.ts | 4 +--- src/toast/function-call.tsx | 2 +- src/tree-select/index.ts | 4 +--- src/uploader/index.ts | 4 +--- src/utils/with-install.ts | 5 ++--- 86 files changed, 92 insertions(+), 254 deletions(-) diff --git a/src/action-bar-button/index.ts b/src/action-bar-button/index.ts index 697582b93..9637fbc9b 100644 --- a/src/action-bar-button/index.ts +++ b/src/action-bar-button/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _ActionBarButton from './ActionBarButton'; -const ActionBarButton = withInstall(_ActionBarButton); - +export const ActionBarButton = withInstall(_ActionBarButton); export default ActionBarButton; -export { ActionBarButton }; diff --git a/src/action-bar-icon/index.ts b/src/action-bar-icon/index.ts index 4daa9aaaf..4fcade600 100644 --- a/src/action-bar-icon/index.ts +++ b/src/action-bar-icon/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _ActionBarIcon from './ActionBarIcon'; -const ActionBarIcon = withInstall(_ActionBarIcon); - +export const ActionBarIcon = withInstall(_ActionBarIcon); export default ActionBarIcon; -export { ActionBarIcon }; diff --git a/src/action-bar/index.ts b/src/action-bar/index.ts index 46d08c53e..e358d2730 100644 --- a/src/action-bar/index.ts +++ b/src/action-bar/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _ActionBar from './ActionBar'; -const ActionBar = withInstall(_ActionBar); - +export const ActionBar = withInstall(_ActionBar); export default ActionBar; -export { ActionBar }; diff --git a/src/action-sheet/index.ts b/src/action-sheet/index.ts index 12abb6c7f..70db81753 100644 --- a/src/action-sheet/index.ts +++ b/src/action-sheet/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _ActionSheet from './ActionSheet'; -const ActionSheet = withInstall(_ActionSheet); - +export const ActionSheet = withInstall(_ActionSheet); export default ActionSheet; -export { ActionSheet }; export type { ActionSheetAction } from './ActionSheet'; diff --git a/src/address-edit/index.ts b/src/address-edit/index.ts index eb8df5185..7eebd3e36 100644 --- a/src/address-edit/index.ts +++ b/src/address-edit/index.ts @@ -1,10 +1,8 @@ import { withInstall } from '../utils'; import _AddressEdit from './AddressEdit'; -const AddressEdit = withInstall(_AddressEdit); - +export const AddressEdit = withInstall(_AddressEdit); export default AddressEdit; -export { AddressEdit }; export type { AddressEditInfo, AddressEditInstance, diff --git a/src/address-list/index.ts b/src/address-list/index.ts index 5167b65fe..59e33076f 100644 --- a/src/address-list/index.ts +++ b/src/address-list/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _AddressList from './AddressList'; -const AddressList = withInstall(_AddressList); - +export const AddressList = withInstall(_AddressList); export default AddressList; -export { AddressList }; export type { AddressListAddress } from './AddressListItem'; diff --git a/src/area/index.ts b/src/area/index.ts index 01266b9f7..1467a7eaa 100644 --- a/src/area/index.ts +++ b/src/area/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Area from './Area'; -const Area = withInstall(_Area); - +export const Area = withInstall(_Area); export default Area; -export { Area }; export type { AreaList, AreaInstance, AreaColumnOption } from './types'; diff --git a/src/badge/index.ts b/src/badge/index.ts index 78fcc048b..bb87fb058 100644 --- a/src/badge/index.ts +++ b/src/badge/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Badge from './Badge'; -const Badge = withInstall(_Badge); - +export const Badge = withInstall(_Badge); export default Badge; -export { Badge }; diff --git a/src/button/index.ts b/src/button/index.ts index 1613c52a1..08bbc2763 100644 --- a/src/button/index.ts +++ b/src/button/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Button from './Button'; -const Button = withInstall(_Button); - +export const Button = withInstall(_Button); export default Button; -export { Button }; export type { ButtonType, ButtonSize } from './Button'; diff --git a/src/calendar/index.ts b/src/calendar/index.ts index 9b449c887..25dd1cc69 100644 --- a/src/calendar/index.ts +++ b/src/calendar/index.ts @@ -1,10 +1,8 @@ import { withInstall } from '../utils'; import _Calendar from './Calendar'; -const Calendar = withInstall(_Calendar); - +export const Calendar = withInstall(_Calendar); export default Calendar; -export { Calendar }; export type { CalendarType, CalendarDayItem, diff --git a/src/card/index.ts b/src/card/index.ts index 0ee865244..083e93dd2 100644 --- a/src/card/index.ts +++ b/src/card/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Card from './Card'; -const Card = withInstall(_Card); - +export const Card = withInstall(_Card); export default Card; -export { Card }; diff --git a/src/cascader/index.ts b/src/cascader/index.ts index 3b0c72cf2..f3dd32d3b 100644 --- a/src/cascader/index.ts +++ b/src/cascader/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Cascader from './Cascader'; -const Cascader = withInstall(_Cascader); - +export const Cascader = withInstall(_Cascader); export default Cascader; -export { Cascader }; export type { CascaderOption, CascaderFieldNames } from './Cascader'; diff --git a/src/cell-group/index.ts b/src/cell-group/index.ts index cc4e68d96..11f41cdd4 100644 --- a/src/cell-group/index.ts +++ b/src/cell-group/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _CellGroup from './CellGroup'; -const CellGroup = withInstall(_CellGroup); - +export const CellGroup = withInstall(_CellGroup); export default CellGroup; -export { CellGroup }; diff --git a/src/cell/index.ts b/src/cell/index.ts index 973a1faf6..06aaca0f8 100644 --- a/src/cell/index.ts +++ b/src/cell/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Cell from './Cell'; -const Cell = withInstall(_Cell); - +export const Cell = withInstall(_Cell); export default Cell; -export { Cell }; export type { CellArrowDirection } from './Cell'; diff --git a/src/checkbox-group/index.ts b/src/checkbox-group/index.ts index b6a430c8f..7e8a9f62b 100644 --- a/src/checkbox-group/index.ts +++ b/src/checkbox-group/index.ts @@ -1,10 +1,8 @@ import { withInstall } from '../utils'; import _CheckboxGroup from './CheckboxGroup'; -const CheckboxGroup = withInstall(_CheckboxGroup); - +export const CheckboxGroup = withInstall(_CheckboxGroup); export default CheckboxGroup; -export { CheckboxGroup }; export type { CheckboxGroupInstance, CheckboxGroupToggleAllOptions, diff --git a/src/checkbox/index.ts b/src/checkbox/index.ts index d77fafb12..d67f58ab9 100644 --- a/src/checkbox/index.ts +++ b/src/checkbox/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Checkbox from './Checkbox'; -const Checkbox = withInstall(_Checkbox); - +export const Checkbox = withInstall(_Checkbox); export default Checkbox; -export { Checkbox }; export type { CheckboxInstance } from './types'; diff --git a/src/circle/index.ts b/src/circle/index.ts index 58961c497..ccd48099b 100644 --- a/src/circle/index.ts +++ b/src/circle/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Circle from './Circle'; -const Circle = withInstall(_Circle); - +export const Circle = withInstall(_Circle); export default Circle; -export { Circle }; export type { CircleStartPosition } from './Circle'; diff --git a/src/col/index.ts b/src/col/index.ts index 8b7557067..d2e575434 100644 --- a/src/col/index.ts +++ b/src/col/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Col from './Col'; -const Col = withInstall(_Col); - +export const Col = withInstall(_Col); export default Col; -export { Col }; diff --git a/src/collapse-item/index.ts b/src/collapse-item/index.ts index f873c2e44..b2f0aefa1 100644 --- a/src/collapse-item/index.ts +++ b/src/collapse-item/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _CollapseItem from './CollapseItem'; -const CollapseItem = withInstall(_CollapseItem); - +export const CollapseItem = withInstall(_CollapseItem); export default CollapseItem; -export { CollapseItem }; export type { CollapseItemInstance } from './types'; diff --git a/src/collapse/index.ts b/src/collapse/index.ts index 3e2123981..61e73c551 100644 --- a/src/collapse/index.ts +++ b/src/collapse/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Collapse from './Collapse'; -const Collapse = withInstall(_Collapse); - +export const Collapse = withInstall(_Collapse); export default Collapse; -export { Collapse }; diff --git a/src/config-provider/index.ts b/src/config-provider/index.ts index 345ac3689..25e772174 100644 --- a/src/config-provider/index.ts +++ b/src/config-provider/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _ConfigProvider from './ConfigProvider'; -const ConfigProvider = withInstall(_ConfigProvider); - +export const ConfigProvider = withInstall(_ConfigProvider); export default ConfigProvider; -export { ConfigProvider }; diff --git a/src/contact-card/index.ts b/src/contact-card/index.ts index 87817f5e0..357b53ffe 100644 --- a/src/contact-card/index.ts +++ b/src/contact-card/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _ContactCard from './ContactCard'; -const ContactCard = withInstall(_ContactCard); - +export const ContactCard = withInstall(_ContactCard); export default ContactCard; -export { ContactCard }; export type { ContactCardType } from './ContactCard'; diff --git a/src/contact-edit/index.ts b/src/contact-edit/index.ts index 5200f3679..147bbfe23 100644 --- a/src/contact-edit/index.ts +++ b/src/contact-edit/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _ContactEdit from './ContactEdit'; -const ContactEdit = withInstall(_ContactEdit); - +export const ContactEdit = withInstall(_ContactEdit); export default ContactEdit; -export { ContactEdit }; export type { ContactEditInfo } from './ContactEdit'; diff --git a/src/contact-list/index.ts b/src/contact-list/index.ts index 15cf4233f..3aefb31c2 100644 --- a/src/contact-list/index.ts +++ b/src/contact-list/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _ContactList from './ContactList'; -const ContactList = withInstall(_ContactList); - +export const ContactList = withInstall(_ContactList); export default ContactList; -export { ContactList }; export type { ContactListItem } from './ContactList'; diff --git a/src/count-down/index.ts b/src/count-down/index.ts index 006543bb2..616f70471 100644 --- a/src/count-down/index.ts +++ b/src/count-down/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _CountDown from './CountDown'; -const CountDown = withInstall(_CountDown); - +export const CountDown = withInstall(_CountDown); export default CountDown; -export { CountDown }; export type { CountDownInstance, CountDownCurrentTime } from './CountDown'; diff --git a/src/coupon-cell/index.ts b/src/coupon-cell/index.ts index ab8ea34be..e7cb34093 100644 --- a/src/coupon-cell/index.ts +++ b/src/coupon-cell/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _CouponCell from './CouponCell'; -const CouponCell = withInstall(_CouponCell); - +export const CouponCell = withInstall(_CouponCell); export default CouponCell; -export { CouponCell }; diff --git a/src/coupon-list/index.ts b/src/coupon-list/index.ts index f5deddfa9..1123067d7 100644 --- a/src/coupon-list/index.ts +++ b/src/coupon-list/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _CouponList from './CouponList'; -const CouponList = withInstall(_CouponList); - +export const CouponList = withInstall(_CouponList); export default CouponList; -export { CouponList }; diff --git a/src/coupon/index.ts b/src/coupon/index.ts index 4ce22de3f..ceb407972 100644 --- a/src/coupon/index.ts +++ b/src/coupon/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Coupon from './Coupon'; -const Coupon = withInstall(_Coupon); - +export const Coupon = withInstall(_Coupon); export default Coupon; -export { Coupon }; export type { CouponInfo } from './Coupon'; diff --git a/src/datetime-picker/index.ts b/src/datetime-picker/index.ts index ff032b559..4befcf976 100644 --- a/src/datetime-picker/index.ts +++ b/src/datetime-picker/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _DatetimePicker from './DatetimePicker'; -const DatetimePicker = withInstall(_DatetimePicker); - +export const DatetimePicker = withInstall(_DatetimePicker); export default DatetimePicker; -export { DatetimePicker }; export type { DatetimePickerType, DatetimePickerInstance } from './types'; diff --git a/src/dialog/function-call.tsx b/src/dialog/function-call.tsx index 7940ce680..5804b1c63 100644 --- a/src/dialog/function-call.tsx +++ b/src/dialog/function-call.tsx @@ -120,11 +120,11 @@ Dialog.resetDefaultOptions = () => { Dialog.currentOptions = extend({}, Dialog.defaultOptions); }; +Dialog.Component = withInstall(VanDialog); + Dialog.install = (app: App) => { - app.use(withInstall(VanDialog)); + app.use(Dialog.Component); app.config.globalProperties.$dialog = Dialog; }; -Dialog.Component = withInstall(VanDialog); - export { Dialog }; diff --git a/src/divider/index.ts b/src/divider/index.ts index 1309d44a9..c8afa11b7 100644 --- a/src/divider/index.ts +++ b/src/divider/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Divider from './Divider'; -const Divider = withInstall(_Divider); - +export const Divider = withInstall(_Divider); export default Divider; -export { Divider }; export type { DividerContentPosition } from './Divider'; diff --git a/src/dropdown-item/index.ts b/src/dropdown-item/index.ts index 2c9fb6f90..994cca3a6 100644 --- a/src/dropdown-item/index.ts +++ b/src/dropdown-item/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _DropdownItem from './DropdownItem'; -const DropdownItem = withInstall(_DropdownItem); - +export const DropdownItem = withInstall(_DropdownItem); export default DropdownItem; -export { DropdownItem }; export type { DropdownItemInstance, DropdownItemOption } from './types'; diff --git a/src/dropdown-menu/index.ts b/src/dropdown-menu/index.ts index db2ab02a5..7679172d3 100644 --- a/src/dropdown-menu/index.ts +++ b/src/dropdown-menu/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _DropdownMenu from './DropdownMenu'; -const DropdownMenu = withInstall(_DropdownMenu); - +export const DropdownMenu = withInstall(_DropdownMenu); export default DropdownMenu; -export { DropdownMenu }; export type { DropdownMenuDirection } from './types'; diff --git a/src/empty/index.ts b/src/empty/index.ts index c13ec866b..39dd44370 100644 --- a/src/empty/index.ts +++ b/src/empty/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Empty from './Empty'; -const Empty = withInstall(_Empty); - +export const Empty = withInstall(_Empty); export default Empty; -export { Empty }; diff --git a/src/field/index.ts b/src/field/index.ts index fdd0e84c9..ae188d789 100644 --- a/src/field/index.ts +++ b/src/field/index.ts @@ -1,10 +1,8 @@ import { withInstall } from '../utils'; import _Field from './Field'; -const Field = withInstall(_Field); - +export const Field = withInstall(_Field); export default Field; -export { Field }; export type { FieldType, FieldRule, diff --git a/src/form/index.ts b/src/form/index.ts index e99d0ccc7..07b77bfcf 100644 --- a/src/form/index.ts +++ b/src/form/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Form from './Form'; -const Form = withInstall(_Form); - +export const Form = withInstall(_Form); export default Form; -export { Form }; export type { FormInstance } from './types'; diff --git a/src/grid-item/index.ts b/src/grid-item/index.ts index c18facb37..3df247a9f 100644 --- a/src/grid-item/index.ts +++ b/src/grid-item/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _GridItem from './GridItem'; -const GridItem = withInstall(_GridItem); - +export const GridItem = withInstall(_GridItem); export default GridItem; -export { GridItem }; diff --git a/src/grid/index.ts b/src/grid/index.ts index 18c14c556..d8d4e076d 100644 --- a/src/grid/index.ts +++ b/src/grid/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Grid from './Grid'; -const Grid = withInstall(_Grid); - +export const Grid = withInstall(_Grid); export default Grid; -export { Grid }; export type { GridDirection } from './Grid'; diff --git a/src/icon/index.ts b/src/icon/index.ts index a30d8d6ec..55405ef9d 100644 --- a/src/icon/index.ts +++ b/src/icon/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Icon from './Icon'; -const Icon = withInstall(_Icon); - +export const Icon = withInstall(_Icon); export default Icon; -export { Icon }; diff --git a/src/image-preview/function-call.tsx b/src/image-preview/function-call.tsx index 09be97df1..c3d6515b6 100644 --- a/src/image-preview/function-call.tsx +++ b/src/image-preview/function-call.tsx @@ -70,10 +70,10 @@ const ImagePreview = ( return instance; }; -ImagePreview.Component = withInstall(VanImagePreview); +ImagePreview.Component = withInstall(VanImagePreview); ImagePreview.install = (app: App) => { - app.use(withInstall(VanImagePreview)); + app.use(ImagePreview.Component); }; export { ImagePreview }; diff --git a/src/image/index.ts b/src/image/index.ts index 9aacacebc..3a8917f8d 100644 --- a/src/image/index.ts +++ b/src/image/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Image from './Image'; -const Image = withInstall(_Image); - +export const Image = withInstall(_Image); export default Image; -export { Image }; export type { ImageFit } from './Image'; diff --git a/src/index-anchor/index.ts b/src/index-anchor/index.ts index ef961de7c..864974bb3 100644 --- a/src/index-anchor/index.ts +++ b/src/index-anchor/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _IndexAnchor from './IndexAnchor'; -const IndexAnchor = withInstall(_IndexAnchor); - +export const IndexAnchor = withInstall(_IndexAnchor); export default IndexAnchor; -export { IndexAnchor }; diff --git a/src/index-bar/index.ts b/src/index-bar/index.ts index a7fba0bb0..21bb411e6 100644 --- a/src/index-bar/index.ts +++ b/src/index-bar/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _IndexBar from './IndexBar'; -const IndexBar = withInstall(_IndexBar); - +export const IndexBar = withInstall(_IndexBar); export default IndexBar; -export { IndexBar }; export type { IndexBarInstance } from './types'; diff --git a/src/list/index.ts b/src/list/index.ts index 762978cc9..c6b95eb94 100644 --- a/src/list/index.ts +++ b/src/list/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _List from './List'; -const List = withInstall(_List); - +export const List = withInstall(_List); export default List; -export { List }; export type { ListInstance, ListDirection } from './types'; diff --git a/src/loading/index.ts b/src/loading/index.ts index f2475cffe..46b6a8f73 100644 --- a/src/loading/index.ts +++ b/src/loading/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Loading from './Loading'; -const Loading = withInstall(_Loading); - +export const Loading = withInstall(_Loading); export default Loading; -export { Loading }; export type { LoadingType } from './Loading'; diff --git a/src/locale/index.ts b/src/locale/index.ts index 9f5c4a9a2..d1fb131aa 100644 --- a/src/locale/index.ts +++ b/src/locale/index.ts @@ -10,7 +10,7 @@ const messages = reactive({ 'zh-CN': defaultMessages, }); -const Locale = { +export const Locale = { messages(): Message { return messages[lang.value]; }, @@ -26,4 +26,3 @@ const Locale = { }; export default Locale; -export { Locale }; diff --git a/src/nav-bar/index.ts b/src/nav-bar/index.ts index fa712de5b..08eed915a 100644 --- a/src/nav-bar/index.ts +++ b/src/nav-bar/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _NavBar from './NavBar'; -const NavBar = withInstall(_NavBar); - +export const NavBar = withInstall(_NavBar); export default NavBar; -export { NavBar }; diff --git a/src/notice-bar/index.ts b/src/notice-bar/index.ts index 780eae59e..7d34665ad 100644 --- a/src/notice-bar/index.ts +++ b/src/notice-bar/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _NoticeBar from './NoticeBar'; -const NoticeBar = withInstall(_NoticeBar); - +export const NoticeBar = withInstall(_NoticeBar); export default NoticeBar; -export { NoticeBar }; export type { NoticeBarMode, NoticeBarInstance } from './types'; diff --git a/src/notify/function-call.tsx b/src/notify/function-call.tsx index 733657f0c..a30bd0465 100644 --- a/src/notify/function-call.tsx +++ b/src/notify/function-call.tsx @@ -92,11 +92,11 @@ Notify.resetDefaultOptions = () => { Notify.currentOptions = defaultOptions(); }; +Notify.Component = withInstall(VanNotify); + Notify.install = (app: App) => { - app.use(withInstall(VanNotify)); + app.use(Notify.Component); app.config.globalProperties.$notify = Notify; }; -Notify.Component = withInstall(VanNotify); - export { Notify }; diff --git a/src/number-keyboard/index.ts b/src/number-keyboard/index.ts index 4130adeda..9f85c28a1 100644 --- a/src/number-keyboard/index.ts +++ b/src/number-keyboard/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _NumberKeyboard from './NumberKeyboard'; -const NumberKeyboard = withInstall(_NumberKeyboard); - +export const NumberKeyboard = withInstall(_NumberKeyboard); export default NumberKeyboard; -export { NumberKeyboard }; export type { NumberKeyboardTheme } from './NumberKeyboard'; diff --git a/src/overlay/index.ts b/src/overlay/index.ts index 1ac0504ec..e4d3f410c 100644 --- a/src/overlay/index.ts +++ b/src/overlay/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Overlay from './Overlay'; -const Overlay = withInstall(_Overlay); - +export const Overlay = withInstall(_Overlay); export default Overlay; -export { Overlay }; diff --git a/src/pagination/index.ts b/src/pagination/index.ts index a45056a67..7404377e1 100644 --- a/src/pagination/index.ts +++ b/src/pagination/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Pagination from './Pagination'; -const Pagination = withInstall(_Pagination); - +export const Pagination = withInstall(_Pagination); export default Pagination; -export { Pagination }; export type { PaginationMode } from './Pagination'; diff --git a/src/password-input/index.ts b/src/password-input/index.ts index e57f50041..30b020af1 100644 --- a/src/password-input/index.ts +++ b/src/password-input/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _PasswordInput from './PasswordInput'; -const PasswordInput = withInstall(_PasswordInput); - +export const PasswordInput = withInstall(_PasswordInput); export default PasswordInput; -export { PasswordInput }; diff --git a/src/picker/index.ts b/src/picker/index.ts index 2b8ed879d..d81b40f1b 100644 --- a/src/picker/index.ts +++ b/src/picker/index.ts @@ -1,10 +1,8 @@ import { withInstall } from '../utils'; import _Picker from './Picker'; -const Picker = withInstall(_Picker); - +export const Picker = withInstall(_Picker); export default Picker; -export { Picker }; export type { PickerColumn, PickerOption, diff --git a/src/popover/index.ts b/src/popover/index.ts index cb6b27e36..b185fa896 100644 --- a/src/popover/index.ts +++ b/src/popover/index.ts @@ -1,10 +1,8 @@ import { withInstall } from '../utils'; import _Popover from './Popover'; -const Popover = withInstall(_Popover); - +export const Popover = withInstall(_Popover); export default Popover; -export { Popover }; export type { PopoverTheme, PopoverAction, diff --git a/src/popup/index.ts b/src/popup/index.ts index 3df91a8df..7228ba773 100644 --- a/src/popup/index.ts +++ b/src/popup/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Popup from './Popup'; -const Popup = withInstall(_Popup); - +export const Popup = withInstall(_Popup); export default Popup; -export { Popup }; export type { PopupPosition, PopupCloseIconPosition } from './Popup'; diff --git a/src/progress/index.ts b/src/progress/index.ts index 3773a384f..dd5149086 100644 --- a/src/progress/index.ts +++ b/src/progress/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Progress from './Progress'; -const Progress = withInstall(_Progress); - +export const Progress = withInstall(_Progress); export default Progress; -export { Progress }; export type { ProgressInstance } from './types'; diff --git a/src/pull-refresh/index.ts b/src/pull-refresh/index.ts index 9cb6d7816..ad9f4cfec 100644 --- a/src/pull-refresh/index.ts +++ b/src/pull-refresh/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _PullRefresh from './PullRefresh'; -const PullRefresh = withInstall(_PullRefresh); - +export const PullRefresh = withInstall(_PullRefresh); export default PullRefresh; -export { PullRefresh }; diff --git a/src/radio-group/index.ts b/src/radio-group/index.ts index 46b5b1659..d9ed7e66c 100644 --- a/src/radio-group/index.ts +++ b/src/radio-group/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _RadioGroup from './RadioGroup'; -const RadioGroup = withInstall(_RadioGroup); - +export const RadioGroup = withInstall(_RadioGroup); export default RadioGroup; -export { RadioGroup }; diff --git a/src/radio/index.ts b/src/radio/index.ts index 361534913..232718798 100644 --- a/src/radio/index.ts +++ b/src/radio/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Radio from './Radio'; -const Radio = withInstall(_Radio); - +export const Radio = withInstall(_Radio); export default Radio; -export { Radio }; diff --git a/src/rate/index.ts b/src/rate/index.ts index 168e40c8b..5d3541a7a 100644 --- a/src/rate/index.ts +++ b/src/rate/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Rate from './Rate'; -const Rate = withInstall(_Rate); - +export const Rate = withInstall(_Rate); export default Rate; -export { Rate }; diff --git a/src/row/index.ts b/src/row/index.ts index 613a73fa4..17f8e71e5 100644 --- a/src/row/index.ts +++ b/src/row/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Row from './Row'; -const Row = withInstall(_Row); - +export const Row = withInstall(_Row); export default Row; -export { Row }; export type { RowAlign, RowJustify } from './Row'; diff --git a/src/search/index.ts b/src/search/index.ts index e41640e26..06b6134e2 100644 --- a/src/search/index.ts +++ b/src/search/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Search from './Search'; -const Search = withInstall(_Search); - +export const Search = withInstall(_Search); export default Search; -export { Search }; export type { SearchShape, SearchInstance } from './types'; diff --git a/src/share-sheet/index.ts b/src/share-sheet/index.ts index 8073f3e40..6eda49844 100644 --- a/src/share-sheet/index.ts +++ b/src/share-sheet/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _ShareSheet from './ShareSheet'; -const ShareSheet = withInstall(_ShareSheet); - +export const ShareSheet = withInstall(_ShareSheet); export default ShareSheet; -export { ShareSheet }; export type { ShareSheetOption, ShareSheetOptions } from './ShareSheet'; diff --git a/src/sidebar-item/index.ts b/src/sidebar-item/index.ts index d16a4f091..f7d1738fc 100644 --- a/src/sidebar-item/index.ts +++ b/src/sidebar-item/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _SidebarItem from './SidebarItem'; -const SidebarItem = withInstall(_SidebarItem); - +export const SidebarItem = withInstall(_SidebarItem); export default SidebarItem; -export { SidebarItem }; diff --git a/src/sidebar/index.ts b/src/sidebar/index.ts index 9a1a9ff40..c80462b09 100644 --- a/src/sidebar/index.ts +++ b/src/sidebar/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Sidebar from './Sidebar'; -const Sidebar = withInstall(_Sidebar); - +export const Sidebar = withInstall(_Sidebar); export default Sidebar; -export { Sidebar }; diff --git a/src/skeleton/index.ts b/src/skeleton/index.ts index a7ee7d865..0c1228482 100644 --- a/src/skeleton/index.ts +++ b/src/skeleton/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Skeleton from './Skeleton'; -const Skeleton = withInstall(_Skeleton); - +export const Skeleton = withInstall(_Skeleton); export default Skeleton; -export { Skeleton }; diff --git a/src/slider/index.ts b/src/slider/index.ts index 8fe52e8e8..f5766bf45 100644 --- a/src/slider/index.ts +++ b/src/slider/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Slider from './Slider'; -const Slider = withInstall(_Slider); - +export const Slider = withInstall(_Slider); export default Slider; -export { Slider }; diff --git a/src/step/index.ts b/src/step/index.ts index 955026e19..e048d12cb 100644 --- a/src/step/index.ts +++ b/src/step/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Step from './Step'; -const Step = withInstall(_Step); - +export const Step = withInstall(_Step); export default Step; -export { Step }; diff --git a/src/stepper/index.ts b/src/stepper/index.ts index 184ae619a..b11af383f 100644 --- a/src/stepper/index.ts +++ b/src/stepper/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Stepper, { StepperTheme } from './Stepper'; -const Stepper = withInstall(_Stepper); - +export const Stepper = withInstall(_Stepper); export default Stepper; -export { Stepper }; export type { StepperTheme }; diff --git a/src/steps/index.ts b/src/steps/index.ts index 4757f1903..375b6e217 100644 --- a/src/steps/index.ts +++ b/src/steps/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Steps from './Steps'; -const Steps = withInstall(_Steps); - +export const Steps = withInstall(_Steps); export default Steps; -export { Steps }; diff --git a/src/sticky/index.ts b/src/sticky/index.ts index 905496794..dbfc5dd7f 100644 --- a/src/sticky/index.ts +++ b/src/sticky/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Sticky from './Sticky'; -const Sticky = withInstall(_Sticky); - +export const Sticky = withInstall(_Sticky); export default Sticky; -export { Sticky }; export type { StickyPosition } from './Sticky'; diff --git a/src/submit-bar/index.ts b/src/submit-bar/index.ts index 4e4255139..10abdf84d 100644 --- a/src/submit-bar/index.ts +++ b/src/submit-bar/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _SubmitBar from './SubmitBar'; -const SubmitBar = withInstall(_SubmitBar); - +export const SubmitBar = withInstall(_SubmitBar); export default SubmitBar; -export { SubmitBar }; diff --git a/src/swipe-cell/index.ts b/src/swipe-cell/index.ts index f63aae7c3..4acde3def 100644 --- a/src/swipe-cell/index.ts +++ b/src/swipe-cell/index.ts @@ -1,10 +1,8 @@ import { withInstall } from '../utils'; import _SwipeCell from './SwipeCell'; -const SwipeCell = withInstall(_SwipeCell); - +export const SwipeCell = withInstall(_SwipeCell); export default SwipeCell; -export { SwipeCell }; export type { SwipeCellSide, SwipeCellPosition, diff --git a/src/swipe-item/index.ts b/src/swipe-item/index.ts index e4ab1dd20..e859dbce7 100644 --- a/src/swipe-item/index.ts +++ b/src/swipe-item/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _SwipeItem from './SwipeItem'; -const SwipeItem = withInstall(_SwipeItem); - +export const SwipeItem = withInstall(_SwipeItem); export default SwipeItem; -export { SwipeItem }; diff --git a/src/swipe/index.ts b/src/swipe/index.ts index 59e2f6dea..f63fb43e6 100644 --- a/src/swipe/index.ts +++ b/src/swipe/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Swipe from './Swipe'; -const Swipe = withInstall(_Swipe); - +export const Swipe = withInstall(_Swipe); export default Swipe; -export { Swipe }; export type { SwipeInstance, SwipeToOptions } from './types'; diff --git a/src/switch/index.ts b/src/switch/index.ts index 37fdc48e4..0cec22f23 100644 --- a/src/switch/index.ts +++ b/src/switch/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Switch from './Switch'; -const Switch = withInstall(_Switch); - +export const Switch = withInstall(_Switch); export default Switch; -export { Switch }; diff --git a/src/tab/index.ts b/src/tab/index.ts index 89b9f23dd..700864d57 100644 --- a/src/tab/index.ts +++ b/src/tab/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Tab from './Tab'; -const Tab = withInstall(_Tab); - +export const Tab = withInstall(_Tab); export default Tab; -export { Tab }; diff --git a/src/tabbar-item/index.ts b/src/tabbar-item/index.ts index 0540b7a56..99e55c902 100644 --- a/src/tabbar-item/index.ts +++ b/src/tabbar-item/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _TabbarItem from './TabbarItem'; -const TabbarItem = withInstall(_TabbarItem); - +export const TabbarItem = withInstall(_TabbarItem); export default TabbarItem; -export { TabbarItem }; diff --git a/src/tabbar/index.ts b/src/tabbar/index.ts index f4327e856..1f27c0ed0 100644 --- a/src/tabbar/index.ts +++ b/src/tabbar/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Tabbar from './Tabbar'; -const Tabbar = withInstall(_Tabbar); - +export const Tabbar = withInstall(_Tabbar); export default Tabbar; -export { Tabbar }; diff --git a/src/tabs/index.ts b/src/tabs/index.ts index d5b1592c4..404a6e6de 100644 --- a/src/tabs/index.ts +++ b/src/tabs/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _Tabs from './Tabs'; -const Tabs = withInstall(_Tabs); - +export const Tabs = withInstall(_Tabs); export default Tabs; -export { Tabs }; export type { TabsType, TabsInstance } from './types'; diff --git a/src/tag/index.ts b/src/tag/index.ts index 55d17a012..917c1287e 100644 --- a/src/tag/index.ts +++ b/src/tag/index.ts @@ -1,7 +1,5 @@ import { withInstall } from '../utils'; import _Tag from './Tag'; -const Tag = withInstall(_Tag); - +export const Tag = withInstall(_Tag); export default Tag; -export { Tag }; diff --git a/src/toast/function-call.tsx b/src/toast/function-call.tsx index 6de78e457..12e3f7ef7 100644 --- a/src/toast/function-call.tsx +++ b/src/toast/function-call.tsx @@ -186,7 +186,7 @@ Toast.allowMultiple = (value = true) => { }; Toast.install = (app: App) => { - app.use(withInstall(VanToast)); + app.use(withInstall(VanToast)); app.config.globalProperties.$toast = Toast; }; diff --git a/src/tree-select/index.ts b/src/tree-select/index.ts index 1c18942d3..aa692f146 100644 --- a/src/tree-select/index.ts +++ b/src/tree-select/index.ts @@ -1,8 +1,6 @@ import { withInstall } from '../utils'; import _TreeSelect from './TreeSelect'; -const TreeSelect = withInstall(_TreeSelect); - +export const TreeSelect = withInstall(_TreeSelect); export default TreeSelect; -export { TreeSelect }; export type { TreeSelectItem, TreeSelectChild } from './TreeSelect'; diff --git a/src/uploader/index.ts b/src/uploader/index.ts index 11f427d23..557704fa1 100644 --- a/src/uploader/index.ts +++ b/src/uploader/index.ts @@ -1,10 +1,8 @@ import { withInstall } from '../utils'; import _Uploader from './Uploader'; -const Uploader = withInstall(_Uploader); - +export const Uploader = withInstall(_Uploader); export default Uploader; -export { Uploader }; export type { UploaderInstance, UploaderResultType, diff --git a/src/utils/with-install.ts b/src/utils/with-install.ts index a0c5f984c..f92840b22 100644 --- a/src/utils/with-install.ts +++ b/src/utils/with-install.ts @@ -14,13 +14,12 @@ export type WithInstall = T & { install(app: App): void; } & EventShim; -// using any here because tsc will generate some weird results when using generics -export function withInstall(options: any): WithInstall { +export function withInstall(options: T) { (options as Record).install = (app: App) => { const { name } = options as any; app.component(name, options); app.component(camelize(`-${name}`), options); }; - return options; + return options as WithInstall; }