提交 a56eec30 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

chore(types): 更新生命周期 ts 类型

上级 74258229
...@@ -102,7 +102,7 @@ function resolveEasycom(component, easycom) { ...@@ -102,7 +102,7 @@ function resolveEasycom(component, easycom) {
return shared.isString(component) ? easycom : component; return shared.isString(component) ? easycom : component;
} }
// @ts-ignore /// <reference types="@dcloudio/types" />
const createHook = (lifecycle) => (hook, target = vue.getCurrentInstance()) => { const createHook = (lifecycle) => (hook, target = vue.getCurrentInstance()) => {
// post-create lifecycle registrations are noops during SSR // post-create lifecycle registrations are noops during SSR
!vue.isInSSRComponentSetup && vue.injectHook(lifecycle, hook, target); !vue.isInSSRComponentSetup && vue.injectHook(lifecycle, hook, target);
......
/// <reference types="@dcloudio/types" />
import { capitalize } from '@vue/shared'; import { capitalize } from '@vue/shared';
import type { ComponentInternalInstance } from '@vue/runtime-core'; import type { ComponentInternalInstance } from '@vue/runtime-core';
import { extend } from '@vue/shared'; import { extend } from '@vue/shared';
...@@ -6,34 +8,8 @@ import { isPlainObject } from '@vue/shared'; ...@@ -6,34 +8,8 @@ import { isPlainObject } from '@vue/shared';
import { ref } from 'vue'; import { ref } from 'vue';
import { shallowRef } from 'vue'; import { shallowRef } from 'vue';
declare interface AddToFavoritesContent {
title?: string;
imageUrl?: string;
query?: string;
}
declare interface AddToFavoritesOption {
webviewUrl?: string;
}
declare interface BackPressOption {
from: 'backbutton' | 'navigateBack';
}
export { capitalize } export { capitalize }
declare interface CustomShareAppMessage {
title?: string;
path?: string;
imageUrl?: string;
}
declare interface CustomShareTimeline {
title?: string;
query?: string;
imageUrl?: string;
}
export { extend } export { extend }
export declare function formatAppLog(type: 'log' | 'info' | 'debug' | 'warn' | 'error', filename: string, ...args: unknown[]): void; export declare function formatAppLog(type: 'log' | 'info' | 'debug' | 'warn' | 'error', filename: string, ...args: unknown[]): void;
...@@ -43,7 +19,8 @@ export declare function formatH5Log(type: keyof Console, filename: string, ...ar ...@@ -43,7 +19,8 @@ export declare function formatH5Log(type: keyof Console, filename: string, ...ar
/** /**
* uni 对象是跨实例的,而此处列的 API 均是需要跟当前实例关联的,比如 requireNativePlugin 获取 dom 时,依赖当前 weex 实例 * uni 对象是跨实例的,而此处列的 API 均是需要跟当前实例关联的,比如 requireNativePlugin 获取 dom 时,依赖当前 weex 实例
*/ */
export declare function getCurrentSubNVue(): any; /// <reference types="@dcloudio/types" />
export declare function getCurrentSubNVue(): UniApp.SubNVue;
export declare function getSsrGlobalData(): any; export declare function getSsrGlobalData(): any;
...@@ -63,83 +40,39 @@ declare function initUtsStaticMethod(async: boolean, opts: ProxyFunctionOptions) ...@@ -63,83 +40,39 @@ declare function initUtsStaticMethod(async: boolean, opts: ProxyFunctionOptions)
export { isPlainObject } export { isPlainObject }
declare type LaunchOption = LaunchShowOption;
declare interface LaunchShowOption {
path: string;
query: Record<string, string | undefined>;
scene: number;
shareTicket: string;
referrerInfo?: ReferrerInfo;
}
declare interface NavigationBarButtonTapOption {
index: number;
}
declare interface NavigationBarSearchInputChangedOption {
text: string;
}
declare type NavigationBarSearchInputConfirmedOption = NavigationBarSearchInputChangedOption;
declare interface NavigationBarSearchInputFocusChanged { declare interface NavigationBarSearchInputFocusChanged {
focus: boolean; focus: boolean;
} }
export declare const onAddToFavorites: (hook: onAddToFavoritesHook, target?: ComponentInternalInstance | null) => void; export declare const onAddToFavorites: (hook: (options: Page.AddToFavoritesOption) => Page.CustomFavoritesContent, target?: ComponentInternalInstance | null) => void;
declare type onAddToFavoritesHook = (options: AddToFavoritesOption) => AddToFavoritesContent | void;
declare type onAppShowHook = (options: LaunchShowOption) => void;
export declare const onBackPress: (hook: onBackPressHook, target?: ComponentInternalInstance | null) => void; export declare const onBackPress: (hook: (options: Page.BackPressOption) => any, target?: ComponentInternalInstance | null) => void;
declare type onBackPressHook = (options: BackPressOption) => boolean | void; export declare const onError: (hook: (error: string) => void, target?: ComponentInternalInstance | null) => void;
export declare const onError: (hook: onErrorHook, target?: ComponentInternalInstance | null) => void;
declare type onErrorHook = (error: string) => void;
export declare const onHide: (hook: () => any, target?: ComponentInternalInstance | null) => void; export declare const onHide: (hook: () => any, target?: ComponentInternalInstance | null) => void;
export declare const onInit: (hook: onLoadHook, target?: ComponentInternalInstance | null) => void; export declare const onInit: (hook: (query?: AnyObject | undefined) => void, target?: ComponentInternalInstance | null) => void;
export declare const onLaunch: (hook: onLaunchHook, target?: ComponentInternalInstance | null) => void;
declare type onLaunchHook = (options: LaunchOption) => void;
export declare const onLoad: (hook: onLoadHook, target?: ComponentInternalInstance | null) => void;
declare type onLoadHook = (query: Record<string, string | undefined>) => void;
export declare const onNavigationBarButtonTap: (hook: onNavigationBarButtonTapHook, target?: ComponentInternalInstance | null) => void; export declare const onLaunch: (hook: (options?: App.LaunchShowOption | undefined) => void, target?: ComponentInternalInstance | null) => void;
declare type onNavigationBarButtonTapHook = (options: NavigationBarButtonTapOption) => void; export declare const onLoad: (hook: (query?: AnyObject | undefined) => void, target?: ComponentInternalInstance | null) => void;
export declare const onNavigationBarSearchInputChanged: (hook: onNavigationBarSearchInputChangedHook, target?: ComponentInternalInstance | null) => void; export declare const onNavigationBarButtonTap: (hook: (options: Page.NavigationBarButtonTapOption) => void, target?: ComponentInternalInstance | null) => void;
declare type onNavigationBarSearchInputChangedHook = (options: NavigationBarSearchInputChangedOption) => void; export declare const onNavigationBarSearchInputChanged: (hook: (event: Page.NavigationBarSearchInputEvent) => void, target?: ComponentInternalInstance | null) => void;
export declare const onNavigationBarSearchInputClicked: (hook: () => any, target?: ComponentInternalInstance | null) => void; export declare const onNavigationBarSearchInputClicked: (hook: () => any, target?: ComponentInternalInstance | null) => void;
export declare const onNavigationBarSearchInputConfirmed: (hook: onNavigationBarSearchInputConfirmedHook, target?: ComponentInternalInstance | null) => void; export declare const onNavigationBarSearchInputConfirmed: (hook: (event: Page.NavigationBarSearchInputEvent) => void, target?: ComponentInternalInstance | null) => void;
declare type onNavigationBarSearchInputConfirmedHook = (options: NavigationBarSearchInputConfirmedOption) => void;
export declare const onNavigationBarSearchInputFocusChanged: (hook: onNavigationBarSearchInputFocusChangedHook, target?: ComponentInternalInstance | null) => void; export declare const onNavigationBarSearchInputFocusChanged: (hook: onNavigationBarSearchInputFocusChangedHook, target?: ComponentInternalInstance | null) => void;
declare type onNavigationBarSearchInputFocusChangedHook = (options: NavigationBarSearchInputFocusChanged) => void; declare type onNavigationBarSearchInputFocusChangedHook = (options: NavigationBarSearchInputFocusChanged) => void;
export declare const onPageNotFound: (hook: onPageNotFoundHook, target?: ComponentInternalInstance | null) => void; export declare const onPageNotFound: (hook: (options: App.PageNotFoundOption) => void, target?: ComponentInternalInstance | null) => void;
declare type onPageNotFoundHook = (options: PageNotFoundOption) => void;
export declare const onPageScroll: (hook: onPageScrollHook, target?: ComponentInternalInstance | null) => void;
declare type onPageScrollHook = (options: PageScrollOption) => void;
declare type onPageShowHook = () => void; export declare const onPageScroll: (hook: (options: Page.PageScrollOption) => void, target?: ComponentInternalInstance | null) => void;
export declare const onPullDownRefresh: (hook: () => any, target?: ComponentInternalInstance | null) => void; export declare const onPullDownRefresh: (hook: () => any, target?: ComponentInternalInstance | null) => void;
...@@ -147,48 +80,26 @@ export declare const onReachBottom: (hook: () => any, target?: ComponentInternal ...@@ -147,48 +80,26 @@ export declare const onReachBottom: (hook: () => any, target?: ComponentInternal
export declare const onReady: (hook: () => any, target?: ComponentInternalInstance | null) => void; export declare const onReady: (hook: () => any, target?: ComponentInternalInstance | null) => void;
export declare const onResize: (hook: onResizeHook, target?: ComponentInternalInstance | null) => void; export declare const onResize: (hook: (options: Page.ResizeOption) => void, target?: ComponentInternalInstance | null) => void;
declare type onResizeHook = (options: ResizeOption) => void;
export declare const onSaveExitState: (hook: onSaveExitStateHook, target?: ComponentInternalInstance | null) => void; export declare const onSaveExitState: (hook: onSaveExitStateHook, target?: ComponentInternalInstance | null) => void;
declare type onSaveExitStateHook = () => SaveExitState; declare type onSaveExitStateHook = () => SaveExitState;
export declare const onShareAppMessage: (hook: onShareAppMessageHook, target?: ComponentInternalInstance | null) => void; export declare const onShareAppMessage: (hook: (options: Page.ShareAppMessageOption) => Page.CustomShareContent | Promise<Omit<Page.CustomShareContent, "promise">>, target?: ComponentInternalInstance | null) => void;
declare type onShareAppMessageHook = (options: ShareAppMessageOption) => CustomShareAppMessage | void;
export declare const onShareTimeline: (hook: onShareTimelineHook, target?: ComponentInternalInstance | null) => void;
declare type onShareTimelineHook = () => CustomShareTimeline | void; export declare const onShareTimeline: (hook: () => Page.ShareTimelineContent, target?: ComponentInternalInstance | null) => void;
export declare const onShow: (hook: onAppShowHook | onPageShowHook, target?: ComponentInternalInstance | null) => void; export declare const onShow: (hook: ((options?: App.LaunchShowOption | undefined) => void) | (() => void), target?: ComponentInternalInstance | null) => void;
export declare const onTabItemTap: (hook: onTabItemTapHook, target?: ComponentInternalInstance | null) => void; export declare const onTabItemTap: (hook: (options: Page.TabItemTapOption) => void, target?: ComponentInternalInstance | null) => void;
declare type onTabItemTapHook = (options: TabItemTapOption) => void; export declare const onThemeChange: (hook: (options: UniApp.OnThemeChangeCallbackResult) => void, target?: ComponentInternalInstance | null) => void;
export declare const onThemeChange: (hook: onThemeChangeHook, target?: ComponentInternalInstance | null) => void; export declare const onUnhandledRejection: (hook: (options: UniApp.OnUnhandledRejectionCallbackResult) => void, target?: ComponentInternalInstance | null) => void;
declare type onThemeChangeHook = (options: ThemeChangeOption) => void;
export declare const onUnhandledRejection: (hook: onUnhandledRejectionHook, target?: ComponentInternalInstance | null) => void;
declare type onUnhandledRejectionHook = (options: UnhandledRejectionOption) => void;
export declare const onUnload: (hook: () => any, target?: ComponentInternalInstance | null) => void; export declare const onUnload: (hook: () => any, target?: ComponentInternalInstance | null) => void;
declare interface PageNotFoundOption {
path: string;
query: Record<string, string | undefined>;
isEntryPage: boolean;
}
declare interface PageScrollOption {
scrollTop: number;
}
declare interface Parameter { declare interface Parameter {
name: string; name: string;
type: string; type: string;
...@@ -247,20 +158,8 @@ declare interface ProxyFunctionOptions { ...@@ -247,20 +158,8 @@ declare interface ProxyFunctionOptions {
params: Parameter[]; params: Parameter[];
} }
declare interface ReferrerInfo {
appId: string;
extraData?: any;
}
export declare function requireNativePlugin(name: string): any; export declare function requireNativePlugin(name: string): any;
declare interface ResizeOption {
size: {
windowWidth: number;
windowHeight: number;
};
}
export declare function resolveEasycom(component: unknown, easycom: unknown): unknown; export declare function resolveEasycom(component: unknown, easycom: unknown): unknown;
declare interface SaveExitState { declare interface SaveExitState {
...@@ -270,29 +169,8 @@ declare interface SaveExitState { ...@@ -270,29 +169,8 @@ declare interface SaveExitState {
export declare const shallowSsrRef: SSRRef; export declare const shallowSsrRef: SSRRef;
declare interface ShareAppMessageOption {
from: 'button' | 'menu' | string;
target: any;
webViewUrl?: string;
}
declare type SSRRef = (value: unknown, key?: string, shallow?: boolean) => ReturnType<typeof ref> | ReturnType<typeof shallowRef>; declare type SSRRef = (value: unknown, key?: string, shallow?: boolean) => ReturnType<typeof ref> | ReturnType<typeof shallowRef>;
export declare const ssrRef: SSRRef; export declare const ssrRef: SSRRef;
declare interface TabItemTapOption {
index: string;
pagePath: string;
text: string;
}
declare interface ThemeChangeOption {
theme: 'dark' | 'light';
}
declare interface UnhandledRejectionOption {
promise: Promise<any>;
reason: string;
}
export { } export { }
...@@ -71,7 +71,7 @@ function resolveEasycom(component, easycom) { ...@@ -71,7 +71,7 @@ function resolveEasycom(component, easycom) {
return isString(component) ? easycom : component; return isString(component) ? easycom : component;
} }
// @ts-ignore /// <reference types="@dcloudio/types" />
const createHook = (lifecycle) => (hook, target = getCurrentInstance()) => { const createHook = (lifecycle) => (hook, target = getCurrentInstance()) => {
// post-create lifecycle registrations are noops during SSR // post-create lifecycle registrations are noops during SSR
!isInSSRComponentSetup && injectHook(lifecycle, hook, target); !isInSSRComponentSetup && injectHook(lifecycle, hook, target);
......
...@@ -31,5 +31,11 @@ ...@@ -31,5 +31,11 @@
"@dcloudio/uni-shared": "3.0.0-alpha-3060820221027004", "@dcloudio/uni-shared": "3.0.0-alpha-3060820221027004",
"@dcloudio/uni-stat": "3.0.0-alpha-3060820221027004", "@dcloudio/uni-stat": "3.0.0-alpha-3060820221027004",
"@vue/shared": "3.2.41" "@vue/shared": "3.2.41"
},
"peerDependencies": {
"@dcloudio/types": "^3.0.19"
},
"devDependencies": {
"@dcloudio/types": "^3.0.19"
} }
} }
/// <reference types="@dcloudio/types" />
import type { ComponentInternalInstance } from '@vue/runtime-core' import type { ComponentInternalInstance } from '@vue/runtime-core'
// @ts-ignore // @ts-ignore
import { isInSSRComponentSetup, injectHook, getCurrentInstance } from 'vue' import { isInSSRComponentSetup, injectHook, getCurrentInstance } from 'vue'
...@@ -32,133 +34,12 @@ import { ...@@ -32,133 +34,12 @@ import {
UniLifecycleHooks, UniLifecycleHooks,
} from '@dcloudio/uni-shared' } from '@dcloudio/uni-shared'
interface ReferrerInfo {
appId: string
extraData?: any
}
interface LaunchShowOption {
path: string
query: Record<string, string | undefined>
scene: number
shareTicket: string
referrerInfo?: ReferrerInfo
}
type LaunchOption = LaunchShowOption
type onAppShowHook = (options: LaunchShowOption) => void
type onPageShowHook = () => void
type onLaunchHook = (options: LaunchOption) => void
type onLoadHook = (query: Record<string, string | undefined>) => void
type onInitHook = onLoadHook
type onErrorHook = (error: string) => void
interface ThemeChangeOption {
theme: 'dark' | 'light'
}
type onThemeChangeHook = (options: ThemeChangeOption) => void
interface PageNotFoundOption {
path: string
query: Record<string, string | undefined>
isEntryPage: boolean
}
type onPageNotFoundHook = (options: PageNotFoundOption) => void
interface UnhandledRejectionOption {
promise: Promise<any>
reason: string
}
type onUnhandledRejectionHook = (options: UnhandledRejectionOption) => void
interface ResizeOption {
size: {
windowWidth: number
windowHeight: number
}
}
type onResizeHook = (options: ResizeOption) => void
interface BackPressOption {
from: 'backbutton' | 'navigateBack'
}
type onBackPressHook = (options: BackPressOption) => boolean | void
interface PageScrollOption {
scrollTop: number
}
type onPageScrollHook = (options: PageScrollOption) => void
interface TabItemTapOption {
index: string
pagePath: string
text: string
}
type onTabItemTapHook = (options: TabItemTapOption) => void
interface CustomShareTimeline {
title?: string
query?: string
imageUrl?: string
}
type onShareTimelineHook = () => CustomShareTimeline | void
interface AddToFavoritesOption {
webviewUrl?: string
}
interface AddToFavoritesContent {
title?: string
imageUrl?: string
query?: string
}
type onAddToFavoritesHook = (
options: AddToFavoritesOption
) => AddToFavoritesContent | void
interface ShareAppMessageOption {
from: 'button' | 'menu' | string
target: any
webViewUrl?: string
}
interface CustomShareAppMessage {
title?: string
path?: string
imageUrl?: string
}
type onShareAppMessageHook = (
options: ShareAppMessageOption
) => CustomShareAppMessage | void
interface SaveExitState { interface SaveExitState {
data: any data: any
expireTimeStamp: number expireTimeStamp: number
} }
type onSaveExitStateHook = () => SaveExitState type onSaveExitStateHook = () => SaveExitState
interface NavigationBarButtonTapOption {
index: number
}
type onNavigationBarButtonTapHook = (
options: NavigationBarButtonTapOption
) => void
interface NavigationBarSearchInputChangedOption {
text: string
}
type onNavigationBarSearchInputChangedHook = (
options: NavigationBarSearchInputChangedOption
) => void
type NavigationBarSearchInputConfirmedOption =
NavigationBarSearchInputChangedOption
type onNavigationBarSearchInputConfirmedHook = (
options: NavigationBarSearchInputConfirmedOption
) => void
interface NavigationBarSearchInputFocusChanged { interface NavigationBarSearchInputFocusChanged {
focus: boolean focus: boolean
} }
...@@ -179,32 +60,48 @@ const createHook = ...@@ -179,32 +60,48 @@ const createHook =
!isInSSRComponentSetup && injectHook(lifecycle as any, hook, target) !isInSSRComponentSetup && injectHook(lifecycle as any, hook, target)
} }
export const onShow = /*#__PURE__*/ createHook<onAppShowHook | onPageShowHook>( export const onShow = /*#__PURE__*/ createHook<
ON_SHOW Required<App.AppInstance>['onShow'] | Required<Page.PageInstance>['onShow']
) >(ON_SHOW)
export const onHide = /*#__PURE__*/ createHook(ON_HIDE) export const onHide = /*#__PURE__*/ createHook(ON_HIDE)
export const onLaunch = /*#__PURE__*/ createHook<onLaunchHook>(ON_LAUNCH) export const onLaunch =
export const onError = /*#__PURE__*/ createHook<onErrorHook>(ON_ERROR) /*#__PURE__*/ createHook<Required<App.AppInstance>['onLaunch']>(ON_LAUNCH)
export const onError =
/*#__PURE__*/ createHook<Required<App.AppInstance>['onError']>(ON_ERROR)
export const onThemeChange = export const onThemeChange =
/*#__PURE__*/ createHook<onThemeChangeHook>(ON_THEME_CHANGE) /*#__PURE__*/ createHook<Required<App.AppInstance>['onThemeChange']>(
ON_THEME_CHANGE
)
export const onPageNotFound = export const onPageNotFound =
/*#__PURE__*/ createHook<onPageNotFoundHook>(ON_PAGE_NOT_FOUND) /*#__PURE__*/ createHook<Required<App.AppInstance>['onPageNotFound']>(
export const onUnhandledRejection = ON_PAGE_NOT_FOUND
/*#__PURE__*/ createHook<onUnhandledRejectionHook>(ON_UNHANDLE_REJECTION) )
export const onInit = /*#__PURE__*/ createHook<onInitHook>(ON_INIT) export const onUnhandledRejection = /*#__PURE__*/ createHook<
Required<App.AppInstance>['onUnhandledRejection']
>(ON_UNHANDLE_REJECTION)
export const onInit =
/*#__PURE__*/ createHook<Required<Page.PageInstance>['onInit']>(ON_INIT)
// 小程序如果想在 setup 的 props 传递页面参数,需要定义 props,故同时暴露 onLoad 吧 // 小程序如果想在 setup 的 props 传递页面参数,需要定义 props,故同时暴露 onLoad 吧
export const onLoad = /*#__PURE__*/ createHook<onLoadHook>(ON_LOAD) export const onLoad =
/*#__PURE__*/ createHook<Required<Page.PageInstance>['onLoad']>(ON_LOAD)
export const onReady = /*#__PURE__*/ createHook(ON_READY) export const onReady = /*#__PURE__*/ createHook(ON_READY)
export const onUnload = /*#__PURE__*/ createHook(ON_UNLOAD) export const onUnload = /*#__PURE__*/ createHook(ON_UNLOAD)
export const onResize = /*#__PURE__*/ createHook<onResizeHook>(ON_RESIZE) export const onResize =
/*#__PURE__*/ createHook<Required<Page.PageInstance>['onResize']>(ON_RESIZE)
export const onBackPress = export const onBackPress =
/*#__PURE__*/ createHook<onBackPressHook>(ON_BACK_PRESS) /*#__PURE__*/ createHook<Required<Page.PageInstance>['onBackPress']>(
ON_BACK_PRESS
)
export const onPageScroll = export const onPageScroll =
/*#__PURE__*/ createHook<onPageScrollHook>(ON_PAGE_SCROLL) /*#__PURE__*/ createHook<Required<Page.PageInstance>['onPageScroll']>(
ON_PAGE_SCROLL
)
export const onTabItemTap = export const onTabItemTap =
/*#__PURE__*/ createHook<onTabItemTapHook>(ON_TAB_ITEM_TAP) /*#__PURE__*/ createHook<Required<Page.PageInstance>['onTabItemTap']>(
ON_TAB_ITEM_TAP
)
export const onReachBottom = /*#__PURE__*/ createHook(ON_REACH_BOTTOM) export const onReachBottom = /*#__PURE__*/ createHook(ON_REACH_BOTTOM)
export const onPullDownRefresh = /*#__PURE__*/ createHook(ON_PULL_DOWN_REFRESH) export const onPullDownRefresh = /*#__PURE__*/ createHook(ON_PULL_DOWN_REFRESH)
...@@ -212,28 +109,31 @@ export const onSaveExitState = ...@@ -212,28 +109,31 @@ export const onSaveExitState =
/*#__PURE__*/ createHook<onSaveExitStateHook>(ON_SAVE_EXIT_STATE) /*#__PURE__*/ createHook<onSaveExitStateHook>(ON_SAVE_EXIT_STATE)
export const onShareTimeline = export const onShareTimeline =
/*#__PURE__*/ createHook<onShareTimelineHook>(ON_SHARE_TIMELINE) /*#__PURE__*/ createHook<Required<Page.PageInstance>['onShareTimeline']>(
ON_SHARE_TIMELINE
)
export const onAddToFavorites = export const onAddToFavorites =
/*#__PURE__*/ createHook<onAddToFavoritesHook>(ON_ADD_TO_FAVORITES) /*#__PURE__*/ createHook<Required<Page.PageInstance>['onAddToFavorites']>(
ON_ADD_TO_FAVORITES
)
export const onShareAppMessage = export const onShareAppMessage =
/*#__PURE__*/ createHook<onShareAppMessageHook>(ON_SHARE_APP_MESSAGE) /*#__PURE__*/ createHook<Required<Page.PageInstance>['onShareAppMessage']>(
ON_SHARE_APP_MESSAGE
export const onNavigationBarButtonTap =
/*#__PURE__*/ createHook<onNavigationBarButtonTapHook>(
ON_NAVIGATION_BAR_BUTTON_TAP
) )
export const onNavigationBarSearchInputChanged = export const onNavigationBarButtonTap = /*#__PURE__*/ createHook<
/*#__PURE__*/ createHook<onNavigationBarSearchInputChangedHook>( Required<Page.PageInstance>['onNavigationBarButtonTap']
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED >(ON_NAVIGATION_BAR_BUTTON_TAP)
)
export const onNavigationBarSearchInputChanged = /*#__PURE__*/ createHook<
Required<Page.PageInstance>['onNavigationBarSearchInputChanged']
>(ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED)
export const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook( export const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
) )
export const onNavigationBarSearchInputConfirmed = export const onNavigationBarSearchInputConfirmed = /*#__PURE__*/ createHook<
/*#__PURE__*/ createHook<onNavigationBarSearchInputConfirmedHook>( Required<Page.PageInstance>['onNavigationBarSearchInputConfirmed']
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED >(ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED)
)
export const onNavigationBarSearchInputFocusChanged = export const onNavigationBarSearchInputFocusChanged =
/*#__PURE__*/ createHook<onNavigationBarSearchInputFocusChangedHook>( /*#__PURE__*/ createHook<onNavigationBarSearchInputFocusChangedHook>(
ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
......
...@@ -6,7 +6,7 @@ importers: ...@@ -6,7 +6,7 @@ importers:
specifiers: specifiers:
'@babel/core': ^7.17.10 '@babel/core': ^7.17.10
'@babel/preset-env': ^7.16.11 '@babel/preset-env': ^7.16.11
'@dcloudio/types': ^3.0.17 '@dcloudio/types': ^3.0.19
'@dcloudio/uni-api': 3.0.0-alpha-3060820221027004 '@dcloudio/uni-api': 3.0.0-alpha-3060820221027004
'@dcloudio/uni-app': 3.0.0-alpha-3060820221027004 '@dcloudio/uni-app': 3.0.0-alpha-3060820221027004
'@jest/types': ^27.0.2 '@jest/types': ^27.0.2
...@@ -58,7 +58,7 @@ importers: ...@@ -58,7 +58,7 @@ importers:
devDependencies: devDependencies:
'@babel/core': 7.19.6 '@babel/core': 7.19.6
'@babel/preset-env': 7.19.4_@babel+core@7.19.6 '@babel/preset-env': 7.19.4_@babel+core@7.19.6
'@dcloudio/types': 3.0.17 '@dcloudio/types': 3.0.19
'@dcloudio/uni-api': link:packages/uni-api '@dcloudio/uni-api': link:packages/uni-api
'@dcloudio/uni-app': link:packages/uni-app '@dcloudio/uni-app': link:packages/uni-app
'@jest/types': 27.5.1 '@jest/types': 27.5.1
...@@ -167,6 +167,7 @@ importers: ...@@ -167,6 +167,7 @@ importers:
packages/uni-app: packages/uni-app:
specifiers: specifiers:
'@dcloudio/types': ^3.0.19
'@dcloudio/uni-cloud': 3.0.0-alpha-3060820221027004 '@dcloudio/uni-cloud': 3.0.0-alpha-3060820221027004
'@dcloudio/uni-components': 3.0.0-alpha-3060820221027004 '@dcloudio/uni-components': 3.0.0-alpha-3060820221027004
'@dcloudio/uni-i18n': 3.0.0-alpha-3060820221027004 '@dcloudio/uni-i18n': 3.0.0-alpha-3060820221027004
...@@ -182,6 +183,8 @@ importers: ...@@ -182,6 +183,8 @@ importers:
'@dcloudio/uni-shared': link:../uni-shared '@dcloudio/uni-shared': link:../uni-shared
'@dcloudio/uni-stat': link:../uni-stat '@dcloudio/uni-stat': link:../uni-stat
'@vue/shared': 3.2.41 '@vue/shared': 3.2.41
devDependencies:
'@dcloudio/types': 3.0.19
packages/uni-app-plus: packages/uni-app-plus:
specifiers: specifiers:
...@@ -2149,8 +2152,8 @@ packages: ...@@ -2149,8 +2152,8 @@ packages:
resolution: {integrity: sha512-mrCMwcINy1IFjU9VUqLeWBkj404yWs5paLDttBcA+eqUjanuUQbBcTVPqlrGgkyzLXDcV2oDDZRSNxNpXi4kMQ==} resolution: {integrity: sha512-mrCMwcINy1IFjU9VUqLeWBkj404yWs5paLDttBcA+eqUjanuUQbBcTVPqlrGgkyzLXDcV2oDDZRSNxNpXi4kMQ==}
dev: true dev: true
/@dcloudio/types/3.0.17: /@dcloudio/types/3.0.19:
resolution: {integrity: sha512-8Uhejd2zvP9KVsCFPuDOGkfBXAkWyEI4BMjv2Fako6CuEC62YxocMaZCoqr+rN1cI2EVa+jR1np9XBTQyVccYA==} resolution: {integrity: sha512-j5mmKskyAxGa3yD5s+M03mRJu6IjxesHJMsXLB3p4jhd2K8D1aqHB3XDrhwPRauOTrKkQSGF14bp8oQsS2t4tA==}
dev: true dev: true
/@esbuild/android-arm/0.15.12: /@esbuild/android-arm/0.15.12:
...@@ -5223,7 +5226,7 @@ packages: ...@@ -5223,7 +5226,7 @@ packages:
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==} resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==}
/graceful-fs/4.2.9: /graceful-fs/4.2.9:
resolution: {integrity: sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==, registry: https://registry.yarnpkg.com/} resolution: {integrity: sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==, registry: https://registry.yarnpkg.com/, tarball: https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.9.tgz}
dev: true dev: true
/has-flag/3.0.0: /has-flag/3.0.0:
......
...@@ -21,10 +21,10 @@ import { ...@@ -21,10 +21,10 @@ import {
import { expectType } from './' import { expectType } from './'
describe('apiLifecycle', () => { describe('apiLifecycle', () => {
onLaunch(({ path, query, scene }) => { onLaunch((options) => {
expectType<string>(path) expectType<string>(options!.path)
expectType<Record<string, string | undefined>>(query) expectType<Record<string, string | undefined>>(options!.query)
expectType<number>(scene) expectType<number>(options!.scene)
}) })
onError((err) => { onError((err) => {
expectType<string>(err) expectType<string>(err)
...@@ -40,15 +40,15 @@ describe('apiLifecycle', () => { ...@@ -40,15 +40,15 @@ describe('apiLifecycle', () => {
expectType<Promise<any>>(promise) expectType<Promise<any>>(promise)
expectType<string>(reason) expectType<string>(reason)
}) })
onShow(({ path }) => { onShow((option) => {
expectType<string>(path) expectType<string>(option!.path)
}) })
onLoad((options) => { onLoad((options) => {
expectType<string | undefined>(options.a) expectType<any>(options!.a)
}) })
onResize(({ size: { windowHeight, windowWidth } }) => { onResize((res) => {
expectType<number>(windowHeight) expectType<number>(res.size!.windowHeight)
expectType<number>(windowWidth) expectType<number>(res.size!.windowWidth)
}) })
onBackPress(({ from }) => { onBackPress(({ from }) => {
expectType<'backbutton' | 'navigateBack'>(from) expectType<'backbutton' | 'navigateBack'>(from)
...@@ -57,11 +57,10 @@ describe('apiLifecycle', () => { ...@@ -57,11 +57,10 @@ describe('apiLifecycle', () => {
expectType<number>(scrollTop) expectType<number>(scrollTop)
}) })
onTabItemTap(({ index, pagePath, text }) => { onTabItemTap(({ index, pagePath, text }) => {
expectType<string>(index) expectType<number>(index)
expectType<string>(pagePath) expectType<string>(pagePath)
expectType<string>(text) expectType<string>(text)
}) })
onShareTimeline(() => {})
onShareTimeline(() => { onShareTimeline(() => {
return { return {
title: '', title: '',
...@@ -69,7 +68,6 @@ describe('apiLifecycle', () => { ...@@ -69,7 +68,6 @@ describe('apiLifecycle', () => {
imageUrl: '', imageUrl: '',
} }
}) })
onAddToFavorites(() => {})
onAddToFavorites(({ webviewUrl }) => { onAddToFavorites(({ webviewUrl }) => {
expectType<string | undefined>(webviewUrl) expectType<string | undefined>(webviewUrl)
return { return {
...@@ -78,7 +76,6 @@ describe('apiLifecycle', () => { ...@@ -78,7 +76,6 @@ describe('apiLifecycle', () => {
imageUrl: '', imageUrl: '',
} }
}) })
onShareAppMessage(() => {})
onShareAppMessage(({ from, target, webViewUrl }) => { onShareAppMessage(({ from, target, webViewUrl }) => {
expectType<string>(from) expectType<string>(from)
expectType<any>(target) expectType<any>(target)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册