diff --git a/package.json b/package.json index 8b75dae017bf0431c116805b93337f01e424cdae..d0b89380c5cc9a0f40e916491f306e058190a64a 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "devDependencies": { "@babel/core": "^7.17.10", "@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-app": "3.0.0-alpha-3060820221027004", "@jest/types": "^27.0.2", diff --git a/packages/uni-app/dist/uni-app.cjs.js b/packages/uni-app/dist/uni-app.cjs.js index f3c44997088f2bd6d624c0c358c67e1413997f83..71275d2632ce0e2f96aa4eb7332d053ae95ad8b0 100644 --- a/packages/uni-app/dist/uni-app.cjs.js +++ b/packages/uni-app/dist/uni-app.cjs.js @@ -102,7 +102,7 @@ function resolveEasycom(component, easycom) { return shared.isString(component) ? easycom : component; } -// @ts-ignore +/// const createHook = (lifecycle) => (hook, target = vue.getCurrentInstance()) => { // post-create lifecycle registrations are noops during SSR !vue.isInSSRComponentSetup && vue.injectHook(lifecycle, hook, target); diff --git a/packages/uni-app/dist/uni-app.d.ts b/packages/uni-app/dist/uni-app.d.ts index 8c8091319d275d7eaff10613a7f871262684f3df..dcba46aa7ead6a280fa7a746dff1b1724a340156 100644 --- a/packages/uni-app/dist/uni-app.d.ts +++ b/packages/uni-app/dist/uni-app.d.ts @@ -1,3 +1,5 @@ +/// + import { capitalize } from '@vue/shared'; import type { ComponentInternalInstance } from '@vue/runtime-core'; import { extend } from '@vue/shared'; @@ -6,34 +8,8 @@ import { isPlainObject } from '@vue/shared'; import { ref } 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 } -declare interface CustomShareAppMessage { - title?: string; - path?: string; - imageUrl?: string; -} - -declare interface CustomShareTimeline { - title?: string; - query?: string; - imageUrl?: string; -} - export { extend } 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 /** * uni 对象是跨实例的,而此处列的 API 均是需要跟当前实例关联的,比如 requireNativePlugin 获取 dom 时,依赖当前 weex 实例 */ -export declare function getCurrentSubNVue(): any; +/// +export declare function getCurrentSubNVue(): UniApp.SubNVue; export declare function getSsrGlobalData(): any; @@ -63,83 +40,39 @@ declare function initUtsStaticMethod(async: boolean, opts: ProxyFunctionOptions) export { isPlainObject } -declare type LaunchOption = LaunchShowOption; - -declare interface LaunchShowOption { - path: string; - query: Record; - scene: number; - shareTicket: string; - referrerInfo?: ReferrerInfo; -} - -declare interface NavigationBarButtonTapOption { - index: number; -} - -declare interface NavigationBarSearchInputChangedOption { - text: string; -} - -declare type NavigationBarSearchInputConfirmedOption = NavigationBarSearchInputChangedOption; - declare interface NavigationBarSearchInputFocusChanged { focus: boolean; } -export declare const onAddToFavorites: (hook: onAddToFavoritesHook, target?: ComponentInternalInstance | null) => void; - -declare type onAddToFavoritesHook = (options: AddToFavoritesOption) => AddToFavoritesContent | void; - -declare type onAppShowHook = (options: LaunchShowOption) => void; +export declare const onAddToFavorites: (hook: (options: Page.AddToFavoritesOption) => Page.CustomFavoritesContent, target?: ComponentInternalInstance | null) => 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: onErrorHook, target?: ComponentInternalInstance | null) => void; - -declare type onErrorHook = (error: string) => void; +export declare const onError: (hook: (error: string) => void, 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 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) => void; +export declare const onInit: (hook: (query?: AnyObject | undefined) => void, target?: ComponentInternalInstance | null) => 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 onNavigationBarSearchInputConfirmed: (hook: onNavigationBarSearchInputConfirmedHook, target?: ComponentInternalInstance | null) => void; - -declare type onNavigationBarSearchInputConfirmedHook = (options: NavigationBarSearchInputConfirmedOption) => void; +export declare const onNavigationBarSearchInputConfirmed: (hook: (event: Page.NavigationBarSearchInputEvent) => void, target?: ComponentInternalInstance | null) => void; export declare const onNavigationBarSearchInputFocusChanged: (hook: onNavigationBarSearchInputFocusChangedHook, target?: ComponentInternalInstance | null) => void; declare type onNavigationBarSearchInputFocusChangedHook = (options: NavigationBarSearchInputFocusChanged) => void; -export declare const onPageNotFound: (hook: onPageNotFoundHook, 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; +export declare const onPageNotFound: (hook: (options: App.PageNotFoundOption) => void, target?: ComponentInternalInstance | null) => 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; @@ -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 onResize: (hook: onResizeHook, target?: ComponentInternalInstance | null) => void; - -declare type onResizeHook = (options: ResizeOption) => void; +export declare const onResize: (hook: (options: Page.ResizeOption) => void, target?: ComponentInternalInstance | null) => void; export declare const onSaveExitState: (hook: onSaveExitStateHook, target?: ComponentInternalInstance | null) => void; declare type onSaveExitStateHook = () => SaveExitState; -export declare const onShareAppMessage: (hook: onShareAppMessageHook, target?: ComponentInternalInstance | null) => void; - -declare type onShareAppMessageHook = (options: ShareAppMessageOption) => CustomShareAppMessage | void; - -export declare const onShareTimeline: (hook: onShareTimelineHook, target?: ComponentInternalInstance | null) => void; +export declare const onShareAppMessage: (hook: (options: Page.ShareAppMessageOption) => Page.CustomShareContent | Promise>, 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; - -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 onUnhandledRejection: (hook: (options: UniApp.OnUnhandledRejectionCallbackResult) => void, target?: ComponentInternalInstance | null) => void; export declare const onUnload: (hook: () => any, target?: ComponentInternalInstance | null) => void; -declare interface PageNotFoundOption { - path: string; - query: Record; - isEntryPage: boolean; -} - -declare interface PageScrollOption { - scrollTop: number; -} - declare interface Parameter { name: string; type: string; @@ -247,20 +158,8 @@ declare interface ProxyFunctionOptions { params: Parameter[]; } -declare interface ReferrerInfo { - appId: string; - extraData?: 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; declare interface SaveExitState { @@ -270,29 +169,8 @@ declare interface SaveExitState { 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 | ReturnType; 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; - reason: string; -} - export { } diff --git a/packages/uni-app/dist/uni-app.es.js b/packages/uni-app/dist/uni-app.es.js index 95b6341425832136d7b70a918ea3e1c4d3344d66..46315e0f0cc4a36ead7f9968d1162ab88563ff83 100644 --- a/packages/uni-app/dist/uni-app.es.js +++ b/packages/uni-app/dist/uni-app.es.js @@ -71,7 +71,7 @@ function resolveEasycom(component, easycom) { return isString(component) ? easycom : component; } -// @ts-ignore +/// const createHook = (lifecycle) => (hook, target = getCurrentInstance()) => { // post-create lifecycle registrations are noops during SSR !isInSSRComponentSetup && injectHook(lifecycle, hook, target); diff --git a/packages/uni-app/package.json b/packages/uni-app/package.json index 8ad8fd99b000d840257fd5ca8f2df09e2323224f..584e9db62b0939ccbf3c9233fa73a9b22e6e7ba8 100644 --- a/packages/uni-app/package.json +++ b/packages/uni-app/package.json @@ -31,5 +31,11 @@ "@dcloudio/uni-shared": "3.0.0-alpha-3060820221027004", "@dcloudio/uni-stat": "3.0.0-alpha-3060820221027004", "@vue/shared": "3.2.41" + }, + "peerDependencies": { + "@dcloudio/types": "^3.0.19" + }, + "devDependencies": { + "@dcloudio/types": "^3.0.19" } } diff --git a/packages/uni-app/src/apiLifecycle.ts b/packages/uni-app/src/apiLifecycle.ts index 96fc7b58a437b44dc6c7518b3c8737d3d97a7194..3c9da533428b55cb354e35b2020fc42f3077c3ae 100644 --- a/packages/uni-app/src/apiLifecycle.ts +++ b/packages/uni-app/src/apiLifecycle.ts @@ -1,3 +1,5 @@ +/// + import type { ComponentInternalInstance } from '@vue/runtime-core' // @ts-ignore import { isInSSRComponentSetup, injectHook, getCurrentInstance } from 'vue' @@ -32,133 +34,12 @@ import { UniLifecycleHooks, } from '@dcloudio/uni-shared' -interface ReferrerInfo { - appId: string - extraData?: any -} - -interface LaunchShowOption { - path: string - query: Record - 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) => 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 - isEntryPage: boolean -} -type onPageNotFoundHook = (options: PageNotFoundOption) => void - -interface UnhandledRejectionOption { - promise: Promise - 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 { data: any expireTimeStamp: number } 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 { focus: boolean } @@ -179,32 +60,48 @@ const createHook = !isInSSRComponentSetup && injectHook(lifecycle as any, hook, target) } -export const onShow = /*#__PURE__*/ createHook( - ON_SHOW -) +export const onShow = /*#__PURE__*/ createHook< + Required['onShow'] | Required['onShow'] +>(ON_SHOW) export const onHide = /*#__PURE__*/ createHook(ON_HIDE) -export const onLaunch = /*#__PURE__*/ createHook(ON_LAUNCH) -export const onError = /*#__PURE__*/ createHook(ON_ERROR) +export const onLaunch = + /*#__PURE__*/ createHook['onLaunch']>(ON_LAUNCH) +export const onError = + /*#__PURE__*/ createHook['onError']>(ON_ERROR) export const onThemeChange = - /*#__PURE__*/ createHook(ON_THEME_CHANGE) + /*#__PURE__*/ createHook['onThemeChange']>( + ON_THEME_CHANGE + ) export const onPageNotFound = - /*#__PURE__*/ createHook(ON_PAGE_NOT_FOUND) -export const onUnhandledRejection = - /*#__PURE__*/ createHook(ON_UNHANDLE_REJECTION) -export const onInit = /*#__PURE__*/ createHook(ON_INIT) + /*#__PURE__*/ createHook['onPageNotFound']>( + ON_PAGE_NOT_FOUND + ) +export const onUnhandledRejection = /*#__PURE__*/ createHook< + Required['onUnhandledRejection'] +>(ON_UNHANDLE_REJECTION) +export const onInit = + /*#__PURE__*/ createHook['onInit']>(ON_INIT) // 小程序如果想在 setup 的 props 传递页面参数,需要定义 props,故同时暴露 onLoad 吧 -export const onLoad = /*#__PURE__*/ createHook(ON_LOAD) +export const onLoad = + /*#__PURE__*/ createHook['onLoad']>(ON_LOAD) export const onReady = /*#__PURE__*/ createHook(ON_READY) export const onUnload = /*#__PURE__*/ createHook(ON_UNLOAD) -export const onResize = /*#__PURE__*/ createHook(ON_RESIZE) +export const onResize = + /*#__PURE__*/ createHook['onResize']>(ON_RESIZE) export const onBackPress = - /*#__PURE__*/ createHook(ON_BACK_PRESS) + /*#__PURE__*/ createHook['onBackPress']>( + ON_BACK_PRESS + ) export const onPageScroll = - /*#__PURE__*/ createHook(ON_PAGE_SCROLL) + /*#__PURE__*/ createHook['onPageScroll']>( + ON_PAGE_SCROLL + ) export const onTabItemTap = - /*#__PURE__*/ createHook(ON_TAB_ITEM_TAP) + /*#__PURE__*/ createHook['onTabItemTap']>( + ON_TAB_ITEM_TAP + ) export const onReachBottom = /*#__PURE__*/ createHook(ON_REACH_BOTTOM) export const onPullDownRefresh = /*#__PURE__*/ createHook(ON_PULL_DOWN_REFRESH) @@ -212,28 +109,31 @@ export const onSaveExitState = /*#__PURE__*/ createHook(ON_SAVE_EXIT_STATE) export const onShareTimeline = - /*#__PURE__*/ createHook(ON_SHARE_TIMELINE) + /*#__PURE__*/ createHook['onShareTimeline']>( + ON_SHARE_TIMELINE + ) export const onAddToFavorites = - /*#__PURE__*/ createHook(ON_ADD_TO_FAVORITES) + /*#__PURE__*/ createHook['onAddToFavorites']>( + ON_ADD_TO_FAVORITES + ) export const onShareAppMessage = - /*#__PURE__*/ createHook(ON_SHARE_APP_MESSAGE) - -export const onNavigationBarButtonTap = - /*#__PURE__*/ createHook( - ON_NAVIGATION_BAR_BUTTON_TAP + /*#__PURE__*/ createHook['onShareAppMessage']>( + ON_SHARE_APP_MESSAGE ) -export const onNavigationBarSearchInputChanged = - /*#__PURE__*/ createHook( - ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED - ) +export const onNavigationBarButtonTap = /*#__PURE__*/ createHook< + Required['onNavigationBarButtonTap'] +>(ON_NAVIGATION_BAR_BUTTON_TAP) + +export const onNavigationBarSearchInputChanged = /*#__PURE__*/ createHook< + Required['onNavigationBarSearchInputChanged'] +>(ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED) export const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook( ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED ) -export const onNavigationBarSearchInputConfirmed = - /*#__PURE__*/ createHook( - ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED - ) +export const onNavigationBarSearchInputConfirmed = /*#__PURE__*/ createHook< + Required['onNavigationBarSearchInputConfirmed'] +>(ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED) export const onNavigationBarSearchInputFocusChanged = /*#__PURE__*/ createHook( ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 511cf9e7caa4979260b588a7f512186ddcaa1647..940708f99962586cdf07a6017871990ff35b4a3e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,7 +6,7 @@ importers: specifiers: '@babel/core': ^7.17.10 '@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-app': 3.0.0-alpha-3060820221027004 '@jest/types': ^27.0.2 @@ -58,7 +58,7 @@ importers: devDependencies: '@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-app': link:packages/uni-app '@jest/types': 27.5.1 @@ -167,6 +167,7 @@ importers: packages/uni-app: specifiers: + '@dcloudio/types': ^3.0.19 '@dcloudio/uni-cloud': 3.0.0-alpha-3060820221027004 '@dcloudio/uni-components': 3.0.0-alpha-3060820221027004 '@dcloudio/uni-i18n': 3.0.0-alpha-3060820221027004 @@ -182,6 +183,8 @@ importers: '@dcloudio/uni-shared': link:../uni-shared '@dcloudio/uni-stat': link:../uni-stat '@vue/shared': 3.2.41 + devDependencies: + '@dcloudio/types': 3.0.19 packages/uni-app-plus: specifiers: @@ -2149,8 +2152,8 @@ packages: resolution: {integrity: sha512-mrCMwcINy1IFjU9VUqLeWBkj404yWs5paLDttBcA+eqUjanuUQbBcTVPqlrGgkyzLXDcV2oDDZRSNxNpXi4kMQ==} dev: true - /@dcloudio/types/3.0.17: - resolution: {integrity: sha512-8Uhejd2zvP9KVsCFPuDOGkfBXAkWyEI4BMjv2Fako6CuEC62YxocMaZCoqr+rN1cI2EVa+jR1np9XBTQyVccYA==} + /@dcloudio/types/3.0.19: + resolution: {integrity: sha512-j5mmKskyAxGa3yD5s+M03mRJu6IjxesHJMsXLB3p4jhd2K8D1aqHB3XDrhwPRauOTrKkQSGF14bp8oQsS2t4tA==} dev: true /@esbuild/android-arm/0.15.12: @@ -5223,7 +5226,7 @@ packages: resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==} /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 /has-flag/3.0.0: diff --git a/test-dts/uni-app.test-d.ts b/test-dts/uni-app.test-d.ts index e4b0a8e000671e42671b906c55005248832bda83..30eba53e1f4ef04ca978a3cb254ec0932e844ed2 100644 --- a/test-dts/uni-app.test-d.ts +++ b/test-dts/uni-app.test-d.ts @@ -21,10 +21,10 @@ import { import { expectType } from './' describe('apiLifecycle', () => { - onLaunch(({ path, query, scene }) => { - expectType(path) - expectType>(query) - expectType(scene) + onLaunch((options) => { + expectType(options!.path) + expectType>(options!.query) + expectType(options!.scene) }) onError((err) => { expectType(err) @@ -40,15 +40,15 @@ describe('apiLifecycle', () => { expectType>(promise) expectType(reason) }) - onShow(({ path }) => { - expectType(path) + onShow((option) => { + expectType(option!.path) }) onLoad((options) => { - expectType(options.a) + expectType(options!.a) }) - onResize(({ size: { windowHeight, windowWidth } }) => { - expectType(windowHeight) - expectType(windowWidth) + onResize((res) => { + expectType(res.size!.windowHeight) + expectType(res.size!.windowWidth) }) onBackPress(({ from }) => { expectType<'backbutton' | 'navigateBack'>(from) @@ -57,11 +57,10 @@ describe('apiLifecycle', () => { expectType(scrollTop) }) onTabItemTap(({ index, pagePath, text }) => { - expectType(index) + expectType(index) expectType(pagePath) expectType(text) }) - onShareTimeline(() => {}) onShareTimeline(() => { return { title: '', @@ -69,7 +68,6 @@ describe('apiLifecycle', () => { imageUrl: '', } }) - onAddToFavorites(() => {}) onAddToFavorites(({ webviewUrl }) => { expectType(webviewUrl) return { @@ -78,7 +76,6 @@ describe('apiLifecycle', () => { imageUrl: '', } }) - onShareAppMessage(() => {}) onShareAppMessage(({ from, target, webViewUrl }) => { expectType(from) expectType(target)