Skip to content

Commit 340f327

Browse files
authored
refactor(types): sync components types
1 parent e558f6d commit 340f327

File tree

3 files changed

+9
-44
lines changed

3 files changed

+9
-44
lines changed

packages/taro-components/types/Button.d.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,6 @@ interface ButtonProps extends StandardProps {
189189
* @supported weapp, alipay, swan, tt, jd
190190
*/
191191
onGetPhoneNumber?: CommonEventFunction<ButtonProps.onGetPhoneNumberEventDetail>
192-
/**
193-
* 手机号实时验证回调,`open-type="getRealtimePhoneNumber"` 时有效
194-
* @supported weapp
195-
*/
196-
onGetRealTimePhoneNumber?: CommonEventFunction<ButtonProps.onGetRealTimePhoneNumberEventDetail>
197192
/** 当使用开放能力时,发生错误的回调
198193
*
199194
* 生效时机:`open-type="launchApp"`
@@ -218,11 +213,6 @@ interface ButtonProps extends StandardProps {
218213
* @supported weapp
219214
*/
220215
onChooseAvatar?: CommonEventFunction
221-
/**
222-
* 用户同意隐私协议事件回调,`open-type="agreePrivacyAuthorization"`时有效
223-
* @supported weapp
224-
*/
225-
onAgreePrivacyAuthorization?: CommonEventFunction
226216
/** 点击。
227217
* 说明: 每点击一次会触发一次事件,建议自行使用代码防止重复点击,可以使用 js 防抖和节流实现。
228218
* @supported alipay
@@ -303,11 +293,6 @@ declare namespace ButtonProps {
303293
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html
304294
*/
305295
getPhoneNumber
306-
/**
307-
* 手机号实时验证,向用户申请,并在用户同意后,快速填写和实时验证手机号。(*小程序插件中不能使用*)
308-
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getRealtimePhoneNumber.html
309-
*/
310-
getRealtimePhoneNumber
311296
/** 获取用户信息,可以从回调中获取到用户信息 */
312297
getUserInfo
313298
/** 打开APP,可以通过 app-parameter 属性设定向APP传的参数
@@ -320,10 +305,6 @@ declare namespace ButtonProps {
320305
feedback
321306
/** 获取用户头像,可以从回调中获得具体信息 */
322307
chooseAvatar
323-
/**
324-
* 用户同意隐私协议按钮。可通过 bindagreeprivacyauthorization 监听用户同意隐私协议事件
325-
*/
326-
agreePrivacyAuthorization
327308
}
328309
/** 支付宝小程序专属的 open-type 合法值
329310
* @see https://opendocs.alipay.com/mini/component/button
@@ -445,9 +426,6 @@ declare namespace ButtonProps {
445426
*/
446427
sign: string
447428
}
448-
interface onGetRealTimePhoneNumberEventDetail {
449-
code: string
450-
}
451429
interface onOpenSettingEventDetail {
452430
/* 打开授权设置页的调用状态 */
453431
errMsg: string

packages/taro-components/types/ShareElement.d.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ interface ShareElementProps extends StandardProps {
66
* @deprecated 使用mapkey替换key
77
*/
88
key?: string
9-
/** 映射标记
10-
* @supported weapp
11-
*/
12-
mapkey?: string
139
/** 映射标记
1410
* @supported alipay
1511
*/

packages/taro-components/types/index.vue3.d.ts

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ import { AdCustomProps } from './AdCustom'
1818
import { AudioProps } from './Audio'
1919
import { ButtonProps } from './Button'
2020
import { CameraProps } from './Camera'
21-
import { CanvasProps } from './Canvas'
2221
import { ChannelLiveProps } from './ChannelLive'
2322
import { ChannelVideoProps } from './ChannelVideo'
23+
import { CanvasProps } from './Canvas'
2424
import { CheckboxProps } from './Checkbox'
2525
import { CheckboxGroupProps } from './CheckboxGroup'
2626
import { StandardProps } from './common'
@@ -30,20 +30,17 @@ import { CustomWrapperProps } from './CustomWrapper'
3030
import { EditorProps } from './Editor'
3131
import { FormProps } from './Form'
3232
import { FunctionalPageNavigatorProps } from './FunctionalPageNavigator'
33-
import { GridViewProps } from './GridView'
3433
import { IconProps } from './Icon'
3534
import { ImageProps } from './Image'
3635
import { InputProps } from './Input'
3736
import { KeyboardAccessoryProps } from './KeyboardAccessory'
3837
import { LabelProps } from './Label'
39-
import { ListViewProps } from './ListView'
4038
import { LivePlayerProps } from './LivePlayer'
4139
import { LivePusherProps } from './LivePusher'
4240
import { MapProps } from './Map'
4341
import { MatchMediaProps } from './MatchMedia'
4442
import { MovableAreaProps } from './MovableArea'
4543
import { MovableViewProps } from './MovableView'
46-
import { NativeSlotProps } from './NativeSlot'
4744
import { NavigationBarProps } from './NavigationBar'
4845
import { NavigatorProps } from './Navigator'
4946
import { OfficialAccountProps } from './OfficialAccount'
@@ -55,18 +52,14 @@ import {
5552
PickerRegionProps, PickerSelectorProps, PickerTimeProps
5653
} from './Picker'
5754
import { PickerViewProps } from './PickerView'
58-
import { PickerViewColumnProps } from './PickerViewColumn'
5955
import { ProgressProps } from './Progress'
6056
import { RadioProps } from './Radio'
6157
import { RadioGroupProps } from './RadioGroup'
6258
import { RichTextProps } from './RichText'
63-
import { RootPortalProps } from './RootPortal'
6459
import { ScrollViewProps } from './ScrollView'
6560
import { ShareElementProps } from './ShareElement'
6661
import { SliderProps } from './Slider'
6762
import { SlotProps } from './Slot'
68-
import { StickyHeaderProps } from './StickyHeader'
69-
import { StickySectionProps } from './StickySection'
7063
import { SwiperProps } from './Swiper'
7164
import { SwiperItemProps } from './SwiperItem'
7265
import { SwitchProps } from './Switch'
@@ -76,18 +69,16 @@ import { VideoProps } from './Video'
7669
import { ViewProps } from './View'
7770
import { VoipRoomProps } from './VoipRoom'
7871
import { WebViewProps } from './WebView'
79-
80-
/** 因为react的事件是CamelCase而vue得是Camelcase, 所以需要转换 */
81-
type OnCamelCaseToOnCamelcase<T extends string> = T extends `on${infer Rest}`
82-
? `on${Capitalize<Lowercase<Rest>>}`
83-
: T;
84-
85-
type TransformCamelCase<T extends Record<string, any>> = {
86-
[key in keyof T as OnCamelCaseToOnCamelcase<key>]: T[key]
87-
}
72+
import { RootPortalProps } from './RootPortal'
73+
import { PickerViewColumnProps } from './PickerViewColumn'
74+
import { NativeSlotProps } from './NativeSlot'
75+
import { GridViewProps } from './GridView'
76+
import { ListViewProps } from './ListView'
77+
import { StickyHeaderProps } from './StickyHeader'
78+
import { StickySectionProps } from './StickySection'
8879

8980
/** 联合类型不能用omit(比如picker) */
90-
type DistributiveOmit<T, K extends keyof T> = T extends unknown ? TransformCamelCase<Omit<T, K>> : never
81+
type DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never
9182

9283
interface SlimProps {
9384
class?: any

0 commit comments

Comments
 (0)